Re: [PATCH net-next v6 10/15] bnxt_en: Add MPC transmit and completion functions
From: Michael Chan <michael.chan@broadcom.com>
Date: 2026-08-12 07:06:20
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 [off-list ref] 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.
Attachments
- smime.p7s [application/pkcs7-signature] 5469 bytes