diff mbox series

IB/rxe: Utilize generic function to validate port number

Message ID 20181206140234.7587-1-yuval.shaia@oracle.com (mailing list archive)
State Accepted
Commit e7521d82b33593c9b3ffd1e49a7ea2999ddc2285
Delegated to: Jason Gunthorpe
Headers show
Series IB/rxe: Utilize generic function to validate port number | expand

Commit Message

Yuval Shaia Dec. 6, 2018, 2:02 p.m. UTC
Utilize rdma_is_port_valid to validate the given port.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
Please note, this patch has nothing to do with the previously patch i sent
with the same title, that one was replaced by something else. Here it is a
different area.
---
 drivers/infiniband/sw/rxe/rxe_qp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jason Gunthorpe Dec. 7, 2018, 4:19 a.m. UTC | #1
On Thu, Dec 06, 2018 at 04:02:34PM +0200, Yuval Shaia wrote:
> Utilize rdma_is_port_valid to validate the given port.
> 
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
> Please note, this patch has nothing to do with the previously patch i sent
> with the same title, that one was replaced by something else. Here it is a
> different area.
> ---
>  drivers/infiniband/sw/rxe/rxe_qp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Applied to for-next

Thanks,
Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index b9710907dac2..2ca4ffe5015f 100644
--- a/drivers/infiniband/sw/rxe/rxe_qp.c
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -97,7 +97,7 @@  int rxe_qp_chk_init(struct rxe_dev *rxe, struct ib_qp_init_attr *init)
 		goto err1;
 
 	if (init->qp_type == IB_QPT_SMI || init->qp_type == IB_QPT_GSI) {
-		if (port_num != 1) {
+		if (!rdma_is_port_valid(&rxe->ib_dev, port_num)) {
 			pr_warn("invalid port = %d\n", port_num);
 			goto err1;
 		}
@@ -433,7 +433,7 @@  int rxe_qp_chk_attr(struct rxe_dev *rxe, struct rxe_qp *qp,
 	}
 
 	if (mask & IB_QP_PORT) {
-		if (attr->port_num != 1) {
+		if (!rdma_is_port_valid(&rxe->ib_dev, attr->port_num)) {
 			pr_warn("invalid port %d\n", attr->port_num);
 			goto err1;
 		}
@@ -448,7 +448,7 @@  int rxe_qp_chk_attr(struct rxe_dev *rxe, struct rxe_qp *qp,
 	if (mask & IB_QP_ALT_PATH) {
 		if (rxe_av_chk_attr(rxe, &attr->alt_ah_attr))
 			goto err1;
-		if (attr->alt_port_num != 1) {
+		if (!rdma_is_port_valid(&rxe->ib_dev, attr->alt_port_num))  {
 			pr_warn("invalid alt port %d\n", attr->alt_port_num);
 			goto err1;
 		}