+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
+}
+
+