diff options
author | Stefan Raspl <raspl@linux.ibm.com> | 2018-05-23 17:38:11 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-23 23:02:35 +0300 |
commit | de8474eb9d50fd47b8c73816f34739dec5e96754 (patch) | |
tree | 4d8c4d02508896fefba4c7172162ebf1b8333798 /net/smc/af_smc.c | |
parent | b9f227c37071d1115cec791b328b684e2c4ba414 (diff) | |
download | linux-de8474eb9d50fd47b8c73816f34739dec5e96754.tar.xz |
net/smc: urgent data support
Add support for out of band data send and receive.
Signed-off-by: Stefan Raspl <raspl@linux.ibm.com>
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.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index f2d925921d81..2c369d4bb1c1 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -8,8 +8,6 @@ * * Initial restrictions: * - support for alternate links postponed - * - partial support for non-blocking sockets only - * - support for urgent data postponed * * Copyright IBM Corp. 2016, 2018 * @@ -1338,6 +1336,8 @@ static __poll_t smc_poll(struct file *file, struct socket *sock, if (sk->sk_state == SMC_APPCLOSEWAIT1) mask |= EPOLLIN; } + if (smc->conn.urg_state == SMC_URG_VALID) + mask |= EPOLLPRI; } release_sock(sk); @@ -1477,10 +1477,13 @@ static int smc_getsockopt(struct socket *sock, int level, int optname, static int smc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { + union smc_host_cursor cons, urg; + struct smc_connection *conn; struct smc_sock *smc; int answ; smc = smc_sk(sock->sk); + conn = &smc->conn; if (smc->use_fallback) { if (!smc->clcsock) return -EBADF; @@ -1517,6 +1520,23 @@ static int smc_ioctl(struct socket *sock, unsigned int cmd, else answ = smc_tx_prepared_sends(&smc->conn); break; + case SIOCATMARK: + if (smc->sk.sk_state == SMC_LISTEN) + return -EINVAL; + if (smc->sk.sk_state == SMC_INIT || + smc->sk.sk_state == SMC_CLOSED) { + answ = 0; + } else { + smc_curs_write(&cons, + smc_curs_read(&conn->local_tx_ctrl.cons, conn), + conn); + smc_curs_write(&urg, + smc_curs_read(&conn->urg_curs, conn), + conn); + answ = smc_curs_diff(conn->rmb_desc->len, + &cons, &urg) == 1; + } + break; default: return -ENOIOCTLCMD; } |