IB/{core, usnic}: Add generic function to extract IB speed from netdev
Subsystems (4)
PATCH v3 1/1 IB/{core, usnic}: Add generic function to extract IB speed from netdev
Please review this change which adds generic function to extract speed from netdev and return IB speed to caller.
[PATCH v3 1/2] IB/usnic: Implement get_netdev hook
Preliminary and needed anyway patch which adds get_netdev implementation to usnic driver.
[PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev The actual patch that adds the $subject functionality.
Thanks,
Yuval
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170611054450.7221-1-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org
PATCH v3 1/2 IB/usnic: Implement get_netdev hook
usnic's get_netdev hook for struct ib_device is missing - add it.
---
Per Moni Shoua's suggestion - create seperate patch for this purpose.
--- drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 + drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 10 ++++++++++ drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 1 + 3 files changed, 12 insertions(+)
drivers/infiniband/hw/usnic/usnic_ib_main.c +1 -0
@@ -409,6 +409,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev) us_ibdev->ib_dev.query_port = usnic_ib_query_port; us_ibdev->ib_dev.query_pkey = usnic_ib_query_pkey; us_ibdev->ib_dev.query_gid = usnic_ib_query_gid; + us_ibdev->ib_dev.get_netdev = usnic_get_netdev; us_ibdev->ib_dev.get_link_layer = usnic_ib_port_link_layer; us_ibdev->ib_dev.alloc_pd = usnic_ib_alloc_pd; us_ibdev->ib_dev.dealloc_pd = usnic_ib_dealloc_pd;
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +10 -0
@@ -424,6 +424,16 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index,return 0 ; } +struct net_device *usnic_get_netdev (struct ib_device *device,u8 port_num) +{ +struct usnic_ib_dev *us_ibdev =to_usdev (device); + +if (us_ibdev->netdev) +dev_hold (us_ibdev->netdev); + +return us_ibdev->netdev; +} +int usnic_ib_query_pkey (struct ib_device *ibdev,u8 port,u16 index,u16 *pkey) {
drivers/infiniband/hw/usnic/usnic_ib_verbs.h +1 -0
@@ -48,6 +48,7 @@ int usnic_ib_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, struct ib_qp_init_attr *qp_init_attr);int usnic_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid); +struct net_device *usnic_get_netdev (struct ib_device *device,u8 port_num);int usnic_ib_query_pkey (struct ib_device *ibdev,u8 port,u16 index,u16 *pkey); struct ib_pd *usnic_ib_alloc_pd(struct ib_device *ibdev,
Signature · 6 lines
2.9.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170611054450.7221-2-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org
Re: [PATCH v3 1/2] IB/usnic: Implement get_netdev hook
Quoted 28 lines · Yuval Shaia
usnic's
get_netdevhook for structib_deviceis missing - add it.Signed-off-by Yuval Shaia <[email protected]>---
Per Moni Shoua's suggestion - create seperate patch for this purpose.--- drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 + drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 10 ++++++++++ drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 1 + 3 files changed, 12 insertions(+)drivers/infiniband/hw/usnic/usnic_ib_main.c +1
-0@@ -409,6 +409,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev) us_ibdev->ib_dev.query_port = usnic_ib_query_port; us_ibdev->ib_dev.query_pkey = usnic_ib_query_pkey; us_ibdev->ib_dev.query_gid = usnic_ib_query_gid; + us_ibdev->ib_dev.get_netdev = usnic_get_netdev; us_ibdev->ib_dev.get_link_layer = usnic_ib_port_link_layer; us_ibdev->ib_dev.alloc_pd = usnic_ib_alloc_pd; us_ibdev->ib_dev.dealloc_pd = usnic_ib_dealloc_pd;drivers/infiniband/hw/usnic/usnic_ib_verbs.c +0
-0
drivers/infiniband/hw/usnic/usnic_ib_verbs.c int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index, · line 432
Quoted 9 lines
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +6
-0@@ -424,6 +424,16 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index,return 0 ; } +struct net_device *usnic_get_netdev (struct ib_device *device,u8 port_num) +{ +struct usnic_ib_dev *us_ibdev =to_usdev (device); + +if (us_ibdev->netdev) +dev_hold (us_ibdev->netdev);
Who will release this reference?
Thanks
Quoted 26 lines
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +4
-0+ +return us_ibdev->netdev; +} +int usnic_ib_query_pkey (struct ib_device *ibdev,u8 port,u16 index,u16 *pkey) {drivers/infiniband/hw/usnic/usnic_ib_verbs.h +1
-1@@ -48,6 +48,7 @@ int usnic_ib_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, struct ib_qp_init_attr *qp_init_attr);int usnic_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid); +struct net_device *usnic_get_netdev (struct ib_device *device,u8 port_num);int usnic_ib_query_pkey (struct ib_device *ibdev,u8 port,u16 index,u16 *pkey); struct ib_pd *usnic_ib_alloc_pd(struct ib_device *ibdev, --2.9.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170613072526.GM2576-U/[email protected]
Re: [PATCH v3 1/2] IB/usnic: Implement get_netdev hook
Quoted 32 lines · Leon Romanovsky
Quoted 31 lines · Yuval Shaia
usnic's
get_netdevhook for structib_deviceis missing - add it.Signed-off-by Yuval Shaia <[email protected]>---
Per Moni Shoua's suggestion - create seperate patch for this purpose.--- drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 + drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 10 ++++++++++ drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 1 + 3 files changed, 12 insertions(+)drivers/infiniband/hw/usnic/usnic_ib_main.c +1
-0@@ -409,6 +409,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev) us_ibdev->ib_dev.query_port = usnic_ib_query_port; us_ibdev->ib_dev.query_pkey = usnic_ib_query_pkey; us_ibdev->ib_dev.query_gid = usnic_ib_query_gid; + us_ibdev->ib_dev.get_netdev = usnic_get_netdev; us_ibdev->ib_dev.get_link_layer = usnic_ib_port_link_layer; us_ibdev->ib_dev.alloc_pd = usnic_ib_alloc_pd; us_ibdev->ib_dev.dealloc_pd = usnic_ib_dealloc_pd;drivers/infiniband/hw/usnic/usnic_ib_verbs.c +0
-0@@ -424,6 +424,16 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index,return 0 ; }
Quoted 8 lines
drivers/infiniband/hw/usnic/usnic_ib_verbs.c int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index, · line 432
Quoted 6 lines
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +6
-0+struct net_device *usnic_get_netdev (struct ib_device *device,u8 port_num) +{ +struct usnic_ib_dev *us_ibdev =to_usdev (device); + +if (us_ibdev->netdev) +dev_hold (us_ibdev->netdev);Who will release this reference?
I followed the instructions in struct ib_device so assuming the one that calls get_netdev will do it.
See ib_cache_gid_add as an example.
Patch #2 aslo take care of it.
Quoted 25 lines
Thanks
Quoted 22 lines
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +4
-0+ +return us_ibdev->netdev; +} +int usnic_ib_query_pkey (struct ib_device *ibdev,u8 port,u16 index,u16 *pkey) {drivers/infiniband/hw/usnic/usnic_ib_verbs.h +1
-1@@ -48,6 +48,7 @@ int usnic_ib_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, struct ib_qp_init_attr *qp_init_attr);int usnic_ib_query_gid (struct ib_device *ibdev,u8 port,int index,union ib_gid *gid); +struct net_device *usnic_get_netdev (struct ib_device *device,u8 port_num);int usnic_ib_query_pkey (struct ib_device *ibdev,u8 port,u16 index,u16 *pkey); struct ib_pd *usnic_ib_alloc_pd(struct ib_device *ibdev, --2.9.4
Quoted 4 lines
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Leon Romanovsky
Reviewed-byRe: [PATCH v3 1/2] IB/usnic: Implement get_netdev hook
Quoted 42 lines · Yuval Shaia
Quoted 32 lines · Leon Romanovsky
Quoted 31 lines · Yuval Shaia
usnic's
get_netdevhook for structib_deviceis missing - add it.Signed-off-by Yuval Shaia <[email protected]>---
Per Moni Shoua's suggestion - create seperate patch for this purpose.--- drivers/infiniband/hw/usnic/usnic_ib_main.c | 1 + drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 10 ++++++++++ drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 1 + 3 files changed, 12 insertions(+)drivers/infiniband/hw/usnic/usnic_ib_main.c +1
-0@@ -409,6 +409,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev) us_ibdev->ib_dev.query_port = usnic_ib_query_port; us_ibdev->ib_dev.query_pkey = usnic_ib_query_pkey; us_ibdev->ib_dev.query_gid = usnic_ib_query_gid; + us_ibdev->ib_dev.get_netdev = usnic_get_netdev; us_ibdev->ib_dev.get_link_layer = usnic_ib_port_link_layer; us_ibdev->ib_dev.alloc_pd = usnic_ib_alloc_pd; us_ibdev->ib_dev.dealloc_pd = usnic_ib_dealloc_pd;drivers/infiniband/hw/usnic/usnic_ib_verbs.c +0
-0@@ -424,6 +424,16 @@ int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index,return 0 ; }Quoted 8 lines
drivers/infiniband/hw/usnic/usnic_ib_verbs.c int usnic_ib_query_gid(struct ib_device *ibdev, u8 port, int index, · line 432
Quoted 6 lines
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +6
-0+struct net_device *usnic_get_netdev (struct ib_device *device,u8 port_num) +{ +struct usnic_ib_dev *us_ibdev =to_usdev (device); + +if (us_ibdev->netdev) +dev_hold (us_ibdev->netdev);Who will release this reference?
Quoted 6 lines
I followed the instructions in struct
ib_deviceso assuming the one that callsget_netdevwill do it.
Seeib_cache_gid_addas an example.Patch #2 aslo take care of it.
Thanks,
Christian Benvenuti (benve)
Reviewed-byRE: [PATCH v3 1/2] IB/usnic: Implement get_netdev hook
In reply to a message not in the archiveQuoted 13 lines
-----Original Message-----
From: Yuval Shaia [mailto:[email protected]]
Sent: Saturday, June 10, 2017 10:45 PM
To: [email protected]; [email protected]; [email protected]; selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]; devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]; somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]; sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/[email protected]; Christian Benvenuti (benve); Dave Goodell (dgoodell); monis-VPRAkNaXOzVWk0Htik3J/[email protected]; leonro-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]; dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; sagi-TmH2Wj2nsNJBDLzU/[email protected]; [email protected]; yishaih-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]; [email protected]
Subject: [PATCH v3 1/2] IB/usnic: Implementget_netdevhook
Quoted 3 lines
usnic's
get_netdevhook for structib_deviceis missing - add it.Signed-off-by Yuval Shaia <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 2/2 IB/core: Add generic function to extract IB speed from netdev
In reply to a message not in the archiveLogic of retrieving netdev speed from net_device and translating it to IB speed is implemented in rxe, in usnic and in bnxt drivers.
Define new function which merges all.
---
v0 -> v1:
* Invite usnic to the party.
v1 -> v2:
* Utilize __ethtool_get_link_ksettings
* Rename to ib_get_eth_speed
* Add some validation checks
* Implement get_netdev in usnic
v2 -> v3:
* Split to two separate patches
--- drivers/infiniband/core/verbs.c | 55 ++++++++++++++++++++++++++++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 49 ++----------------------- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 31 +++------------- drivers/infiniband/sw/rxe/rxe_verbs.c | 53 +++------------------------ include/rdma/ib_verbs.h | 1 + 5 files changed, 71 insertions(+), 118 deletions(-)
drivers/infiniband/core/verbs.c +55 -0
@@ -1253,6 +1253,61 @@ int ib_resolve_eth_dmac(struct ib_device *device, }EXPORT_SYMBOL (ib_resolve_eth_dmac); +int ib_get_eth_speed (struct ib_device *dev,u8 port_num,u8 *speed,u8 *width) +{ +int rc; +u32 netdev_speed; +struct net_device *netdev; +struct ethtool_link_ksettings lksettings; + +if (rdma_port_get_link_layer (dev, port_num) !=IB_LINK_LAYER_ETHERNET ) +return -EINVAL ; + +if (!dev->get_netdev) +return -EINVAL ; + + netdev = dev->get_netdev (dev, port_num); +if (!netdev) +return -EINVAL ; + +rtnl_lock (); + rc =__ethtool_get_link_ksettings (netdev, &lksettings); +rtnl_unlock (); + +dev_put (netdev); + +if (!rc) { + netdev_speed = lksettings.base.speed; + }else { + netdev_speed =SPEED_1000 ; +pr_warn ("%s speed is unknown, defaulting to %d\n" , netdev->name, + netdev_speed); + } + +if (netdev_speed <=SPEED_1000 ) { + *width =IB_WIDTH_1X ; + *speed =IB_SPEED_SDR ; + }else if (netdev_speed <=SPEED_10000 ) { + *width =IB_WIDTH_1X ; + *speed =IB_SPEED_FDR10 ; + }else if (netdev_speed <=SPEED_20000 ) { + *width =IB_WIDTH_4X ; + *speed =IB_SPEED_DDR ; + }else if (netdev_speed <=SPEED_25000 ) { + *width =IB_WIDTH_1X ; + *speed =IB_SPEED_EDR ; + }else if (netdev_speed <=SPEED_40000 ) { + *width =IB_WIDTH_4X ; + *speed =IB_SPEED_FDR10 ; + }else { + *width =IB_WIDTH_4X ; + *speed =IB_SPEED_EDR ; + } + +return 0 ; +} +EXPORT_SYMBOL (ib_get_eth_speed); +int ib_modify_qp (struct ib_qp *qp,struct ib_qp_attr *qp_attr,int qp_attr_mask)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +3 -46
61 lines not on this page · raw message
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +6 -25
@@ -226,27 +226,6 @@ static void qp_grp_destroy(struct usnic_ib_qp_grp *qp_grp)spin_unlock (&vf->lock); } -static void eth_speed_to_ib_speed (int speed,u8 *active_speed, -u8 *active_width) -{ -if (speed <=10000 ) { - *active_width =IB_WIDTH_1X ; - *active_speed =IB_SPEED_FDR10 ; - }else if (speed <=20000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_DDR ; - }else if (speed <=30000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_QDR ; - }else if (speed <=40000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_FDR10 ; - }else { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_EDR ; - } -} -static int create_qp_validate_user_data (struct usnic_ib_create_qp_cmd cmd) { if (cmd.spec.trans_type <= USNIC_TRANSPORT_UNKNOWN ||
@@ -326,12 +305,16 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *props) {struct usnic_ib_dev *us_ibdev =to_usdev (ibdev); -struct ethtool_link_ksettings cmd;usnic_dbg ("\n" );mutex_lock (&us_ibdev->usdev_lock); -__ethtool_get_link_ksettings (us_ibdev->netdev, &cmd); +if (!ib_get_eth_speed (ibdev, port, &props->active_speed, + &props->active_width)) { +mutex_unlock (&us_ibdev->usdev_lock); +return -EINVAL ; + } +/* props being zeroed by the caller, avoid zeroing it here */ props->lid =0 ;
@@ -355,8 +338,6 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port, props->pkey_tbl_len =1 ; props->bad_pkey_cntr =0 ; props->qkey_viol_cntr =0 ; -eth_speed_to_ib_speed (cmd.base.speed, &props->active_speed, - &props->active_width); props->max_mtu =IB_MTU_4096 ; props->active_mtu =iboe_get_mtu (us_ibdev->ufdev->mtu);/* Userspace will adjust for hdrs */
drivers/infiniband/sw/rxe/rxe_verbs.c +6 -47
75 lines not on this page · raw message
include/rdma/ib_verbs.h +1 -0
@@ -3488,6 +3488,7 @@ void ib_drain_qp(struct ib_qp *qp);int ib_resolve_eth_dmac (struct ib_device *device,struct rdma_ah_attr *ah_attr); +int ib_get_eth_speed (struct ib_device *dev,u8 port_num,u8 *speed,u8 *width);static inline u8 *rdma_ah_retrieve_dmac (struct rdma_ah_attr *attr) {
Signature · 6 lines
2.9.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170611054450.7221-3-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org
Moni Shoua
Reviewed-byRe: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
Quoted 6 lines · Yuval Shaia
Logic of retrieving netdev speed from
net_deviceand translating it to IB speed is implemented in rxe, in usnic and in bnxt drivers.Define new function which merges all.
Signed-off-by Yuval Shaia <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAG9sBKOTmcpy=iSZZ3=PG_k5o7HNS4vNA1qaahVZeOP2d2FLBw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
Quoted 10 lines · Moni Shoua
Quoted 6 lines · Yuval Shaia
Logic of retrieving netdev speed from
net_deviceand translating it to IB speed is implemented in rxe, in usnic and in bnxt drivers.Define new function which merges all.
Signed-off-by Yuval Shaia <[email protected]>
Thanks,
Appreciate if you can also review patch #1 "IB/usnic: Implement get_netdev hook" as we can't apply this one without taking #1.
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Christian Benvenuti (benve)
Reviewed-byRE: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
In reply to a message not in the archiveQuoted 14 lines
-----Original Message-----
From: Yuval Shaia [mailto:[email protected]]
Sent: Saturday, June 10, 2017 10:45 PM
To: [email protected]; [email protected]; [email protected]; selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]; devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]; somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]; sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/[email protected]; Christian Benvenuti (benve); Dave Goodell (dgoodell); monis-VPRAkNaXOzVWk0Htik3J/[email protected]; leonro-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]; dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; sagi-TmH2Wj2nsNJBDLzU/[email protected]; [email protected]; yishaih-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]; [email protected]
Subject: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from
netdev
Quoted 6 lines
Logic of retrieving netdev speed from
net_deviceand translating it to IB speed is implemented in rxe, in usnic and in bnxt drivers.Define new function which merges all.
Signed-off-by Yuval Shaia <[email protected]>
Minor nit in ib_get_eth_speed().
For the usnic bits:
Quoted 27 lines
---
v0 -> v1:
* Invite usnic to the party.
v1 -> v2:
* Utilize__ethtool_get_link_ksettings
* Rename toib_get_eth_speed
* Add some validation checks
* Implementget_netdevin usnic
v2 -> v3:
* Split to two separate patches--- drivers/infiniband/core/verbs.c | 55 ++++++++++++++++++++++++++++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 49 ++----------------------- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 31 +++------------- drivers/infiniband/sw/rxe/rxe_verbs.c | 53 +++------------------------ include/rdma/ib_verbs.h | 1 + 5 files changed, 71 insertions(+), 118 deletions(-)drivers/infiniband/core/verbs.c +2
-0@@ -1253,6 +1253,61 @@ int ib_resolve_eth_dmac(struct ib_device *device, }EXPORT_SYMBOL (ib_resolve_eth_dmac); +int ib_get_eth_speed (struct ib_device *dev,u8 port_num,u8 *speed,u8 +*width) {
drivers/infiniband/core/verbs.c int ib_resolve_eth_dmac(struct ib_device *device, } · line 1266
Quoted 10 lines
drivers/infiniband/core/verbs.c +10
-0+int rc; +u32 netdev_speed; +struct net_device *netdev; +struct ethtool_link_ksettings lksettings; + +if (rdma_port_get_link_layer (dev, port_num) !=IB_LINK_LAYER_ETHERNET ) +return -EINVAL ; + +if (!dev->get_netdev) +return -EINVAL ;
-EOPNOTSUPP ?
Quoted 267 lines
drivers/infiniband/core/verbs.c +42
-0+ netdev = dev->get_netdev (dev, port_num); +if (!netdev) +return -EINVAL ; + +rtnl_lock (); + rc =__ethtool_get_link_ksettings (netdev, &lksettings); +rtnl_unlock (); + +dev_put (netdev); + +if (!rc) { + netdev_speed = lksettings.base.speed; + }else { + netdev_speed =SPEED_1000 ; +pr_warn ("%s speed is unknown, defaulting to %d\n" , netdev->name, + netdev_speed); + } + +if (netdev_speed <=SPEED_1000 ) { + *width =IB_WIDTH_1X ; + *speed =IB_SPEED_SDR ; + }else if (netdev_speed <=SPEED_10000 ) { + *width =IB_WIDTH_1X ; + *speed =IB_SPEED_FDR10 ; + }else if (netdev_speed <=SPEED_20000 ) { + *width =IB_WIDTH_4X ; + *speed =IB_SPEED_DDR ; + }else if (netdev_speed <=SPEED_25000 ) { + *width =IB_WIDTH_1X ; + *speed =IB_SPEED_EDR ; + }else if (netdev_speed <=SPEED_40000 ) { + *width =IB_WIDTH_4X ; + *speed =IB_SPEED_FDR10 ; + }else { + *width =IB_WIDTH_4X ; + *speed =IB_SPEED_EDR ; + } + +return 0 ; +} +EXPORT_SYMBOL (ib_get_eth_speed); +int ib_modify_qp (struct ib_qp *qp,struct ib_qp_attr *qp_attr,int qp_attr_mask)drivers/infiniband/hw/bnxt_re/ib_verbs.c +0
-43@@ -181,50 +181,6 @@ int bnxt_re_modify_device(struct ib_device *ibdev,return 0 ; } -static void __to_ib_speed_width (struct net_device *netdev,u8 *speed,u8 *width) -{ -struct ethtool_link_ksettings lksettings; -u32 espeed; - -if (netdev->ethtool_ops && netdev->ethtool_ops->get_link_ksettings) { -memset (&lksettings,0 ,sizeof (lksettings)); -rtnl_lock (); - netdev->ethtool_ops->get_link_ksettings (netdev, &lksettings); -rtnl_unlock (); - espeed = lksettings.base.speed; - }else { - espeed =SPEED_UNKNOWN ; - } -switch (espeed) { -case SPEED_1000 : - *speed =IB_SPEED_SDR ; - *width =IB_WIDTH_1X ; -break ; -case SPEED_10000 : - *speed =IB_SPEED_QDR ; - *width =IB_WIDTH_1X ; -break ; -case SPEED_20000 : - *speed =IB_SPEED_DDR ; - *width =IB_WIDTH_4X ; -break ; -case SPEED_25000 : - *speed =IB_SPEED_EDR ; - *width =IB_WIDTH_1X ; -break ; -case SPEED_40000 : - *speed =IB_SPEED_QDR ; - *width =IB_WIDTH_4X ; -break ; -case SPEED_50000 : -break ; -default : - *speed =IB_SPEED_SDR ; - *width =IB_WIDTH_1X ; -break ; - } -} -/* Port */ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num, struct ib_port_attr *port_attr) @@ -266,8 +222,9 @@ intbnxt_re_query_port(struct
ib_device*ibdev, u8port_num,drivers/infiniband/hw/bnxt_re/ib_verbs.c +3
-2* IB stack to avoid race in the NETDEV_UNREG path */ if (test_bit (BNXT_RE_FLAG_IBDEV_REGISTERED , &rdev->flags)) -__to_ib_speed_width (rdev->netdev, &port_attr->active_speed, - &port_attr->active_width); +if (!ib_get_eth_speed (ibdev, port_num, &port_attr->active_speed, + &port_attr->active_width)) +return -EINVAL ;return 0 ; }drivers/infiniband/hw/usnic/usnic_ib_verbs.c +0
-21@@ -226,27 +226,6 @@ static void qp_grp_destroy(struct usnic_ib_qp_grp *qp_grp)spin_unlock (&vf->lock); } -static void eth_speed_to_ib_speed (int speed,u8 *active_speed, -u8 *active_width) -{ -if (speed <=10000 ) { - *active_width =IB_WIDTH_1X ; - *active_speed =IB_SPEED_FDR10 ; - }else if (speed <=20000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_DDR ; - }else if (speed <=30000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_QDR ; - }else if (speed <=40000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_FDR10 ; - }else { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_EDR ; - } -} -static int create_qp_validate_user_data (struct usnic_ib_create_qp_cmd cmd) { if (cmd.spec.trans_type <= USNIC_TRANSPORT_UNKNOWN || @@ -326,12 +305,16 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,drivers/infiniband/hw/usnic/usnic_ib_verbs.c +6
-4struct ib_port_attr *props) {struct usnic_ib_dev *us_ibdev =to_usdev (ibdev); -struct ethtool_link_ksettings cmd;usnic_dbg ("\n" );mutex_lock (&us_ibdev->usdev_lock); -__ethtool_get_link_ksettings (us_ibdev->netdev, &cmd); +if (!ib_get_eth_speed (ibdev, port, &props->active_speed, + &props->active_width)) { +mutex_unlock (&us_ibdev->usdev_lock); +return -EINVAL ; + } +/* props being zeroed by the caller, avoid zeroing it here */ props->lid =0 ;@@ -355,8 +338,6 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port, props->pkey_tbl_len =1 ; props->bad_pkey_cntr =0 ; props->qkey_viol_cntr =0 ; -eth_speed_to_ib_speed (cmd.base.speed, &props->active_speed, - &props->active_width); props->max_mtu =IB_MTU_4096 ; props->active_mtu =iboe_get_mtu (us_ibdev->ufdev->mtu);/* Userspace will adjust for hdrs */ drivers/infiniband/sw/rxe/rxe_verbs.c +6
-47@@ -51,40 +51,16 @@ static int rxe_query_device(struct ib_device *dev,return 0 ; } -static void rxe_eth_speed_to_ib_speed (int speed,u8 *active_speed, -u8 *active_width) -{ -if (speed <=1000 ) { - *active_width =IB_WIDTH_1X ; - *active_speed =IB_SPEED_SDR ; - }else if (speed <=10000 ) { - *active_width =IB_WIDTH_1X ; - *active_speed =IB_SPEED_FDR10 ; - }else if (speed <=20000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_DDR ; - }else if (speed <=30000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_QDR ; - }else if (speed <=40000 ) { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_FDR10 ; - }else { - *active_width =IB_WIDTH_4X ; - *active_speed =IB_SPEED_EDR ; - } -} -static int rxe_query_port (struct ib_device *dev,u8 port_num,struct ib_port_attr *attr) {struct rxe_dev *rxe =to_rdev (dev);struct rxe_port *port; -u32 speed; +int rc = -EINVAL ;if (unlikely (port_num !=1 )) {pr_warn ("invalid port_number %d\n" , port_num); - goto err1; + goto out; } port = &rxe->port;@@ -93,29 +69,12 @@ static int rxe_query_port(struct ib_device *dev, *attr = port->attr;mutex_lock (&rxe->usdev_lock); -if (rxe->ndev->ethtool_ops->get_link_ksettings) { -struct ethtool_link_ksettings ks; - - rxe->ndev->ethtool_ops->get_link_ksettings (rxe->ndev, &ks); - speed = ks.base.speed; - }else if (rxe->ndev->ethtool_ops->get_settings) { -struct ethtool_cmd cmd; - - rxe->ndev->ethtool_ops->get_settings (rxe->ndev, &cmd); - speed = cmd.speed; - }else { -pr_warn ("%s speed is unknown, defaulting to 1000\n" , - rxe->ndev->name); - speed =1000 ; - } -rxe_eth_speed_to_ib_speed (speed, &attr->active_speed, - &attr->active_width); + rc =ib_get_eth_speed (dev, port_num, &attr->active_speed, + &attr->active_width);mutex_unlock (&rxe->usdev_lock); -return 0 ; - -err1: -return -EINVAL ; +out: +return rc; } static int rxe_query_gid(struct ib_device *device, diff --git
a/include/rdma/ib_verbs.hb/include/rdma/ib_verbs.hindex ba8314e..860cb30 100644include/rdma/ib_verbs.h +2
-1@@ -3488,6 +3488,7 @@ void ib_drain_qp(struct ib_qp *qp);int ib_resolve_eth_dmac (struct ib_device *device,struct rdma_ah_attr *ah_attr); +int ib_get_eth_speed (struct ib_device *dev,u8 port_num,u8 *speed,u8 +*width);static inline u8 *rdma_ah_retrieve_dmac (struct rdma_ah_attr *attr) { --
Quoted 1 line
2.9.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): e58c9e7782774aa1b710b779c44f918d-NcvnDpcxJI+VcpH5Q1TwH6BKnGwkPULj@public.gmane.org
Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
Quoted 15 lines · Christian Benvenuti (benve)
drivers/infiniband/core/verbs.c int ib_resolve_eth_dmac(struct ib_device *device, · line 1267
Quoted 13 lines
drivers/infiniband/core/verbs.c +12
-0+int ib_get_eth_speed (struct ib_device *dev,u8 port_num,u8 *speed,u8 +*width) { +int rc; +u32 netdev_speed; +struct net_device *netdev; +struct ethtool_link_ksettings lksettings; + +if (rdma_port_get_link_layer (dev, port_num) !=IB_LINK_LAYER_ETHERNET ) +return -EINVAL ; + +if (!dev->get_netdev) +return -EINVAL ;
-EOPNOTSUPP?
Looks better.
Assuming the same should be for the above one and the one below, right?
Quoted 8 lines
drivers/infiniband/core/verbs.c int ib_resolve_eth_dmac(struct ib_device *device, · line 1275
Quoted 8 lines
drivers/infiniband/core/verbs.c +7
-0+ netdev = dev->get_netdev (dev, port_num); +if (!netdev) +return -EINVAL ; + +rtnl_lock (); + rc =__ethtool_get_link_ksettings (netdev, &lksettings); +rtnl_unlock ();
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
Quoted 30 lines
-----Original Message-----
From: Yuval Shaia [mailto:[email protected]]
Sent: Wednesday, June 14, 2017 6:03 AM
To: Christian Benvenuti (benve)
Cc: [email protected]; [email protected]; [email protected]; selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]; devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]; somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]; sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/[email protected]; Dave Goodell (dgoodell); monis-VPRAkNaXOzVWk0Htik3J/[email protected]; leonro-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]; dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; sagi-TmH2Wj2nsNJBDLzU/[email protected]; [email protected]; yishaih-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]
Subject: Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed
from netdevQuoted 15 lines · Christian Benvenuti (benve)
drivers/infiniband/core/verbs.c int ib_resolve_eth_dmac(struct ib_device *device, · line 1267
Quoted 13 lines
drivers/infiniband/core/verbs.c +12
-0+int ib_get_eth_speed (struct ib_device *dev,u8 port_num,u8 *speed,u8 +*width) { +int rc; +u32 netdev_speed; +struct net_device *netdev; +struct ethtool_link_ksettings lksettings; + +if (rdma_port_get_link_layer (dev, port_num) !=IB_LINK_LAYER_ETHERNET ) +return -EINVAL ; + +if (!dev->get_netdev) +return -EINVAL ;
-EOPNOTSUPP?
Quoted 2 lines
Looks better.
Assuming the same should be for the above one and the one below, right?
I am not sure about the other two:
- rdma_port_get_link_layer() does not entirely depend on ib_device->get_link_layer()
- ib_device->get_netdev() can fail for different reasons I guess
/Chris
Quoted 8 lines
Quoted 8 lines
drivers/infiniband/core/verbs.c int ib_resolve_eth_dmac(struct ib_device *device, · line 1275
Quoted 8 lines
drivers/infiniband/core/verbs.c +7
-0+ netdev = dev->get_netdev (dev, port_num); +if (!netdev) +return -EINVAL ; + +rtnl_lock (); + rc =__ethtool_get_link_ksettings (netdev, &lksettings); +rtnl_unlock ();
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): e61752e6cd164574b08161ae5f4c43f6-NcvnDpcxJI+VcpH5Q1TwH6BKnGwkPULj@public.gmane.org
Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
Quoted 30 lines · Christian Benvenuti (benve)
Quoted 30 lines
-----Original Message-----
From: Yuval Shaia [mailto:[email protected]]
Sent: Wednesday, June 14, 2017 6:03 AM
To: Christian Benvenuti (benve)
Cc: [email protected]; [email protected]; [email protected]; selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]; devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]; somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]; sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/[email protected]; Dave Goodell (dgoodell); monis-VPRAkNaXOzVWk0Htik3J/[email protected]; leonro-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]; dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; sagi-TmH2Wj2nsNJBDLzU/[email protected]; [email protected]; yishaih-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]
Subject: Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed
from netdevQuoted 15 lines · Christian Benvenuti (benve)
Review
Quoted 13 lines
(quoted diff) +12
-0+int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 +*width) { + int rc; + u32 netdev_speed; + struct net_device *netdev; + struct ethtool_link_ksettings lksettings; + + if (rdma_port_get_link_layer(dev, port_num) != IB_LINK_LAYER_ETHERNET) + return -EINVAL; + + if (!dev->get_netdev) + return -EINVAL;
-EOPNOTSUPP?
Quoted 6 lines
Quoted 2 lines
Looks better.
Assuming the same should be for the above one and the one below, right?I am not sure about the other two:
-rdma_port_get_link_layer()does not entirely depend onib_device->get_link_layer()
-ib_device->get_netdev()can fail for different reasons I guess
I see,
So back to your proposal, the fact that dev->get_netdev is not set means that the IB device is not relayed on Ethernet one (RoCE folks, correct me if i'm wrong) so with the given input - the operation is not supported. Is that means that -EINVAL is better than -EOPNOTSUPP?
As far as the name suggest, EINVAL is where input values are wrong while EOPNOTSUPP is where input values are fine but the operation is not supported.
Yuval
Quoted 4 lines
/Chris
Quoted 1 line
Quoted 1 line
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ netdev = dev->get_netdev(dev, port_num); + if (!netdev) + return -EINVAL; + + rtnl_lock(); + rc = __ethtool_get_link_ksettings(netdev, &lksettings); + rtnl_unlock();--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
Quoted 40 lines · Yuval Shaia
Quoted 30 lines · Christian Benvenuti (benve)
Quoted 30 lines
-----Original Message-----
From: Yuval Shaia [mailto:[email protected]]
Sent: Wednesday, June 14, 2017 6:03 AM
To: Christian Benvenuti (benve)
Cc: [email protected]; [email protected]; [email protected]; selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]; devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]; somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]; sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/[email protected]; Dave Goodell (dgoodell); monis-VPRAkNaXOzVWk0Htik3J/[email protected]; leonro-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]; dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org; sagi-TmH2Wj2nsNJBDLzU/[email protected]; [email protected]; yishaih-VPRAkNaXOzVWk0Htik3J/[email protected]; [email protected]
Subject: Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed
from netdevQuoted 15 lines · Christian Benvenuti (benve)
Review
Quoted 13 lines
(quoted diff) +12
-0+int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 +*width) { + int rc; + u32 netdev_speed; + struct net_device *netdev; + struct ethtool_link_ksettings lksettings; + + if (rdma_port_get_link_layer(dev, port_num) != IB_LINK_LAYER_ETHERNET) + return -EINVAL; + + if (!dev->get_netdev) + return -EINVAL;
-EOPNOTSUPP?Quoted 6 lines
Quoted 2 lines
Looks better.
Assuming the same should be for the above one and the one below, right?I am not sure about the other two:
-rdma_port_get_link_layer()does not entirely depend onib_device->get_link_layer()
-ib_device->get_netdev()can fail for different reasons I guessI see,
Quoted 8 lines
So back to your proposal, the fact that
dev->get_netdevis not set means that the IB device is not relayed on Ethernet one (RoCE folks, correct me if i'm wrong) so with the given input - the operation is not supported. Is that means that-EINVALis better than-EOPNOTSUPP?As far as the name suggest, EINVAL is where input values are wrong while EOPNOTSUPP is where input values are fine but the operation is not supported.
Please ignore, i looked at some other places.
Will post v4 soon.
Quoted 18 lines
Yuval
Quoted 4 lines
/Chris
Quoted 1 line
Quoted 1 line
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ netdev = dev->get_netdev(dev, port_num); + if (!netdev) + return -EINVAL; + + rtnl_lock(); + rc = __ethtool_get_link_ksettings(netdev, &lksettings); + rtnl_unlock();--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Leon Romanovsky
Reviewed-byRe: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
In reply to a message not in the archiveQuoted 16 lines · Yuval Shaia
Logic of retrieving netdev speed from
net_deviceand translating it to IB speed is implemented in rxe, in usnic and in bnxt drivers.Define new function which merges all.
Signed-off-by Yuval Shaia <[email protected]>---
v0 -> v1:
* Invite usnic to the party.
v1 -> v2:
* Utilize__ethtool_get_link_ksettings
* Rename toib_get_eth_speed
* Add some validation checks
* Implementget_netdevin usnic
v2 -> v3:
* Split to two separate patches
Quoted 8 lines
--- drivers/infiniband/core/verbs.c | 55 ++++++++++++++++++++++++++++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 49 ++----------------------- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 31 +++------------- drivers/infiniband/sw/rxe/rxe_verbs.c | 53 +++------------------------ include/rdma/ib_verbs.h | 1 + 5 files changed, 71 insertions(+), 118 deletions(-)
Thanks,
Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
In reply to a message not in the archiveQuoted 56 lines · Yuval Shaia
drivers/infiniband/hw/bnxt_re/ib_verbs.c +0
-44@@ -181,50 +181,6 @@ int bnxt_re_modify_device(struct ib_device *ibdev,return 0 ; } -static void __to_ib_speed_width (struct net_device *netdev,u8 *speed,u8 *width) -{ -struct ethtool_link_ksettings lksettings; -u32 espeed; - -if (netdev->ethtool_ops && netdev->ethtool_ops->get_link_ksettings) { -memset (&lksettings,0 ,sizeof (lksettings)); -rtnl_lock (); - netdev->ethtool_ops->get_link_ksettings (netdev, &lksettings); -rtnl_unlock (); - espeed = lksettings.base.speed; - }else { - espeed =SPEED_UNKNOWN ; - } -switch (espeed) { -case SPEED_1000 : - *speed =IB_SPEED_SDR ; - *width =IB_WIDTH_1X ; -break ; -case SPEED_10000 : - *speed =IB_SPEED_QDR ; - *width =IB_WIDTH_1X ; -break ; -case SPEED_20000 : - *speed =IB_SPEED_DDR ; - *width =IB_WIDTH_4X ; -break ; -case SPEED_25000 : - *speed =IB_SPEED_EDR ; - *width =IB_WIDTH_1X ; -break ; -case SPEED_40000 : - *speed =IB_SPEED_QDR ; - *width =IB_WIDTH_4X ; -break ; -case SPEED_50000 : -break ; -default : - *speed =IB_SPEED_SDR ; - *width =IB_WIDTH_1X ; -break ; - } -} -/* Port */ int bnxt_re_query_port (struct ib_device *ibdev,u8 port_num,struct ib_port_attr *port_attr)
drivers/infiniband/hw/bnxt_re/ib_verbs.c int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num, · line 229
Quoted 10 lines
drivers/infiniband/hw/bnxt_re/ib_verbs.c +3
-2@@ -266,8 +222,9 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,* IB stack to avoid race in the NETDEV_UNREG path */ if (test_bit (BNXT_RE_FLAG_IBDEV_REGISTERED , &rdev->flags)) -__to_ib_speed_width (rdev->netdev, &port_attr->active_speed, - &port_attr->active_width); +if (!ib_get_eth_speed (ibdev, port_num, &port_attr->active_speed, + &port_attr->active_width)) +return -EINVAL ;return 0 ; }
The bnxt_re changes looks good to me.
But this change conflicts with one of the patches i submitted as a part of the bug fix series.
https://patchwork.kernel.org/patch/9786057/
Depending on the order in which Doug pulls these patches, one of us might have to
re-spin the patch.
Thanks,
Selvin Xavier
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CA+sbYW07k=UoFvJVLvjfTcuUosoJJk34mSZJAfXRaUJuHwS3cA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v3 2/2] IB/core: Add generic function to extract IB speed from netdev
Quoted 70 lines · Selvin Xavier
Quoted 56 lines · Yuval Shaia
drivers/infiniband/hw/bnxt_re/ib_verbs.c +0
-44@@ -181,50 +181,6 @@ int bnxt_re_modify_device(struct ib_device *ibdev,return 0 ; } -static void __to_ib_speed_width (struct net_device *netdev,u8 *speed,u8 *width) -{ -struct ethtool_link_ksettings lksettings; -u32 espeed; - -if (netdev->ethtool_ops && netdev->ethtool_ops->get_link_ksettings) { -memset (&lksettings,0 ,sizeof (lksettings)); -rtnl_lock (); - netdev->ethtool_ops->get_link_ksettings (netdev, &lksettings); -rtnl_unlock (); - espeed = lksettings.base.speed; - }else { - espeed =SPEED_UNKNOWN ; - } -switch (espeed) { -case SPEED_1000 : - *speed =IB_SPEED_SDR ; - *width =IB_WIDTH_1X ; -break ; -case SPEED_10000 : - *speed =IB_SPEED_QDR ; - *width =IB_WIDTH_1X ; -break ; -case SPEED_20000 : - *speed =IB_SPEED_DDR ; - *width =IB_WIDTH_4X ; -break ; -case SPEED_25000 : - *speed =IB_SPEED_EDR ; - *width =IB_WIDTH_1X ; -break ; -case SPEED_40000 : - *speed =IB_SPEED_QDR ; - *width =IB_WIDTH_4X ; -break ; -case SPEED_50000 : -break ; -default : - *speed =IB_SPEED_SDR ; - *width =IB_WIDTH_1X ; -break ; - } -} -/* Port */ int bnxt_re_query_port (struct ib_device *ibdev,u8 port_num,struct ib_port_attr *port_attr)drivers/infiniband/hw/bnxt_re/ib_verbs.c int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num, · line 229
Quoted 10 lines
drivers/infiniband/hw/bnxt_re/ib_verbs.c +3
-2@@ -266,8 +222,9 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,* IB stack to avoid race in the NETDEV_UNREG path */ if (test_bit (BNXT_RE_FLAG_IBDEV_REGISTERED , &rdev->flags)) -__to_ib_speed_width (rdev->netdev, &port_attr->active_speed, - &port_attr->active_width); +if (!ib_get_eth_speed (ibdev, port_num, &port_attr->active_speed, + &port_attr->active_width)) +return -EINVAL ;return 0 ; }The
bnxt_rechanges looks good to me.
Quoted 8 lines
But this change conflicts with one of the patches i submitted as a part of the bug fix series.
https://patchwork.kernel.org/patch/9786057/
Depending on the order in which Doug pulls these patches, one of us might have to
re-spin the patch.
Doug, you want me to rebase v4 of the patch on top of the above?
Quoted 7 lines
Thanks,
Selvin Xavier
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html