Linux 5.1.15
[linux/fpc-iii.git] / net / smc / smc_pnet.h
blob5eac42fb45d06c98eaf7180c3af6bf21021a5a17
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;
22 /**
23 * struct smc_pnettable - SMC PNET table anchor
24 * @lock: Lock for list action
25 * @pnetlist: List of PNETIDs
27 struct smc_pnettable {
28 rwlock_t lock;
29 struct list_head pnetlist;
32 static inline int smc_pnetid_by_dev_port(struct device *dev,
33 unsigned short port, u8 *pnetid)
35 #if IS_ENABLED(CONFIG_HAVE_PNETID)
36 return pnet_id_by_dev_port(dev, port, pnetid);
37 #else
38 return -ENOENT;
39 #endif
42 int smc_pnet_init(void) __init;
43 int smc_pnet_net_init(struct net *net);
44 void smc_pnet_exit(void);
45 void smc_pnet_net_exit(struct net *net);
46 void smc_pnet_find_roce_resource(struct sock *sk,
47 struct smc_ib_device **smcibdev, u8 *ibport,
48 unsigned short vlan_id, u8 gid[]);
49 void smc_pnet_find_ism_resource(struct sock *sk, struct smcd_dev **smcismdev);
51 #endif