• Home
  • Raw
  • Download

Lines Matching full:link

17  * SMC uses this to exchange LLC (link layer control)
44 struct smc_link *link; member
53 static inline int smc_wr_tx_find_pending_index(struct smc_link *link, u64 wr_id) in smc_wr_tx_find_pending_index() argument
57 for (i = 0; i < link->wr_tx_cnt; i++) { in smc_wr_tx_find_pending_index()
58 if (link->wr_tx_pends[i].wr_id == wr_id) in smc_wr_tx_find_pending_index()
61 return link->wr_tx_cnt; in smc_wr_tx_find_pending_index()
67 struct smc_link *link; in smc_wr_tx_process_cqe() local
71 link = wc->qp->qp_context; in smc_wr_tx_process_cqe()
75 link->wr_reg_state = FAILED; in smc_wr_tx_process_cqe()
77 link->wr_reg_state = CONFIRMED; in smc_wr_tx_process_cqe()
78 wake_up(&link->wr_reg_wait); in smc_wr_tx_process_cqe()
82 pnd_snd_idx = smc_wr_tx_find_pending_index(link, wc->wr_id); in smc_wr_tx_process_cqe()
83 if (pnd_snd_idx == link->wr_tx_cnt) in smc_wr_tx_process_cqe()
85 link->wr_tx_pends[pnd_snd_idx].wc_status = wc->status; in smc_wr_tx_process_cqe()
86 memcpy(&pnd_snd, &link->wr_tx_pends[pnd_snd_idx], sizeof(pnd_snd)); in smc_wr_tx_process_cqe()
88 memset(&link->wr_tx_pends[pnd_snd_idx], 0, in smc_wr_tx_process_cqe()
89 sizeof(link->wr_tx_pends[pnd_snd_idx])); in smc_wr_tx_process_cqe()
90 memset(&link->wr_tx_bufs[pnd_snd_idx], 0, in smc_wr_tx_process_cqe()
91 sizeof(link->wr_tx_bufs[pnd_snd_idx])); in smc_wr_tx_process_cqe()
92 if (!test_and_clear_bit(pnd_snd_idx, link->wr_tx_mask)) in smc_wr_tx_process_cqe()
95 for_each_set_bit(i, link->wr_tx_mask, link->wr_tx_cnt) { in smc_wr_tx_process_cqe()
97 memset(&link->wr_tx_pends[i], 0, in smc_wr_tx_process_cqe()
98 sizeof(link->wr_tx_pends[i])); in smc_wr_tx_process_cqe()
99 memset(&link->wr_tx_bufs[i], 0, in smc_wr_tx_process_cqe()
100 sizeof(link->wr_tx_bufs[i])); in smc_wr_tx_process_cqe()
101 clear_bit(i, link->wr_tx_mask); in smc_wr_tx_process_cqe()
103 /* terminate connections of this link group abnormally */ in smc_wr_tx_process_cqe()
104 smc_lgr_terminate(smc_get_lgr(link)); in smc_wr_tx_process_cqe()
107 pnd_snd.handler(&pnd_snd.priv, link, wc->status); in smc_wr_tx_process_cqe()
108 wake_up(&link->wr_tx_wait); in smc_wr_tx_process_cqe()
146 static inline int smc_wr_tx_get_free_slot_index(struct smc_link *link, u32 *idx) in smc_wr_tx_get_free_slot_index() argument
148 *idx = link->wr_tx_cnt; in smc_wr_tx_get_free_slot_index()
149 for_each_clear_bit(*idx, link->wr_tx_mask, link->wr_tx_cnt) { in smc_wr_tx_get_free_slot_index()
150 if (!test_and_set_bit(*idx, link->wr_tx_mask)) in smc_wr_tx_get_free_slot_index()
153 *idx = link->wr_tx_cnt; in smc_wr_tx_get_free_slot_index()
160 * @link: Pointer to smc_link used to later send the message.
167 int smc_wr_tx_get_free_slot(struct smc_link *link, in smc_wr_tx_get_free_slot() argument
173 u32 idx = link->wr_tx_cnt; in smc_wr_tx_get_free_slot()
181 rc = smc_wr_tx_get_free_slot_index(link, &idx); in smc_wr_tx_get_free_slot()
186 link->wr_tx_wait, in smc_wr_tx_get_free_slot()
187 link->state == SMC_LNK_INACTIVE || in smc_wr_tx_get_free_slot()
188 (smc_wr_tx_get_free_slot_index(link, &idx) != -EBUSY), in smc_wr_tx_get_free_slot()
192 smc_lgr_terminate(smc_get_lgr(link)); in smc_wr_tx_get_free_slot()
195 if (idx == link->wr_tx_cnt) in smc_wr_tx_get_free_slot()
198 wr_id = smc_wr_tx_get_next_wr_id(link); in smc_wr_tx_get_free_slot()
199 wr_pend = &link->wr_tx_pends[idx]; in smc_wr_tx_get_free_slot()
202 wr_pend->link = link; in smc_wr_tx_get_free_slot()
204 wr_ib = &link->wr_tx_ibs[idx]; in smc_wr_tx_get_free_slot()
206 *wr_buf = &link->wr_tx_bufs[idx]; in smc_wr_tx_get_free_slot()
211 int smc_wr_tx_put_slot(struct smc_link *link, in smc_wr_tx_put_slot() argument
217 if (pend->idx < link->wr_tx_cnt) { in smc_wr_tx_put_slot()
221 memset(&link->wr_tx_pends[pend->idx], 0, in smc_wr_tx_put_slot()
222 sizeof(link->wr_tx_pends[pend->idx])); in smc_wr_tx_put_slot()
223 memset(&link->wr_tx_bufs[pend->idx], 0, in smc_wr_tx_put_slot()
224 sizeof(link->wr_tx_bufs[pend->idx])); in smc_wr_tx_put_slot()
225 test_and_clear_bit(idx, link->wr_tx_mask); in smc_wr_tx_put_slot()
235 int smc_wr_tx_send(struct smc_link *link, struct smc_wr_tx_pend_priv *priv) in smc_wr_tx_send() argument
240 ib_req_notify_cq(link->smcibdev->roce_cq_send, in smc_wr_tx_send()
243 rc = ib_post_send(link->roce_qp, &link->wr_tx_ibs[pend->idx], NULL); in smc_wr_tx_send()
245 smc_wr_tx_put_slot(link, priv); in smc_wr_tx_send()
246 smc_lgr_terminate(smc_get_lgr(link)); in smc_wr_tx_send()
252 int smc_wr_reg_send(struct smc_link *link, struct ib_mr *mr) in smc_wr_reg_send() argument
256 ib_req_notify_cq(link->smcibdev->roce_cq_send, in smc_wr_reg_send()
258 link->wr_reg_state = POSTED; in smc_wr_reg_send()
259 link->wr_reg.wr.wr_id = (u64)(uintptr_t)mr; in smc_wr_reg_send()
260 link->wr_reg.mr = mr; in smc_wr_reg_send()
261 link->wr_reg.key = mr->rkey; in smc_wr_reg_send()
262 rc = ib_post_send(link->roce_qp, &link->wr_reg.wr, NULL); in smc_wr_reg_send()
266 rc = wait_event_interruptible_timeout(link->wr_reg_wait, in smc_wr_reg_send()
267 (link->wr_reg_state != POSTED), in smc_wr_reg_send()
271 smc_lgr_terminate(smc_get_lgr(link)); in smc_wr_reg_send()
276 switch (link->wr_reg_state) { in smc_wr_reg_send()
290 void smc_wr_tx_dismiss_slots(struct smc_link *link, u8 wr_tx_hdr_type, in smc_wr_tx_dismiss_slots() argument
299 for_each_set_bit(i, link->wr_tx_mask, link->wr_tx_cnt) { in smc_wr_tx_dismiss_slots()
300 wr_tx = (struct smc_wr_rx_hdr *)&link->wr_tx_bufs[i]; in smc_wr_tx_dismiss_slots()
303 tx_pend = &link->wr_tx_pends[i].priv; in smc_wr_tx_dismiss_slots()
335 struct smc_link *link = (struct smc_link *)wc->qp->qp_context; in smc_wr_rx_demultiplex() local
344 index = do_div(temp_wr_id, link->wr_rx_cnt); in smc_wr_rx_demultiplex()
345 wr_rx = (struct smc_wr_rx_hdr *)&link->wr_rx_bufs[index]; in smc_wr_rx_demultiplex()
354 struct smc_link *link; in smc_wr_rx_process_cqes() local
358 link = wc[i].qp->qp_context; in smc_wr_rx_process_cqes()
360 link->wr_rx_tstamp = jiffies; in smc_wr_rx_process_cqes()
362 smc_wr_rx_post(link); /* refill WR RX */ in smc_wr_rx_process_cqes()
369 /* terminate connections of this link group in smc_wr_rx_process_cqes()
372 smc_lgr_terminate(smc_get_lgr(link)); in smc_wr_rx_process_cqes()
375 smc_wr_rx_post(link); /* refill WR RX */ in smc_wr_rx_process_cqes()
414 int smc_wr_rx_post_init(struct smc_link *link) in smc_wr_rx_post_init() argument
419 for (i = 0; i < link->wr_rx_cnt; i++) in smc_wr_rx_post_init()
420 rc = smc_wr_rx_post(link); in smc_wr_rx_post_init()
536 int smc_wr_alloc_link_mem(struct smc_link *link) in smc_wr_alloc_link_mem() argument
538 /* allocate link related memory */ in smc_wr_alloc_link_mem()
539 link->wr_tx_bufs = kcalloc(SMC_WR_BUF_CNT, SMC_WR_BUF_SIZE, GFP_KERNEL); in smc_wr_alloc_link_mem()
540 if (!link->wr_tx_bufs) in smc_wr_alloc_link_mem()
542 link->wr_rx_bufs = kcalloc(SMC_WR_BUF_CNT * 3, SMC_WR_BUF_SIZE, in smc_wr_alloc_link_mem()
544 if (!link->wr_rx_bufs) in smc_wr_alloc_link_mem()
546 link->wr_tx_ibs = kcalloc(SMC_WR_BUF_CNT, sizeof(link->wr_tx_ibs[0]), in smc_wr_alloc_link_mem()
548 if (!link->wr_tx_ibs) in smc_wr_alloc_link_mem()
550 link->wr_rx_ibs = kcalloc(SMC_WR_BUF_CNT * 3, in smc_wr_alloc_link_mem()
551 sizeof(link->wr_rx_ibs[0]), in smc_wr_alloc_link_mem()
553 if (!link->wr_rx_ibs) in smc_wr_alloc_link_mem()
555 link->wr_tx_sges = kcalloc(SMC_WR_BUF_CNT, sizeof(link->wr_tx_sges[0]), in smc_wr_alloc_link_mem()
557 if (!link->wr_tx_sges) in smc_wr_alloc_link_mem()
559 link->wr_rx_sges = kcalloc(SMC_WR_BUF_CNT * 3, in smc_wr_alloc_link_mem()
560 sizeof(link->wr_rx_sges[0]), in smc_wr_alloc_link_mem()
562 if (!link->wr_rx_sges) in smc_wr_alloc_link_mem()
564 link->wr_tx_mask = kcalloc(BITS_TO_LONGS(SMC_WR_BUF_CNT), in smc_wr_alloc_link_mem()
565 sizeof(*link->wr_tx_mask), in smc_wr_alloc_link_mem()
567 if (!link->wr_tx_mask) in smc_wr_alloc_link_mem()
569 link->wr_tx_pends = kcalloc(SMC_WR_BUF_CNT, in smc_wr_alloc_link_mem()
570 sizeof(link->wr_tx_pends[0]), in smc_wr_alloc_link_mem()
572 if (!link->wr_tx_pends) in smc_wr_alloc_link_mem()
577 kfree(link->wr_tx_mask); in smc_wr_alloc_link_mem()
579 kfree(link->wr_rx_sges); in smc_wr_alloc_link_mem()
581 kfree(link->wr_tx_sges); in smc_wr_alloc_link_mem()
583 kfree(link->wr_rx_ibs); in smc_wr_alloc_link_mem()
585 kfree(link->wr_tx_ibs); in smc_wr_alloc_link_mem()
587 kfree(link->wr_rx_bufs); in smc_wr_alloc_link_mem()
589 kfree(link->wr_tx_bufs); in smc_wr_alloc_link_mem()