mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
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: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
1712be05a8
commit
248376b1b1
@ -1812,19 +1812,23 @@ 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)
|
||||
switch (type) {
|
||||
case TC_SETUP_QDISC_TAPRIO: {
|
||||
struct tc_taprio_qopt_offload *taprio = type_data;
|
||||
|
||||
if (!hellcreek_validate_schedule(hellcreek, taprio))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (taprio->enable)
|
||||
return hellcreek_port_set_schedule(ds, port, taprio);
|
||||
|
||||
return hellcreek_port_del_schedule(ds, port);
|
||||
}
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (!hellcreek_validate_schedule(hellcreek, taprio))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (taprio->enable)
|
||||
return hellcreek_port_set_schedule(ds, port, taprio);
|
||||
|
||||
return hellcreek_port_del_schedule(ds, port);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct dsa_switch_ops hellcreek_ds_ops = {
|
||||
|
Loading…
Reference in New Issue
Block a user