Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44c58487 authored by Dasaratharaman Chandramouli's avatar Dasaratharaman Chandramouli Committed by Doug Ledford
Browse files

IB/core: Define 'ib' and 'roce' rdma_ah_attr types



rdma_ah_attr can now be either ib or roce allowing
core components to use one type or the other and also
to define attributes unique to a specific type. struct
ib_ah is also initialized with the type when its first
created. This ensures that calls such as modify_ah
dont modify the type of the address handle attribute.

Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarDon Hiatt <don.hiatt@intel.com>
Reviewed-by: default avatarSean Hefty <sean.hefty@intel.com>
Reviewed-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: default avatarDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent d8966fcd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1761,7 +1761,9 @@ static int cm_req_handler(struct cm_work *work)
	cm_process_routed_req(req_msg, work->mad_recv_wc->wc);
	cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]);

	memcpy(work->path[0].dmac, cm_id_priv->av.ah_attr.dmac, ETH_ALEN);
	if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE)
		memcpy(work->path[0].dmac, cm_id_priv->av.ah_attr.roce.dmac,
		       ETH_ALEN);
	grh = rdma_ah_read_grh(&cm_id_priv->av.ah_attr);
	work->path[0].hop_limit = grh->hop_limit;
	ret = ib_get_cached_gid(work->port->cm_dev->ib_device,
+1 −0
Original line number Diff line number Diff line
@@ -743,6 +743,7 @@ int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num,
		return ret;

	memset(ah_attr, 0, sizeof *ah_attr);
	ah_attr->type = rdma_ah_find_type(device, port_num);

	rdma_ah_set_dlid(ah_attr, be16_to_cpu(rec->mlid));
	rdma_ah_set_sl(ah_attr, rec->sl);
+4 −1
Original line number Diff line number Diff line
@@ -1108,6 +1108,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
	struct net_device *ndev = NULL;

	memset(ah_attr, 0, sizeof *ah_attr);
	ah_attr->type = rdma_ah_find_type(device, port_num);

	rdma_ah_set_dlid(ah_attr, be16_to_cpu(rec->dlid));
	rdma_ah_set_sl(ah_attr, rec->sl);
@@ -1192,7 +1193,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
	}

	if (use_roce)
		memcpy(ah_attr->dmac, rec->dmac, ETH_ALEN);
		memcpy(ah_attr->roce.dmac, rec->dmac, ETH_ALEN);

	return 0;
}
@@ -2029,6 +2030,8 @@ static void update_sm_ah(struct work_struct *work)
		pr_err("Couldn't find index for default PKey\n");

	memset(&ah_attr, 0, sizeof(ah_attr));
	ah_attr.type = rdma_ah_find_type(port->agent->device,
					 port->port_num);
	rdma_ah_set_dlid(&ah_attr, port_attr.sm_lid);
	rdma_ah_set_sl(&ah_attr, port_attr.sm_sl);
	rdma_ah_set_port_num(&ah_attr, port->port_num);
+2 −0
Original line number Diff line number Diff line
@@ -491,6 +491,8 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
	}

	memset(&ah_attr, 0, sizeof ah_attr);
	ah_attr.type = rdma_ah_find_type(file->port->ib_dev,
					 file->port->port_num);
	rdma_ah_set_dlid(&ah_attr, be16_to_cpu(packet->mad.hdr.lid));
	rdma_ah_set_sl(&ah_attr, packet->mad.hdr.sl);
	rdma_ah_set_path_bits(&ah_attr, packet->mad.hdr.path_bits);
+5 −0
Original line number Diff line number Diff line
@@ -1954,6 +1954,8 @@ static int modify_qp(struct ib_uverbs_file *file,
	attr->alt_timeout	  = cmd->base.alt_timeout;
	attr->rate_limit	  = cmd->rate_limit;

	attr->ah_attr.type = rdma_ah_find_type(qp->device,
					       cmd->base.dest.port_num);
	if (cmd->base.dest.is_global) {
		rdma_ah_set_grh(&attr->ah_attr, NULL,
				cmd->base.dest.flow_label,
@@ -1971,6 +1973,8 @@ static int modify_qp(struct ib_uverbs_file *file,
	rdma_ah_set_port_num(&attr->ah_attr,
			     cmd->base.dest.port_num);

	attr->alt_ah_attr.type = rdma_ah_find_type(qp->device,
						   cmd->base.dest.port_num);
	if (cmd->base.alt_dest.is_global) {
		rdma_ah_set_grh(&attr->alt_ah_attr, NULL,
				cmd->base.alt_dest.flow_label,
@@ -2551,6 +2555,7 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
		goto err;
	}

	attr.type = rdma_ah_find_type(ib_dev, cmd.attr.port_num);
	rdma_ah_set_dlid(&attr, cmd.attr.dlid);
	rdma_ah_set_sl(&attr, cmd.attr.sl);
	rdma_ah_set_path_bits(&attr, cmd.attr.src_path_bits);
Loading