> Subject: Re: [PATCH 01/13] RDMA: Split the alloc_hw_stats() ops to port and > device variants > > On 5/18/2021 12:47 AM, Jason Gunthorpe wrote: > > External email: Use caution opening links or attachments > > > > > > This is being used to implement both the port and device global stats, > > which is causing some confusion in the drivers. For instance EFA and > > i40iw both seem to be misusing the device stats. > > > > Split it into two ops so drivers that don't support one or the other > > can leave the op NULL'd, making the calling code a little simpler to > > understand. > > > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > > --- [...] > > -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? Yeah, additionally per-device seems to coincide with the behavior in get_hw_stats callback for cxgb4. Shiraz