From: Madalin Bucur <madalin.bucur@nxp.com>
To: <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <davem@davemloft.net>,
<camelia.groza@nxp.com>, <linuxppc-dev@lists.ozlabs.org>,
Madalin Bucur <madalin.bucur@nxp.com>
Subject: [PATCH 9/9] dpaa_eth: enable multiple Tx traffic classes
Date: Tue, 21 Feb 2017 13:52:54 +0200 [thread overview]
Message-ID: <1487677974-13678-10-git-send-email-madalin.bucur@nxp.com> (raw)
In-Reply-To: <1487677974-13678-1-git-send-email-madalin.bucur@nxp.com>
From: Camelia Groza <camelia.groza@nxp.com>
Implement the setup_tc ndo to configure prioritised Tx traffic classes.
Priorities range from 0 (lowest) to 3 (highest). The driver assigns
NR_CPUS queues to each traffic class.
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 36 ++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index ac75d09..1b3ea38 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -342,6 +342,41 @@ static void dpaa_get_stats64(struct net_device *net_dev,
}
}
+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);
+ int i;
+
+ if (tc->type != TC_SETUP_MQPRIO)
+ return -EINVAL;
+
+ if (tc->tc == priv->num_tc)
+ return 0;
+
+ if (!tc->tc) {
+ netdev_reset_tc(net_dev);
+ goto out;
+ }
+
+ if (tc->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);
+
+ for (i = 0; i < tc->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;
+ netif_set_real_num_tx_queues(net_dev, priv->num_tc * DPAA_TC_TXQ_NUM);
+ return 0;
+}
+
static struct mac_device *dpaa_mac_dev_get(struct platform_device *pdev)
{
struct platform_device *of_dev;
@@ -2417,6 +2452,7 @@ static const struct net_device_ops dpaa_ops = {
.ndo_validate_addr = eth_validate_addr,
.ndo_set_rx_mode = dpaa_set_rx_mode,
.ndo_do_ioctl = dpaa_ioctl,
+ .ndo_setup_tc = dpaa_setup_tc,
};
static int dpaa_napi_add(struct net_device *net_dev)
--
2.1.0
next prev parent reply other threads:[~2017-02-21 11:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 11:52 [PATCH 0/9] QorIQ DPAA 1 updates Madalin Bucur
2017-02-21 11:52 ` [PATCH 1/9] fsl/fman: parse result data is big endian Madalin Bucur
2017-02-21 11:52 ` [PATCH 2/9] fsl/fman: set HW parser as BMI next engine Madalin Bucur
2017-02-21 11:52 ` [PATCH 3/9] fsl/fman: remove wrong free Madalin Bucur
2017-02-21 11:52 ` [PATCH 4/9] fsl/fman: enlarge FIFO to allow for the 5th port Madalin Bucur
2017-02-21 11:52 ` [PATCH 5/9] dpaa_eth: remove redundant initialization Madalin Bucur
2017-02-21 11:52 ` [PATCH 6/9] dpaa_eth: enable Rx checksum offload Madalin Bucur
2017-02-21 11:52 ` [PATCH 7/9] dpaa_eth: do not ignore port api return value Madalin Bucur
2017-02-21 11:52 ` [PATCH 8/9] dpaa_eth: add four prioritised Tx traffic classes Madalin Bucur
2017-02-21 11:52 ` Madalin Bucur [this message]
2017-02-21 18:19 ` [PATCH 0/9] QorIQ DPAA 1 updates David Miller
2017-02-22 8:01 ` Madalin-Cristian Bucur
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1487677974-13678-10-git-send-email-madalin.bucur@nxp.com \
--to=madalin.bucur@nxp.com \
--cc=camelia.groza@nxp.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).