On Mon, Mar 4, 2013 at 6:01 PM, Andy Gospodarek <agospoda(a)redhat.com> wrote:
On Mon, Mar 04, 2013 at 10:19:14AM -0600, Matt Domsch wrote:
> > > drivers/net/ethernet/mellanox/mlx4/en_netdev.c:
dev->dev_id = port - 1;
> > > drivers/net/ethernet/sfc/siena.c: efx->net_dev->dev_id =
EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1;
> > >
> > > of these, both the mlx4 and siena drivers set them starting at 0. I
> > > think the fec driver might be doing so as well, but it's not as
> > > obvious. I'm pretty sure cxgb4 starts numbering at 1 just from
> > > reading the code. So, as-is in the 3.9rc1 kernel, I wouldn't be
> > > comfortable relying on the value of dev_id.
> >
> > I agree it looks like some cleanup is needed due to the inconsistency.
> >
> > This is still only an issue when a single function supports multiple
> > ethernet devices, right?
>
> I believe so, yes.
Ok, good. I did like your idea to possibly set this to something other
than 0 in the default case and then make sure that any driver that needs
to set it can do so.
The udev code just appends the dev_id number to the device name if
dev_id is > 0, so either starting at 0 or at 1 would work fine and
produce reliable results.
Starting at 1 would create slightly more consistent names, where all
names of one and the same card follow the same scheme, and 0 is not
special because it is suppressed.
Kay