All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 net] i40e: Implement ndo_gso_check()
@ 2014-11-20 23:11 Joe Stringer
  2014-11-20 23:14 ` Jeff Kirsher
  2014-11-21  0:19 ` Jesse Gross
  0 siblings, 2 replies; 12+ messages in thread
From: Joe Stringer @ 2014-11-20 23:11 UTC (permalink / raw)
  To: netdev
  Cc: shannon.nelson, jesse.brandeburg, jeffrey.t.kirsher, therbert,
	linux.nics, linux-kernel, jesse

ndo_gso_check() was recently introduced to allow NICs to report the
offloading support that they have on a per-skb basis. Add an
implementation for this driver which checks for IPIP, GRE, UDP tunnels.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
---
v2: Expand to include IP in IP and IPv4/IPv6 inside GRE/UDP tunnels.
    Add MAX_INNER_LENGTH (as 80).
---
 drivers/net/ethernet/intel/i40e/i40e_main.c |   31 +++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index c3a7f4a..2b01c8d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7447,6 +7447,36 @@ static int i40e_ndo_fdb_dump(struct sk_buff *skb,
 
 #endif /* USE_DEFAULT_FDB_DEL_DUMP */
 #endif /* HAVE_FDB_OPS */
+static bool i40e_gso_check(struct sk_buff *skb, struct net_device *dev)
+{
+	if ((skb_shinfo(skb)->gso_type & SKB_GSO_IPIP) &&
+	    (skb->inner_protocol_type != ENCAP_TYPE_IPPROTO ||
+	     skb->inner_protocol != htons(IPPROTO_IPIP))) {
+		return false;
+	}
+
+	if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE | SKB_GSO_UDP_TUNNEL)) {
+		unsigned char *ihdr;
+
+		if (skb->inner_protocol_type != ENCAP_TYPE_ETHER)
+			return false;
+
+		if (skb->inner_protocol == htons(ETH_P_TEB))
+			ihdr = skb_inner_mac_header(skb);
+		else if (skb->inner_protocol == htons(ETH_P_IP) ||
+			 skb->inner_protocol == htons(ETH_P_IPV6))
+			ihdr = skb_inner_network_header(skb);
+		else
+			return false;
+
+#define MAX_TUNNEL_HDR_LEN	80
+		if (ihdr - skb_transport_header(skb) > MAX_TUNNEL_HDR_LEN)
+			return false;
+	}
+
+	return true;
+}
+
 static const struct net_device_ops i40e_netdev_ops = {
 	.ndo_open		= i40e_open,
 	.ndo_stop		= i40e_close,
@@ -7487,6 +7517,7 @@ static const struct net_device_ops i40e_netdev_ops = {
 	.ndo_fdb_dump		= i40e_ndo_fdb_dump,
 #endif
 #endif
+	.ndo_gso_check		= i40e_gso_check,
 };
 
 /**
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-11-20 23:11 [PATCHv2 net] i40e: Implement ndo_gso_check() Joe Stringer
@ 2014-11-20 23:14 ` Jeff Kirsher
  2014-11-21  0:19 ` Jesse Gross
  1 sibling, 0 replies; 12+ messages in thread
From: Jeff Kirsher @ 2014-11-20 23:14 UTC (permalink / raw)
  To: Joe Stringer
  Cc: netdev, shannon.nelson, jesse.brandeburg, therbert, linux.nics,
	linux-kernel, jesse

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

On Thu, 2014-11-20 at 15:11 -0800, Joe Stringer wrote:
> ndo_gso_check() was recently introduced to allow NICs to report the
> offloading support that they have on a per-skb basis. Add an
> implementation for this driver which checks for IPIP, GRE, UDP
> tunnels.
> 
> Signed-off-by: Joe Stringer <joestringer@nicira.com>
> ---
> v2: Expand to include IP in IP and IPv4/IPv6 inside GRE/UDP tunnels.
>     Add MAX_INNER_LENGTH (as 80).
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c |   31
> +++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)

If Jesse is good with the updated patch, I will add it to my queue.
Thanks Joe!

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-11-20 23:11 [PATCHv2 net] i40e: Implement ndo_gso_check() Joe Stringer
  2014-11-20 23:14 ` Jeff Kirsher
@ 2014-11-21  0:19 ` Jesse Gross
  2014-11-21 17:59   ` Joe Stringer
  1 sibling, 1 reply; 12+ messages in thread
From: Jesse Gross @ 2014-11-21  0:19 UTC (permalink / raw)
  To: Joe Stringer
  Cc: netdev, Shannon Nelson, Brandeburg, Jesse, Jeff Kirsher,
	Tom Herbert, linux.nics, Linux Kernel Mailing List

On Thu, Nov 20, 2014 at 3:11 PM, Joe Stringer <joestringer@nicira.com> wrote:
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index c3a7f4a..2b01c8d 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -7447,6 +7447,36 @@ static int i40e_ndo_fdb_dump(struct sk_buff *skb,
>
>  #endif /* USE_DEFAULT_FDB_DEL_DUMP */
>  #endif /* HAVE_FDB_OPS */
> +static bool i40e_gso_check(struct sk_buff *skb, struct net_device *dev)
> +{
> +       if ((skb_shinfo(skb)->gso_type & SKB_GSO_IPIP) &&
> +           (skb->inner_protocol_type != ENCAP_TYPE_IPPROTO ||
> +            skb->inner_protocol != htons(IPPROTO_IPIP))) {

I think this check on inner_protocol isn't really semantically correct
- that field is a union with inner_ipproto, so it would be more
correct to check against that and then you wouldn't need to use htons
either.

I don't know if we need to have the check at all for IPIP though -
after all the driver doesn't expose support for it all (actually it
doesn't expose GRE either). This raises kind of an interesting
question about the checks though - it's pretty easy to add support to
the driver for a new GSO type (and I imagine that people will be
adding GRE soon) and forget to update the check.

> +       if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE | SKB_GSO_UDP_TUNNEL)) {
> +               unsigned char *ihdr;
> +
> +               if (skb->inner_protocol_type != ENCAP_TYPE_ETHER)
> +                       return false;

I guess if you want to be nice, it might be good to check the
equivalent IP protocol types as well.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-11-21  0:19 ` Jesse Gross
@ 2014-11-21 17:59   ` Joe Stringer
  2014-12-01 23:35     ` Joe Stringer
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Stringer @ 2014-11-21 17:59 UTC (permalink / raw)
  To: Jesse Gross
  Cc: netdev, Shannon Nelson, Brandeburg, Jesse, Jeff Kirsher,
	Tom Herbert, linux.nics, Linux Kernel Mailing List

On 20 November 2014 16:19, Jesse Gross <jesse@nicira.com> wrote:
> On Thu, Nov 20, 2014 at 3:11 PM, Joe Stringer <joestringer@nicira.com> wrote:
>> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
>> index c3a7f4a..2b01c8d 100644
>> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
>> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
>> @@ -7447,6 +7447,36 @@ static int i40e_ndo_fdb_dump(struct sk_buff *skb,
>>
>>  #endif /* USE_DEFAULT_FDB_DEL_DUMP */
>>  #endif /* HAVE_FDB_OPS */
>> +static bool i40e_gso_check(struct sk_buff *skb, struct net_device *dev)
>> +{
>> +       if ((skb_shinfo(skb)->gso_type & SKB_GSO_IPIP) &&
>> +           (skb->inner_protocol_type != ENCAP_TYPE_IPPROTO ||
>> +            skb->inner_protocol != htons(IPPROTO_IPIP))) {
>
> I think this check on inner_protocol isn't really semantically correct
> - that field is a union with inner_ipproto, so it would be more
> correct to check against that and then you wouldn't need to use htons
> either.

Yes, translation error on my part, but if IPIP isn't exposed I'll just
drop this section.

> I don't know if we need to have the check at all for IPIP though -
> after all the driver doesn't expose support for it all (actually it
> doesn't expose GRE either). This raises kind of an interesting
> question about the checks though - it's pretty easy to add support to
> the driver for a new GSO type (and I imagine that people will be
> adding GRE soon) and forget to update the check.

If the check is more conservative, then testing would show that it's
not working and lead people to figure out why (and update the check).

>> +       if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE | SKB_GSO_UDP_TUNNEL)) {
>> +               unsigned char *ihdr;
>> +
>> +               if (skb->inner_protocol_type != ENCAP_TYPE_ETHER)
>> +                       return false;
>
> I guess if you want to be nice, it might be good to check the
> equivalent IP protocol types as well.

Can do (just UDP as I'll drop GRE as per the above).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-11-21 17:59   ` Joe Stringer
@ 2014-12-01 23:35     ` Joe Stringer
  2014-12-01 23:47       ` Tom Herbert
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Stringer @ 2014-12-01 23:35 UTC (permalink / raw)
  To: Jesse Gross
  Cc: netdev, Shannon Nelson, Brandeburg, Jesse, Jeff Kirsher,
	Tom Herbert, linux.nics, Linux Kernel Mailing List

On 21 November 2014 at 09:59, Joe Stringer <joestringer@nicira.com> wrote:
> On 20 November 2014 16:19, Jesse Gross <jesse@nicira.com> wrote:
>> I don't know if we need to have the check at all for IPIP though -
>> after all the driver doesn't expose support for it all (actually it
>> doesn't expose GRE either). This raises kind of an interesting
>> question about the checks though - it's pretty easy to add support to
>> the driver for a new GSO type (and I imagine that people will be
>> adding GRE soon) and forget to update the check.
>
> If the check is more conservative, then testing would show that it's
> not working and lead people to figure out why (and update the check).

More concretely, one suggestion would be something like following at
the start of each gso_check():

+       const int supported = SKB_GSO_TCPV4 | SKB_GSO_TCPV6 | SKB_GSO_FCOE |
+                             SKB_GSO_UDP | SKB_GSO_UDP_TUNNEL;
+
+       if (skb_shinfo(skb)->gso_type & ~supported)
+               return false;

..followed by checking the specifics for each. So far the patches have
only been concerned with further checking on UDP tunnels.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-12-01 23:35     ` Joe Stringer
@ 2014-12-01 23:47       ` Tom Herbert
  2014-12-01 23:53         ` Jesse Gross
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Herbert @ 2014-12-01 23:47 UTC (permalink / raw)
  To: Joe Stringer
  Cc: Jesse Gross, netdev, Shannon Nelson, Brandeburg, Jesse,
	Jeff Kirsher, linux.nics, Linux Kernel Mailing List

On Mon, Dec 1, 2014 at 3:35 PM, Joe Stringer <joestringer@nicira.com> wrote:
> On 21 November 2014 at 09:59, Joe Stringer <joestringer@nicira.com> wrote:
>> On 20 November 2014 16:19, Jesse Gross <jesse@nicira.com> wrote:
>>> I don't know if we need to have the check at all for IPIP though -
>>> after all the driver doesn't expose support for it all (actually it
>>> doesn't expose GRE either). This raises kind of an interesting
>>> question about the checks though - it's pretty easy to add support to
>>> the driver for a new GSO type (and I imagine that people will be
>>> adding GRE soon) and forget to update the check.
>>
>> If the check is more conservative, then testing would show that it's
>> not working and lead people to figure out why (and update the check).
>
> More concretely, one suggestion would be something like following at
> the start of each gso_check():
>
> +       const int supported = SKB_GSO_TCPV4 | SKB_GSO_TCPV6 | SKB_GSO_FCOE |
> +                             SKB_GSO_UDP | SKB_GSO_UDP_TUNNEL;
> +
> +       if (skb_shinfo(skb)->gso_type & ~supported)
> +               return false;

This should already be handled by net_gso_ok.

>
> ..followed by checking the specifics for each. So far the patches have
> only been concerned with further checking on UDP tunnels.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-12-01 23:47       ` Tom Herbert
@ 2014-12-01 23:53         ` Jesse Gross
  2014-12-01 23:58           ` Joe Stringer
  2014-12-02  0:09           ` Tom Herbert
  0 siblings, 2 replies; 12+ messages in thread
From: Jesse Gross @ 2014-12-01 23:53 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Joe Stringer, netdev, Shannon Nelson, Brandeburg, Jesse,
	Jeff Kirsher, linux.nics, Linux Kernel Mailing List

On Mon, Dec 1, 2014 at 3:47 PM, Tom Herbert <therbert@google.com> wrote:
> On Mon, Dec 1, 2014 at 3:35 PM, Joe Stringer <joestringer@nicira.com> wrote:
>> On 21 November 2014 at 09:59, Joe Stringer <joestringer@nicira.com> wrote:
>>> On 20 November 2014 16:19, Jesse Gross <jesse@nicira.com> wrote:
>>>> I don't know if we need to have the check at all for IPIP though -
>>>> after all the driver doesn't expose support for it all (actually it
>>>> doesn't expose GRE either). This raises kind of an interesting
>>>> question about the checks though - it's pretty easy to add support to
>>>> the driver for a new GSO type (and I imagine that people will be
>>>> adding GRE soon) and forget to update the check.
>>>
>>> If the check is more conservative, then testing would show that it's
>>> not working and lead people to figure out why (and update the check).
>>
>> More concretely, one suggestion would be something like following at
>> the start of each gso_check():
>>
>> +       const int supported = SKB_GSO_TCPV4 | SKB_GSO_TCPV6 | SKB_GSO_FCOE |
>> +                             SKB_GSO_UDP | SKB_GSO_UDP_TUNNEL;
>> +
>> +       if (skb_shinfo(skb)->gso_type & ~supported)
>> +               return false;
>
> This should already be handled by net_gso_ok.

My original point wasn't so much that this isn't handled at the moment
but that it's easy to add a supported GSO type but then forget to
update this check - i.e. if a driver already supports UDP_TUNNEL and
adds support for GRE with the same constraints. It seems not entirely
ideal that this function is acting as a blacklist rather than a
whitelist.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-12-01 23:53         ` Jesse Gross
@ 2014-12-01 23:58           ` Joe Stringer
  2014-12-02  0:09           ` Tom Herbert
  1 sibling, 0 replies; 12+ messages in thread
From: Joe Stringer @ 2014-12-01 23:58 UTC (permalink / raw)
  To: Jesse Gross
  Cc: Tom Herbert, netdev, Shannon Nelson, Brandeburg, Jesse,
	Jeff Kirsher, linux.nics, Linux Kernel Mailing List

On 1 December 2014 at 15:53, Jesse Gross <jesse@nicira.com> wrote:
> On Mon, Dec 1, 2014 at 3:47 PM, Tom Herbert <therbert@google.com> wrote:
>> On Mon, Dec 1, 2014 at 3:35 PM, Joe Stringer <joestringer@nicira.com> wrote:
>>> On 21 November 2014 at 09:59, Joe Stringer <joestringer@nicira.com> wrote:
>>>> On 20 November 2014 16:19, Jesse Gross <jesse@nicira.com> wrote:
>>>>> I don't know if we need to have the check at all for IPIP though -
>>>>> after all the driver doesn't expose support for it all (actually it
>>>>> doesn't expose GRE either). This raises kind of an interesting
>>>>> question about the checks though - it's pretty easy to add support to
>>>>> the driver for a new GSO type (and I imagine that people will be
>>>>> adding GRE soon) and forget to update the check.
>>>>
>>>> If the check is more conservative, then testing would show that it's
>>>> not working and lead people to figure out why (and update the check).
>>>
>>> More concretely, one suggestion would be something like following at
>>> the start of each gso_check():
>>>
>>> +       const int supported = SKB_GSO_TCPV4 | SKB_GSO_TCPV6 | SKB_GSO_FCOE |
>>> +                             SKB_GSO_UDP | SKB_GSO_UDP_TUNNEL;
>>> +
>>> +       if (skb_shinfo(skb)->gso_type & ~supported)
>>> +               return false;
>>
>> This should already be handled by net_gso_ok.
>
> My original point wasn't so much that this isn't handled at the moment
> but that it's easy to add a supported GSO type but then forget to
> update this check - i.e. if a driver already supports UDP_TUNNEL and
> adds support for GRE with the same constraints. It seems not entirely
> ideal that this function is acting as a blacklist rather than a
> whitelist.

How much less ideal is it to forget to update the check than to make
this a blacklist?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-12-01 23:53         ` Jesse Gross
  2014-12-01 23:58           ` Joe Stringer
@ 2014-12-02  0:09           ` Tom Herbert
  2014-12-02 18:26             ` Jesse Gross
  1 sibling, 1 reply; 12+ messages in thread
From: Tom Herbert @ 2014-12-02  0:09 UTC (permalink / raw)
  To: Jesse Gross
  Cc: Joe Stringer, netdev, Shannon Nelson, Brandeburg, Jesse,
	Jeff Kirsher, linux.nics, Linux Kernel Mailing List

On Mon, Dec 1, 2014 at 3:53 PM, Jesse Gross <jesse@nicira.com> wrote:
> On Mon, Dec 1, 2014 at 3:47 PM, Tom Herbert <therbert@google.com> wrote:
>> On Mon, Dec 1, 2014 at 3:35 PM, Joe Stringer <joestringer@nicira.com> wrote:
>>> On 21 November 2014 at 09:59, Joe Stringer <joestringer@nicira.com> wrote:
>>>> On 20 November 2014 16:19, Jesse Gross <jesse@nicira.com> wrote:
>>>>> I don't know if we need to have the check at all for IPIP though -
>>>>> after all the driver doesn't expose support for it all (actually it
>>>>> doesn't expose GRE either). This raises kind of an interesting
>>>>> question about the checks though - it's pretty easy to add support to
>>>>> the driver for a new GSO type (and I imagine that people will be
>>>>> adding GRE soon) and forget to update the check.
>>>>
>>>> If the check is more conservative, then testing would show that it's
>>>> not working and lead people to figure out why (and update the check).
>>>
>>> More concretely, one suggestion would be something like following at
>>> the start of each gso_check():
>>>
>>> +       const int supported = SKB_GSO_TCPV4 | SKB_GSO_TCPV6 | SKB_GSO_FCOE |
>>> +                             SKB_GSO_UDP | SKB_GSO_UDP_TUNNEL;
>>> +
>>> +       if (skb_shinfo(skb)->gso_type & ~supported)
>>> +               return false;
>>
>> This should already be handled by net_gso_ok.
>
> My original point wasn't so much that this isn't handled at the moment
> but that it's easy to add a supported GSO type but then forget to
> update this check - i.e. if a driver already supports UDP_TUNNEL and
> adds support for GRE with the same constraints. It seems not entirely
> ideal that this function is acting as a blacklist rather than a
> whitelist.

Agreed, it would be nice to have all the checking logic in one place.
If all the drivers end up implementing ndo_gso_check then we could
potentially get rid of the GSO types as features. This probably
wouldn't be a bad thing since we already know that the features
mechanism doesn't scale (for instance there's no way to indicate that
certain combinations of GSO types are supported by a device).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-12-02  0:09           ` Tom Herbert
@ 2014-12-02 18:26             ` Jesse Gross
  2014-12-04 18:41               ` Joe Stringer
  2014-12-05 21:52               ` Jesse Gross
  0 siblings, 2 replies; 12+ messages in thread
From: Jesse Gross @ 2014-12-02 18:26 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Joe Stringer, netdev, Shannon Nelson, Brandeburg, Jesse,
	Jeff Kirsher, linux.nics, Linux Kernel Mailing List

On Mon, Dec 1, 2014 at 4:09 PM, Tom Herbert <therbert@google.com> wrote:
> On Mon, Dec 1, 2014 at 3:53 PM, Jesse Gross <jesse@nicira.com> wrote:
>> On Mon, Dec 1, 2014 at 3:47 PM, Tom Herbert <therbert@google.com> wrote:
>>> On Mon, Dec 1, 2014 at 3:35 PM, Joe Stringer <joestringer@nicira.com> wrote:
>>>> On 21 November 2014 at 09:59, Joe Stringer <joestringer@nicira.com> wrote:
>>>>> On 20 November 2014 16:19, Jesse Gross <jesse@nicira.com> wrote:
>>>>>> I don't know if we need to have the check at all for IPIP though -
>>>>>> after all the driver doesn't expose support for it all (actually it
>>>>>> doesn't expose GRE either). This raises kind of an interesting
>>>>>> question about the checks though - it's pretty easy to add support to
>>>>>> the driver for a new GSO type (and I imagine that people will be
>>>>>> adding GRE soon) and forget to update the check.
>>>>>
>>>>> If the check is more conservative, then testing would show that it's
>>>>> not working and lead people to figure out why (and update the check).
>>>>
>>>> More concretely, one suggestion would be something like following at
>>>> the start of each gso_check():
>>>>
>>>> +       const int supported = SKB_GSO_TCPV4 | SKB_GSO_TCPV6 | SKB_GSO_FCOE |
>>>> +                             SKB_GSO_UDP | SKB_GSO_UDP_TUNNEL;
>>>> +
>>>> +       if (skb_shinfo(skb)->gso_type & ~supported)
>>>> +               return false;
>>>
>>> This should already be handled by net_gso_ok.
>>
>> My original point wasn't so much that this isn't handled at the moment
>> but that it's easy to add a supported GSO type but then forget to
>> update this check - i.e. if a driver already supports UDP_TUNNEL and
>> adds support for GRE with the same constraints. It seems not entirely
>> ideal that this function is acting as a blacklist rather than a
>> whitelist.
>
> Agreed, it would be nice to have all the checking logic in one place.
> If all the drivers end up implementing ndo_gso_check then we could
> potentially get rid of the GSO types as features. This probably
> wouldn't be a bad thing since we already know that the features
> mechanism doesn't scale (for instance there's no way to indicate that
> certain combinations of GSO types are supported by a device).

This crossed my mind and I agree that it's pretty clear that the
features mechanism isn't scaling very well. Presumably, the logical
extension of this is that each driver would have a function that looks
at a packet and returns a set of offload operations that it can
support rather than exposing a set of protocols. However, it seems
like it would probably result in a bunch of duplicate code in each
driver.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-12-02 18:26             ` Jesse Gross
@ 2014-12-04 18:41               ` Joe Stringer
  2014-12-05 21:52               ` Jesse Gross
  1 sibling, 0 replies; 12+ messages in thread
From: Joe Stringer @ 2014-12-04 18:41 UTC (permalink / raw)
  To: Jesse Gross
  Cc: Tom Herbert, netdev, Shannon Nelson, Brandeburg, Jesse,
	Jeff Kirsher, linux.nics, Linux Kernel Mailing List

On 2 December 2014 at 10:26, Jesse Gross <jesse@nicira.com> wrote:
> On Mon, Dec 1, 2014 at 4:09 PM, Tom Herbert <therbert@google.com> wrote:
>> On Mon, Dec 1, 2014 at 3:53 PM, Jesse Gross <jesse@nicira.com> wrote:
>>> On Mon, Dec 1, 2014 at 3:47 PM, Tom Herbert <therbert@google.com> wrote:
>>>> On Mon, Dec 1, 2014 at 3:35 PM, Joe Stringer <joestringer@nicira.com> wrote:
>>>>> On 21 November 2014 at 09:59, Joe Stringer <joestringer@nicira.com> wrote:
>>>>>> On 20 November 2014 16:19, Jesse Gross <jesse@nicira.com> wrote:
>>>>>>> I don't know if we need to have the check at all for IPIP though -
>>>>>>> after all the driver doesn't expose support for it all (actually it
>>>>>>> doesn't expose GRE either). This raises kind of an interesting
>>>>>>> question about the checks though - it's pretty easy to add support to
>>>>>>> the driver for a new GSO type (and I imagine that people will be
>>>>>>> adding GRE soon) and forget to update the check.
>>>>>>
>>>>>> If the check is more conservative, then testing would show that it's
>>>>>> not working and lead people to figure out why (and update the check).
>>>>>
>>>>> More concretely, one suggestion would be something like following at
>>>>> the start of each gso_check():
>>>>>
>>>>> +       const int supported = SKB_GSO_TCPV4 | SKB_GSO_TCPV6 | SKB_GSO_FCOE |
>>>>> +                             SKB_GSO_UDP | SKB_GSO_UDP_TUNNEL;
>>>>> +
>>>>> +       if (skb_shinfo(skb)->gso_type & ~supported)
>>>>> +               return false;
>>>>
>>>> This should already be handled by net_gso_ok.
>>>
>>> My original point wasn't so much that this isn't handled at the moment
>>> but that it's easy to add a supported GSO type but then forget to
>>> update this check - i.e. if a driver already supports UDP_TUNNEL and
>>> adds support for GRE with the same constraints. It seems not entirely
>>> ideal that this function is acting as a blacklist rather than a
>>> whitelist.
>>
>> Agreed, it would be nice to have all the checking logic in one place.
>> If all the drivers end up implementing ndo_gso_check then we could
>> potentially get rid of the GSO types as features. This probably
>> wouldn't be a bad thing since we already know that the features
>> mechanism doesn't scale (for instance there's no way to indicate that
>> certain combinations of GSO types are supported by a device).
>
> This crossed my mind and I agree that it's pretty clear that the
> features mechanism isn't scaling very well. Presumably, the logical
> extension of this is that each driver would have a function that looks
> at a packet and returns a set of offload operations that it can
> support rather than exposing a set of protocols. However, it seems
> like it would probably result in a bunch of duplicate code in each
> driver.

Given the discussion is still pretty open-ended, I've made the basic
feedback changes for v3 and haven't tried to address the concern about
forgetting to update this check when a driver adds support.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2 net] i40e: Implement ndo_gso_check()
  2014-12-02 18:26             ` Jesse Gross
  2014-12-04 18:41               ` Joe Stringer
@ 2014-12-05 21:52               ` Jesse Gross
  1 sibling, 0 replies; 12+ messages in thread
From: Jesse Gross @ 2014-12-05 21:52 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Joe Stringer, netdev, Shannon Nelson, Brandeburg, Jesse,
	Jeff Kirsher, linux.nics, Linux Kernel Mailing List

On Tue, Dec 2, 2014 at 10:26 AM, Jesse Gross <jesse@nicira.com> wrote:
> On Mon, Dec 1, 2014 at 4:09 PM, Tom Herbert <therbert@google.com> wrote:
>> On Mon, Dec 1, 2014 at 3:53 PM, Jesse Gross <jesse@nicira.com> wrote:
>>> On Mon, Dec 1, 2014 at 3:47 PM, Tom Herbert <therbert@google.com> wrote:
>>>> On Mon, Dec 1, 2014 at 3:35 PM, Joe Stringer <joestringer@nicira.com> wrote:
>>>>> On 21 November 2014 at 09:59, Joe Stringer <joestringer@nicira.com> wrote:
>>>>>> On 20 November 2014 16:19, Jesse Gross <jesse@nicira.com> wrote:
>>>>>>> I don't know if we need to have the check at all for IPIP though -
>>>>>>> after all the driver doesn't expose support for it all (actually it
>>>>>>> doesn't expose GRE either). This raises kind of an interesting
>>>>>>> question about the checks though - it's pretty easy to add support to
>>>>>>> the driver for a new GSO type (and I imagine that people will be
>>>>>>> adding GRE soon) and forget to update the check.
>>>>>>
>>>>>> If the check is more conservative, then testing would show that it's
>>>>>> not working and lead people to figure out why (and update the check).
>>>>>
>>>>> More concretely, one suggestion would be something like following at
>>>>> the start of each gso_check():
>>>>>
>>>>> +       const int supported = SKB_GSO_TCPV4 | SKB_GSO_TCPV6 | SKB_GSO_FCOE |
>>>>> +                             SKB_GSO_UDP | SKB_GSO_UDP_TUNNEL;
>>>>> +
>>>>> +       if (skb_shinfo(skb)->gso_type & ~supported)
>>>>> +               return false;
>>>>
>>>> This should already be handled by net_gso_ok.
>>>
>>> My original point wasn't so much that this isn't handled at the moment
>>> but that it's easy to add a supported GSO type but then forget to
>>> update this check - i.e. if a driver already supports UDP_TUNNEL and
>>> adds support for GRE with the same constraints. It seems not entirely
>>> ideal that this function is acting as a blacklist rather than a
>>> whitelist.
>>
>> Agreed, it would be nice to have all the checking logic in one place.
>> If all the drivers end up implementing ndo_gso_check then we could
>> potentially get rid of the GSO types as features. This probably
>> wouldn't be a bad thing since we already know that the features
>> mechanism doesn't scale (for instance there's no way to indicate that
>> certain combinations of GSO types are supported by a device).
>
> This crossed my mind and I agree that it's pretty clear that the
> features mechanism isn't scaling very well. Presumably, the logical
> extension of this is that each driver would have a function that looks
> at a packet and returns a set of offload operations that it can
> support rather than exposing a set of protocols. However, it seems
> like it would probably result in a bunch of duplicate code in each
> driver.

I think a possible middleground here is to convert ndo_gso_check() to
ndo_features_check(). This would behave similarly to
netif_skb_features() and give drivers an opportunity to knock out
features for a given packet. This would allow us to avoid duplicate
code in the immediate case of tunnels where we need to handle both GSO
and checksums and potentially enable wider usage in the future if it
makes sense.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-12-05 21:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-20 23:11 [PATCHv2 net] i40e: Implement ndo_gso_check() Joe Stringer
2014-11-20 23:14 ` Jeff Kirsher
2014-11-21  0:19 ` Jesse Gross
2014-11-21 17:59   ` Joe Stringer
2014-12-01 23:35     ` Joe Stringer
2014-12-01 23:47       ` Tom Herbert
2014-12-01 23:53         ` Jesse Gross
2014-12-01 23:58           ` Joe Stringer
2014-12-02  0:09           ` Tom Herbert
2014-12-02 18:26             ` Jesse Gross
2014-12-04 18:41               ` Joe Stringer
2014-12-05 21:52               ` Jesse Gross

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.