blob: 811a659866918721c750ef753a0473f090c3df6b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Thomas Richter6812baa2017-01-09 16:55:15 +01002/*
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 Braun0afff912018-06-28 19:05:05 +020015#if IS_ENABLED(CONFIG_HAVE_PNETID)
16#include <asm/pnet.h>
17#endif
18
Thomas Richter6812baa2017-01-09 16:55:15 +010019struct smc_ib_device;
Hans Wippel1619f772018-06-28 19:05:08 +020020struct smcd_dev;
Karsten Graulbc36d2f2019-04-12 12:57:26 +020021struct smc_init_info;
Karsten Graul6c868a32020-05-01 12:48:11 +020022struct smc_link_group;
Thomas Richter6812baa2017-01-09 16:55:15 +010023
Hans Wippel64e28b52019-02-21 13:01:02 +010024/**
25 * struct smc_pnettable - SMC PNET table anchor
26 * @lock: Lock for list action
27 * @pnetlist: List of PNETIDs
28 */
29struct smc_pnettable {
30 rwlock_t lock;
31 struct list_head pnetlist;
32};
33
Ursula Braun0afff912018-06-28 19:05:05 +020034static 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
Thomas Richter6812baa2017-01-09 16:55:15 +010044int smc_pnet_init(void) __init;
Hans Wippel64e28b52019-02-21 13:01:02 +010045int smc_pnet_net_init(struct net *net);
Thomas Richter6812baa2017-01-09 16:55:15 +010046void smc_pnet_exit(void);
Hans Wippel64e28b52019-02-21 13:01:02 +010047void smc_pnet_net_exit(struct net *net);
Karsten Graulbc36d2f2019-04-12 12:57:26 +020048void smc_pnet_find_roce_resource(struct sock *sk, struct smc_init_info *ini);
49void smc_pnet_find_ism_resource(struct sock *sk, struct smc_init_info *ini);
Karsten Graulfdff7042020-04-29 17:10:37 +020050int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port);
51int smc_pnetid_by_table_smcd(struct smcd_dev *smcd);
Karsten Graul6c868a32020-05-01 12:48:11 +020052void smc_pnet_find_alt_roce(struct smc_link_group *lgr,
53 struct smc_init_info *ini,
54 struct smc_ib_device *known_dev);
Thomas Richter6812baa2017-01-09 16:55:15 +010055#endif