From: Alexander Duyck <alexander.duyck@gmail.com>
To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
Subject: [jkirsher/next-queue PATCH 4/5] dev: Clean-up __skb_tx_hash to match up with traffic class based configs
Date: Thu, 02 Nov 2017 16:34:41 -0700 [thread overview]
Message-ID: <20171102233417.15146.6991.stgit@localhost.localdomain> (raw)
In-Reply-To: <20171102232857.15146.21583.stgit@localhost.localdomain>
From: Alexander Duyck <alexander.h.duyck@intel.com>
This patch is mostly just a minor clean-up so that we avoid letting a
packet jump from one traffic class to another just based on the Rx queue.
Instead we now use that queue number as an offset within the traffic class.
Handling it this way allows us to operate more cleanly in a mixed
environment that is doing routing over multiple interfaces that may not
have the same queue configuration.
This patch includes a minor clean-up of variable declaration as well to get
things into the reverse xmas tree format.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
---
net/core/dev.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 24ac9083bc13..fd51b8703277 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2573,16 +2573,9 @@ void netif_device_attach(struct net_device *dev)
u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
unsigned int num_tx_queues)
{
- u32 hash;
- u16 qoffset = 0;
u16 qcount = num_tx_queues;
-
- if (skb_rx_queue_recorded(skb)) {
- hash = skb_get_rx_queue(skb);
- while (unlikely(hash >= num_tx_queues))
- hash -= num_tx_queues;
- return hash;
- }
+ u16 qoffset = 0;
+ u32 hash;
if (dev->num_tc) {
u8 tc = netdev_get_prio_tc_map(dev, skb->priority);
@@ -2591,6 +2584,13 @@ u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
qcount = dev->tc_to_txq[tc].count;
}
+ if (skb_rx_queue_recorded(skb)) {
+ hash = skb_get_rx_queue(skb);
+ while (unlikely(hash >= qcount))
+ hash -= qcount;
+ return hash + qoffset;
+ }
+
return (u16) reciprocal_scale(skb_get_hash(skb), qcount) + qoffset;
}
EXPORT_SYMBOL(__skb_tx_hash);
next prev parent reply other threads:[~2017-11-02 23:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-02 23:33 [jkirsher/next-queue PATCH 0/5] macvlan offload fixes Alexander Duyck
2017-11-02 23:33 ` [jkirsher/next-queue PATCH 1/5] ixgbe: Fix interaction between SR-IOV and macvlan offload Alexander Duyck
2017-11-02 23:33 ` [jkirsher/next-queue PATCH 2/5] fm10k: Fix VLAN configuration for " Alexander Duyck
2017-11-03 17:05 ` [Intel-wired-lan] " Jesse Brandeburg
2017-11-08 22:05 ` Keller, Jacob E
2017-11-08 23:03 ` Alexander Duyck
2017-11-09 0:21 ` Keller, Jacob E
2017-11-09 0:32 ` Alexander Duyck
2017-11-09 1:26 ` Keller, Jacob E
2017-11-02 23:34 ` [jkirsher/next-queue PATCH 3/5] ixgbe: Fix handling of macvlan Tx offload Alexander Duyck
2017-11-03 16:30 ` [Intel-wired-lan] " Shannon Nelson
2017-11-03 18:18 ` Alexander Duyck
2017-11-02 23:34 ` Alexander Duyck [this message]
2017-11-02 23:34 ` [jkirsher/next-queue PATCH 5/5] dev: Cap number of queues even with accel_priv Alexander Duyck
2017-11-03 17:07 ` [Intel-wired-lan] " Jesse Brandeburg
2017-11-03 17:13 ` [Intel-wired-lan] [jkirsher/next-queue PATCH 0/5] macvlan offload fixes Shannon Nelson
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=20171102233417.15146.6991.stgit@localhost.localdomain \
--to=alexander.duyck@gmail.com \
--cc=intel-wired-lan@lists.osuosl.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).