Skip to contentSkip to conversation

RDMA/siw: Fix setting active_{speed, width} attributes

PATCH Applied Kamal Heib 5 participants 10 messages Feb 18, 2020 – Feb 27, 2020

Subsystems (2)
lore
Share & tools
lore

Kamal Heib

author
#0 lore raw

PATCH v2 1/1 RDMA/siw: Fix setting active_{speed, width} attributes

Make sure to set the active_{speed, width} attributes to avoid reporting the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")

---
V2: Change rc to rv.

---
 drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/siw/siw_verbs.c +4 -3
index 73485d0da907..d5390d498c61 100644
@@ -165,11 +165,12 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 		   struct ib_port_attr *attr)
 {
 	struct siw_device *sdev = to_siw_dev(base_dev);
+	int rv;
 
 	memset(attr, 0, sizeof(*attr));
 
-	attr->active_speed = 2;
-	attr->active_width = 2;
+	rv = ib_get_eth_speed(base_dev, port, &attr->active_speed,
+			 &attr->active_width);
 	attr->gid_tbl_len = 1;
 	attr->max_msg_sz = -1;
 	attr->max_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu);
@@ -192,7 +193,7 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 	 * attr->subnet_timeout = 0;
 	 * attr->init_type_repy = 0;
 	 */
-	return 0;
+	return rv;
 }
 
 int siw_get_port_immutable(struct ib_device *base_dev, u8 port,
Signature · 1 line
2.21.1
Tested-by Reviewed-by on v2 1/1
#1 lore raw

-----"Kamal Heib" <[email protected]> wrote: -----

Quoted 51 lines

To: [email protected]
From: "Kamal Heib" <[email protected]>
Date: 02/18/2020 10:59AM
Cc: "Jason Gunthorpe" <[email protected]>, "Doug Ledford" <[email protected]>, "Bernard Metzler" <[email protected]>, "Kamal Heib" <[email protected]>
Subject: [EXTERNAL] [PATCH for-next v2] RDMA/siw: Fix setting active_{speed, width} attributes

Make sure to set the active_{speed, width} attributes to avoid reporting
the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")

---
V2: Change rc to rv.
---
drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---

1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/siw/siw_verbs.c +3 -2
index 73485d0da907..d5390d498c61 100644
@@ -165,11 +165,12 @@ int siw_query_port(struct ib_device *base_dev,
 u8 port,
 		   struct ib_port_attr *attr)
 {
 	struct siw_device *sdev = to_siw_dev(base_dev);
+	int rv;
 
 	memset(attr, 0, sizeof(*attr));
 
-	attr->active_speed = 2;
-	attr->active_width = 2;
+	rv = ib_get_eth_speed(base_dev, port, &attr->active_speed,
+			 &attr->active_width);
 	attr->gid_tbl_len = 1;
 	attr->max_msg_sz = -1;
	attr->max_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu);
drivers/infiniband/sw/siw/siw_verbs.c +1 -1
@@ -192,7 +193,7 @@ int siw_query_port(struct ib_device *base_dev, u8
 port,
 	 * attr->subnet_timeout = 0;
 	 * attr->init_type_repy = 0;
 	 */
-	return 0;
+	return rv;
 }
 
Quoted 5 lines

int siw_get_port_immutable(struct ib_device *base_dev, u8 port,

Signature · 1 line
2.21.1

Looks good, and does what it should do, thanks!

#2 lore raw
In reply to Kamal Heib
Quoted 16 lines · Kamal Heib

Make sure to set the active_{speed, width} attributes to avoid reporting the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")

---
V2: Change rc to rv.

---
 drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/siw/siw_verbs.c +0 -0
index 73485d0da907..d5390d498c61 100644

drivers/infiniband/sw/siw/siw_verbs.c int siw_query_port(struct ib_device *base_dev, u8 port, · line 170

Quoted 6 lines
drivers/infiniband/sw/siw/siw_verbs.c +1 -0
@@ -165,11 +165,12 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 		   struct ib_port_attr *attr)
 {
 	struct siw_device *sdev = to_siw_dev(base_dev);
+	int rv;
 
 	memset(attr, 0, sizeof(*attr));

This line should go too. IB/core clears attr prior to call driver.

Thanks

Quoted 20 lines
drivers/infiniband/sw/siw/siw_verbs.c +3 -4
-	attr->active_speed = 2;
-	attr->active_width = 2;
+	rv = ib_get_eth_speed(base_dev, port, &attr->active_speed,
+			 &attr->active_width);
 	attr->gid_tbl_len = 1;
 	attr->max_msg_sz = -1;
 	attr->max_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu);
@@ -192,7 +193,7 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 	 * attr->subnet_timeout = 0;
 	 * attr->init_type_repy = 0;
 	 */
-	return 0;
+	return rv;
 }
 
 int siw_get_port_immutable(struct ib_device *base_dev, u8 port,
--

2.21.1

author
#3 lore raw
Quoted 22 lines · Leon Romanovsky
Quoted 21 lines · Kamal Heib

Make sure to set the active_{speed, width} attributes to avoid reporting the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")

---
V2: Change rc to rv.

---
 drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -0
index 73485d0da907..d5390d498c61 100644
@@ -165,11 +165,12 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 		   struct ib_port_attr *attr)
 {
 	struct siw_device *sdev = to_siw_dev(base_dev);
+	int rv;
 
Quoted 6 lines

drivers/infiniband/sw/siw/siw_verbs.c int siw_query_port(struct ib_device *base_dev, u8 port, · line 170

Quoted 1 line
drivers/infiniband/sw/siw/siw_verbs.c +0 -0
 	memset(attr, 0, sizeof(*attr));

This line should go too. IB/core clears attr prior to call driver.

Thanks

This can be done in a separate patch as this patch fixes a specific issue.

Thanks,
Kamal

Quoted 20 lines
Quoted 20 lines
drivers/infiniband/sw/siw/siw_verbs.c +3 -4
-	attr->active_speed = 2;
-	attr->active_width = 2;
+	rv = ib_get_eth_speed(base_dev, port, &attr->active_speed,
+			 &attr->active_width);
 	attr->gid_tbl_len = 1;
 	attr->max_msg_sz = -1;
 	attr->max_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu);
@@ -192,7 +193,7 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 	 * attr->subnet_timeout = 0;
 	 * attr->init_type_repy = 0;
 	 */
-	return 0;
+	return rv;
 }
 
 int siw_get_port_immutable(struct ib_device *base_dev, u8 port,
--

2.21.1

#4 lore raw
Quoted 23 lines · Kamal Heib
Quoted 22 lines · Leon Romanovsky
Quoted 21 lines · Kamal Heib

Make sure to set the active_{speed, width} attributes to avoid reporting the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")

---
V2: Change rc to rv.

---
 drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -0
index 73485d0da907..d5390d498c61 100644
@@ -165,11 +165,12 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 		   struct ib_port_attr *attr)
 {
 	struct siw_device *sdev = to_siw_dev(base_dev);
+	int rv;
 
Quoted 8 lines
Quoted 6 lines

drivers/infiniband/sw/siw/siw_verbs.c int siw_query_port(struct ib_device *base_dev, u8 port, · line 170

Quoted 1 line
drivers/infiniband/sw/siw/siw_verbs.c +0 -0
 	memset(attr, 0, sizeof(*attr));

This line should go too. IB/core clears attr prior to call driver.

Thanks

This can be done in a separate patch as this patch fixes a specific issue.

Whatever works for you, if you don't value your own time, go for it, do separate patch for every line you are changing. It just looks crazy to see changes like this:
* changed line
* line to be changed, but not changed
* another changed line

Thanks

Quoted 24 lines

Thanks,
Kamal

Quoted 20 lines
Quoted 20 lines
drivers/infiniband/sw/siw/siw_verbs.c +3 -4
-	attr->active_speed = 2;
-	attr->active_width = 2;
+	rv = ib_get_eth_speed(base_dev, port, &attr->active_speed,
+			 &attr->active_width);
 	attr->gid_tbl_len = 1;
 	attr->max_msg_sz = -1;
 	attr->max_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu);
@@ -192,7 +193,7 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 	 * attr->subnet_timeout = 0;
 	 * attr->init_type_repy = 0;
 	 */
-	return 0;
+	return rv;
 }
 
 int siw_get_port_immutable(struct ib_device *base_dev, u8 port,
--

2.21.1

author
#5 lore raw
Quoted 33 lines · Leon Romanovsky
Quoted 23 lines · Kamal Heib
Quoted 22 lines · Leon Romanovsky
Quoted 21 lines · Kamal Heib

Make sure to set the active_{speed, width} attributes to avoid reporting the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")

---
V2: Change rc to rv.

---
 drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -0
index 73485d0da907..d5390d498c61 100644
@@ -165,11 +165,12 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 		   struct ib_port_attr *attr)
 {
 	struct siw_device *sdev = to_siw_dev(base_dev);
+	int rv;
 
Quoted 8 lines
Quoted 6 lines

drivers/infiniband/sw/siw/siw_verbs.c int siw_query_port(struct ib_device *base_dev, u8 port, · line 170

Quoted 1 line
drivers/infiniband/sw/siw/siw_verbs.c +0 -0
 	memset(attr, 0, sizeof(*attr));

This line should go too. IB/core clears attr prior to call driver.

Thanks

This can be done in a separate patch as this patch fixes a specific issue.

Quoted 9 lines

Whatever works for you, if you don't value your own time, go for it, do separate patch for every line you are changing. It just looks crazy to see changes like this:
* changed line
* line to be changed, but not changed
* another changed line

Thanks

Leon, With all my respect, This isn't your decision what I do and when.

W.R.T your suggestion for removing the memset() line, there are multiple places in the siw drivers that do memset in the ib_device_ops, with that said, I think that this need to be done in a separate patch. BTW you can do the change too ;)

Thanks,
Kamal

Quoted 24 lines
Quoted 24 lines

Thanks,
Kamal

Quoted 20 lines
Quoted 20 lines
drivers/infiniband/sw/siw/siw_verbs.c +3 -4
-	attr->active_speed = 2;
-	attr->active_width = 2;
+	rv = ib_get_eth_speed(base_dev, port, &attr->active_speed,
+			 &attr->active_width);
 	attr->gid_tbl_len = 1;
 	attr->max_msg_sz = -1;
 	attr->max_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu);
@@ -192,7 +193,7 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 	 * attr->subnet_timeout = 0;
 	 * attr->init_type_repy = 0;
 	 */
-	return 0;
+	return rv;
 }
 
 int siw_get_port_immutable(struct ib_device *base_dev, u8 port,
--

2.21.1

#6 lore raw
Quoted 41 lines · Kamal Heib
Quoted 40 lines · Leon Romanovsky
Quoted 23 lines · Kamal Heib
Quoted 22 lines · Leon Romanovsky
Quoted 21 lines · Kamal Heib

Make sure to set the active_{speed, width} attributes to avoid reporting the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")

---
V2: Change rc to rv.

---
 drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -0
index 73485d0da907..d5390d498c61 100644
@@ -165,11 +165,12 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 		   struct ib_port_attr *attr)
 {
 	struct siw_device *sdev = to_siw_dev(base_dev);
+	int rv;
 
Quoted 8 lines
Quoted 6 lines

drivers/infiniband/sw/siw/siw_verbs.c int siw_query_port(struct ib_device *base_dev, u8 port, · line 170

Quoted 1 line
drivers/infiniband/sw/siw/siw_verbs.c +0 -0
 	memset(attr, 0, sizeof(*attr));

This line should go too. IB/core clears attr prior to call driver.

Thanks

This can be done in a separate patch as this patch fixes a specific issue.

Whatever works for you, if you don't value your own time, go for it, do separate patch for every line you are changing. It just looks crazy to see changes like this:
* changed line
* line to be changed, but not changed
* another changed line

Quoted 4 lines
Quoted 2 lines

Thanks

Leon, With all my respect, This isn't your decision what I do and when.

Please carefully reread my answer, I didn't say what and when you should do, simply gave to you an explanation why request remove useless memeset makes sense in the context of proposed patch.

Thanks

#7 lore raw
Quoted 42 lines · Leon Romanovsky
Quoted 41 lines · Kamal Heib
Quoted 40 lines · Leon Romanovsky
Quoted 23 lines · Kamal Heib
Quoted 22 lines · Leon Romanovsky
Quoted 21 lines · Kamal Heib

Make sure to set the active_{speed, width} attributes to avoid reporting the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")

---
V2: Change rc to rv.

---
 drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -0
index 73485d0da907..d5390d498c61 100644
@@ -165,11 +165,12 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 		   struct ib_port_attr *attr)
 {
 	struct siw_device *sdev = to_siw_dev(base_dev);
+	int rv;
 
Quoted 8 lines
Quoted 6 lines

drivers/infiniband/sw/siw/siw_verbs.c int siw_query_port(struct ib_device *base_dev, u8 port, · line 170

Quoted 1 line
drivers/infiniband/sw/siw/siw_verbs.c +0 -0
 	memset(attr, 0, sizeof(*attr));

This line should go too. IB/core clears attr prior to call driver.

Thanks

This can be done in a separate patch as this patch fixes a specific issue.

Whatever works for you, if you don't value your own time, go for it, do separate patch for every line you are changing. It just looks crazy to see changes like this:
* changed line
* line to be changed, but not changed
* another changed line

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Thanks

Leon, With all my respect, This isn't your decision what I do and when.

Please carefully reread my answer, I didn't say what and when you should do, simply gave to you an explanation why request remove useless memeset makes sense in the context of proposed patch.

I tend to agree with Kamal..
If the patch contained the memset removal I would argue it should be dropped as it has nothing to do with the purpose of this commit. Just adds noise to the review.

author
#8 lore raw
In reply to Leon Romanovsky
Quoted 45 lines · Leon Romanovsky
Quoted 44 lines · Kamal Heib
Quoted 42 lines · Leon Romanovsky
Quoted 23 lines · Kamal Heib
Quoted 22 lines · Leon Romanovsky
Quoted 21 lines · Kamal Heib

Make sure to set the active_{speed, width} attributes to avoid reporting the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")

---
V2: Change rc to rv.

---
 drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -0
index 73485d0da907..d5390d498c61 100644
@@ -165,11 +165,12 @@ int siw_query_port(struct ib_device *base_dev, u8 port,
 		   struct ib_port_attr *attr)
 {
 	struct siw_device *sdev = to_siw_dev(base_dev);
+	int rv;
 
Quoted 8 lines
Quoted 6 lines

drivers/infiniband/sw/siw/siw_verbs.c int siw_query_port(struct ib_device *base_dev, u8 port, · line 170

Quoted 1 line
drivers/infiniband/sw/siw/siw_verbs.c +0 -0
 	memset(attr, 0, sizeof(*attr));

This line should go too. IB/core clears attr prior to call driver.

Thanks

This can be done in a separate patch as this patch fixes a specific issue.

Whatever works for you, if you don't value your own time, go for it, do separate patch for every line you are changing. It just looks crazy to see changes like this:
* changed line
* line to be changed, but not changed
* another changed line

Thanks

Quoted 7 lines
Quoted 1 line

Leon, With all my respect, This isn't your decision what I do and when.

Please carefully reread my answer, I didn't say what and when you should do, simply gave to you an explanation why request remove useless memeset makes sense in the context of proposed patch.

Thanks

I simply give an answer to why I think otherwise, That doesn't mean that I don't value my own time...

Thanks,
Kamal

#9 lore raw
In reply to Kamal Heib
Quoted 7 lines · Kamal Heib

Make sure to set the active_{speed, width} attributes to avoid reporting the same values regardless of the underlying device.

Fixes 303ae1cdfdf7 ("rdma/siw: application interface")
Quoted 5 lines

---
V2: Change rc to rv.

---
 drivers/infiniband/sw/siw/siw_verbs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Applied to for-next, thanks

Jason