From nobody Thu Apr 2 20:21:23 2026 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 661BB2EC0AE for ; Thu, 26 Mar 2026 23:52:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774569173; cv=none; b=sND2AdAvIHVUsQlk1x+HiL+XUMHTi183yJDBZv/as/DEHJ8gV9rEm10tgzO3cV1AFJT7TOdl2xJ/h6LsPEXT7k6Cyi/3wWjhqXSNxKaEbZeyZdHqFMTG/duzdTFO4+xeI/BfNJQDHxjNSeosq/WFN/bvoxLSkeoEdErIWaNwa10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774569173; c=relaxed/simple; bh=89osrXGFcyoMNdsGsSYJRS7HmUWWP8RNcJMZ4Irlins=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BcwNN0a1nR87N7wmxllVfYc3KKkCIfbDMvD8WlYEFKHe4t3aA78DwhGtJhC+zBdjs+3iKisqdhknTJbDNRpcSwjSYOTC6j5mk4fWevohWAuxCwwNPvriKB9OKQA82ZHObHm5zAFm+nMiK63sC9WqD+KBDV0foUWgm7FQmkUdxJI= 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=aj+ylgOn; arc=none smtp.client-ip=209.85.215.180 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="aj+ylgOn" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-c73c990a96dso800053a12.0 for ; Thu, 26 Mar 2026 16:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20230601.gappssmtp.com; s=20230601; t=1774569172; x=1775173972; 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=hzwsL2AaeOyolPivj0sSP8+HZDWRlIMJad3TwBTVVkk=; b=aj+ylgOn5510l4Y1yr1L48xVbF+yPSDcoQ04fpFRCjWibUE3Dl6r+5hHV0s3tXUq8P daTXj8gqltaK6AK5N0fWmdswu+r8u1vjc0VwAFNS0ZdFmcaHTb30k3vC/LooVqYTWJCh 30WMIve7I00ypX1HNnuIQaoutbA0ZkDiqkSmshjlpSX0f/3L3z0wRxjMSA0GOSs57JLh /tv5ycH5t3eJ2h0ugybsy5YsG27lTBpYgbP4gwoJ2bVrXb45W6+Q57OMujrOGUbpAjsu KeU/HmwSjtBih6m4VPWwVfJDSKOSf1yOJw0VZnHh0UTs5DLXzath5Q5zRScfdYHvX5+m oeNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774569172; x=1775173972; 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=hzwsL2AaeOyolPivj0sSP8+HZDWRlIMJad3TwBTVVkk=; b=pOW7yZLRN3hWtYRoSBioeTn5L38vac99pawv0x0AX6ojGeJbwGNq2hFYLPl89trbjC GLe8aYtSx6LuBvO4QVFPVdelr53QlSDBZvIepsI8TMxU65ZaVTpoTbpjdXicpk5u9fLv bTwWW0G0pztVO7lCYVwIp4JzITsElPyt6YHppgpjCcgGlU9KsUHOHAqDTuzslSaP376w DAweTcOAsOMggH6oWqTiGZ44diFo6iPBA5tmN3bJQSOef18TMgUYn3QlO35+6vugoTD5 ArEs5igfJroeSVBFP0UkA0I1TtTxZpK2wEV+keodWG/uBhbN2rQ8XatoNfnEa2Zm4Kps s53w== X-Forwarded-Encrypted: i=1; AJvYcCUoUZF8UppOmyMyn6X3l5OYuucTvKClCVQRedLqIKjIS8HOEbRB4k/ojp9DYvaZZhvLT4peAYS4bwDuPkc=@vger.kernel.org X-Gm-Message-State: AOJu0YzK/e5P/X4tvDYpqY/0ou6lrNYGEkidVPoLXrWpItZrHtyFoc4q n9COMxH99HO4JTUXw3uMxYa0E/B3XN1Z5268WP4Dg0OFRjFtmdTceb6P4zXA/I7+u2Q= X-Gm-Gg: ATEYQzw7WAIYFQV4i3aTFGF2nQ10gJoqSgpXxczgpP+BTSg8cLUNh/Ux1IuBUN2ieu9 l2Vcr6bxlK1hejKduFzvHDBTPBfPuRwuO+J6IFIJGpuStJGJlnz7Ao0zmXuFCYH4AD4h0GAjZPC Fuo6ZAc5vF4Sn6MLlHbaXPwYDOhkgtI5juo2VT/j5JfKzd21FX4oiFDFUUJS9/J0ktwqi1b9fco Q3FJ5lyBBykWs3+4iFJa5y8iLUU5LTvmeqoLSn9zQA+o+DA98UuhNByjCqnHOi/Gt+zRajN4+qg GR5FCoP3RuMJzJHkhV7m3EXiwiMiL+c35ol2fMYVbzJbUETg0K3K+BXAunT70kOMEcx/pRfepui UnXvdik+qAyCHt3xLHDjzamyvh6Soak/6IaAWQ5fRNIxMHrW9aEwl8XHZF7ibZoXUnDucdwptNF HKXQs= X-Received: by 2002:a17:903:19ed:b0:2b0:61c2:8e83 with SMTP id d9443c01a7336-2b0cdc43116mr4855505ad.20.1774569171745; Thu, 26 Mar 2026 16:52:51 -0700 (PDT) Received: from localhost ([2a03:2880:2ff:2::]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0bc87e643sm43677055ad.41.2026.03.26.16.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2026 16:52:51 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: andrew+netdev@lunn.ch, horms@kernel.org, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, linux-kernel@vger.kernel.org, leon@kernel.org, Joe Damato Subject: [net-next v6 01/12] net: tso: Introduce tso_dma_map Date: Thu, 26 Mar 2026 16:52:20 -0700 Message-ID: <20260326235238.2940471-2-joe@dama.to> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260326235238.2940471-1-joe@dama.to> References: <20260326235238.2940471-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 struct tso_dma_map to tso.h for tracking DMA addresses of mapped GSO payload data. The struct combines DMA mapping storage with iterator state, allowing drivers to walk pre-mapped DMA regions linearly. Includes fields for the DMA IOVA path (iova_state, iova_offset, total_len) and a fallback per-region path (linear_dma, frags[], frag_idx, offset). Helpers to initialize and operate on this struct will be added in the next commit. Suggested-by: Jakub Kicinski Signed-off-by: Joe Damato --- v3: - struct tso_dma_map extended to track IOVA state and a fallback per-region path. include/net/tso.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/include/net/tso.h b/include/net/tso.h index e7e157ae0526..8f8d9d74e873 100644 --- a/include/net/tso.h +++ b/include/net/tso.h @@ -3,6 +3,7 @@ #define _TSO_H =20 #include +#include #include =20 #define TSO_HEADER_SIZE 256 @@ -28,4 +29,43 @@ 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); =20 +/** + * 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 + * @iova_state: DMA IOVA state (when IOMMU available) + * @iova_offset: global byte offset into IOVA range (IOVA path only) + * @total_len: total payload length + * @frag_idx: current region (-1 =3D linear, 0..nr_frags-1 =3D frag) + * @offset: byte offset within current region + * @linear_dma: DMA address of the linear payload + * @linear_len: length of the linear payload + * @nr_frags: number of frags successfully DMA-mapped + * @frags: per-frag DMA address and length + * + * DMA-maps the payload regions of a GSO skb (linear data + frags). + * Prefers the DMA IOVA API for a single contiguous mapping with one + * IOTLB sync; falls back to per-region dma_map_phys() otherwise. + */ +struct tso_dma_map { + struct device *dev; + const struct sk_buff *skb; + unsigned int hdr_len; + /* IOVA path */ + struct dma_iova_state iova_state; + size_t iova_offset; + size_t total_len; + /* Fallback path if IOVA path fails */ + int frag_idx; + unsigned int offset; + 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 */ --=20 2.52.0