🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19004

[PATCH net-next v3 0/2] netdevsim: add TLS device offload emulation and test

#19004
From: Jiayuan Chen
Date: Thu, 19 Nov 2026 06:48
54 lines
10742 bytes
Running kTLS over this already found a few bugs:

  b17cf742eaad ("tls: device: fix out-of-bounds write in tls_append_frag()")
  ed642349d87d ("tls: fix the open record check in the max payload size setsockopt")

So I think it is worth sending a formal patchset.  v1 [1] was asked to
wait for a selftest that can also run against real hardware.  That test,
drivers/net/hw/tls_hw_offload.py, is in the tree now, so this can move
forward.

The kTLS device offload path in net/tls/tls_device.c has no test
coverage upstream -- selftests/net/tls.c is software only, and the
offload code needs a driver that implements it.

So teach netdevsim to fake it.  Patch 1 implements tlsdev_ops and
advertises the TLS features.  Patch 2 lets the existing hardware offload
test, drivers/net/hw/tls_hw_offload.py, run on netdevsim as well, so the
same test covers real devices and the netdevsim pair CI already uses.

No crypto is done, like the IPsec, MACsec and PSP emulation netdevsim
already has: TX puts the plaintext record on the wire.  That only works
with netdevsim on both ends and offload on in both directions, which is
what the netdevsim environment of the drivers/net tests gives.  It still
covers record assembly and the offload lifecycle.

[1] https://lore.kernel.org/netdev/20260901154914.11637-3-jiayuan.chen@linux.dev/

v2 -> v3:
  - fix the build with CONFIG_IPV6=n (kernel test robot)
  - address some of the issues Sashiko reported
v2: https://lore.kernel.org/netdev/20261117140642.4008-1-jiayuan.chen@linux.dev/
v1 -> v2:
  - drop the netdevsim-only selftest, run the upstream tls_hw_offload.py
    on netdevsim instead so the test also covers real hardware (Jakub)
  - rebase on net-next
v1: https://lore.kernel.org/netdev/20260901154914.11637-1-jiayuan.chen@linux.dev/
RFC (July): https://lore.kernel.org/netdev/20260728125658.390500-1-jiayuan.chen@linux.dev/

Jiayuan Chen (2):
  netdevsim: add TLS device offload emulation
  selftests: drv-net: run tls_hw_offload on netdevsim

 drivers/net/Kconfig                           |   1 +
 drivers/net/netdevsim/Makefile                |   4 +
 drivers/net/netdevsim/netdev.c                |   9 +-
 drivers/net/netdevsim/netdevsim.h             |  34 ++
 drivers/net/netdevsim/tls.c                   | 453 ++++++++++++++++++
 .../drivers/net/hw/tls_hw_offload.py          |   5 +-
 6 files changed, 503 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/netdevsim/tls.c

-- 
2.43.0
Technical Details
Message-ID: <20261119064902.242502-1-jiayuan.chen@linux.dev>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366786-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366786-linux-kernel-netdev=dewy.ru
From: jiayuan.chen@linux.dev (Jiayuan Chen)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v3 0/2] netdevsim: add TLS device offload emulation and test
Date: Thu, 19 Nov 2026 14:48:49 +0800
Organization: Usenet Network
Message-ID: <20261119064902.242502-1-jiayuan.chen@linux.dev>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2810532"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:qBomFne3UCpfOEHvADuwHPPAr8o= sha256:CazckeQ4Pv+m/GTnuUdFK0rbRBJ/P7E936ztRguKr5U=
	sha1:YLjClQLrqMKBUxbthIPPgPqVNQs= sha256:mO2M43y+ggqiyWI4PPjJy7r61eIY6rokjvc4YboA++U=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id BA68D115532; Thu, 19 Nov 2026 09:49:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.05
X-Spam-Status: No, score=-2.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	HK_RANDOM_FROM=1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.dev
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id c_a74cpdVvER;
	Thu, 19 Nov 2026 09:49:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-366786-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id F2A4F1154CC; Thu, 19 Nov 2026 09:49:33 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id E19DE1E12C4; Thu, 19 Nov 2026 06:49:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795070967;
	b=A00ItON2H/zi68qr0xVcn/8H3rHNUObvNHaWPVkPUb7bZ04j+f8/aD605Kw9U1/vD0Xs
	 VY+9aze3A1h+Nc1/zjHT+33g3jPfjdWlMNmHhyVXT4qaXmvxQT2IF2Uc4YGi/gYvn2WQQ
	 S3zh9KBY/mvES+G9ZMf+jYEpG90Eqdhp8SgD90COakPr8tZT0P7c343t3xq6Uunu3zupj
	 ECxfMC7Yamq8JFd7W4hHW9QldAfzHkmhIdqx4JNdIHfnVMUZE3R/GBo15R2X7yzj2qVA8
	 trYTOzKab7LpTdB3gjTJ5c4vVGxyMyR6AbKI6et+/1FymtGILH+MnJoROGz+TK+whig==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795070967;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:
	 Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding;
	bh=0k8SjqfV40GoMj5uo467qPGka1/JYX8qZC07b5bhn/I=;
	b=t/NLPOzP/5xLLHikOPSaVFuKE6VGd0SQs1G5SKBMhsrkSweNDvoJHCGh+0HbX7kfQMPk
	 L1PAQutx3T3iM6+9+DZuLTHQD9nYTFxa1EnPKaUNCau3KdjBnIWmUeyEpLeVyxhabb1RH
	 PPW+Q87FRq9zJ4kxV+7ODPJR+Nv919nqt+apO+gKpz/m3PH2Chs2F1VNou5LwkTT2UROK
	 T70bXaGtf2PI9uXvEXXgL5JDReLc1wbGSRkHmkSkbs9TFbWT0QehW3OCRgB4J+buL+1WU
	 9VWiHqYheD40oryxxwZ9fkpi5G9uVkkZN9s412H2Q7d4lS3vwSh11WXB6O+jgLBsmVA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=JoHTTGB+;
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E53C606A332;
	Thu, 19 Nov 2026 06:49:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=JoHTTGB+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.103
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795070966;
	b=2yUhdTS1rW1ubgN3CMQBep6AEdeMhCvnASwv8da5lxBFgmKY3rHobN3p88K9JvWKxBmu
	 tzy7b6Eglm06OptKuPUHTPmMeor9J/l3mbxgTRxbUVVKrlqcJu58uidNPLginqcOHrOpo
	 m8Tnx7lTi46VdaYpwsxUUhxVqNh8uhyoCMvbpKDIP1lWgb4ASOWKdpNlXJsI7999zAYx4
	 FaZ5uokiO35iXtg0FvlvWvlhehioYi3wJBKemesryRNmsjvhedG2EKr939B4e4lfA0HzT
	 GMskDeWccPErTx812CDwL6RspH7R0A7dt0J18du5V980lWLMCsS4zq0DzKc/0MRpqEQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795070966;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:MIME-Version:Content-Transfer-Encoding;
	bh=0k8SjqfV40GoMj5uo467qPGka1/JYX8qZC07b5bhn/I=;
	b=1NUDH6eRtbtouRctkH+heJw/nUQl4eoz+HCOUovkNHHiF2/iZcgAU/MomffkculCOxAU
	 bA1waCvNQawSkHLxsu5b0ZfrdrpFApQIEJEseQw+3P0ckS/H0a3yVajjvNUCVhiGWmibX
	 L6WeVNMLjCG6duU/qH5jAg/o3wP1W8hpdwzyleGNnaPxOSIjlU1NqBXb2RUnSMoK45aIa
	 LTtcsbH/Atg/FeElR5ybwOJy6Aso/KvTmJqbAbkFH6q70vKJTas82Xop/VUoH7UDPvcJm
	 vVj144LiTyMfL4lRhjwHmMsIm/pMowMVotydaBULwmT4c55tMuzuoNxSFppKY/jpwPQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=JoHTTGB+;
	arc=none smtp.remote-ip=91.218.175.103
X-Received: from mta0.migadu.com (out-103.mta0.migadu.com [91.218.175.103])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C88E606A320
	for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 06:49:24 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4C88E606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=/paUg1xcKXQDviTgdVFByKx4J0HVlCDf5eq8bk6XF5M=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1795070963; v=1; x=1795675763;
 b=JoHTTGB+yCfmB7CRrkISQDC3FqnODTbZ+9Av3bWP1nqjdik3U5+UScBLE8lqOyREXyjVNbOF
 g98PEt+hQhFMVonh0NrP/b628RvLGvPLNZeS4Sel3ahwKLkqmDHLd1u5yOG1jjdImQZ9yjC8eoO
 9DWE1TEd+IernVs6MGFUZvpM=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by smtp.migadu.com with ESMTPS id 1b0ae60659841cff;
	Thu, 19 Nov 2026 06:49:23 +0000
X-Mizu-Trace-ID: 1b0ae60659841cff
X-Migadu-Flow: FLOW_OUT
X-Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Sabrina Dubroca <sd@queasysnail.net>,
	Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
X-Mailer: git-send-email 2.43.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list