From: sashiko-bot@kernel.org
To: "Fil Dunsky" <filipp.dunsky@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH RFC net-next 6/7] net: cortina: connect wired IPv4 NAT to nftables hardware flowtables
Date: Thu, 26 Nov 2026 20:54:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-236175@kernel.org> (raw)
In-Reply-To: <20261125-almondplus-offload-rfc-v1-6-703175c6340c@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: cortina: native_rule() withdraws active offload rules
after 2s expiry
--
commit 3485cf5bb03e313d42563aa90d0681cf27485447
Author: Fil Dunsky <filipp.dunsky@gmail.com>
net: cortina: connect wired IPv4 NAT to nftables hardware flowtables
This commit adds an nftables hardware flowtable frontend for the CS7542
forwarding engine, translating established IPv4 TCP and UDP NAT flows
across the QCA8337 DSA switch into checked hardware leases.
> diff --git a/drivers/net/ethernet/cortina/flowtable/cs7542_fw4.c b/drivers/net/ethernet/cortina/flowtable/cs7542_fw4.c
> new file mode 100644
> index 0000000000000..d5a132e877b0f
> --- /dev/null
> +++ b/drivers/net/ethernet/cortina/flowtable/cs7542_fw4.c
[ ... ]
> +static enum native_reason
> +prepare_request(struct native_binding *b, struct flow_cls_offload *cls,
> + struct cs7542_fe_native_request *request)
> +{
[ ... ]
> + tuple = (struct cs7542_l4_tuple){
> + .src = facts.rewrite.before.src,
> + .dst = facts.rewrite.before.dst,
> + .sport = facts.rewrite.before.sport,
> + .dport = facts.rewrite.before.dport,
> + .ip_proto = htonl(facts.ip_proto),
> + };
> + if (cs7542_rx_path_lookup(b->conduit, in.port, &tuple, &wire))
> + return NATIVE_WIRE;
> + if (!fdb_matches(ip, wire.source) ||
> + !fdb_matches(op, facts.rewrite.dmac))
> + return NATIVE_PATH;
[ ... ]
> +}
[ ... ]
> +static int native_rule(void *ctx, u64 id, struct flow_cls_offload *cls)
> +{
[ ... ]
> + if (!rtnl_trylock()) {
> + reason = NATIVE_PATH;
> + result = cs7542_fe_live_reject(b->owner, b->handle, cls->cookie,
> + b->version, -EBUSY);
> + } else {
> + reason = prepare_request(b, cls, &request);
> + if (reason == NATIVE_OWNER && request.route_mtu &&
> + replace_native) {
> + result = native_replace_checked(b, cls, &request,
> + &reason);
> + } else {
> + result = cs7542_fe_live_reject(b->owner, b->handle,
> + cls->cookie, b->version,
> + -EOPNOTSUPP);
> + }
> + rtnl_unlock();
> + }
> + atomic64_inc(&counts[reason]);
> + return result;
> +}
[Severity: Medium]
Can a refresh FLOW_CLS_REPLACE tear down an already-installed hardware
rule for cls->cookie once its 2-second CPU observation in paths[] expires?
Once a flow direction is offloaded in hardware, its packets bypass the CPU
ETH_P_XDSA observer and its path_entry expires after PATH_AGE (2 * HZ).
If a packet of the connection later hits the software flowtable path (for
example, because the opposite direction stayed in software after a hash
collision in the 128-slot direct-mapped paths[] table, where remember()
keeps refreshing an active CPU flow's slot), flow_offload_refresh()
re-issues FLOW_CLS_REPLACE for both directions.
prepare_request() then fails in cs7542_rx_path_lookup() with NATIVE_WIRE
before reaching cs_be_replace()'s idempotent check for an existing cookie,
and native_rule() calls cs7542_fe_live_reject() (as it also does on
transient rtnl_trylock() contention), withdrawing the active hardware
lease.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-almondplus-offload-rfc-v1-0-703175c6340c@gmail.com?part=6
next prev parent reply other threads:[~2026-11-26 20:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 20:50 [PATCH RFC net-next 0/7] net: cortina: CS7542 wired IPv4 hardware flowtable offload Fil Dunsky via B4 Relay
2026-11-25 20:50 ` [PATCH RFC net-next 1/7] dt-bindings: net: dsa: allow the QCA four-byte tag protocol Fil Dunsky via B4 Relay
2026-11-25 20:50 ` [PATCH RFC net-next 2/7] net: dsa: add a QCA four-byte CPU tagger Fil Dunsky via B4 Relay
2026-11-25 21:15 ` Andrew Lunn
2026-11-26 20:54 ` sashiko-bot
2026-11-25 20:50 ` [PATCH RFC net-next 3/7] netfilter: flowtable: expose route MTU and established TCP context Fil Dunsky via B4 Relay
2026-11-25 20:50 ` [PATCH RFC net-next 4/7] net: cortina: add a serialized CS7542 forwarding engine owner Fil Dunsky via B4 Relay
2026-11-26 20:54 ` sashiko-bot
2026-11-25 20:50 ` [PATCH RFC net-next 5/7] net: dsa: qca8k: select the four-byte format before port activation Fil Dunsky via B4 Relay
2026-11-25 21:13 ` Andrew Lunn
2026-11-26 20:54 ` sashiko-bot
2026-11-25 20:50 ` [PATCH RFC net-next 6/7] net: cortina: connect wired IPv4 NAT to nftables hardware flowtables Fil Dunsky via B4 Relay
2026-11-26 20:54 ` sashiko-bot [this message]
2026-11-25 20:50 ` [PATCH RFC net-next 7/7] docs: networking: describe the CS7542 flowtable RFC limits Fil Dunsky via B4 Relay
2026-11-26 20:54 ` sashiko-bot
2026-11-25 21:10 ` [PATCH RFC net-next 0/7] net: cortina: CS7542 wired IPv4 hardware flowtable offload Andrew Lunn
2026-11-25 21:55 ` Fil Dunsky
2026-11-25 22:10 ` Andrew Lunn
2026-11-25 22:56 ` Fil Dunsky
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=sashiko-outbox-236175@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=filipp.dunsky@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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