From nobody Thu Jul 25 19:33:32 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WVLf51VMDz5R8kt; Thu, 25 Jul 2024 19:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WVLf50WqXz40nM; Thu, 25 Jul 2024 19:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721936013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N/4Vh0NkLdRnEiRoW2zBu+IrLdKRiW8R/CJcp4JxuPc=; b=eGeOtCjnZr+M9Fa1xEwyMqVw/9gpo3FOU5M6+aiqHWX3koY3VUS8cAfR0WIDGR2m/dtFeJ 8s7nOxNb8oIlZfWxkCvXIg7DGEUB36K7oYU44ozwM3GA0aOa9F/UcyCzvi1ZienUJcE0Dc tVxgSHr9vdMAexpMSKfkqlapfo5Mo8h24vdSCZ5oZp/Jd7z99hl6khw8iCw5kPhr2j4oWH KiMB5hf6lP6Jon6xLRYkeoedeefYPSPO11b4uJNqPs71VYntXlKWSL4S2qIUuf1he9cWfl h0PCpeoWxnAmIVpZspF+LsX4zvxlN0mKDHaGgT/NbhM/jX4Le6wUDbbtHG48XA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721936013; a=rsa-sha256; cv=none; b=vr0qSZ/pMTKBRTOd8CVaRhkVCR2CAZNeg13VCkhulTIB+2ONdSQzmN7AAdaa85+0ZMuev/ ozNiKvzsYy2od9rKsQ7gWaeutdOOW4u7HdrMQ7JlC9zgbTLpLhV2X0V2INO/IJi3wWy1lQ n/Bu+/aqAeazabDQxIMA+7XHxy0LTmUN6te1pmenakTSuKN6y/LzKA5IjyYdbzAOj8siyv nYyi5kzR92entZ5A2gJh1pTeXuDeSxMpZrhbPadURc7oG7ejve4I5ER/4sUgp2NO/EI2YF mgJF7Igaop5U5v3mDlzV5wwi2IuZiJX8lys/1H4KRgtaNLCYku4pd2DvH0UF6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721936013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N/4Vh0NkLdRnEiRoW2zBu+IrLdKRiW8R/CJcp4JxuPc=; b=SL6+cdB8M4mCen/sIqRBzFcccjtzgj/iF+icxw3AZKbw9qiB1BTLodF8pejqmxIiN+S3AR R9TDzbbrQIIhFy+P/lo/XYyVu06RzEjsErBSA1w4+3sNSSJV/TVo8GzrjWeUHeekgal9dS 36DNBq2CeWlT73AxQKv64O4LPk92FKk/3QqX641x6WjT02xS29Gn2hYSD8JkX2o9zQmdyr lKKt10CPfk++bDQF2aijsX4WIsbRyY+6OLB6haIhqghX43OiKqTT1ybUPiAYdKNQm9vq4B VEKp0LowJlALw2iw7aciVxS2OqDpXjH3bpbbPxMv9IX5U/jDA8kXUJxzwTx7tw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WVLf506NFz17dg; Thu, 25 Jul 2024 19:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46PJXWCs042847; Thu, 25 Jul 2024 19:33:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46PJXWWi042844; Thu, 25 Jul 2024 19:33:32 GMT (envelope-from git) Date: Thu, 25 Jul 2024 19:33:32 GMT Message-Id: <202407251933.46PJXWWi042844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 399362bac312 - main - nvmfd: Permit setting the MAXH2CDATA value via -H List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 399362bac312d4fa77a3fd918ea002c0782bc315 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=399362bac312d4fa77a3fd918ea002c0782bc315 commit 399362bac312d4fa77a3fd918ea002c0782bc315 Author: John Baldwin AuthorDate: 2024-07-25 19:33:15 +0000 Commit: John Baldwin CommitDate: 2024-07-25 19:33:15 +0000 nvmfd: Permit setting the MAXH2CDATA value via -H This value is advertised to the remote host for TCP associations and determines the maximum data payload size the remote host is permitted to transmit in a single PDU. Sponsored by: Chelsio Communications --- usr.sbin/nvmfd/discovery.c | 2 +- usr.sbin/nvmfd/internal.h | 1 + usr.sbin/nvmfd/io.c | 2 +- usr.sbin/nvmfd/nvmfd.8 | 10 ++++++++-- usr.sbin/nvmfd/nvmfd.c | 17 ++++++++++++++--- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/usr.sbin/nvmfd/discovery.c b/usr.sbin/nvmfd/discovery.c index 1cee8755c65c..2cfe56731d7c 100644 --- a/usr.sbin/nvmfd/discovery.c +++ b/usr.sbin/nvmfd/discovery.c @@ -109,7 +109,7 @@ init_discovery(void) aparams.tcp.pda = 0; aparams.tcp.header_digests = header_digests; aparams.tcp.data_digests = data_digests; - aparams.tcp.maxh2cdata = 256 * 1024; + aparams.tcp.maxh2cdata = maxh2cdata; discovery_na = nvmf_allocate_association(NVMF_TRTYPE_TCP, true, &aparams); if (discovery_na == NULL) diff --git a/usr.sbin/nvmfd/internal.h b/usr.sbin/nvmfd/internal.h index 5ddbc1cf89f0..f70dc78881c6 100644 --- a/usr.sbin/nvmfd/internal.h +++ b/usr.sbin/nvmfd/internal.h @@ -24,6 +24,7 @@ extern bool data_digests; extern bool header_digests; extern bool flow_control_disable; extern bool kernel_io; +extern uint32_t maxh2cdata; /* controller.c */ void controller_handle_admin_commands(struct controller *c, diff --git a/usr.sbin/nvmfd/io.c b/usr.sbin/nvmfd/io.c index 3c25d1944eb8..4407360257a2 100644 --- a/usr.sbin/nvmfd/io.c +++ b/usr.sbin/nvmfd/io.c @@ -57,7 +57,7 @@ init_io(const char *subnqn) aparams.tcp.pda = 0; aparams.tcp.header_digests = header_digests; aparams.tcp.data_digests = data_digests; - aparams.tcp.maxh2cdata = 256 * 1024; + aparams.tcp.maxh2cdata = maxh2cdata; io_na = nvmf_allocate_association(NVMF_TRTYPE_TCP, true, &aparams); if (io_na == NULL) diff --git a/usr.sbin/nvmfd/nvmfd.8 b/usr.sbin/nvmfd/nvmfd.8 index 40b1c0e2ebe0..1076583c417c 100644 --- a/usr.sbin/nvmfd/nvmfd.8 +++ b/usr.sbin/nvmfd/nvmfd.8 @@ -13,12 +13,14 @@ .Nm .Fl K .Op Fl dFGg +.Op Fl H Ar MAXH2CDATA .Op Fl P Ar port .Op Fl p Ar port .Op Fl t Ar transport .Op Fl n Ar subnqn .Nm .Op Fl dFGg +.Op Fl H Ar MAXH2CDATA .Op Fl P Ar port .Op Fl p Ar port .Op Fl t Ar transport @@ -42,6 +44,11 @@ Permit remote hosts to disable SQ flow control. Permit remote hosts to enable PDU data digests for the TCP transport. .It Fl g Permit remote hosts to enable PDU header digests for the TCP transport. +.It Fl H +Set the MAXH2CDATA value advertised to the remote host for the TCP transport. +This value is in bytes and determines the maximum data payload size for +data PDUs sent by the remote host. +The value must be at least 4096 and defaults to 256KiB. .It Fl K Enable kernel mode which hands off incoming I/O controller connections to .Xr nvmft 4 . @@ -121,5 +128,4 @@ should be merged into .Xr ctld 8 . .Pp Additional parameters such as -.Va MAXH2CDATA -and queue sizes should be configurable. +queue sizes should be configurable. diff --git a/usr.sbin/nvmfd/nvmfd.c b/usr.sbin/nvmfd/nvmfd.c index cce7a88706d2..df6f400b40e5 100644 --- a/usr.sbin/nvmfd/nvmfd.c +++ b/usr.sbin/nvmfd/nvmfd.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,7 @@ bool data_digests = false; bool header_digests = false; bool flow_control_disable = false; bool kernel_io = false; +uint32_t maxh2cdata = 256 * 1024; static const char *subnqn; static volatile bool quit = false; @@ -36,8 +38,8 @@ static volatile bool quit = false; static void usage(void) { - fprintf(stderr, "nvmfd -K [-dFGg] [-P port] [-p port] [-t transport] [-n subnqn]\n" - "nvmfd [-dFGg] [-P port] [-p port] [-t transport] [-n subnqn]\n" + fprintf(stderr, "nvmfd -K [-dFGg] [-H MAXH2CDATA] [-P port] [-p port] [-t transport] [-n subnqn]\n" + "nvmfd [-dFGg] [-H MAXH2CDATA] [-P port] [-p port] [-t transport] [-n subnqn]\n" "\tdevice [device [...]]\n" "\n" "Devices use one of the following syntaxes:\n" @@ -150,6 +152,7 @@ main(int ac, char **av) struct pidfh *pfh; const char *dport, *ioport, *transport; pid_t pid; + uint64_t value; int ch, error, kqfd; bool daemonize; static char nqn[NVMF_NQN_MAX_LEN]; @@ -162,7 +165,7 @@ main(int ac, char **av) ioport = "0"; subnqn = NULL; transport = "tcp"; - while ((ch = getopt(ac, av, "dFgGKn:P:p:t:")) != -1) { + while ((ch = getopt(ac, av, "dFgGH:Kn:P:p:t:")) != -1) { switch (ch) { case 'd': daemonize = false; @@ -176,6 +179,14 @@ main(int ac, char **av) case 'g': header_digests = true; break; + case 'H': + if (expand_number(optarg, &value) != 0) + errx(1, "Invalid MAXH2CDATA value %s", optarg); + if (value < 4096 || value > UINT32_MAX || + value % 4 != 0) + errx(1, "Invalid MAXH2CDATA value %s", optarg); + maxh2cdata = value; + break; case 'K': kernel_io = true; break;