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

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

IB/SA: Rename ib_sa_path_rec to sa_path_rec



Rename ib_sa_path_rec to a more generic sa_path_rec.
This is part of extending ib_sa to also support OPA
path records in addition to the IB defined path records.

Reviewed-by: default avatarDon Hiatt <don.hiatt@intel.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 82ffc226
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -241,7 +241,7 @@ struct cm_work {
	__be32 local_id;			/* Established / timewait */
	__be32 local_id;			/* Established / timewait */
	__be32 remote_id;
	__be32 remote_id;
	struct ib_cm_event cm_event;
	struct ib_cm_event cm_event;
	struct ib_sa_path_rec path[0];
	struct sa_path_rec path[0];
};
};


struct cm_timewait_info {
struct cm_timewait_info {
@@ -440,7 +440,7 @@ static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
			   grh, &av->ah_attr);
			   grh, &av->ah_attr);
}
}


static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av,
static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
			      struct cm_id_private *cm_id_priv)
			      struct cm_id_private *cm_id_priv)
{
{
	struct cm_device *cm_dev;
	struct cm_device *cm_dev;
@@ -1172,8 +1172,8 @@ static void cm_format_req(struct cm_req_msg *req_msg,
			  struct cm_id_private *cm_id_priv,
			  struct cm_id_private *cm_id_priv,
			  struct ib_cm_req_param *param)
			  struct ib_cm_req_param *param)
{
{
	struct ib_sa_path_rec *pri_path = param->primary_path;
	struct sa_path_rec *pri_path = param->primary_path;
	struct ib_sa_path_rec *alt_path = param->alternate_path;
	struct sa_path_rec *alt_path = param->alternate_path;


	cm_format_mad_hdr(&req_msg->hdr, CM_REQ_ATTR_ID,
	cm_format_mad_hdr(&req_msg->hdr, CM_REQ_ATTR_ID,
			  cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_REQ));
			  cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_REQ));
@@ -1401,8 +1401,8 @@ static inline int cm_is_active_peer(__be64 local_ca_guid, __be64 remote_ca_guid,
}
}


static void cm_format_paths_from_req(struct cm_req_msg *req_msg,
static void cm_format_paths_from_req(struct cm_req_msg *req_msg,
					    struct ib_sa_path_rec *primary_path,
				     struct sa_path_rec *primary_path,
					    struct ib_sa_path_rec *alt_path)
				     struct sa_path_rec *alt_path)
{
{
	memset(primary_path, 0, sizeof(*primary_path));
	memset(primary_path, 0, sizeof(*primary_path));
	primary_path->dgid = req_msg->primary_local_gid;
	primary_path->dgid = req_msg->primary_local_gid;
@@ -2815,7 +2815,7 @@ static int cm_mra_handler(struct cm_work *work)


static void cm_format_lap(struct cm_lap_msg *lap_msg,
static void cm_format_lap(struct cm_lap_msg *lap_msg,
			  struct cm_id_private *cm_id_priv,
			  struct cm_id_private *cm_id_priv,
			  struct ib_sa_path_rec *alternate_path,
			  struct sa_path_rec *alternate_path,
			  const void *private_data,
			  const void *private_data,
			  u8 private_data_len)
			  u8 private_data_len)
{
{
@@ -2845,7 +2845,7 @@ static void cm_format_lap(struct cm_lap_msg *lap_msg,
}
}


int ib_send_cm_lap(struct ib_cm_id *cm_id,
int ib_send_cm_lap(struct ib_cm_id *cm_id,
		   struct ib_sa_path_rec *alternate_path,
		   struct sa_path_rec *alternate_path,
		   const void *private_data,
		   const void *private_data,
		   u8 private_data_len)
		   u8 private_data_len)
{
{
@@ -2899,7 +2899,7 @@ out: spin_unlock_irqrestore(&cm_id_priv->lock, flags);
EXPORT_SYMBOL(ib_send_cm_lap);
EXPORT_SYMBOL(ib_send_cm_lap);


static void cm_format_path_from_lap(struct cm_id_private *cm_id_priv,
static void cm_format_path_from_lap(struct cm_id_private *cm_id_priv,
				    struct ib_sa_path_rec *path,
				    struct sa_path_rec *path,
				    struct cm_lap_msg *lap_msg)
				    struct cm_lap_msg *lap_msg)
{
{
	memset(path, 0, sizeof *path);
	memset(path, 0, sizeof *path);
@@ -3712,7 +3712,7 @@ static void cm_recv_handler(struct ib_mad_agent *mad_agent,
	atomic_long_inc(&port->counter_group[CM_RECV].
	atomic_long_inc(&port->counter_group[CM_RECV].
			counter[attr_id - CM_ATTR_ID_OFFSET]);
			counter[attr_id - CM_ATTR_ID_OFFSET]);


	work = kmalloc(sizeof(*work) + sizeof(struct ib_sa_path_rec) * paths,
	work = kmalloc(sizeof(*work) + sizeof(struct sa_path_rec) * paths,
		       GFP_KERNEL);
		       GFP_KERNEL);
	if (!work) {
	if (!work) {
		ib_free_recv_mad(mad_recv_wc);
		ib_free_recv_mad(mad_recv_wc);
+4 −4
Original line number Original line Diff line number Diff line
@@ -1128,7 +1128,7 @@ static inline int cma_any_port(struct sockaddr *addr)
static void cma_save_ib_info(struct sockaddr *src_addr,
static void cma_save_ib_info(struct sockaddr *src_addr,
			     struct sockaddr *dst_addr,
			     struct sockaddr *dst_addr,
			     struct rdma_cm_id *listen_id,
			     struct rdma_cm_id *listen_id,
			     struct ib_sa_path_rec *path)
			     struct sa_path_rec *path)
{
{
	struct sockaddr_ib *listen_ib, *ib;
	struct sockaddr_ib *listen_ib, *ib;


@@ -2301,7 +2301,7 @@ void rdma_set_service_type(struct rdma_cm_id *id, int tos)
}
}
EXPORT_SYMBOL(rdma_set_service_type);
EXPORT_SYMBOL(rdma_set_service_type);


static void cma_query_handler(int status, struct ib_sa_path_rec *path_rec,
static void cma_query_handler(int status, struct sa_path_rec *path_rec,
			      void *context)
			      void *context)
{
{
	struct cma_work *work = context;
	struct cma_work *work = context;
@@ -2328,7 +2328,7 @@ static int cma_query_ib_route(struct rdma_id_private *id_priv, int timeout_ms,
			      struct cma_work *work)
			      struct cma_work *work)
{
{
	struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
	struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
	struct ib_sa_path_rec path_rec;
	struct sa_path_rec path_rec;
	ib_sa_comp_mask comp_mask;
	ib_sa_comp_mask comp_mask;
	struct sockaddr_in6 *sin6;
	struct sockaddr_in6 *sin6;
	struct sockaddr_ib *sib;
	struct sockaddr_ib *sib;
@@ -2453,7 +2453,7 @@ static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms)
}
}


int rdma_set_ib_paths(struct rdma_cm_id *id,
int rdma_set_ib_paths(struct rdma_cm_id *id,
		      struct ib_sa_path_rec *path_rec, int num_paths)
		      struct sa_path_rec *path_rec, int num_paths)
{
{
	struct rdma_id_private *id_priv;
	struct rdma_id_private *id_priv;
	int ret;
	int ret;
+10 −10
Original line number Original line Diff line number Diff line
@@ -129,7 +129,7 @@ struct ib_sa_service_query {
};
};


struct ib_sa_path_query {
struct ib_sa_path_query {
	void (*callback)(int, struct ib_sa_path_rec *, void *);
	void (*callback)(int, struct sa_path_rec *, void *);
	void *context;
	void *context;
	struct ib_sa_query sa_query;
	struct ib_sa_query sa_query;
};
};
@@ -188,8 +188,8 @@ static DEFINE_SPINLOCK(tid_lock);
static u32 tid;
static u32 tid;


#define PATH_REC_FIELD(field) \
#define PATH_REC_FIELD(field) \
	.struct_offset_bytes = offsetof(struct ib_sa_path_rec, field),		\
	.struct_offset_bytes = offsetof(struct sa_path_rec, field),	\
	.struct_size_bytes   = sizeof ((struct ib_sa_path_rec *) 0)->field,	\
	.struct_size_bytes   = sizeof((struct sa_path_rec *)0)->field,	\
	.field_name          = "sa_path_rec:" #field
	.field_name          = "sa_path_rec:" #field


static const struct ib_field path_rec_table[] = {
static const struct ib_field path_rec_table[] = {
@@ -618,7 +618,7 @@ static inline int ib_sa_query_cancelled(struct ib_sa_query *query)
static void ib_nl_set_path_rec_attrs(struct sk_buff *skb,
static void ib_nl_set_path_rec_attrs(struct sk_buff *skb,
				     struct ib_sa_query *query)
				     struct ib_sa_query *query)
{
{
	struct ib_sa_path_rec *sa_rec = query->mad_buf->context[1];
	struct sa_path_rec *sa_rec = query->mad_buf->context[1];
	struct ib_sa_mad *mad = query->mad_buf->mad;
	struct ib_sa_mad *mad = query->mad_buf->mad;
	ib_sa_comp_mask comp_mask = mad->sa_hdr.comp_mask;
	ib_sa_comp_mask comp_mask = mad->sa_hdr.comp_mask;
	u16 val16;
	u16 val16;
@@ -1099,7 +1099,7 @@ static u8 get_src_path_mask(struct ib_device *device, u8 port_num)
}
}


int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
			 struct ib_sa_path_rec *rec,
			 struct sa_path_rec *rec,
			 struct rdma_ah_attr *ah_attr)
			 struct rdma_ah_attr *ah_attr)
{
{
	int ret;
	int ret;
@@ -1301,13 +1301,13 @@ static int send_mad(struct ib_sa_query *query, int timeout_ms, gfp_t gfp_mask)
	return ret ? ret : id;
	return ret ? ret : id;
}
}


void ib_sa_unpack_path(void *attribute, struct ib_sa_path_rec *rec)
void ib_sa_unpack_path(void *attribute, struct sa_path_rec *rec)
{
{
	ib_unpack(path_rec_table, ARRAY_SIZE(path_rec_table), attribute, rec);
	ib_unpack(path_rec_table, ARRAY_SIZE(path_rec_table), attribute, rec);
}
}
EXPORT_SYMBOL(ib_sa_unpack_path);
EXPORT_SYMBOL(ib_sa_unpack_path);


void ib_sa_pack_path(struct ib_sa_path_rec *rec, void *attribute)
void ib_sa_pack_path(struct sa_path_rec *rec, void *attribute)
{
{
	ib_pack(path_rec_table, ARRAY_SIZE(path_rec_table), rec, attribute);
	ib_pack(path_rec_table, ARRAY_SIZE(path_rec_table), rec, attribute);
}
}
@@ -1321,7 +1321,7 @@ static void ib_sa_path_rec_callback(struct ib_sa_query *sa_query,
		container_of(sa_query, struct ib_sa_path_query, sa_query);
		container_of(sa_query, struct ib_sa_path_query, sa_query);


	if (mad) {
	if (mad) {
		struct ib_sa_path_rec rec;
		struct sa_path_rec rec;


		ib_unpack(path_rec_table, ARRAY_SIZE(path_rec_table),
		ib_unpack(path_rec_table, ARRAY_SIZE(path_rec_table),
			  mad->data, &rec);
			  mad->data, &rec);
@@ -1366,11 +1366,11 @@ static void ib_sa_path_rec_release(struct ib_sa_query *sa_query)
 */
 */
int ib_sa_path_rec_get(struct ib_sa_client *client,
int ib_sa_path_rec_get(struct ib_sa_client *client,
		       struct ib_device *device, u8 port_num,
		       struct ib_device *device, u8 port_num,
		       struct ib_sa_path_rec *rec,
		       struct sa_path_rec *rec,
		       ib_sa_comp_mask comp_mask,
		       ib_sa_comp_mask comp_mask,
		       int timeout_ms, gfp_t gfp_mask,
		       int timeout_ms, gfp_t gfp_mask,
		       void (*callback)(int status,
		       void (*callback)(int status,
					struct ib_sa_path_rec *resp,
					struct sa_path_rec *resp,
					void *context),
					void *context),
		       void *context,
		       void *context,
		       struct ib_sa_query **sa_query)
		       struct ib_sa_query **sa_query)
+3 −3
Original line number Original line Diff line number Diff line
@@ -702,10 +702,10 @@ static int ib_ucm_alloc_data(const void **dest, u64 src, u32 len)
	return 0;
	return 0;
}
}


static int ib_ucm_path_get(struct ib_sa_path_rec **path, u64 src)
static int ib_ucm_path_get(struct sa_path_rec **path, u64 src)
{
{
	struct ib_user_path_rec upath;
	struct ib_user_path_rec upath;
	struct ib_sa_path_rec  *sa_path;
	struct sa_path_rec  *sa_path;


	*path = NULL;
	*path = NULL;


@@ -962,7 +962,7 @@ static ssize_t ib_ucm_send_lap(struct ib_ucm_file *file,
			       int in_len, int out_len)
			       int in_len, int out_len)
{
{
	struct ib_ucm_context *ctx;
	struct ib_ucm_context *ctx;
	struct ib_sa_path_rec *path = NULL;
	struct sa_path_rec *path = NULL;
	struct ib_ucm_lap cmd;
	struct ib_ucm_lap cmd;
	const void *data = NULL;
	const void *data = NULL;
	int result;
	int result;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1197,7 +1197,7 @@ static int ucma_set_option_id(struct ucma_context *ctx, int optname,
static int ucma_set_ib_path(struct ucma_context *ctx,
static int ucma_set_ib_path(struct ucma_context *ctx,
			    struct ib_path_rec_data *path_data, size_t optlen)
			    struct ib_path_rec_data *path_data, size_t optlen)
{
{
	struct ib_sa_path_rec sa_path;
	struct sa_path_rec sa_path;
	struct rdma_cm_event event;
	struct rdma_cm_event event;
	int ret;
	int ret;


Loading