netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: Yuval Mintz <yuvalm@mellanox.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Ariel Elior <Ariel.Elior@cavium.com>,
	"everest-linux-l2@cavium.com" <everest-linux-l2@cavium.com>
Subject: Re: [PATCH net-next 1/4] net: Introduce NETIF_F_GRO_HW
Date: Mon, 4 Dec 2017 14:31:14 -0800	[thread overview]
Message-ID: <CACKFLinxDzE++S-ML-41D4+cxHjW0Opkjy1JwYdc1feJtyGQ=A@mail.gmail.com> (raw)
In-Reply-To: <VI1PR05MB35202FBCCC9C4B06F5C9148FBF3C0@VI1PR05MB3520.eurprd05.prod.outlook.com>

On Mon, Dec 4, 2017 at 2:15 PM, Yuval Mintz <yuvalm@mellanox.com> wrote:
>> @@ -96,6 +98,7 @@ enum {
>>  #define NETIF_F_FRAGLIST     __NETIF_F(FRAGLIST)
>>  #define NETIF_F_FSO          __NETIF_F(FSO)
>>  #define NETIF_F_GRO          __NETIF_F(GRO)
>> +#define NETIF_F_GRO_HW               __NETIF_F(GRO_HW)
>>  #define NETIF_F_GSO          __NETIF_F(GSO)
>>  #define NETIF_F_GSO_ROBUST   __NETIF_F(GSO_ROBUST)
>>  #define NETIF_F_HIGHDMA              __NETIF_F(HIGHDMA)
>> @@ -193,7 +196,7 @@ enum {
>>   * If upper/master device has these features disabled, they must be disabled
>>   * on all lower/slave devices as well.
>>   */
>> -#define NETIF_F_UPPER_DISABLES       NETIF_F_LRO
>> +#define NETIF_F_UPPER_DISABLES       (NETIF_F_LRO | NETIF_F_GRO_HW)
>>
>>  /* changeable features with no special hardware requirements */
>>  #define NETIF_F_SOFT_FEATURES        (NETIF_F_GSO | NETIF_F_GRO)
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 30b5fe3..09c2ad0 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -7392,6 +7392,19 @@ static netdev_features_t
>> netdev_fix_features(struct net_device *dev,
>>               features &= ~dev->gso_partial_features;
>>       }
>>
>> +     if (features & NETIF_F_GRO_HW) {
>> +             /* Hardware GRO depends on GRO. */
>> +             if (!(features & NETIF_F_GRO)) {
>
> While at it, perhaps also make it dependent on NETIF_F_RXCSUM?

OK.  Makes sense.

>
>> +                     netdev_dbg(dev, "Dropping NETIF_F_GSO_HW since
>> no GRO feature.\n");
>> +                     features &= ~NETIF_F_GRO_HW;
>> +             }
>> +             /* Hardware GRO and LRO are mutually exclusive. */
>> +             if (features & NETIF_F_LRO) {
>> +                     netdev_dbg(dev, "Dropping NETIF_F_LRO since
>> GRO_HW is set.\n");
>> +                     features &= ~NETIF_F_LRO;
>
> Isn't this considered to be breaking an existing API?
> After this, while NETIF_F_GRO_HW is published an application trying to
> set NETIF_F_LRO and then query its state would discover it failed
> [while previously it could have succeeded, such as for bnx2]
>
> While I understand the need to make sure core doesn't enable
> two competing aggregation offloads, why make GRO_HW > LRO?
> I understand it's probably the better one, but until LRO gets deprecated
> isn't it safer to do this limitation the opposite way?
> I.e., make sure NETIF_F_GRO_HW can't be set as long as NETIF_F_LRO is set?

I am just following precedents in the netdev_fix_features() logic to
drop incompatible features.  I can make LRO and GRO_HW have equal
standing by dropping the other when one is set.  So if I do that, user
will be able to always enable LRO.  The code will just drop GRO_HW if
it is set.

  reply	other threads:[~2017-12-04 22:31 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 11:12 [PATCH net-next 0/4] Introduce NETIF_F_GRO_HW Michael Chan
2017-12-04 11:12 ` [PATCH net-next 1/4] net: " Michael Chan
2017-12-04 16:30   ` Or Gerlitz
2017-12-04 16:47   ` Alexander Duyck
2017-12-04 18:23     ` Michael Chan
2017-12-04 18:43       ` Alexander Duyck
2017-12-04 18:59         ` David Miller
2017-12-04 19:24           ` Alexander Duyck
2017-12-04 19:26           ` Eric Dumazet
2017-12-04 19:36             ` Alexander Duyck
2017-12-04 19:52         ` Michael Chan
2017-12-04 20:58           ` Alexander Duyck
2017-12-04 23:05             ` Michael Chan
2017-12-04 22:15   ` Yuval Mintz
2017-12-04 22:31     ` Michael Chan [this message]
2017-12-04 11:12 ` [PATCH net-next 2/4] bnxt_en: Use NETIF_F_GRO_HW Michael Chan
2017-12-04 16:35   ` Or Gerlitz
2017-12-04 18:11     ` Michael Chan
2017-12-04 21:06       ` Or Gerlitz
2017-12-04 22:00         ` Eric Dumazet
2017-12-05  0:07           ` Michael Chan
2017-12-05 18:10             ` Marcelo Ricardo Leitner
2017-12-06 21:04               ` Michael Chan
2017-12-04 11:12 ` [PATCH net-next 3/4] bnx2x: " Michael Chan
2017-12-04 11:12 ` [PATCH net-next 4/4] qede: " Michael Chan
2017-12-04 21:48   ` Yuval Mintz
2017-12-04 22:45     ` Michael Chan
2017-12-05 12:32       ` Chopra, Manish
2017-12-05 17:13         ` Michael Chan
2017-12-04 11:38 ` [PATCH net-next 0/4] Introduce NETIF_F_GRO_HW Elior, Ariel
2017-12-05 19:31 ` David Miller

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='CACKFLinxDzE++S-ML-41D4+cxHjW0Opkjy1JwYdc1feJtyGQ=A@mail.gmail.com' \
    --to=michael.chan@broadcom.com \
    --cc=Ariel.Elior@cavium.com \
    --cc=davem@davemloft.net \
    --cc=everest-linux-l2@cavium.com \
    --cc=netdev@vger.kernel.org \
    --cc=yuvalm@mellanox.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).