net/smc: expose smc proto operations
Externalize smc proto operations (smc_xxx) to allow access from files other than af_smc.c This is in preparation for the subsequent implementation of the AF_INET version of SMC. Signed-off-by: D. Wythe <alibuda@linux.alibaba.com> Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com> Reviewed-by: Dust Li <dust.li@linux.alibaba.com> Tested-by: Niklas Schnelle <schnelle@linux.ibm.com> Tested-by: Wenjia Zhang <wenjia@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d0e35656d8
commit
13543d02c9
@ -170,15 +170,15 @@ static bool smc_hs_congested(const struct sock *sk)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct smc_hashinfo smc_v4_hashinfo = {
|
struct smc_hashinfo smc_v4_hashinfo = {
|
||||||
.lock = __RW_LOCK_UNLOCKED(smc_v4_hashinfo.lock),
|
.lock = __RW_LOCK_UNLOCKED(smc_v4_hashinfo.lock),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct smc_hashinfo smc_v6_hashinfo = {
|
struct smc_hashinfo smc_v6_hashinfo = {
|
||||||
.lock = __RW_LOCK_UNLOCKED(smc_v6_hashinfo.lock),
|
.lock = __RW_LOCK_UNLOCKED(smc_v6_hashinfo.lock),
|
||||||
};
|
};
|
||||||
|
|
||||||
static int smc_hash_sk(struct sock *sk)
|
int smc_hash_sk(struct sock *sk)
|
||||||
{
|
{
|
||||||
struct smc_hashinfo *h = sk->sk_prot->h.smc_hash;
|
struct smc_hashinfo *h = sk->sk_prot->h.smc_hash;
|
||||||
struct hlist_head *head;
|
struct hlist_head *head;
|
||||||
@ -193,7 +193,7 @@ static int smc_hash_sk(struct sock *sk)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void smc_unhash_sk(struct sock *sk)
|
void smc_unhash_sk(struct sock *sk)
|
||||||
{
|
{
|
||||||
struct smc_hashinfo *h = sk->sk_prot->h.smc_hash;
|
struct smc_hashinfo *h = sk->sk_prot->h.smc_hash;
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ static void smc_unhash_sk(struct sock *sk)
|
|||||||
* work which we didn't do because of user hold the sock_lock in the
|
* work which we didn't do because of user hold the sock_lock in the
|
||||||
* BH context
|
* BH context
|
||||||
*/
|
*/
|
||||||
static void smc_release_cb(struct sock *sk)
|
void smc_release_cb(struct sock *sk)
|
||||||
{
|
{
|
||||||
struct smc_sock *smc = smc_sk(sk);
|
struct smc_sock *smc = smc_sk(sk);
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ static int __smc_release(struct smc_sock *smc)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_release(struct socket *sock)
|
int smc_release(struct socket *sock)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
@ -401,8 +401,8 @@ static struct sock *smc_sock_alloc(struct net *net, struct socket *sock,
|
|||||||
return sk;
|
return sk;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_bind(struct socket *sock, struct sockaddr *uaddr,
|
int smc_bind(struct socket *sock, struct sockaddr *uaddr,
|
||||||
int addr_len)
|
int addr_len)
|
||||||
{
|
{
|
||||||
struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
|
struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
@ -1631,8 +1631,8 @@ out:
|
|||||||
release_sock(&smc->sk);
|
release_sock(&smc->sk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_connect(struct socket *sock, struct sockaddr *addr,
|
int smc_connect(struct socket *sock, struct sockaddr *addr,
|
||||||
int alen, int flags)
|
int alen, int flags)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
@ -2613,7 +2613,7 @@ out:
|
|||||||
read_unlock_bh(&listen_clcsock->sk_callback_lock);
|
read_unlock_bh(&listen_clcsock->sk_callback_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_listen(struct socket *sock, int backlog)
|
int smc_listen(struct socket *sock, int backlog)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
@ -2678,8 +2678,8 @@ out:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_accept(struct socket *sock, struct socket *new_sock,
|
int smc_accept(struct socket *sock, struct socket *new_sock,
|
||||||
struct proto_accept_arg *arg)
|
struct proto_accept_arg *arg)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk, *nsk;
|
struct sock *sk = sock->sk, *nsk;
|
||||||
DECLARE_WAITQUEUE(wait, current);
|
DECLARE_WAITQUEUE(wait, current);
|
||||||
@ -2748,8 +2748,8 @@ out:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_getname(struct socket *sock, struct sockaddr *addr,
|
int smc_getname(struct socket *sock, struct sockaddr *addr,
|
||||||
int peer)
|
int peer)
|
||||||
{
|
{
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
|
|
||||||
@ -2762,7 +2762,7 @@ static int smc_getname(struct socket *sock, struct sockaddr *addr,
|
|||||||
return smc->clcsock->ops->getname(smc->clcsock, addr, peer);
|
return smc->clcsock->ops->getname(smc->clcsock, addr, peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
|
int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
@ -2800,8 +2800,8 @@ out:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
|
int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
@ -2850,8 +2850,8 @@ static __poll_t smc_accept_poll(struct sock *parent)
|
|||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __poll_t smc_poll(struct file *file, struct socket *sock,
|
__poll_t smc_poll(struct file *file, struct socket *sock,
|
||||||
poll_table *wait)
|
poll_table *wait)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
@ -2903,7 +2903,7 @@ static __poll_t smc_poll(struct file *file, struct socket *sock,
|
|||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_shutdown(struct socket *sock, int how)
|
int smc_shutdown(struct socket *sock, int how)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
bool do_shutdown = true;
|
bool do_shutdown = true;
|
||||||
@ -3043,8 +3043,8 @@ static int __smc_setsockopt(struct socket *sock, int level, int optname,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_setsockopt(struct socket *sock, int level, int optname,
|
int smc_setsockopt(struct socket *sock, int level, int optname,
|
||||||
sockptr_t optval, unsigned int optlen)
|
sockptr_t optval, unsigned int optlen)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
@ -3130,8 +3130,8 @@ out:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_getsockopt(struct socket *sock, int level, int optname,
|
int smc_getsockopt(struct socket *sock, int level, int optname,
|
||||||
char __user *optval, int __user *optlen)
|
char __user *optval, int __user *optlen)
|
||||||
{
|
{
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
int rc;
|
int rc;
|
||||||
@ -3156,8 +3156,8 @@ static int smc_getsockopt(struct socket *sock, int level, int optname,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smc_ioctl(struct socket *sock, unsigned int cmd,
|
int smc_ioctl(struct socket *sock, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
union smc_host_cursor cons, urg;
|
union smc_host_cursor cons, urg;
|
||||||
struct smc_connection *conn;
|
struct smc_connection *conn;
|
||||||
@ -3243,9 +3243,9 @@ static int smc_ioctl(struct socket *sock, unsigned int cmd,
|
|||||||
* Note that subsequent recv() calls have to wait till all splice() processing
|
* Note that subsequent recv() calls have to wait till all splice() processing
|
||||||
* completed.
|
* completed.
|
||||||
*/
|
*/
|
||||||
static ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
|
ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
|
||||||
struct pipe_inode_info *pipe, size_t len,
|
struct pipe_inode_info *pipe, size_t len,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct smc_sock *smc;
|
struct smc_sock *smc;
|
||||||
|
@ -34,6 +34,39 @@
|
|||||||
extern struct proto smc_proto;
|
extern struct proto smc_proto;
|
||||||
extern struct proto smc_proto6;
|
extern struct proto smc_proto6;
|
||||||
|
|
||||||
|
extern struct smc_hashinfo smc_v4_hashinfo;
|
||||||
|
extern struct smc_hashinfo smc_v6_hashinfo;
|
||||||
|
|
||||||
|
int smc_hash_sk(struct sock *sk);
|
||||||
|
void smc_unhash_sk(struct sock *sk);
|
||||||
|
void smc_release_cb(struct sock *sk);
|
||||||
|
|
||||||
|
int smc_release(struct socket *sock);
|
||||||
|
int smc_bind(struct socket *sock, struct sockaddr *uaddr,
|
||||||
|
int addr_len);
|
||||||
|
int smc_connect(struct socket *sock, struct sockaddr *addr,
|
||||||
|
int alen, int flags);
|
||||||
|
int smc_accept(struct socket *sock, struct socket *new_sock,
|
||||||
|
struct proto_accept_arg *arg);
|
||||||
|
int smc_getname(struct socket *sock, struct sockaddr *addr,
|
||||||
|
int peer);
|
||||||
|
__poll_t smc_poll(struct file *file, struct socket *sock,
|
||||||
|
poll_table *wait);
|
||||||
|
int smc_ioctl(struct socket *sock, unsigned int cmd,
|
||||||
|
unsigned long arg);
|
||||||
|
int smc_listen(struct socket *sock, int backlog);
|
||||||
|
int smc_shutdown(struct socket *sock, int how);
|
||||||
|
int smc_setsockopt(struct socket *sock, int level, int optname,
|
||||||
|
sockptr_t optval, unsigned int optlen);
|
||||||
|
int smc_getsockopt(struct socket *sock, int level, int optname,
|
||||||
|
char __user *optval, int __user *optlen);
|
||||||
|
int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len);
|
||||||
|
int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
|
||||||
|
int flags);
|
||||||
|
ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
|
||||||
|
struct pipe_inode_info *pipe, size_t len,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
/* smc sock initialization */
|
/* smc sock initialization */
|
||||||
void smc_sk_init(struct net *net, struct sock *sk, int protocol);
|
void smc_sk_init(struct net *net, struct sock *sk, int protocol);
|
||||||
/* clcsock initialization */
|
/* clcsock initialization */
|
||||||
|
Loading…
Reference in New Issue
Block a user