Good point. I moved the three attributes to debugfs which
looks much more appropriate.

I also re-structured module initialization/device registration:
The siw module now registers with the netdevice subsystem
(register_netdevice_notifier()) to catch NETDEV_xx events,
which now also handles device state changes and later
device addition.

Before posting it as a proposed patch I wanted to discuss the
following. Currently, only NETDEV_REGISTER, NETDEV_UNREGISTER,
NETDEV_UP, NETDEV_DOWN are handled as following:
NETDEV_REGISTER:        Instantiate a siw device (ib_alloc_device()).
NETDEV_UP:              Register to ib_core (ib_register_device()),
                        if the device has an interface address.
NETDEV_DOWN:    Unregister from ib_core (ib_unregister_device()).
NETDEV_UNREGISTER:Deallocate device (ib_dealloc_device())

Toggling the device UP and DOWN would end up un-/registering
with the ib_core. Maybe thats not appropriate and the device
should remain visible to ib_core? The CM appears to exclude
DOWN devices from connection management. With that, a siw device
would remain visible to ib_core until it gets UNREGISTERed.


Should the code handle other events such as NETDEV_CHANGEADDR?


Many thanks,
bernard.

[email protected] wrote on 06/18/2011 07:39:11 PM:

> On Thu, Jun 16, 2011 at 2:42 PM, Bernard Metzler <[email protected]>
wrote:
> > ---
> >  drivers/infiniband/hw/siw/siw_main.c |  603
> ++++++++++++++++++++++++++++++++++
> >  1 files changed, 603 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/infiniband/hw/siw/siw_main.c
> >
> > diff --git a/drivers/infiniband/hw/siw/siw_main.c
> b/drivers/infiniband/hw/siw/siw_main.c
> > [ ... ]
> > +static ssize_t show_stats(struct device *dev,
> > +                         struct device_attribute *attr, char *buf)
> > +{
> > +       struct siw_dev *siw_dev = container_of(dev, struct siw_dev,
> > +                                              ofa_dev.dev);
> > +
> > +       return sprintf(buf, "Allocated SIW Objects:\n"
> > +#if DPRINT_MASK > 0
> > +                       "Global     :\t%s: %d\n"
> > +#endif
> > +                       "Device %s:\t"
> > +                       "%s: %d, %s: %d, %s: %d, %s: %d, %s: %d, %s: %d
\n",
> > +#if DPRINT_MASK > 0
> > +                       "WQEs", atomic_read(&siw_num_wqe),
> > +#endif
> > +                       siw_dev->ofa_dev.name,
> > +                       "PDs", atomic_read(&siw_dev->num_pd),
> > +                       "QPs", atomic_read(&siw_dev->num_qp),
> > +                       "CQs", atomic_read(&siw_dev->num_cq),
> > +                       "SRQs", atomic_read(&siw_dev->num_srq),
> > +                       "MRs", atomic_read(&siw_dev->num_mem),
> > +                       "CEPs", atomic_read(&siw_dev->num_cep));
> > +}
>
> The rules for sysfs, documented in Documentation/ABI/README, are:
> - One value per file.
> - All new sysfs attributes must be documented in Documentation/ABI.
>
> An alternative to following the above rules is moving attributes from
> sysfs to debugfs.
>
> Bart.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to