tcp: add tcp_sock_set_nodelay

Add a helper to directly set the TCP_NODELAY sockopt from kernel space
without going through a fake uaccess.  Cleanup the callers to avoid
pointless wrappers now that this is a simple function call.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Acked-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christoph Hellwig
2020-05-28 07:12:19 +02:00
committed by David S. Miller
parent db10538a4b
commit 12abc5ee78
16 changed files with 49 additions and 127 deletions

View File

@@ -947,16 +947,8 @@ static void siw_accept_newconn(struct siw_cep *cep)
siw_cep_get(new_cep);
new_s->sk->sk_user_data = new_cep;
if (siw_tcp_nagle == false) {
int val = 1;
rv = kernel_setsockopt(new_s, SOL_TCP, TCP_NODELAY,
(char *)&val, sizeof(val));
if (rv) {
siw_dbg_cep(cep, "setsockopt NODELAY error: %d\n", rv);
goto error;
}
}
if (siw_tcp_nagle == false)
tcp_sock_set_nodelay(new_s->sk);
new_cep->state = SIW_EPSTATE_AWAIT_MPAREQ;
rv = siw_cm_queue_work(new_cep, SIW_CM_WORK_MPATIMEOUT);
@@ -1386,16 +1378,8 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params)
siw_dbg_qp(qp, "kernel_bindconnect: error %d\n", rv);
goto error;
}
if (siw_tcp_nagle == false) {
int val = 1;
rv = kernel_setsockopt(s, SOL_TCP, TCP_NODELAY, (char *)&val,
sizeof(val));
if (rv) {
siw_dbg_qp(qp, "setsockopt NODELAY error: %d\n", rv);
goto error;
}
}
if (siw_tcp_nagle == false)
tcp_sock_set_nodelay(s->sk);
cep = siw_cep_alloc(sdev);
if (!cep) {
rv = -ENOMEM;