Skip to content

Commit

Permalink
dpaa2-eth: move the mqprio setup into a separate function
Browse files Browse the repository at this point in the history
Move the setup done for MQPRIO into a separate function so that
with the addition of another offload we do not crowd
dpaa2_eth_setup_tc(). After this restructuring it's easier to see what
is supported in terms of Qdisc offloading.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ioana Ciornei authored and David S. Miller committed Jul 21, 2020
1 parent c1d069e commit e3ec13b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
Original file line number Diff line number Diff line change
@@ -2213,17 +2213,13 @@ static int update_xps(struct dpaa2_eth_priv *priv)
return err;
}

static int dpaa2_eth_setup_tc(struct net_device *net_dev,
enum tc_setup_type type, void *type_data)
static int dpaa2_eth_setup_mqprio(struct net_device *net_dev,
struct tc_mqprio_qopt *mqprio)
{
struct dpaa2_eth_priv *priv = netdev_priv(net_dev);
struct tc_mqprio_qopt *mqprio = type_data;
u8 num_tc, num_queues;
int i;

if (type != TC_SETUP_QDISC_MQPRIO)
return -EOPNOTSUPP;

mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS;
num_queues = dpaa2_eth_queue_count(priv);
num_tc = mqprio->num_tc;
@@ -2255,6 +2251,17 @@ static int dpaa2_eth_setup_tc(struct net_device *net_dev,
return 0;
}

static int dpaa2_eth_setup_tc(struct net_device *net_dev,
enum tc_setup_type type, void *type_data)
{
switch (type) {
case TC_SETUP_QDISC_MQPRIO:
return dpaa2_eth_setup_mqprio(net_dev, type_data);
default:
return -EOPNOTSUPP;
}
}

static const struct net_device_ops dpaa2_eth_ops = {
.ndo_open = dpaa2_eth_open,
.ndo_start_xmit = dpaa2_eth_tx,

0 comments on commit e3ec13b

Please sign in to comment.