Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/core: Rename rdma_route.num_paths field to num_pri_alt_paths

This fields means the total number of primary and alternative paths,
i.e.,:
0 - No primary nor alternate path is available;
1 - Only primary path is available;
2 - Both primary and alternate path are available.
Rename it to avoid confusion as with follow patches primary path will
support multiple path records.

Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Link: https://lore.kernel.org/r/cbe424de63a56207870d70c5edce7c68e45f429e.1662631201.git.leonro@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>

authored by

Mark Zhang and committed by
Leon Romanovsky
bf9a9928 9bdb9350

+20 -15
+9 -9
drivers/infiniband/core/cma.c
··· 2241 2241 goto err; 2242 2242 2243 2243 rt = &id->route; 2244 - rt->num_paths = ib_event->param.req_rcvd.alternate_path ? 2 : 1; 2245 - rt->path_rec = kmalloc_array(rt->num_paths, sizeof(*rt->path_rec), 2246 - GFP_KERNEL); 2244 + rt->num_pri_alt_paths = ib_event->param.req_rcvd.alternate_path ? 2 : 1; 2245 + rt->path_rec = kmalloc_array(rt->num_pri_alt_paths, 2246 + sizeof(*rt->path_rec), GFP_KERNEL); 2247 2247 if (!rt->path_rec) 2248 2248 goto err; 2249 2249 2250 2250 rt->path_rec[0] = *path; 2251 - if (rt->num_paths == 2) 2251 + if (rt->num_pri_alt_paths == 2) 2252 2252 rt->path_rec[1] = *ib_event->param.req_rcvd.alternate_path; 2253 2253 2254 2254 if (net_dev) { ··· 2826 2826 route = &work->id->id.route; 2827 2827 2828 2828 if (!status) { 2829 - route->num_paths = 1; 2829 + route->num_pri_alt_paths = 1; 2830 2830 *route->path_rec = *path_rec; 2831 2831 } else { 2832 2832 work->old_state = RDMA_CM_ROUTE_QUERY; ··· 3081 3081 dev_put(ndev); 3082 3082 } 3083 3083 3084 - id->route.num_paths = 1; 3084 + id->route.num_pri_alt_paths = 1; 3085 3085 return 0; 3086 3086 3087 3087 err_free: ··· 3214 3214 goto err1; 3215 3215 } 3216 3216 3217 - route->num_paths = 1; 3217 + route->num_pri_alt_paths = 1; 3218 3218 3219 3219 ndev = cma_iboe_set_path_rec_l2_fields(id_priv); 3220 3220 if (!ndev) { ··· 3274 3274 err2: 3275 3275 kfree(route->path_rec); 3276 3276 route->path_rec = NULL; 3277 - route->num_paths = 0; 3277 + route->num_pri_alt_paths = 0; 3278 3278 err1: 3279 3279 kfree(work); 3280 3280 return ret; ··· 4265 4265 } 4266 4266 4267 4267 req.primary_path = &route->path_rec[0]; 4268 - if (route->num_paths == 2) 4268 + if (route->num_pri_alt_paths == 2) 4269 4269 req.alternate_path = &route->path_rec[1]; 4270 4270 4271 4271 req.ppath_sgid_attr = id_priv->id.route.addr.dev_addr.sgid_attr;
+5 -5
drivers/infiniband/core/ucma.c
··· 754 754 { 755 755 struct rdma_dev_addr *dev_addr; 756 756 757 - resp->num_paths = route->num_paths; 758 - switch (route->num_paths) { 757 + resp->num_paths = route->num_pri_alt_paths; 758 + switch (route->num_pri_alt_paths) { 759 759 case 0: 760 760 dev_addr = &route->addr.dev_addr; 761 761 rdma_addr_get_dgid(dev_addr, ··· 781 781 struct rdma_route *route) 782 782 { 783 783 784 - resp->num_paths = route->num_paths; 785 - switch (route->num_paths) { 784 + resp->num_paths = route->num_pri_alt_paths; 785 + switch (route->num_pri_alt_paths) { 786 786 case 0: 787 787 rdma_ip2gid((struct sockaddr *)&route->addr.dst_addr, 788 788 (union ib_gid *)&resp->ib_route[0].dgid); ··· 921 921 if (!resp) 922 922 return -ENOMEM; 923 923 924 - resp->num_paths = ctx->cm_id->route.num_paths; 924 + resp->num_paths = ctx->cm_id->route.num_pri_alt_paths; 925 925 for (i = 0, out_len -= sizeof(*resp); 926 926 i < resp->num_paths && out_len > sizeof(struct ib_path_rec_data); 927 927 i++, out_len -= sizeof(struct ib_path_rec_data)) {
+6 -1
include/rdma/rdma_cm.h
··· 52 52 struct rdma_route { 53 53 struct rdma_addr addr; 54 54 struct sa_path_rec *path_rec; 55 - int num_paths; 55 + /* 56 + * 0 - No primary nor alternate path is available 57 + * 1 - Only primary path is available 58 + * 2 - Both primary and alternate path are available 59 + */ 60 + int num_pri_alt_paths; 56 61 }; 57 62 58 63 struct rdma_conn_param {