Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Thomas Richter | 6812baa | 2017-01-09 16:55:15 +0100 | [diff] [blame] | 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 | |
Ursula Braun | 0afff91 | 2018-06-28 19:05:05 +0200 | [diff] [blame] | 15 | #if IS_ENABLED(CONFIG_HAVE_PNETID) |
| 16 | #include <asm/pnet.h> |
| 17 | #endif |
| 18 | |
Thomas Richter | 6812baa | 2017-01-09 16:55:15 +0100 | [diff] [blame] | 19 | struct smc_ib_device; |
Hans Wippel | 1619f77 | 2018-06-28 19:05:08 +0200 | [diff] [blame] | 20 | struct smcd_dev; |
Karsten Graul | bc36d2f | 2019-04-12 12:57:26 +0200 | [diff] [blame^] | 21 | struct smc_init_info; |
Thomas Richter | 6812baa | 2017-01-09 16:55:15 +0100 | [diff] [blame] | 22 | |
Hans Wippel | 64e28b5 | 2019-02-21 13:01:02 +0100 | [diff] [blame] | 23 | /** |
| 24 | * struct smc_pnettable - SMC PNET table anchor |
| 25 | * @lock: Lock for list action |
| 26 | * @pnetlist: List of PNETIDs |
| 27 | */ |
| 28 | struct smc_pnettable { |
| 29 | rwlock_t lock; |
| 30 | struct list_head pnetlist; |
| 31 | }; |
| 32 | |
Ursula Braun | 0afff91 | 2018-06-28 19:05:05 +0200 | [diff] [blame] | 33 | static inline int smc_pnetid_by_dev_port(struct device *dev, |
| 34 | unsigned short port, u8 *pnetid) |
| 35 | { |
| 36 | #if IS_ENABLED(CONFIG_HAVE_PNETID) |
| 37 | return pnet_id_by_dev_port(dev, port, pnetid); |
| 38 | #else |
| 39 | return -ENOENT; |
| 40 | #endif |
| 41 | } |
| 42 | |
Thomas Richter | 6812baa | 2017-01-09 16:55:15 +0100 | [diff] [blame] | 43 | int smc_pnet_init(void) __init; |
Hans Wippel | 64e28b5 | 2019-02-21 13:01:02 +0100 | [diff] [blame] | 44 | int smc_pnet_net_init(struct net *net); |
Thomas Richter | 6812baa | 2017-01-09 16:55:15 +0100 | [diff] [blame] | 45 | void smc_pnet_exit(void); |
Hans Wippel | 64e28b5 | 2019-02-21 13:01:02 +0100 | [diff] [blame] | 46 | void smc_pnet_net_exit(struct net *net); |
Karsten Graul | bc36d2f | 2019-04-12 12:57:26 +0200 | [diff] [blame^] | 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); |
Thomas Richter | 6812baa | 2017-01-09 16:55:15 +0100 | [diff] [blame] | 49 | |
| 50 | #endif |