From: Stephen Hemminger <stephen@networkplumber.org>
To: Weijun Pan <wpan3636@gmail.com>
Cc: Chas Williams <3chas3@gmail.com>,
"Min Hu (Connor)" <humin29@huawei.com>,
Anatoly Burakov <anatoly.burakov@intel.com>,
dev@dpdk.org
Subject: Re: [RFC PATCH v2] net/bonding: restrict secondary control operations
Date: Mon, 24 Aug 2026 09:15:19 -0700 [thread overview]
Message-ID: <20260824091519.45ab3fd7@phoenix.local> (raw)
In-Reply-To: <20260823151625.18687-1-wpan3636@gmail.com>
On Sun, 23 Aug 2026 10:16:25 -0500
Weijun Pan <wpan3636@gmail.com> wrote:
> The bonding PMD currently supports secondary attach with safe fallback
> burst functions, but bonding configuration and LACP state are owned by
> the primary process.
>
> Use a secondary-specific dev_ops table so unsupported operations are
> rejected by ethdev before PMD callbacks can mutate shared device state.
> Also reject bonding-specific control APIs from non-primary processes,
> while keeping secondary detach and query paths available.
>
> This keeps secondary process behavior safe while leaving room for future
> limited datapath support.
>
> Bugzilla ID: 1900
>
> Signed-off-by: Weijun Pan <wpan3636@gmail.com>
> ---
More indepth AI review with Fable saw some possible issues.
Review: [RFC PATCH v2] net/bonding: restrict secondary control operations
Applies cleanly to main, builds with -Dwerror=true. The secondary
dev_ops table is a good approach; everything left in it is read-only
against shared memory, and bond_ethdev_close() already returns early
for non-primary so dev_close stays safe.
Warning: prog guide describes a secondary datapath that does not exist
"Secondary process datapath support is limited and bonding mode
specific ... unless support for the selected mode is explicitly
documented."
bond_probe() installs bond_ethdev_rx_secondary() (returns 0) and
bond_ethdev_tx_secondary() (frees and returns nb_pkts) for every
mode. There is no mode with datapath support. Say that plainly:
Rx and Tx are not supported on a bonding device in a secondary
process; receive returns no packets and transmit drops them.
Warning: LACP query paths return zeroed state in a secondary process
bond_mode_8023ad_ports[] is a plain global array, populated only in
the primary. rte_eth_bond_8023ad_member_info(), _ext_collect_get()
and _ext_distrib_get() validate against shared internals (which
pass), then read actor/partner state from the secondary's untouched
copy and return all zeros with rc 0. bond_ethdev_priv_dump(), kept
in secondary_dev_ops, prints the same zeros through dump_lacp().
Since the patch's premise is that query paths are safe in a
secondary, either give these three the same bond_8023ad_check_primary()
guard (and drop eth_dev_priv_dump from secondary_dev_ops or make
dump_lacp() skip in secondary), or document that LACP per-member
state is only visible to the primary.
Warning: rte_eth_bond_api.c: two blank lines after
bond_api_check_primary(). checkpatch will flag it.
Info: three spellings of the same test
rte_eth_bond_pmd.c already open-codes rte_eal_process_type() in
bond_ethdev_mode_set(), bond_ethdev_close(), bond_probe() and
bond_remove(). This patch adds bond_process_is_primary() plus two
near-identical logging wrappers with different return values (-1
and -ENOTSUP). The return values match each file's conventions, so
not wrong, but one helper in eth_bond_private.h taking the error
code would remove the duplication.
Info: link_update writes shared state from the secondary
bond_ethdev_link_update() assigns ethdev->data->dev_link fields
directly. Keeping it in secondary_dev_ops means a secondary calling
rte_eth_link_get() races the primary on that shared struct.
Pre-existing behaviour, but worth a thought given the patch's
"must not change device state" rule.
----------------------------------------------------------------------
Suggested commit message (the Bugzilla entry has the background;
no need to restate it):
net/bonding: restrict secondary control operations
Bonding configuration and LACP state are owned by the primary
process. Install a reduced dev_ops table in secondary processes so
ethdev rejects control operations, and reject the bonding control
API when called from a non-primary process. Query and detach remain
available.
Bugzilla ID: 1900
----------------------------------------------------------------------
Suggested release note:
* **Restricted bonding device control to the primary process.**
Secondary processes can query and detach a bonding device but can no
longer change its configuration.
next prev parent reply other threads:[~2026-08-24 16:15 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 17:42 [RFC PATCH] net/bonding: reject control operations in secondary Weijun Pan
2026-07-22 23:10 ` Stephen Hemminger
2026-07-26 17:32 ` Stephen Hemminger
2026-08-23 15:16 ` [RFC PATCH v2] net/bonding: restrict secondary control operations Weijun Pan
2026-08-23 15:43 ` Stephen Hemminger
2026-08-24 2:39 ` Weijun Pan
2026-08-24 16:15 ` Stephen Hemminger [this message]
2026-08-26 16:10 ` [RFC PATCH v3] " Weijun Pan
2026-08-26 17:53 ` Stephen Hemminger
2026-08-30 1:14 ` [RFC PATCH v4 1/2] net/bonding: skip unavailable member stats Weijun Pan
2026-08-30 1:14 ` [RFC PATCH v4 2/2] net/bonding: restrict secondary control operations Weijun Pan
2026-08-30 4:29 ` Stephen Hemminger
2026-08-30 4:22 ` [RFC PATCH v4 1/2] net/bonding: skip unavailable member stats Stephen Hemminger
2026-08-30 16:35 ` [RFC PATCH v5 " Weijun Pan
2026-08-30 16:35 ` [RFC PATCH v5 2/2] net/bonding: restrict secondary control operations Weijun Pan
2026-08-30 20:23 ` [PATCH 0/8] net/bonding: fixes and per-member statistics Stephen Hemminger
2026-08-30 20:23 ` [PATCH 1/8] net/bonding: fix TLB member ordering with unusable member Stephen Hemminger
2026-08-30 20:23 ` [PATCH 2/8] net/bonding: skip unavailable member stats Stephen Hemminger
2026-08-30 20:23 ` [PATCH 3/8] net/bonding: skip unavailable members in device info Stephen Hemminger
2026-08-30 20:23 ` [PATCH 4/8] net/bonding: use atomic link status accessors Stephen Hemminger
2026-08-30 20:23 ` [PATCH 5/8] net/bonding: restrict control operations in secondary process Stephen Hemminger
2026-08-30 20:23 ` [PATCH 6/8] net/bonding: add extended statistics Stephen Hemminger
2026-08-30 20:23 ` [PATCH 7/8] test/bonding: add extended statistics test Stephen Hemminger
2026-08-30 20:23 ` [PATCH 8/8] doc: add bonding features matrix Stephen Hemminger
2026-08-31 16:06 ` [PATCH v2 0/8] net/bonding: fixes and per-member stats Stephen Hemminger
2026-08-31 16:06 ` [PATCH v2 1/8] net/bonding: fix TLB member ordering with unusable member Stephen Hemminger
2026-08-31 16:06 ` [PATCH v2 2/8] net/bonding: skip unavailable member stats Stephen Hemminger
2026-08-31 16:06 ` [PATCH v2 3/8] net/bonding: skip unavailable members in device info Stephen Hemminger
2026-08-31 16:06 ` [PATCH v2 4/8] net/bonding: use atomic link status accessors Stephen Hemminger
2026-08-31 16:06 ` [PATCH v2 5/8] net/bonding: restrict control ops in secondary process Stephen Hemminger
2026-08-31 16:06 ` [PATCH v2 6/8] net/bonding: add extended statistics Stephen Hemminger
2026-08-31 16:06 ` [PATCH v2 7/8] test/bonding: add extended statistics test Stephen Hemminger
2026-08-31 16:06 ` [PATCH v2 8/8] doc: add bonding features matrix 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=20260824091519.45ab3fd7@phoenix.local \
--to=stephen@networkplumber.org \
--cc=3chas3@gmail.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=humin29@huawei.com \
--cc=wpan3636@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.