unsigned int pingpong;
unsigned int nodelay;
unsigned int ttl;
+ unsigned int window_size;
+ unsigned int mss;
char *intfc;
};
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_NETIO,
},
+#ifdef CONFIG_NET_WINDOWSIZE
+ {
+ .name = "window_size",
+ .lname = "Window Size",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct netio_options, window_size),
+ .minval = 0,
+ .help = "Set socket buffer window size",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+#endif
+#ifdef CONFIG_NET_MSS
+ {
+ .name = "mss",
+ .lname = "Maximum segment size",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct netio_options, mss),
+ .minval = 0,
+ .help = "Set TCP maximum segment size",
+ .category = FIO_OPT_C_ENGINE,
+ .group = FIO_OPT_G_NETIO,
+ },
+#endif
{
.name = NULL,
},
return o->proto == FIO_TYPE_UDP_V6 || o->proto == FIO_TYPE_TCP_V6;
}
+static int set_window_size(struct thread_data *td, int fd)
+{
+#ifdef CONFIG_NET_WINDOWSIZE
+ struct netio_options *o = td->eo;
+ unsigned int wss;
+ int snd, rcv, ret;
+
+ if (!o->window_size)
+ return 0;
+
+ rcv = o->listen || o->pingpong;
+ snd = !o->listen || o->pingpong;
+ wss = o->window_size;
+ ret = 0;
+
+ if (rcv) {
+ ret = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *) &wss,
+ sizeof(wss));
+ if (ret < 0)
+ td_verror(td, errno, "rcvbuf window size");
+ }
+ if (snd && !ret) {
+ ret = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *) &wss,
+ sizeof(wss));
+ if (ret < 0)
+ td_verror(td, errno, "sndbuf window size");
+ }
+
+ return ret;
+#else
+ td_verror(td, -EINVAL, "setsockopt window size");
+ return -1;
+#endif
+}
+
+static int set_mss(struct thread_data *td, int fd)
+{
+#ifdef CONFIG_NET_MSS
+ struct netio_options *o = td->eo;
+ unsigned int mss;
+ int ret;
+
+ if (!o->mss || !is_tcp(o))
+ return 0;
+
+ mss = o->mss;
+ ret = setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, (void *) &mss,
+ sizeof(mss));
+ if (ret < 0)
+ td_verror(td, errno, "setsockopt TCP_MAXSEG");
+
+ return ret;
+#else
+ td_verror(td, -EINVAL, "setsockopt TCP_MAXSEG");
+ return -1;
+#endif
+}
+
+
/*
* Return -1 for error and 'nr events' for a positive number
* of events
ret = 0; /* must be a SYNC */
if (ret != (int) io_u->xfer_buflen) {
- if (ret >= 0) {
+ if (ret > 0) {
io_u->resid = io_u->xfer_buflen - ret;
io_u->error = 0;
return FIO_Q_COMPLETED;
- } else {
+ } else if (!ret)
+ return FIO_Q_BUSY;
+ else {
int err = errno;
if (ddir == DDIR_WRITE && err == EMSGSIZE)
}
#endif
+ if (set_window_size(td, f->fd)) {
+ close(f->fd);
+ return 1;
+ }
+ if (set_mss(td, f->fd)) {
+ close(f->fd);
+ return 1;
+ }
+
if (is_udp(o)) {
if (!fio_netio_is_multicast(td->o.filename))
return 0;
}
#endif
+ if (set_window_size(td, fd)) {
+ close(fd);
+ return 1;
+ }
+ if (set_mss(td, fd)) {
+ close(fd);
+ return 1;
+ }
+
if (td->o.filename) {
if (!is_udp(o) || !fio_netio_is_multicast(td->o.filename)) {
log_err("fio: hostname not valid for non-multicast inbound network IO\n");
static void fio_netio_terminate(struct thread_data *td)
{
- kill(td->pid, SIGUSR2);
+ kill(td->pid, SIGTERM);
}
#ifdef CONFIG_LINUX_SPLICE