Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Florian Fainelli" <florian.fainelli@broadcom.com>
Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree@vger.kernel.org>,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next 8/9] net: add KUnit coverage for FA and flowtable path validation
Date: Tue, 17 Nov 2026 22:34:00 +0000	[thread overview]
Message-ID: <sashiko-outbox-219756@kernel.org> (raw)
In-Reply-To: <20261116222519.1416501-9-florian.fainelli@broadcom.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: broadcom: fa: invalid MMIO heap pointer in bcm-ns-fa
  KUnit tests
--

commit ba8a6de53c2a0a0ed0378db8bfcb3ef2f7005c51
Author: Florian Fainelli <florian.fainelli@broadcom.com>

net: add KUnit coverage for FA and flowtable path validation

This commit adds KUnit test suites for Broadcom B53 FA exception guards,
Northstar flow accelerator rule encoding and invalidation, Broadcom FA DSA
tags, and Netfilter flowtable cached path validation.

> diff --git a/drivers/net/ethernet/broadcom/bcm-ns-fa-test.c b/drivers/net/ethernet/broadcom/bcm-ns-fa-test.c
> new file mode 100644
> index 0000000000000..59406f84809e7
> --- /dev/null
> +++ b/drivers/net/ethernet/broadcom/bcm-ns-fa-test.c
[ ... ]
> +static void fa_test_tcp_control_readiness(struct kunit *test)
> +{
> +	struct bcm_ns_fa *fa = kunit_kzalloc(test, sizeof(*fa), GFP_KERNEL);
> +
> +	KUNIT_ASSERT_NOT_NULL(test, fa);
> +	fa->regs = (void __iomem *)kunit_kzalloc(test, 0xc0, GFP_KERNEL);
> +	fa->learned = kunit_kcalloc(test, FA_SLOTS, sizeof(*fa->learned), GFP_KERNEL);
> +	KUNIT_ASSERT_NOT_NULL(test, fa->regs);
> +	KUNIT_ASSERT_NOT_NULL(test, fa->learned);
> +	mutex_init(&fa->lock);
> +	spin_lock_init(&fa->learn_lock);
> +	fa_control_state_change(fa, true);
> +	KUNIT_EXPECT_TRUE(test, fa->tcp_ready);
> +	fa_control_state_change(fa, false);
> +	KUNIT_EXPECT_FALSE(test, fa->tcp_ready);
> +	fa->stopping = true;
> +	fa_control_state_change(fa, true);
> +	KUNIT_EXPECT_FALSE(test, fa->tcp_ready);
> +}
> +
> +static void fa_test_lookup_gate_preserves_tags(struct kunit *test)
> +{
> +	struct bcm_ns_fa *fa = kunit_kzalloc(test, sizeof(*fa), GFP_KERNEL);
> +	u32 *regs = kunit_kzalloc(test, 0xc0, GFP_KERNEL);
> +	u32 control = FA_CTL_CRC_OVERWRITE | FA_CTL_NO_DA_CHECK;
> +	u32 header = FA_BRCM_HW | FA_BRCM_RX | FA_BRCM_TX | FA_BRCM_PARSE_EXCEPTIONS;
> +
> +	KUNIT_ASSERT_NOT_NULL(test, fa);
> +	KUNIT_ASSERT_NOT_NULL(test, regs);
> +	fa->regs = (void __iomem *)regs;
> +	writel(control, fa->regs + FA_CTL);
> +	writel(header, fa->regs + FA_BRCM_HDR);
> +	fa->enabled = true;
> +	fa->tcp_ready = true;
> +	fa->route_mtu_ok = true;
> +	fa_lookup_update(fa);
> +	KUNIT_EXPECT_EQ(test, readl(fa->regs + FA_L2_ETHERTYPE),
> +			(u32)(ETH_P_IP | ETH_P_IPV6 << 16));

[Severity: Medium]
Can fa->regs be backed by a raw kunit_kzalloc() buffer when writel() and
readl() are called on it here and in fa_test_invalidation()?

Running this suite under the default User Mode Linux KUnit runner (with
drivers/net/ethernet/broadcom/.kunitconfig) enables indirect iomem
emulation in lib/logic_iomem.c, where get_area() rejects plain heap
addresses that lack the ioremap bias.  Every readl() and writel() on
fa->regs triggers a warning splat, drops the write, and returns
0xffffffffU from readl(), causing the register expectations in
fa_test_lookup_gate_preserves_tags() and owner.lookup_stopped in
fa_test_invalidation() to fail.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116222519.1416501-1-florian.fainelli@broadcom.com?part=8

  reply	other threads:[~2026-11-17 22:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 22:25 [PATCH net-next 0/9] net: bgmac: add Northstar IPv4 TCP/UDP NAT flowtable offload Florian Fainelli
2026-11-16 22:25 ` [PATCH net-next 1/9] net: ethernet: bgmac: validate RX length against the DMA packet capacity Florian Fainelli
2026-11-16 22:25 ` [PATCH net-next 2/9] netfilter: flowtable: reject non-host IPv4 packets before lookup Florian Fainelli
2026-11-17 22:33   ` sashiko-bot
2026-11-16 22:25 ` [PATCH net-next 3/9] netfilter: flowtable: retain offload ownership until deletion completes Florian Fainelli
2026-11-17 22:33   ` sashiko-bot
2026-11-16 22:25 ` [PATCH net-next 4/9] dt-bindings: net: describe the Northstar flow accelerator Florian Fainelli
2026-11-16 22:25 ` [PATCH net-next 5/9] net: dsa: add Broadcom FA metadata and IPv4 exception paths Florian Fainelli
2026-11-17 22:33   ` sashiko-bot
2026-11-16 22:25 ` [PATCH net-next 6/9] net: flow_offload: allow drivers to validate and invalidate cached paths Florian Fainelli
2026-11-16 22:25 ` [PATCH net-next 7/9] net: bgmac: add Northstar IPv4 TCP/UDP NAT flowtable offload Florian Fainelli
2026-11-17 22:33   ` sashiko-bot
2026-11-16 22:25 ` [PATCH net-next 8/9] net: add KUnit coverage for FA and flowtable path validation Florian Fainelli
2026-11-17 22:34   ` sashiko-bot [this message]
2026-11-16 22:25 ` [PATCH net-next 9/9] docs: net: document Northstar FA setup and NAT qualification Florian Fainelli
2026-11-16 22:38 ` [PATCH net-next 0/9] net: bgmac: add Northstar IPv4 TCP/UDP NAT flowtable offload netdev-bot+sinfo
2026-11-16 22:45   ` Florian Fainelli

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-219756@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=florian.fainelli@broadcom.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