From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Chan Subject: Re: [PATCH net-next v3 2/5] net: Disable GRO_HW when generic XDP is installed on a device. Date: Sat, 9 Dec 2017 13:40:31 -0800 Message-ID: References: <1512800879-17934-1-git-send-email-michael.chan@broadcom.com> <1512800879-17934-3-git-send-email-michael.chan@broadcom.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: David Miller , Netdev , Andrew Gospodarek , Ariel Elior , everest-linux-l2@cavium.com To: Alexander Duyck Return-path: Received: from mail-oi0-f65.google.com ([209.85.218.65]:36400 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbdLIVkc (ORCPT ); Sat, 9 Dec 2017 16:40:32 -0500 Received: by mail-oi0-f65.google.com with SMTP id j17so9368686oih.3 for ; Sat, 09 Dec 2017 13:40:32 -0800 (PST) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Sat, Dec 9, 2017 at 10:56 AM, Alexander Duyck wrote: > On Fri, Dec 8, 2017 at 10:27 PM, Michael Chan wrote: >> Hardware should not aggregate any packets when generic XDP is installed. >> >> Cc: Ariel Elior >> Cc: everest-linux-l2@cavium.com >> Signed-off-by: Michael Chan >> --- >> 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); > > I think these two lines are redundant in dev_disable_lro, since > netdev_update_features should propagate the disable to all of the > lower devices. Right. But for GRO_HW, there is no automatic propagation. > Also this doesn't prevent the lower devices from > re-enabling gro_hw. Right. You can re-enable LRO on the upper device as well.