All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Siva Reddy Kallam" <siva.kallam@broadcom.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [RDMA v2 05/13] RDMA/bng_re: Add GID verbs
Date: Sat, 05 Dec 2026 16:10:08 +0000	[thread overview]
Message-ID: <sashiko-outbox-251729@kernel.org> (raw)
In-Reply-To: <20261204155249.1002019-6-siva.kallam@broadcom.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] RDMA/bng_re: bng_sp_add_sgid() ignores source MAC during SGID
  deduplication
- [Medium] RDMA/bng_re: bng_sp_del_sgid() leaves
  cmdq_delete_gid.host_gid_index unset
--

commit e8609d412a7d5ef6891fa0552518f46fa0e772cb
Author: Sachin Holla <sachin.holla@broadcom.com>

RDMA/bng_re: Add GID verbs

This commit adds the bng_re_add_gid and bng_re_del_gid verbs along with
SGID table allocation, cleanup, and firmware ADD_GID/DELETE_GID helpers.

> diff --git a/drivers/infiniband/hw/bng_re/bng_sp.c b/drivers/infiniband/hw/bng_re/bng_sp.c
> index 622cba5e4927e..83921f23a4230 100644
> --- a/drivers/infiniband/hw/bng_re/bng_sp.c
> +++ b/drivers/infiniband/hw/bng_re/bng_sp.c

[ ... ]

> +int bng_sp_add_sgid(struct bng_re_sgid_tbl *sgid_tbl,
> +		    struct bng_re_gid *gid, const u8 *smac, u16 vlan_id,
> +		    bool update, u32 *index, bool is_ugid, u32 stats_ctx_id)
> +{
> +	struct bng_re_res *res = to_bng_re_res(sgid_tbl, sgid_tbl);
> +	struct bng_re_dev *rdev = to_bng_re_dev(res, bng_res);
> +	int i, free_idx;
> +
> +	free_idx = sgid_tbl->max;
> +	for (i = 0; i < sgid_tbl->max; i++) {
> +		if (!memcmp(&sgid_tbl->tbl[i].gid, gid, sizeof(*gid)) &&
> +		    sgid_tbl->tbl[i].vlan_id == vlan_id) {
> +			dev_dbg(&res->pdev->dev,
> +				"SGID entry already exist in entry %d!\n",
> +				i);
> +			*index = i;
> +			return -EALREADY;
> +		}

[Severity: Medium]
Should bng_sp_add_sgid() also compare smac before returning -EALREADY?

struct bng_re_gid_info only stores gid and vlan_id, even though
bng_sp_add_sgid() programs smac into req.src_mac in the firmware ADD_GID
command.  When bng_re_add_gid() gets -EALREADY, it increments refcnt and
shares the existing slot without checking the MAC address.

Because ib_core allows distinct GID entries per netdev (such as macvlan
upper devices on the same port), two interfaces with different MAC
addresses configured with the same IP and VLAN ID will alias onto the
same hardware GID slot.

The second interface then sends RoCE traffic with the first interface's
source MAC, breaking L2 connectivity and MAC isolation.  Storing smac in
struct bng_re_gid_info and comparing it here avoids the aliasing.

[ ... ]

> +int bng_sp_del_sgid(struct bng_re_sgid_tbl *sgid_tbl, u32 index, bool update)

[ ... ]

> +		bng_re_rcfw_cmd_prep((struct cmdq_base *)&req,
> +				     CMDQ_BASE_OPCODE_DELETE_GID, sizeof(req));
> +		req.gid_index = cpu_to_le16(hw_id);
> +		bng_re_fill_cmdqmsg(&msg, &req, &resp, NULL,
> +				    sizeof(req), sizeof(resp), 0);

[Severity: Medium]
Does bng_sp_del_sgid() also need to set req.host_gid_index to
cpu_to_le16(index)?

struct cmdq_delete_gid defines host_gid_index alongside gid_index, and
bng_sp_add_sgid() populates req.host_gid_index = cpu_to_le16(free_idx).
Leaving req.host_gid_index as 0 on every DELETE_GID command creates an
asymmetry whenever a non-zero SGID slot is deleted.

If firmware validates or tracks host_gid_index during deletion, removing
non-zero entries will fail and leak firmware GIDs, or corrupt host-index
tracking for slot 0.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204155249.1002019-1-siva.kallam@broadcom.com?part=5

  reply	other threads:[~2026-12-05 16:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 15:47 [RDMA v2 00/13] Add BNG_RE control path verbs Siva Reddy Kallam
2026-12-04 15:47 ` [RDMA v2 01/13] bnge: Keep the RoCE MSI-X minimum for the MPC vector Siva Reddy Kallam
2026-12-04 15:47 ` [RDMA v2 02/13] RDMA/bng_re: Add MPC, XID management, doorbell infrastructure Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 03/13] RDMA/bng_re: Add support verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 04/13] RDMA/bng_re: Add ucontext/mmap verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 05/13] RDMA/bng_re: Add GID verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot [this message]
2026-12-04 15:47 ` [RDMA v2 06/13] RDMA/bng_re: Add PD verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:47 ` [RDMA v2 07/13] RDMA/bng_re: Add MR verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 08/13] RDMA/bng_re: Add CQ verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 09/13] RDMA/bng_re: Add SRQ verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 10/13] RDMA/bng_re: Add Stats verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 11/13] RDMA/bng_re: Add AH verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 12/13] RDMA/bng_re: Add QP verbs Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-04 15:48 ` [RDMA v2 13/13] RDMA/bng_re: Register with ib-core Siva Reddy Kallam
2026-12-05 16:10   ` sashiko-bot
2026-12-05 16:10 ` [RDMA v2 00/13] Add BNG_RE control path verbs sashiko-bot

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-251729@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=siva.kallam@broadcom.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.