From nobody Mon Apr 6 10:43:35 2026 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01FBF3C945D for ; Fri, 20 Mar 2026 14:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774017723; cv=none; b=PN2QQAUn6m3/QkjtIE1YWYoW+KB48VQABm04o/EaBgvZ2HgUejCuS+RC28g5KmlWMl4uMw+onzb4323qUSKgJWylInRM+SiBwgVe4kknXB2JLYg+IQ1eJXSVWZA3h5T0LDgl+nY+qASj4eL4LcXKa0qLVC4ysx4ShD7nP/NyhLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774017723; c=relaxed/simple; bh=7Zu0Dz91B8pcyek/pNRIrZNMIcp1uoJ9XU9YtqJIP40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z8YG3I83omGYKSgv1Rqhe2laMVWUnolmR6iF7I0h+qEZ6XSgJ0kKKdV3XHa/ckxFHvpU+CHECgu7JEqocviu8hWm35pVTMSgWprfzc2ISTKbEub0eH/ztbjHyc+01FqldBn2Wn8GQ/sAcERHbfgbq7Y73jaU9r5znDeK60mklO4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to; spf=none smtp.mailfrom=dama.to; dkim=pass (2048-bit key) header.d=dama-to.20230601.gappssmtp.com header.i=@dama-to.20230601.gappssmtp.com header.b=WFZC5c9I; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dama.to Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=dama.to Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dama-to.20230601.gappssmtp.com header.i=@dama-to.20230601.gappssmtp.com header.b="WFZC5c9I" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-824c9da9928so1969659b3a.3 for ; Fri, 20 Mar 2026 07:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20230601.gappssmtp.com; s=20230601; t=1774017721; x=1774622521; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SXOL9iubHrTOR9uFk5hJvutezBCpUTAEEHozBYZRA8g=; b=WFZC5c9IH0Y8WxULW0z10sbs8RMkQSKfw5A5HSeiE7ebA1EtYHFlkM88NjC80rKo5M 1Rbt8uZk7AhXMOCBEjVKrnsMN5113XHtKOIfQpvFfwIBRtyjISoPNlV2XClbzFWWOK3/ uLU7XaqN2RnQNOS/CK+2KycfR6VfoZU5RKWz7PHekdjLzY/rVVWPMBhL48wzQ5MTgrw4 EhFgLN/j+Knl9bjJIgo/z05jqOo6ESQ36YSNmNIVg/j4cOiEnv3S0vaTRpqJMgEd0/jS NNJSeY+x+Rzp4eaj6E4YrMadhNZuk8NBcgcPCs94YQPZERGkQ8A8X7pyIB5aGA9/IgQs JVOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774017721; x=1774622521; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SXOL9iubHrTOR9uFk5hJvutezBCpUTAEEHozBYZRA8g=; b=jUuAxg86LOKuVpGNAP0x7TrvLLLA5nxWgLyZr0CWtnJmUP5NAA5g4KxCG+ZAqGTvpd YqyAcr6fOwbCrxOLhuuDFXYqU4Y16CEJTkZqnjfuU8dqBOPn18nCpN5iH4yrJRXMxmDw UjVM0OVjZfhqZ92J/Ziz+MNf2ZSW836V6s7IuMMr4hL1qyY3ey8GUAeFrsAnppaw3BF+ RHFoMRTkMAfBdTE7rQa5O5iufq+LFAk0Sr/vSGPmpiOQVenSj7NledmCwZuSPpQUYOw+ lCQvvN7bqg/45Z55u9T3Npf7rNA9eJm35XvYCQGaOEdn2oBSyd506DysTYum5+FVZWai a8ig== X-Forwarded-Encrypted: i=1; AJvYcCWskNW9hzA0lAX0IzCv19y7DKWrkx7Gn6W0Wzyu0MF4PIsMS5IPfeAqgT71fng4h01A5b0mqLbmidJvw8E=@vger.kernel.org X-Gm-Message-State: AOJu0YyWGSwIs5T799mqXBsVcC4BXTMyZha0Knbl5i6Zg27jRpr7pR2q PPurKAcfyZFNuqG5Mi7EO85lPtKpwFJ200AOapcwUjVX8uMw6jh0DhQoaqOF3KRnaN8= X-Gm-Gg: ATEYQzwFxYX+wIJbiKVbLBsX7fVGTn+XekyNX9owXDrlEmUdeSgwBcoocAhqA2/H9gn UuspKsapbSRlTztzTA19YJbuNn4NA0LbvMklqROrWjR6uv+f9tcBNhAR8baVvYjfJynSZ2Kefkq aGNjFuxtizP6DiAj2RTop6XAYVa8RHZ6WPIERZO8a31AHlqcUsy81LO93wj4V9dGgS2RxbF0itg ccIBz76reKKZjMoa2t0KKuefLBsKdpNLmJzuVV78LlPgTPpZeFpPGZMxbKQmWjHW3w0LTgoB5yN ekAQn/mBRTWoOksEmlk3+7e20zLxsECwaZwboBGvF6kNRnySCS7gPhbtn4zw8FVtEOp5TlGkM/p 6qZmydvPNJwb91LWrWFohX4NWproJ2iSmxc+SDwYSbAY5kE6E2xWsbWrEwIgb6WeRfHPaAHyR9x wUtZI= X-Received: by 2002:a05:6a00:299b:b0:82a:f02:7355 with SMTP id d2e1a72fcca58-82a8c35c866mr2564897b3a.32.1774017721399; Fri, 20 Mar 2026 07:42:01 -0700 (PDT) Received: from localhost ([2a03:2880:2ff:4::]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82b03aa9619sm2261657b3a.6.2026.03.20.07.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 07:42:01 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org, Michael Chan , Pavan Chebbi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: horms@kernel.org, linux-kernel@vger.kernel.org, leon@kernel.org, Joe Damato Subject: [net-next v4 06/12] net: bnxt: Add TX inline buffer infrastructure Date: Fri, 20 Mar 2026 07:41:27 -0700 Message-ID: <20260320144141.260246-7-joe@dama.to> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260320144141.260246-1-joe@dama.to> References: <20260320144141.260246-1-joe@dama.to> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add per-ring pre-allocated inline buffer fields (tx_inline_buf, tx_inline_dma, tx_inline_size) to bnxt_tx_ring_info and helpers to allocate and free them. A producer and consumer (tx_inline_prod, tx_inline_cons) are added to track which slot(s) of the inline buffer are in-use. The inline buffer will be used by the SW USO path for pre-allocated, pre-DMA-mapped per-segment header copies. In the future, this could be extended to support TX copybreak. Allocation helper is marked __maybe_unused in this commit because it will be wired in later. Suggested-by: Jakub Kicinski Signed-off-by: Joe Damato Reviewed-by: Pavan Chebbi --- rfcv2: - Added a producer and consumer to correctly track the in use header slo= ts. drivers/net/ethernet/broadcom/bnxt/bnxt.c | 35 +++++++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 6 ++++ 2 files changed, 41 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethern= et/broadcom/bnxt/bnxt.c index ea8081aeb5ae..8929264a54b1 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -3983,6 +3983,39 @@ static int bnxt_alloc_rx_rings(struct bnxt *bp) return rc; } =20 +static void bnxt_free_tx_inline_buf(struct bnxt_tx_ring_info *txr, + struct pci_dev *pdev) +{ + if (!txr->tx_inline_buf) + return; + + dma_unmap_single(&pdev->dev, txr->tx_inline_dma, + txr->tx_inline_size, DMA_TO_DEVICE); + kfree(txr->tx_inline_buf); + txr->tx_inline_buf =3D NULL; + txr->tx_inline_size =3D 0; +} + +static int __maybe_unused bnxt_alloc_tx_inline_buf(struct bnxt_tx_ring_inf= o *txr, + struct pci_dev *pdev, + unsigned int size) +{ + txr->tx_inline_buf =3D kmalloc(size, GFP_KERNEL); + if (!txr->tx_inline_buf) + return -ENOMEM; + + txr->tx_inline_dma =3D dma_map_single(&pdev->dev, txr->tx_inline_buf, + size, DMA_TO_DEVICE); + if (dma_mapping_error(&pdev->dev, txr->tx_inline_dma)) { + kfree(txr->tx_inline_buf); + txr->tx_inline_buf =3D NULL; + return -ENOMEM; + } + txr->tx_inline_size =3D size; + + return 0; +} + static void bnxt_free_tx_rings(struct bnxt *bp) { int i; @@ -4001,6 +4034,8 @@ static void bnxt_free_tx_rings(struct bnxt *bp) txr->tx_push =3D NULL; } =20 + bnxt_free_tx_inline_buf(txr, pdev); + ring =3D &txr->tx_ring_struct; =20 bnxt_free_ring(bp, &ring->ring_mem); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethern= et/broadcom/bnxt/bnxt.h index a822bbb71146..d9543d6048d8 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -994,6 +994,12 @@ struct bnxt_tx_ring_info { dma_addr_t tx_push_mapping; __le64 data_mapping; =20 + void *tx_inline_buf; + dma_addr_t tx_inline_dma; + unsigned int tx_inline_size; + u16 tx_inline_prod; + u16 tx_inline_cons; + #define BNXT_DEV_STATE_CLOSING 0x1 u32 dev_state; =20 --=20 2.52.0