summaryrefslogtreecommitdiff
path: root/net/smc/af_smc.c
diff options
context:
space:
mode:
authorUrsula Braun <ubraun@linux.ibm.com>2018-04-26 18:18:22 +0300
committerDavid S. Miller <davem@davemloft.net>2018-04-27 21:02:52 +0300
commit01d2f7e2cdd31becffafa0cb82809a5e36558ec0 (patch)
tree5df8e8f6838478e51efe14206d17a522cda03ed5 /net/smc/af_smc.c
parentee9dfbef02d186a90f3a4876b276701966a92d10 (diff)
downloadlinux-01d2f7e2cdd31becffafa0cb82809a5e36558ec0.tar.xz
net/smc: sockopts TCP_NODELAY and TCP_CORK
Setting sockopt TCP_NODELAY or resetting sockopt TCP_CORK triggers data transfer. For a corked SMC socket RDMA writes are deferred, if there is still sufficient send buffer space available. Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/af_smc.c')
-rw-r--r--net/smc/af_smc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index d274be7265ea..9d8b381281e3 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1291,7 +1291,7 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
{
struct sock *sk = sock->sk;
struct smc_sock *smc;
- int rc;
+ int val, rc;
smc = smc_sk(sk);
@@ -1307,6 +1307,10 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
if (rc)
return rc;
+ if (optlen < sizeof(int))
+ return rc;
+ get_user(val, (int __user *)optval);
+
lock_sock(sk);
switch (optname) {
case TCP_ULP:
@@ -1322,6 +1326,20 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
rc = -EINVAL;
}
break;
+ case TCP_NODELAY:
+ if (sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) {
+ if (val)
+ mod_delayed_work(system_wq, &smc->conn.tx_work,
+ 0);
+ }
+ break;
+ case TCP_CORK:
+ if (sk->sk_state != SMC_INIT && sk->sk_state != SMC_LISTEN) {
+ if (!val)
+ mod_delayed_work(system_wq, &smc->conn.tx_work,
+ 0);
+ }
+ break;
default:
break;
}