From nobody Mon Apr 6 18:29:07 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 7941F3F0764 for ; Wed, 18 Mar 2026 19:13:46 +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=1773861229; cv=none; b=tURObSYAQQP8NzrKDMYcFH6QvuqLm91DsVZBUMBGOGQnjrXs0J95UoX+UZ7dXXo3dVXPRs16ljxhRZb7i3vKFvOk9hka+dg9GcTyqinbsRcMH8oEL+sDg+wOHjU9CidwlFVmx3m0+chn4MJxpvFKW9WZPF6E5j0YbZf2clJXvFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773861229; c=relaxed/simple; bh=7Zu0Dz91B8pcyek/pNRIrZNMIcp1uoJ9XU9YtqJIP40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iHsPcZtL7MQ0CBKQtHAI9B0bA3bRLrHBvQUPvVt1VH8EQH1WEwiXp67Dq361UVneFWtRkJ1lTMa3ZBPyJrKSL3kfoUDqUSejuhEDO7Ssn3ZhzZJxQ5EKzl/8i/bkIaE5+7QqiUNyjN3QsABC8HLb4h/3k01P6k1HvM8uv2V5MeU= 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=NCH4DYky; 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="NCH4DYky" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-82987437624so116351b3a.1 for ; Wed, 18 Mar 2026 12:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20230601.gappssmtp.com; s=20230601; t=1773861226; x=1774466026; 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=NCH4DYkyBX58Kx7hUMDoFO5B+DtXuTiIYKM2nPQ0i7jQd2ZYCBg5CborI3YA5GGHyi WgxDPt6Ull5T4DUsZSb5OlO2ErFt+LDiT1frUsa+m0jKgbgPXEBMlxJd/PMYaBHzv4ub Z5dETOZDB8YJs99/Y+2NWQV5WsILBBqXC/hhUBeqpHAioc1KyMMWNH7uotZvF7hoeruX 8MiFzOrC27E8p+uJLOmkrx82trTXnmU3caOge/uDYuPi9gk8l7icnF5X2QksoxNO/JeN Y6qsobjmCeTPeBw7Gw9mfg4uPZBtcP9AUcmJL5fuQjQuWRN8tcFF+QacfgMLBE20MTVl tqsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773861226; x=1774466026; 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=rZYLHZhiKF7C6FMvTIMtTp7sMwbzxVxnCB8Bpu4cz1dZx+h1IfHbiPt4RDFM076Q/q aeFhjP2m1CTy3xt5/HS5JyfaVLCyat7Ydcj3d5cJcBWW13r8rBEiT6ar54EwFkRfFzPj ahHKwVrPDfM4NyivkpX++VcEgrDDtMXyIHrHm548oGT/ZD1KaFJJtU9nsOAB9vN52FZw A3IrAwyAevNjtFtBuqR81AWS6jNODWuYd7w888r8k9dbaDkqSFtDoR9IIOmoZKevF5Oo gN3vl9UUFNxUB18kFuBF9V6b8V2BLPhzpl2PTkcKciMUORRR6l5qNYlXwhnjjqJtFmvR S6hw== X-Forwarded-Encrypted: i=1; AJvYcCXrz7RLO7ZuaST0m3rjm/R51jAV01oLunmHE2buflnd+xgx5LZl4YuPI9nhNL474GNLQn66TnHy37oGDkc=@vger.kernel.org X-Gm-Message-State: AOJu0Ywc9JrLUIYbaVDccESKB4MXxyh/T16tnkvRP0ChLW9feBHnyF0f /iovicfa2LHd2Fk3KsYgT7Ig8Arwr1u89YQYtja8aC+1xQ+O9Mo4ZQ+vPXQJZGuZBKo= X-Gm-Gg: ATEYQzye7o2Z0w9tmcCpxnmm4lE+ISRLFu4jJJNF8H+7vj53jHwTPl80soJ+UL/DK8t erZbqR0McLzJLI26L6C6vw3yDasiiwL9kMtVeUCZp7c6WsZl5TyJkWt9lCCdcWyy+p/1QxS614S 0+yGmobS74MO7XAe3yVtutE1HwgyK+r7WY/iVtUTbmxrYRy3BjXzuYtusgg2MEiSSZWA46JOhLq yZx7A/7wIHcWYjXn4d4s9xRDvfX/ybd0pP065e24sFPnR/CM1xb+nAPlsJzon60aqoEvG4SIpZk bOXpnA7scZ56VZxW1Al6pe8Ipz11qL220OKhzfYjtMhC597v0xpmPVsfSpE2giPdtRQ36dpj7Ke xrf57JvYCKKJObafKvGeTy9un57T9rFEGMGQn9wHR5qc6m7zvR6653sZw+UBSBqmCqISBKwajtQ 2wEO0= X-Received: by 2002:aa7:9d89:0:b0:829:b23b:d150 with SMTP id d2e1a72fcca58-82a7a8eb3c8mr318691b3a.20.1773861225619; Wed, 18 Mar 2026 12:13:45 -0700 (PDT) Received: from localhost ([2a03:2880:2ff:2::]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82a6af06bd7sm3550133b3a.0.2026.03.18.12.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 12:13:45 -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 v3 06/12] net: bnxt: Add TX inline buffer infrastructure Date: Wed, 18 Mar 2026 12:13:11 -0700 Message-ID: <20260318191325.1819881-7-joe@dama.to> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260318191325.1819881-1-joe@dama.to> References: <20260318191325.1819881-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 --- 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