Skip to contentSkip to conversation

net: hsr: fix GRO/GSO super-packet handling

PATCH Superseded Xin Xie 2 participants 10 messages Jul 31

Subsystems (5)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Xin Xie

author
#0 lore raw

v3 cover net: hsr: fix GRO/GSO super-packet handling

HSR/PRP forward frames one by one: each wire frame gets its own tag or RCT and sequence number, and duplicate discard is per frame. Two aggregation mechanisms break that per-frame assumption:

* On RX, a lower device that aggregates frames into a GRO super-packet feeds the HSR receive and forward paths a single skb instead of the individual frames. Depending on the lower device, that super-skb is then either rejected outright (for example when it exceeds the lower MTU at egress), or forwarded without valid per-wire-frame HSR/PRP processing: its single trailing HSR tag / PRP RCT cannot represent the per-frame trailers and sequence numbers of the aggregated frames. On memory-constrained devices processing super-skbs in softirq context also pressures atomic allocation.

* At the forward entry, a GSO super-packet (locally generated on the master, or delivered intact by software NICs such as veth) would be tagged and forwarded as a single frame, violating per-frame wire semantics.

Patch 1 adds netif_disable_gro() and dev_disable_gro() alongside the existing LRO helpers. HSR calls the public wrapper at enslavement time, while the networking core handles the generic feature update and recursive lower-device traversal. Enslavement to an HSR/PRP master therefore strips NETIF_F_GRO and NETIF_F_GRO_HW on the lower device. Disabling GRO on our own lowers is the cheap, always-correct default for this problem: unlike the bridge, HSR/PRP must attach a tag or RCT and a sequence number to every wire frame, so leaving GRO enabled and re-segmenting later (the bridge pattern) would add per-packet segmentation cost and still could not recover per-frame trailer state from a super-skb. This is a setup-time default, not an immutable feature policy: a later privileged feature override, or a lower newly attached below a stacked slave, can re-enable GRO without re-walking the HSR enslavement path.

Patch 2 is a preparatory locking change: it shrinks hsr->seqnr_lock from whole hsr_forward_skb() calls to the individual sequence counter updates, so that the segmentation work of patch 3 (per-segment allocation, checksums and forwarding) never runs with BH disabled under the global sequence lock. Patch 3 depends on patch 2; their automatic stable selection is limited to 7.0 and newer, where sparse-bitmap duplicate discard accepts out-of-order arrival. Older stable branches require an adapted backport.

Patch 3 unfolds the remaining GSO super-packets at the forward entry with the top-level GSO dispatch (__skb_gso_segment()), so each wire frame still gets its own tag and sequence number. Patch 1 and patch 3 cover different sources and neither is redundant:
patch 1 establishes the safe default on our own enslaved lowers at setup time (a later privileged override can re-enable GRO, and patch 3 is the fail-safe for that case), while patch 3 handles GSO super-packets that legitimately arise from locally generated master traffic or from untagged SAN ingress on the interlink. Segmentation is offered only for those two roles, whose frames are known to be plain Ethernet. A super-packet from a LAN slave may carry per-frame HSR tags or PRP RCT trailers that software segmentation cannot recover, and an already-tagged HSR/PRP super-packet violates per-frame wire semantics; both are rejected by ingress-port policy. The HSR master also stops advertising NETIF_F_GSO_MASK so locally generated traffic is segmented as early as possible.

Patch 4 adds a kselftest covering the above: GRO disabled on enslaved devices, no GSO/TSO advertised by the HSR master, and a TCP stream from a TSO-enabled SAN through an HSR DUT. The stream evidence is direct: the SAN's TX frame-size average must exceed a fixed super-packet threshold while the DUT LAN legs' averages stay below a fixed per-frame guard, which is aggregate evidence that super-packets entered the forward path and bulk output was segmented (not a per-frame maximum proof); zero retransmits is reported as a secondary health signal. The one-shot iperf3 server is confined to a private mktemp workdir with its real exit status propagated, so on every path exercised by the test itself (normal completion, server startup failure, client failure, never-published PID, and baseline/final counter-snapshot parse failures) no process or directory can leak.

Validation:
* build: W=1 allmodconfig and allyesconfig, base vs patched - no new warnings (final run on this frozen v3 candidate: all four builds RC=0; 342/342 normalized warnings in allmodconfig and 345/345 in allyesconfig, base-vs-patched diffs empty).
* selftests (all on this exact v3 kernel, QEMU x86_64):
hsr_gro_superpacket passes (GRO stripped on enslaved devices; SAN TX frame-size average ~38k bytes > super-packet threshold; DUT LAN legs ~1.5k bytes < per-frame guard; 0 retransmits) and fails on the base kernel: the LAN per-frame-average guard fails at approximately 1.9 kB on a veth lower device (aggregate evidence; not a universal MTU-drop or per-frame-maximum proof); hsr_ping, hsr_redbox, link_faults and
prp_ping all pass.
* functional: IPv4, IPv6 and VLAN-tagged SAN TSO streams unfold per-frame through an HSR DUT with clean dmesg; the counter assertions show super-packets entering the forward path and per-frame output on both LAN legs. LAN-side aggregates and already-tagged super-packets are dropped by ingress-port policy (supplementary, reused v1/v2 evidence per the same patch-id argument).
* concurrency: parallel interlink-RX (GSO) and master-TX streams with supervision timers running, under a PROVE_LOCKING kernel built from this candidate: both streams 0 retransmits, no lockdep/WARN/BUG/sleep-atomic findings.
* lifecycle: normal completion, server startup failure, client failure, a never-published server PID (live-but-unpublished proven), and forced baseline/final counter-snapshot parse failures all exit bounded with no leftover iperf3 process, workdir, or namespace (all re-run on this exact v3 script; the parse-failure paths are new v3 evidence: a baseline-snapshot parse failure aborts before the iperf3 client workload, a final-snapshot parse failure aborts before any counter-delta verdict, and both leave no process or workdir).
* physical igb lower devices (supplementary, reused v1 evidence:
patches 1-3 are patch-id identical and the only upstream delta in the touched files is an unrelated 2-line hsr_del_port() change): GRO stripped at enslavement; force-enabled generic GRO super-packets unfold at line rate with a clean dmesg.

---

Changes in v3:
- Fix the selftest's early-abort path: both TX counter snapshot blocks now validate their values as decimal counters. Previously the error flag was lost in a command-substitution subshell: a baseline-snapshot parse failure let the test continue into the iperf3 client workload, and a final-snapshot parse failure was only caught indirectly. Now a baseline failure aborts before the client workload, and a final failure aborts before any counter-delta evaluation.
- Wrap the remaining lines that exceed 80 columns (tab-expanded) in the selftest.
- Make the selftest's network namespaces instance-unique via setup_ns()/cleanup_all_ns(): the previous hard-coded namespace names were deleted unconditionally at setup, which could destroy unrelated host namespaces and made concurrent instances collide. Also re-prove that pre-existing namespaces survive and that two instances run in parallel.
- Patch 2 message: state explicitly that the lock shrink removes the old allocation-through-forward ordering guarantee and why current sparse-bitmap duplicate discard accepts that; correct the seqnr_lock history to its actual branch shape.
- Patch 1 message and the failure description: the outcome of a GRO aggregate is driver-dependent (rejected by a constrained lower device, or forwarded without valid per-frame processing), not a universal MTU drop. Also spell out the enforcement
contract: the enslavement-time GRO disable is a setup-time default, not an immutable feature policy, and patch 3 is the fail-safe for traffic that still arrives aggregated.
- Stable floor: patches 2 and 3 are marked for 7.0 and newer (sparse-bitmap duplicate discard); patch 1's eligibility is unchanged; older branches need adapted backports.
- Rebase onto current net; patches 1-3 code payloads are unchanged (stable patch-ids).
- Cover clarifications: the concrete RX failure site, the patch 1 vs patch 3 layering, and why disabling GRO is preferred over re-segmenting later.

Note on the v2 contest report: the v2 series conflicts in net-next with our own PRP RedBox series now merged there
(https://lore.kernel.org/netdev/[email protected]/).
On current net it applies cleanly (re-verified by a full-series git am). A tested net-next merge resolution is available on request.

Previous postings (newest first):
v2: https://lore.kernel.org/netdev/[email protected]/
v1: https://lore.kernel.org/netdev/[email protected]/

Xin Xie (4):
net: hsr: fix packet drops caused by GRO superpackets
net: hsr: shrink seqnr_lock to sequence counter updates
net: hsr: unfold GSO super-packets at the forward entry
selftests: net: hsr: add GRO super-packet forwarding test

 include/linux/netdevice.h                     |   2 +
 net/core/dev.c                                |  18 +
 net/core/dev_api.c                            |  16 +
 net/hsr/hsr_device.c                          |  17 +-
 net/hsr/hsr_forward.c                         |  53 +-
 net/hsr/hsr_slave.c                           |  12 +-
 tools/testing/selftests/net/hsr/Makefile      |   1 +
 .../selftests/net/hsr/hsr_gro_superpacket.sh  | 462 ++++++++++++++++++
 8 files changed, 557 insertions(+), 24 deletions(-)
 create mode 100755 tools/testing/selftests/net/hsr/hsr_gro_superpacket.sh

base-commit: 51b093a7ba27476e1f639455f005e8d2e75390e4

Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v3 1/4 net: hsr: fix packet drops caused by GRO superpackets

HSR/PRP append a 6-byte tag/RCT to every forwarded frame and process each frame individually (sequence numbering, duplicate discard). When a lower device aggregates received frames into a GRO super-packet -- in software, or in hardware on GRO_HW-capable NICs -- the HSR receive/forward path sees a single skb instead of the individual frames. Depending on the lower device, that super-skb is then either rejected outright (for example when it exceeds the lower MTU at egress), or forwarded without valid per-wire-frame HSR/PRP
processing: its single trailing tag/RCT cannot represent the per-frame trailers and sequence numbers of the aggregated frames. On memory-constrained devices, processing super-skbs in softirq context can also pressure atomic memory allocation.

The HSR/PRP stack already disables LRO on enslaved devices for the same reason. Extend that treatment to GRO: add netif_disable_gro() and dev_disable_gro() mirroring netif_disable_lro()/dev_disable_lro(), and call dev_disable_gro() from hsr_portdev_setup() so enslavement to an HSR/PRP master automatically strips NETIF_F_GRO and NETIF_F_GRO_HW on the lower device (recursively on its own lowers, as with LRO).

This is a setup-time default, not an immutable feature policy: a later privileged feature override, or a lower newly attached below a stacked slave, can re-enable GRO without re-walking the HSR enslavement path. Patch 3 is the fail-safe for that case: a GSO skb that nevertheless reaches the forward entry is segmented on the plain master/interlink paths or rejected on the LAN/tagged paths, so invalid aggregates are never forwarded as-is -- though a later override can still cost traffic on a LAN ingress.

Fixes f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
---
 include/linux/netdevice.h |  2 ++
 net/core/dev.c            | 18 ++++++++++++++++++
 net/core/dev_api.c        | 16 ++++++++++++++++
 net/hsr/hsr_slave.c       |  1 +
 4 files changed, 37 insertions(+)
include/linux/netdevice.h +2 -0
index 9981d637f8b5..eba2c26a49ba 100644
@@ -3434,6 +3434,8 @@ void dev_close(struct net_device *dev);
 void netif_close_many(struct list_head *head, bool unlink);
 void netif_disable_lro(struct net_device *dev);
 void dev_disable_lro(struct net_device *dev);
+void netif_disable_gro(struct net_device *dev);
+void dev_disable_gro(struct net_device *dev);
 int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb);
 u16 dev_pick_tx_zero(struct net_device *dev, struct sk_buff *skb,
 		     struct net_device *sb_dev);
net/core/dev.c +18 -0
index 5933c5dab09e..a6cf2adc8625 100644
@@ -1840,6 +1840,24 @@ void netif_disable_lro(struct net_device *dev)
 	}
 }
 
+void netif_disable_gro(struct net_device *dev)
+{
+	struct net_device *lower_dev;
+	struct list_head *iter;
+
+	dev->wanted_features &= ~(NETIF_F_GRO | NETIF_F_GRO_HW);
+	netdev_update_features(dev);
+
+	if (unlikely(dev->features & (NETIF_F_GRO | NETIF_F_GRO_HW)))
+		netdev_WARN(dev, "failed to disable GRO!\n");
+
+	netdev_for_each_lower_dev(dev, lower_dev, iter) {
+		netdev_lock_ops(lower_dev);
+		netif_disable_gro(lower_dev);
+		netdev_unlock_ops(lower_dev);
+	}
+}
+
 /**
  *	dev_disable_gro_hw - disable HW Generic Receive Offload on a device
  *	@dev: device
net/core/dev_api.c +16 -0
index 437947dd08ed..02fb21629512 100644
@@ -269,6 +269,22 @@ void dev_disable_lro(struct net_device *dev)
 }
 EXPORT_SYMBOL(dev_disable_lro);
 
+/**
+ * dev_disable_gro() - disable Generic Receive Offload on a device
+ * @dev: device
+ *
+ * Disable Generic Receive Offload (GRO) on a net device.  Must be
+ * called under RTNL.  This is needed if received packets may be
+ * forwarded to another interface.
+ */
+void dev_disable_gro(struct net_device *dev)
+{
+	netdev_lock_ops(dev);
+	netif_disable_gro(dev);
+	netdev_unlock_ops(dev);
+}
+EXPORT_SYMBOL(dev_disable_gro);
+
 /**
  * dev_set_promiscuity() - update promiscuity count on a device
  * @dev: device
net/hsr/hsr_slave.c +1 -0
index 01c73b4b50dd..da06b21cdf51 100644
@@ -170,6 +170,7 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
 	if (res)
 		goto fail_rx_handler;
 	dev_disable_lro(dev);
+	dev_disable_gro(dev);
 
 	return 0;
 
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH v3 2/4 net: hsr: shrink seqnr_lock to sequence counter updates

In reply to Xin Xie

hsr->seqnr_lock is currently held across entire hsr_forward_skb()
calls: master TX (hsr_dev_xmit()), interlink RX (hsr_handle_frame()), and both supervision frame builders hold it while frames are built, classified, duplicated and forwarded on every port. The only state that actually needs the lock is the sequence counters themselves (hsr->sequence_nr / hsr->sup_sequence_nr).

Shrink the locking to the individual counter updates:
handle_std_frame() now takes the lock around its sequence number allocation (replacing the lockdep assertion), the master TX and interlink RX paths drop their outer lock, and the supervision builders release the lock right after updating their counter instead of holding it across frame construction and forwarding.

Ordering: with IFF_NO_QUEUE and dev->lltx, hsr_dev_xmit() is concurrently callable, and this change removes the old allocation-through-forward ordering guarantee there: master-TX frames may now be emitted out of sequence-allocation order. On the current tree this is safe because duplicate discard tracks individual sequence numbers in sparse bitmaps (commit aae9d6b616b5 ("hsr:
Implement more robust duplicate discard for HSR") and commit 415e6367512b ("hsr: Implement more robust duplicate discard for PRP")) rather than requiring monotonic arrival. Sequence numbers remain unique and monotonically allocated per counter.

This is a latency/critical-section prerequisite for unfolding GSO super-packets at the forward entry (not a functional prerequisite):
the segmentation work should not extend the global sequence lock's critical section. Patch 3 depends on this change; their automatic stable selection is limited to 7.0 and newer, where sparse-bitmap duplicate discard accepts out-of-order arrival. Older stable branches require an adapted backport.

History of the lock being narrowed: it was introduced by
commit 06afd2c31d33 ("hsr: Synchronize sending frames to have always incremented outgoing seq nr.") and briefly removed by
commit b3c9e65eb227 ("net: hsr: remove seqnr_lock") in net. Merge
commit 46ae4d0a4897 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
reverted that removal because
commit 430d67bdcb04 ("net: hsr: Use the seqnr lock for frames
received via interlink port.") in net-next had already superseded it
by adding locking for the interlink RX path. All sequence counter updates remain protected; only the forwarding work moves out of the critical section.

---
 net/hsr/hsr_device.c  | 15 ++++-----------
 net/hsr/hsr_forward.c |  3 ++-
 net/hsr/hsr_slave.c   | 11 +----------
 3 files changed, 7 insertions(+), 22 deletions(-)
net/hsr/hsr_device.c +4 -11
index 5555b71ab19b..3fd1762d8916 100644
@@ -232,9 +232,7 @@ static netdev_tx_t hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev)
 		skb->dev = master->dev;
 		skb_reset_mac_header(skb);
 		skb_reset_mac_len(skb);
-		spin_lock_bh(&hsr->seqnr_lock);
 		hsr_forward_skb(skb, master);
-		spin_unlock_bh(&hsr->seqnr_lock);
 	} else {
 		dev_core_stats_tx_dropped_inc(dev);
 		dev_kfree_skb_any(skb);
@@ -335,6 +333,7 @@ static void send_hsr_supervision_frame(struct hsr_port *port,
 		hsr_stag->sequence_nr = htons(hsr->sequence_nr);
 		hsr->sequence_nr++;
 	}
+	spin_unlock_bh(&hsr->seqnr_lock);
 
 	hsr_stag->tlv.HSR_TLV_type = type;
 	/* HSRv0 has 6 unused bytes after the MAC */
@@ -356,14 +355,10 @@ static void send_hsr_supervision_frame(struct hsr_port *port,
 		ether_addr_copy(hsr_sp->macaddress_A, hsr->macaddress_redbox);
 	}
 
-	if (skb_put_padto(skb, ETH_ZLEN)) {
-		spin_unlock_bh(&hsr->seqnr_lock);
+	if (skb_put_padto(skb, ETH_ZLEN))
 		return;
-	}
 
 	hsr_forward_skb(skb, port);
-	spin_unlock_bh(&hsr->seqnr_lock);
-	return;
 }
 
 static void send_prp_supervision_frame(struct hsr_port *master,
@@ -390,6 +385,7 @@ static void send_prp_supervision_frame(struct hsr_port *master,
 	spin_lock_bh(&hsr->seqnr_lock);
 	hsr_stag->sequence_nr = htons(hsr->sup_sequence_nr);
 	hsr->sup_sequence_nr++;
+	spin_unlock_bh(&hsr->seqnr_lock);
 	hsr_stag->tlv.HSR_TLV_type = PRP_TLV_LIFE_CHECK_DD;
 	hsr_stag->tlv.HSR_TLV_length = sizeof(struct hsr_sup_payload);
 
@@ -397,13 +393,10 @@ static void send_prp_supervision_frame(struct hsr_port *master,
 	hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload));
 	ether_addr_copy(hsr_sp->macaddress_A, master->dev->dev_addr);
 
-	if (skb_put_padto(skb, ETH_ZLEN)) {
-		spin_unlock_bh(&hsr->seqnr_lock);
+	if (skb_put_padto(skb, ETH_ZLEN))
 		return;
-	}
 
 	hsr_forward_skb(skb, master);
-	spin_unlock_bh(&hsr->seqnr_lock);
 }
 
 /* Announce (supervision frame) timer function
net/hsr/hsr_forward.c +2 -1
index 0774981a65c1..8e4158a9b57c 100644
@@ -621,9 +621,10 @@ static void handle_std_frame(struct sk_buff *skb,
 	if (port->type == HSR_PT_MASTER ||
 	    port->type == HSR_PT_INTERLINK) {
 		/* Sequence nr for the master/interlink node */
-		lockdep_assert_held(&hsr->seqnr_lock);
+		spin_lock_bh(&hsr->seqnr_lock);
 		frame->sequence_nr = hsr->sequence_nr;
 		hsr->sequence_nr++;
+		spin_unlock_bh(&hsr->seqnr_lock);
 	}
 }
 
net/hsr/hsr_slave.c +1 -10
index da06b21cdf51..0ca55d9323c5 100644
@@ -73,16 +73,7 @@ static rx_handler_result_t hsr_handle_frame(struct sk_buff **pskb)
 	}
 	skb_reset_mac_len(skb);
 
-	/* Only the frames received over the interlink port will assign a
-	 * sequence number and require synchronisation vs other sender.
-	 */
-	if (port->type == HSR_PT_INTERLINK) {
-		spin_lock_bh(&hsr->seqnr_lock);
-		hsr_forward_skb(skb, port);
-		spin_unlock_bh(&hsr->seqnr_lock);
-	} else {
-		hsr_forward_skb(skb, port);
-	}
+	hsr_forward_skb(skb, port);
 
 finish_consume:
 	return RX_HANDLER_CONSUMED;
Signature · 1 line
2.43.0
author
#5 lore raw

PATCH v3 3/4 net: hsr: unfold GSO super-packets at the forward entry

In reply to Xin Xie

HSR/PRP forward frames one by one: each wire frame gets its own tag and sequence number, and duplicate discard is per frame. A GSO super-packet reaching hsr_forward_skb() breaks that per-frame
semantics: it would be tagged and forwarded as a single frame.

Unfold such super-packets at the forward entry with the top-level GSO
dispatch: __skb_gso_segment() initializes SKB_GSO_CB() and performs the L2->L3->L4 protocol dispatch (calling the low-level skb_segment() helper directly is not allowed here -- it reads SKB_GSO_CB(skb) state that only __skb_gso_segment() sets up). features = 0 requests full software segmentation; tx_path is selected by ingress port (master = locally generated TX, interlink = RX) to get the right checksum semantics. Each segment then runs through the existing per-frame path, which is split out as hsr_forward_skb_one() so that no GSO skb can reach it.

Segmentation is only offered for the ingress roles whose frames are known to be plain Ethernet: the master (locally generated) and the interlink (SAN side, untagged). A super-packet received from a LAN slave may carry per-frame HSR tags or PRP RCT trailers that software segmentation cannot recover, and an already-tagged HSR/PRP super-packet violates per-frame wire semantics; both are rejected by ingress-port policy. (ETH_P_PRP identifies supervision traffic only; a PRP data frame keeps its payload EtherType, so RCT carriage cannot be tested by protocol.)

Also drop NETIF_F_GSO_MASK from the HSR master's hw_features so locally generated traffic is segmented before reaching the forward path whenever possible.

Patch 2 (seqnr_lock shrink) is a latency/critical-section prerequisite for this change; their automatic stable selection is limited to 7.0 and newer. Older stable branches require an adapted backport.

Fixes f421436a591d ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)")
Cc <[email protected]> # 7.0.x
---
 net/hsr/hsr_device.c  |  2 +-
 net/hsr/hsr_forward.c | 50 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 50 insertions(+), 2 deletions(-)
net/hsr/hsr_device.c +1 -1
index 3fd1762d8916..248cbb142e21 100644
@@ -652,7 +652,7 @@ void hsr_dev_setup(struct net_device *dev)
 	dev->needs_free_netdev = true;
 
 	dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
-			   NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
+			   NETIF_F_HW_CSUM |
 			   NETIF_F_HW_VLAN_CTAG_TX |
 			   NETIF_F_HW_VLAN_CTAG_FILTER;
 
net/hsr/hsr_forward.c +49 -1

65 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#7 lore raw

PATCH v3 4/4 selftests: net: hsr: add GRO super-packet forwarding test

In reply to Xin Xie

Add a test exercising the HSR forward path with GSO super-packets:
a TSO-enabled SAN behind the interlink streams TCP through an HSR DUT to a peer node. The test verifies that:

* enslaved devices have GRO and HW-GRO disabled automatically,
* the HSR master does not advertise GSO/TSO features (including tx-tcp6/udp/gso-list, to catch future hw_features leaks),
* super-packets really leave the SAN (TX average frame size above a fixed threshold) while bulk output on the DUT's LAN legs stays at per-frame size — aggregate counter evidence that GSO enters the forward path and is unfolded at the forward entry. Zero TCP retransmits is reported as a secondary health signal.

The one-shot iperf3 server lives in a private mktemp -d workdir (mode 0700): its exact PID is retained only after numeric, alive, comm==iperf3 and netns-membership checks, its real exit status is propagated through an rc file, and cleanup kills by exact PID with a bounded wrapper reap plus a namespace-scoped iperf3 sweep. Server startup failure, client failure and a never-published PID are all bounded exits with no process or directory leaks. Environments whose iproute2 lacks the HSR interlink syntax are skipped with ksft_skip.

Without this series the feature checks fail, and on drivers that hand GRO super-packets to the HSR receive path the stream degrades or stalls.

---
 tools/testing/selftests/net/hsr/Makefile      |   1 +
 .../selftests/net/hsr/hsr_gro_superpacket.sh  | 462 ++++++++++++++++++
 2 files changed, 463 insertions(+)
 create mode 100755 tools/testing/selftests/net/hsr/hsr_gro_superpacket.sh
tools/testing/selftests/net/hsr/Makefile +1 -0
index 31fb9326cf53..0d105476e7c5 100644
@@ -3,6 +3,7 @@
 top_srcdir = ../../../../..
 
 TEST_PROGS := \
+	hsr_gro_superpacket.sh \
 	hsr_ping.sh \
 	hsr_redbox.sh \
 	link_faults.sh \
tools/testing/selftests/net/hsr/hsr_gro_superpacket.sh new file +462 -0

462 lines not on this page · raw message

Signature · 1 line
2.43.0
Tested-by on the v3 series
#9 lore raw
In reply to Xin Xie
Quoted 1 line · Xin Xie

[PATCH net v3 0/4] net: hsr: fix GRO/GSO super-packet handling

I tested the series on top of net under virtme-ng (QEMU/KVM, x86_64).

selftests/net/hsr/hsr_gro_superpacket.sh passes: the SAN emits TSO super-packets (TX frame-size average around 41 kB, well over the 2048 byte threshold) while both DUT LAN legs stay per-frame (average around 1497 bytes, under the 1514 byte guard), and the test reports success. For contrast, without the series the same topology leaks oversized, HSR-tagged frames onto the LAN legs (up to roughly 28 kB, ethertype 0x88fb), which this work eliminates. hsr_ping, prp_ping and hsr_redbox still pass.

I also went through the code. Patch 1 mirrors netif_disable_lro() and dev_disable_lro() faithfully, and clearing both NETIF_F_GRO and NETIF_F_GRO_HW matches the changelog intent. For patch 2 I audited all seqnr_lock users; after the change it guards only the sequence counter updates, so dropping the outer lock around hsr_forward_skb() cannot race any other state. For patch 3 the __skb_gso_segment() dispatch and the consume_skb() and kfree_skb() paths look correct, and the port type gate keeps LAN and tagged aggregates out of software segmentation.

Per-patch Reviewed-by for patches 1 to 3 sent separately.

Reviewed-by on v3 1/4
#2 lore raw

Re: [PATCH net v3 1/4] net: hsr: fix packet drops caused by GRO superpackets

In reply to Xin Xie

This mirrors netif_disable_lro() and dev_disable_lro() faithfully, including the recursive lower device walk and the split between the internal helper in dev.c and the exported wrapper in dev_api.c. Clearing both NETIF_F_GRO and NETIF_F_GRO_HW matches the changelog.

Reviewed-by on v3 2/4
#4 lore raw

Re: [PATCH net v3 2/4] net: hsr: shrink seqnr_lock to sequence counter updates

In reply to Xin Xie

I audited all seqnr_lock users after the change: it now guards only the sequence counter updates (handle_std_frame() and the two supervision builders), so dropping the outer lock around hsr_forward_skb() cannot race any other state. Lock and unlock stay balanced on every path.

Reviewed-by on v3 3/4
#6 lore raw

Re: [PATCH net v3 3/4] net: hsr: unfold GSO super-packets at the forward entry

In reply to Xin Xie

The __skb_gso_segment() dispatch and the consume_skb() and kfree_skb() paths look correct: the original skb is freed on success and the segment list is freed on error, with no double free. The port type gate keeps LAN and tagged aggregates out of software segmentation.

Reviewed-by on v3 4/4
#8 lore raw

Re: [PATCH net v3 4/4] selftests: net: hsr: add GRO super-packet forwarding test

In reply to Xin Xie

I ran this under virtme-ng (QEMU/KVM). It passes on the patched kernel:
the SAN TX frame-size average is around 41 kB, well over the 2048 byte threshold, both DUT LAN legs average around 1497 bytes, under the 1514 byte guard, and it reports success. On an unpatched kernel it correctly fails, where oversized HSR-tagged frames reach the LAN legs, so the test discriminates the fix. The topology setup and the counter delta thresholds look sound.