From: Hannes Reinecke <hare@suse.de>
To: alistair23@gmail.com, chuck.lever@oracle.com, hare@kernel.org,
kernel-tls-handshake@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
linux-nvme@lists.infradead.org, linux-nfs@vger.kernel.org
Cc: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
kch@nvidia.com, Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH 6/8] nvme-tcp: Support KeyUpdate
Date: Mon, 18 Aug 2025 14:52:14 +0200 [thread overview]
Message-ID: <107506e2-7870-45df-b595-583b57137a29@suse.de> (raw)
In-Reply-To: <20250815050210.1518439-7-alistair.francis@wdc.com>
On 8/15/25 07:02, alistair23@gmail.com wrote:
> From: Alistair Francis <alistair.francis@wdc.com>
>
> If the nvme_tcp_try_send() or nvme_tcp_try_recv() functions return
> EKEYEXPIRED then the underlying TLS keys need to be updated. This occurs
> on an KeyUpdate event.
>
> If the NVMe Target (TLS server) initiates a KeyUpdate this patch will
> allow the NVMe layer to process the KeyUpdate request and forward the
> request to userspace. Userspace must then update the key to keep the
> connection alive.
>
> This patch allows us to handle the NVMe target sending a KeyUpdate
> request without aborting the connection. At this time we don't support
> initiating a KeyUpdate.
>
> Link: https://datatracker.ietf.org/doc/html/rfc8446#section-4.6.3
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
> drivers/nvme/host/tcp.c | 63 ++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 62 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index cc3332529355..0c14d3ad58af 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -171,6 +171,7 @@ struct nvme_tcp_queue {
> bool tls_enabled;
> u32 rcv_crc;
> u32 snd_crc;
> + key_serial_t user_key_serial;
> __le32 exp_ddgst;
> __le32 recv_ddgst;
> struct completion tls_complete;
> @@ -1313,6 +1314,7 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *queue)
> struct nvme_tcp_request *req;
> unsigned int noreclaim_flag;
> int ret = 1;
> + enum nvme_ctrl_state state = nvme_ctrl_state(&(queue->ctrl->ctrl));
>
> if (!queue->request) {
> queue->request = nvme_tcp_fetch_request(queue);
> @@ -1347,6 +1349,29 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *queue)
> done:
> if (ret == -EAGAIN) {
> ret = 0;
> + } else if (ret == -EKEYEXPIRED &&
> + state != NVME_CTRL_CONNECTING &&
> + state != NVME_CTRL_RESETTING) {
> + int qid = nvme_tcp_queue_id(queue);
> +
> + dev_dbg(queue->ctrl->ctrl.device,
> + "updating key for queue %d\n", qid);
> +
> + nvme_change_ctrl_state(&(queue->ctrl->ctrl), NVME_CTRL_RESETTING);
Rah. Don't do that.
The 'resetting' state is tied to the resetting mechanism
(LIVE->RESETTING->CONNECTING->LIVE) and is being relied on
for the timeout handler. Setting it manually will confuse error
handling.
And really, having the key update in two places is a bit ... odd.
I'd rather stop the I/O queue in nvme_tcp_io_work() once a
EKEYEXPIRED error has been hit, and start the key update via
nvme_tcp_start_tls() function directly from there.
No need to change the controller state.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
next prev parent reply other threads:[~2025-08-18 12:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 5:02 [PATCH 0/8] nvme-tcp: Support receiving KeyUpdate requests alistair23
2025-08-15 5:02 ` [PATCH 1/8] net/handshake: Store the key serial number on completion alistair23
2025-08-15 13:40 ` Chuck Lever
2025-08-15 5:02 ` [PATCH 2/8] net/handshake: Make handshake_req_cancel public alistair23
2025-08-15 20:03 ` kernel test robot
2025-08-15 5:02 ` [PATCH 3/8] net/handshake: Expose handshake_sk_destruct_req publically alistair23
2025-08-15 21:48 ` kernel test robot
2025-08-15 5:02 ` [PATCH 4/8] tls: Allow callers to clear errors alistair23
2025-08-15 17:02 ` Jakub Kicinski
2025-08-15 5:02 ` [PATCH 5/8] net/handshake: Support KeyUpdate message types alistair23
2025-08-15 5:02 ` [PATCH 6/8] nvme-tcp: Support KeyUpdate alistair23
2025-08-18 12:52 ` Hannes Reinecke [this message]
2025-08-15 5:02 ` [PATCH 7/8] net/handshake: Support decoding the HandshakeType alistair23
2025-08-15 13:40 ` Chuck Lever
2025-08-15 5:02 ` [PATCH 8/8] nvmet-tcp: Support KeyUpdate alistair23
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=107506e2-7870-45df-b595-583b57137a29@suse.de \
--to=hare@suse.de \
--cc=alistair.francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=axboe@kernel.dk \
--cc=chuck.lever@oracle.com \
--cc=hare@kernel.org \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=kernel-tls-handshake@lists.linux.dev \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®