+static int str_hostname_cb(void *data, const char *input);
+static struct fio_option options[] = {
+ {
+ .name = "hostname",
+ .lname = "net engine hostname",
+ .type = FIO_OPT_STR_STORE,
+ .cb = str_hostname_cb,
+ .help = "Hostname for net IO engine",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+ {
+ .name = "port",
+ .lname = "net engine port",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct netio_options, port),
+ .minval = 1,
+ .maxval = 65535,
+ .help = "Port to use for TCP or UDP net connections",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+ {
+ .name = "protocol",
+ .lname = "net engine protocol",
+ .alias = "proto",
+ .type = FIO_OPT_STR,
+ .off1 = offsetof(struct netio_options, proto),
+ .help = "Network protocol to use",
+ .def = "tcp",
+ .posval = {
+ { .ival = "tcp",
+ .oval = FIO_TYPE_TCP,
+ .help = "Transmission Control Protocol",
+ },
+ { .ival = "tcpv6",
+ .oval = FIO_TYPE_TCP_V6,
+ .help = "Transmission Control Protocol V6",
+ },
+ { .ival = "udp",
+ .oval = FIO_TYPE_UDP,
+ .help = "User Datagram Protocol",
+ },
+ { .ival = "udpv6",
+ .oval = FIO_TYPE_UDP_V6,
+ .help = "User Datagram Protocol V6",
+ },
+ { .ival = "unix",
+ .oval = FIO_TYPE_UNIX,
+ .help = "UNIX domain socket",
+ },
+ },
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+#ifdef CONFIG_TCP_NODELAY
+ {
+ .name = "nodelay",
+ .type = FIO_OPT_BOOL,
+ .off1 = offsetof(struct netio_options, nodelay),
+ .help = "Use TCP_NODELAY on TCP connections",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+#endif
+ {
+ .name = "listen",
+ .lname = "net engine listen",
+ .type = FIO_OPT_STR_SET,
+ .off1 = offsetof(struct netio_options, listen),
+ .help = "Listen for incoming TCP connections",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+ {
+ .name = "pingpong",
+ .type = FIO_OPT_STR_SET,
+ .off1 = offsetof(struct netio_options, pingpong),
+ .help = "Ping-pong IO requests",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+ {
+ .name = "interface",
+ .lname = "net engine interface",
+ .type = FIO_OPT_STR_STORE,
+ .off1 = offsetof(struct netio_options, intfc),
+ .help = "Network interface to use",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+ {
+ .name = "ttl",
+ .lname = "net engine multicast ttl",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct netio_options, ttl),
+ .def = "1",
+ .minval = 0,
+ .help = "Time-to-live value for outgoing UDP multicast packets",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+ {
+ .name = NULL,
+ },
+};
+
+static inline int is_udp(struct netio_options *o)
+{
+ return o->proto == FIO_TYPE_UDP || o->proto == FIO_TYPE_UDP_V6;
+}
+
+static inline int is_tcp(struct netio_options *o)
+{
+ return o->proto == FIO_TYPE_TCP || o->proto == FIO_TYPE_TCP_V6;
+}
+
+static inline int is_ipv6(struct netio_options *o)
+{
+ return o->proto == FIO_TYPE_UDP_V6 || o->proto == FIO_TYPE_TCP_V6;
+}
+