On Sat, Oct 17, 2026 at 9:49 PM Alexander Goodkind <[email protected]> wrote:
> 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: [email protected]
>
> Signed-off-by: Alexander Goodkind <[email protected]>
> ---
>
> 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 <[email protected]>
> Alexander Bechikov <[email protected]>
> Alexander Belyakov <[email protected]>
> Alexander Chernavin <[email protected]>
> +Alexander Goodkind <[email protected]>
> Alexander Guy <[email protected]>
> Alexander Kozyrev <[email protected]> <[email protected]>
> Alexander Matushevsky <[email protected]>
> 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
> --
Acked-by: Kishore Padmanabha <[email protected]>
>
> 2.54.0 (Apple Git-157)
>
smime.p7s
Description: S/MIME Cryptographic Signature

