.. | .. |
---|
22 | 22 | #define SMC_WR_BUF_CNT 16 /* # of ctrl buffers per link */ |
---|
23 | 23 | |
---|
24 | 24 | #define SMC_WR_TX_WAIT_FREE_SLOT_TIME (10 * HZ) |
---|
25 | | -#define SMC_WR_TX_WAIT_PENDING_TIME (5 * HZ) |
---|
26 | 25 | |
---|
27 | 26 | #define SMC_WR_TX_SIZE 44 /* actual size of wr_send data (<=SMC_WR_BUF_SIZE) */ |
---|
28 | 27 | |
---|
.. | .. |
---|
60 | 59 | atomic_long_set(wr_tx_id, val); |
---|
61 | 60 | } |
---|
62 | 61 | |
---|
| 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 | + |
---|
63 | 86 | /* post a new receive work request to fill a completed old work request entry */ |
---|
64 | 87 | static inline int smc_wr_rx_post(struct smc_link *link) |
---|
65 | 88 | { |
---|
.. | .. |
---|
85 | 108 | |
---|
86 | 109 | int smc_wr_tx_get_free_slot(struct smc_link *link, smc_wr_tx_handler handler, |
---|
87 | 110 | struct smc_wr_buf **wr_buf, |
---|
| 111 | + struct smc_rdma_wr **wrs, |
---|
88 | 112 | struct smc_wr_tx_pend_priv **wr_pend_priv); |
---|
89 | 113 | int smc_wr_tx_put_slot(struct smc_link *link, |
---|
90 | 114 | struct smc_wr_tx_pend_priv *wr_pend_priv); |
---|
91 | 115 | int smc_wr_tx_send(struct smc_link *link, |
---|
92 | 116 | 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); |
---|
93 | 119 | void smc_wr_tx_cq_handler(struct ib_cq *ib_cq, void *cq_context); |
---|
94 | 120 | void smc_wr_tx_dismiss_slots(struct smc_link *lnk, u8 wr_rx_hdr_type, |
---|
95 | 121 | smc_wr_tx_filter filter, |
---|
96 | 122 | smc_wr_tx_dismisser dismisser, |
---|
97 | 123 | unsigned long data); |
---|
| 124 | +void smc_wr_tx_wait_no_pending_sends(struct smc_link *link); |
---|
98 | 125 | |
---|
99 | 126 | int smc_wr_rx_register_handler(struct smc_wr_rx_handler *handler); |
---|
100 | 127 | int smc_wr_rx_post_init(struct smc_link *link); |
---|