Page MenuHomeFreeBSD

net: replace IFF_KNOWSEPOCH with IFF_NEEDSEPOCH
ClosedPublic

Authored by glebius on Apr 11 2023, 5:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 10:26 AM
Unknown Object (File)
Dec 22 2023, 11:54 PM
Unknown Object (File)
Dec 12 2023, 1:42 PM
Unknown Object (File)
Nov 22 2023, 2:15 AM
Unknown Object (File)
Jun 19 2023, 8:02 PM
Unknown Object (File)
May 26 2023, 4:03 AM
Unknown Object (File)
May 2 2023, 8:38 AM
Unknown Object (File)
Apr 17 2023, 4:09 PM

Details

Summary

Expect that drivers call into the network stack with the net epoch
entered. This has already been the fact since early 2020. The net
interrupts, that are marked with INTR_TYPE_NET, were entering epoch
since 511d1afb6bf. For the taskqueues there is NET_TASK_INIT() and
all drivers that were known back in 2020 we marked with it in
6c3e93cb5a4. However in e87c4940156 we took conservative approach
and preferred to opt-in rather than opt-out for the epoch.

This change not only reverts e87c4940156 but adds a safety belt to
avoid panicing with INVARIANTS if there is a missed driver. With
INVARIANTS we will run in_epoch() check, print a warning and enter
the net epoch. A driver that prints can be quickly fixed with the
IFF_NEEDSEPOCH flag, but better be augmented to properly enter the
epoch itself.

Note on TCP LRO: it is a backdoor to enter the TCP stack bypassing
some layers of net stack, ignoring either old IFF_KNOWSEPOCH or the
new IFF_NEEDSEPOCH. But the tcp_lro_flush_all() asserts the presence
of network epoch. Indeed, all NIC drivers that support LRO already
provide the epoch, either with help of INTR_TYPE_NET or just running
NET_EPOCH_ENTER() in their code.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/compat/linux/linux_netlink.c
315

I'm not familiar with netlink, @melifaro may comment on this.

sys/compat/linux/linux_netlink.c
315

This is very simple - list of flags that do not have analogue in Linux.

This revision is now accepted and ready to land.Apr 12 2023, 4:39 PM
#define IFCAPBITS \
"\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \
"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" \
"\17TOE4\20TOE6\21VLAN_HWFILTER\23VLAN_HWTSO\24LINKSTATE\25NETMAP" \
"\26RXCSUM_IPV6\27TXCSUM_IPV6\31TXRTLMT\32HWRXTSTMP\33NOMAP\34TXTLS4\35TXTLS6" \
"\36VXLAN_HWCSUM\37VXLAN_HWTSO\40TXTLS_RTLMT"

One more question: Should ifconfig print this flag?

One more question: Should ifconfig print this flag?

Given that the flag is temporary and is planned to be removed, I think it should be hidden from end user. Just as current KNOWSEPOCH is.