Re: [PATCH net-next v6 10/15] bnxt_en: Add MPC transmit and completion functions

Michael Chan <[email protected]>
Newsgroups org.kernel.vger.netdev
Message-ID <CACKFLin4ciJf5G5tkCfoauEb6wMMU90hOFu=9H6dxgWMx8ykWQ@mail.gmail.com>
Responding to some Sashiko comments:
https://sashiko.dev/#/patchset/20260810051358.1244418-1-michael.chan%40broadcom.com

On Sun, Aug 9, 2026 at 10:15 PM Michael Chan <[email protected]> wrote:
> +int bnxt_start_xmit_mpc(struct bnxt *bp, struct bnxt_tx_ring_info *txr,
> +                       void *data, unsigned int len, unsigned long handle)
> +{
(prod);
> +       if (bd_space < bds) {
> +               unsigned int len0 = bd_space * sizeof(*txbd);
> +
> +               memcpy(txbd, data, len0);
> +               prod += bd_space;
> +               txbd = &txr->tx_desc_ring[TX_RING(bp, prod)][TX_IDX(prod)];
> +               bds -= bd_space;
> +               len -= len0;
> +               data += len0;
> +       }
> +       memcpy(txbd, data, len);
Sashiko:
Does this code adequately bounds-check the remaining length when it exceeds
the size of a single descriptor page?
If the provided length is large enough to span more than two pages...

Response:
Yes, the largest MPC command is the ce_add_cmd and the size is about
72 bytes.  It will not span more than 2 pages.

> +int bnxt_mpc_cmp(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, u32 *raw_cons)
> +{

> +               tx_cons = txr->tx_cons;
> +               if (TX_OPAQUE_RING(opaque) != txr->tx_napi_idx) {
> +                       netdev_warn(bp->dev, "Wrong opaque %x, expected ring %x, cons idx %x\n",
> +                                   opaque, txr->tx_napi_idx, txr->tx_cons);
> +                       goto cmp_done;
> +               }
> +               mpc_buf = &txr->tx_mpc_buf_ring[RING_TX(bp, tx_cons)];
> +               mpc_buf->handle = 0;
> +               tx_cons += mpc_buf->inline_bds;
Sashiko:
The docstring for bnxt_start_xmit_mpc() states that bnxt_crypto_mpc_cmp()
will be called with the handle passed back upon successful hardware
completion.
However, mpc_buf->handle is cleared here,...

Response:
The changes are staged. The next patch #11 will hook this up and call
bnxt_crypto_mpc_cmp() with the handle passed back.
smime.p7s (application/pkcs7-signature, 5.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.