linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next] net: hns: add skb_reset_mac_header() after skb being alloc
@ 2016-06-13 12:41 Yisen Zhuang
  2016-06-15  5:41 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Yisen Zhuang @ 2016-06-13 12:41 UTC (permalink / raw)
  To: davem, arnd; +Cc: charles.chenxin, netdev, linux-kernel, linuxarm

From: Kejian Yan <yankejian@huawei.com>

HNS receives a packet without doing anything, but it should call
skb_reset_mac_header() to initialize the header before using
eth_hdr().

Fixes: 0d6b425a3773c3445b0f51b2f333821beaacb619
Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_enet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index ad742a6..15200e4 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -600,6 +600,7 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data,
 		ring->stats.sw_err_cnt++;
 		return -ENOMEM;
 	}
+	skb_reset_mac_header(skb);
 
 	prefetchw(skb->data);
 	length = le16_to_cpu(desc->rx.pkt_len);
-- 
1.9.1

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

* Re: [patch net-next] net: hns: add skb_reset_mac_header() after skb being alloc
  2016-06-13 12:41 [patch net-next] net: hns: add skb_reset_mac_header() after skb being alloc Yisen Zhuang
@ 2016-06-15  5:41 ` David Miller
  2016-06-15 10:30   ` Yisen Zhuang
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2016-06-15  5:41 UTC (permalink / raw)
  To: Yisen.Zhuang; +Cc: arnd, charles.chenxin, netdev, linux-kernel, linuxarm

From: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Date: Mon, 13 Jun 2016 20:41:22 +0800

> From: Kejian Yan <yankejian@huawei.com>
> 
> HNS receives a packet without doing anything, but it should call
> skb_reset_mac_header() to initialize the header before using
> eth_hdr().
> 
> Fixes: 0d6b425a3773c3445b0f51b2f333821beaacb619
> Signed-off-by: Kejian Yan <yankejian@huawei.com>
> Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>

Well, this patch made me look at this function.

You really shouldn't be filtering packets looped back, that is
the stack's job.  It shouldn't be happening in the driver.

And once you remove that code, this patch here is no longer
necessary.

Second of all, unless you card supports every protocol that
exists in the past, present, and _future_ you cannot set
skb->ip_summed to CHECKSUM_UNNECSSARY unconditionally like
that.

You can only set that for protocols your chip actually supports.

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

* Re: [patch net-next] net: hns: add skb_reset_mac_header() after skb being alloc
  2016-06-15  5:41 ` David Miller
@ 2016-06-15 10:30   ` Yisen Zhuang
  2016-06-20  7:12     ` Yisen Zhuang
  0 siblings, 1 reply; 5+ messages in thread
From: Yisen Zhuang @ 2016-06-15 10:30 UTC (permalink / raw)
  To: David Miller; +Cc: arnd, charles.chenxin, netdev, linux-kernel, linuxarm

Hi David,

Thanks for your suggestions.

Please see my comments below.

Thanks,

Yisen

在 2016/6/15 13:41, David Miller 写道:
> From: Yisen Zhuang <Yisen.Zhuang@huawei.com>
> Date: Mon, 13 Jun 2016 20:41:22 +0800
> 
>> From: Kejian Yan <yankejian@huawei.com>
>>
>> HNS receives a packet without doing anything, but it should call
>> skb_reset_mac_header() to initialize the header before using
>> eth_hdr().
>>
>> Fixes: 0d6b425a3773c3445b0f51b2f333821beaacb619
>> Signed-off-by: Kejian Yan <yankejian@huawei.com>
>> Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
> 
> Well, this patch made me look at this function.
> 
> You really shouldn't be filtering packets looped back, that is
> the stack's job.  It shouldn't be happening in the driver.

If we use ping6 to test if it is connected to network, CPUs would send out the NS packets
and these packets will be looped back to CPUs. If driver does not drop these packets,
they will be sent to protocol stack and protocol stack consider that there is a device
with the same address and it is not available address. It will show us the log like
"connect: Cannot assign requested address". Then it can not connect to the network enviroment.
Thus, we drop these packets looped back in HNS driver.

> 
> And once you remove that code, this patch here is no longer
> necessary.
> 
> Second of all, unless you card supports every protocol that
> exists in the past, present, and _future_ you cannot set
> skb->ip_summed to CHECKSUM_UNNECSSARY unconditionally like
> that.
> 
> You can only set that for protocols your chip actually supports.

Thanks for your suggestions. I will prepare a new patch to fix it.

> 
> .
> 

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

* Re: [patch net-next] net: hns: add skb_reset_mac_header() after skb being alloc
  2016-06-15 10:30   ` Yisen Zhuang
@ 2016-06-20  7:12     ` Yisen Zhuang
  2016-06-20 16:04       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Yisen Zhuang @ 2016-06-20  7:12 UTC (permalink / raw)
  To: David Miller; +Cc: charles.chenxin, linuxarm, linux-kernel, arnd, netdev



在 2016/6/15 18:30, Yisen Zhuang 写道:
> Hi David,
> 
> Thanks for your suggestions.
> 
> Please see my comments below.
> 
> Thanks,
> 
> Yisen
> 
> 在 2016/6/15 13:41, David Miller 写道:
>> From: Yisen Zhuang <Yisen.Zhuang@huawei.com>
>> Date: Mon, 13 Jun 2016 20:41:22 +0800
>>
>>> From: Kejian Yan <yankejian@huawei.com>
>>>
>>> HNS receives a packet without doing anything, but it should call
>>> skb_reset_mac_header() to initialize the header before using
>>> eth_hdr().
>>>
>>> Fixes: 0d6b425a3773c3445b0f51b2f333821beaacb619
>>> Signed-off-by: Kejian Yan <yankejian@huawei.com>
>>> Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
>>
>> Well, this patch made me look at this function.
>>
>> You really shouldn't be filtering packets looped back, that is
>> the stack's job.  It shouldn't be happening in the driver.
> 
> If we use ping6 to test if it is connected to network, CPUs would send out the NS packets
> and these packets will be looped back to CPUs. If driver does not drop these packets,
> they will be sent to protocol stack and protocol stack consider that there is a device
> with the same address and it is not available address. It will show us the log like
> "connect: Cannot assign requested address". Then it can not connect to the network enviroment.
> Thus, we drop these packets looped back in HNS driver.
> 

Hi David,

What is the opinion about this issue? We need this patch to resolve the issue.

Hoping for your suggestions.

Many thanks,

Yisen

>>
>> And once you remove that code, this patch here is no longer
>> necessary.
>>
>> Second of all, unless you card supports every protocol that
>> exists in the past, present, and _future_ you cannot set
>> skb->ip_summed to CHECKSUM_UNNECSSARY unconditionally like
>> that.
>>
>> You can only set that for protocols your chip actually supports.
> 
> Thanks for your suggestions. I will prepare a new patch to fix it.
> 
>>
>> .
>>
> 
> _______________________________________________
> linuxarm mailing list
> linuxarm@huawei.com
> http://rnd-openeuler.huawei.com/mailman/listinfo/linuxarm
> 

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

* Re: [patch net-next] net: hns: add skb_reset_mac_header() after skb being alloc
  2016-06-20  7:12     ` Yisen Zhuang
@ 2016-06-20 16:04       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2016-06-20 16:04 UTC (permalink / raw)
  To: Yisen.zhuang; +Cc: charles.chenxin, linuxarm, linux-kernel, arnd, netdev

From: Yisen Zhuang <Yisen.zhuang@huawei.com>
Date: Mon, 20 Jun 2016 15:12:34 +0800

> 
> 
> 在 2016/6/15 18:30, Yisen Zhuang 写道:
>> Hi David,
>> 
>> Thanks for your suggestions.
>> 
>> Please see my comments below.
>> 
>> Thanks,
>> 
>> Yisen
>> 
>> 在 2016/6/15 13:41, David Miller 写道:
>>> From: Yisen Zhuang <Yisen.Zhuang@huawei.com>
>>> Date: Mon, 13 Jun 2016 20:41:22 +0800
>>>
>>>> From: Kejian Yan <yankejian@huawei.com>
>>>>
>>>> HNS receives a packet without doing anything, but it should call
>>>> skb_reset_mac_header() to initialize the header before using
>>>> eth_hdr().
>>>>
>>>> Fixes: 0d6b425a3773c3445b0f51b2f333821beaacb619
>>>> Signed-off-by: Kejian Yan <yankejian@huawei.com>
>>>> Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
>>>
>>> Well, this patch made me look at this function.
>>>
>>> You really shouldn't be filtering packets looped back, that is
>>> the stack's job.  It shouldn't be happening in the driver.
>> 
>> If we use ping6 to test if it is connected to network, CPUs would send out the NS packets
>> and these packets will be looped back to CPUs. If driver does not drop these packets,
>> they will be sent to protocol stack and protocol stack consider that there is a device
>> with the same address and it is not available address. It will show us the log like
>> "connect: Cannot assign requested address". Then it can not connect to the network enviroment.
>> Thus, we drop these packets looped back in HNS driver.
>> 
> 
> Hi David,
> 
> What is the opinion about this issue? We need this patch to resolve the issue.

I guess this is fine if your chip behaves this way.

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

end of thread, other threads:[~2016-06-20 16:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13 12:41 [patch net-next] net: hns: add skb_reset_mac_header() after skb being alloc Yisen Zhuang
2016-06-15  5:41 ` David Miller
2016-06-15 10:30   ` Yisen Zhuang
2016-06-20  7:12     ` Yisen Zhuang
2016-06-20 16:04       ` David Miller

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).