Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Shared Memory Communications over RDMA (SMC-R) and RoCE
0004  *
0005  *  PNET table queries
0006  *
0007  *  Copyright IBM Corp. 2016
0008  *
0009  *  Author(s):  Thomas Richter <tmricht@linux.vnet.ibm.com>
0010  */
0011 
0012 #ifndef _SMC_PNET_H
0013 #define _SMC_PNET_H
0014 
0015 #include <net/smc.h>
0016 
0017 #if IS_ENABLED(CONFIG_HAVE_PNETID)
0018 #include <asm/pnet.h>
0019 #endif
0020 
0021 struct smc_ib_device;
0022 struct smcd_dev;
0023 struct smc_init_info;
0024 struct smc_link_group;
0025 
0026 /**
0027  * struct smc_pnettable - SMC PNET table anchor
0028  * @lock: Lock for list action
0029  * @pnetlist: List of PNETIDs
0030  */
0031 struct smc_pnettable {
0032     struct mutex lock;
0033     struct list_head pnetlist;
0034 };
0035 
0036 struct smc_pnetids_ndev {   /* list of pnetids for net devices in UP state*/
0037     struct list_head    list;
0038     rwlock_t        lock;
0039 };
0040 
0041 struct smc_pnetids_ndev_entry {
0042     struct list_head    list;
0043     u8          pnetid[SMC_MAX_PNETID_LEN];
0044     refcount_t      refcnt;
0045 };
0046 
0047 static inline int smc_pnetid_by_dev_port(struct device *dev,
0048                      unsigned short port, u8 *pnetid)
0049 {
0050 #if IS_ENABLED(CONFIG_HAVE_PNETID)
0051     return pnet_id_by_dev_port(dev, port, pnetid);
0052 #else
0053     return -ENOENT;
0054 #endif
0055 }
0056 
0057 int smc_pnet_init(void) __init;
0058 int smc_pnet_net_init(struct net *net);
0059 void smc_pnet_exit(void);
0060 void smc_pnet_net_exit(struct net *net);
0061 void smc_pnet_find_roce_resource(struct sock *sk, struct smc_init_info *ini);
0062 void smc_pnet_find_ism_resource(struct sock *sk, struct smc_init_info *ini);
0063 int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port);
0064 int smc_pnetid_by_table_smcd(struct smcd_dev *smcd);
0065 void smc_pnet_find_alt_roce(struct smc_link_group *lgr,
0066                 struct smc_init_info *ini,
0067                 struct smc_ib_device *known_dev);
0068 bool smc_pnet_is_ndev_pnetid(struct net *net, u8 *pnetid);
0069 bool smc_pnet_is_pnetid_set(u8 *pnetid);
0070 #endif