Linux 5.7.7
[linux/fpc-iii.git] / net / smc / smc_pnet.h
blob4564e4d69c2e563d3c519434f01c4fb203781242
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Shared Memory Communications over RDMA (SMC-R) and RoCE
5 * PNET table queries
7 * Copyright IBM Corp. 2016
9 * Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com>
12 #ifndef _SMC_PNET_H
13 #define _SMC_PNET_H
15 #if IS_ENABLED(CONFIG_HAVE_PNETID)
16 #include <asm/pnet.h>
17 #endif
19 struct smc_ib_device;
20 struct smcd_dev;
21 struct smc_init_info;
23 /**
24 * struct smc_pnettable - SMC PNET table anchor
25 * @lock: Lock for list action
26 * @pnetlist: List of PNETIDs
28 struct smc_pnettable {
29 rwlock_t lock;
30 struct list_head pnetlist;
33 static inline int smc_pnetid_by_dev_port(struct device *dev,
34 unsigned short port, u8 *pnetid)
36 #if IS_ENABLED(CONFIG_HAVE_PNETID)
37 return pnet_id_by_dev_port(dev, port, pnetid);
38 #else
39 return -ENOENT;
40 #endif
43 int smc_pnet_init(void) __init;
44 int smc_pnet_net_init(struct net *net);
45 void smc_pnet_exit(void);
46 void smc_pnet_net_exit(struct net *net);
47 void smc_pnet_find_roce_resource(struct sock *sk, struct smc_init_info *ini);
48 void smc_pnet_find_ism_resource(struct sock *sk, struct smc_init_info *ini);
50 #endif