From mboxrd@z Thu Jan 1 00:00:00 1970 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 142F0348898 for ; Thu, 19 Mar 2026 17:09:07 +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=1773940149; cv=none; b=LG/pIdcm9ex1PD7fHUDkSwWY/NMQaIVUONJAUKiJCfq8Eo60RIoKV+Zqnr/PPdrwqPaQvsgx6v6k6oYcn3DaDORid/To0gfvFV9XjBwIbKAX+tgUTM7B0/uLlDV2/8M1hqI/yRDRMOModg3mBWfDYLckqEAdg848jMibf29b2Ew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773940149; c=relaxed/simple; bh=yjuF9xAV1vdhVProkPDDgLZxMZq70MdjbsBVZBgMtiE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ohq6U4pRC18ju+vebJSbaO5rsOrSAO5mj6ghfJEMwbhwOH8Ng/Vif9hOwfdxvqDQjF6LxTO2h+E8PAi7U6i8XRYONF8W066Lmz2PjgwyI0flHlmm/aFRtWt1wfNs4X2QJ89hSLNywVbk72A0O3AUvrK0iPMSXQ0eWj4Nk0hRhSc= 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=r9J5Exk1; 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="r9J5Exk1" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-3567e2b4159so839190a91.0 for ; Thu, 19 Mar 2026 10:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20230601.gappssmtp.com; s=20230601; t=1773940147; x=1774544947; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=s+hX2S30TzDh6XwWhQKX0yqfwzeDA9CM0NhQsO3zAFY=; b=r9J5Exk1ApRHIUncfavgaA3ZQUV7XPhSPUbz68jh7yZomX4C2kmEA3P4kJ4Cm2ekwO MSQoWuFmPk/BoN8ZSuj5kI9bkSWRyVWqoVUrQnWnjziTRdWICIvK+BR5sP0sqpdK8Sff DPMH/ZQjMEiSV+qC4HYJDP+mZAl0inbKflRoLsoni+fHiyqavAr9sp/i3jIQoo8DViK6 fpU7qCv+m4sso3bUKnE+UQ35cruX4A9jReXzt+uYQzsu647SJpCK1VF/T0YNybllBeqI r9nPv8FNeQghnlIkAqFd1RHtSbCXPOr4MhguSVAznbjcQc5w6zpLS/FP+30bjJvh+yBf dHiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773940147; x=1774544947; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=s+hX2S30TzDh6XwWhQKX0yqfwzeDA9CM0NhQsO3zAFY=; b=d5Fme6VBb+rpsP9iynh477bwoHWKsPjHOpto8B8+M31kXW75ZL1ZXCuGUrkaR86ruR zhfRz1OhyIrIlZEmYPIdy7aiZ8urfpl4Inhtii7DJs9TUUmeoWNzupxHdWX+f3YkuP5N taxf8C6vjKdj9q7uq91TG7ld6PXqRAO6KI5zoPTYErqWSwRaQQ9PEqW0DCu2KSKRBjie y6YFQopMNHmdIsxq1+3IUTKDOtRpIZq/Grm2lzczpfW24oqzJ1X0x87zRwjS/S5PImIA XqBnyaKFucpIyC6MnN0qIr9rFw4MWxUluGm4HyUn18hEVIfpG3ekKPZ0EBMf61iPWV4l QniA== X-Forwarded-Encrypted: i=1; AJvYcCW8oGUqMpDelvawW5z4nyy+6F9xp35RdVUnXAmdqm75nz6lNsboc8ud9YWzGkLbnWTdKo9NXfu/SSFP+1Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5gpXoMm1ySh4NAjjfO+cpX0Gwz7b8o3WQ8ExFGVuPWpLl+sWv Wu9/MwGhP1wau+wSNn/AdCQWgPXzgrNXr+hfFHxeNYI6gKUByr309PzynEBK8ApWTB0= X-Gm-Gg: ATEYQzxdvA1vJCIwNhHQaTYUHRuo5mSQtpjgmkb4sVn53KL+hSFD1SkHrnxKaLVy1be wgmy9Us2qFGVs+y7oEDysud3EH498BImkvkZZSErcUxxAXwFsGkq87MhOlmIRPhfoLeABfWi1dr pagOwH1TPj8Zh/uDSneyTe7Uyi6eGkMXvJGaYBwjas5le6YHzyunBH4KTtsqvJUWP36HuMCZLnv 6g1S1ajbgeIEO1Do7/BD9gEktlPUBkEN/xCLK4BPs1hRxVifJP8vn2AofeQUMCxUH0TI5RVRyB7 ucu5gAgqDUKEBkUNdkAbY/E/J6McH7y3yOrf0qatQ4RPgGtfAe0jKMDgK/4j0Vs1TGLhexpqM5g ZTrTXLFgMR3DY4l3SVemjCfUFa6ir6lxu/ah1QuCyubY8Bn78eCha2uRSqV4iaOEWpFyZtgz8+K 1l3UI3 X-Received: by 2002:a17:90b:4c0f:b0:35b:a44f:b7c with SMTP id 98e67ed59e1d1-35bb9e7f6a4mr6438639a91.15.1773940147321; Thu, 19 Mar 2026 10:09:07 -0700 (PDT) Received: from localhost ([2a03:2880:2ff:70::]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35bbabc03ecsm3218505a91.2.2026.03.19.10.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2026 10:09:06 -0700 (PDT) Date: Thu, 19 Mar 2026 10:09:06 -0700 From: Joe Damato To: Leon Romanovsky Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , andrew+netdev@lunn.ch, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, linux-kernel@vger.kernel.org Subject: Re: [net-next v3 02/12] net: tso: Add tso_dma_map helpers Message-ID: Mail-Followup-To: Joe Damato , Leon Romanovsky , netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , andrew+netdev@lunn.ch, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, linux-kernel@vger.kernel.org References: <20260318191325.1819881-1-joe@dama.to> <20260318191325.1819881-3-joe@dama.to> <20260319073959.GJ352386@unreal> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260319073959.GJ352386@unreal> On Thu, Mar 19, 2026 at 09:39:59AM +0200, Leon Romanovsky wrote: > On Wed, Mar 18, 2026 at 12:13:07PM -0700, Joe Damato wrote: > > Adds skb_frag_phys() to skbuff.h, returning the physical address > > of a paged fragment's data, which is used by the tso_dma_map helpers > > introduced in this commit described below: > > > > tso_dma_map_init(): DMA-maps the linear payload region and all frags > > upfront. Prefers the DMA IOVA API for a single contiguous mapping with > > one IOTLB sync; falls back to per-region dma_map_phys() otherwise. > > Returns 0 on success, cleans up partial mappings on failure. > > > > tso_dma_map_cleanup(): Handles both IOVA and fallback teardown paths. > > > > tso_dma_map_count(): counts how many descriptors the next N bytes of > > payload will need. Returns 1 if IOVA is used since the mapping is > > contiguous. > > > > tso_dma_map_next(): yields the next (dma_addr, chunk_len) pair. > > On the IOVA path, each segment is a single contiguous chunk. On the > > fallback path, indicates when a chunk starts a new DMA mapping so the > > driver can set dma_unmap_len on that descriptor for completion-time > > unmapping. > > > > Suggested-by: Jakub Kicinski > > Signed-off-by: Joe Damato > > --- > > v3: > > - Added skb_frag_phys helper include/linux/skbuff.h. > > - Added tso_dma_map_use_iova() inline helper in tso.h. > > - Updated the helpers to use the DMA IOVA API and falls back to per-region > > mapping instead. > > > > include/linux/skbuff.h | 11 ++ > > include/net/tso.h | 21 ++++ > > net/core/tso.c | 274 +++++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 306 insertions(+) > > > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > > index 9cc98f850f1d..d8630eb366c5 100644 > > --- a/include/linux/skbuff.h > > +++ b/include/linux/skbuff.h > > @@ -3758,6 +3758,17 @@ static inline void *skb_frag_address_safe(const skb_frag_t *frag) > > return ptr + skb_frag_off(frag); > > } > > > > +/** > > + * skb_frag_phys - gets the physical address of the data in a paged fragment > > + * @frag: the paged fragment buffer > > + * > > + * Returns: the physical address of the data within @frag. > > + */ > > +static inline phys_addr_t skb_frag_phys(const skb_frag_t *frag) > > +{ > > + return page_to_phys(skb_frag_page(frag)) + skb_frag_off(frag); > > +} > > I skimmed through the patch and it looks generally correct to me. The one > thing that disappointed me is this function. It's unfortunate that you > have to implement it this way and cannot rely on phys_addr_t directly. Thanks for taking a look. Would you prefer if I modified this and created a netmem_to_phys() helper (page-only for now, but extensible later?) and use that instead? Or is this patch acceptable as-is for this series with the understanding that it only handles page-backed frags? Just want to make sure I'm following what you mean. Thanks.