From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-204.mta0.migadu.com [91.218.175.204]) (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 D149C3B47E3 for ; Tue, 1 Sep 2026 15:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.204 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788277772; cv=none; b=Tsp3OOi7g7P6mIwSzHigm96VU3SDutIBQ6y8qAstFJKcx8mxQOmRjdZPhhn9Ovam5nVKbEa44evdr7UMY/EF0R24ssJ1NYKnnlqAhddqkrLJBkPSoclKrFPF+91Th4aU5J/9EK46G8k/HI0/lEPd7uvmCPylwivUpSwpeoPCGLQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788277772; c=relaxed/simple; bh=7tAbQ3FNXQwdtFApJLSmfPJ1AsLIn5kjlzDFefq/f9U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bBXWyKZ1ol4USo+fmGagLDlbtLIQcMd+cFw9r7X7cbYDgP5z+eA7lUqB9m0EAq2mX0MFumnOk4QDLaLXknmq1iWuD+Gr6SLKQqCy1gHgyPKHypTrvNG7D6gl9uVRax0H/GlAIWs9We//gWZEPutEvKm6PgZD433rsG6HzMH1bqc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=oqPvH9G0; arc=none smtp.client-ip=91.218.175.204 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="oqPvH9G0" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=7tAbQ3FNXQwdtFApJLSmfPJ1AsLIn5kjlzDFefq/f9U=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1788277767; v=1; x=1788882567; b=oqPvH9G0IQCIELA8f3NPRCikXTuSJBmmty31hKFio7mhRBJvrxyXenO9359O2Fz3XDj7ZeQ4 KX7OyGpnk4oNAsv/J51zXfE74a1vC5phnLsqPTq9cEXPHPX3Tp4/s4FczpopfsKzTNkFSfqBh9L zm3pmXbl6ErLnzva2CagwOPg= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 36ff23f91a58beb3; Tue, 01 Sep 2026 15:49:27 +0000 X-Mizu-Trace-ID: 36ff23f91a58beb3 X-Migadu-Flow: FLOW_OUT From: Jiayuan Chen To: netdev@vger.kernel.org Cc: Jiayuan Chen , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH net-next v1 0/2] netdevsim: add TLS device offload emulation and test Date: Tue, 1 Sep 2026 23:48:55 +0800 Message-ID: <20260901154914.11637-1-jiayuan.chen@linux.dev> X-Mailer: git-send-email 2.43.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 It helped me find commit b17cf742eaad ("tls: device: fix out-of-bounds write in tls_append_frag()"). So I think it is worth sending a formal patchset. 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 adds a selftest. No crypto is done: TX puts the plaintext record on the wire, RX just sets skb->decrypted. That only works netdevsim to netdevsim, but it covers record assembly and the offload lifecycle. Real ciphertext, and more on top of it, can come later. Jiayuan Chen (2): netdevsim: add TLS device offload emulation selftests: netdevsim: add a kTLS device offload test drivers/net/Kconfig | 1 + drivers/net/netdevsim/Makefile | 4 + drivers/net/netdevsim/netdev.c | 5 + drivers/net/netdevsim/netdevsim.h | 35 ++ drivers/net/netdevsim/tls.c | 482 +++++++++++++++++ .../drivers/net/netdevsim/.gitignore | 2 + .../selftests/drivers/net/netdevsim/Makefile | 7 + .../selftests/drivers/net/netdevsim/config | 2 + .../selftests/drivers/net/netdevsim/tls.sh | 334 ++++++++++++ .../drivers/net/netdevsim/tls_offload.c | 505 ++++++++++++++++++ 10 files changed, 1377 insertions(+) create mode 100644 drivers/net/netdevsim/tls.c create mode 100644 tools/testing/selftests/drivers/net/netdevsim/.gitignore create mode 100755 tools/testing/selftests/drivers/net/netdevsim/tls.sh create mode 100644 tools/testing/selftests/drivers/net/netdevsim/tls_offload.c -- 2.43.0