blob: c3b61726861a75773e252d3e9ac3a42bd8353f9e [file] [log] [blame]
Ursula Brauna4cf0442017-01-09 16:55:14 +01001/*
2 * Shared Memory Communications over RDMA (SMC-R) and RoCE
3 *
4 * Definitions for IB environment
5 *
6 * Copyright IBM Corp. 2016
7 *
8 * Author(s): Ursula Braun <Ursula Braun@linux.vnet.ibm.com>
9 */
10
11#ifndef _SMC_IB_H
12#define _SMC_IB_H
13
14#include <rdma/ib_verbs.h>
15
16#define SMC_MAX_PORTS 2 /* Max # of ports */
17#define SMC_GID_SIZE sizeof(union ib_gid)
18
19struct smc_ib_devices { /* list of smc ib devices definition */
20 struct list_head list;
21 spinlock_t lock; /* protects list of smc ib devices */
22};
23
24extern struct smc_ib_devices smc_ib_devices; /* list of smc ib devices */
25
26struct smc_ib_device { /* ib-device infos for smc */
27 struct list_head list;
28 struct ib_device *ibdev;
29 struct ib_port_attr pattr[SMC_MAX_PORTS]; /* ib dev. port attrs */
30 char mac[SMC_MAX_PORTS][6]; /* mac address per port*/
31 union ib_gid gid[SMC_MAX_PORTS]; /* gid per port */
32 u8 initialized : 1; /* ib dev CQ, evthdl done */
33};
34
Ursula Brauncd6851f2017-01-09 16:55:18 +010035struct smc_buf_desc;
36
Ursula Brauna4cf0442017-01-09 16:55:14 +010037int smc_ib_register_client(void) __init;
38void smc_ib_unregister_client(void);
39bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport);
40int smc_ib_remember_port_attr(struct smc_ib_device *smcibdev, u8 ibport);
Ursula Brauncd6851f2017-01-09 16:55:18 +010041int smc_ib_buf_map(struct smc_ib_device *smcibdev, int buf_size,
42 struct smc_buf_desc *buf_slot,
43 enum dma_data_direction data_direction);
Ursula Brauna4cf0442017-01-09 16:55:14 +010044
45#endif