hc
2024-05-10 10ebd8556b7990499c896a550e3d416b444211e6
kernel/net/smc/smc_ib.h
....@@ -14,6 +14,8 @@
1414
1515 #include <linux/interrupt.h>
1616 #include <linux/if_ether.h>
17
+#include <linux/mutex.h>
18
+#include <linux/wait.h>
1719 #include <rdma/ib_verbs.h>
1820 #include <net/smc.h>
1921
....@@ -24,7 +26,7 @@
2426
2527 struct smc_ib_devices { /* list of smc ib devices definition */
2628 struct list_head list;
27
- spinlock_t lock; /* protects list of smc ib devices */
29
+ struct mutex mutex; /* protects list of smc ib devices */
2830 };
2931
3032 extern struct smc_ib_devices smc_ib_devices; /* list of smc ib devices */
....@@ -42,9 +44,15 @@
4244 /* mac address per port*/
4345 u8 pnetid[SMC_MAX_PORTS][SMC_MAX_PNETID_LEN];
4446 /* pnetid per port */
47
+ bool pnetid_by_user[SMC_MAX_PORTS];
48
+ /* pnetid defined by user? */
4549 u8 initialized : 1; /* ib dev CQ, evthdl done */
4650 struct work_struct port_event_work;
4751 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 */
4856 };
4957
5058 struct smc_buf_desc;
....@@ -53,10 +61,10 @@
5361 int smc_ib_register_client(void) __init;
5462 void smc_ib_unregister_client(void);
5563 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,
5765 struct smc_buf_desc *buf_slot,
5866 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,
6068 struct smc_buf_desc *buf_slot,
6169 enum dma_data_direction data_direction);
6270 void smc_ib_dealloc_protection_domain(struct smc_link *lnk);
....@@ -66,16 +74,18 @@
6674 int smc_ib_ready_link(struct smc_link *lnk);
6775 int smc_ib_modify_qp_rts(struct smc_link *lnk);
6876 int smc_ib_modify_qp_reset(struct smc_link *lnk);
77
+int smc_ib_modify_qp_error(struct smc_link *lnk);
6978 long smc_ib_setup_per_ibdev(struct smc_ib_device *smcibdev);
7079 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);
7281 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,
7483 struct smc_buf_desc *buf_slot,
7584 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,
7786 struct smc_buf_desc *buf_slot,
7887 enum dma_data_direction data_direction);
7988 int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
8089 unsigned short vlan_id, u8 gid[], u8 *sgid_index);
90
+bool smc_ib_is_valid_local_systemid(void);
8191 #endif