From nobody Fri Apr 3 19:10:26 2026 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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 9692A30E0EF for ; Mon, 23 Mar 2026 18:39:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774291155; cv=none; b=bxtTwZz/8D7rumdd5l8HKqzYlm13dDpTk/d+EpPcRUc6KSNYQ25bfQ08WidV2Q4LWb+SO5L/z6sznYmMlYAqz00uhDboCN6OToLfD5tZK3PAsseechQ+j5kQZJXa+WtNko1chgPBaDTCOXrQwuNLZRVHzZGIu7IP7zPUMf/K/sc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774291155; c=relaxed/simple; bh=893kAeGclOk4fSk78cvUgba6Sya5sswIG+0f/z9UDDY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C5eJf/D3YHnRUW5LiCEBxghHvjobDq/56KZ7Uy8OPATV4p/JxKulrkQCci2n9sW5zUoZLa42MtA7rvpKd0mEqq48AsdRVDjKUpv8n90zcTUh8E17D+hYMFoIuD4s1g73KdkVuG8Awi0Y4vARGJS0Gtq6VczFaGFz2zy+cJ8ennE= 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=Y0WysUY9; arc=none smtp.client-ip=209.85.216.49 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="Y0WysUY9" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-35a288a2c00so241648a91.2 for ; Mon, 23 Mar 2026 11:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20230601.gappssmtp.com; s=20230601; t=1774291151; x=1774895951; 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=wEdEGPSrIUj5fWAalmJxUK7ZuzZ9BH5SshMhMwYuV3c=; b=Y0WysUY9qtnZJ0PpTDzoQGKK4VN4Mk7Bk/f/94OQfJHkHVNC2z9cLtr+ChJzvUIV22 Y3mSJBWU0ATdXQ4QGbaBibJ8U5Q4UIj99vcY5lMLq5C1/sLYiSN31lLS3foxCRiFgm05 L0JDo5DTfV30Vp5sXe9vwePjMDNoPVNeqO6PBQrK7NzlwhWWfVEuvKbgCipTNtZruyHj 8y9IMtkf8QUf+EVW+zqhjLKbY6J7L9a6cTtfTrKNtbzKL7TXctoGVr/12I33Wy4+Lrem BvKA7pvQ3AwJX8bZjbqEegmuJFusjd+cvRIehhRyRjrmHm1yii09uMK9HDVKfGKVJ7m0 5aAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774291151; x=1774895951; 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=wEdEGPSrIUj5fWAalmJxUK7ZuzZ9BH5SshMhMwYuV3c=; b=fWrIRv09hA6reYRfQ8tWr5TPqH1wbNIi70nQ+efBG18bSWjWGN/C/5Axg96/qa0H8K cvDgpmIPibf2xIAslbxiEQu5p+z1Z+n3ZfALgLcqpgU9pJis5G/rYQt4lStVqm2Kzxto b0XAwgdaB29YupY4ikeZG7G1guNtiQhpS91MGYLbiQUCWFW0r7lsUyPpneVeEcuNvySE afbgzQFDqRb9Lhq2IHxznmEj41lFqxFwLnfg8lLLy2fMoChBlPG7F/GRQWY/v69urtAZ 1fOujq2X9sVW1RbwESgwYz4nZFVvyLKj0YIXz5yiVqGw42q/GrBKjCaiu15VMTf0mqIP 5ylQ== X-Forwarded-Encrypted: i=1; AJvYcCWZ89q6sWkGjRwEbj6+SKBjv1V5MZUyMdTWi+5m/u6iWyEsUFNZLu6OqeQ3hC9FeYSSre4MSxtTh14WMhw=@vger.kernel.org X-Gm-Message-State: AOJu0Yz22dJjoX7ESj+bkmFQPmVtqI1b8RD9AaNUVq8bOmC0lKtLpXpq 3Xr8rWdkyWZtV5LE3Vmdhkx66XnouK+Gys/tU2HUB+YwaEOV/IbI9JyHyEdTbftV4mI= X-Gm-Gg: ATEYQzxVX209aGWVL4AI5jJh9LbTOn5oxkZivafZn7u9PZ31ZAsBcDWA1Hx/X6meb6J f2zRxDvdvhx2iW7JXoJLJ9tH1i/hiSLhO1i7yWKSKoONn96X0Kblq6n4tndX8TfHOC98Pl4FSFu AXB0fuHLlffFKCaVv+QXNZMrrjvOwYAoTEW4vdPx5bgQDCtgmpWNYw8wnOXu2khPxkSzarMKJ8w 9XkyeloKspqTIlj2HsKPKpZKYN7Ki7ihhxjgnY/cIv4dLKNORgLu4igoxMqnNgFCMOaD9h9d3jt Ew2V82AqIIqBbplSDW+eQ77P6M+xSSXpZDTK2CLAGqLbEh7kUX3zMNANeygZ/qIjYX4YKkF+YW2 lTkw71si5ppi65gSbUa+kxORhXKPpNuI+3oD76zDK9pfasvABNx3OFrZ8BcgISXktAWMuboARek AUS4c= X-Received: by 2002:a17:90a:517:b0:35b:e4f8:55ab with SMTP id 98e67ed59e1d1-35be4f87ae4mr4169478a91.6.1774291150605; Mon, 23 Mar 2026 11:39:10 -0700 (PDT) Received: from localhost ([2a03:2880:2ff:1::]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35bd410e7b8sm9717171a91.14.2026.03.23.11.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2026 11:39:10 -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 v5 06/12] net: bnxt: Add TX inline buffer infrastructure Date: Mon, 23 Mar 2026 11:38:31 -0700 Message-ID: <20260323183844.3146982-7-joe@dama.to> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260323183844.3146982-1-joe@dama.to> References: <20260323183844.3146982-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 Reviewed-by: Pavan Chebbi Signed-off-by: Joe Damato --- v5: - Added Pavan's Reviewed-by. No functional changes. 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 fe15b32b12e7..2759a4e2b148 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -3985,6 +3985,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; @@ -4003,6 +4036,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 a6b04652600e..751dbc055fdd 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