From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, gospo@redhat.com,
Vasu Dev <vasu.dev@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next-2.6 PATCH 1/3] vlan: adds vlan_dev_select_queue
Date: Wed, 17 Feb 2010 04:36:08 -0800 [thread overview]
Message-ID: <20100217123606.18210.13602.stgit@localhost.localdomain> (raw)
From: Vasu Dev <vasu.dev@intel.com>
This is required to correctly select vlan tx queue for a driver
supporting multi tx queue with ndo_select_queue implemented since
currently selected vlan tx queue is unaligned to selected queue by
ndo_select_queue.
Unaligned vlan tx queue causes thrash with higher vlan tx lock
contention for least fcoe traffic on ixgbe.
Added vlan_dev_select_queue adds only minimal required code from
dev_pick_tx and preserves queue selection for the case ndo_select_queue
is not implemented.
Also updates vlan real_num_tx_queues in case underlying device
queues has changed.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
net/8021q/vlan.c | 1 +
net/8021q/vlan_dev.c | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 4535122..6c70805 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -378,6 +378,7 @@ static void vlan_transfer_features(struct net_device *dev,
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid;
#endif
+ vlandev->real_num_tx_queues = dev->real_num_tx_queues;
if (old_features != vlandev->features)
netdev_features_change(vlandev);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 9e83272..7ec246f 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -26,6 +26,7 @@
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <net/arp.h>
+#include <net/sock.h>
#include "vlan.h"
#include "vlanproc.h"
@@ -361,6 +362,26 @@ static netdev_tx_t vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,
return ret;
}
+static u16 vlan_dev_select_queue(struct net_device *dev, struct sk_buff *skb)
+{
+ struct vlan_dev_info *vlan = vlan_dev_info(dev);
+ const struct net_device_ops *ops = vlan->real_dev->netdev_ops;
+ u16 queue_index;
+
+ if (ops->ndo_select_queue)
+ queue_index = ops->ndo_select_queue(vlan->real_dev, skb);
+ else {
+ queue_index = 0;
+ if (dev->real_num_tx_queues > 1)
+ queue_index = skb_tx_hash(dev, skb);
+
+ if (skb->sk && skb->sk->sk_dst_cache)
+ sk_tx_queue_set(skb->sk, queue_index);
+ }
+
+ return queue_index;
+}
+
static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu)
{
/* TODO: gotta make sure the underlying layer can handle it,
@@ -818,6 +839,7 @@ static const struct ethtool_ops vlan_ethtool_ops = {
};
static const struct net_device_ops vlan_netdev_ops = {
+ .ndo_select_queue = vlan_dev_select_queue,
.ndo_change_mtu = vlan_dev_change_mtu,
.ndo_init = vlan_dev_init,
.ndo_uninit = vlan_dev_uninit,
@@ -842,6 +864,7 @@ static const struct net_device_ops vlan_netdev_ops = {
};
static const struct net_device_ops vlan_netdev_accel_ops = {
+ .ndo_select_queue = vlan_dev_select_queue,
.ndo_change_mtu = vlan_dev_change_mtu,
.ndo_init = vlan_dev_init,
.ndo_uninit = vlan_dev_uninit,
next reply other threads:[~2010-02-17 12:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-17 12:36 Jeff Kirsher [this message]
2010-02-17 12:36 ` [net-next-2.6 PATCH 2/3] ixgbe: fix real_num_tx_queues update issue Jeff Kirsher
2010-02-17 12:36 ` [net-next-2.6 PATCH 3/3] net: consolidate netif_needs_gso() checks Jeff Kirsher
2010-02-17 13:51 ` [net-next-2.6 PATCH 1/3] vlan: adds vlan_dev_select_queue Eric Dumazet
2010-02-17 21:43 ` David Miller
2010-02-17 22:40 ` Vasu Dev
2010-02-18 7:37 ` Eric Dumazet
2010-02-19 1:12 ` Vasu Dev
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=20100217123606.18210.13602.stgit@localhost.localdomain \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=vasu.dev@intel.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).