Re: [PATCH] IB/rxe: Utilize generic function to validate port number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 06, 2018 at 01:44:12PM +0200, Leon Romanovsky wrote:
> On Thu, Dec 06, 2018 at 01:06:15PM +0200, Yuval Shaia wrote:
> > RXE has only one port. No need to hard code it on every verb instead use
> > rdma_is_port_valid to validate the given port number.
> >
> > Signed-off-by: Yuval Shaia <yuval.shaia@xxxxxxxxxx>
> > ---
> >  drivers/infiniband/sw/rxe/rxe_verbs.c | 23 +++++++++++++----------
> >  1 file changed, 13 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
> > index 30817c79ba96..88fdb8890038 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_verbs.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
> > @@ -51,6 +51,16 @@ static int rxe_query_device(struct ib_device *dev,
> >  	return 0;
> >  }
> >
> > +static bool rxe_is_port_valid(struct rxe_dev *rxe, u8 port_num)
> > +{
> > +	if (unlikely(!rdma_is_port_valid(&rxe->ib_dev, port_num))) {
> > +		pr_warn("Invalid port number %d\n", port_num);
> > +		return 0;
> > +	}
> > +
> > +	return 1;
> > +}
> 
> Let's use directly rdma_is_port_valid() without extra layer.

Checking it a bit more, except for query_pkey the core functions already
validates the port so instead - i will just remove this redundant
verification.

For the ib_query_pkey thing, i'll post a different patch.

> 
> Thanks





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux