Skip to contentSkip to conversation

IB/core: Fix for core panic

PATCH Superseded Dennis Dalessandro 3 participants 3 messages Aug 30, 2017 – Aug 31, 2017 1 message not in the archive InfiniBand

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/core: Fix for core panic

From: Alex Estrin <[email protected]>

Rdma device driver may not have implemented (*get_link_layer)() so it can not be called directly. Should use appropriate helper function.

Fixes 523633359224 ("IB/core: Fix the validations of a multicast LID in attach or detach operations")
---
 drivers/infiniband/core/verbs.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/core/verbs.c +4 -3
index ee9e27d..123084a 100644
@@ -1646,8 +1646,9 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
 	 */
 	if (!ib_query_qp(qp, &attr, IB_QP_STATE | IB_QP_PORT, &init_attr)) {
 		if (attr.qp_state >= IB_QPS_INIT) {
-			if (qp->device->get_link_layer(qp->device, attr.port_num) !=
-			    IB_LINK_LAYER_INFINIBAND)
+			enum rdma_link_layer ll =
+			rdma_port_get_link_layer(qp->device, attr.port_num);
+			if (ll != IB_LINK_LAYER_INFINIBAND)
 				return true;
 			goto lid_check;
 		}
@@ -1655,7 +1656,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
 
 	/* Can't get a quick answer, iterate over all ports */
 	for (port = 0; port < qp->device->phys_port_cnt; port++)
-		if (qp->device->get_link_layer(qp->device, port) !=
+		if (rdma_port_get_link_layer(qp->device, port) !=
 		    IB_LINK_LAYER_INFINIBAND)
 			num_eth_ports++;
 

--
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

Reviewed-by
#2 lore raw
In reply to a message not in the archive
Quoted 8 lines · Dennis Dalessandro

From: Alex Estrin <[email protected]>

Rdma device driver may not have implemented (*get_link_layer)() so it can not be called directly. Should use appropriate helper function.

Fixes 523633359224 ("IB/core: Fix the validations of a multicast LID in attach or detach operations")
Quoted 31 lines
---
 drivers/infiniband/core/verbs.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/core/verbs.c +4 -4
index ee9e27d..123084a 100644
@@ -1646,8 +1646,9 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
 	 */
 	if (!ib_query_qp(qp, &attr, IB_QP_STATE | IB_QP_PORT, &init_attr)) {
 		if (attr.qp_state >= IB_QPS_INIT) {
-			if (qp->device->get_link_layer(qp->device, attr.port_num) !=
-			    IB_LINK_LAYER_INFINIBAND)
+			enum rdma_link_layer ll =
+			rdma_port_get_link_layer(qp->device, attr.port_num);
+			if (ll != IB_LINK_LAYER_INFINIBAND)
 				return true;
 			goto lid_check;
 		}
@@ -1655,7 +1656,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
 
 	/* Can't get a quick answer, iterate over all ports */
 	for (port = 0; port < qp->device->phys_port_cnt; port++)
-		if (qp->device->get_link_layer(qp->device, port) !=
+		if (rdma_port_get_link_layer(qp->device, port) !=
 		    IB_LINK_LAYER_INFINIBAND)
 			num_eth_ports++;
 
 
--
Quoted 3 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

Reviewed-by
#3 lore raw
In reply to a message not in the archive
Quoted 3 lines · Dennis Dalessandro

From: Alex Estrin <[email protected]>

Rdma device driver may not have implemented (*get_link_layer)()

s/Rdma/RDMA

Quoted 14 lines

so it can not be called directly. Should use appropriate helper function.

Fixes 523633359224 ("IB/core: Fix the validations of a multicast LID in attach or detach operations")
---
 drivers/infiniband/core/verbs.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/infiniband/core/verbs.c +0 -0
index ee9e27d..123084a 100644

drivers/infiniband/core/verbs.c static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid) · line 1651

Quoted 8 lines
drivers/infiniband/core/verbs.c +3 -2
@@ -1646,8 +1646,9 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
 	 */
 	if (!ib_query_qp(qp, &attr, IB_QP_STATE | IB_QP_PORT, &init_attr)) {
 		if (attr.qp_state >= IB_QPS_INIT) {
-			if (qp->device->get_link_layer(qp->device, attr.port_num) !=
-			    IB_LINK_LAYER_INFINIBAND)
+			enum rdma_link_layer ll =
+			rdma_port_get_link_layer(qp->device, attr.port_num);
+			if (ll != IB_LINK_LAYER_INFINIBAND)

Please do the same solution as you did below. There is no need in temp variable.

Thanks,

Quoted 15 lines
drivers/infiniband/core/verbs.c +1 -2
 				return true;
 			goto lid_check;
 		}
@@ -1655,7 +1656,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
 
 	/* Can't get a quick answer, iterate over all ports */
 	for (port = 0; port < qp->device->phys_port_cnt; port++)
-		if (qp->device->get_link_layer(qp->device, port) !=
+		if (rdma_port_get_link_layer(qp->device, port) !=
 		    IB_LINK_LAYER_INFINIBAND)
 			num_eth_ports++;
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-rdma" in