hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/net/smc/smc_wr.h
....@@ -22,7 +22,6 @@
2222 #define SMC_WR_BUF_CNT 16 /* # of ctrl buffers per link */
2323
2424 #define SMC_WR_TX_WAIT_FREE_SLOT_TIME (10 * HZ)
25
-#define SMC_WR_TX_WAIT_PENDING_TIME (5 * HZ)
2625
2726 #define SMC_WR_TX_SIZE 44 /* actual size of wr_send data (<=SMC_WR_BUF_SIZE) */
2827
....@@ -60,6 +59,30 @@
6059 atomic_long_set(wr_tx_id, val);
6160 }
6261
62
+static inline bool smc_wr_tx_link_hold(struct smc_link *link)
63
+{
64
+ if (!smc_link_sendable(link))
65
+ return false;
66
+ atomic_inc(&link->wr_tx_refcnt);
67
+ return true;
68
+}
69
+
70
+static inline void smc_wr_tx_link_put(struct smc_link *link)
71
+{
72
+ if (atomic_dec_and_test(&link->wr_tx_refcnt))
73
+ wake_up_all(&link->wr_tx_wait);
74
+}
75
+
76
+static inline void smc_wr_wakeup_tx_wait(struct smc_link *lnk)
77
+{
78
+ wake_up_all(&lnk->wr_tx_wait);
79
+}
80
+
81
+static inline void smc_wr_wakeup_reg_wait(struct smc_link *lnk)
82
+{
83
+ wake_up(&lnk->wr_reg_wait);
84
+}
85
+
6386 /* post a new receive work request to fill a completed old work request entry */
6487 static inline int smc_wr_rx_post(struct smc_link *link)
6588 {
....@@ -85,16 +108,20 @@
85108
86109 int smc_wr_tx_get_free_slot(struct smc_link *link, smc_wr_tx_handler handler,
87110 struct smc_wr_buf **wr_buf,
111
+ struct smc_rdma_wr **wrs,
88112 struct smc_wr_tx_pend_priv **wr_pend_priv);
89113 int smc_wr_tx_put_slot(struct smc_link *link,
90114 struct smc_wr_tx_pend_priv *wr_pend_priv);
91115 int smc_wr_tx_send(struct smc_link *link,
92116 struct smc_wr_tx_pend_priv *wr_pend_priv);
117
+int smc_wr_tx_send_wait(struct smc_link *link, struct smc_wr_tx_pend_priv *priv,
118
+ unsigned long timeout);
93119 void smc_wr_tx_cq_handler(struct ib_cq *ib_cq, void *cq_context);
94120 void smc_wr_tx_dismiss_slots(struct smc_link *lnk, u8 wr_rx_hdr_type,
95121 smc_wr_tx_filter filter,
96122 smc_wr_tx_dismisser dismisser,
97123 unsigned long data);
124
+void smc_wr_tx_wait_no_pending_sends(struct smc_link *link);
98125
99126 int smc_wr_rx_register_handler(struct smc_wr_rx_handler *handler);
100127 int smc_wr_rx_post_init(struct smc_link *link);