From: Alexander Goodkind <alex@goodkind.io>
To: kishore.padmanabha@broadcom.com, ajit.khaparde@broadcom.com
Cc: dev@dpdk.org, stable@dpdk.org, thomas@monjalon.net, tarick@bedeir.com
Subject: [PATCH v2] net/bnxt: fix aliasing in firmware command writes
Date: Sat, 17 Oct 2026 19:29:29 -0700 [thread overview]
Message-ID: <20261018022929.91865-1-alex@goodkind.io> (raw)
In-Reply-To: <CAAbO5hbOnKdeD78Q6BHLSA-dD9Vzo004Myr_74_yK4as=bb6UA@mail.gmail.com>
Use memcpy to copy each firmware command word into a local uint32_t
before writing it to the card. Replace the uint32_t pointer reads in
bnxt_hwrm_send_message() with byte access.
Fixes: 1cd45aeb3270 ("net/bnxt: support Stratus VF device")
Cc: stable@dpdk.org
Signed-off-by: Alexander Goodkind <alex@goodkind.io>
---
v2: The previous patch got corrupted during email delivery.
VPP could not initialize the interfaces on my PowerEdge XR11 with a
Broadcom BCM57504 card, using SR-IOV virtual functions inside an Ubuntu
LXC container on Proxmox. The debugger showed an empty command header
immediately before the driver wrote it to the card.
The original pointer reads violate GCC's strict-aliasing rule [1].
The patched driver initialized the interfaces and transferred packets
with DPDK 26.03.0 and VPP 26.06-release. Separate build and software
tests passed against the current Broadcom source.
[1] https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
.mailmap | 1 +
drivers/net/bnxt/bnxt_hwrm.c | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/.mailmap b/.mailmap
index 5d1df79860..3143e642b5 100644
--- a/.mailmap
+++ b/.mailmap
@@ -65,6 +65,7 @@ Alex Zelezniak <alexz@att.com>
Alexander Bechikov <asb.tyum@gmail.com>
Alexander Belyakov <abelyako@gmail.com>
Alexander Chernavin <achernavin@netgate.com>
+Alexander Goodkind <alex@goodkind.io>
Alexander Guy <alexander@andern.org>
Alexander Kozyrev <akozyrev@nvidia.com> <akozyrev@mellanox.com>
Alexander Matushevsky <matua@amazon.com>
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index ab1521953a..573a33b2de 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -483,7 +483,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
unsigned int i;
struct input *req = msg;
struct output *resp = bp->hwrm_cmd_resp_addr;
- uint32_t *data = msg;
+ const uint8_t *data = msg;
uint8_t *bar;
uint8_t *valid;
uint16_t max_req_len = bp->max_req_len;
@@ -526,7 +526,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
short_input.req_addr =
rte_cpu_to_le_64(bp->hwrm_short_cmd_req_dma_addr);
- data = (uint32_t *)&short_input;
+ data = (const uint8_t *)&short_input;
msg_len = sizeof(short_input);
max_req_len = BNXT_HWRM_SHORT_REQ_LEN;
@@ -534,9 +534,12 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
/* Write request msg to hwrm channel */
for (i = 0; i < msg_len; i += 4) {
+ uint32_t request_word;
+
bar = (uint8_t *)bp->bar0 + bar_offset + i;
- rte_write32(*data, bar);
- data++;
+ memcpy(&request_word, data, sizeof(request_word));
+ rte_write32(request_word, bar);
+ data += sizeof(request_word);
}
/* Zero the rest of the request space */
base-commit: af80aca47b05d46f4a5e1951de3ce8372bd726b6
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-10-18 2:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 1:49 [PATCH] net/bnxt: fix aliasing in firmware command writes Alexander Goodkind
2026-10-18 2:29 ` Alexander Goodkind [this message]
[not found] ` <20261018024910.5D1706051830@postal.iol.unh.edu>
2026-10-18 3:02 ` |WARNING| [v2] " Alexander Goodkind
2026-10-19 11:32 ` Thomas Monjalon
2026-10-19 22:05 ` [PATCH] " Kishore Padmanabha
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=20261018022929.91865-1-alex@goodkind.io \
--to=alex@goodkind.io \
--cc=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=kishore.padmanabha@broadcom.com \
--cc=stable@dpdk.org \
--cc=tarick@bedeir.com \
--cc=thomas@monjalon.net \
/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