kernel-fxtec-pro1x/drivers/net/wan
Xie He 7fcf25b4f8 drivers/net/wan/hdlc: Set skb->protocol before transmitting
[ Upstream commit 9fb030a70431a2a2a1b292dbf0b2f399cc072c16 ]

This patch sets skb->protocol before transmitting frames on the HDLC
device, so that a user listening on the HDLC device with an AF_PACKET
socket will see outgoing frames' sll_protocol field correctly set and
consistent with that of incoming frames.

1. Control frames in hdlc_cisco and hdlc_ppp

When these drivers send control frames, skb->protocol is not set.

This value should be set to htons(ETH_P_HDLC), because when receiving
control frames, their skb->protocol is set to htons(ETH_P_HDLC).

When receiving, hdlc_type_trans in hdlc.h is called, which then calls
cisco_type_trans or ppp_type_trans. The skb->protocol of control frames
is set to htons(ETH_P_HDLC) so that the control frames can be received
by hdlc_rcv in hdlc.c, which calls cisco_rx or ppp_rx to process the
control frames.

2. hdlc_fr

When this driver sends control frames, skb->protocol is set to internal
values used in this driver.

When this driver sends data frames (from upper stacked PVC devices),
skb->protocol is the same as that of the user data packet being sent on
the upper PVC device (for normal PVC devices), or is htons(ETH_P_802_3)
(for Ethernet-emulating PVC devices).

However, skb->protocol for both control frames and data frames should be
set to htons(ETH_P_HDLC), because when receiving, all frames received on
the HDLC device will have their skb->protocol set to htons(ETH_P_HDLC).

When receiving, hdlc_type_trans in hdlc.h is called, and because this
driver doesn't provide a type_trans function in struct hdlc_proto,
all frames will have their skb->protocol set to htons(ETH_P_HDLC).
The frames are then received by hdlc_rcv in hdlc.c, which calls fr_rx
to process the frames (control frames are consumed and data frames
are re-received on upper PVC devices).

Cc: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-07 08:00:06 +02:00
..
lmc
.gitignore
c101.c
cosa.c
cosa.h
dlci.c
dscc4.c
farsync.c
farsync.h
fsl_ucc_hdlc.c
fsl_ucc_hdlc.h
hd64570.c
hd64570.h
hd64572.c
hd64572.h
hdlc.c
hdlc_cisco.c drivers/net/wan/hdlc: Set skb->protocol before transmitting 2020-10-07 08:00:06 +02:00
hdlc_fr.c drivers/net/wan/hdlc: Set skb->protocol before transmitting 2020-10-07 08:00:06 +02:00
hdlc_ppp.c drivers/net/wan/hdlc: Set skb->protocol before transmitting 2020-10-07 08:00:06 +02:00
hdlc_raw.c
hdlc_raw_eth.c
hdlc_x25.c
hostess_sv11.c
ixp4xx_hss.c wan: ixp4xx_hss: fix compile-testing on 64-bit 2020-02-24 08:34:46 +01:00
Kconfig net: wan: wanxl: use allow to pass CROSS_COMPILE_M68k for rebuilding firmware 2020-09-26 18:01:31 +02:00
lapbether.c drivers/net/wan/lapbether: Make skb->protocol consistent with the header 2020-10-07 08:00:06 +02:00
Makefile net: wan: wanxl: use $(M68KCC) instead of $(M68KAS) for rebuilding firmware 2020-09-26 18:01:31 +02:00
n2.c
pc300too.c
pci200syn.c
sbni.c
sbni.h
sdla.c
sealevel.c
slic_ds26522.c
slic_ds26522.h
wanxl.c
wanxl.h
wanxlfw.inc_shipped
wanxlfw.S
x25_asy.c drivers/net/wan/x25_asy: Fix to make it work 2020-07-31 18:37:47 +02:00
x25_asy.h
z85230.c
z85230.h