From: Joe Damato <joe@dama.to>
To: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>
Cc: michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
linux-kernel@vger.kernel.org, Joe Damato <joe@dama.to>
Subject: [RFC net-next v2 01/12] net: tso: Introduce tso_dma_map
Date: Thu, 12 Mar 2026 15:34:38 -0700 [thread overview]
Message-ID: <20260312223457.1999489-2-joe@dama.to> (raw)
In-Reply-To: <20260312223457.1999489-1-joe@dama.to>
Add struct tso_dma_map to tso.h for tracking DMA addresses of mapped
GSO payload data.
The struct combines DMA mapping storage (linear_dma, frags[]) with
iterator state (frag_idx, offset), allowing drivers to walk pre-mapped
DMA regions linearly. Helpers to initialize and operate on this struct
will be added in the next commit.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Joe Damato <joe@dama.to>
---
include/net/tso.h | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/include/net/tso.h b/include/net/tso.h
index e7e157ae0526..cd4b98dbea71 100644
--- a/include/net/tso.h
+++ b/include/net/tso.h
@@ -3,6 +3,7 @@
#define _TSO_H
#include <linux/skbuff.h>
+#include <linux/dma-mapping.h>
#include <net/ip.h>
#define TSO_HEADER_SIZE 256
@@ -28,4 +29,37 @@ void tso_build_hdr(const struct sk_buff *skb, char *hdr, struct tso_t *tso,
void tso_build_data(const struct sk_buff *skb, struct tso_t *tso, int size);
int tso_start(struct sk_buff *skb, struct tso_t *tso);
+/**
+ * struct tso_dma_map - DMA mapping state for GSO payload
+ * @dev: device used for DMA mapping
+ * @skb: the GSO skb being mapped
+ * @hdr_len: per-segment header length
+ * @frag_idx: current region (-1 = linear, 0..nr_frags-1 = frag)
+ * @offset: byte offset within current region
+ * @linear_dma: DMA address of the linear payload (after headers)
+ * @linear_len: length of the linear payload
+ * @nr_frags: number of frags successfully DMA-mapped
+ * @frags: per-frag DMA address and length
+ *
+ * Struct that DMA-maps the payload regions of a GSO skb
+ * (linear data + frags) upfront, then provides iteration to yield
+ * (dma_addr, chunk_len) pairs bounded by region boundaries.
+ */
+struct tso_dma_map {
+ struct device *dev;
+ const struct sk_buff *skb;
+ unsigned int hdr_len;
+ /* Iterator state */
+ int frag_idx;
+ unsigned int offset;
+ /* Pre-mapped regions */
+ dma_addr_t linear_dma;
+ unsigned int linear_len;
+ unsigned int nr_frags;
+ struct {
+ dma_addr_t dma;
+ unsigned int len;
+ } frags[MAX_SKB_FRAGS];
+};
+
#endif /* _TSO_H */
--
2.52.0
next prev parent reply other threads:[~2026-03-12 22:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 22:34 [RFC net-next v2 00/12] Add TSO map-once DMA helpers and bnxt SW USO support Joe Damato
2026-03-12 22:34 ` Joe Damato [this message]
2026-03-12 22:34 ` [RFC net-next v2 02/12] net: tso: Add tso_dma_map helpers Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 03/12] net: bnxt: Export bnxt_xmit_get_cfa_action Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 04/12] net: bnxt: Add a helper for tx_bd_ext Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 05/12] net: bnxt: Use dma_unmap_len for TX completion unmapping Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 06/12] net: bnxt: Add TX inline buffer infrastructure Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 07/12] net: bnxt: Add boilerplate GSO code Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 08/12] net: bnxt: Implement software USO Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 09/12] net: bnxt: Add SW GSO completion and teardown support Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 10/12] net: bnxt: Dispatch to SW USO Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 11/12] net: netdevsim: Add support for " Joe Damato
2026-03-12 22:34 ` [RFC net-next v2 12/12] selftests: drv-net: Add USO test Joe Damato
2026-03-16 19:44 ` [RFC net-next v2 00/12] Add TSO map-once DMA helpers and bnxt SW USO support Leon Romanovsky
2026-03-16 21:02 ` Joe Damato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260312223457.1999489-2-joe@dama.to \
--to=joe@dama.to \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox