[PATCH net-next v3 3/4] net: hdlc_fr: Improve the initial checks when we receive an skb

2020-10-28 Thread Xie He
check to the initial checks in fr_rx. fh->ea2 == 1 means the second address byte is the final address byte. We only support the case where the address length is 2 bytes. Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_fr.c | 2 +- 1 file changed, 1 insertion(+), 1 d

[PATCH net-next 4/4] net: hdlc_fr: Add support for any Ethertype

2020-10-28 Thread Xie He
devices) to upper layers. Because we don't use header_ops for normal PVC devices, we should hide the header from upper layer code in this case. Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_fr.c | 76 ++- 1 file changed, 51 insertions(+

[PATCH net-next v2 1/4] net: hdlc_fr: Simpify fr_rx by using "goto rx_drop" to drop frames

2020-10-28 Thread Xie He
eated several times, this patch uses "goto rx_drop" to replace them so that the code looks cleaner. Also add code to increase the stats.rx_dropped count whenever we drop a frame. Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_fr.c | 16 +++- 1 file change

[PATCH net-next v3 1/4] net: hdlc_fr: Simpify fr_rx by using "goto rx_drop" to drop frames

2020-10-28 Thread Xie He
eated several times, this patch uses "goto rx_drop" to replace them so that the code looks cleaner. Also add code to increase the stats.rx_dropped count whenever we drop a frame. Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_fr.c | 16 +++- 1 file change

[PATCH net-next 3/4] net: hdlc_fr: Improve the initial check when we receive an skb

2020-10-28 Thread Xie He
check to the initial checks in fr_fx. fh->ea2 == 1 means the second address byte is the final address byte. We only support the case where the address length is 2 bytes. Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_fr.c | 2 +- 1 file changed, 1 insertion(+), 1 d

[PATCH net-next v3 2/4] net: hdlc_fr: Change the use of "dev" in fr_rx to make the code cleaner

2020-10-28 Thread Xie He
: first make sure the pointer is not NULL, then assign it directly to skb->dev. "dev" is no longer needed until the end where we use it to update stats. Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_fr.c | 37 - 1 file chang

[PATCH net-next v3 4/4] net: hdlc_fr: Add support for any Ethertype

2020-10-28 Thread Xie He
devices) to upper layers. Because we don't use header_ops for normal PVC devices, we should hide the header from upper layer code in this case. Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_fr.c | 76 ++- 1 file changed, 51 insertions(+

Re: [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning

2020-10-27 Thread Xie He
On Tue, Oct 27, 2020 at 6:24 AM Arnd Bergmann wrote: > > Ah, of course. I had looked up the types but mixed up the memmap > and HDW definitions, but then got confused trying to understand the > logic in wr_mem() that operates on bytes but expands them into > multiples of 4. I think wr_mem() doesn

Re: [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning

2020-10-26 Thread Xie He
On Mon, Oct 26, 2020 at 8:56 PM Xie He wrote: > > > - for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem) > > + for (mem = (HDW *) memmap; mem < (HDW *) ((uintptr_t)memmap + 1); ++mem) > > Note that these two lines are semantically different. In the fi

Re: [PATCH net-next 01/11] atm: horizon: shut up clang null pointer arithmetic warning

2020-10-26 Thread Xie He
> - for (mem = (HDW *) memmap; mem < (HDW *) (memmap + 1); ++mem) > + for (mem = (HDW *) memmap; mem < (HDW *) ((uintptr_t)memmap + 1); ++mem) Note that these two lines are semantically different. In the first line, "+ 1" moves the pointer by (sizeof memmap) bytes. However in the second line, "+

Re: [PATCH net RFC] net: Clear IFF_TX_SKB_SHARING for all Ethernet devices using skb_padto

2020-10-22 Thread Xie He
On Thu, Oct 22, 2020 at 6:56 PM Xie He wrote: > > My patch isn't complete. Because there are so many drivers with this > problem, I feel it's hard to solve them all at once. So I only grepped > "skb_padto" under "drivers/net/ethernet". There are other

Re: [PATCH net RFC] net: Clear IFF_TX_SKB_SHARING for all Ethernet devices using skb_padto

2020-10-22 Thread Xie He
On Thu, Oct 22, 2020 at 5:44 PM Jakub Kicinski wrote: > > On Thu, 22 Oct 2020 12:59:45 -0700 Xie He wrote: > > > > But I also see some drivers that want to pad the skb to a strange > > length, and don't set their special min_mtu to match this length. For > > ex

Re: [PATCH net RFC] net: Clear IFF_TX_SKB_SHARING for all Ethernet devices using skb_padto

2020-10-22 Thread Xie He
On Thu, Oct 22, 2020 at 8:22 AM Jakub Kicinski wrote: > > Are most of these drivers using skb_padto()? Is that the reason they > can't be sharing the SKB? Yes, I think if a driver calls skb_pad / skb_padto / skb_put_padto / eth_skb_pad, the driver can't accept shared skbs because it may modify th

[PATCH net RFC v2] net: Clear IFF_TX_SKB_SHARING for all Ethernet devices using skb_padto

2020-10-22 Thread Xie He
ic function, it cannot be used anywhere else. Fixes: 550fd08c2ceb ("net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared") Cc: Neil Horman Cc: Jakub Kicinski Cc: David S. Miller Signed-off-by: Xie He --- drivers/net/ethernet/adaptec/starfire.c | 2 ++ drivers/

Re: [PATCH net RFC] net: Clear IFF_TX_SKB_SHARING for all Ethernet devices using skb_padto

2020-10-22 Thread Xie He
Sorry. I spotted some errors in this patch. Some drivers use "ndev" as the variable name but I mistakenly used "dev". It was very hard for me to attempt fixing. There are too many drivers that need to be fixed. Fixing them is very time-consuming and may also be error-prone. So I think it may be be

[PATCH net RFC] net: Clear IFF_TX_SKB_SHARING for all Ethernet devices using skb_padto

2020-10-22 Thread Xie He
ic function, it cannot be used anywhere else. Fixes: 550fd08c2ceb ("net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared") Cc: Neil Horman Cc: Jakub Kicinski Cc: David S. Miller Signed-off-by: Xie He --- drivers/net/ethernet/adaptec/starfire.c | 2 ++ drivers/

Re: [PATCH net] net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup

2020-10-21 Thread Xie He
On Wed, Oct 21, 2020 at 6:02 PM Jakub Kicinski wrote: > > Applied, thank you. > > In the future please try to provide a Fixes: tag. OK. Thanks! I'll remember this in the future!

[PATCH net-next RFC] net: dlci: Deprecate the DLCI driver (aka the Frame Relay layer)

2020-10-21 Thread Xie He
i_conf and frad_conf). According to the comments, these two structs are specially crafted for sdla.c (the only hardware driver dlci.c supports). I think this makes dlci.c not generic enough to support other hardware drivers. Cc: Lee Jones Cc: Gustavo A. R. Silva Cc: Krzysztof Kozlowski Signed-o

[PATCH net] net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup

2020-10-19 Thread Xie He
transmission, so the skb may be modified. Cc: Neil Horman Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_raw_eth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wan/hdlc_raw_eth.c b/drivers/net/wan/hdlc_raw_eth.c index 08e0a46501de..c70a518b8b47 100644 --- a

[PATCH net v2] net: hdlc: In hdlc_rcv, check to make sure dev is an HDLC device

2020-10-19 Thread Xie He
ore starting its processing. This patch adds this check to hdlc_rcv. Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 9b00708676cf..1bdd3df08

Re: [PATCH net] drivers/net/wan/hdlc: In hdlc_rcv, check to make sure dev is an HDLC device

2020-10-19 Thread Xie He
On Mon, Oct 19, 2020 at 3:49 PM Jakub Kicinski wrote: > > Cool! FWIW when you resend you can also trim the subject to just say: > > net: hdlc: In hdlc_rcv, check to make sure dev is an HDLC device > > There's no need for the full file path. OK. I'll do that. Thanks!

Re: [PATCH net] drivers/net/wan/hdlc: In hdlc_rcv, check to make sure dev is an HDLC device

2020-10-19 Thread Xie He
On Mon, Oct 19, 2020 at 2:22 PM Jakub Kicinski wrote: > > Looks correct to me. I spotted there is also IFF_WAN_HDLC added by > 7cdc15f5f9db ("WAN: Generic HDLC now uses IFF_WAN_HDLC private flag.") > would using that flag also be correct and cleaner potentially? > > Up to you, just wanted to make

[PATCH net] drivers/net/wan/hdlc: In hdlc_rcv, check to make sure dev is an HDLC device

2020-10-19 Thread Xie He
_xmit to this). Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 9b00708676cf..0a392fb9aff8 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/ne

Re: [PATCH net-next] drivers/net/wan/hdlc_fr: Improve fr_rx and add support for any Ethertype

2020-10-18 Thread Xie He
On Sun, Oct 18, 2020 at 3:05 PM Jakub Kicinski wrote: > > Whenever you make a list like that it's a strong indication that > each of these should be a separate commit. That makes things easier > to review. > > > We have already sent a pull request for 5.10 and therefore net-next > is closed for ne

[PATCH net-next] drivers/net/wan/hdlc_fr: Improve fr_rx and add support for any Ethertype

2020-10-16 Thread Xie He
nce when we actually need it. Also add an fh->ea2 check to the initial checks in fr_fx. fh->ea2 == 1 means the second address byte is the final address byte. We only support the case where the address length is 2 bytes. 4. Use "goto rx_drop" whenever w

[PATCH net-next] drivers/net/wan/hdlc_fr: Move the skb_headroom check out of fr_hard_header

2020-10-07 Thread Xie He
pointers (skb_p) because we no longer need to replace the skb inside fr_hard_header. Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_fr.c | 30 +- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/net/wan/hdlc_fr.c b/drivers

[PATCH net] drivers/net/wan: lapb: Replace the skb->len checks with pskb_may_pull

2020-10-03 Thread Xie He
ord "check" in the comments because pskb_may_pull may do things other than simple checks in the case of non-linear skbs.) Cc: Willem de Bruijn Cc: Martin Schiller Signed-off-by: Xie He --- drivers/net/wan/hdlc_x25.c | 4 ++-- drivers/net/wan/lapbether.c | 4 ++-- drivers/net/wan/x2

[PATCH net-next] drivers/net/wan/hdlc_fr: Improvements to the code of pvc_xmit

2020-10-03 Thread Xie He
andling code. "kfree_skb" is the correct function to call when dropping an skb due to an error. "dev_kfree_skb", which is an alias of "consume_skb", is for dropping skbs normally (not due to an error). Cc: Krzysztof Halasa Cc: Stephen

Re: [PATCH net-next] drivers/net/wan/hdlc_fr: Reduce indentation in pvc_xmit

2020-10-03 Thread Xie He
On Sat, Oct 3, 2020 at 11:10 AM Stephen Hemminger wrote: > > This code snippet is basically an version of skb_pad(). > Probably it is very old and pre-dates that. > Could the code use skb_pad? Oh! Yes! I looked at the skb_pad function and I think we can use it in this code. Since it doesn't do s

[PATCH net-next] drivers/net/wan/hdlc_fr: Reduce indentation in pvc_xmit

2020-10-03 Thread Xie He
b" in error handling code. "kfree_skb" is the correct function to call when dropping an skb due to an error. "dev_kfree_skb", which is an alias of "consume_skb", is for dropping skbs normally (not due to an error). Cc: Krzysztof Halasa

Re: [PATCH net] drivers/net/wan/x25_asy: Keep the ldisc running even when netif is down

2020-09-28 Thread Xie He
On Mon, Sep 28, 2020 at 3:58 PM David Miller wrote: > > It could also go back down and also back up again after you do this > test. Maybe even 10 or 100 times over. > > You can't just leave things so incredibly racy like this, please apply > proper synchronization between netdev state changes and

[PATCH net-next] drivers/net/wan/hdlc_fr: Correctly handle special skb->protocol values

2020-09-28 Thread Xie He
_ETHER; and for situation 3, skb->dev->type would be ARPHRD_DLCI. This way fr_hard_header would be able to distinguish these 3 situations correctly regardless what skb->protocol value the user tries to use in situation 3. Cc: Krzysztof Halasa Signed-off-by: Xie He

[PATCH net] drivers/net/wan/x25_asy: Keep the ldisc running even when netif is down

2020-09-26 Thread Xie He
locking to prevent this. This needs to be fixed.) Cc: Martin Schiller Signed-off-by: Xie He --- drivers/net/wan/x25_asy.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index c418767a890a..22fcc0dd4b57 10

[PATCH net v2] drivers/net/wan/x25_asy: Correct the ndo_open and ndo_stop functions

2020-09-23 Thread Xie He
s ndo_stop, and made it call the original ndo_stop function. I moved netif_stop_queue from the original ndo_stop function to the new ndo_stop function.) Cc: Martin Schiller Signed-off-by: Xie He --- Change from v1: In v1, I moved the x25_asy_close call to x25_asy_close_tty. Now, although I still

Re: [PATCH net] drivers/net/wan/x25_asy: Correct the ndo_open and ndo_stop functions

2020-09-22 Thread Xie He
Sorry. I wish to drop the 3rd part (the 3rd point in the commit message) and re-send this patch. I'll re-address the problem discussed in the 3rd point in future patches.

[PATCH net] drivers/net/wan/x25_asy: Correct the ndo_open and ndo_stop functions

2020-09-22 Thread Xie He
because x25_asy_open is called in x25_asy_open_tty.) Cc: Martin Schiller Signed-off-by: Xie He --- drivers/net/wan/x25_asy.c | 42 +++ 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c i

[PATCH net-next] net/packet: Fix a comment about network_header

2020-09-18 Thread Xie He
skb->nh.raw has been renamed as skb->network_header in 2007, in commit b0e380b1d8a8 ("[SK_BUFF]: unions of just one member don't get anything done, kill them") So here we change it to the new name. Cc: Willem de Bruijn Signed-off-by: Xie He --- net/p

Re: [PATCH net-next] net/packet: Fix a comment about mac_header

2020-09-17 Thread Xie He
On Thu, Sep 17, 2020 at 1:51 AM Willem de Bruijn wrote: > > Acked-by: Willem de Bruijn Thank you, Willem!

[PATCH net] drivers/net/wan/hdlc: Set skb->protocol before transmitting

2020-09-16 Thread Xie He
s). Cc: Krzysztof Halasa Signed-off-by: Xie He --- drivers/net/wan/hdlc_cisco.c | 1 + drivers/net/wan/hdlc_fr.c| 3 +++ drivers/net/wan/hdlc_ppp.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index 444130655d8e..cb58

[PATCH net] drivers/net/wan/lapbether: Make skb->protocol consistent with the header

2020-09-16 Thread Xie He
akes a user listening on the Ethernet device with an AF_PACKET socket, to see the same sll_protocol value for incoming and outgoing frames. Cc: Martin Schiller Signed-off-by: Xie He --- drivers/net/wan/lapbether.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/n

[PATCH net-next] net/packet: Fix a comment about mac_header

2020-09-16 Thread Xie He
y tries to restore the LL header when header_ops != NULL. Cc: Willem de Bruijn Signed-off-by: Xie He --- net/packet/af_packet.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 2d5d5fbb435c..f59f

[PATCH net-next v2] net/packet: Fix a comment about hard_header_len and headroom allocation

2020-09-14 Thread Xie He
means this usage is already adopted by driver developers. Cc: Willem de Bruijn Cc: Eric Dumazet Cc: Brian Norris Cc: Cong Wang Signed-off-by: Xie He --- net/packet/af_packet.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/packet/af_packet.c b/net/packe

Re: [PATCH net-next] drivers/net/wan/x25_asy: Remove an unnecessary x25_type_trans call

2020-09-13 Thread Xie He
On Sun, Sep 13, 2020 at 10:32 PM Martin Schiller wrote: > > Acked-by: Martin Schiller Thank you, Martin!

Re: [PATCH net v2] drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices

2020-09-13 Thread Xie He
On Sun, Sep 13, 2020 at 10:26 PM Krzysztof HaƂasa wrote: > > Xie He writes: > > > The HDLC device is not actually prepending any header when it is used > > with this driver. When the PVC device has prepended its header and > > handed over the skb to the HDLC device, th

Re: [PATCH net-next] net/packet: Fix a comment about hard_header_len and add a warning for it

2020-09-13 Thread Xie He
On Sun, Sep 13, 2020 at 1:11 AM Willem de Bruijn wrote: > > I am concerned about adding a WARN_ON_ONCE that we already expect to > fire on some platforms. > > Probably better to add the documentation without the warning. > > I know I suggested the check before, sorry for the churn, but I hadn't >

[PATCH net-next] drivers/net/wan/x25_asy: Remove an unnecessary x25_type_trans call

2020-09-11 Thread Xie He
only called before netif_rx and not before lapb_data_received. Cc: Martin Schiller Signed-off-by: Xie He --- drivers/net/wan/x25_asy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 5a7cf8bf9d0d..ab56a5e6447a

Re: [PATCH net-next] drivers/net/wan/x25_asy: Remove an unused flag "SLF_OUTWAIT"

2020-09-11 Thread Xie He
On Fri, Sep 11, 2020 at 2:44 PM David Miller wrote: > > From: Xie He > Date: Thu, 10 Sep 2020 23:35:03 -0700 > > > The "SLF_OUTWAIT" flag defined in x25_asy.h is not actually used. > > It is only cleared at one place in x25_asy.c but is never read or set. >

Re: [PATCH net-next] net/packet: Fix a comment about hard_header_len and add a warning for it

2020-09-11 Thread Xie He
On Fri, Sep 11, 2020 at 7:32 AM Willem de Bruijn wrote: > > From a quick scan, a few device types that might trigger this > > net/atm/clip.c > drivers/net/wan/hdlc_fr.c > drivers/net/appletalk/ipddp.c > drivers/net/ppp/ppp_generic.c > drivers/net/net_failover.c I have recently fixed this problem

Re: [PATCH net-next] net/socket.c: Remove an unused header file

2020-09-11 Thread Xie He
On Fri, Sep 11, 2020 at 2:41 PM David Miller wrote: > > From: Xie He > Date: Thu, 10 Sep 2020 23:07:20 -0700 > > > This header file is not actually used in this file. Let's remove it. > > How did you test this assertion? As Jakub showed, the > dlci_ioctl_set

[PATCH net-next] drivers/net/wan/x25_asy: Remove an unused flag "SLF_OUTWAIT"

2020-09-10 Thread Xie He
The "SLF_OUTWAIT" flag defined in x25_asy.h is not actually used. It is only cleared at one place in x25_asy.c but is never read or set. So we can remove it. Signed-off-by: Xie He --- drivers/net/wan/x25_asy.c | 2 -- drivers/net/wan/x25_asy.h | 1 - 2 files changed, 3 deletions(-)

[PATCH net-next] net/socket.c: Remove an unused header file

2020-09-10 Thread Xie He
wan/sdla.c Note that the "Frame Relay" module is different from and unrelated to the "HDLC Frame Relay" module at: drivers/net/wan/hdlc_fr.c I think maybe we can deprecate the "Frame Relay" module because we already have the (newer) "HDLC Frame Relay" module

[PATCH net-next] net/packet: Fix a comment about hard_header_len and add a warning for it

2020-09-10 Thread Xie He
The author tried to set the WiFi driver's hard_header_len to the Ethernet header length, and request additional header space internally needed by setting needed_headroom. This means this usage is already adopted by driver developers. Cc: Willem de Bruijn Cc: Eric Dumazet Cc: Brian Norris Cc: Con

Re: [PATCH net v2] net: Clarify the difference between hard_header_len and needed_headroom

2020-09-10 Thread Xie He
OK. I'll make the changes you suggested and resubmit the patch. Thanks! I'll drop the change to netdevice.h and the check for dev_hard_header's return value. If there's still a need for something similar to these, we can do them in a separate patch.

[PATCH net v2] net: Clarify the difference between hard_header_len and needed_headroom

2020-09-09 Thread Xie He
tional header space internally needed by setting needed_headroom. This means this usage is already adopted by driver developers. Cc: Willem de Bruijn Cc: Eric Dumazet Cc: Brian Norris Cc: Cong Wang Signed-off-by: Xie He --- Change from v1: Small change to the commit message. --- include/linux/netde

[PATCH net] net: Clarify the difference between hard_header_len and needed_headroom

2020-09-09 Thread Xie He
tional header space internally needed by setting needed_headroom. This means this usage is already adopted by driver developers. Cc: Willem de Bruijn Cc: Eric Dumazet Cc: Brian Norris Cc: Cong Wang Signed-off-by: Xie He --- include/linux/netdevice.h | 4 ++-- net/packet/af_packet.c| 19 +

Re: Question about dev_validate_header used in af_packet.c

2020-09-08 Thread Xie He
On Tue, Sep 8, 2020 at 4:53 AM Willem de Bruijn wrote: > > On Tue, Sep 8, 2020 at 1:04 PM Xie He wrote: > > > > I was recently looking at some drivers, and I felt that if af_packet.c > > could help me filter out the invalid RAW frames, I didn't need to > > chec

Re: [PATCH net] net/packet: Fix a comment about hard_header_len and headroom allocation

2020-09-08 Thread Xie He
On Tue, Sep 8, 2020 at 1:56 AM Willem de Bruijn wrote: > > > > > /* > > > > Assumptions: > > > > - - if device has no dev->hard_header routine, it adds and removes ll > > > > header > > > > - inside itself. In this case ll header is invisible outside of > > > > device, > > > > - b

Re: Question about dev_validate_header used in af_packet.c

2020-09-08 Thread Xie He
On Tue, Sep 8, 2020 at 1:41 AM Willem de Bruijn wrote: > > The intent is to bypass such validation to be able to test device > drivers. Note that removing that may cause someone's test to start > failing. > > > So there's no point in > > keeping the ability to test this, either. > > I don't disag

Re: [PATCH net] net/packet: Fix a comment about hard_header_len and headroom allocation

2020-09-07 Thread Xie He
Thank you for your comment! On Mon, Sep 7, 2020 at 2:41 AM Willem de Bruijn wrote: > > On Sun, Sep 6, 2020 at 5:18 AM Xie He wrote: > > > > This comment is outdated and no longer reflects the actual implementation > > of af_packet.c. > > If it was previously true,

Re: Question about dev_validate_header used in af_packet.c

2020-09-07 Thread Xie He
On Mon, Sep 7, 2020 at 2:06 AM Willem de Bruijn wrote: > > The CAP_SYS_RAWIO exception indeed was requested to be able to > purposely test devices against bad inputs. The gmane link > unfortunately no longer works, but this was the discussion thread: > https://www.mail-archive.com/netdev@vger.kern

[PATCH net] net/packet: Fix a comment about hard_header_len and headroom allocation

2020-09-05 Thread Xie He
by driver developers. Cc: Willem de Bruijn Cc: Eric Dumazet Cc: Brian Norris Cc: Cong Wang Signed-off-by: Xie He --- net/packet/af_packet.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 2b33e97

Re: Question about dev_validate_header used in af_packet.c

2020-09-05 Thread Xie He
On Sat, Sep 5, 2020 at 3:24 PM Xie He wrote: > > Hi Willem, > > I have a question about the function dev_validate_header used in > af_packet.c. Can you help me? Thanks! > > I see when the length of the data is smaller than hard_header_len, and > when the user is "

Question about dev_validate_header used in af_packet.c

2020-09-05 Thread Xie He
Hi Willem, I have a question about the function dev_validate_header used in af_packet.c. Can you help me? Thanks! I see when the length of the data is smaller than hard_header_len, and when the user is "capable" enough, the function will accept it and pad it with 0s, without validating the header

Re: [PATCH net v2] drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices

2020-09-05 Thread Xie He
On Fri, Sep 4, 2020 at 9:36 PM Jakub Kicinski wrote: > > Applied to net, thank you! Thank you, Jakub!

Re: [PATCH net v2] drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices

2020-09-04 Thread Xie He
On Fri, Sep 4, 2020 at 6:28 PM Xie He wrote: > > The HDLC device is not actually prepending any header when it is used > with this driver. When the PVC device has prepended its header and > handed over the skb to the HDLC device, the HDLC device just hands it > over to the hard

Re: [PATCH net v2] drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices

2020-09-04 Thread Xie He
Thank you for your email, Jakub! On Fri, Sep 4, 2020 at 3:14 PM Jakub Kicinski wrote: > > Since this is a tunnel protocol on top of HDLC interfaces, and > hdlc_setup_dev() sets dev->hard_header_len = 16; should we actually > set the needed_headroom to 10 + 16 = 26? I'm not clear on where/if > hdl

[PATCH net v2] drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices

2020-09-02 Thread Xie He
all cases. Cc: Krzysztof Halasa Cc: Martin Schiller Signed-off-by: Xie He --- Change from v1: English language fix for the commit message. Changed "Ethernet-emulated" to "Ethernet-emulating" because the device is emulating an Ethernet device, rather than being emulated b

[PATCH net] drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices

2020-09-02 Thread Xie He
cases. Cc: Krzysztof Halasa Cc: Martin Schiller Signed-off-by: Xie He --- drivers/net/wan/hdlc_fr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 9acad651ea1f..12b35404cd8e 100644 --- a/drivers/net/wan/hdlc_fr.c

[PATCH net v2] drivers/net/wan/hdlc: Change the default of hard_header_len to 0

2020-09-02 Thread Xie He
m and does not call dev_hard_header, but checks if the user has provided a header of length hard_header_len (in function dev_validate_header). Cc: Krzysztof Halasa Cc: Martin Schiller Signed-off-by: Xie He --- Change from v1: Small fix for the English grammar in the commit message. --- drive

[PATCH net] drivers/net/wan/hdlc: Change the default of hard_header_len to 0

2020-09-02 Thread Xie He
m and does not call dev_hard_header, but checks if the user has provided a header of length hard_header_len (in function dev_validate_header). Cc: Krzysztof Halasa Cc: Martin Schiller Signed-off-by: Xie He --- drivers/net/wan/hdlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH net] drivers/net/wan/hdlc_cisco: Add hard_header_len

2020-08-28 Thread Xie He
;t have header_ops, I think their hard_header_len should be set to 0. So I think maybe it's better to change the default value in hdlc.c to 0 and let them take the default value of 0. What do you think? Thanks! Xie He

[PATCH net] drivers/net/wan/hdlc_cisco: Add hard_header_len

2020-08-28 Thread Xie He
dlc_header). Cc: Martin Schiller Signed-off-by: Xie He --- drivers/net/wan/hdlc_cisco.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index d8cba3625c18..444130655d8e 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/

[PATCH net] drivers/net/wan/lapbether: Set network_header before transmitting

2020-08-25 Thread Xie He
the Ethernet header, and at the beginning of the Ethernet payload): Because when this driver receives an skb from the Ethernet device, the network_header is also set at this place. Cc: Martin Schiller Signed-off-by: Xie He --- drivers/net/wan/lapbether.c | 2 ++ 1 file changed, 2 inserti

Re: [PATCH net v2] drivers/net/wan/lapbether: Added needed_tailroom

2020-08-24 Thread Xie He
On Mon, Aug 24, 2020 at 4:09 PM David Miller wrote: > > Applied, thank you. Thank you!

[PATCH net v2] drivers/net/wan/lapbether: Added needed_tailroom

2020-08-21 Thread Xie He
The underlying Ethernet device may request necessary tailroom to be allocated by setting needed_tailroom. This driver should also set needed_tailroom to request the tailroom needed by the underlying Ethernet device to be allocated. Cc: Willem de Bruijn Cc: Martin Schiller Signed-off-by: Xie He

Re: [PATCH net] drivers/net/wan/lapbether: Added needed_tailroom

2020-08-19 Thread Xie He
Hi Martin Schiller, Can you help review this patch? Thanks! It is a very simple patch that adds the "needed_tailroom" setting for this driver. Thank you! Xie He

Re: [PATCH net] drivers/net/wan/lapbether: Added needed_tailroom

2020-08-18 Thread Xie He
7;s needed_tailroom. So I submitted this patch. I see you previously also did a change related to needed_tailroom to pppoe. Can you help review this patch? Thank you so much! The patch is at: http://patchwork.ozlabs.org/project/netdev/patch/20200808175251.582781-1-xie.he.0...@gmail.com/ Thanks! Xie He

Re: [PATCH net] drivers/net/wan/lapbether: Added needed_tailroom

2020-08-15 Thread Xie He
I took some time to look at the history of needed_tailroom. I found it was added in this commit: f5184d267c1a (net: Allow netdevices to specify needed head/tailroom) The author tried to make use of needed_tailroom at various places in the kernel by replacing the macro LL_RESERVED_SPACE with his ne

Re: [PATCH net] drivers/net/wan/hdlc_x25: Added needed_headroom and a skb->len check

2020-08-15 Thread Xie He
On Fri, Aug 14, 2020 at 8:41 PM David Miller wrote: > > Applied, thanks. Thank you, David!

[PATCH net] drivers/net/wan/hdlc_x25: Added needed_headroom and a skb->len check

2020-08-13 Thread Xie He
eader_len) to the default values. We add needed_headroom here so that needed_headroom will also be reset. Cc: Willem de Bruijn Cc: Martin Schiller Cc: Andrew Hendry Signed-off-by: Xie He --- drivers/net/wan/hdlc.c | 1 + drivers/net/wan/hdlc_x25.c | 17 - 2 files ch

Re: [PATCH net] drivers/net/wan/x25_asy: Added needed_headroom and a skb->len check

2020-08-11 Thread Xie He
On Tue, Aug 11, 2020 at 10:32 AM David Miller wrote: > > Applied, thank you. Thank you!

Re: [PATCH net] drivers/net/wan/x25_asy: Added needed_headroom and a skb->len check

2020-08-11 Thread Xie He
On Tue, Aug 11, 2020 at 3:50 AM Willem de Bruijn wrote: > > > I became interested in X.25 when I was trying different address > > families that Linux supported. I tried AF_X25 sockets. And then I > > tried to use the X.25 link layer directly through AF_PACKET. I believe > > both AF_X25 sockets and

Re: [PATCH net] drivers/net/wan/x25_asy: Added needed_headroom and a skb->len check

2020-08-10 Thread Xie He
On Mon, Aug 10, 2020 at 12:21 AM Willem de Bruijn wrote: > > Acked-by: Willem de Bruijn Thank you so much! > > 1) I hope to set needed_headroom properly for all three X.25 drivers > > (lapbether, x25_asy, hdlc_x25) in the kernel. So that the upper layer > > (net/x25) can be changed to use neede

Re: [PATCH net] drivers/net/wan/lapbether: Added needed_tailroom

2020-08-10 Thread Xie He
On Mon, Aug 10, 2020 at 12:32 AM Willem de Bruijn wrote: > > What happens when a tunnel device passes a packet to these devices? > That will also not have allocated the extra tailroom. Does that cause > a bug? I looked at the code in net/ipv4/ip_tunnel.c. It indeed appeared to me that it didn't t

Re: [PATCH net] drivers/net/wan/x25_asy: Added needed_headroom and a skb->len check

2020-08-09 Thread Xie He
On Sun, Aug 9, 2020 at 2:13 AM Willem de Bruijn wrote: > > The patch is analogous to commit c7ca03c216ac > ("drivers/net/wan/lapbether: Added needed_headroom and a skb->len > check"). > > Seems to make sense based on call stack > > x25_asy_xmit // skb_pull(skb, 1) > lapb_data_req

Re: [PATCH net] drivers/net/wan/lapbether: Added needed_tailroom

2020-08-09 Thread Xie He
On Sun, Aug 9, 2020 at 1:48 AM Willem de Bruijn wrote: > > Does this solve an actual observed bug? > > In many ways lapbeth is similar to tunnel devices. This is not common. Thank you for your comment! This doesn't solve a bug observed by me. But I think this should be necessary considering the

[PATCH net] drivers/net/wan/x25_asy: Added needed_headroom and a skb->len check

2020-08-08 Thread Xie He
adroom When this driver transmits data, first this driver will remove a pseudo header of 1 byte, then the lapb module will prepend the LAPB header of 2 or 3 bytes. So the value of needed_headroom in this driver should be 3 - 1. Cc: Willem de Bruijn Cc: Martin Schiller Signed-off-by:

[PATCH net] drivers/net/wan/lapbether: Added needed_tailroom

2020-08-08 Thread Xie He
The underlying Ethernet device may request necessary tailroom to be allocated by setting needed_tailroom. This driver should also set needed_tailroom to request the tailroom needed by the underlying Ethernet device to be allocated. Cc: Willem de Bruijn Cc: Martin Schiller Signed-off-by: Xie He

Re: [PATCH] drivers/net/wan/lapbether: Added needed_headroom and a skb->len check

2020-08-06 Thread Xie He
On Thu, Aug 6, 2020 at 12:47 AM Willem de Bruijn wrote: > > Acked-by: Willem de Bruijn > > The in-band signal byte is required, but stripped by lapbeth_xmit. > Subsequent code will prefix additional headers, including an Ethernet > link layer. The extra space needs to be reserved, but not pulled

Re: [PATCH] drivers/net/wan/lapbether: Added needed_headroom and a skb->len check

2020-08-05 Thread Xie He
I'm sorry I forgot to include the "net" prefix again. I remembered "PATCH" but not "net" this time. I'll try to remember both next time. If requested I can resend the patch with the correct prefix. Sorry.

[PATCH] drivers/net/wan/lapbether: Added needed_headroom and a skb->len check

2020-08-05 Thread Xie He
] ? packet_parse_headers.isra.0+0xd2/0x110 [ 168.399297] dev_queue_xmit+0x10/0x20 [ 168.399298] packet_sendmsg+0xbf0/0x19b0 .. Cc: Willem de Bruijn Cc: Martin Schiller Cc: Brian Norris Signed-off-by: Xie He --- drivers/net/wan/lapbether.c | 10 +- 1 file changed, 9 insertions(+),

Re: [net v3] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-05 Thread Xie He
On Tue, Aug 4, 2020 at 10:23 PM Martin Schiller wrote: > > > Adding skb_cow before these skb_push calls would indeed help > > preventing kernel panics, but that might not be the essential issue > > here, and it might also prevent us from discovering the real issue. (I > > guess this is also the re

Re: [net v3] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-04 Thread Xie He
On Tue, Aug 4, 2020 at 5:43 AM Martin Schiller wrote: > > I'm not an expert in the field, but after reading the commit message and > the previous comments, I'd say that makes sense. Thanks! > Shouldn't this kernel panic be intercepted by a skb_cow() before the > skb_push() in lapbeth_data_transm

Re: [PATCH v2] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-04 Thread Xie He
On Tue, Aug 4, 2020 at 3:07 AM Xie He wrote: > > Maybe we could contact . It seems to be the > manager of VGER mail lists. Oh. No. Majordomo seems to be a robot.

Re: [PATCH v2] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-04 Thread Xie He
On Tue, Aug 4, 2020 at 12:06 AM Willem de Bruijn wrote: > > > BTW: The linux x25 mailing list does not seem to work anymore. I've been > > on it for some time now, but haven't received a single email from it. > > I've tried to contact owner-linux-...@vger.kernel.org, but only got an > > "undeliver

Re: [PATCH v2] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-04 Thread Xie He
On Mon, Aug 3, 2020 at 11:53 PM Martin Schiller wrote: > > I don't like the idea to get rid of the 1-byte header. > This header is also used in userspace, for example when using a tun/tap > interface for an XoT (X.25 over TCP) application. A change would > therefore have very far-reaching conseque

Re: [net v3] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-03 Thread Xie He
Thanks! On Mon, Aug 3, 2020 at 2:50 AM Willem de Bruijn wrote: > > It's [PATCH net v3], not [net v3] Sorry. My mistake. I'll pay attention next time. I'm currently thinking about changing the subject to reflect that we added a "skb->len" check. Should I number the new patch as v1 or continue to

[net v3] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-02 Thread Xie He
98] packet_sendmsg+0xbf0/0x19b0 .. Additional change: When sending, check skb->len to ensure the 1-byte pseudo header is present before reading it. Cc: Willem de Bruijn Cc: Brian Norris Signed-off-by: Xie He --- Change from v2: Added skb->len check when sending. Change from v1: N

Re: [PATCH v2] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-01 Thread Xie He
On Sat, Aug 1, 2020 at 6:31 AM Willem de Bruijn wrote: > > The kernel interface cannot be changed. If packet sockets used to pass > the first byte up to userspace, they have to continue to do so. > > So I think you can limit the header_ops to only dev_hard_header. Actually if we want to keep the

Re: [PATCH v2] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

2020-08-01 Thread Xie He
On Fri, Jul 31, 2020 at 7:33 PM Willem de Bruijn wrote: > > I quickly scanned the main x.25 datapath code. Specifically > x25_establish_link, x25_terminate_link and x25_send_frame. These all > write this 1 byte header. It appears to be an in-band communication > means between the network and data

<    1   2   3   4   >