All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, andrew.gospodarek@broadcom.com,
	Ariel Elior <Ariel.Elior@cavium.com>,
	everest-linux-l2@cavium.com
Subject: [PATCH net-next v3 2/5] net: Disable GRO_HW when generic XDP is installed on a device.
Date: Sat,  9 Dec 2017 01:27:56 -0500	[thread overview]
Message-ID: <1512800879-17934-3-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1512800879-17934-1-git-send-email-michael.chan@broadcom.com>

Hardware should not aggregate any packets when generic XDP is installed.

Cc: Ariel Elior <Ariel.Elior@cavium.com>
Cc: everest-linux-l2@cavium.com
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 net/core/dev.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 6ebd0e7..ec08ace 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1542,6 +1542,29 @@ void dev_disable_lro(struct net_device *dev)
 }
 EXPORT_SYMBOL(dev_disable_lro);
 
+/**
+ *	dev_disable_gro_hw - disable HW Generic Receive Offload on a device
+ *	@dev: device
+ *
+ *	Disable HW Generic Receive Offload (GRO_HW) on a net device.  Must be
+ *	called under RTNL.  This is needed if Generic XDP is installed on
+ *	the device.
+ */
+static void dev_disable_gro_hw(struct net_device *dev)
+{
+	struct net_device *lower_dev;
+	struct list_head *iter;
+
+	dev->wanted_features &= ~NETIF_F_GRO_HW;
+	netdev_update_features(dev);
+
+	if (unlikely(dev->features & NETIF_F_GRO_HW))
+		netdev_WARN(dev, "failed to disable GRO_HW!\n");
+
+	netdev_for_each_lower_dev(dev, lower_dev, iter)
+		dev_disable_gro_hw(lower_dev);
+}
+
 static int call_netdevice_notifier(struct notifier_block *nb, unsigned long val,
 				   struct net_device *dev)
 {
@@ -4564,6 +4587,7 @@ static int generic_xdp_install(struct net_device *dev, struct netdev_bpf *xdp)
 		} else if (new && !old) {
 			static_key_slow_inc(&generic_xdp_needed);
 			dev_disable_lro(dev);
+			dev_disable_gro_hw(dev);
 		}
 		break;
 
-- 
1.8.3.1

  parent reply	other threads:[~2017-12-09  6:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-09  6:27 [PATCH net-next v3 0/5] Introduce NETIF_F_GRO_HW Michael Chan
2017-12-09  6:27 ` [PATCH net-next v3 1/5] net: " Michael Chan
2017-12-09 18:50   ` Alexander Duyck
2017-12-09 21:31     ` Michael Chan
2017-12-09 22:04       ` Alexander Duyck
2017-12-10  6:40         ` Michael Chan
2017-12-10 17:02           ` Alexander Duyck
2017-12-11  6:39             ` Michael Chan
2017-12-09  6:27 ` Michael Chan [this message]
2017-12-09 18:56   ` [PATCH net-next v3 2/5] net: Disable GRO_HW when generic XDP is installed on a device Alexander Duyck
2017-12-09 21:40     ` Michael Chan
2017-12-09 22:37       ` Alexander Duyck
2017-12-10  6:49         ` Michael Chan
2017-12-11  3:03           ` Alexander Duyck
2017-12-09  6:27 ` [PATCH net-next v3 3/5] bnxt_en: Use NETIF_F_GRO_HW Michael Chan
2017-12-09  6:27 ` [PATCH net-next v3 4/5] bnx2x: " Michael Chan
2017-12-09  6:27 ` [PATCH net-next v3 5/5] qede: " Michael Chan

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=1512800879-17934-3-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=Ariel.Elior@cavium.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=everest-linux-l2@cavium.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.