diff options
author | Amritha Nambiar <amritha.nambiar@intel.com> | 2017-03-15 10:39:25 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-03-15 15:20:27 -0700 |
commit | 56f36acd215cf7c28372b2fdb4f33f6900e97e05 (patch) | |
tree | 449ec9c837c24b8a8ca5b199abe7bad31bfd84f3 /drivers/net/ethernet/freescale | |
parent | 2026fecf516bc04df20cb50874957cd8c364fb4e (diff) | |
download | linux-56f36acd215cf7c28372b2fdb4f33f6900e97e05.tar.gz linux-56f36acd215cf7c28372b2fdb4f33f6900e97e05.tar.bz2 linux-56f36acd215cf7c28372b2fdb4f33f6900e97e05.zip |
mqprio: Modify mqprio to pass user parameters via ndo_setup_tc.
The configurable priority to traffic class mapping and the user specified
queue ranges are used to configure the traffic class, overriding the
hardware defaults when the 'hw' option is set to 0. However, when the 'hw'
option is non-zero, the hardware QOS defaults are used.
This patch makes it so that we can pass the data the user provided to
ndo_setup_tc. This allows us to pull in the queue configuration if the
user requested it as well as any additional hardware offload type
requested by using a value other than 1 for the hw value.
Finally it also provides a means for the device driver to return the level
supported for the offload type via the qopt->hw value. Previously we were
just always assuming the value to be 1, in the future values beyond just 1
may be supported.
Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale')
-rw-r--r-- | drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index aa769cbc7425..d4bb8bf86a45 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -346,33 +346,37 @@ static int dpaa_setup_tc(struct net_device *net_dev, u32 handle, __be16 proto, struct tc_to_netdev *tc) { struct dpaa_priv *priv = netdev_priv(net_dev); + u8 num_tc; int i; if (tc->type != TC_SETUP_MQPRIO) return -EINVAL; - if (tc->tc == priv->num_tc) + tc->mqprio->hw = TC_MQPRIO_HW_OFFLOAD_TCS; + num_tc = tc->mqprio->num_tc; + + if (num_tc == priv->num_tc) return 0; - if (!tc->tc) { + if (!num_tc) { netdev_reset_tc(net_dev); goto out; } - if (tc->tc > DPAA_TC_NUM) { + if (num_tc > DPAA_TC_NUM) { netdev_err(net_dev, "Too many traffic classes: max %d supported.\n", DPAA_TC_NUM); return -EINVAL; } - netdev_set_num_tc(net_dev, tc->tc); + netdev_set_num_tc(net_dev, num_tc); - for (i = 0; i < tc->tc; i++) + for (i = 0; i < num_tc; i++) netdev_set_tc_queue(net_dev, i, DPAA_TC_TXQ_NUM, i * DPAA_TC_TXQ_NUM); out: - priv->num_tc = tc->tc ? tc->tc : 1; + priv->num_tc = num_tc ? : 1; netif_set_real_num_tx_queues(net_dev, priv->num_tc * DPAA_TC_TXQ_NUM); return 0; } |