• Home
  • Raw
  • Download

Lines Matching refs:lnk

455 void smc_wr_remember_qp_attr(struct smc_link *lnk)  in smc_wr_remember_qp_attr()  argument
457 struct ib_qp_attr *attr = &lnk->qp_attr; in smc_wr_remember_qp_attr()
462 ib_query_qp(lnk->roce_qp, attr, in smc_wr_remember_qp_attr()
482 lnk->wr_tx_cnt = min_t(size_t, SMC_WR_BUF_CNT, in smc_wr_remember_qp_attr()
483 lnk->qp_attr.cap.max_send_wr); in smc_wr_remember_qp_attr()
484 lnk->wr_rx_cnt = min_t(size_t, SMC_WR_BUF_CNT * 3, in smc_wr_remember_qp_attr()
485 lnk->qp_attr.cap.max_recv_wr); in smc_wr_remember_qp_attr()
488 static void smc_wr_init_sge(struct smc_link *lnk) in smc_wr_init_sge() argument
492 for (i = 0; i < lnk->wr_tx_cnt; i++) { in smc_wr_init_sge()
493 lnk->wr_tx_sges[i].addr = in smc_wr_init_sge()
494 lnk->wr_tx_dma_addr + i * SMC_WR_BUF_SIZE; in smc_wr_init_sge()
495 lnk->wr_tx_sges[i].length = SMC_WR_TX_SIZE; in smc_wr_init_sge()
496 lnk->wr_tx_sges[i].lkey = lnk->roce_pd->local_dma_lkey; in smc_wr_init_sge()
497 lnk->wr_tx_rdma_sges[i].tx_rdma_sge[0].wr_tx_rdma_sge[0].lkey = in smc_wr_init_sge()
498 lnk->roce_pd->local_dma_lkey; in smc_wr_init_sge()
499 lnk->wr_tx_rdma_sges[i].tx_rdma_sge[0].wr_tx_rdma_sge[1].lkey = in smc_wr_init_sge()
500 lnk->roce_pd->local_dma_lkey; in smc_wr_init_sge()
501 lnk->wr_tx_rdma_sges[i].tx_rdma_sge[1].wr_tx_rdma_sge[0].lkey = in smc_wr_init_sge()
502 lnk->roce_pd->local_dma_lkey; in smc_wr_init_sge()
503 lnk->wr_tx_rdma_sges[i].tx_rdma_sge[1].wr_tx_rdma_sge[1].lkey = in smc_wr_init_sge()
504 lnk->roce_pd->local_dma_lkey; in smc_wr_init_sge()
505 lnk->wr_tx_ibs[i].next = NULL; in smc_wr_init_sge()
506 lnk->wr_tx_ibs[i].sg_list = &lnk->wr_tx_sges[i]; in smc_wr_init_sge()
507 lnk->wr_tx_ibs[i].num_sge = 1; in smc_wr_init_sge()
508 lnk->wr_tx_ibs[i].opcode = IB_WR_SEND; in smc_wr_init_sge()
509 lnk->wr_tx_ibs[i].send_flags = in smc_wr_init_sge()
511 lnk->wr_tx_rdmas[i].wr_tx_rdma[0].wr.opcode = IB_WR_RDMA_WRITE; in smc_wr_init_sge()
512 lnk->wr_tx_rdmas[i].wr_tx_rdma[1].wr.opcode = IB_WR_RDMA_WRITE; in smc_wr_init_sge()
513 lnk->wr_tx_rdmas[i].wr_tx_rdma[0].wr.sg_list = in smc_wr_init_sge()
514 lnk->wr_tx_rdma_sges[i].tx_rdma_sge[0].wr_tx_rdma_sge; in smc_wr_init_sge()
515 lnk->wr_tx_rdmas[i].wr_tx_rdma[1].wr.sg_list = in smc_wr_init_sge()
516 lnk->wr_tx_rdma_sges[i].tx_rdma_sge[1].wr_tx_rdma_sge; in smc_wr_init_sge()
518 for (i = 0; i < lnk->wr_rx_cnt; i++) { in smc_wr_init_sge()
519 lnk->wr_rx_sges[i].addr = in smc_wr_init_sge()
520 lnk->wr_rx_dma_addr + i * SMC_WR_BUF_SIZE; in smc_wr_init_sge()
521 lnk->wr_rx_sges[i].length = SMC_WR_BUF_SIZE; in smc_wr_init_sge()
522 lnk->wr_rx_sges[i].lkey = lnk->roce_pd->local_dma_lkey; in smc_wr_init_sge()
523 lnk->wr_rx_ibs[i].next = NULL; in smc_wr_init_sge()
524 lnk->wr_rx_ibs[i].sg_list = &lnk->wr_rx_sges[i]; in smc_wr_init_sge()
525 lnk->wr_rx_ibs[i].num_sge = 1; in smc_wr_init_sge()
527 lnk->wr_reg.wr.next = NULL; in smc_wr_init_sge()
528 lnk->wr_reg.wr.num_sge = 0; in smc_wr_init_sge()
529 lnk->wr_reg.wr.send_flags = IB_SEND_SIGNALED; in smc_wr_init_sge()
530 lnk->wr_reg.wr.opcode = IB_WR_REG_MR; in smc_wr_init_sge()
531 lnk->wr_reg.access = IB_ACCESS_LOCAL_WRITE | IB_ACCESS_REMOTE_WRITE; in smc_wr_init_sge()
534 void smc_wr_free_link(struct smc_link *lnk) in smc_wr_free_link() argument
538 if (!lnk->smcibdev) in smc_wr_free_link()
540 ibdev = lnk->smcibdev->ibdev; in smc_wr_free_link()
542 smc_wr_wakeup_reg_wait(lnk); in smc_wr_free_link()
543 smc_wr_wakeup_tx_wait(lnk); in smc_wr_free_link()
545 smc_wr_tx_wait_no_pending_sends(lnk); in smc_wr_free_link()
546 wait_event(lnk->wr_reg_wait, (!atomic_read(&lnk->wr_reg_refcnt))); in smc_wr_free_link()
547 wait_event(lnk->wr_tx_wait, (!atomic_read(&lnk->wr_tx_refcnt))); in smc_wr_free_link()
549 if (lnk->wr_rx_dma_addr) { in smc_wr_free_link()
550 ib_dma_unmap_single(ibdev, lnk->wr_rx_dma_addr, in smc_wr_free_link()
551 SMC_WR_BUF_SIZE * lnk->wr_rx_cnt, in smc_wr_free_link()
553 lnk->wr_rx_dma_addr = 0; in smc_wr_free_link()
555 if (lnk->wr_tx_dma_addr) { in smc_wr_free_link()
556 ib_dma_unmap_single(ibdev, lnk->wr_tx_dma_addr, in smc_wr_free_link()
557 SMC_WR_BUF_SIZE * lnk->wr_tx_cnt, in smc_wr_free_link()
559 lnk->wr_tx_dma_addr = 0; in smc_wr_free_link()
563 void smc_wr_free_link_mem(struct smc_link *lnk) in smc_wr_free_link_mem() argument
565 kfree(lnk->wr_tx_compl); in smc_wr_free_link_mem()
566 lnk->wr_tx_compl = NULL; in smc_wr_free_link_mem()
567 kfree(lnk->wr_tx_pends); in smc_wr_free_link_mem()
568 lnk->wr_tx_pends = NULL; in smc_wr_free_link_mem()
569 kfree(lnk->wr_tx_mask); in smc_wr_free_link_mem()
570 lnk->wr_tx_mask = NULL; in smc_wr_free_link_mem()
571 kfree(lnk->wr_tx_sges); in smc_wr_free_link_mem()
572 lnk->wr_tx_sges = NULL; in smc_wr_free_link_mem()
573 kfree(lnk->wr_tx_rdma_sges); in smc_wr_free_link_mem()
574 lnk->wr_tx_rdma_sges = NULL; in smc_wr_free_link_mem()
575 kfree(lnk->wr_rx_sges); in smc_wr_free_link_mem()
576 lnk->wr_rx_sges = NULL; in smc_wr_free_link_mem()
577 kfree(lnk->wr_tx_rdmas); in smc_wr_free_link_mem()
578 lnk->wr_tx_rdmas = NULL; in smc_wr_free_link_mem()
579 kfree(lnk->wr_rx_ibs); in smc_wr_free_link_mem()
580 lnk->wr_rx_ibs = NULL; in smc_wr_free_link_mem()
581 kfree(lnk->wr_tx_ibs); in smc_wr_free_link_mem()
582 lnk->wr_tx_ibs = NULL; in smc_wr_free_link_mem()
583 kfree(lnk->wr_tx_bufs); in smc_wr_free_link_mem()
584 lnk->wr_tx_bufs = NULL; in smc_wr_free_link_mem()
585 kfree(lnk->wr_rx_bufs); in smc_wr_free_link_mem()
586 lnk->wr_rx_bufs = NULL; in smc_wr_free_link_mem()
680 int smc_wr_create_link(struct smc_link *lnk) in smc_wr_create_link() argument
682 struct ib_device *ibdev = lnk->smcibdev->ibdev; in smc_wr_create_link()
685 smc_wr_tx_set_wr_id(&lnk->wr_tx_id, 0); in smc_wr_create_link()
686 lnk->wr_rx_id = 0; in smc_wr_create_link()
687 lnk->wr_rx_dma_addr = ib_dma_map_single( in smc_wr_create_link()
688 ibdev, lnk->wr_rx_bufs, SMC_WR_BUF_SIZE * lnk->wr_rx_cnt, in smc_wr_create_link()
690 if (ib_dma_mapping_error(ibdev, lnk->wr_rx_dma_addr)) { in smc_wr_create_link()
691 lnk->wr_rx_dma_addr = 0; in smc_wr_create_link()
695 lnk->wr_tx_dma_addr = ib_dma_map_single( in smc_wr_create_link()
696 ibdev, lnk->wr_tx_bufs, SMC_WR_BUF_SIZE * lnk->wr_tx_cnt, in smc_wr_create_link()
698 if (ib_dma_mapping_error(ibdev, lnk->wr_tx_dma_addr)) { in smc_wr_create_link()
702 smc_wr_init_sge(lnk); in smc_wr_create_link()
703 memset(lnk->wr_tx_mask, 0, in smc_wr_create_link()
704 BITS_TO_LONGS(SMC_WR_BUF_CNT) * sizeof(*lnk->wr_tx_mask)); in smc_wr_create_link()
705 init_waitqueue_head(&lnk->wr_tx_wait); in smc_wr_create_link()
706 atomic_set(&lnk->wr_tx_refcnt, 0); in smc_wr_create_link()
707 init_waitqueue_head(&lnk->wr_reg_wait); in smc_wr_create_link()
708 atomic_set(&lnk->wr_reg_refcnt, 0); in smc_wr_create_link()
712 ib_dma_unmap_single(ibdev, lnk->wr_rx_dma_addr, in smc_wr_create_link()
713 SMC_WR_BUF_SIZE * lnk->wr_rx_cnt, in smc_wr_create_link()
715 lnk->wr_rx_dma_addr = 0; in smc_wr_create_link()