^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Shared Memory Communications over RDMA (SMC-R) and RoCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * IB infrastructure:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Establish SMC-R as an Infiniband Client to be notified about added and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * removed IB devices of type RDMA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Determine device and port characteristics for these IB devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Copyright IBM Corp. 2016
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Author(s): Ursula Braun <ubraun@linux.vnet.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/random.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/scatterlist.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/wait.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <rdma/ib_verbs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <rdma/ib_cache.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "smc_pnet.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include "smc_ib.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include "smc_core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include "smc_wr.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include "smc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define SMC_MAX_CQE 32766 /* max. # of completion queue elements */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define SMC_QP_MIN_RNR_TIMER 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define SMC_QP_TIMEOUT 15 /* 4096 * 2 ** timeout usec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define SMC_QP_RETRY_CNT 7 /* 7: infinite */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define SMC_QP_RNR_RETRY 7 /* 7: infinite */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct smc_ib_devices smc_ib_devices = { /* smc-registered ib devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .mutex = __MUTEX_INITIALIZER(smc_ib_devices.mutex),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) .list = LIST_HEAD_INIT(smc_ib_devices.list),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) u8 local_systemid[SMC_SYSTEMID_LEN]; /* unique system identifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) static int smc_ib_modify_qp_init(struct smc_link *lnk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct ib_qp_attr qp_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) memset(&qp_attr, 0, sizeof(qp_attr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) qp_attr.qp_state = IB_QPS_INIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) qp_attr.pkey_index = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) qp_attr.port_num = lnk->ibport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) qp_attr.qp_access_flags = IB_ACCESS_LOCAL_WRITE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) | IB_ACCESS_REMOTE_WRITE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) return ib_modify_qp(lnk->roce_qp, &qp_attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) IB_QP_STATE | IB_QP_PKEY_INDEX |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) IB_QP_ACCESS_FLAGS | IB_QP_PORT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) static int smc_ib_modify_qp_rtr(struct smc_link *lnk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) enum ib_qp_attr_mask qp_attr_mask =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) IB_QP_STATE | IB_QP_AV | IB_QP_PATH_MTU | IB_QP_DEST_QPN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) IB_QP_RQ_PSN | IB_QP_MAX_DEST_RD_ATOMIC | IB_QP_MIN_RNR_TIMER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) struct ib_qp_attr qp_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) memset(&qp_attr, 0, sizeof(qp_attr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) qp_attr.qp_state = IB_QPS_RTR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) qp_attr.path_mtu = min(lnk->path_mtu, lnk->peer_mtu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) qp_attr.ah_attr.type = RDMA_AH_ATTR_TYPE_ROCE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) rdma_ah_set_port_num(&qp_attr.ah_attr, lnk->ibport);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) rdma_ah_set_grh(&qp_attr.ah_attr, NULL, 0, lnk->sgid_index, 1, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) rdma_ah_set_dgid_raw(&qp_attr.ah_attr, lnk->peer_gid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) memcpy(&qp_attr.ah_attr.roce.dmac, lnk->peer_mac,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) sizeof(lnk->peer_mac));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) qp_attr.dest_qp_num = lnk->peer_qpn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) qp_attr.rq_psn = lnk->peer_psn; /* starting receive packet seq # */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) qp_attr.max_dest_rd_atomic = 1; /* max # of resources for incoming
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) qp_attr.min_rnr_timer = SMC_QP_MIN_RNR_TIMER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) return ib_modify_qp(lnk->roce_qp, &qp_attr, qp_attr_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) int smc_ib_modify_qp_rts(struct smc_link *lnk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct ib_qp_attr qp_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) memset(&qp_attr, 0, sizeof(qp_attr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) qp_attr.qp_state = IB_QPS_RTS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) qp_attr.timeout = SMC_QP_TIMEOUT; /* local ack timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) qp_attr.retry_cnt = SMC_QP_RETRY_CNT; /* retry count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) qp_attr.rnr_retry = SMC_QP_RNR_RETRY; /* RNR retries, 7=infinite */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) qp_attr.sq_psn = lnk->psn_initial; /* starting send packet seq # */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) qp_attr.max_rd_atomic = 1; /* # of outstanding RDMA reads and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * atomic ops allowed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) return ib_modify_qp(lnk->roce_qp, &qp_attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) IB_QP_STATE | IB_QP_TIMEOUT | IB_QP_RETRY_CNT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) IB_QP_SQ_PSN | IB_QP_RNR_RETRY |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) IB_QP_MAX_QP_RD_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) int smc_ib_modify_qp_error(struct smc_link *lnk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) struct ib_qp_attr qp_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) memset(&qp_attr, 0, sizeof(qp_attr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) qp_attr.qp_state = IB_QPS_ERR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) return ib_modify_qp(lnk->roce_qp, &qp_attr, IB_QP_STATE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) int smc_ib_ready_link(struct smc_link *lnk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct smc_link_group *lgr = smc_get_lgr(lnk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) rc = smc_ib_modify_qp_init(lnk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) rc = smc_ib_modify_qp_rtr(lnk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) smc_wr_remember_qp_attr(lnk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) rc = ib_req_notify_cq(lnk->smcibdev->roce_cq_recv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) IB_CQ_SOLICITED_MASK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) rc = smc_wr_rx_post_init(lnk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) smc_wr_remember_qp_attr(lnk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) if (lgr->role == SMC_SERV) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) rc = smc_ib_modify_qp_rts(lnk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) smc_wr_remember_qp_attr(lnk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) static int smc_ib_fill_mac(struct smc_ib_device *smcibdev, u8 ibport)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) const struct ib_gid_attr *attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) attr = rdma_get_gid_attr(smcibdev->ibdev, ibport, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) if (IS_ERR(attr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) rc = rdma_read_gid_l2_fields(attr, NULL, smcibdev->mac[ibport - 1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) rdma_put_gid_attr(attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /* Create an identifier unique for this instance of SMC-R.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * The MAC-address of the first active registered IB device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * plus a random 2-byte number is used to create this identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * This name is delivered to the peer during connection initialization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) static inline void smc_ib_define_local_systemid(struct smc_ib_device *smcibdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) u8 ibport)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) memcpy(&local_systemid[2], &smcibdev->mac[ibport - 1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) sizeof(smcibdev->mac[ibport - 1]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) bool smc_ib_is_valid_local_systemid(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) return !is_zero_ether_addr(&local_systemid[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) static void smc_ib_init_local_systemid(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) get_random_bytes(&local_systemid[0], 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) return smcibdev->pattr[ibport - 1].state == IB_PORT_ACTIVE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) /* determine the gid for an ib-device port and vlan id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) unsigned short vlan_id, u8 gid[], u8 *sgid_index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) const struct ib_gid_attr *attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) const struct net_device *ndev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) attr = rdma_get_gid_attr(smcibdev->ibdev, ibport, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) if (IS_ERR(attr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) rcu_read_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) ndev = rdma_read_gid_attr_ndev_rcu(attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) if (!IS_ERR(ndev) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) ((!vlan_id && !is_vlan_dev(ndev)) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) (vlan_id && is_vlan_dev(ndev) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) vlan_dev_vlan_id(ndev) == vlan_id)) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) attr->gid_type == IB_GID_TYPE_ROCE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) rcu_read_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) if (gid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) memcpy(gid, &attr->gid, SMC_GID_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) if (sgid_index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) *sgid_index = attr->index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) rdma_put_gid_attr(attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) rcu_read_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) rdma_put_gid_attr(attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) static int smc_ib_remember_port_attr(struct smc_ib_device *smcibdev, u8 ibport)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) memset(&smcibdev->pattr[ibport - 1], 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) sizeof(smcibdev->pattr[ibport - 1]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) rc = ib_query_port(smcibdev->ibdev, ibport,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) &smcibdev->pattr[ibport - 1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) /* the SMC protocol requires specification of the RoCE MAC address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) rc = smc_ib_fill_mac(smcibdev, ibport);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) if (!smc_ib_is_valid_local_systemid() &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) smc_ib_port_active(smcibdev, ibport))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) /* create unique system identifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) smc_ib_define_local_systemid(smcibdev, ibport);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) /* process context wrapper for might_sleep smc_ib_remember_port_attr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) static void smc_ib_port_event_work(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) struct smc_ib_device *smcibdev = container_of(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) work, struct smc_ib_device, port_event_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) u8 port_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) for_each_set_bit(port_idx, &smcibdev->port_event_mask, SMC_MAX_PORTS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) smc_ib_remember_port_attr(smcibdev, port_idx + 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) clear_bit(port_idx, &smcibdev->port_event_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) if (!smc_ib_port_active(smcibdev, port_idx + 1)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) set_bit(port_idx, smcibdev->ports_going_away);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) smcr_port_err(smcibdev, port_idx + 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) clear_bit(port_idx, smcibdev->ports_going_away);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) smcr_port_add(smcibdev, port_idx + 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) /* can be called in IRQ context */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) static void smc_ib_global_event_handler(struct ib_event_handler *handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) struct ib_event *ibevent)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) struct smc_ib_device *smcibdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) bool schedule = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) u8 port_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) smcibdev = container_of(handler, struct smc_ib_device, event_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) switch (ibevent->event) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) case IB_EVENT_DEVICE_FATAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) /* terminate all ports on device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) for (port_idx = 0; port_idx < SMC_MAX_PORTS; port_idx++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) set_bit(port_idx, &smcibdev->port_event_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) if (!test_and_set_bit(port_idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) smcibdev->ports_going_away))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) schedule = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) if (schedule)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) schedule_work(&smcibdev->port_event_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) case IB_EVENT_PORT_ACTIVE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) port_idx = ibevent->element.port_num - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) if (port_idx >= SMC_MAX_PORTS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) set_bit(port_idx, &smcibdev->port_event_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) if (test_and_clear_bit(port_idx, smcibdev->ports_going_away))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) schedule_work(&smcibdev->port_event_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) case IB_EVENT_PORT_ERR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) port_idx = ibevent->element.port_num - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) if (port_idx >= SMC_MAX_PORTS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) set_bit(port_idx, &smcibdev->port_event_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) if (!test_and_set_bit(port_idx, smcibdev->ports_going_away))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) schedule_work(&smcibdev->port_event_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) case IB_EVENT_GID_CHANGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) port_idx = ibevent->element.port_num - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) if (port_idx >= SMC_MAX_PORTS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) set_bit(port_idx, &smcibdev->port_event_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) schedule_work(&smcibdev->port_event_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) void smc_ib_dealloc_protection_domain(struct smc_link *lnk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) if (lnk->roce_pd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) ib_dealloc_pd(lnk->roce_pd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) lnk->roce_pd = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) int smc_ib_create_protection_domain(struct smc_link *lnk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) lnk->roce_pd = ib_alloc_pd(lnk->smcibdev->ibdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) rc = PTR_ERR_OR_ZERO(lnk->roce_pd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) if (IS_ERR(lnk->roce_pd))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) lnk->roce_pd = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) static void smc_ib_qp_event_handler(struct ib_event *ibevent, void *priv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) struct smc_link *lnk = (struct smc_link *)priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) struct smc_ib_device *smcibdev = lnk->smcibdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) u8 port_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) switch (ibevent->event) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) case IB_EVENT_QP_FATAL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) case IB_EVENT_QP_ACCESS_ERR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) port_idx = ibevent->element.qp->port - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) if (port_idx >= SMC_MAX_PORTS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) set_bit(port_idx, &smcibdev->port_event_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) if (!test_and_set_bit(port_idx, smcibdev->ports_going_away))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) schedule_work(&smcibdev->port_event_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) void smc_ib_destroy_queue_pair(struct smc_link *lnk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) if (lnk->roce_qp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) ib_destroy_qp(lnk->roce_qp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) lnk->roce_qp = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) /* create a queue pair within the protection domain for a link */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) int smc_ib_create_queue_pair(struct smc_link *lnk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) struct ib_qp_init_attr qp_attr = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) .event_handler = smc_ib_qp_event_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) .qp_context = lnk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) .send_cq = lnk->smcibdev->roce_cq_send,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) .recv_cq = lnk->smcibdev->roce_cq_recv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) .srq = NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) .cap = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) /* include unsolicited rdma_writes as well,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) * there are max. 2 RDMA_WRITE per 1 WR_SEND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) .max_send_wr = SMC_WR_BUF_CNT * 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) .max_recv_wr = SMC_WR_BUF_CNT * 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) .max_send_sge = SMC_IB_MAX_SEND_SGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) .max_recv_sge = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) .sq_sig_type = IB_SIGNAL_REQ_WR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) .qp_type = IB_QPT_RC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) lnk->roce_qp = ib_create_qp(lnk->roce_pd, &qp_attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) rc = PTR_ERR_OR_ZERO(lnk->roce_qp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) if (IS_ERR(lnk->roce_qp))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) lnk->roce_qp = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) smc_wr_remember_qp_attr(lnk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) void smc_ib_put_memory_region(struct ib_mr *mr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) ib_dereg_mr(mr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) static int smc_ib_map_mr_sg(struct smc_buf_desc *buf_slot, u8 link_idx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) unsigned int offset = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) int sg_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) /* map the largest prefix of a dma mapped SG list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) sg_num = ib_map_mr_sg(buf_slot->mr_rx[link_idx],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) buf_slot->sgt[link_idx].sgl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) buf_slot->sgt[link_idx].orig_nents,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) &offset, PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) return sg_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) /* Allocate a memory region and map the dma mapped SG list of buf_slot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) struct smc_buf_desc *buf_slot, u8 link_idx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) if (buf_slot->mr_rx[link_idx])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) return 0; /* already done */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) buf_slot->mr_rx[link_idx] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) ib_alloc_mr(pd, IB_MR_TYPE_MEM_REG, 1 << buf_slot->order);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) if (IS_ERR(buf_slot->mr_rx[link_idx])) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) rc = PTR_ERR(buf_slot->mr_rx[link_idx]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) buf_slot->mr_rx[link_idx] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) if (smc_ib_map_mr_sg(buf_slot, link_idx) != 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) /* synchronize buffer usage for cpu access */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) void smc_ib_sync_sg_for_cpu(struct smc_link *lnk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) struct smc_buf_desc *buf_slot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) enum dma_data_direction data_direction)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) struct scatterlist *sg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) unsigned int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) /* for now there is just one DMA address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) for_each_sg(buf_slot->sgt[lnk->link_idx].sgl, sg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) buf_slot->sgt[lnk->link_idx].nents, i) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) if (!sg_dma_len(sg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) ib_dma_sync_single_for_cpu(lnk->smcibdev->ibdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) sg_dma_address(sg),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) sg_dma_len(sg),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) data_direction);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) /* synchronize buffer usage for device access */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) void smc_ib_sync_sg_for_device(struct smc_link *lnk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) struct smc_buf_desc *buf_slot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) enum dma_data_direction data_direction)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) struct scatterlist *sg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) unsigned int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) /* for now there is just one DMA address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) for_each_sg(buf_slot->sgt[lnk->link_idx].sgl, sg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) buf_slot->sgt[lnk->link_idx].nents, i) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) if (!sg_dma_len(sg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) ib_dma_sync_single_for_device(lnk->smcibdev->ibdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) sg_dma_address(sg),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) sg_dma_len(sg),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) data_direction);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) /* Map a new TX or RX buffer SG-table to DMA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) int smc_ib_buf_map_sg(struct smc_link *lnk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) struct smc_buf_desc *buf_slot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) enum dma_data_direction data_direction)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) int mapped_nents;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) mapped_nents = ib_dma_map_sg(lnk->smcibdev->ibdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) buf_slot->sgt[lnk->link_idx].sgl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) buf_slot->sgt[lnk->link_idx].orig_nents,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) data_direction);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) if (!mapped_nents)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) return mapped_nents;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) void smc_ib_buf_unmap_sg(struct smc_link *lnk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) struct smc_buf_desc *buf_slot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) enum dma_data_direction data_direction)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) if (!buf_slot->sgt[lnk->link_idx].sgl->dma_address)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) return; /* already unmapped */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) ib_dma_unmap_sg(lnk->smcibdev->ibdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) buf_slot->sgt[lnk->link_idx].sgl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) buf_slot->sgt[lnk->link_idx].orig_nents,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) data_direction);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) buf_slot->sgt[lnk->link_idx].sgl->dma_address = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) long smc_ib_setup_per_ibdev(struct smc_ib_device *smcibdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) struct ib_cq_init_attr cqattr = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) .cqe = SMC_MAX_CQE, .comp_vector = 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) int cqe_size_order, smc_order;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) long rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) mutex_lock(&smcibdev->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) if (smcibdev->initialized)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) /* the calculated number of cq entries fits to mlx5 cq allocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) cqe_size_order = cache_line_size() == 128 ? 7 : 6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) smc_order = MAX_ORDER - cqe_size_order - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) if (SMC_MAX_CQE + 2 > (0x00000001 << smc_order) * PAGE_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) cqattr.cqe = (0x00000001 << smc_order) * PAGE_SIZE - 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) smcibdev->roce_cq_send = ib_create_cq(smcibdev->ibdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) smc_wr_tx_cq_handler, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) smcibdev, &cqattr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) rc = PTR_ERR_OR_ZERO(smcibdev->roce_cq_send);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) if (IS_ERR(smcibdev->roce_cq_send)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) smcibdev->roce_cq_send = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) smcibdev->roce_cq_recv = ib_create_cq(smcibdev->ibdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) smc_wr_rx_cq_handler, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) smcibdev, &cqattr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) rc = PTR_ERR_OR_ZERO(smcibdev->roce_cq_recv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) if (IS_ERR(smcibdev->roce_cq_recv)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) smcibdev->roce_cq_recv = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) goto err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) smc_wr_add_dev(smcibdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) smcibdev->initialized = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) ib_destroy_cq(smcibdev->roce_cq_send);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) mutex_unlock(&smcibdev->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) static void smc_ib_cleanup_per_ibdev(struct smc_ib_device *smcibdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) mutex_lock(&smcibdev->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) if (!smcibdev->initialized)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) smcibdev->initialized = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) ib_destroy_cq(smcibdev->roce_cq_recv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) ib_destroy_cq(smcibdev->roce_cq_send);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) smc_wr_remove_dev(smcibdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) mutex_unlock(&smcibdev->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) static struct ib_client smc_ib_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) /* callback function for ib_register_client() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) static int smc_ib_add_dev(struct ib_device *ibdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) struct smc_ib_device *smcibdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) u8 port_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) if (ibdev->node_type != RDMA_NODE_IB_CA)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) smcibdev = kzalloc(sizeof(*smcibdev), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) if (!smcibdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) smcibdev->ibdev = ibdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) INIT_WORK(&smcibdev->port_event_work, smc_ib_port_event_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) atomic_set(&smcibdev->lnk_cnt, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) init_waitqueue_head(&smcibdev->lnks_deleted);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) mutex_init(&smcibdev->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) mutex_lock(&smc_ib_devices.mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) list_add_tail(&smcibdev->list, &smc_ib_devices.list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) mutex_unlock(&smc_ib_devices.mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) ib_set_client_data(ibdev, &smc_ib_client, smcibdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) INIT_IB_EVENT_HANDLER(&smcibdev->event_handler, smcibdev->ibdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) smc_ib_global_event_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) ib_register_event_handler(&smcibdev->event_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) /* trigger reading of the port attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) port_cnt = smcibdev->ibdev->phys_port_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) pr_warn_ratelimited("smc: adding ib device %s with port count %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) smcibdev->ibdev->name, port_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) for (i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) i < min_t(size_t, port_cnt, SMC_MAX_PORTS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) set_bit(i, &smcibdev->port_event_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) /* determine pnetids of the port */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) if (smc_pnetid_by_dev_port(ibdev->dev.parent, i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) smcibdev->pnetid[i]))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) smc_pnetid_by_table_ib(smcibdev, i + 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) pr_warn_ratelimited("smc: ib device %s port %d has pnetid "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) "%.16s%s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) smcibdev->ibdev->name, i + 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) smcibdev->pnetid[i],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) smcibdev->pnetid_by_user[i] ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) " (user defined)" :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) "");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) schedule_work(&smcibdev->port_event_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) /* callback function for ib_unregister_client() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) static void smc_ib_remove_dev(struct ib_device *ibdev, void *client_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) struct smc_ib_device *smcibdev = client_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) mutex_lock(&smc_ib_devices.mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) list_del_init(&smcibdev->list); /* remove from smc_ib_devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) mutex_unlock(&smc_ib_devices.mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) pr_warn_ratelimited("smc: removing ib device %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) smcibdev->ibdev->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) smc_smcr_terminate_all(smcibdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) smc_ib_cleanup_per_ibdev(smcibdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) ib_unregister_event_handler(&smcibdev->event_handler);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) cancel_work_sync(&smcibdev->port_event_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) kfree(smcibdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) static struct ib_client smc_ib_client = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) .name = "smc_ib",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) .add = smc_ib_add_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) .remove = smc_ib_remove_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) int __init smc_ib_register_client(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) smc_ib_init_local_systemid();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) return ib_register_client(&smc_ib_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) void smc_ib_unregister_client(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) ib_unregister_client(&smc_ib_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) }