Skip to content

Commit 13543d0

Browse files
D. Wythedavem330
D. Wythe
authored andcommitted
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>
1 parent d0e3565 commit 13543d0

File tree

2 files changed

+63
-30
lines changed

2 files changed

+63
-30
lines changed

net/smc/af_smc.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ static bool smc_hs_congested(const struct sock *sk)
170170
return false;
171171
}
172172

173-
static struct smc_hashinfo smc_v4_hashinfo = {
173+
struct smc_hashinfo smc_v4_hashinfo = {
174174
.lock = __RW_LOCK_UNLOCKED(smc_v4_hashinfo.lock),
175175
};
176176

177-
static struct smc_hashinfo smc_v6_hashinfo = {
177+
struct smc_hashinfo smc_v6_hashinfo = {
178178
.lock = __RW_LOCK_UNLOCKED(smc_v6_hashinfo.lock),
179179
};
180180

181-
static int smc_hash_sk(struct sock *sk)
181+
int smc_hash_sk(struct sock *sk)
182182
{
183183
struct smc_hashinfo *h = sk->sk_prot->h.smc_hash;
184184
struct hlist_head *head;
@@ -193,7 +193,7 @@ static int smc_hash_sk(struct sock *sk)
193193
return 0;
194194
}
195195

196-
static void smc_unhash_sk(struct sock *sk)
196+
void smc_unhash_sk(struct sock *sk)
197197
{
198198
struct smc_hashinfo *h = sk->sk_prot->h.smc_hash;
199199

@@ -207,7 +207,7 @@ static void smc_unhash_sk(struct sock *sk)
207207
* work which we didn't do because of user hold the sock_lock in the
208208
* BH context
209209
*/
210-
static void smc_release_cb(struct sock *sk)
210+
void smc_release_cb(struct sock *sk)
211211
{
212212
struct smc_sock *smc = smc_sk(sk);
213213

@@ -307,7 +307,7 @@ static int __smc_release(struct smc_sock *smc)
307307
return rc;
308308
}
309309

310-
static int smc_release(struct socket *sock)
310+
int smc_release(struct socket *sock)
311311
{
312312
struct sock *sk = sock->sk;
313313
struct smc_sock *smc;
@@ -401,8 +401,8 @@ static struct sock *smc_sock_alloc(struct net *net, struct socket *sock,
401401
return sk;
402402
}
403403

404-
static int smc_bind(struct socket *sock, struct sockaddr *uaddr,
405-
int addr_len)
404+
int smc_bind(struct socket *sock, struct sockaddr *uaddr,
405+
int addr_len)
406406
{
407407
struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
408408
struct sock *sk = sock->sk;
@@ -1631,8 +1631,8 @@ static void smc_connect_work(struct work_struct *work)
16311631
release_sock(&smc->sk);
16321632
}
16331633

1634-
static int smc_connect(struct socket *sock, struct sockaddr *addr,
1635-
int alen, int flags)
1634+
int smc_connect(struct socket *sock, struct sockaddr *addr,
1635+
int alen, int flags)
16361636
{
16371637
struct sock *sk = sock->sk;
16381638
struct smc_sock *smc;
@@ -2613,7 +2613,7 @@ static void smc_clcsock_data_ready(struct sock *listen_clcsock)
26132613
read_unlock_bh(&listen_clcsock->sk_callback_lock);
26142614
}
26152615

2616-
static int smc_listen(struct socket *sock, int backlog)
2616+
int smc_listen(struct socket *sock, int backlog)
26172617
{
26182618
struct sock *sk = sock->sk;
26192619
struct smc_sock *smc;
@@ -2678,8 +2678,8 @@ static int smc_listen(struct socket *sock, int backlog)
26782678
return rc;
26792679
}
26802680

2681-
static int smc_accept(struct socket *sock, struct socket *new_sock,
2682-
struct proto_accept_arg *arg)
2681+
int smc_accept(struct socket *sock, struct socket *new_sock,
2682+
struct proto_accept_arg *arg)
26832683
{
26842684
struct sock *sk = sock->sk, *nsk;
26852685
DECLARE_WAITQUEUE(wait, current);
@@ -2748,8 +2748,8 @@ static int smc_accept(struct socket *sock, struct socket *new_sock,
27482748
return rc;
27492749
}
27502750

2751-
static int smc_getname(struct socket *sock, struct sockaddr *addr,
2752-
int peer)
2751+
int smc_getname(struct socket *sock, struct sockaddr *addr,
2752+
int peer)
27532753
{
27542754
struct smc_sock *smc;
27552755

@@ -2762,7 +2762,7 @@ static int smc_getname(struct socket *sock, struct sockaddr *addr,
27622762
return smc->clcsock->ops->getname(smc->clcsock, addr, peer);
27632763
}
27642764

2765-
static int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
2765+
int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
27662766
{
27672767
struct sock *sk = sock->sk;
27682768
struct smc_sock *smc;
@@ -2800,8 +2800,8 @@ static int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
28002800
return rc;
28012801
}
28022802

2803-
static int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
2804-
int flags)
2803+
int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
2804+
int flags)
28052805
{
28062806
struct sock *sk = sock->sk;
28072807
struct smc_sock *smc;
@@ -2850,8 +2850,8 @@ static __poll_t smc_accept_poll(struct sock *parent)
28502850
return mask;
28512851
}
28522852

2853-
static __poll_t smc_poll(struct file *file, struct socket *sock,
2854-
poll_table *wait)
2853+
__poll_t smc_poll(struct file *file, struct socket *sock,
2854+
poll_table *wait)
28552855
{
28562856
struct sock *sk = sock->sk;
28572857
struct smc_sock *smc;
@@ -2903,7 +2903,7 @@ static __poll_t smc_poll(struct file *file, struct socket *sock,
29032903
return mask;
29042904
}
29052905

2906-
static int smc_shutdown(struct socket *sock, int how)
2906+
int smc_shutdown(struct socket *sock, int how)
29072907
{
29082908
struct sock *sk = sock->sk;
29092909
bool do_shutdown = true;
@@ -3043,8 +3043,8 @@ static int __smc_setsockopt(struct socket *sock, int level, int optname,
30433043
return rc;
30443044
}
30453045

3046-
static int smc_setsockopt(struct socket *sock, int level, int optname,
3047-
sockptr_t optval, unsigned int optlen)
3046+
int smc_setsockopt(struct socket *sock, int level, int optname,
3047+
sockptr_t optval, unsigned int optlen)
30483048
{
30493049
struct sock *sk = sock->sk;
30503050
struct smc_sock *smc;
@@ -3130,8 +3130,8 @@ static int smc_setsockopt(struct socket *sock, int level, int optname,
31303130
return rc;
31313131
}
31323132

3133-
static int smc_getsockopt(struct socket *sock, int level, int optname,
3134-
char __user *optval, int __user *optlen)
3133+
int smc_getsockopt(struct socket *sock, int level, int optname,
3134+
char __user *optval, int __user *optlen)
31353135
{
31363136
struct smc_sock *smc;
31373137
int rc;
@@ -3156,8 +3156,8 @@ static int smc_getsockopt(struct socket *sock, int level, int optname,
31563156
return rc;
31573157
}
31583158

3159-
static int smc_ioctl(struct socket *sock, unsigned int cmd,
3160-
unsigned long arg)
3159+
int smc_ioctl(struct socket *sock, unsigned int cmd,
3160+
unsigned long arg)
31613161
{
31623162
union smc_host_cursor cons, urg;
31633163
struct smc_connection *conn;
@@ -3243,9 +3243,9 @@ static int smc_ioctl(struct socket *sock, unsigned int cmd,
32433243
* Note that subsequent recv() calls have to wait till all splice() processing
32443244
* completed.
32453245
*/
3246-
static ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
3247-
struct pipe_inode_info *pipe, size_t len,
3248-
unsigned int flags)
3246+
ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
3247+
struct pipe_inode_info *pipe, size_t len,
3248+
unsigned int flags)
32493249
{
32503250
struct sock *sk = sock->sk;
32513251
struct smc_sock *smc;

net/smc/smc.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,39 @@
3434
extern struct proto smc_proto;
3535
extern struct proto smc_proto6;
3636

37+
extern struct smc_hashinfo smc_v4_hashinfo;
38+
extern struct smc_hashinfo smc_v6_hashinfo;
39+
40+
int smc_hash_sk(struct sock *sk);
41+
void smc_unhash_sk(struct sock *sk);
42+
void smc_release_cb(struct sock *sk);
43+
44+
int smc_release(struct socket *sock);
45+
int smc_bind(struct socket *sock, struct sockaddr *uaddr,
46+
int addr_len);
47+
int smc_connect(struct socket *sock, struct sockaddr *addr,
48+
int alen, int flags);
49+
int smc_accept(struct socket *sock, struct socket *new_sock,
50+
struct proto_accept_arg *arg);
51+
int smc_getname(struct socket *sock, struct sockaddr *addr,
52+
int peer);
53+
__poll_t smc_poll(struct file *file, struct socket *sock,
54+
poll_table *wait);
55+
int smc_ioctl(struct socket *sock, unsigned int cmd,
56+
unsigned long arg);
57+
int smc_listen(struct socket *sock, int backlog);
58+
int smc_shutdown(struct socket *sock, int how);
59+
int smc_setsockopt(struct socket *sock, int level, int optname,
60+
sockptr_t optval, unsigned int optlen);
61+
int smc_getsockopt(struct socket *sock, int level, int optname,
62+
char __user *optval, int __user *optlen);
63+
int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len);
64+
int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
65+
int flags);
66+
ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
67+
struct pipe_inode_info *pipe, size_t len,
68+
unsigned int flags);
69+
3770
/* smc sock initialization */
3871
void smc_sk_init(struct net *net, struct sock *sk, int protocol);
3972
/* clcsock initialization */

0 commit comments

Comments
 (0)