Ursula Braun | a4cf044 | 2017-01-09 16:55:14 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 19 | struct 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 | |
| 24 | extern struct smc_ib_devices smc_ib_devices; /* list of smc ib devices */ |
| 25 | |
| 26 | struct 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 Braun | cd6851f | 2017-01-09 16:55:18 +0100 | [diff] [blame^] | 35 | struct smc_buf_desc; |
| 36 | |
Ursula Braun | a4cf044 | 2017-01-09 16:55:14 +0100 | [diff] [blame] | 37 | int smc_ib_register_client(void) __init; |
| 38 | void smc_ib_unregister_client(void); |
| 39 | bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport); |
| 40 | int smc_ib_remember_port_attr(struct smc_ib_device *smcibdev, u8 ibport); |
Ursula Braun | cd6851f | 2017-01-09 16:55:18 +0100 | [diff] [blame^] | 41 | int 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 Braun | a4cf044 | 2017-01-09 16:55:14 +0100 | [diff] [blame] | 44 | |
| 45 | #endif |