Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 3.2 085/115] veth: don’t modify ip_summed; doing so treats packets with bad checksums as good.
From: Ben Greear @ 2016-04-27 15:59 UTC (permalink / raw)
  To: Ben Hutchings, linux-kernel, stable
  Cc: akpm, David S. Miller, Vijay Pandurangan, Cong Wang, netdev,
	Evan Jones, Nicolas Dichtel, Phil Sutter, Toshiaki Makita
In-Reply-To: <lsq.1461711744.699003961@decadent.org.uk>

On 04/26/2016 04:02 PM, Ben Hutchings wrote:
> 3.2.80-rc1 review patch.  If anyone has any objections, please let me know.

I would be careful about this.  It causes regressions when sending
PACKET_SOCKET buffers from user-space to veth devices.

There was a proposed upstream fix for the regression, but it has not gone
into the tree as far as I know.

http://www.spinics.net/lists/netdev/msg370436.html

Thanks,
Ben

>
> ------------------
>
> From: Vijay Pandurangan <vijayp@vijayp.ca>
>
> [ Upstream commit ce8c839b74e3017996fad4e1b7ba2e2625ede82f ]
>
> Packets that arrive from real hardware devices have ip_summed ==
> CHECKSUM_UNNECESSARY if the hardware verified the checksums, or
> CHECKSUM_NONE if the packet is bad or it was unable to verify it. The
> current version of veth will replace CHECKSUM_NONE with
> CHECKSUM_UNNECESSARY, which causes corrupt packets routed from hardware to
> a veth device to be delivered to the application. This caused applications
> at Twitter to receive corrupt data when network hardware was corrupting
> packets.
>
> We believe this was added as an optimization to skip computing and
> verifying checksums for communication between containers. However, locally
> generated packets have ip_summed == CHECKSUM_PARTIAL, so the code as
> written does nothing for them. As far as we can tell, after removing this
> code, these packets are transmitted from one stack to another unmodified
> (tcpdump shows invalid checksums on both sides, as expected), and they are
> delivered correctly to applications. We didn’t test every possible network
> configuration, but we tried a few common ones such as bridging containers,
> using NAT between the host and a container, and routing from hardware
> devices to containers. We have effectively deployed this in production at
> Twitter (by disabling RX checksum offloading on veth devices).
>
> This code dates back to the first version of the driver, commit
> <e314dbdc1c0dc6a548ecf> ("[NET]: Virtual ethernet device driver"), so I
> suspect this bug occurred mostly because the driver API has evolved
> significantly since then. Commit <0b7967503dc97864f283a> ("net/veth: Fix
> packet checksumming") (in December 2010) fixed this for packets that get
> created locally and sent to hardware devices, by not changing
> CHECKSUM_PARTIAL. However, the same issue still occurs for packets coming
> in from hardware devices.
>
> Co-authored-by: Evan Jones <ej@evanjones.ca>
> Signed-off-by: Evan Jones <ej@evanjones.ca>
> Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Cc: Phil Sutter <phil@nwl.cc>
> Cc: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Vijay Pandurangan <vijayp@vijayp.ca>
> Acked-by: Cong Wang <cwang@twopensource.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> [bwh: Backported to 3.2: adjust context]
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
>   drivers/net/veth.c | 6 ------
>   1 file changed, 6 deletions(-)
>
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -126,11 +126,6 @@ static netdev_tx_t veth_xmit(struct sk_b
>   	stats = this_cpu_ptr(priv->stats);
>   	rcv_stats = this_cpu_ptr(rcv_priv->stats);
>
> -	/* don't change ip_summed == CHECKSUM_PARTIAL, as that
> -	   will cause bad checksum on forwarded packets */
> -	if (skb->ip_summed == CHECKSUM_NONE &&
> -	    rcv->features & NETIF_F_RXCSUM)
> -		skb->ip_summed = CHECKSUM_UNNECESSARY;
>
>   	length = skb->len;
>   	if (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS)
>


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply

* Re: [PATCH net-next] drivers/net: add 6WIND SHULTI support
From: Jiri Pirko @ 2016-04-27 15:54 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: Florian Westphal, davem, netdev
In-Reply-To: <5720DCE1.8060803@6wind.com>

Wed, Apr 27, 2016 at 05:38:09PM CEST, nicolas.dichtel@6wind.com wrote:
>Le 27/04/2016 17:14, Jiri Pirko a écrit :
>> Wed, Apr 27, 2016 at 11:56:15AM CEST, fw@strlen.de wrote:
>>> Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
>>>> This patch adds the support of the 6WIND SHULTI switch. It is a software
>>>> switch doing L2 forwarding.
>>>>
>>>> This first version implements the minimum needed to get the device working.
>>>> It also implements, via switchdev and rtnetlink, bridge forwarding offload,
>>>> including FDB static entries, FDB learning and FDB ageing.
>>>
>>> How is this different from net/bridge?
>>> How is this different from openvswitch?
>> 
>> The difference is that it this tries to allow userspace crap to mirror
>> setting user does for bridge/ovs. Basically this looks to me like an
>> attempt to enable userspace SDKs and such.
>> 
>It is software switch, allowed by the switchdev model (see
>Documentation/networking/switchdev.txt), same design as mellanox spectrum.

Switchdev purpose is to offload stuff down to HW.
You say your switch is software, so integrate it properly into kernel.
Easy.


>
>What's wrong with that?

What's wrong is that your driver allows many userspace proprietary SDKs
to work on out-of-box kernel. This is called "trampoline model". You
basically enable userspace drivers for switches and stuff like that.
This was discussed many many times.

^ permalink raw reply

* [PATCH net-next v2] taskstats: fix nl parsing in accounting/getdelays.c
From: Nicolas Dichtel @ 2016-04-27 15:53 UTC (permalink / raw)
  To: bsingharora-Re5JQEeQqe8AvxtiuMwx3w
  Cc: dev-yBygre7rU0TnMu66kgdUjQ,
	steffen.klassert-opNxpl+3fjRBDgjK7y7TUQ,
	herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q,
	aar-bIcnvbaLZ9MEGnE8C9+IrQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	Nicolas Dichtel, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	kaber-dcUjhNyLwpNeoWH0uzbU5w, yoshfuji-VfPWfsRibaP+Ru+s062T9g,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	kadlec-K40Dz/62t/MgiyqX0sVFJYdd74u8MsAO,
	kuznet-v/Mj1YrvjDBInbfyfbPRSQ, jmorris-gx6/JNMH7DfYtjvyW6yDsg,
	linux-wpan-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	pablo-Cap9r6Oaw4JrovVCs/uTlw
In-Reply-To: <5720DFA1.3080503-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

The type TASKSTATS_TYPE_NULL should always be ignored.

When jumping to the next attribute, only the length of the current
attribute should be added, not the length of all nested attributes.
This last bug was not visible before commit 80df554275c2, because the
kernel didn't put more than two nested attributes.

Fixes: a3baf649ca9c ("[PATCH] per-task-delay-accounting: documentation")
Fixes: 80df554275c2 ("taskstats: use the libnl API to align nlattr on 64-bit")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 Documentation/accounting/getdelays.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index 7785fb5eb93f..b5ca536e56a8 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -505,6 +505,8 @@ int main(int argc, char *argv[])
 						if (!loop)
 							goto done;
 						break;
+					case TASKSTATS_TYPE_NULL:
+						break;
 					default:
 						fprintf(stderr, "Unknown nested"
 							" nla_type %d\n",
@@ -512,7 +514,8 @@ int main(int argc, char *argv[])
 						break;
 					}
 					len2 += NLA_ALIGN(na->nla_len);
-					na = (struct nlattr *) ((char *) na + len2);
+					na = (struct nlattr *)((char *)na +
+							       NLA_ALIGN(na->nla_len));
 				}
 				break;
 
-- 
2.8.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

^ permalink raw reply related

* Re: [PATCH net-next] taskstats: fix nl parsing in accounting/getdelays.c
From: Nicolas Dichtel @ 2016-04-27 15:49 UTC (permalink / raw)
  To: bsingharora-Re5JQEeQqe8AvxtiuMwx3w
  Cc: dev-yBygre7rU0TnMu66kgdUjQ,
	steffen.klassert-opNxpl+3fjRBDgjK7y7TUQ,
	herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q,
	aar-bIcnvbaLZ9MEGnE8C9+IrQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, kaber-dcUjhNyLwpNeoWH0uzbU5w,
	yoshfuji-VfPWfsRibaP+Ru+s062T9g,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	kadlec-K40Dz/62t/MgiyqX0sVFJYdd74u8MsAO,
	kuznet-v/Mj1YrvjDBInbfyfbPRSQ, jmorris-gx6/JNMH7DfYtjvyW6yDsg,
	linux-wpan-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	pablo-Cap9r6Oaw4JrovVCs/uTlw
In-Reply-To: <1461772077-3216-1-git-send-email-nicolas.dichtel-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

Le 27/04/2016 17:47, Nicolas Dichtel a écrit :
> The type TASKSTATS_TYPE_NULL should always be ignored.
> 
> When jumping to the next attribute, only the length of the current
> attribute should be added, not the length of all nested attributes.
> This last bug was not visible before commit 80df554275c2, because the
> kernel didn't put more than two nested attributes.
> 
> Fixes: a3baf649ca9c ("[PATCH] per-task-delay-accounting: documentation")
> Fixes: 80df554275c2 ("taskstats: use the libnl API to align nlattr on 64-bit")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Please, drop this version. I fatfingered my rebase.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

^ permalink raw reply

* [PATCH net-next] taskstats: fix nl parsing in accounting/getdelays.c
From: Nicolas Dichtel @ 2016-04-27 15:47 UTC (permalink / raw)
  To: bsingharora
  Cc: netdev, davem, linux-kernel, linux-wpan, aar, pablo, kaber,
	kadlec, pshelar, kuznet, jmorris, yoshfuji, netfilter-devel, dev,
	steffen.klassert, herbert, Nicolas Dichtel
In-Reply-To: <5720DED8.4090706@6wind.com>

The type TASKSTATS_TYPE_NULL should always be ignored.

When jumping to the next attribute, only the length of the current
attribute should be added, not the length of all nested attributes.
This last bug was not visible before commit 80df554275c2, because the
kernel didn't put more than two nested attributes.

Fixes: a3baf649ca9c ("[PATCH] per-task-delay-accounting: documentation")
Fixes: 80df554275c2 ("taskstats: use the libnl API to align nlattr on 64-bit")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 Documentation/accounting/getdelays.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index 7785fb5eb93f..d3caa6748a46 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -512,7 +512,7 @@ int main(int argc, char *argv[])
 						break;
 					}
 					len2 += NLA_ALIGN(na->nla_len);
-					na = (struct nlattr *) ((char *) na + len2);
+					na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
 				}
 				break;
 
-- 
2.8.1

^ permalink raw reply related

* Re: [PATCH net-next 9/9] taskstats: use the libnl API to align nlattr on 64-bit
From: Nicolas Dichtel @ 2016-04-27 15:46 UTC (permalink / raw)
  To: Balbir Singh, netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: dev-yBygre7rU0TnMu66kgdUjQ,
	steffen.klassert-opNxpl+3fjRBDgjK7y7TUQ,
	herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q,
	aar-bIcnvbaLZ9MEGnE8C9+IrQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q, yoshfuji-VfPWfsRibaP+Ru+s062T9g,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	kadlec-K40Dz/62t/MgiyqX0sVFJYdd74u8MsAO,
	kuznet-v/Mj1YrvjDBInbfyfbPRSQ, jmorris-gx6/JNMH7DfYtjvyW6yDsg,
	linux-wpan-u79uwXL29TY76Z2rM5mHXA, kaber-dcUjhNyLwpNeoWH0uzbU5w,
	pablo-Cap9r6Oaw4JrovVCs/uTlw
In-Reply-To: <5720B0A2.1030405-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Le 27/04/2016 14:29, Balbir Singh a écrit :
[snip]
> Please try
> 
> https://www.kernel.org/doc/Documentation/accounting/getdelays.c
A patch follows this mail to fix that.

> 
> iotop uses it as well. My concern is ABI breakage of user space.
My test is ok here, I didn't see a problem.
Code review (from here http://repo.or.cz/w/iotop.git) is also ok.


Regards,
Nicolas
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

^ permalink raw reply

* Re: [net-next PATCH 6/8] mlx4: Add support for inner IPv6 checksum offloads and TSO
From: Tariq Toukan @ 2016-04-27 15:39 UTC (permalink / raw)
  To: Alexander Duyck, Saeed Mahameed
  Cc: Alex Duyck, Tal Alon, Linux Kernel Network Developers,
	David Miller, Gal Pressman, Or Gerlitz, Eran Ben Elisha
In-Reply-To: <CAKgT0UfWUOFs8NvjWFQTtL_3Ure8MWbe5tJhEWFYnowb1kz1Dw@mail.gmail.com>



On 27/04/2016 12:01 AM, Alexander Duyck wrote:
> On Tue, Apr 26, 2016 at 1:23 PM, Saeed Mahameed
> <saeedm@dev.mellanox.co.il> wrote:
>> On Tue, Apr 26, 2016 at 6:50 PM, Alex Duyck <aduyck@mirantis.com> wrote:
>>> The setup is pretty straight forward.  Basically I left the first port
>>> in the default namespace and moved the second int a secondary
>>> namespace referred to below as $netns.  I then assigned the IPv6
>>> addresses fec0::10:1 and fec0::10:2. After that I ran the following:
>>>
>>>          VXLAN=vx$net
>>>          echo $VXLAN ${test_options[$i]}
>>>          ip link add $VXLAN type vxlan id $net \
>>>                  local fec0::10:1 remote $addr6 dev $PF0 \
>>>                  ${test_options[$i]} dstport `expr 8800 + $net`
>>>          ip netns exec $netns ip link add $VXLAN type vxlan id $net \
>>>                                    local $addr6 remote fec0::10:1 dev $port \
>>>                                    ${test_options[$i]} dstport `expr 8800 + $net`
>>>          ifconfig $VXLAN 192.168.${net}.1/24
>>>          ip netns exec $netns ifconfig $VXLAN 192.168.${net}.2/24
>>>
>> Thanks, indeed i see that GSO is not working with vxlan over IPv6 over
>> mlx5 device.
>> We will test out those patches on both mlx4 and mlx5, and debug mlx4
>> IPv6 issue you see.
>>
>>>> Anyway, I suspect it might be related to a driver bug most likely in
>>>> get_real_size function @en_tx.c
>>>> specifically in : *lso_header_size = (skb_inner_transport_header(skb) -
>>>> skb->data) + inner_tcp_hdrlen(skb);
>>>>
>>>> will check this and get back to you.
>>> I'm not entirely convinced.  What I was seeing is t hat the hardware
>>> itself was performing Rx checksum offload only on tunnels with an
>>> outer IPv4 header and ignoring tunnels with an outer IPv6 header.
>> I don't get it, are you trying to say that the issue is in the RX side ?
>> what do you mean by ignoring ? Dropping ? or just not validating checksum ?
>> if so why would you disable GSO and IPv6 checksumming on TX ?
> I'm suspecting that whatever parsing logic exists in either the
> hardware or firmware may not be configured to parse tunnels with outer
> IPv6 headers.  The tell-tale sign is what occurs with an IPv6 based
> tunnel with no outer checksum.  The hardware is not performing a
> checksum on the inner headers so it reports it as a UDP frame with no
> checksum to the stack which ends up preventing us from doing GRO.
> That tells me that the hardware is not parsing IPv6 based tunnels on
> Rx.  I am assuming that if the Rx side doesn't work then there is a
> good chance that the Tx won't.
>
>>>>>    @@ -2431,7 +2435,18 @@ static netdev_features_t
>>>>> mlx4_en_features_check(struct sk_buff *skb,
>>>>>                                                  netdev_features_t
>>>>> features)
>>>>>    {
>>>>>          features = vlan_features_check(skb, features);
>>>>> -       return vxlan_features_check(skb, features);
>>>>> +       features = vxlan_features_check(skb, features);
>>>>> +
>>>>> +       /* The ConnectX-3 doesn't support outer IPv6 checksums but it does
>>>>> +        * support inner IPv6 checksums and segmentation so  we need to
>>>>> +        * strip that feature if this is an IPv6 encapsulated frame.
>>>>> +        */
>>>>> +       if (skb->encapsulation &&
>>>>> +           (skb->ip_summed == CHECKSUM_PARTIAL) &&
>>>>> +           (ip_hdr(skb)->version != 4))
>>>>> +               features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
>>>> Dejavu, didn't you fix this already in harmonize_features, in
>>>> i.e, it is enough to do here:
>>>>
>>>> if (skb->encapsulation && (skb->ip_summed == CHECKSUM_PARTIAL))
>>>>              features &= ~NETIF_F_IPV6_CSUM;
>>>>
>>> So what this patch is doing is enabling an inner IPv6 header offloads.
>>> Up above we set the NETIF_F_IPV6_CSUM bit and we want it to stay set
>>> unless we have an outer IPv6 header because the inner headers may
>>> still need that bit set.  If I did what you suggest it strips IPv6
>>> checksum support for inner headers and if we have to use GSO partial I
>>> ended up encountering some of the other bugs that I have fixed for GSO
>>> partial where either sg or csum are not defined.
>>>
>> I see, you mean that you want to disable checksumming and GSO only for
>> packets with Outer(IPv6):Inner(X) and keep it in case for
>> Outer(IPv4):Inner(IPv6)
>> but i think it is weird that the driver decides to disable features it
>> didn't declare in first place (NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK)
>>
>> Retry:
>>
>> if (skb->encapsulation && (skb->ip_summed == CHECKSUM_PARTIAL) &&
>>      (ip_hdr(skb)->version != 4))
>>              features &= ~NETIF_F_IPV6_CSUM;
>>
>> will this work ?
> Sort of.  All that would happen is that you would fall through to
> harmonize_features where NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK gets
> cleared.  I just figured I would short-cut things since we cannot
> support inner checksum or any GSO offloads if the tunnel has an outer
> IPv6 header.  In addition this happens to effectively be the same code
> I am using in vxlan_features_check to disable things if we cannot
> checksum a protocol so it should help to keep the code size smaller
> for the function if the compiler is smart enough to coalesce similar
> code.
>
>> Anyway i prefer to debug the mlx4 issue first before we discuss the
>> best approach to disable checksumming & GSO for outer IPv6 in mlx4.
> The current code as-is already has it disabled.  All I am doing is
> enabling IPv6 checksums for inner headers as it seems like it doesn't
> work for outer headers.

Hi Alex,
I will be working on the mlx4 issue next week after the holidays.
I will check this offline in-house, without blocking the series.

Regards,
Tariq

^ permalink raw reply

* Re: [PATCH net-next] drivers/net: add 6WIND SHULTI support
From: Nicolas Dichtel @ 2016-04-27 15:38 UTC (permalink / raw)
  To: Jiri Pirko, Florian Westphal; +Cc: davem, netdev
In-Reply-To: <20160427151336.GB1962@nanopsycho.orion>

Le 27/04/2016 17:14, Jiri Pirko a écrit :
> Wed, Apr 27, 2016 at 11:56:15AM CEST, fw@strlen.de wrote:
>> Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
>>> This patch adds the support of the 6WIND SHULTI switch. It is a software
>>> switch doing L2 forwarding.
>>>
>>> This first version implements the minimum needed to get the device working.
>>> It also implements, via switchdev and rtnetlink, bridge forwarding offload,
>>> including FDB static entries, FDB learning and FDB ageing.
>>
>> How is this different from net/bridge?
>> How is this different from openvswitch?
> 
> The difference is that it this tries to allow userspace crap to mirror
> setting user does for bridge/ovs. Basically this looks to me like an
> attempt to enable userspace SDKs and such.
> 
It is software switch, allowed by the switchdev model (see
Documentation/networking/switchdev.txt), same design as mellanox spectrum.

What's wrong with that?

^ permalink raw reply

* Re: [PATCH] MAINTAINERS: net: Change maintainer for GRETH 10/100/1G Ethernet MAC device driver
From: Sam Ravnborg @ 2016-04-27 15:37 UTC (permalink / raw)
  To: Andreas Larsson; +Cc: David S. Miller, netdev, linux-kernel, software
In-Reply-To: <1461768370-3011-1-git-send-email-andreas@gaisler.com>

Hi Andreas.

Tak!

	Sam

On Wed, Apr 27, 2016 at 04:46:10PM +0200, Andreas Larsson wrote:
> Signed-off-by: Andreas Larsson <andreas@gaisler.com>
> ---
>  MAINTAINERS |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1d5b4be..08ffebd 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4903,7 +4903,7 @@ F:	net/ipv4/gre_offload.c
>  F:	include/net/gre.h
>  
>  GRETH 10/100/1G Ethernet MAC device driver
> -M:	Kristoffer Glembo <kristoffer@gaisler.com>
> +M:	Andreas Larsson <andreas@gaisler.com>
>  L:	netdev@vger.kernel.org
>  S:	Maintained
>  F:	drivers/net/ethernet/aeroflex/
> -- 
> 1.7.10.4
> 

^ permalink raw reply

* Re: ixgbe: cannot enable LRO
From: Alexander Duyck @ 2016-04-27 15:37 UTC (permalink / raw)
  To: Otto Sabart; +Cc: Netdev, Jirka Hladky, Adam Okuliar
In-Reply-To: <20160427093646.GA15205@redhat.com>

On Wed, Apr 27, 2016 at 2:36 AM, Otto Sabart <osabart@redhat.com> wrote:
>
> Hello everyone,
> does anybody have a problem with LRO on ixge (on latest 4.6-rc5)?
> I cannot find a way to enable it.
>
> On stable RHEL7.2 kernel everything works fine.
>
> I opened a bug report [0].
>
> [0] https://bugzilla.kernel.org/show_bug.cgi?id=117291
>
>
> Thanks!
>
> Ota

So I am able to turn on LRO without any issues.

Do you know if you have done anything that might disable LRO such as
modified the rx-usecs to a value less than 10 or enabled routing or
bridging on the device?  Also I think a stacked device might be able
to block you from enabling LRO unless all the devices stacked on the
interface can support it.

- Alex

^ permalink raw reply

* Re: [PATCH] ip: add udp_csum, udp6_csum_tx, udp6_csum_rx control flags to ip l2tp add tunnel
From: Wang Shanker @ 2016-04-27 15:33 UTC (permalink / raw)
  To: James Chapman; +Cc: netdev
In-Reply-To: <CAEwTi7SkMrgxpPi-EuC2UDiwv7L0-vdRAhtdAYLgnbnw5H-Eig@mail.gmail.com>



> 在 2016年4月27日,20:21,James Chapman <jchapman@katalix.com> 写道:
> 
> On 26 April 2016 at 15:15, Wang Shanker <shankerwangmiao@gmail.com> wrote:
>> Hi, all
>> 
>> It’s my first time to contribute to such an important open source project. Things began when I upgraded my server, called "Server A", form ubuntu 14.04 to 16.04, which is shipped with new kernel version, 4.4. After upgrade, I soon found a l2tp tunnel between this server and another linux server, called "Server B", via ipv6 broke down. Here is the network topology:
>> 
>>  +----------+                    +----------+
>>  | Server A | -- IPV6 Network -- | Server B |
>>  +----------+                    +----------+
>> 
>> The l2tp tunnel was encapsulated in udp datagrams. All the configuration was normal and could work after I reverted the kernel on Server A to original version.
>> 
>> Here is what i did to create the tunnel:
>> 
>> ```
>> on Server A:
>> 
>> ip l2tp add tunnel tunnel_id 86 peer_tunnel_id 86 remote 2001:db8::aaaa local 2001:db8::bbbb udp_sport 1086 udp_dport 1086
>> ip l2tp add session name l2tpeth0 tunnel_id 86 session_id 86 peer_session_id 86
>> ip l s l2tpeth0 up
>> 
>> on Server B:
>> 
>> ip l2tp add tunnel tunnel_id 86 peer_tunnel_id 86 local 2001:db8::aaaa remote 2001:db8::bbbb udp_sport 1086 udp_dport 1086
>> ip l2tp add session name l2tpeth0 tunnel_id 86 session_id 86 peer_session_id 86
>> ip l s l2tpeth0 up
>> 
>> ```
>> 
>> When I used tcpdump to diagnose the problem, I got such result:
>> 
>> ```
>> on Server A:
>> 
>> arping -i l2tpeth0 -0 1.2.3.4
>> 
>> on Server B:
>> 
>> tcpdump -i eth0 -n port 1086  -v
>> 
>> 21:35:57.818810 IP6 (flowlabel 0x8f028, hlim 64, next-header UDP (17) payload length: 62) 2001:db8::aaaa.1086 > 2001:db8::bbbb.1086: [bad udp cksum 0x0000 -> 0x1140!] UDP, length 54
>> 21:35:58.820572 IP6 (flowlabel 0x8f028, hlim 64, next-header UDP (17) payload length: 62) 2001:db8::aaaa.1086 > 2001:db8::bbbb.1086: [bad udp cksum 0x0000 -> 0x1140!] UDP, length 54
>> 21:35:59.822216 IP6 (flowlabel 0x8f028, hlim 64, next-header UDP (17) payload length: 62) 2001:db8::aaaa.1086 > 2001:db8::bbbb.1086: [bad udp cksum 0x0000 -> 0x1140!] UDP, length 54
>> 
>> ```
>> 
>> After looking into kernel source, I found out that in this commit a new feature to set udp6 checksum to zero in commit 6b649fe, which added `L2TP_ATTR_UDP_ZERO_CSUM6_TX` and `L2TP_ATTR_UDP_ZERO_CSUM6_TX`.
>> 
>> As a result, I added `udp_csum`, `udp6_csum_tx`, `udp6_csum_rx` control flags to `ip l2tp add tunnel` to control those attributes about checksum.
>> 
>> Using this to create the tunnel instead on Server A:
>> 
>> ```
>> ip l2tp add tunnel tunnel_id 86 peer_tunnel_id 86 remote 2001:db8::aaaa local 2001:db8::bbbb udp_sport 1086 udp_dport 1086 udp6_csum_tx on udp6_csum_rx on
>> ```
>> 
>> I finally got:
>> 
>> ```
>> on Server A:
>> 
>> arping -i l2tpeth0 -0 1.2.3.4
>> 
>> on Server B:
>> 
>> tcpdump -i eth0 -n port 1086  -v
>> 
>> 22:07:03.844297 IP6 (flowlabel 0x8f028, hlim 64, next-header UDP (17) payload length: 62) 2001:db8::aaaa.1086 > 2001:db8::bbbb.1086: [udp sum ok] UDP, length 54
>> 22:07:04.845717 IP6 (flowlabel 0x8f028, hlim 64, next-header UDP (17) payload length: 62) 2001:db8::aaaa.1086 > 2001:db8::bbbb.1086: [udp sum ok] UDP, length 54
>> 22:07:05.847965 IP6 (flowlabel 0x8f028, hlim 64, next-header UDP (17) payload length: 62) 2001:db8::aaaa.1086 > 2001:db8::bbbb.1086: [udp sum ok] UDP, length 54
>> 
>> tcpdump -i l2tpeth0 -v
>> 
>> 22:10:35.691326 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 1.2.3.4 tell 0.0.0.0, length 28
>> 22:10:36.693627 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 1.2.3.4 tell 0.0.0.0, length 28
>> 22:10:37.695010 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 1.2.3.4 tell 0.0.0.0, length 28
>> 22:10:38.697121 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 1.2.3.4 tell 0.0.0.0, length 28
>> 
>> ```
>> 
>> It seems to work. However, is it the real point that should be fixed and does my patch fix it well? I need your suggestion.
> 
> This seems reasonable to me. It is good to provide user control of
> L2TP checksum options.
> 
> However, there is a problem with your patch. The netlink attributes
> you are accessing to control checksums are flags, not u8 values.

I’m not so familiar with kernel code. However, in `<linux/l2tp.h>` : 

```

/*
 * ATTR types defined for L2TP
 */
enum {
	L2TP_ATTR_NONE,			/* no data */
// ...
	L2TP_ATTR_IP6_DADDR,		/* struct in6_addr */
	L2TP_ATTR_UDP_ZERO_CSUM6_TX,	/* u8 */
	L2TP_ATTR_UDP_ZERO_CSUM6_RX,	/* u8 */
// ...

}
```

isn’t L2TP_ATTR_UDP_ZERO_CSUM6_TX a u8 value? Or should I use `addattr` instead of `addattr8`? 

> 
> Maybe the default checksum setting for such l2tp tunnels should be
> changed in the l2tp kernel code to match the previous behaviour where
> IPv6 checksums were disabled?

I think so. However, I’m confused with those code.

From the name of the attrs `L2TP_ATTR_UDP_ZERO_CSUM6_TX` and `L2TP_ATTR_UDP_ZERO_CSUM6_RX`, I 
can tell that when those flags are set, the checksum will be zero. Also, according to the 
comment of commit 6b649fe in kernel source, “Added new L2TP configuration options to allow 
TX and RX of zero checksums in IPv6. Default is not to use them.”, checksums shouldn't have
been zero by default. However, in fact, they are. I think there may be some bugs in kernel
source. 

> 
>> 
>> 
>> ---
>> ip/ipl2tp.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 45 insertions(+)
>> 
>> diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
>> index 3c8ee93..67a6482 100644
>> --- a/ip/ipl2tp.c
>> +++ b/ip/ipl2tp.c
>> @@ -56,6 +56,8 @@ struct l2tp_parm {
>> 
>>        uint16_t pw_type;
>>        uint16_t mtu;
>> +       int udp6_csum_tx:1;
>> +       int udp6_csum_rx:1;
>>        int udp_csum:1;
>>        int recv_seq:1;
>>        int send_seq:1;
>> @@ -117,6 +119,9 @@ static int create_tunnel(struct l2tp_parm *p)
>>        if (p->encap == L2TP_ENCAPTYPE_UDP) {
>>                addattr16(&req.n, 1024, L2TP_ATTR_UDP_SPORT, p->local_udp_port);
>>                addattr16(&req.n, 1024, L2TP_ATTR_UDP_DPORT, p->peer_udp_port);
>> +               addattr8 (&req.n, 1024, L2TP_ATTR_UDP_CSUM, p->udp_csum);
>> +               addattr8 (&req.n, 1024, L2TP_ATTR_UDP_ZERO_CSUM6_TX, p->udp6_csum_tx);
>> +               addattr8 (&req.n, 1024, L2TP_ATTR_UDP_ZERO_CSUM6_RX, p->udp6_csum_rx);
>>        }
>> 
>>        if (rtnl_talk(&genl_rth, &req.n, NULL, 0) < 0)
>> @@ -282,6 +287,14 @@ static int get_response(struct nlmsghdr *n, void *arg)
>>                p->l2spec_len = rta_getattr_u8(attrs[L2TP_ATTR_L2SPEC_LEN]);
>> 
>>        p->udp_csum = !!attrs[L2TP_ATTR_UDP_CSUM];
>> +       if (attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX])
>> +         p->udp6_csum_tx = rta_getattr_u8(attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX]);
>> +       else
>> +         p->udp6_csum_tx = 1;
>> +       if (attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX])
>> +         p->udp6_csum_rx = rta_getattr_u8(attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX]);
>> +       else
>> +         p->udp6_csum_rx = 1;
>>        if (attrs[L2TP_ATTR_COOKIE])
>>                memcpy(p->cookie, RTA_DATA(attrs[L2TP_ATTR_COOKIE]),
>>                       p->cookie_len = RTA_PAYLOAD(attrs[L2TP_ATTR_COOKIE]));
>> @@ -470,6 +483,9 @@ static void usage(void)
>>        fprintf(stderr, "          tunnel_id ID peer_tunnel_id ID\n");
>>        fprintf(stderr, "          [ encap { ip | udp } ]\n");
>>        fprintf(stderr, "          [ udp_sport PORT ] [ udp_dport PORT ]\n");
>> +       fprintf(stderr, "          [ udp_csum { on | off } ]\n");
>> +       fprintf(stderr, "          [ udp6_csum_tx { on | off } ]\n");
>> +       fprintf(stderr, "          [ udp6_csum_rx { on | off } ]\n");
>>        fprintf(stderr, "Usage: ip l2tp add session [ name NAME ]\n");
>>        fprintf(stderr, "          tunnel_id ID\n");
>>        fprintf(stderr, "          session_id ID peer_session_id ID\n");
>> @@ -500,6 +516,8 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
>>        /* Defaults */
>>        p->l2spec_type = L2TP_L2SPECTYPE_DEFAULT;
>>        p->l2spec_len = 4;
>> +       p->udp6_csum_rx = 1;
>> +       p->udp6_csum_tx = 1;
>> 
>>        while (argc > 0) {
>>                if (strcmp(*argv, "encap") == 0) {
>> @@ -569,6 +587,33 @@ static int parse_args(int argc, char **argv, int cmd, struct l2tp_parm *p)
>>                        if (get_u16(&uval, *argv, 0))
>>                                invarg("invalid port\n", *argv);
>>                        p->peer_udp_port = uval;
>> +               } else if (strcmp(*argv, "udp_csum") == 0) {
>> +                       NEXT_ARG();
>> +                       if (strcmp(*argv, "on") == 0) {
>> +                               p->udp_csum = 1;
>> +                       } else if (strcmp(*argv, "off") == 0) {
>> +                               p->udp_csum = 0;
>> +                       } else {
>> +                               invarg("invalid option for udp_csum\n", *argv);
>> +                       }
>> +               } else if (strcmp(*argv, "udp6_csum_rx") == 0) {
>> +                       NEXT_ARG();
>> +                       if (strcmp(*argv, "on") == 0) {
>> +                               p->udp6_csum_rx = 1;
>> +                       } else if (strcmp(*argv, "off") == 0) {
>> +                               p->udp6_csum_rx = 0;
>> +                       } else {
>> +                               invarg("invalid option for udp6_csum_rx\n", *argv);
>> +                       }
>> +               } else if (strcmp(*argv, "udp6_csum_tx") == 0) {
>> +                       NEXT_ARG();
>> +                       if (strcmp(*argv, "on") == 0) {
>> +                               p->udp6_csum_tx = 1;
>> +                       } else if (strcmp(*argv, "off") == 0) {
>> +                               p->udp6_csum_tx = 0;
>> +                       } else {
>> +                               invarg("invalid option for udp6_csum_tx\n", *argv);
>> +                       }
>>                } else if (strcmp(*argv, "offset") == 0) {
>>                        __u8 uval;
>> 
>> --
>> 2.5.2
>> 

^ permalink raw reply

* Re: [PATCH v2 net-next 11/13] Documentation: Bindings: Update DT binding for separating dsaf dev support
From: Rob Herring @ 2016-04-27 15:25 UTC (permalink / raw)
  To: Yisen Zhuang
  Cc: David Miller, devicetree@vger.kernel.org, netdev,
	linux-arm-kernel@lists.infradead.org, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Will Deacon, Catalin Marinas, yankejian,
	huangdaode, salil.mehta, lipeng321, liguozhu, xieqianqian, Wei Xu,
	Linuxarm
In-Reply-To: <57203309.1090501@huawei.com>

On Tue, Apr 26, 2016 at 10:33 PM, Yisen Zhuang <Yisen.zhuang@huawei.com> wrote:
> Hi Rob and David,
>
> Please see my comments inline.
>
> David have merged this series to net-next, but we need to modify some codes according
> to Rob's comments. I am not sure if i need to send V3 for this series, or separate
> patches of documentation to independent series and generate a new patch for hns base
> on current net-next?

That's David's call. I'm guessing he wants follow-up patches on top of these.

> 在 2016/4/26 20:48, Rob Herring 写道:
>> On Sat, Apr 23, 2016 at 05:05:15PM +0800, Yisen Zhuang wrote:
>>> Because debug dsaf port was separated from service dsaf port, this patch
>>> updates the related information of DT binding.
>>
>> Separated when? New version of the h/w? If so, where's the new
>> compatible string? This is quite a big binding change.
>
> There isn't any change of h/w. I separated debug dsaf port from sevice dsaf
> port to make the code more simple and readability.

Okay.

[...]

>>> +  serdes-syscon rather than this address.
>>>    The third region is the PPE register base and size.
>>> -  The fourth region is dsa fabric base register and size.
>>> -  The fifth region is cpld base register and size, it is not required if do not use cpld.
>>> -- phy-handle: phy handle of physicl port, 0 if not any phy device. see ethernet.txt [1].
>>> +  The fourth region is dsa fabric base register and size. It is not required for
>>> +  single-port mode.
>>> +- reg-names: may be ppe-base and(or) dsaf-base. It is used to find the
>>> +  corresponding reg's index.
>>
>> But you have up to 5 regions.
>>
>> The variable nature of what regions you have tells me you need more
>> specific compatible strings for each chip.
>
> we didn't add support of new h/w. We added these regions to make code simple and readability.
> If we need to add support of next h/w version next time, we don't need to add many branches
> for these attributes. So we didn't add a new compatible here.

Not sure what you mean by branches. It's fine to put properties for
things that vary among h/w versions, but new compatible strings will
be needed for any new versions.


>>> +- port: subnodes of dsaf. A dsaf node may contain several port nodes(Depending
>>> +  on mode of dsaf). Port node contain some attributes listed below:
>>> +- port-id: is physical port index in one dsaf.
>>
>> Indexes should generally be avoided. What does the number correspond
>> to in h/w (if anything)?
>
> port-id is index for a port in dsaf, it is correspond to index of PHY showed below.

Okay, you should use reg property here instead.

>
>                                                          CPU
>                                                           |
>                                     -----------------------------------
>                                     |                     |           |
>     ----------------------------------------------    ---------   ---------
>     |                         |                  |    |       |   |   |   |
>     |                        PPE                 |    |  PPE  |   |  PPE  |
>     |                         |                  |    |   |   |   |   |   |
>     |                         |                  |    |   |   |   |   |   |
>     |                      crossbar              |    |   |   |   |   |   |
>     |                         |                  |    |   |   |   |   |   |
>     |   ----------------------------------       |    |   |   |   |   |   |
>     |   |     |     |      |      |      |       |    |   |   |   |   |   |
>     |   |     |     |      |      |      |       |    |   |   |   |   |   |
>     |  MAC   MAC   MAC    MAC    MAC    MAC      |    |  MAC  |   |  MAC  |
>     |   |     |     |      |      |      |       |    |   |   |   |   |   |
>     ----------------------------------------------    ---------   ---------
>         |     |     |      |      |      |    \        /  |        /  |
>        PHY   PHY   PHY    PHY    PHY    PHY    \      /  PHY      /  PHY
>                                                 \    /           /
>                                                  \  /           /
>                                              DSAF(three platform device)
>
>>
>>> +- phy-handle: phy handle of physicl port. It is not required if there isn't

Another typo here.

Rob

^ permalink raw reply

* Re: [RFC PATCH 4/5] bnxt: Add support for segmentation of tunnels with outer checksums
From: Alexander Duyck @ 2016-04-27 15:21 UTC (permalink / raw)
  To: Michael Chan
  Cc: Alexander Duyck, eugenia, Bruce W Allan, Saeed Mahameed, Netdev,
	intel-wired-lan, Ariel Elior, Michael Chan
In-Reply-To: <CACKFLi=2mHfOS1Rz5RbSdyhepdjBqM+dj7Nh=CzARcYSwUTcSw@mail.gmail.com>

On Tue, Apr 26, 2016 at 10:55 PM, Michael Chan
<michael.chan@broadcom.com> wrote:
> On Tue, Apr 19, 2016 at 12:06 PM, Alexander Duyck <aduyck@mirantis.com> wrote:
>> This patch assumes that the bnxt hardware will ignore existing IPv4/v6
>> header fields for length and checksum as well as the length and checksum
>> fields for outer UDP and GRE headers.
>>
>> I have no means of testing this as I do not have any bnx2x hardware but
>> thought I would submit it as an RFC to see if anyone out there wants to
>> test this and see if this does in fact enable this functionality allowing
>> us to to segment tunneled frames that have an outer checksum.
>>
>> Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
>
> Hi Alex, I just did a very quick test of this patch on our bnxt
> hardware and it seemed to work.
>
> I created a vxlan endpoint with udpcsum enabled and I saw TSO packets
> getting through.  I've verified that our hardware can be programmed to
> either ignore outer UDP checksum or to calculate it.  Current default
> is to ignore ipv4 UDP checksum and calculate ipv6 UDP checksum.
> Thanks.

Are you saying you can natively support UDP tunnel with outer checksum
offload then?

I'm just trying to sort out if you actually need to have the partial
segmentation offload support or if we can handle it in hardware.  Also
is there any documentation you could point me to that might help to
clarify what the hardware does/doesn't support so that I could improve
upon this patch in order to make sure we are getting the most bang for
the buck in terms of the features that can be offloaded by hardware?

Thanks.

- Alex

^ permalink raw reply

* Re: [PATCH net-next] drivers/net: add 6WIND SHULTI support
From: Jiri Pirko @ 2016-04-27 15:14 UTC (permalink / raw)
  To: Florian Westphal; +Cc: Nicolas Dichtel, davem, netdev
In-Reply-To: <20160427095615.GA27071@breakpoint.cc>

Wed, Apr 27, 2016 at 11:56:15AM CEST, fw@strlen.de wrote:
>Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
>> This patch adds the support of the 6WIND SHULTI switch. It is a software
>> switch doing L2 forwarding.
>> 
>> This first version implements the minimum needed to get the device working.
>> It also implements, via switchdev and rtnetlink, bridge forwarding offload,
>> including FDB static entries, FDB learning and FDB ageing.
>
>How is this different from net/bridge?
>How is this different from openvswitch?

The difference is that it this tries to allow userspace crap to mirror
setting user does for bridge/ovs. Basically this looks to me like an
attempt to enable userspace SDKs and such.

^ permalink raw reply

* [PATCH] MAINTAINERS: net: Change maintainer for GRETH 10/100/1G Ethernet MAC device driver
From: Andreas Larsson @ 2016-04-27 14:46 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: linux-kernel, Sam Ravnborg, software

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
---
 MAINTAINERS |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1d5b4be..08ffebd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4903,7 +4903,7 @@ F:	net/ipv4/gre_offload.c
 F:	include/net/gre.h
 
 GRETH 10/100/1G Ethernet MAC device driver
-M:	Kristoffer Glembo <kristoffer@gaisler.com>
+M:	Andreas Larsson <andreas@gaisler.com>
 L:	netdev@vger.kernel.org
 S:	Maintained
 F:	drivers/net/ethernet/aeroflex/
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH v2 2/2] net: nps_enet: bug fix - handle lost tx interrupts
From: Elad Kanfi @ 2016-04-27 13:18 UTC (permalink / raw)
  To: davem; +Cc: noamca, linux-kernel, abrodkin, eladkan, talz, netdev
In-Reply-To: <1461763110-15263-1-git-send-email-eladkan@mellanox.com>

From: Elad Kanfi <eladkan@mellanox.com>

The tx interrupt is of edge type, and in case such interrupt is triggered
while it is masked it will not be handled even after tx interrupts are
re-enabled in the end of NAPI poll.
This will cause tx network to stop in the following scenario:
 * Rx is being handled, hence interrupts are masked.
 * Tx interrupt is triggered after checking if there is some tx to handle
   and before re-enabling the interrupts.
In this situation only rx transaction will release tx requests.

In order to handle the tx that was missed( if there was one ),
a NAPI reschdule was added after enabling the interrupts.

Signed-off-by: Elad Kanfi <eladkan@mellanox.com>

Acked-by: Noam Camus <noamca@mellanox.com>
---
 drivers/net/ethernet/ezchip/nps_enet.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index 1373236..31e27a7 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -183,6 +183,8 @@ static int nps_enet_poll(struct napi_struct *napi, int budget)
 	work_done = nps_enet_rx_handler(ndev);
 	if (work_done < budget) {
 		u32 buf_int_enable_value = 0;
+		u32 tx_ctrl_value = nps_enet_reg_get(priv, NPS_ENET_REG_TX_CTL);
+		u32 tx_ctrl_ct = (tx_ctrl_value & TX_CTL_CT_MASK) >> TX_CTL_CT_SHIFT;
 
 		napi_complete(napi);
 
@@ -192,6 +194,18 @@ static int nps_enet_poll(struct napi_struct *napi, int budget)
 
 		nps_enet_reg_set(priv, NPS_ENET_REG_BUF_INT_ENABLE,
 				 buf_int_enable_value);
+
+		/* in case we will get a tx interrupt while interrupts
+		 * are masked, we will lose it since the tx is edge interrupt.
+		 * specifically, while executing the code section above,
+		 * between nps_enet_tx_handler and the interrupts enable, all
+		 * tx requests will be stuck until we will get an rx interrupt.
+		 * the two code lines below will solve this situation by
+		 * re-adding ourselves to the poll list.
+		 */
+
+		if (priv->tx_packet_sent && !tx_ctrl_ct)
+			napi_reschedule(napi);
 	}
 
 	return work_done;
-- 
1.7.1

^ permalink raw reply related

* [PATCH iproute2 2/2] ip link gre: print only relevant info in external mode
From: Jiri Benc @ 2016-04-27 14:11 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Paolo Abeni, Pravin Shelar
In-Reply-To: <cover.1461766016.git.jbenc@redhat.com>

Display only attributes that are relevant when a GRE interface is in
'external' mode instead of the default values (which are ignored by the
kernel even if passed back).

Fixes: 926b39e1feffd ("gre: add support for collect metadata flag")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 ip/link_gre.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/ip/link_gre.c b/ip/link_gre.c
index 36ce1252675b..492c22053b89 100644
--- a/ip/link_gre.c
+++ b/ip/link_gre.c
@@ -339,7 +339,7 @@ get_failed:
 	return 0;
 }
 
-static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
+static void gre_print_direct_opt(FILE *f, struct rtattr *tb[])
 {
 	char s2[64];
 	const char *local = "any";
@@ -347,9 +347,6 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 	unsigned int iflags = 0;
 	unsigned int oflags = 0;
 
-	if (!tb)
-		return;
-
 	if (tb[IFLA_GRE_REMOTE]) {
 		unsigned int addr = rta_getattr_u32(tb[IFLA_GRE_REMOTE]);
 
@@ -421,8 +418,16 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
 		fputs("icsum ", f);
 	if (oflags & GRE_CSUM)
 		fputs("ocsum ", f);
+}
 
-	if (tb[IFLA_GRE_COLLECT_METADATA])
+static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
+{
+	if (!tb)
+		return;
+
+	if (!tb[IFLA_GRE_COLLECT_METADATA])
+		gre_print_direct_opt(f, tb);
+	else
 		fputs("external ", f);
 
 	if (tb[IFLA_GRE_ENCAP_TYPE] &&
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH iproute2 1/2] ip link gre: create interfaces in external mode correctly
From: Jiri Benc @ 2016-04-27 14:11 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Paolo Abeni, Pravin Shelar
In-Reply-To: <cover.1461766016.git.jbenc@redhat.com>

For GRE interfaces in 'external' mode, the kernel ignores all manual
settings like remote IP address or TTL. However, for some of those
attributes, kernel checks their value and does not allow them to be zero
(even though they're ignored later).

Currently, 'ip link' always includes all attributes in the netlink message.
This leads to problem with creating interfaces in 'external' mode. For
example, this command does not work:

ip link add gre1 type gretap external

and needs a bogus remote IP address to be specified, as the kernel enforces
remote IP address to be either not present, or not null.

Ignore the parameters that do not make sense in 'external' mode.
Unfortunately, we cannot error out, as there may be existing deployments
that workarounded the bug by specifying bogus values.

Fixes: 926b39e1feffd ("gre: add support for collect metadata flag")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 ip/link_gre.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/ip/link_gre.c b/ip/link_gre.c
index bcf003aaa5d7..36ce1252675b 100644
--- a/ip/link_gre.c
+++ b/ip/link_gre.c
@@ -315,24 +315,26 @@ get_failed:
 		return -1;
 	}
 
-	addattr32(n, 1024, IFLA_GRE_IKEY, ikey);
-	addattr32(n, 1024, IFLA_GRE_OKEY, okey);
-	addattr_l(n, 1024, IFLA_GRE_IFLAGS, &iflags, 2);
-	addattr_l(n, 1024, IFLA_GRE_OFLAGS, &oflags, 2);
-	addattr_l(n, 1024, IFLA_GRE_LOCAL, &saddr, 4);
-	addattr_l(n, 1024, IFLA_GRE_REMOTE, &daddr, 4);
-	addattr_l(n, 1024, IFLA_GRE_PMTUDISC, &pmtudisc, 1);
-	if (link)
-		addattr32(n, 1024, IFLA_GRE_LINK, link);
-	addattr_l(n, 1024, IFLA_GRE_TTL, &ttl, 1);
-	addattr_l(n, 1024, IFLA_GRE_TOS, &tos, 1);
+	if (!metadata) {
+		addattr32(n, 1024, IFLA_GRE_IKEY, ikey);
+		addattr32(n, 1024, IFLA_GRE_OKEY, okey);
+		addattr_l(n, 1024, IFLA_GRE_IFLAGS, &iflags, 2);
+		addattr_l(n, 1024, IFLA_GRE_OFLAGS, &oflags, 2);
+		addattr_l(n, 1024, IFLA_GRE_LOCAL, &saddr, 4);
+		addattr_l(n, 1024, IFLA_GRE_REMOTE, &daddr, 4);
+		addattr_l(n, 1024, IFLA_GRE_PMTUDISC, &pmtudisc, 1);
+		if (link)
+			addattr32(n, 1024, IFLA_GRE_LINK, link);
+		addattr_l(n, 1024, IFLA_GRE_TTL, &ttl, 1);
+		addattr_l(n, 1024, IFLA_GRE_TOS, &tos, 1);
+	} else {
+		addattr_l(n, 1024, IFLA_GRE_COLLECT_METADATA, NULL, 0);
+	}
 
 	addattr16(n, 1024, IFLA_GRE_ENCAP_TYPE, encaptype);
 	addattr16(n, 1024, IFLA_GRE_ENCAP_FLAGS, encapflags);
 	addattr16(n, 1024, IFLA_GRE_ENCAP_SPORT, htons(encapsport));
 	addattr16(n, 1024, IFLA_GRE_ENCAP_DPORT, htons(encapdport));
-	if (metadata)
-		addattr_l(n, 1024, IFLA_GRE_COLLECT_METADATA, NULL, 0);
 
 	return 0;
 }
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH iproute2 0/2] ip link gre: fix external mode handling
From: Jiri Benc @ 2016-04-27 14:11 UTC (permalink / raw)
  To: netdev; +Cc: Stephen Hemminger, Paolo Abeni, Pravin Shelar

Fix two bugs with handling of the 'external' keyword for GRE.

Jiri Benc (2):
  ip link gre: create interfaces in external mode correctly
  ip link gre: print only relevant info in external mode

 ip/link_gre.c | 43 +++++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 18 deletions(-)

-- 
1.8.3.1

^ permalink raw reply

* Re: [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag
From: Lino Sanfilippo @ 2016-04-27 13:56 UTC (permalink / raw)
  To: Elad Kanfi, davem; +Cc: noamca, linux-kernel, abrodkin, talz, netdev
In-Reply-To: <1461763110-15263-2-git-send-email-eladkan@mellanox.com>

Hi,

On 27.04.2016 15:18, Elad Kanfi wrote:
> From: Elad Kanfi <eladkan@mellanox.com>
>
> Below is a description of a possible problematic
> sequence. CPU-A is sending a frame and CPU-B handles
> the interrupt that indicates the frame was sent. CPU-B
> reads an invalid value of tx_packet_sent.
>
> 	CPU-A				CPU-B
> 	-----				-----
> 	nps_enet_send_frame
> 	.
> 	.
> 	tx_packet_sent = true
> 	order HW to start tx
> 	.
> 	.
> 	HW complete tx
> 			    ------> 	get tx complete interrupt
> 					.
> 					.
> 					if(tx_packet_sent == true)
>
> 	end memory transaction
> 	(tx_packet_sent actually
> 	 written)
>
> Problem solution:
>
> Add a memory barrier after setting tx_packet_sent,
> in order to make sure that it is written before
> the packet is sent.

Should not those SMP memory barriers be paired? AFAIK you do not only have to make sure
that the value written by CPU-A actually is written to memory but also that CPU-B
reads that value from memory. At least this is what I have understood from memory-barriers.txt...

Regards,
Lino

^ permalink raw reply

* RE: [net-next PATCH V2 2/5] samples/bpf: Makefile verify LLVM compiler avail and bpf target is supported
From: David Laight @ 2016-04-27 13:52 UTC (permalink / raw)
  To: 'Jesper Dangaard Brouer', netdev@vger.kernel.org
  Cc: linux-kbuild@vger.kernel.org, bblanco@plumgrid.com,
	naveen.n.rao@linux.vnet.ibm.com, borkmann@iogearbox.net,
	alexei.starovoitov@gmail.com
In-Reply-To: <20160426162716.22962.36473.stgit@firesoul>

From: Jesper Dangaard Brouer
> Sent: 26 April 2016 17:27
> Make compiling samples/bpf more user friendly, by detecting if LLVM
> compiler tool 'llc' is available, and also detect if the 'bpf' target
> is available in this version of LLVM.
...
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 5bae9536f100..45859c99f573 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -85,6 +85,24 @@ HOSTLOADLIBES_test_overhead += -lelf -lrt
>  #  make samples/bpf/ LLC=~/git/llvm/build/bin/llc
>  LLC ?= llc
> 
> +# Verify LLVM compiler is available and bpf target is supported
> +.PHONY: verify_cmd_llc verify_target_bpf
> +
> +verify_cmd_llc:
> +	@if ! (which "${LLC}" > /dev/null 2>&1); then \

You should use 'type' not 'which'.
'type' is a posix shell builtin, 'which' is a script/program
that tries to emulate a 'csh' builtin.
You want to know whether the shell that make runs can execute ${LLC}
not whether a csh would be able to run it.

You might also want to worry about:
    LLC="/path_to_llc/llc -extra_arg" make fubar

	David


^ permalink raw reply

* [PATCH v2 0/2] Net driver bugs fix
From: Elad Kanfi @ 2016-04-27 13:18 UTC (permalink / raw)
  To: davem; +Cc: noamca, linux-kernel, abrodkin, eladkan, talz, netdev

From: Elad Kanfi <eladkan@mellanox.com>

v2:
Remove code style commit for now.
Code style commit will be added after the bugs fix will be approved.

Summary:
 1. Bug description: TX done interrupts that arrives while interrupts
    are masked, during NAPI poll, will not trigger an interrupt handling.
    Since TX interrupt is of level edge we will lose the TX done interrupt.
    As a result all pending tx frames will get no service.

    Solution: Check if there is a pending tx request after unmasking the
    interrupt and if answer is yes then re-add ourselves to
    the NAPI poll list.

 2. Bug description: CPU-A before sending a frame will set a variable
    to true. CPU-B that executes the tx done interrupt service routine
    might read a non valid value of that variable.

    Solution: Add a memory barrier at the tx sending function.

Elad Kanfi (2):
  net: nps_enet: Sync access to packet sent flag
  net: nps_enet: bug fix - handle lost tx interrupts

 drivers/net/ethernet/ezchip/nps_enet.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

^ permalink raw reply

* Re: [PATCH] net: phy: at803x: Register 'link_change_notify' only for AT8030
From: Sebastian Frias @ 2016-04-27 13:50 UTC (permalink / raw)
  To: Daniel Mack, David S. Miller, netdev
  Cc: lkml, mason, Sergei Shtylyov, timur, Florian Fainelli
In-Reply-To: <5720A3C1.2040401@laposte.net>

Hi,

Sergei pointed out that the same patch was submitted yesterday by Timur (what are the chances?! :-) ) https://patchwork.ozlabs.org/patch/615019/

Regards,

Sebastian

On 04/27/2016 01:34 PM, Sebastian Frias wrote:
> There is no need to register the callback introduced by
> commit 13a56b449325 ("net: phy: at803x: Add support for hardware reset")
> for non faulty PHYs.
> 
> The check on the PHY ID is not necessary anymore and thus has been
> removed from the callback implementation as well.
> 
> Fixes: 13a56b449325 ("net: phy: at803x: Add support for hardware reset")
> 
> Signed-off-by: Sebastian Frias <sf84@laposte.net>
> ---
>  drivers/net/phy/at803x.c | 43 ++++++++++++++++++++-----------------------
>  1 file changed, 20 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index b3ffaee..7fdc676 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -353,33 +353,32 @@ static void at803x_link_change_notify(struct phy_device *phydev)
>  	struct at803x_priv *priv = phydev->priv;
>  
>  	/*
> -	 * Conduct a hardware reset for AT8030 every time a link loss is
> +	 * Conduct a hardware reset for AT8030 (this callback is only
> +	 * registered for AT8030 at the moment) every time a link loss is
>  	 * signalled. This is necessary to circumvent a hardware bug that
>  	 * occurs when the cable is unplugged while TX packets are pending
>  	 * in the FIFO. In such cases, the FIFO enters an error mode it
>  	 * cannot recover from by software.
>  	 */
> -	if (phydev->drv->phy_id == ATH8030_PHY_ID) {
> -		if (phydev->state == PHY_NOLINK) {
> -			if (priv->gpiod_reset && !priv->phy_reset) {
> -				struct at803x_context context;
> -
> -				at803x_context_save(phydev, &context);
> -
> -				gpiod_set_value(priv->gpiod_reset, 1);
> -				msleep(1);
> -				gpiod_set_value(priv->gpiod_reset, 0);
> -				msleep(1);
> -
> -				at803x_context_restore(phydev, &context);
> -
> -				phydev_dbg(phydev, "%s(): phy was reset\n",
> -					   __func__);
> -				priv->phy_reset = true;
> -			}
> -		} else {
> -			priv->phy_reset = false;
> +	if (phydev->state == PHY_NOLINK) {
> +		if (priv->gpiod_reset && !priv->phy_reset) {
> +			struct at803x_context context;
> +
> +			at803x_context_save(phydev, &context);
> +
> +			gpiod_set_value(priv->gpiod_reset, 1);
> +			msleep(1);
> +			gpiod_set_value(priv->gpiod_reset, 0);
> +			msleep(1);
> +
> +			at803x_context_restore(phydev, &context);
> +
> +			phydev_dbg(phydev, "%s(): phy was reset\n",
> +				   __func__);
> +			priv->phy_reset = true;
>  		}
> +	} else {
> +		priv->phy_reset = false;
>  	}
>  }
>  
> @@ -391,7 +390,6 @@ static struct phy_driver at803x_driver[] = {
>  	.phy_id_mask		= 0xffffffef,
>  	.probe			= at803x_probe,
>  	.config_init		= at803x_config_init,
> -	.link_change_notify	= at803x_link_change_notify,
>  	.set_wol		= at803x_set_wol,
>  	.get_wol		= at803x_get_wol,
>  	.suspend		= at803x_suspend,
> @@ -427,7 +425,6 @@ static struct phy_driver at803x_driver[] = {
>  	.phy_id_mask		= 0xffffffef,
>  	.probe			= at803x_probe,
>  	.config_init		= at803x_config_init,
> -	.link_change_notify	= at803x_link_change_notify,
>  	.set_wol		= at803x_set_wol,
>  	.get_wol		= at803x_get_wol,
>  	.suspend		= at803x_suspend,
> 

^ permalink raw reply

* [PATCH v2 1/2] net: nps_enet: Sync access to packet sent flag
From: Elad Kanfi @ 2016-04-27 13:18 UTC (permalink / raw)
  To: davem; +Cc: noamca, linux-kernel, abrodkin, eladkan, talz, netdev
In-Reply-To: <1461763110-15263-1-git-send-email-eladkan@mellanox.com>

From: Elad Kanfi <eladkan@mellanox.com>

Below is a description of a possible problematic
sequence. CPU-A is sending a frame and CPU-B handles
the interrupt that indicates the frame was sent. CPU-B
reads an invalid value of tx_packet_sent.

	CPU-A				CPU-B
	-----				-----
	nps_enet_send_frame
	.
	.
	tx_packet_sent = true
	order HW to start tx
	.
	.
	HW complete tx
			    ------> 	get tx complete interrupt
					.
					.
					if(tx_packet_sent == true)

	end memory transaction
	(tx_packet_sent actually
	 written)

Problem solution:

Add a memory barrier after setting tx_packet_sent,
in order to make sure that it is written before
the packet is sent.

Signed-off-by: Elad Kanfi <eladkan@mellanox.com>

Acked-by: Noam Camus <noamca@mellanox.com>
---
 drivers/net/ethernet/ezchip/nps_enet.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index 1f23845..1373236 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -389,6 +389,13 @@ static void nps_enet_send_frame(struct net_device *ndev,
 
 	/* Indicate SW is done */
 	priv->tx_packet_sent = true;
+
+	/* before the frame is sent we have to make
+	 * sure that priv->tx_packet_sent will be valid
+	 * for the CPU'S that handles the ISR and NAPI poll
+	 */
+	smp_wmb();
+
 	tx_ctrl_value |= NPS_ENET_ENABLE << TX_CTL_CT_SHIFT;
 	/* Send Frame */
 	nps_enet_reg_set(priv, NPS_ENET_REG_TX_CTL, tx_ctrl_value);
-- 
1.7.1

^ permalink raw reply related

* RE: [net-next PATCH 4/4] samples/bpf: allow make to be run from samples/bpf/ directory
From: David Laight @ 2016-04-27 13:15 UTC (permalink / raw)
  To: 'Alexei Starovoitov', Jesper Dangaard Brouer
  Cc: netdev@vger.kernel.org, bblanco@plumgrid.com,
	borkmann@iogearbox.net, linux-kbuild@vger.kernel.org
In-Reply-To: <20160426143524.GB39797@ast-mbp.thefacebook.com>

From: Alexei Starovoitov
> Sent: 26 April 2016 15:35
> On Tue, Apr 26, 2016 at 01:09:32PM +0200, Jesper Dangaard Brouer wrote:
> > It is not intuitive that 'make' must be run from the top level
> > directory with argument "samples/bpf/" to compile these eBPF samples.
> >
> > Introduce a kbuild make file trick that allow make to be run from the
> > "samples/bpf/" directory itself.  It basically change to the top level
> > directory and call "make samples/bpf/" with the "/" slash after the
> > directory name.
> >
> > Also add a clean target that only cleans this directory, by taking
> > advantage of the kbuild external module setting M=$PWD.
> >
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > ---
> >  samples/bpf/Makefile   |    8 ++++++++
> >  samples/bpf/README.rst |    3 +++
> >  2 files changed, 11 insertions(+)
> >
> > diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> > index 7ac66f5bbbf5..7370dfee482f 100644
> > --- a/samples/bpf/Makefile
> > +++ b/samples/bpf/Makefile
> > @@ -85,6 +85,14 @@ HOSTLOADLIBES_test_overhead += -lelf -lrt
> >  #  make samples/bpf/ LLC=~/git/llvm/build/bin/llc
> >  LLC ?= llc
> >
> > +# Trick to allow make to be run from this directory
> > +all:
> > +	$(MAKE) -C ../../ $$PWD/
> > +
> > +clean:
> > +	$(MAKE) -C ../../ M=$$PWD clean
> > +	@rm -f *~
> > +
> 
> nice trick!

Another nice 'trick' is to write a GNUmakefie containing the local rules.
GNU make will read it in preference to Makefile and makefile.

	David

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox