blob: 5eac42fb45d06c98eaf7180c3af6bf21021a5a17 [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;
Thomas Richter6812baa2017-01-09 16:55:15 +010021
Hans Wippel64e28b52019-02-21 13:01:02 +010022/**
23 * struct smc_pnettable - SMC PNET table anchor
24 * @lock: Lock for list action
25 * @pnetlist: List of PNETIDs
26 */
27struct smc_pnettable {
28 rwlock_t lock;
29 struct list_head pnetlist;
30};
31
Ursula Braun0afff912018-06-28 19:05:05 +020032static inline int smc_pnetid_by_dev_port(struct device *dev,
33 unsigned short port, u8 *pnetid)
34{
35#if IS_ENABLED(CONFIG_HAVE_PNETID)
36 return pnet_id_by_dev_port(dev, port, pnetid);
37#else
38 return -ENOENT;
39#endif
40}
41
Thomas Richter6812baa2017-01-09 16:55:15 +010042int smc_pnet_init(void) __init;
Hans Wippel64e28b52019-02-21 13:01:02 +010043int smc_pnet_net_init(struct net *net);
Thomas Richter6812baa2017-01-09 16:55:15 +010044void smc_pnet_exit(void);
Hans Wippel64e28b52019-02-21 13:01:02 +010045void smc_pnet_net_exit(struct net *net);
Thomas Richter6812baa2017-01-09 16:55:15 +010046void smc_pnet_find_roce_resource(struct sock *sk,
Ursula Braun7005ada2018-07-25 16:35:31 +020047 struct smc_ib_device **smcibdev, u8 *ibport,
48 unsigned short vlan_id, u8 gid[]);
Hans Wippel1619f772018-06-28 19:05:08 +020049void smc_pnet_find_ism_resource(struct sock *sk, struct smcd_dev **smcismdev);
Thomas Richter6812baa2017-01-09 16:55:15 +010050
51#endif