public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH net v3 0/7] net/sched: Fix packet loops in mirred and netem
Date: Thu, 26 Mar 2026 11:00:59 -0700	[thread overview]
Message-ID: <20260326181701.308275-1-stephen@networkplumber.org> (raw)

This a minor revision of Jamal's series that
fixes packet loops caused by mirred ingress redirects
and netem duplication in stacked qdisc trees.

The core idea is a 2-bit per-skb tc_depth counter that travels with
the packet.  The existing per-CPU mirred nest tracking loses state
when a packet is deferred through the backlog or moves between CPUs
via XPS/RPS.  A per-skb field covers both cases.

Patch 1 adds the tc_depth field in a padding hole in sk_buff.
Patches 2-3 revert the check_netem_in_tree() fix and its tests,
which broke legitimate multi-netem configurations.
Patch 4 uses tc_depth to stop netem duplicate recursion.
Patch 5 uses tc_depth to catch mirred ingress redirect loops.
Patches 6-7 add mirred and netem test cases.

Thanks to Jamal and Victor for fixing this.

There are additional netem bug fixes in the pipeline but those
are held back until this series lands.

Changes in v3:
- Renamed skb->ttl to skb->tc_depth to avoid confusion with IP TTL
- Expanded commit messages
- Split mirred and netem test cases into separate patches
- No code changes from v2

Changes in v2:
- Do not reuse skb->from_ingress (which was moved to skb->cb)

Jamal Hadi Salim (5):
  net: Introduce skb tc depth field to track packet loops
  net/sched: Revert "net/sched: Restrict conditions for adding
    duplicating netems to qdisc tree"
  Revert "selftests/tc-testing: Add tests for restrictions on netem
    duplication"
  net/sched: fix packet loop on netem when duplicate is on
  net/sched: Fix ethx:ingress -> ethy:egress -> ethx:ingress mirred loop

Victor Nogueira (2):
  selftests/tc-testing: Add mirred test cases exercising loops
  selftests/tc-testing: Add netem test case exercising loops

 include/linux/skbuff.h                        |   2 +
 net/sched/act_mirred.c                        |  47 +-
 net/sched/sch_netem.c                         |  47 +-
 .../tc-testing/tc-tests/actions/mirred.json   | 616 +++++++++++++++++-
 .../tc-testing/tc-tests/infra/qdiscs.json     |   5 +-
 .../tc-testing/tc-tests/qdiscs/netem.json     |  96 +--
 6 files changed, 676 insertions(+), 137 deletions(-)

-- 
2.53.0


             reply	other threads:[~2026-03-26 18:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 18:00 Stephen Hemminger [this message]
2026-03-26 18:01 ` [PATCH v3 1/7] net: Introduce skb tc depth field to track packet loops Stephen Hemminger
2026-03-26 18:01 ` [PATCH v3 2/7] net/sched: Revert "net/sched: Restrict conditions for adding duplicating netems to qdisc tree" Stephen Hemminger
2026-03-26 18:01 ` [PATCH v3 3/7] Revert "selftests/tc-testing: Add tests for restrictions on netem duplication" Stephen Hemminger
2026-03-26 18:01 ` [PATCH v3 4/7] net/sched: fix packet loop on netem when duplicate is on Stephen Hemminger
2026-03-27  7:00   ` William Liu
2026-03-26 18:01 ` [PATCH v3 5/7] net/sched: Fix ethx:ingress -> ethy:egress -> ethx:ingress mirred loop Stephen Hemminger
2026-03-26 18:01 ` [PATCH v3 6/7] selftests/tc-testing: Add mirred test cases exercising loops Stephen Hemminger
2026-03-26 18:01 ` [PATCH v3 7/7] selftests/tc-testing: Add netem test case " Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260326181701.308275-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox