From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 638AD3C278C for ; Fri, 20 Mar 2026 14:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774017712; cv=none; b=k5KNdosCgtSB1BSjDb74R4vJReVvUmb/GmYhLDlsd9Y+UHrSXNRWgMkC4Hh1W33Ddzh1qSmuMHFZekF+8CipyCQ26rH2lnXMDYny4W+ztsfZ452n0SnhfAqlZD/tw9zxu0ZZJY/rP78cYJ43PG4xyTR99UQk+afhJz6NrYRwsks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774017712; c=relaxed/simple; bh=N9KuTauRl5qNVr4yvJZ1TiXBDN4Jgm2DFykOJ5aGoVA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=l71gKGLx32a2s2407YwFuUt3YEvgdmSQT3l2ED5g09yPltsqTzcVwRyxzFFoHzT84JbPckMc+JB2xX2EIuClzyjkK9IWPz66Jdz8+tEw/eMEOtto07o+WMESUNpYrIjs7QLyy3sUzSPG3aVawp3KJt9d+DXSLhA6Utfe86p2Qr8= 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=NOwRaz+F; arc=none smtp.client-ip=209.85.216.50 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="NOwRaz+F" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-35a1f549e7eso425203a91.0 for ; Fri, 20 Mar 2026 07:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dama-to.20230601.gappssmtp.com; s=20230601; t=1774017711; x=1774622511; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RkY/6UUkz6LekGqRy3yelUEgJVbUVkXO2hFvF544f0c=; b=NOwRaz+FiK8JHscvFfCCL2qMaTExvCEVYqXe7zgJcjriTc7q1p+BEA+F1XC3vit1Y4 Ti3/kJNb9bZu0b3KRB2aWgWbC1+6hlV86pRCRk8jfABZpY/1OCmkT+c8cwjq8dDKuWm7 RT1VSal1i0DyvAZllNHaSb1KuvMHq11afoCR0Q1frT/+ZtcXM1fL6G/mUEsQuKR4FvCu 9jSTqFyZUtN88gixNjg5oSVa+zFVzGPuM4XPeVmbPZ/tCCUM9QsI103zJQb5/NqMHhaf NV87BJhfyc5svUUcIT2Dc11+iArD4t5rBZspjA53qpYPFVH1l+cxwH6HBKWgG2MgCgpt lTJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774017711; x=1774622511; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RkY/6UUkz6LekGqRy3yelUEgJVbUVkXO2hFvF544f0c=; b=I1iQvaKy7QRVIvpmsYeXtwTu1Lwwf0BhmxIYOlR/cOaD5reHqE8L5rO8dC91tsKUst 00r+/WqfYPhF75dq7fF94J2xUHKtqKKiYvgzcoBIDjFbylhvwZXCE9Zr1JH46+xRY9/e vvR2dGQ24hsXLMAZiTz9/iSb0k2WW2xQUP8oI5P73bntHd0we6IcbAc3StsBYh7+ssrB VgaftL7Pl571Z5OB5U8EFwLYrurT7/0f9m59vcMVg+ft5oEnKL1KZUW5hQ8YZVus3c5i PHvcAaJR5i+LpMCarypNvgEEU00wg5iZRR4uqqDD77U0L20r/1r/SHOrYA5yyUEdcJU8 Sucw== X-Forwarded-Encrypted: i=1; AJvYcCV8Fkbd+Bb/2uIpxe86WFo+FdCu2o6fLWA4f1M+Tc5sR98/q/eqPNruM67PXtmB21d5+L42eERFtjWhKlA=@vger.kernel.org X-Gm-Message-State: AOJu0YykjZHRk5CufnJHynAQi94bXqgozKAnlE79hHuheo8MyAUVYHmE yI4iXLkuMwbpB7JdrC1CQYUWllyvnip/CoZ5OR30O2stePqUroMfKD4GwM/1gvF4z18= X-Gm-Gg: ATEYQzwuxBj+oKMHWjfbbI35u9ufK0xZJJKIroif5oO0bGXK77DJTC+RILP7MWuB0Qf +CERcZG544j6SHp4yo7qLc2WUk5ImIE448nZdWH7SVvnW2dKKiRLAmc1P6JexFnyHVQmr8GzWME F/85AMFWwHDNq/gy+9evv0sHo97PqU9DfgyiNOf9TbmsaxV7M5eFfG91RVtRhQR4g2G0eDaKesU PC0358yR34N4/YNgkXSL30e6xymJ0M7yGSPnVOjYWDDFZpjxo9QDJJ7aSWxqycgKlKHx7SdIQQa ndGLd5tQIlFAwxdl4kFN2trozk7LLX1OPWj3K/aRNAFlV0n8aErKE59s1YaeK5MNaeLK3PbrV35 2iDoZsOKBe5py92AUorT35I8mSES8FNmeMRzsPWVq/ZMEhBO31QrY4jqGMxjPYJlIWyGhabkMj5 qtBAo= X-Received: by 2002:a17:903:94e:b0:2ae:aafa:ec95 with SMTP id d9443c01a7336-2b0826d7dc5mr28671905ad.11.1774017710494; Fri, 20 Mar 2026 07:41:50 -0700 (PDT) Received: from localhost ([2a03:2880:2ff:7::]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b083655474sm32919915ad.48.2026.03.20.07.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 07:41:50 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, linux-kernel@vger.kernel.org, leon@kernel.org, Joe Damato Subject: [net-next v4 00/12] Add TSO map-once DMA helpers and bnxt SW USO support Date: Fri, 20 Mar 2026 07:41:21 -0700 Message-ID: <20260320144141.260246-1-joe@dama.to> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Greetings: This series extends net/tso to add a data structure and some helpers allowing drivers to DMA map headers and packet payloads a single time. The helpers can then be used to reference slices of shared mapping for each segment. This helps to avoid the cost of repeated DMA mappings, especially on systems which use an IOMMU. N per-packet DMA maps are replaced with a single map for the entire GSO skb. As of v3, the series uses the DMA IOVA API (as suggested by Leon [1]) and provides a fallback path when an IOMMU is not in use. The DMA IOVA API provides even better efficiency than the v2; see below. The added helpers are then used in bnxt to add support for software UDP Segmentation Offloading (SW USO) for older bnxt devices which do not have support for USO in hardware. Since the helpers are generic, other drivers can be extended similarly. The v2 showed a ~4x reduction in DMA mapping calls at the same wire packet rate on production traffic with a bnxt device. The v3, however, shows a larger reduction of about ~6x at the same wire packet rate. This is thanks to Leon's suggestion of using the DMA IOVA API [1]. Special care is taken to make bnxt ethtool operations work correctly: the ring size cannot be reduced below a minimum threshold while USO is enabled and growing the ring automatically re-enables USO if it was previously blocked. I've extended netdevsim to have support for SW USO, but I used tso_build_hdr/tso_build_data in netdevsim because I couldn't figure out if there was a way to test the DMA helpers added by this series. If anyone has suggestions, let me know. I think to test the DMA helpers you probably need to use real hardware. Since this v4 made minor updates to the python test (see below and patch 12 changelog), I re-ran the test with both netdevsim and real bnxt hardware and the test passed. Thanks, Joe [1]: https://lore.kernel.org/netdev/20260316194419.GH61385@unreal/ v4: - Fixed kdoc issues in patch 2. No functional change. - Added Pavan's Reviewed-by to patches 3, 4, and 5. - Fixed the issue Pavan (and the AI review) pointed out in patch 8. See patch changelog. - Added parentheses around gso_type check in patch 11 for clarity. No functional change. - Fixed python linter issues in patch 12. No functional change. v3: https://lore.kernel.org/netdev/20260318191325.1819881-1-joe@dama.to/ - Converted from RFC to an actual submission. - Updated based on Leon's feedback to use the DMA IOVA API. See individual patches for update information. RFCv2: https://lore.kernel.org/netdev/20260312223457.1999489-1-joe@dama.to/ - Some bugs were discovered shortly after sending: incorrect handling of the shared header space and a bug in the unmap path in the TX completion. Sorry about that; I was more careful this time. - On that note: this rfc includes a test. RFCv1: https://lore.kernel.org/netdev/20260310212209.2263939-1-joe@dama.to/ Joe Damato (12): net: tso: Introduce tso_dma_map net: tso: Add tso_dma_map helpers net: bnxt: Export bnxt_xmit_get_cfa_action net: bnxt: Add a helper for tx_bd_ext net: bnxt: Use dma_unmap_len for TX completion unmapping net: bnxt: Add TX inline buffer infrastructure net: bnxt: Add boilerplate GSO code net: bnxt: Implement software USO net: bnxt: Add SW GSO completion and teardown support net: bnxt: Dispatch to SW USO net: netdevsim: Add support for SW USO selftests: drv-net: Add USO test drivers/net/ethernet/broadcom/bnxt/Makefile | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 190 +++++++++--- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 33 +++ .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 19 +- drivers/net/ethernet/broadcom/bnxt/bnxt_gso.c | 236 +++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt_gso.h | 31 ++ drivers/net/netdevsim/netdev.c | 100 ++++++- include/linux/skbuff.h | 11 + include/net/tso.h | 61 ++++ net/core/tso.c | 273 ++++++++++++++++++ tools/testing/selftests/drivers/net/Makefile | 1 + tools/testing/selftests/drivers/net/uso.py | 96 ++++++ 12 files changed, 1013 insertions(+), 40 deletions(-) create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_gso.c create mode 100644 drivers/net/ethernet/broadcom/bnxt/bnxt_gso.h create mode 100755 tools/testing/selftests/drivers/net/uso.py base-commit: 9f4960b94f1a044f76da98a765d6cbd294c22c92 -- 2.52.0