diff options
Diffstat (limited to 'drivers/infiniband/core/cm.c')
| -rw-r--r-- | drivers/infiniband/core/cm.c | 58 | 
1 files changed, 27 insertions, 31 deletions
| diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 3d194bb60840..0ead0d223154 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -202,7 +202,7 @@ static struct attribute *cm_counter_default_attrs[] = {  struct cm_port {  	struct cm_device *cm_dev;  	struct ib_mad_agent *mad_agent; -	u8 port_num; +	u32 port_num;  	struct list_head cm_priv_prim_list;  	struct list_head cm_priv_altr_list;  	struct cm_counter_group counter_group[CM_COUNTER_GROUPS]; @@ -255,7 +255,8 @@ struct cm_id_private {  	struct completion comp;  	refcount_t refcount;  	/* Number of clients sharing this ib_cm_id. Only valid for listeners. -	 * Protected by the cm.lock spinlock. */ +	 * Protected by the cm.lock spinlock. +	 */  	int listen_sharecount;  	struct rcu_head rcu; @@ -420,8 +421,7 @@ static int cm_alloc_response_msg(struct cm_port *port,  	return 0;  } -static void * cm_copy_private_data(const void *private_data, -				   u8 private_data_len) +static void *cm_copy_private_data(const void *private_data, u8 private_data_len)  {  	void *data; @@ -680,8 +680,8 @@ static struct cm_id_private *cm_insert_listen(struct cm_id_private *cm_id_priv,  	return cm_id_priv;  } -static struct cm_id_private * cm_find_listen(struct ib_device *device, -					     __be64 service_id) +static struct cm_id_private *cm_find_listen(struct ib_device *device, +					    __be64 service_id)  {  	struct rb_node *node = cm.listen_service_table.rb_node;  	struct cm_id_private *cm_id_priv; @@ -708,8 +708,8 @@ static struct cm_id_private * cm_find_listen(struct ib_device *device,  	return NULL;  } -static struct cm_timewait_info * cm_insert_remote_id(struct cm_timewait_info -						     *timewait_info) +static struct cm_timewait_info * +cm_insert_remote_id(struct cm_timewait_info *timewait_info)  {  	struct rb_node **link = &cm.remote_id_table.rb_node;  	struct rb_node *parent = NULL; @@ -767,8 +767,8 @@ static struct cm_id_private *cm_find_remote_id(__be64 remote_ca_guid,  	return res;  } -static struct cm_timewait_info * cm_insert_remote_qpn(struct cm_timewait_info -						      *timewait_info) +static struct cm_timewait_info * +cm_insert_remote_qpn(struct cm_timewait_info *timewait_info)  {  	struct rb_node **link = &cm.remote_qp_table.rb_node;  	struct rb_node *parent = NULL; @@ -797,8 +797,8 @@ static struct cm_timewait_info * cm_insert_remote_qpn(struct cm_timewait_info  	return NULL;  } -static struct cm_id_private * cm_insert_remote_sidr(struct cm_id_private -						    *cm_id_priv) +static struct cm_id_private * +cm_insert_remote_sidr(struct cm_id_private *cm_id_priv)  {  	struct rb_node **link = &cm.remote_sidr_table.rb_node;  	struct rb_node *parent = NULL; @@ -897,7 +897,7 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device,  }  EXPORT_SYMBOL(ib_create_cm_id); -static struct cm_work * cm_dequeue_work(struct cm_id_private *cm_id_priv) +static struct cm_work *cm_dequeue_work(struct cm_id_private *cm_id_priv)  {  	struct cm_work *work; @@ -986,7 +986,7 @@ static void cm_remove_remote(struct cm_id_private *cm_id_priv)  	}  } -static struct cm_timewait_info * cm_create_timewait_info(__be32 local_id) +static struct cm_timewait_info *cm_create_timewait_info(__be32 local_id)  {  	struct cm_timewait_info *timewait_info; @@ -1631,7 +1631,7 @@ static bool cm_req_has_alt_path(struct cm_req_msg *req_msg)  					       req_msg))));  } -static void cm_path_set_rec_type(struct ib_device *ib_device, u8 port_num, +static void cm_path_set_rec_type(struct ib_device *ib_device, u32 port_num,  				 struct sa_path_rec *path, union ib_gid *gid)  {  	if (ib_is_opa_gid(gid) && rdma_cap_opa_ah(ib_device, port_num)) @@ -1750,7 +1750,7 @@ static void cm_format_paths_from_req(struct cm_req_msg *req_msg,  static u16 cm_get_bth_pkey(struct cm_work *work)  {  	struct ib_device *ib_dev = work->port->cm_dev->ib_device; -	u8 port_num = work->port->port_num; +	u32 port_num = work->port->port_num;  	u16 pkey_index = work->mad_recv_wc->wc->pkey_index;  	u16 pkey;  	int ret; @@ -1778,7 +1778,7 @@ static void cm_opa_to_ib_sgid(struct cm_work *work,  			      struct sa_path_rec *path)  {  	struct ib_device *dev = work->port->cm_dev->ib_device; -	u8 port_num = work->port->port_num; +	u32 port_num = work->port->port_num;  	if (rdma_cap_opa_ah(dev, port_num) &&  	    (ib_is_opa_gid(&path->sgid))) { @@ -1977,8 +1977,8 @@ unlock:	spin_unlock_irq(&cm_id_priv->lock);  free:	cm_free_msg(msg);  } -static struct cm_id_private * cm_match_req(struct cm_work *work, -					   struct cm_id_private *cm_id_priv) +static struct cm_id_private *cm_match_req(struct cm_work *work, +					  struct cm_id_private *cm_id_priv)  {  	struct cm_id_private *listen_cm_id_priv, *cur_cm_id_priv;  	struct cm_timewait_info *timewait_info; @@ -2138,20 +2138,17 @@ static int cm_req_handler(struct cm_work *work)  		goto destroy;  	} -	cm_process_routed_req(req_msg, work->mad_recv_wc->wc); -  	memset(&work->path[0], 0, sizeof(work->path[0]));  	if (cm_req_has_alt_path(req_msg))  		memset(&work->path[1], 0, sizeof(work->path[1]));  	grh = rdma_ah_read_grh(&cm_id_priv->av.ah_attr);  	gid_attr = grh->sgid_attr; -	if (gid_attr && -	    rdma_protocol_roce(work->port->cm_dev->ib_device, -			       work->port->port_num)) { +	if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) {  		work->path[0].rec_type =  			sa_conv_gid_to_pathrec_type(gid_attr->gid_type);  	} else { +		cm_process_routed_req(req_msg, work->mad_recv_wc->wc);  		cm_path_set_rec_type(  			work->port->cm_dev->ib_device, work->port->port_num,  			&work->path[0], @@ -2993,7 +2990,7 @@ static void cm_format_rej_event(struct cm_work *work)  		IBA_GET_MEM_PTR(CM_REJ_PRIVATE_DATA, rej_msg);  } -static struct cm_id_private * cm_acquire_rejected_id(struct cm_rej_msg *rej_msg) +static struct cm_id_private *cm_acquire_rejected_id(struct cm_rej_msg *rej_msg)  {  	struct cm_id_private *cm_id_priv;  	__be32 remote_id; @@ -3098,7 +3095,7 @@ int ib_send_cm_mra(struct ib_cm_id *cm_id,  	cm_id_priv = container_of(cm_id, struct cm_id_private, id);  	spin_lock_irqsave(&cm_id_priv->lock, flags); -	switch(cm_id_priv->id.state) { +	switch (cm_id_priv->id.state) {  	case IB_CM_REQ_RCVD:  		cm_state = IB_CM_MRA_REQ_SENT;  		lap_state = cm_id->lap_state; @@ -3155,7 +3152,7 @@ error2:	spin_unlock_irqrestore(&cm_id_priv->lock, flags);  }  EXPORT_SYMBOL(ib_send_cm_mra); -static struct cm_id_private * cm_acquire_mraed_id(struct cm_mra_msg *mra_msg) +static struct cm_id_private *cm_acquire_mraed_id(struct cm_mra_msg *mra_msg)  {  	switch (IBA_GET(CM_MRA_MESSAGE_MRAED, mra_msg)) {  	case CM_MSG_RESPONSE_REQ: @@ -3917,8 +3914,7 @@ static int cm_establish(struct ib_cm_id *cm_id)  	cm_id_priv = container_of(cm_id, struct cm_id_private, id);  	spin_lock_irqsave(&cm_id_priv->lock, flags); -	switch (cm_id->state) -	{ +	switch (cm_id->state) {  	case IB_CM_REP_SENT:  	case IB_CM_MRA_REP_RCVD:  		cm_id->state = IB_CM_ESTABLISHED; @@ -4334,7 +4330,7 @@ static int cm_add_one(struct ib_device *ib_device)  	unsigned long flags;  	int ret;  	int count = 0; -	unsigned int i; +	u32 i;  	cm_dev = kzalloc(struct_size(cm_dev, port, ib_device->phys_port_cnt),  			 GFP_KERNEL); @@ -4432,7 +4428,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data)  		.clr_port_cap_mask = IB_PORT_CM_SUP  	};  	unsigned long flags; -	unsigned int i; +	u32 i;  	write_lock_irqsave(&cm.device_lock, flags);  	list_del(&cm_dev->list); | 
