1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Shared Memory Communications over RDMA (SMC-R) and RoCE 4 * 5 * PNET table queries 6 * 7 * Copyright IBM Corp. 2016 8 * 9 * Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com> 10 */ 11 12 #ifndef _SMC_PNET_H 13 #define _SMC_PNET_H 14 15 #if IS_ENABLED(CONFIG_HAVE_PNETID) 16 #include <asm/pnet.h> 17 #endif 18 19 struct smc_ib_device; 20 struct smcd_dev; 21 struct smc_init_info; 22 struct smc_link_group; 23 24 /** 25 * struct smc_pnettable - SMC PNET table anchor 26 * @lock: Lock for list action 27 * @pnetlist: List of PNETIDs 28 */ 29 struct smc_pnettable { 30 rwlock_t lock; 31 struct list_head pnetlist; 32 }; 33 34 static inline int smc_pnetid_by_dev_port(struct device *dev, 35 unsigned short port, u8 *pnetid) 36 { 37 #if IS_ENABLED(CONFIG_HAVE_PNETID) 38 return pnet_id_by_dev_port(dev, port, pnetid); 39 #else 40 return -ENOENT; 41 #endif 42 } 43 44 int smc_pnet_init(void) __init; 45 int smc_pnet_net_init(struct net *net); 46 void smc_pnet_exit(void); 47 void smc_pnet_net_exit(struct net *net); 48 void smc_pnet_find_roce_resource(struct sock *sk, struct smc_init_info *ini); 49 void smc_pnet_find_ism_resource(struct sock *sk, struct smc_init_info *ini); 50 int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port); 51 int smc_pnetid_by_table_smcd(struct smcd_dev *smcd); 52 void smc_pnet_find_alt_roce(struct smc_link_group *lgr, 53 struct smc_init_info *ini, 54 struct smc_ib_device *known_dev); 55 #endif 56