Re: [PATCH 01/13] RDMA: Split the alloc_hw_stats() ops to port and device variants

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

 



On Tue, May 18, 2021 at 11:49:57AM +0800, Mark Zhang wrote:
> On 5/18/2021 12:47 AM, Jason Gunthorpe wrote:
> > diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
> > index 05b702de00e89b..29082d8d45fc4f 100644
> > +++ b/drivers/infiniband/core/sysfs.c
> > @@ -981,8 +981,15 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port,
> >          struct rdma_hw_stats *stats;
> >          int i, ret;
> > 
> > -       stats = device->ops.alloc_hw_stats(device, port_num);
> > -
> > +       if (port_num) {
> > +               if (!device->ops.alloc_hw_port_stats)
> > +                       return;
> 
> Do we need this "if (!device->ops.alloc_hw_port_stats)" here?

Not really in this patch, one of the next patches needs them near
here, but there isn't a good reason to leave them in this patch at
this point.

> > index 3f1893e180ddf3..c0f01799f4a0b9 100644
> > +++ b/drivers/infiniband/hw/cxgb4/provider.c
> > @@ -377,14 +377,11 @@ static const char * const names[] = {
> >          [IP6OUTRSTS] = "ip6OutRsts"
> >   };
> > 
> > -static struct rdma_hw_stats *c4iw_alloc_stats(struct ib_device *ibdev,
> > -                                             u32 port_num)
> > +static struct rdma_hw_stats *c4iw_alloc_port_stats(struct ib_device *ibdev,
> > +                                                  u32 port_num)
> >   {
> >          BUILD_BUG_ON(ARRAY_SIZE(names) != NR_COUNTERS);
> > 
> > -       if (port_num != 0)
> > -               return NULL;
> > -
> 
> I'm not familiar with this driver, but if port_num must be 0 here, does it
> mean this is per-device not per-port?

Yes, I switched it, though the actual counters look per port to me.

Thanks,
Jason



[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