1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00

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
This commit is contained in:
John Baldwin 2024-07-25 15:33:15 -04:00
parent 7f73c04895
commit 399362bac3
5 changed files with 25 additions and 7 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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)

View File

@ -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.

View File

@ -18,6 +18,7 @@
#include <libutil.h>
#include <netdb.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -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;