android_kernel_motorola_sm6375/net
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Martin Ottens 83c6ab12f0 net/sched: netem: account for backlog updates from child qdisc
[ Upstream commit f8d4bc455047cf3903cd6f85f49978987dbb3027 ]

In general, 'qlen' of any classful qdisc should keep track of the
number of packets that the qdisc itself and all of its children holds.
In case of netem, 'qlen' only accounts for the packets in its internal
tfifo. When netem is used with a child qdisc, the child qdisc can use
'qdisc_tree_reduce_backlog' to inform its parent, netem, about created
or dropped SKBs. This function updates 'qlen' and the backlog statistics
of netem, but netem does not account for changes made by a child qdisc.
'qlen' then indicates the wrong number of packets in the tfifo.
If a child qdisc creates new SKBs during enqueue and informs its parent
about this, netem's 'qlen' value is increased. When netem dequeues the
newly created SKBs from the child, the 'qlen' in netem is not updated.
If 'qlen' reaches the configured sch->limit, the enqueue function stops
working, even though the tfifo is not full.

Reproduce the bug:
Ensure that the sender machine has GSO enabled. Configure netem as root
qdisc and tbf as its child on the outgoing interface of the machine
as follows:
$ tc qdisc add dev <oif> root handle 1: netem delay 100ms limit 100
$ tc qdisc add dev <oif> parent 1:0 tbf rate 50Mbit burst 1542 latency 50ms

Send bulk TCP traffic out via this interface, e.g., by running an iPerf3
client on the machine. Check the qdisc statistics:
$ tc -s qdisc show dev <oif>

Statistics after 10s of iPerf3 TCP test before the fix (note that
netem's backlog > limit, netem stopped accepting packets):
qdisc netem 1: root refcnt 2 limit 1000 delay 100ms
 Sent 2767766 bytes 1848 pkt (dropped 652, overlimits 0 requeues 0)
 backlog 4294528236b 1155p requeues 0
qdisc tbf 10: parent 1:1 rate 50Mbit burst 1537b lat 50ms
 Sent 2767766 bytes 1848 pkt (dropped 327, overlimits 7601 requeues 0)
 backlog 0b 0p requeues 0

Statistics after the fix:
qdisc netem 1: root refcnt 2 limit 1000 delay 100ms
 Sent 37766372 bytes 24974 pkt (dropped 9, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc tbf 10: parent 1:1 rate 50Mbit burst 1537b lat 50ms
 Sent 37766372 bytes 24974 pkt (dropped 327, overlimits 96017 requeues 0)
 backlog 0b 0p requeues 0

tbf segments the GSO SKBs (tbf_segment) and updates the netem's 'qlen'.
The interface fully stops transferring packets and "locks". In this case,
the child qdisc and tfifo are empty, but 'qlen' indicates the tfifo is at
its limit and no more packets are accepted.

This patch adds a counter for the entries in the tfifo. Netem's 'qlen' is
only decreased when a packet is returned by its dequeue function, and not
during enqueuing into the child qdisc. External updates to 'qlen' are thus
accounted for and only the behavior of the backlog statistics changes. As
in other qdiscs, 'qlen' then keeps track of  how many packets are held in
netem and all of its children. As before, sch->limit remains as the
maximum number of packets in the tfifo. The same applies to netem's
backlog statistics.

Fixes: 50612537e9 ("netem: fix classful handling")
Signed-off-by: Martin Ottens <martin.ottens@fau.de>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20241210131412.1837202-1-martin.ottens@fau.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-19 18:05:04 +01:00
..
6lowpan
9p 9p/xen: fix release of IRQ 2024-12-14 19:44:41 +01:00
802
8021q
appletalk
atm
ax25
batman-adv batman-adv: Do not let TT changes list grows indefinitely 2024-12-19 18:05:03 +01:00
bluetooth Bluetooth: L2CAP: do not leave dangling sk pointer on error in l2cap_sock_create() 2024-12-14 19:44:51 +01:00
bpf
bpfilter
bridge net: bridge: xmit: make sure we have at least eth header len bytes 2024-11-17 14:58:51 +01:00
caif
can net: af_can: do not leave a dangling sk pointer in can_create() 2024-12-14 19:44:51 +01:00
ceph libceph: fix race between delayed_work() and ceph_monc_stop() 2024-07-18 11:40:55 +02:00
core bpf, sockmap: Fix update element with same 2024-12-19 18:05:03 +01:00
dcb
dccp dccp: Fix memory leak in dccp_feat_change_recv 2024-12-14 19:44:45 +01:00
decnet
dns_resolver
dsa
ethernet ethernet: Add helper for assigning packet type when dest address does not match device address 2024-05-02 16:18:36 +02:00
hsr hsr: Handle failures in module init 2024-03-26 18:22:25 -04:00
ieee802154 net: ieee802154: do not leave a dangling sk pointer in ieee802154_create() 2024-12-14 19:44:51 +01:00
ife
ipv4 net: inet: do not leave a dangling sk pointer in inet_create() 2024-12-14 19:44:51 +01:00
ipv6 net: inet6: do not leave a dangling sk pointer in inet6_create() 2024-12-14 19:44:51 +01:00
iucv s390/iucv: fix receive buffer virtual vs physical address confusion 2024-09-04 13:14:57 +02:00
kcm kcm: Serialise kcm_sendmsg() for the same socket. 2024-09-04 13:14:59 +02:00
key
l2tp genetlink: hold RCU in genlmsg_mcast() 2024-11-08 16:20:50 +01:00
l3mdev
lapb
llc llc: call sock_orphan() at release time 2024-02-23 08:25:04 +01:00
mac80211 mac80211: fix user-power when emulating chanctx 2024-12-14 19:44:20 +01:00
mac802154 net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and DEV_STATS_ADD() 2024-07-27 10:38:31 +02:00
mpls
ncsi
netfilter netfilter: nft_set_hash: skip duplicated elements pending gc run 2024-12-14 19:44:46 +01:00
netlabel
netlink netlink: terminate outstanding dump on socket close 2024-12-14 19:44:18 +01:00
netrom netrom: Fix a memory leak in nr_heartbeat_expiry() 2024-07-05 09:08:22 +02:00
nfc nfc: nci: Fix handling of zero-length payload packets in nci_rx_work() 2024-06-16 13:28:46 +02:00
nsh nsh: Restore skb->{protocol,data,mac_header} for outer header in nsh_gso_segment(). 2024-05-17 11:43:49 +02:00
openvswitch openvswitch: Set the skbuff pkt_type for proper pmtud support. 2024-06-16 13:28:45 +02:00
packet af_packet: avoid erroring out after sock_init_data() in packet_create() 2024-12-14 19:44:51 +01:00
phonet phonet: fix rtm_phonet_notify() skb allocation 2024-05-17 11:43:54 +02:00
psample
qrtr net: qrtr: Update packets cloning when broadcasting 2024-11-08 16:20:33 +01:00
rds net:rds: Fix possible deadlock in rds_message_put 2024-09-04 13:15:03 +02:00
rfkill net: rfkill: gpio: Add check for clk_enable() 2024-12-14 19:44:27 +01:00
rose
rxrpc rxrpc: Fix response to PING RESPONSE ACKs to a dead call 2024-02-23 08:25:07 +01:00
sched net/sched: netem: account for backlog updates from child qdisc 2024-12-19 18:05:04 +01:00
sctp sctp: properly validate chunk size in sctp_sf_ootb() 2024-11-17 14:58:50 +01:00
smc net/smc: set rmb's SG_MAX_SINGLE_ALLOC limitation only when CONFIG_ARCH_NO_SG_CHAIN is defined 2024-08-19 05:33:28 +02:00
strparser
sunrpc sunrpc: clear XPRT_SOCK_UPD_TIMEOUT when reset transport 2024-12-14 19:44:42 +01:00
switchdev
tipc tipc: fix NULL deref in cleanup_bearer() 2024-12-19 18:05:03 +01:00
tls tls: stop recv() if initial process_rx_list gave us non-DATA 2024-03-01 13:13:37 +01:00
unix af_unix: Remove put_pid()/put_cred() in copy_peercred(). 2024-09-12 11:03:52 +02:00
vmw_vsock vsock/virtio: Initialization of the dangling pointer occurring in vsk->trans 2024-11-17 14:58:52 +01:00
wimax
wireless genetlink: hold RCU in genlmsg_mcast() 2024-11-08 16:20:50 +01:00
x25 net/x25: fix incorrect parameter validation in the x25_getsockopt() function 2024-03-26 18:22:18 -04:00
xdp xsk: validate user input for XDP_{UMEM|COMPLETION}_FILL_RING 2024-06-16 13:28:52 +02:00
xfrm xfrm: validate new SA's prefixlen using SA family when sel.family is unset 2024-11-08 16:20:52 +01:00
compat.c
Kconfig
Makefile
socket.c
sysctl_net.c