netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ruxandra.radulescu@nxp.com
Cc: netdev@vger.kernel.org, ioana.ciornei@nxp.com
Subject: Re: [PATCH net-next v2 2/3] dpaa2-eth: Support multiple traffic classes on Tx
Date: Thu, 06 Jun 2019 11:02:33 -0700 (PDT)	[thread overview]
Message-ID: <20190606.110233.2117483278297401420.davem@davemloft.net> (raw)
In-Reply-To: <1559811029-28002-3-git-send-email-ruxandra.radulescu@nxp.com>

From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Date: Thu,  6 Jun 2019 11:50:28 +0300

> DPNI objects can have multiple traffic classes, as reflected by
> the num_tc attribute. Until now we ignored its value and only
> used traffic class 0.
> 
> This patch adds support for multiple Tx traffic classes; the skb
> priority information received from the stack is used to select the
> hardware Tx queue on which to enqueue the frame.
> 
> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
> ---
> v2: Extra processing on the fast path happens only when TC is used
> 
>  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 47 ++++++++++++++++--------
>  drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h |  9 ++++-
>  2 files changed, 40 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> index a12fc45..98de092 100644
> --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
> @@ -757,6 +757,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
>  	u16 queue_mapping;
>  	unsigned int needed_headroom;
>  	u32 fd_len;
> +	u8 prio = 0;
>  	int err, i;
>  
>  	percpu_stats = this_cpu_ptr(priv->percpu_stats);
> @@ -814,6 +815,18 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
>  	 * a queue affined to the same core that processed the Rx frame
>  	 */
>  	queue_mapping = skb_get_queue_mapping(skb);
> +
> +	if (net_dev->num_tc) {
> +		prio = netdev_txq_to_tc(net_dev, queue_mapping);
> +		/* Hardware interprets priority level 0 as being the highest,
> +		 * so we need to do a reverse mapping to the netdev tc index
> +		 */
> +		prio = net_dev->num_tc - prio - 1;
> +		/* We have only one FQ array entry for all Tx hardware queues
> +		 * with the same flow id (but different priority levels)
> +		 */
> +		queue_mapping %= dpaa2_eth_queue_count(priv);

This doesn't make any sense.

queue_mapping came from skb_get_queue_mapping().

The core limits the queue mapping value to whatever you told the
generic networking layer was the maximum number of queues.

And you set that to dpaa2_eth_queue_count():

	/* Set actual number of queues in the net device */
	num_queues = dpaa2_eth_queue_count(priv);
	err = netif_set_real_num_tx_queues(net_dev, num_queues);

Therfore the modulus cannot be needed.

  reply	other threads:[~2019-06-06 18:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06  8:50 [PATCH net-next v2 0/3] dpaa2-eth: Add support for MQPRIO offloading Ioana Radulescu
2019-06-06  8:50 ` [PATCH net-next v2 1/3] dpaa2-eth: Refactor xps code Ioana Radulescu
2019-06-06  8:50 ` [PATCH net-next v2 2/3] dpaa2-eth: Support multiple traffic classes on Tx Ioana Radulescu
2019-06-06 18:02   ` David Miller [this message]
2019-06-07  7:47     ` Ioana Ciocoi Radulescu
2019-06-06  8:50 ` [PATCH net-next v2 3/3] dpaa2-eth: Add mqprio support Ioana Radulescu

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=20190606.110233.2117483278297401420.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ioana.ciornei@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=ruxandra.radulescu@nxp.com \
    /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).