Skip to contentSkip to conversation

IB/cma: Allow XRG INI QPs to set their local ACK timeout

PATCH Superseded Håkon Bugge 2 participants 3 messages Feb 9, 2022 InfiniBand

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/cma: Allow XRG INI QPs to set their local ACK timeout

XRC INI QPs should be able to adjust their local ACK timeout.

Fixes 2c1619edef61 ("IB/cma: Define option to set ack timeout and pack tos_set")

---

To avoid excessive discussions around the *if (WARN_ON( ...* construct, just saying that it has been sanctioned by Jason here:

https://lore.kernel.org/linux-rdma/[email protected]/

---
 drivers/infiniband/core/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
index 0f5f0d7..006ea9c 100644
@@ -2811,7 +2811,7 @@ int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout)
 {
 	struct rdma_id_private *id_priv;
 
-	if (id->qp_type != IB_QPT_RC)
+	if (WARN_ON(id->qp_type != IB_QPT_RC && id->qp_type != IB_QPT_XRC_INI))
 		return -EINVAL;
 
 	id_priv = container_of(id, struct rdma_id_private, id);
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 6 lines · Håkon Bugge

XRC INI QPs should be able to adjust their local ACK timeout.

Fixes 2c1619edef61 ("IB/cma: Define option to set ack timeout and pack tos_set")
Quoted 6 lines

---

To avoid excessive discussions around the *if (WARN_ON( ...* construct, just saying that it has been sanctioned by Jason here:

https://lore.kernel.org/linux-rdma/[email protected]/

And I think that this is wrong, because it cane be triggered by user.
1. Create cm_id with any QP type you want - ucma_create_id()
2. Call to set option - ucma_set_option()
3. See WARN_ON.

Thanks

Quoted 20 lines
---
 drivers/infiniband/core/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
index 0f5f0d7..006ea9c 100644
@@ -2811,7 +2811,7 @@ int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout)
 {
 	struct rdma_id_private *id_priv;
 
-	if (id->qp_type != IB_QPT_RC)
+	if (WARN_ON(id->qp_type != IB_QPT_RC && id->qp_type != IB_QPT_XRC_INI))
 		return -EINVAL;
 
 	id_priv = container_of(id, struct rdma_id_private, id);
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 16 lines · Leon Romanovsky
Quoted 11 lines · Håkon Bugge

XRC INI QPs should be able to adjust their local ACK timeout.

Fixes 2c1619edef61 ("IB/cma: Define option to set ack timeout and pack tos_set")

---

To avoid excessive discussions around the *if (WARN_ON( ...* construct, just saying that it has been sanctioned by Jason here:

Quoted 6 lines
Quoted 1 line

https://lore.kernel.org/linux-rdma/[email protected]/

And I think that this is wrong, because it cane be triggered by user.
1. Create cm_id with any QP type you want - ucma_create_id()
2. Call to set option - ucma_set_option()
3. See WARN_ON.

Yes, this one is callable from user-space. Right. Will send a v2.

Thxs, Håkon

Quoted 22 lines

Thanks

Quoted 19 lines

---
drivers/infiniband/core/cma.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
index 0f5f0d7..006ea9c 100644
@@ -2811,7 +2811,7 @@ int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout)
 {
 	struct rdma_id_private *id_priv;
 
-	if (id->qp_type != IB_QPT_RC)
+	if (WARN_ON(id->qp_type != IB_QPT_RC && id->qp_type != IB_QPT_XRC_INI))
 		return -EINVAL;
 
 	id_priv = container_of(id, struct rdma_id_private, id);
Signature · 1 line
1.8.3.1