Pull rdma fixes from Jason Gunthorpe: - Fix several syzkaller found bugs: - Poor parsing of the RDMA_NL_LS_OP_IP_RESOLVE netlink - GID entry refcount leaking when CM destruction races with multicast establishment - Missing refcount put in ib_del_sub_device_and_put() - Fixup recently introduced uABI padding for 32 bit consistency - Avoid user triggered math overflow in MANA and AFA - Reading invalid netdev data during an event - kdoc fixes - Fix never-working gid copying in ib_get_gids_from_rdma_hdr - Typo in bnxt when validating the BAR - bnxt mis-parsed IB_SEND_IP_CSUM so it didn't work always - bnxt out of bounds access in bnxt related to the counters on new devices - Allocate the bnxt PDE table with the right sizing - Use dma_free_coherent() correctly in bnxt - Allow rxe to be unloadable when CONFIG_PROVE_LOCKING by adjusting the tracking of the global sockets it uses - Missing unlocking on error path in rxe - Compute the right number of pages in a MR in rtrs * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: RDMA/bnxt_re: fix dma_free_coherent() pointer RDMA/rtrs: Fix clt_path::max_pages_per_mr calculation IB/rxe: Fix missing umem_odp->umem_mutex unlock on error path RDMA/bnxt_re: Fix to use correct page size for PDE table RDMA/bnxt_re: Fix OOB write in bnxt_re_copy_err_stats() RDMA/bnxt_re: Fix IB_SEND_IP_CSUM handling in post_send RDMA/core: always drop device refcount in ib_del_sub_device_and_put() RDMA/rxe: let rxe_reclassify_recv_socket() call sk_owner_put() RDMA/bnxt_re: Fix incorrect BAR check in bnxt_qplib_map_creq_db() RDMA/core: Fix logic error in ib_get_gids_from_rdma_hdr() RDMA/efa: Remove possible negative shift RTRS/rtrs: clean up rtrs headers kernel-doc RDMA/irdma: avoid invalid read in irdma_net_event RDMA/mana_ib: check cqe length for kernel CQs RDMA/irdma: Fix irdma_alloc_ucontext_resp padding RDMA/ucma: Fix rdma_ucm_query_ib_service_resp struct padding RDMA/cm: Fix leaking the multicast GID table reference RDMA/core: Check for the presence of LS_NLA_TYPE_DGID correctly
Unified · Split
| @@ -80,37 +80,25 @@ static const struct nla_policy ib_nl_addr_policy[LS_NLA_TYPE_MAX] = { · 79 unmodified lines | |||
| 80 | .min = sizeof(struct rdma_nla_ls_gid)}, | 80 | .min = sizeof(struct rdma_nla_ls_gid)}, |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | static inline bool ib_nl_is_good_ip_resp(const struct nlmsghdr *nlh) | 83 | static void ib_nl_process_ip_rsep(const struct nlmsghdr *nlh) |
| 84 | { | 84 | { |
| 85 | struct nlattr *tb[LS_NLA_TYPE_MAX] = {}; | 85 | struct nlattr *tb[LS_NLA_TYPE_MAX] = {}; |
| 86 | union ib_gid gid; | ||
| 87 | struct addr_req *req; | ||
| 88 | int found = 0; | ||
| 86 | int ret; | 89 | int ret; |
| 87 | 90 | ||
| 88 | if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR) | 91 | if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR) |
| 89 | return false; | 92 | return; |
| 90 | 93 | ||
| 91 | ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), | 94 | ret = nla_parse_deprecated(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh), |
| 92 | nlmsg_len(nlh), ib_nl_addr_policy, NULL); | 95 | nlmsg_len(nlh), ib_nl_addr_policy, NULL); |
| 93 | if (ret) | 96 | if (ret) |
| 94 | return false; | 97 | return; |
| 95 | |||
| 96 | return true; | ||
| 97 | } | ||
| 98 | |||
| 99 | static void ib_nl_process_good_ip_rsep(const struct nlmsghdr *nlh) | ||
| 100 | { | ||
| 101 | const struct nlattr *head, *curr; | ||
| 102 | union ib_gid gid; | ||
| 103 | struct addr_req *req; | ||
| 104 | int len, rem; | ||
| 105 | int found = 0; | ||
| 106 | |||
| 107 | head = (const struct nlattr *)nlmsg_data(nlh); | ||
| 108 | len = nlmsg_len(nlh); | ||
| 109 | 98 | ||
| 110 | nla_for_each_attr(curr, head, len, rem) { | 99 | if (!tb[LS_NLA_TYPE_DGID]) |
| 111 | if (curr->nla_type == LS_NLA_TYPE_DGID) | 100 | return; |
| 112 | memcpy(&gid, nla_data(curr), nla_len(curr)); | 101 | memcpy(&gid, nla_data(tb[LS_NLA_TYPE_DGID]), sizeof(gid)); |
| 113 | } | ||
| 114 | 102 | ||
| 115 | spin_lock_bh(&lock); | 103 | spin_lock_bh(&lock); |
| 116 | list_for_each_entry(req, &req_list, list) { | 104 | list_for_each_entry(req, &req_list, list) { |
| @@ -137,8 +125,7 @@ int ib_nl_handle_ip_res_resp(struct sk_buff *skb, · 20 unmodified lines | |||
| 137 | !(NETLINK_CB(skb).sk)) | 125 | !(NETLINK_CB(skb).sk)) |
| 138 | return -EPERM; | 126 | return -EPERM; |
| 139 | 127 | ||
| 140 | if (ib_nl_is_good_ip_resp(nlh)) | 128 | ib_nl_process_ip_rsep(nlh); |
| 141 | ib_nl_process_good_ip_rsep(nlh); | ||
| 142 | 129 | ||
| 143 | return 0; | 130 | return 0; |
| 144 | } | 131 | } |
| @@ -2009,6 +2009,7 @@ static void destroy_mc(struct rdma_id_private *id_priv, · 2008 unmodified lines | |||
| 2009 | ib_sa_free_multicast(mc->sa_mc); | 2009 | ib_sa_free_multicast(mc->sa_mc); |
| 2010 | 2010 | ||
| 2011 | if (rdma_protocol_roce(id_priv->id.device, id_priv->id.port_num)) { | 2011 | if (rdma_protocol_roce(id_priv->id.device, id_priv->id.port_num)) { |
| 2012 | struct rdma_cm_event *event = &mc->iboe_join.event; | ||
| 2012 | struct rdma_dev_addr *dev_addr = | 2013 | struct rdma_dev_addr *dev_addr = |
| 2013 | &id_priv->id.route.addr.dev_addr; | 2014 | &id_priv->id.route.addr.dev_addr; |
| 2014 | struct net_device *ndev = NULL; | 2015 | struct net_device *ndev = NULL; |
| @@ -2031,6 +2032,8 @@ static void destroy_mc(struct rdma_id_private *id_priv, · 16 unmodified lines | |||
| 2031 | dev_put(ndev); | 2032 | dev_put(ndev); |
| 2032 | 2033 | ||
| 2033 | cancel_work_sync(&mc->iboe_join.work); | 2034 | cancel_work_sync(&mc->iboe_join.work); |
| 2035 | if (event->event == RDMA_CM_EVENT_MULTICAST_JOIN) | ||
| 2036 | rdma_destroy_ah_attr(&event->param.ud.ah_attr); | ||
| 2034 | } | 2037 | } |
| 2035 | kfree(mc); | 2038 | kfree(mc); |
| 2036 | } | 2039 | } |
| @@ -2881,8 +2881,10 @@ int ib_del_sub_device_and_put(struct ib_device *sub) · 2880 unmodified lines | |||
| 2881 | { | 2881 | { |
| 2882 | struct ib_device *parent = sub->parent; | 2882 | struct ib_device *parent = sub->parent; |
| 2883 | 2883 | ||
| 2884 | if (!parent) | 2884 | if (!parent) { |
| 2885 | ib_device_put(sub); | ||
| 2885 | return -EOPNOTSUPP; | 2886 | return -EOPNOTSUPP; |
| 2887 | } | ||
| 2886 | 2888 | ||
| 2887 | mutex_lock(&parent->subdev_lock); | 2889 | mutex_lock(&parent->subdev_lock); |
| 2888 | list_del(&sub->subdev_list); | 2890 | list_del(&sub->subdev_list); |
| @@ -738,7 +738,7 @@ int ib_get_gids_from_rdma_hdr(const union rdma_network_hdr *hdr, · 737 unmodified lines | |||
| 738 | (struct in6_addr *)dgid); | 738 | (struct in6_addr *)dgid); |
| 739 | return 0; | 739 | return 0; |
| 740 | } else if (net_type == RDMA_NETWORK_IPV6 || | 740 | } else if (net_type == RDMA_NETWORK_IPV6 || |
| 741 | net_type == RDMA_NETWORK_IB || RDMA_NETWORK_ROCE_V1) { | 741 | net_type == RDMA_NETWORK_IB || net_type == RDMA_NETWORK_ROCE_V1) { |
| 742 | *dgid = hdr->ibgrh.dgid; | 742 | *dgid = hdr->ibgrh.dgid; |
| 743 | *sgid = hdr->ibgrh.sgid; | 743 | *sgid = hdr->ibgrh.sgid; |
| 744 | return 0; | 744 | return 0; |
| @@ -89,6 +89,9 @@ enum bnxt_re_hw_stats { · 88 unmodified lines | |||
| 89 | BNXT_RE_RES_SRQ_LOAD_ERR, | 89 | BNXT_RE_RES_SRQ_LOAD_ERR, |
| 90 | BNXT_RE_RES_TX_PCI_ERR, | 90 | BNXT_RE_RES_TX_PCI_ERR, |
| 91 | BNXT_RE_RES_RX_PCI_ERR, | 91 | BNXT_RE_RES_RX_PCI_ERR, |
| 92 | BNXT_RE_REQ_CQE_ERROR, | ||
| 93 | BNXT_RE_RESP_CQE_ERROR, | ||
| 94 | BNXT_RE_RESP_REMOTE_ACCESS_ERRS, | ||
| 92 | BNXT_RE_OUT_OF_SEQ_ERR, | 95 | BNXT_RE_OUT_OF_SEQ_ERR, |
| 93 | BNXT_RE_TX_ATOMIC_REQ, | 96 | BNXT_RE_TX_ATOMIC_REQ, |
| 94 | BNXT_RE_TX_READ_REQ, | 97 | BNXT_RE_TX_READ_REQ, |
| @@ -110,9 +113,6 @@ enum bnxt_re_hw_stats { · 15 unmodified lines | |||
| 110 | BNXT_RE_TX_CNP, | 113 | BNXT_RE_TX_CNP, |
| 111 | BNXT_RE_RX_CNP, | 114 | BNXT_RE_RX_CNP, |
| 112 | BNXT_RE_RX_ECN, | 115 | BNXT_RE_RX_ECN, |
| 113 | BNXT_RE_REQ_CQE_ERROR, | ||
| 114 | BNXT_RE_RESP_CQE_ERROR, | ||
| 115 | BNXT_RE_RESP_REMOTE_ACCESS_ERRS, | ||
| 116 | BNXT_RE_NUM_EXT_COUNTERS | 116 | BNXT_RE_NUM_EXT_COUNTERS |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| @@ -2919,14 +2919,9 @@ int bnxt_re_post_send(struct ib_qp *ib_qp, const struct ib_send_wr *wr, · 2918 unmodified lines | |||
| 2919 | wqe.rawqp1.lflags |= | 2919 | wqe.rawqp1.lflags |= |
| 2920 | SQ_SEND_RAWETH_QP1_LFLAGS_ROCE_CRC; | 2920 | SQ_SEND_RAWETH_QP1_LFLAGS_ROCE_CRC; |
| 2921 | } | 2921 | } |
| 2922 | switch (wr->send_flags) { | 2922 | if (wr->send_flags & IB_SEND_IP_CSUM) |
| 2923 | case IB_SEND_IP_CSUM: | ||
| 2924 | wqe.rawqp1.lflags |= | 2923 | wqe.rawqp1.lflags |= |
| 2925 | SQ_SEND_RAWETH_QP1_LFLAGS_IP_CHKSUM; | 2924 | SQ_SEND_RAWETH_QP1_LFLAGS_IP_CHKSUM; |
| 2926 | break; | ||
| 2927 | default: | ||
| 2928 | break; | ||
| 2929 | } | ||
| 2930 | fallthrough; | 2925 | fallthrough; |
| 2931 | case IB_WR_SEND_WITH_INV: | 2926 | case IB_WR_SEND_WITH_INV: |
| 2932 | rc = bnxt_re_build_send_wqe(qp, wr, &wqe); | 2927 | rc = bnxt_re_build_send_wqe(qp, wr, &wqe); |
| @@ -1112,7 +1112,7 @@ static int bnxt_qplib_map_creq_db(struct bnxt_qplib_rcfw *rcfw, u32 reg_offt) · 1111 unmodified lines | |||
| 1112 | creq_db->dbinfo.flags = 0; | 1112 | creq_db->dbinfo.flags = 0; |
| 1113 | creq_db->reg.bar_id = RCFW_COMM_CONS_PCI_BAR_REGION; | 1113 | creq_db->reg.bar_id = RCFW_COMM_CONS_PCI_BAR_REGION; |
| 1114 | creq_db->reg.bar_base = pci_resource_start(pdev, creq_db->reg.bar_id); | 1114 | creq_db->reg.bar_base = pci_resource_start(pdev, creq_db->reg.bar_id); |
| 1115 | if (!creq_db->reg.bar_id) | 1115 | if (!creq_db->reg.bar_base) |
| 1116 | dev_err(&pdev->dev, | 1116 | dev_err(&pdev->dev, |
| 1117 | "QPLIB: CREQ BAR region %d resc start is 0!", | 1117 | "QPLIB: CREQ BAR region %d resc start is 0!", |
| 1118 | creq_db->reg.bar_id); | 1118 | creq_db->reg.bar_id); |
| @@ -64,9 +64,7 @@ static void __free_pbl(struct bnxt_qplib_res *res, struct bnxt_qplib_pbl *pbl, · 63 unmodified lines | |||
| 64 | for (i = 0; i < pbl->pg_count; i++) { | 64 | for (i = 0; i < pbl->pg_count; i++) { |
| 65 | if (pbl->pg_arr[i]) | 65 | if (pbl->pg_arr[i]) |
| 66 | dma_free_coherent(&pdev->dev, pbl->pg_size, | 66 | dma_free_coherent(&pdev->dev, pbl->pg_size, |
| 67 | (void *)((unsigned long) | 67 | pbl->pg_arr[i], |
| 68 | pbl->pg_arr[i] & | ||
| 69 | PAGE_MASK), | ||
| 70 | pbl->pg_map_arr[i]); | 68 | pbl->pg_map_arr[i]); |
| 71 | else | 69 | else |
| 72 | dev_warn(&pdev->dev, | 70 | dev_warn(&pdev->dev, |
| @@ -237,7 +235,7 @@ int bnxt_qplib_alloc_init_hwq(struct bnxt_qplib_hwq *hwq, · 164 unmodified lines | |||
| 237 | if (npbl % BIT(MAX_PDL_LVL_SHIFT)) | 235 | if (npbl % BIT(MAX_PDL_LVL_SHIFT)) |
| 238 | npde++; | 236 | npde++; |
| 239 | /* Alloc PDE pages */ | 237 | /* Alloc PDE pages */ |
| 240 | sginfo.pgsize = npde * pg_size; | 238 | sginfo.pgsize = npde * ROCE_PG_SIZE_4K; |
| 241 | sginfo.npages = 1; | 239 | sginfo.npages = 1; |
| 242 | rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); | 240 | rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); |
| 243 | if (rc) | 241 | if (rc) |
| @@ -245,7 +243,7 @@ int bnxt_qplib_alloc_init_hwq(struct bnxt_qplib_hwq *hwq, · 1 unmodified line | |||
| 245 | 243 | ||
| 246 | /* Alloc PBL pages */ | 244 | /* Alloc PBL pages */ |
| 247 | sginfo.npages = npbl; | 245 | sginfo.npages = npbl; |
| 248 | sginfo.pgsize = PAGE_SIZE; | 246 | sginfo.pgsize = ROCE_PG_SIZE_4K; |
| 249 | rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_1], &sginfo); | 247 | rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_1], &sginfo); |
| 250 | if (rc) | 248 | if (rc) |
| 251 | goto fail; | 249 | goto fail; |
| @@ -1320,13 +1320,9 @@ static int umem_to_page_list(struct efa_dev *dev, · 1319 unmodified lines | |||
| 1320 | u32 hp_cnt, | 1320 | u32 hp_cnt, |
| 1321 | u8 hp_shift) | 1321 | u8 hp_shift) |
| 1322 | { | 1322 | { |
| 1323 | u32 pages_in_hp = BIT(hp_shift - PAGE_SHIFT); | ||
| 1324 | struct ib_block_iter biter; | 1323 | struct ib_block_iter biter; |
| 1325 | unsigned int hp_idx = 0; | 1324 | unsigned int hp_idx = 0; |
| 1326 | 1325 | ||
| 1327 | ibdev_dbg(&dev->ibdev, "hp_cnt[%u], pages_in_hp[%u]\n", | ||
| 1328 | hp_cnt, pages_in_hp); | ||
| 1329 | |||
| 1330 | rdma_umem_for_each_dma_block(umem, &biter, BIT(hp_shift)) | 1326 | rdma_umem_for_each_dma_block(umem, &biter, BIT(hp_shift)) |
| 1331 | page_list[hp_idx++] = rdma_block_iter_dma_address(&biter); | 1327 | page_list[hp_idx++] = rdma_block_iter_dma_address(&biter); |
| 1332 | 1328 | ||
| @@ -251,7 +251,7 @@ int irdma_net_event(struct notifier_block *notifier, unsigned long event, · 250 unmodified lines | |||
| 251 | void *ptr) | 251 | void *ptr) |
| 252 | { | 252 | { |
| 253 | struct neighbour *neigh = ptr; | 253 | struct neighbour *neigh = ptr; |
| 254 | struct net_device *real_dev, *netdev = (struct net_device *)neigh->dev; | 254 | struct net_device *real_dev, *netdev; |
| 255 | struct irdma_device *iwdev; | 255 | struct irdma_device *iwdev; |
| 256 | struct ib_device *ibdev; | 256 | struct ib_device *ibdev; |
| 257 | __be32 *p; | 257 | __be32 *p; |
| @@ -260,6 +260,7 @@ int irdma_net_event(struct notifier_block *notifier, unsigned long event, · 2 unmodified lines | |||
| 260 | 260 | ||
| 261 | switch (event) { | 261 | switch (event) { |
| 262 | case NETEVENT_NEIGH_UPDATE: | 262 | case NETEVENT_NEIGH_UPDATE: |
| 263 | netdev = neigh->dev; | ||
| 263 | real_dev = rdma_vlan_dev_real_dev(netdev); | 264 | real_dev = rdma_vlan_dev_real_dev(netdev); |
| 264 | if (!real_dev) | 265 | if (!real_dev) |
| 265 | real_dev = netdev; | 266 | real_dev = netdev; |
| @@ -56,6 +56,10 @@ int mana_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, · 55 unmodified lines | |||
| 56 | doorbell = mana_ucontext->doorbell; | 56 | doorbell = mana_ucontext->doorbell; |
| 57 | } else { | 57 | } else { |
| 58 | is_rnic_cq = true; | 58 | is_rnic_cq = true; |
| 59 | if (attr->cqe > U32_MAX / COMP_ENTRY_SIZE / 2 + 1) { | ||
| 60 | ibdev_dbg(ibdev, "CQE %d exceeding limit\n", attr->cqe); | ||
| 61 | return -EINVAL; | ||
| 62 | } | ||
| 59 | buf_size = MANA_PAGE_ALIGN(roundup_pow_of_two(attr->cqe * COMP_ENTRY_SIZE)); | 63 | buf_size = MANA_PAGE_ALIGN(roundup_pow_of_two(attr->cqe * COMP_ENTRY_SIZE)); |
| 60 | cq->cqe = buf_size / COMP_ENTRY_SIZE; | 64 | cq->cqe = buf_size / COMP_ENTRY_SIZE; |
| 61 | err = mana_ib_create_kernel_queue(mdev, buf_size, GDMA_CQ, &cq->queue); | 65 | err = mana_ib_create_kernel_queue(mdev, buf_size, GDMA_CQ, &cq->queue); |
| @@ -64,7 +64,39 @@ static inline void rxe_reclassify_recv_socket(struct socket *sock) · 63 unmodified lines | |||
| 64 | break; | 64 | break; |
| 65 | default: | 65 | default: |
| 66 | WARN_ON_ONCE(1); | 66 | WARN_ON_ONCE(1); |
| 67 | return; | ||
| 67 | } | 68 | } |
| 69 | /* | ||
| 70 | * sock_lock_init_class_and_name() calls | ||
| 71 | * sk_owner_set(sk, THIS_MODULE); in order | ||
| 72 | * to make sure the referenced global | ||
| 73 | * variables rxe_recv_slock_key and | ||
| 74 | * rxe_recv_sk_key are not removed | ||
| 75 | * before the socket is closed. | ||
| 76 | * | ||
| 77 | * However this prevents rxe_net_exit() | ||
| 78 | * from being called and 'rmmod rdma_rxe' | ||
| 79 | * is refused because of the references. | ||
| 80 | * | ||
| 81 | * For the global sockets in recv_sockets, | ||
| 82 | * we are sure that rxe_net_exit() will call | ||
| 83 | * rxe_release_udp_tunnel -> udp_tunnel_sock_release. | ||
| 84 | * | ||
| 85 | * So we don't need the additional reference to | ||
| 86 | * our own (THIS_MODULE). | ||
| 87 | */ | ||
| 88 | sk_owner_put(sk); | ||
| 89 | /* | ||
| 90 | * We also call sk_owner_clear() otherwise | ||
| 91 | * sk_owner_put(sk) in sk_prot_free will | ||
| 92 | * fail, which is called via | ||
| 93 | * sk_free -> __sk_free -> sk_destruct | ||
| 94 | * and sk_destruct calls __sk_destruct | ||
| 95 | * directly or via call_rcu() | ||
| 96 | * so sk_prot_free() might be called | ||
| 97 | * after rxe_net_exit(). | ||
| 98 | */ | ||
| 99 | sk_owner_clear(sk); | ||
| 68 | #endif /* CONFIG_DEBUG_LOCK_ALLOC */ | 100 | #endif /* CONFIG_DEBUG_LOCK_ALLOC */ |
| 69 | } | 101 | } |
| 70 | 102 | ||
| @@ -179,8 +179,10 @@ static int rxe_odp_map_range_and_lock(struct rxe_mr *mr, u64 iova, int length, u · 178 unmodified lines | |||
| 179 | return err; | 179 | return err; |
| 180 | 180 | ||
| 181 | need_fault = rxe_check_pagefault(umem_odp, iova, length); | 181 | need_fault = rxe_check_pagefault(umem_odp, iova, length); |
| 182 | if (need_fault) | 182 | if (need_fault) { |
| 183 | mutex_unlock(&umem_odp->umem_mutex); | ||
| 183 | return -EFAULT; | 184 | return -EFAULT; |
| 185 | } | ||
| 184 | } | 186 | } |
| 185 | 187 | ||
| 186 | return 0; | 188 | return 0; |
| @@ -1464,6 +1464,7 @@ static void query_fast_reg_mode(struct rtrs_clt_path *clt_path) · 1463 unmodified lines | |||
| 1464 | mr_page_shift = max(12, ffs(ib_dev->attrs.page_size_cap) - 1); | 1464 | mr_page_shift = max(12, ffs(ib_dev->attrs.page_size_cap) - 1); |
| 1465 | max_pages_per_mr = ib_dev->attrs.max_mr_size; | 1465 | max_pages_per_mr = ib_dev->attrs.max_mr_size; |
| 1466 | do_div(max_pages_per_mr, (1ull << mr_page_shift)); | 1466 | do_div(max_pages_per_mr, (1ull << mr_page_shift)); |
| 1467 | max_pages_per_mr = min_not_zero((u32)max_pages_per_mr, U32_MAX); | ||
| 1467 | clt_path->max_pages_per_mr = | 1468 | clt_path->max_pages_per_mr = |
| 1468 | min3(clt_path->max_pages_per_mr, (u32)max_pages_per_mr, | 1469 | min3(clt_path->max_pages_per_mr, (u32)max_pages_per_mr, |
| 1469 | ib_dev->attrs.max_fast_reg_page_list_len); | 1470 | ib_dev->attrs.max_fast_reg_page_list_len); |
| @@ -150,7 +150,7 @@ enum rtrs_msg_types { · 149 unmodified lines | |||
| 150 | 150 | ||
| 151 | /** | 151 | /** |
| 152 | * enum rtrs_msg_flags - RTRS message flags. | 152 | * enum rtrs_msg_flags - RTRS message flags. |
| 153 | * @RTRS_NEED_INVAL: Send invalidation in response. | 153 | * @RTRS_MSG_NEED_INVAL_F: Send invalidation in response. |
| 154 | * @RTRS_MSG_NEW_RKEY_F: Send refreshed rkey in response. | 154 | * @RTRS_MSG_NEW_RKEY_F: Send refreshed rkey in response. |
| 155 | */ | 155 | */ |
| 156 | enum rtrs_msg_flags { | 156 | enum rtrs_msg_flags { |
| @@ -179,16 +179,19 @@ struct rtrs_sg_desc { · 22 unmodified lines | |||
| 179 | * @recon_cnt: Reconnections counter | 179 | * @recon_cnt: Reconnections counter |
| 180 | * @sess_uuid: UUID of a session (path) | 180 | * @sess_uuid: UUID of a session (path) |
| 181 | * @paths_uuid: UUID of a group of sessions (paths) | 181 | * @paths_uuid: UUID of a group of sessions (paths) |
| 182 | * | 182 | * @first_conn: %1 if the connection request is the first for that session, |
| 183 | * otherwise %0 | ||
| 183 | * NOTE: max size 56 bytes, see man rdma_connect(). | 184 | * NOTE: max size 56 bytes, see man rdma_connect(). |
| 184 | */ | 185 | */ |
| 185 | struct rtrs_msg_conn_req { | 186 | struct rtrs_msg_conn_req { |
| 186 | /* Is set to 0 by cma.c in case of AF_IB, do not touch that. | 187 | /** |
| 187 | * see https://www.spinics.net/lists/linux-rdma/msg22397.html | 188 | * @__cma_version: Is set to 0 by cma.c in case of AF_IB, do not touch |
| 189 | * that. See https://www.spinics.net/lists/linux-rdma/msg22397.html | ||
| 188 | */ | 190 | */ |
| 189 | u8 __cma_version; | 191 | u8 __cma_version; |
| 190 | /* On sender side that should be set to 0, or cma_save_ip_info() | 192 | /** |
| 191 | * extract garbage and will fail. | 193 | * @__ip_version: On sender side that should be set to 0, or |
| 194 | * cma_save_ip_info() extract garbage and will fail. | ||
| 192 | */ | 195 | */ |
| 193 | u8 __ip_version; | 196 | u8 __ip_version; |
| 194 | __le16 magic; | 197 | __le16 magic; |
| @@ -199,6 +202,7 @@ struct rtrs_msg_conn_req { · 4 unmodified lines | |||
| 199 | uuid_t sess_uuid; | 202 | uuid_t sess_uuid; |
| 200 | uuid_t paths_uuid; | 203 | uuid_t paths_uuid; |
| 201 | u8 first_conn : 1; | 204 | u8 first_conn : 1; |
| 205 | /* private: */ | ||
| 202 | u8 reserved_bits : 7; | 206 | u8 reserved_bits : 7; |
| 203 | u8 reserved[11]; | 207 | u8 reserved[11]; |
| 204 | }; | 208 | }; |
| @@ -211,6 +215,7 @@ struct rtrs_msg_conn_req { · 6 unmodified lines | |||
| 211 | * @queue_depth: max inflight messages (queue-depth) in this session | 215 | * @queue_depth: max inflight messages (queue-depth) in this session |
| 212 | * @max_io_size: max io size server supports | 216 | * @max_io_size: max io size server supports |
| 213 | * @max_hdr_size: max msg header size server supports | 217 | * @max_hdr_size: max msg header size server supports |
| 218 | * @flags: RTRS message flags for this message | ||
| 214 | * | 219 | * |
| 215 | * NOTE: size is 56 bytes, max possible is 136 bytes, see man rdma_accept(). | 220 | * NOTE: size is 56 bytes, max possible is 136 bytes, see man rdma_accept(). |
| 216 | */ | 221 | */ |
| @@ -222,22 +227,24 @@ struct rtrs_msg_conn_rsp { · 5 unmodified lines | |||
| 222 | __le32 max_io_size; | 227 | __le32 max_io_size; |
| 223 | __le32 max_hdr_size; | 228 | __le32 max_hdr_size; |
| 224 | __le32 flags; | 229 | __le32 flags; |
| 230 | /* private: */ | ||
| 225 | u8 reserved[36]; | 231 | u8 reserved[36]; |
| 226 | }; | 232 | }; |
| 227 | 233 | ||
| 228 | /** | 234 | /** |
| 229 | * struct rtrs_msg_info_req | 235 | * struct rtrs_msg_info_req - client additional info request |
| 230 | * @type: @RTRS_MSG_INFO_REQ | 236 | * @type: @RTRS_MSG_INFO_REQ |
| 231 | * @pathname: Path name chosen by client | 237 | * @pathname: Path name chosen by client |
| 232 | */ | 238 | */ |
| 233 | struct rtrs_msg_info_req { | 239 | struct rtrs_msg_info_req { |
| 234 | __le16 type; | 240 | __le16 type; |
| 235 | u8 pathname[NAME_MAX]; | 241 | u8 pathname[NAME_MAX]; |
| 242 | /* private: */ | ||
| 236 | u8 reserved[15]; | 243 | u8 reserved[15]; |
| 237 | }; | 244 | }; |
| 238 | 245 | ||
| 239 | /** | 246 | /** |
| 240 | * struct rtrs_msg_info_rsp | 247 | * struct rtrs_msg_info_rsp - server additional info response |
| 241 | * @type: @RTRS_MSG_INFO_RSP | 248 | * @type: @RTRS_MSG_INFO_RSP |
| 242 | * @sg_cnt: Number of @desc entries | 249 | * @sg_cnt: Number of @desc entries |
| 243 | * @desc: RDMA buffers where the client can write to server | 250 | * @desc: RDMA buffers where the client can write to server |
| @@ -245,12 +252,14 @@ struct rtrs_msg_info_req { · 1 unmodified line | |||
| 245 | struct rtrs_msg_info_rsp { | 252 | struct rtrs_msg_info_rsp { |
| 246 | __le16 type; | 253 | __le16 type; |
| 247 | __le16 sg_cnt; | 254 | __le16 sg_cnt; |
| 255 | /* private: */ | ||
| 248 | u8 reserved[4]; | 256 | u8 reserved[4]; |
| 257 | /* public: */ | ||
| 249 | struct rtrs_sg_desc desc[]; | 258 | struct rtrs_sg_desc desc[]; |
| 250 | }; | 259 | }; |
| 251 | 260 | ||
| 252 | /** | 261 | /** |
| 253 | * struct rtrs_msg_rkey_rsp | 262 | * struct rtrs_msg_rkey_rsp - server refreshed rkey response |
| 254 | * @type: @RTRS_MSG_RKEY_RSP | 263 | * @type: @RTRS_MSG_RKEY_RSP |
| 255 | * @buf_id: RDMA buf_id of the new rkey | 264 | * @buf_id: RDMA buf_id of the new rkey |
| 256 | * @rkey: new remote key for RDMA buffers id from server | 265 | * @rkey: new remote key for RDMA buffers id from server |
| @@ -264,6 +273,7 @@ struct rtrs_msg_rkey_rsp { · 7 unmodified lines | |||
| 264 | /** | 273 | /** |
| 265 | * struct rtrs_msg_rdma_read - RDMA data transfer request from client | 274 | * struct rtrs_msg_rdma_read - RDMA data transfer request from client |
| 266 | * @type: always @RTRS_MSG_READ | 275 | * @type: always @RTRS_MSG_READ |
| 276 | * @flags: RTRS message flags (enum rtrs_msg_flags) | ||
| 267 | * @usr_len: length of user payload | 277 | * @usr_len: length of user payload |
| 268 | * @sg_cnt: number of @desc entries | 278 | * @sg_cnt: number of @desc entries |
| 269 | * @desc: RDMA buffers where the server can write the result to | 279 | * @desc: RDMA buffers where the server can write the result to |
| @@ -277,7 +287,7 @@ struct rtrs_msg_rdma_read { · 7 unmodified lines | |||
| 277 | }; | 287 | }; |
| 278 | 288 | ||
| 279 | /** | 289 | /** |
| 280 | * struct_msg_rdma_write - Message transferred to server with RDMA-Write | 290 | * struct rtrs_msg_rdma_write - Message transferred to server with RDMA-Write |
| 281 | * @type: always @RTRS_MSG_WRITE | 291 | * @type: always @RTRS_MSG_WRITE |
| 282 | * @usr_len: length of user payload | 292 | * @usr_len: length of user payload |
| 283 | */ | 293 | */ |
| @@ -287,7 +297,7 @@ struct rtrs_msg_rdma_write { · 3 unmodified lines | |||
| 287 | }; | 297 | }; |
| 288 | 298 | ||
| 289 | /** | 299 | /** |
| 290 | * struct_msg_rdma_hdr - header for read or write request | 300 | * struct rtrs_msg_rdma_hdr - header for read or write request |
| 291 | * @type: @RTRS_MSG_WRITE | @RTRS_MSG_READ | 301 | * @type: @RTRS_MSG_WRITE | @RTRS_MSG_READ |
| 292 | */ | 302 | */ |
| 293 | struct rtrs_msg_rdma_hdr { | 303 | struct rtrs_msg_rdma_hdr { |
| @@ -24,8 +24,8 @@ struct rtrs_srv_op; · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | * enum rtrs_clt_link_ev - Events about connectivity state of a client | 26 | * enum rtrs_clt_link_ev - Events about connectivity state of a client |
| 27 | * @RTRS_CLT_LINK_EV_RECONNECTED Client was reconnected. | 27 | * @RTRS_CLT_LINK_EV_RECONNECTED: Client was reconnected. |
| 28 | * @RTRS_CLT_LINK_EV_DISCONNECTED Client was disconnected. | 28 | * @RTRS_CLT_LINK_EV_DISCONNECTED: Client was disconnected. |
| 29 | */ | 29 | */ |
| 30 | enum rtrs_clt_link_ev { | 30 | enum rtrs_clt_link_ev { |
| 31 | RTRS_CLT_LINK_EV_RECONNECTED, | 31 | RTRS_CLT_LINK_EV_RECONNECTED, |
| @@ -33,7 +33,9 @@ enum rtrs_clt_link_ev { · 1 unmodified line | |||
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * Source and destination address of a path to be established | 36 | * struct rtrs_addr - Source and destination address of a path to be established |
| 37 | * @src: source address | ||
| 38 | * @dst: destination address | ||
| 37 | */ | 39 | */ |
| 38 | struct rtrs_addr { | 40 | struct rtrs_addr { |
| 39 | struct sockaddr_storage *src; | 41 | struct sockaddr_storage *src; |
| @@ -41,7 +43,7 @@ struct rtrs_addr { · 1 unmodified line | |||
| 41 | }; | 43 | }; |
| 42 | 44 | ||
| 43 | /** | 45 | /** |
| 44 | * rtrs_clt_ops - it holds the link event callback and private pointer. | 46 | * struct rtrs_clt_ops - it holds the link event callback and private pointer. |
| 45 | * @priv: User supplied private data. | 47 | * @priv: User supplied private data. |
| 46 | * @link_ev: Event notification callback function for connection state changes | 48 | * @link_ev: Event notification callback function for connection state changes |
| 47 | * @priv: User supplied data that was passed to rtrs_clt_open() | 49 | * @priv: User supplied data that was passed to rtrs_clt_open() |
| @@ -67,10 +69,10 @@ enum wait_type { · 19 unmodified lines | |||
| 67 | }; | 69 | }; |
| 68 | 70 | ||
| 69 | /** | 71 | /** |
| 70 | * enum rtrs_clt_con_type() type of ib connection to use with a given | 72 | * enum rtrs_clt_con_type - type of ib connection to use with a given |
| 71 | * rtrs_permit | 73 | * rtrs_permit |
| 72 | * @ADMIN_CON - use connection reserved for "service" messages | 74 | * @RTRS_ADMIN_CON: use connection reserved for "service" messages |
| 73 | * @IO_CON - use a connection reserved for IO | 75 | * @RTRS_IO_CON: use a connection reserved for IO |
| 74 | */ | 76 | */ |
| 75 | enum rtrs_clt_con_type { | 77 | enum rtrs_clt_con_type { |
| 76 | RTRS_ADMIN_CON, | 78 | RTRS_ADMIN_CON, |
| @@ -85,7 +87,7 @@ void rtrs_clt_put_permit(struct rtrs_clt_sess *sess, · 8 unmodified lines | |||
| 85 | struct rtrs_permit *permit); | 87 | struct rtrs_permit *permit); |
| 86 | 88 | ||
| 87 | /** | 89 | /** |
| 88 | * rtrs_clt_req_ops - it holds the request confirmation callback | 90 | * struct rtrs_clt_req_ops - it holds the request confirmation callback |
| 89 | * and a private pointer. | 91 | * and a private pointer. |
| 90 | * @priv: User supplied private data. | 92 | * @priv: User supplied private data. |
| 91 | * @conf_fn: callback function to be called as confirmation | 93 | * @conf_fn: callback function to be called as confirmation |
| @@ -105,7 +107,11 @@ int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops, · 13 unmodified lines | |||
| 105 | int rtrs_clt_rdma_cq_direct(struct rtrs_clt_sess *clt, unsigned int index); | 107 | int rtrs_clt_rdma_cq_direct(struct rtrs_clt_sess *clt, unsigned int index); |
| 106 | 108 | ||
| 107 | /** | 109 | /** |
| 108 | * rtrs_attrs - RTRS session attributes | 110 | * struct rtrs_attrs - RTRS session attributes |
| 111 | * @queue_depth: queue_depth saved from rtrs_clt_sess message | ||
| 112 | * @max_io_size: max_io_size from rtrs_clt_sess message, capped to | ||
| 113 | * @max_segments * %SZ_4K | ||
| 114 | * @max_segments: max_segments saved from rtrs_clt_sess message | ||
| 109 | */ | 115 | */ |
| 110 | struct rtrs_attrs { | 116 | struct rtrs_attrs { |
| 111 | u32 queue_depth; | 117 | u32 queue_depth; |
| @@ -57,8 +57,8 @@ struct irdma_alloc_ucontext_resp { · 56 unmodified lines | |||
| 57 | __u8 rsvd2; | 57 | __u8 rsvd2; |
| 58 | __aligned_u64 comp_mask; | 58 | __aligned_u64 comp_mask; |
| 59 | __u16 min_hw_wq_size; | 59 | __u16 min_hw_wq_size; |
| 60 | __u8 revd3[2]; | ||
| 60 | __u32 max_hw_srq_quanta; | 61 | __u32 max_hw_srq_quanta; |
| 61 | __u8 rsvd3[2]; | ||
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | struct irdma_alloc_pd_resp { | 64 | struct irdma_alloc_pd_resp { |
| @@ -192,6 +192,7 @@ struct rdma_ucm_query_path_resp { · 191 unmodified lines | |||
| 192 | 192 | ||
| 193 | struct rdma_ucm_query_ib_service_resp { | 193 | struct rdma_ucm_query_ib_service_resp { |
| 194 | __u32 num_service_recs; | 194 | __u32 num_service_recs; |
| 195 | __u32 reserved; | ||
| 195 | struct ib_user_service_rec recs[]; | 196 | struct ib_user_service_rec recs[]; |
| 196 | }; | 197 | }; |
| 197 | 198 | ||
| @@ -354,7 +355,7 @@ enum { · 156 unmodified lines | |||
| 354 | 355 | ||
| 355 | #define RDMA_USER_CM_IB_SERVICE_NAME_SIZE 64 | 356 | #define RDMA_USER_CM_IB_SERVICE_NAME_SIZE 64 |
| 356 | struct rdma_ucm_ib_service { | 357 | struct rdma_ucm_ib_service { |
| 357 | __u64 service_id; | 358 | __aligned_u64 service_id; |
| 358 | __u8 service_name[RDMA_USER_CM_IB_SERVICE_NAME_SIZE]; | 359 | __u8 service_name[RDMA_USER_CM_IB_SERVICE_NAME_SIZE]; |
| 359 | __u32 flags; | 360 | __u32 flags; |
| 360 | __u32 reserved; | 361 | __u32 reserved; |
| @@ -362,6 +363,7 @@ struct rdma_ucm_ib_service { · 1 unmodified line | |||
| 362 | 363 | ||
| 363 | struct rdma_ucm_resolve_ib_service { | 364 | struct rdma_ucm_resolve_ib_service { |
| 364 | __u32 id; | 365 | __u32 id; |
| 366 | __u32 reserved; | ||
| 365 | struct rdma_ucm_ib_service ibs; | 367 | struct rdma_ucm_ib_service ibs; |
| 366 | }; | 368 | }; |
| 367 | 369 | ||