linux/drivers/net
Vladimir Oltean ee37a7045c net: dsa: felix: tc-taprio intervals smaller than MTU should send at least one packet
[ Upstream commit 11afdc6526 ]

The blamed commit broke tc-taprio schedules such as this one:

tc qdisc replace dev $swp1 root taprio \
        num_tc 8 \
        map 0 1 2 3 4 5 6 7 \
        queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \
        base-time 0 \
        sched-entry S 0x7f 990000 \
        sched-entry S 0x80  10000 \
        flags 0x2

because the gate entry for TC 7 (S 0x80 10000 ns) now has a static guard
band added earlier than its 'gate close' event, such that packet
overruns won't occur in the worst case of the largest packet possible.

Since guard bands are statically determined based on the per-tc
QSYS_QMAXSDU_CFG_* with a fallback on the port-based QSYS_PORT_MAX_SDU,
we need to discuss what happens with TC 7 depending on kernel version,
since the driver, prior to commit 55a515b1f5 ("net: dsa: felix: drop
oversized frames with tc-taprio instead of hanging the port"), did not
touch QSYS_QMAXSDU_CFG_*, and therefore relied on QSYS_PORT_MAX_SDU.

1 (before vsc9959_tas_guard_bands_update): QSYS_PORT_MAX_SDU defaults to
  1518, and at gigabit this introduces a static guard band (independent
  of packet sizes) of 12144 ns, plus QSYS::HSCH_MISC_CFG.FRM_ADJ (bit
  time of 20 octets => 160 ns). But this is larger than the time window
  itself, of 10000 ns. So, the queue system never considers a frame with
  TC 7 as eligible for transmission, since the gate practically never
  opens, and these frames are forever stuck in the TX queues and hang
  the port.

2 (after vsc9959_tas_guard_bands_update): Under the sole goal of
  enabling oversized frame dropping, we make an effort to set
  QSYS_QMAXSDU_CFG_7 to 1230 bytes. But QSYS_QMAXSDU_CFG_7 plays
  one more role, which we did not take into account: per-tc static guard
  band, expressed in L2 byte time (auto-adjusted for FCS and L1 overhead).
  There is a discrepancy between what the driver thinks (that there is
  no guard band, and 100% of min_gate_len[tc] is available for egress
  scheduling) and what the hardware actually does (crops the equivalent
  of QSYS_QMAXSDU_CFG_7 ns out of min_gate_len[tc]). In practice, this
  means that the hardware thinks it has exactly 0 ns for scheduling tc 7.

In both cases, even minimum sized Ethernet frames are stuck on egress
rather than being considered for scheduling on TC 7, even if they would
fit given a proper configuration. Considering the current situation,
with vsc9959_tas_guard_bands_update(), frames between 60 octets and 1230
octets in size are not eligible for oversized dropping (because they are
smaller than QSYS_QMAXSDU_CFG_7), but won't be considered as eligible
for scheduling either, because the min_gate_len[7] (10000 ns) minus the
guard band determined by QSYS_QMAXSDU_CFG_7 (1230 octets * 8 ns per
octet == 9840 ns) minus the guard band auto-added for L1 overhead by
QSYS::HSCH_MISC_CFG.FRM_ADJ (20 octets * 8 ns per octet == 160 octets)
leaves 0 ns for scheduling in the queue system proper.

Investigating the hardware behavior, it becomes apparent that the queue
system needs precisely 33 ns of 'gate open' time in order to consider a
frame as eligible for scheduling to a tc. So the solution to this
problem is to amend vsc9959_tas_guard_bands_update(), by giving the
per-tc guard bands less space by exactly 33 ns, just enough for one
frame to be scheduled in that interval. This allows the queue system to
make forward progress for that port-tc, and prevents it from hanging.

Fixes: 297c4de6f7 ("net: dsa: felix: re-enable TAS guard band mode")
Reported-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2022-09-15 10:47:19 +02:00
..
appletalk net: appletalk: remove Apple/Farallon LocalTalk PC support 2022-05-11 13:08:38 +01:00
arcnet net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe() 2022-03-03 10:29:13 +00:00
bonding bonding: accept unsolicited NA message 2022-09-15 10:47:18 +02:00
caif caif_virtio: fix race between virtio_device_ready() and ndo_open() 2022-06-27 08:04:30 -04:00
can can: mcp251x: Fix race condition on receive interrupt 2022-08-25 11:45:14 +02:00
dsa net: dsa: felix: tc-taprio intervals smaller than MTU should send at least one packet 2022-09-15 10:47:19 +02:00
ethernet i40e: Fix ADQ rate limiting for PF 2022-09-15 10:47:18 +02:00
fddi net: fddi: skfp: smt: Remove extra parameters to vararg macro 2022-05-22 23:05:56 +01:00
fjes drivers: net: Replace acpi_bus_get_device() 2022-02-02 08:05:06 -08:00
hamradio hamradio: 6pack: fix array-index-out-of-bounds in decode_std_command() 2022-06-17 11:39:46 +01:00
hippi drivers: net: hippi: Fix deadlock in rr_close() 2022-04-21 10:30:45 +02:00
hyperv Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-05-23 21:19:17 -07:00
ieee802154 ieee802154/adf7242: defer destroy_workqueue call 2022-09-08 11:23:58 +02:00
ipa net: ipa: don't assume SMEM is page-aligned 2022-08-31 17:18:05 +02:00
ipvlan net: ipvtap - add __init/__exit annotations to module init/exit funcs 2022-08-31 17:18:05 +02:00
mctp mctp i2c: correct mctp_i2c_header_create result 2022-04-01 12:04:15 +01:00
mdio Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-05-05 13:03:18 -07:00
netdevsim net: Use u64_stats_fetch_begin_irq() for stats fetch. 2022-09-08 11:24:06 +02:00
pcs net: pcs: xpcs: propagate xpcs_read error to xpcs_get_state_c37_sgmii 2022-07-21 19:01:16 -07:00
phy net: phy: lan87xx: change interrupt src of link_up to comm_ready 2022-09-15 10:47:17 +02:00
plip plip: avoid rcu debug splat 2022-08-25 11:45:21 +02:00
ppp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-05-19 11:23:59 -07:00
slip drivers: net: slip: fix NPD bug in sl_tx_timeout() 2022-04-06 23:00:16 -07:00
team teaming: deliver link-local packets with the link they arrive on 2022-02-18 11:40:52 +00:00
usb r8152: fix the RX FIFO settings when suspending 2022-08-31 17:18:02 +02:00
vmxnet3 net: vmxnet3: fix possible NULL pointer dereference in vmxnet3_rq_cleanup() 2022-05-17 12:03:52 +02:00
vxlan vxlan: do not use RT_TOS for IPv6 flowlabel 2022-08-25 11:45:21 +02:00
wan net: wan: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
wireguard wireguard: allowedips: don't corrupt stack when detecting overflow 2022-08-17 15:15:00 +02:00
wireless wifi: wilc1000: fix DMA on stack objects 2022-09-15 10:47:13 +02:00
wwan wwan: iosm: use a flexible array rather than allocate short objects 2022-05-20 17:56:50 -07:00
xen-netback xen-netback: only remove 'hotplug-status' when the vif is actually destroyed 2022-09-15 10:47:15 +02:00
amt.c amt: do not use amt->nr_tunnels outside of lock 2022-07-19 12:37:02 +02:00
bareudp.c bareudp: use ipv6_mod_enabled to check if IPv6 enabled 2022-03-16 19:16:57 -07:00
dummy.c net: bonding, dummy, ifb, team: advertise NETIF_F_GSO_SOFTWARE 2020-11-03 16:53:55 -08:00
eql.c net: eql: Use kzalloc instead of kmalloc/memset 2022-04-21 14:40:21 +02:00
geneve.c geneve: fix TOS inheriting for ipv4 2022-08-25 11:45:25 +02:00
gtp.c gtp: Fix inconsistent indenting 2022-03-16 08:47:02 -07:00
ifb.c net: ifb: support ethtools stats 2021-11-29 20:15:03 -08:00
Kconfig wireguard: Kconfig: select CRYPTO_CHACHA_S390 2022-07-06 20:04:06 -07:00
LICENSE.SRC Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
loopback.c net: loopback: enable BIG TCP packets 2022-05-16 10:18:56 +01:00
macsec.c Revert "net: macsec: update SCI upon MAC address change." 2022-08-31 17:18:01 +02:00
macvlan.c rtnetlink: add extack support in fdb del handlers 2022-05-09 11:58:20 +01:00
macvtap.c macvtap: advertise link netns via netlink 2022-03-01 17:59:28 -08:00
Makefile vxlan: move to its own directory 2022-03-01 08:38:01 +00:00
mdio.c net: mdio: Correct function name mdio45_links_ok() in comment 2021-03-29 13:42:44 -07:00
mhi_net.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
mii.c net: mii: make mii_ethtool_gset() return void 2021-08-19 13:06:53 +01:00
net_failover.c net: add per-cpu storage and net->core_stats 2022-03-11 23:17:24 -08:00
netconsole.c netpoll: add net device refcount tracker to struct netpoll 2021-12-06 16:06:02 -08:00
nlmon.c net: don't include ethtool.h from netdevice.h 2020-11-23 17:27:04 -08:00
ntb_netdev.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
rionet.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
sb1000.c net: dev: Makes sure netif_rx() can be invoked in any context. 2022-02-14 13:38:35 +00:00
Space.c eth: amd: remove NI6510 support (ni65) 2022-05-11 13:09:59 +01:00
sungem_phy.c net: sungem_phy: Add of_node_put() for reference returned by of_get_parent() 2022-07-21 19:04:19 -07:00
tap.c net: tap: NULL pointer derefence in dev_parse_header_protocol when skb->dev is null 2022-08-25 11:45:12 +02:00
thunderbolt.c net: thunderbolt: use eth_hw_addr_set() 2021-10-27 17:13:36 -07:00
tun.c net: tun: avoid disabling NAPI twice 2022-06-30 11:34:10 -07:00
veth.c veth: Add updating of trans_start 2022-06-17 11:38:09 +01:00
virtio_net.c virtio_net: fix endian-ness for RSS 2022-08-25 11:45:32 +02:00
vrf.c vrf: fix packet sniffing for traffic originating from ip tunnels 2022-04-01 11:56:55 +01:00
vsockmon.c net: don't include ethtool.h from netdevice.h 2020-11-23 17:27:04 -08:00
xen-netfront.c xen-netfront: restore __skb_queue_tail() positioning in xennet_get_responses() 2022-07-01 10:01:23 +02:00