Commit 248376b1 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski
Browse files

net: dsa: hellcreek: refactor hellcreek_port_setup_tc() to use switch/case



The following patch will need to make this function also respond to
TC_QUERY_BASE, so make the processing more structured around the
tc_setup_type.

Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: default avatarKurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 1712be05
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -1812,11 +1812,11 @@ static bool hellcreek_validate_schedule(struct hellcreek *hellcreek,
static int hellcreek_port_setup_tc(struct dsa_switch *ds, int port,
				   enum tc_setup_type type, void *type_data)
{
	struct tc_taprio_qopt_offload *taprio = type_data;
	struct hellcreek *hellcreek = ds->priv;

	if (type != TC_SETUP_QDISC_TAPRIO)
		return -EOPNOTSUPP;
	switch (type) {
	case TC_SETUP_QDISC_TAPRIO: {
		struct tc_taprio_qopt_offload *taprio = type_data;

		if (!hellcreek_validate_schedule(hellcreek, taprio))
			return -EOPNOTSUPP;
@@ -1826,6 +1826,10 @@ static int hellcreek_port_setup_tc(struct dsa_switch *ds, int port,

		return hellcreek_port_del_schedule(ds, port);
	}
	default:
		return -EOPNOTSUPP;
	}
}

static const struct dsa_switch_ops hellcreek_ds_ops = {
	.devlink_info_get      = hellcreek_devlink_info_get,