lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <552FB05E.2020707@profitbricks.com>
Date:	Thu, 16 Apr 2015 14:51:42 +0200
From:	Michael Wang <yun.wang@...fitbricks.com>
To:	Hal Rosenstock <hal@....mellanox.co.il>
CC:	Roland Dreier <roland@...nel.org>,
	Sean Hefty <sean.hefty@...el.com>,
	Hal Rosenstock <hal.rosenstock@...il.com>,
	linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
	Tom Tucker <tom@...ngridcomputing.com>,
	Steve Wise <swise@...ngridcomputing.com>,
	Hoang-Nam Nguyen <hnguyen@...ibm.com>,
	Christoph Raisch <raisch@...ibm.com>,
	Mike Marciniszyn <infinipath@...el.com>,
	Eli Cohen <eli@...lanox.com>,
	Faisal Latif <faisal.latif@...el.com>,
	Jack Morgenstein <jackm@....mellanox.co.il>,
	Or Gerlitz <ogerlitz@...lanox.com>,
	Haggai Eran <haggaie@...lanox.com>,
	Ira Weiny <ira.weiny@...el.com>, Tom Talpey <tom@...pey.com>,
	Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
	Doug Ledford <dledford@...hat.com>
Subject: Re: [PATCH v4 03/27] IB/Verbs: Reform IB-core mad/agent/user_mad

Hi,Hal

Thanks for the comments :-)

On 04/16/2015 02:43 PM, Hal Rosenstock wrote:
[snip]
>> @@ -3102,9 +3102,6 @@ static void ib_mad_remove_device(struct ib_device *device)
>>  {
>>  	int i, num_ports, cur_port;
>>  
>> -	if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
>> -		return;
>> -
>>  	if (device->node_type == RDMA_NODE_IB_SWITCH) {
>>  		num_ports = 1;
>>  		cur_port = 0;
>> @@ -3113,6 +3110,9 @@ static void ib_mad_remove_device(struct ib_device *device)
>>  		cur_port = 1;
>>  	}
>>  	for (i = 0; i < num_ports; i++, cur_port++) {
>> +		if (!rdma_ib_or_iboe(device, i))
> 
> Shouldn't this be:
> 		if (!rdma_ib_or_iboe(device, cur_port))
> ?

Agree, actually it's unnecessary to use both i and cur_port, we can just use the
same way inside ib_mad_init_device() ;-)

Regards,
Michael Wang

> 
> -- Hal
> 
>> +			continue;
>> +
>>  		if (ib_agent_port_close(device, cur_port))
>>  			dev_err(&device->dev,
>>  				"Couldn't close port %d for agents\n",
>> diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
>> index 928cdd2..71fc8ba 100644
>> --- a/drivers/infiniband/core/user_mad.c
>> +++ b/drivers/infiniband/core/user_mad.c
>> @@ -1273,9 +1273,7 @@ static void ib_umad_add_one(struct ib_device *device)
>>  {
>>  	struct ib_umad_device *umad_dev;
>>  	int s, e, i;
>> -
>> -	if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
>> -		return;
>> +	int count = 0;
>>  
>>  	if (device->node_type == RDMA_NODE_IB_SWITCH)
>>  		s = e = 0;
>> @@ -1296,11 +1294,21 @@ static void ib_umad_add_one(struct ib_device *device)
>>  	umad_dev->end_port   = e;
>>  
>>  	for (i = s; i <= e; ++i) {
>> +		if (!rdma_ib_or_iboe(device, i))
>> +			continue;
>> +
>>  		umad_dev->port[i - s].umad_dev = umad_dev;
>>  
>>  		if (ib_umad_init_port(device, i, umad_dev,
>>  				      &umad_dev->port[i - s]))
>>  			goto err;
>> +
>> +		count++;
>> +	}
>> +
>> +	if (!count) {
>> +		kobject_put(&umad_dev->kobj);
>> +		return;
>>  	}
>>  
>>  	ib_set_client_data(device, &umad_client, umad_dev);
>> @@ -1308,8 +1316,12 @@ static void ib_umad_add_one(struct ib_device *device)
>>  	return;
>>  
>>  err:
>> -	while (--i >= s)
>> +	while (--i >= s) {
>> +		if (!rdma_ib_or_iboe(device, i))
>> +			continue;
>> +
>>  		ib_umad_kill_port(&umad_dev->port[i - s]);
>> +	}
>>  
>>  	kobject_put(&umad_dev->kobj);
>>  }
>> @@ -1322,8 +1334,10 @@ static void ib_umad_remove_one(struct ib_device *device)
>>  	if (!umad_dev)
>>  		return;
>>  
>> -	for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i)
>> -		ib_umad_kill_port(&umad_dev->port[i]);
>> +	for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i) {
>> +		if (rdma_ib_or_iboe(device, i))
>> +			ib_umad_kill_port(&umad_dev->port[i]);
>> +	}
>>  
>>  	kobject_put(&umad_dev->kobj);
>>  }
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ