mbox series

[net-next,v3,0/2] net: dsa: realtek: add rtl8_4t tag

Message ID 20220222224758.11324-1-luizluca@gmail.com (mailing list archive)
Headers show
Series net: dsa: realtek: add rtl8_4t tag | expand

Message

Luiz Angelo Daros de Luca Feb. 22, 2022, 10:47 p.m. UTC
This series add support for rtl8_4t tag. It is a variant of rtl8_4 tag,
with identical values but placed at the end of the packet (before CRC).

It forces checksum in software before adding the tag as those extra
bytes at the end of the packet would be summed together with the rest of
the payload. When the switch removes the tag before sending the packet
to the network, that checksum will not match.

It might be useful to diagnose or avoid checksum offload issues. With an
ethertype tag like rtl8_4, the cpu port ethernet driver must work with
cksum_start and chksum_offset in order to correctly calculate checksums.
If not, the checksum field will be broken (it will contain the fake ip
header sum).  In those cases, using 'rtl8_4t' might be an alternative
way to avoid checksum offload, either using runtime or device-tree
property.

Regards,

Luiz

v2-v3)
- updated tag documentation (file header)
- do not remove position and format from rtl8365mb_cpu
- reinstate cpu to rtl8365mb
- moved rtl8365mb_change_tag_protocol after rtl8365mb_cpu_config
- do not modify rtl8365mb_cpu_config() logic
- remove cpu arg from rtl8365mb_cpu_config(); get it from priv
- dropped tag_protocol from rtl8365mb. It is now derived from
  cpu->position.
- init cpu struct before dsa_register as default tag must be already
  defined before dsa_register()
- fix formatting issues

v1-v2)
- remove mention to tail tagger, use trailing tagger.
- use void* instead of char* for pointing to tag beginning
- use memcpy to avoid problems with unaligned tags
- calculate checksum if it still pending
- keep in-use tag protocol in memory instead of reading from switch
  register

Comments

Vladimir Oltean Feb. 23, 2022, 11:43 p.m. UTC | #1
On Tue, Feb 22, 2022 at 07:47:56PM -0300, Luiz Angelo Daros de Luca wrote:
> In those cases, using 'rtl8_4t' might be an alternative way to avoid
> checksum offload, either using runtime or device-tree property.

Good point. Can you please add one more patch that updates
Documentation/devicetree/bindings/net/dsa/dsa-port.yaml?
Luiz Angelo Daros de Luca Feb. 25, 2022, 5:16 a.m. UTC | #2
> On Tue, Feb 22, 2022 at 07:47:56PM -0300, Luiz Angelo Daros de Luca wrote:
> > In those cases, using 'rtl8_4t' might be an alternative way to avoid
> > checksum offload, either using runtime or device-tree property.
>
> Good point. Can you please add one more patch that updates
> Documentation/devicetree/bindings/net/dsa/dsa-port.yaml?

Sure