| .. | .. |
|---|
| 14 | 14 | |
|---|
| 15 | 15 | #include <linux/interrupt.h> |
|---|
| 16 | 16 | #include <linux/if_ether.h> |
|---|
| 17 | +#include <linux/mutex.h> |
|---|
| 18 | +#include <linux/wait.h> |
|---|
| 17 | 19 | #include <rdma/ib_verbs.h> |
|---|
| 18 | 20 | #include <net/smc.h> |
|---|
| 19 | 21 | |
|---|
| .. | .. |
|---|
| 24 | 26 | |
|---|
| 25 | 27 | struct smc_ib_devices { /* list of smc ib devices definition */ |
|---|
| 26 | 28 | struct list_head list; |
|---|
| 27 | | - spinlock_t lock; /* protects list of smc ib devices */ |
|---|
| 29 | + struct mutex mutex; /* protects list of smc ib devices */ |
|---|
| 28 | 30 | }; |
|---|
| 29 | 31 | |
|---|
| 30 | 32 | extern struct smc_ib_devices smc_ib_devices; /* list of smc ib devices */ |
|---|
| .. | .. |
|---|
| 42 | 44 | /* mac address per port*/ |
|---|
| 43 | 45 | u8 pnetid[SMC_MAX_PORTS][SMC_MAX_PNETID_LEN]; |
|---|
| 44 | 46 | /* pnetid per port */ |
|---|
| 47 | + bool pnetid_by_user[SMC_MAX_PORTS]; |
|---|
| 48 | + /* pnetid defined by user? */ |
|---|
| 45 | 49 | u8 initialized : 1; /* ib dev CQ, evthdl done */ |
|---|
| 46 | 50 | struct work_struct port_event_work; |
|---|
| 47 | 51 | unsigned long port_event_mask; |
|---|
| 52 | + DECLARE_BITMAP(ports_going_away, SMC_MAX_PORTS); |
|---|
| 53 | + atomic_t lnk_cnt; /* number of links on ibdev */ |
|---|
| 54 | + wait_queue_head_t lnks_deleted; /* wait 4 removal of all links*/ |
|---|
| 55 | + struct mutex mutex; /* protect dev setup+cleanup */ |
|---|
| 48 | 56 | }; |
|---|
| 49 | 57 | |
|---|
| 50 | 58 | struct smc_buf_desc; |
|---|
| .. | .. |
|---|
| 53 | 61 | int smc_ib_register_client(void) __init; |
|---|
| 54 | 62 | void smc_ib_unregister_client(void); |
|---|
| 55 | 63 | bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport); |
|---|
| 56 | | -int smc_ib_buf_map_sg(struct smc_ib_device *smcibdev, |
|---|
| 64 | +int smc_ib_buf_map_sg(struct smc_link *lnk, |
|---|
| 57 | 65 | struct smc_buf_desc *buf_slot, |
|---|
| 58 | 66 | enum dma_data_direction data_direction); |
|---|
| 59 | | -void smc_ib_buf_unmap_sg(struct smc_ib_device *smcibdev, |
|---|
| 67 | +void smc_ib_buf_unmap_sg(struct smc_link *lnk, |
|---|
| 60 | 68 | struct smc_buf_desc *buf_slot, |
|---|
| 61 | 69 | enum dma_data_direction data_direction); |
|---|
| 62 | 70 | void smc_ib_dealloc_protection_domain(struct smc_link *lnk); |
|---|
| .. | .. |
|---|
| 66 | 74 | int smc_ib_ready_link(struct smc_link *lnk); |
|---|
| 67 | 75 | int smc_ib_modify_qp_rts(struct smc_link *lnk); |
|---|
| 68 | 76 | int smc_ib_modify_qp_reset(struct smc_link *lnk); |
|---|
| 77 | +int smc_ib_modify_qp_error(struct smc_link *lnk); |
|---|
| 69 | 78 | long smc_ib_setup_per_ibdev(struct smc_ib_device *smcibdev); |
|---|
| 70 | 79 | int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags, |
|---|
| 71 | | - struct smc_buf_desc *buf_slot); |
|---|
| 80 | + struct smc_buf_desc *buf_slot, u8 link_idx); |
|---|
| 72 | 81 | void smc_ib_put_memory_region(struct ib_mr *mr); |
|---|
| 73 | | -void smc_ib_sync_sg_for_cpu(struct smc_ib_device *smcibdev, |
|---|
| 82 | +void smc_ib_sync_sg_for_cpu(struct smc_link *lnk, |
|---|
| 74 | 83 | struct smc_buf_desc *buf_slot, |
|---|
| 75 | 84 | enum dma_data_direction data_direction); |
|---|
| 76 | | -void smc_ib_sync_sg_for_device(struct smc_ib_device *smcibdev, |
|---|
| 85 | +void smc_ib_sync_sg_for_device(struct smc_link *lnk, |
|---|
| 77 | 86 | struct smc_buf_desc *buf_slot, |
|---|
| 78 | 87 | enum dma_data_direction data_direction); |
|---|
| 79 | 88 | int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport, |
|---|
| 80 | 89 | unsigned short vlan_id, u8 gid[], u8 *sgid_index); |
|---|
| 90 | +bool smc_ib_is_valid_local_systemid(void); |
|---|
| 81 | 91 | #endif |
|---|