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: <01d762f7-6388-9539-68ee-5425b4d56e58@hisilicon.com>
Date:   Thu, 27 Jul 2023 11:44:50 +0800
From:   Junxian Huang <huangjunxian6@...ilicon.com>
To:     Leon Romanovsky <leon@...nel.org>
CC:     <jgg@...dia.com>, <linux-rdma@...r.kernel.org>,
        <linuxarm@...wei.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 for-next] RDMA/core: Get IB width and speed from netdev



On 2023/7/24 19:19, Leon Romanovsky wrote:
> On Fri, Jul 21, 2023 at 05:20:52PM +0800, Junxian Huang wrote:
>> From: Haoyue Xu <xuhaoyue1@...ilicon.com>
>>
>> Previously, there was no way to query the number of lanes for a network
>> card, so the same netdev_speed would result in a fixed pair of width and
>> speed. As network card specifications become more diverse, such fixed
>> mode is no longer suitable, so a method is needed to obtain the correct
>> width and speed based on the number of lanes.
>>
>> This patch retrieves netdev lanes and speed from net_device and
>> translates them to IB width and speed.
>>
>> Signed-off-by: Haoyue Xu <xuhaoyue1@...ilicon.com>
>> Signed-off-by: Luoyouming <luoyouming@...wei.com>
>> Signed-off-by: Junxian Huang <huangjunxian6@...ilicon.com>
>> ---
>>  drivers/infiniband/core/verbs.c | 100 +++++++++++++++++++++++++-------
>>  1 file changed, 79 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
>> index b99b3cc283b6..25367bd6dd97 100644
>> --- a/drivers/infiniband/core/verbs.c
>> +++ b/drivers/infiniband/core/verbs.c
>> @@ -1880,6 +1880,80 @@ int ib_modify_qp_with_udata(struct ib_qp *ib_qp, struct ib_qp_attr *attr,
>>  }
>>  EXPORT_SYMBOL(ib_modify_qp_with_udata);
>>  
>> +static void ib_get_width_and_speed(u32 netdev_speed, u32 lanes,
>> +				   u16 *speed, u8 *width)
> 
> <...>
> 
>> +	switch (netdev_speed / lanes) {
>> +	case SPEED_2500:
>> +		*speed = IB_SPEED_SDR;
>> +		break;
>> +	case SPEED_5000:
>> +		*speed = IB_SPEED_DDR;
>> +		break;
>> +	case SPEED_10000:
>> +		*speed = IB_SPEED_FDR10;
>> +		break;
>> +	case SPEED_14000:
>> +		*speed = IB_SPEED_FDR;
>> +		break;
>> +	case SPEED_25000:
>> +		*speed = IB_SPEED_EDR;
>> +		break;
>> +	case SPEED_50000:
>> +		*speed = IB_SPEED_HDR;
>> +		break;
>> +	case SPEED_100000:
>> +		*speed = IB_SPEED_NDR;
>> +		break;
>> +	default:
>> +		*speed = IB_SPEED_SDR;
>> +	}
> 
> How did you come to these translation values?
> 
> Thanks

The IB spec defines the mapping relationship between IB speed and transfer
rate. For example, if the transfer rate of is 2.5Gbps(SPEED_2500), the IB
speed will be set to IB_SPEED_SDR.

Junxian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ