RE: [PATCH] rdma-core/libibverbs: display gid type in ibv_devinfo

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

 




> From: Devesh Sharma <devesh.sharma@xxxxxxxxxxxx>
> Sent: Friday, January 31, 2020 9:23 PM
> To: Parav Pandit <parav@xxxxxxxxxxxx>
> Cc: linux-rdma <linux-rdma@xxxxxxxxxxxxxxx>; Jason Gunthorpe
> <jgg@xxxxxxxxxxxx>; leon@xxxxxxxxxx
> Subject: Re: [PATCH] rdma-core/libibverbs: display gid type in ibv_devinfo
> 
> On Fri, Jan 31, 2020 at 9:10 PM Devesh Sharma
> <devesh.sharma@xxxxxxxxxxxx> wrote:
> >
> > On Fri, Jan 31, 2020, 16:30 Parav Pandit <parav@xxxxxxxxxxxx> wrote:
> > >
> > > Hi Devesh,
> > >
> > > > From: linux-rdma-owner@xxxxxxxxxxxxxxx <linux-rdma-
> > > > owner@xxxxxxxxxxxxxxx> On Behalf Of Devesh Sharma
> > >
> > >
> > > [..]
> > >
> > > >  static int print_all_port_gids(struct ibv_context *ctx, uint8_t
> > > > port_num, int
> > > > tbl_len)  {
> > > > +     enum ibv_gid_type type;
> > > >       union ibv_gid gid;
> > > >       int rc = 0;
> > > >       int i;
> > > > @@ -175,8 +185,16 @@ static int print_all_port_gids(struct
> > > > ibv_context *ctx, uint8_t port_num, int tb
> > > >                              port_num, i);
> > > >                       return rc;
> > > >               }
> > > > +
> > > > +             rc = ibv_query_gid_type(ctx, port_num, i, &type);
> > > > +             if (rc) {
> > > > +                     fprintf(stderr, "Failed to query gid type to
> > > > + port %d,
> > > > index %d\n",
> > > > +                             port_num, i);
> > > > +                     return rc;
> > > GID table can have holes depending on how IP addresses, vlan
> configured/removed.
> > > ibv_query_gid_type() is masking the EINVAL error with RoCEv1 type so here
> return is ok.
> > > But as good practice, instead of bailing out the loop, if it returns failure,
> skip the particular GID entry print.
> > > This way rest of valid entries can be still printed.
> >
> > Okay, will send V2 shortly.
> 
> Is this what you want:
> if (rc) {
>    print msg;
>    save rc in tmp var;
>    continue;
> }
> 
Bit simpler than that to just ignore the error (for an invalid gid entry).

rc = ibv_query_gid_type(ctx, port_num, i, &type);
if (rc) {
	rc = 0;
	continue;
}

> in the end after loop over
> return saved-rc-tmp-var;
> Alter saved-rc-tmp-var accordingly for good cases.




[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