All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Riesch <michael@riesch.at>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: Christian Riesch <christian.riesch@omicron.at>,
	netdev@vger.kernel.org, Oliver Neukum <oneukum@suse.de>,
	Eric Dumazet <edumazet@google.com>,
	Allan Chou <allan@asix.com.tw>, Mark Lord <kernel@teksavvy.com>,
	Grant Grundler <grundler@chromium.org>,
	Ming Lei <tom.leiming@gmail.com>
Subject: Re: [PATCH 4/4] asix: Add a new driver for the AX88172A
Date: Sun, 08 Jul 2012 17:39:35 +0200	[thread overview]
Message-ID: <1341761975.2038.28.camel@schesaplana> (raw)
In-Reply-To: <1341596255.2923.7.camel@bwh-desktop.uk.solarflarecom.com>

On Fri, 2012-07-06 at 18:37 +0100, Ben Hutchings wrote:
> > +	priv->mdio->priv = (void *)dev;
> > +	priv->mdio->read = &asix_mdio_bus_read;
> > +	priv->mdio->write = &asix_mdio_bus_write;
> > +	priv->mdio->name = "Asix MDIO Bus";
> > +	snprintf(priv->mdio->id, MII_BUS_ID_SIZE, "asix-%s",
> > +		 dev_name(dev->net->dev.parent));
> [...]
> 
> I think you need to ensure that the bus identifier is unique throughout
> its lifetime, but net devices can be renamed and that could lead to a
> collision.  Perhaps you could use the ifindex or the USB device path

Ben,

the dev_name function in the code above returns the sysfs filename of
the USB device (e.g. 1-0:1.0).

> (though that might be too long).

This may be a problem. The bus identifier may be 17 characters long, so
if we leave the endpoint/configuration part (:1.0) and the prefix away
it should be fine in any "normal" system. However, on a system with a
more-than-9-root-hubs 5-tier 127-devices-each USB infrastructure it
results in collisions. So is this approach acceptable?

Using the ifindex sounds good to me,

snprintf(priv->mdio->id, MII_BUS_ID_SIZE, "asix-%d",
	dev->net->ifindex);

works on any system with less than 10^12 network interfaces.

Regards,
Michael

  reply	other threads:[~2012-07-08 15:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-06 11:33 [PATCH 0/4] Add a driver for the ASIX AX88172A Christian Riesch
2012-07-06 11:33 ` [PATCH 1/4] asix: Fix checkpatch warnings Christian Riesch
2012-07-06 11:58   ` Eric Dumazet
2012-07-06 12:02     ` David Miller
2012-07-06 21:43     ` Grant Grundler
2012-07-07  8:36       ` Eric Dumazet
2012-07-09  9:48         ` Christian Riesch
2012-07-06 15:25   ` Joe Perches
2012-07-06 11:33 ` [PATCH 2/4] asix: Rename asix.c to asix_devices.c Christian Riesch
2012-07-06 11:33 ` [PATCH 3/4] asix: Factor out common code Christian Riesch
2012-07-06 11:33 ` [PATCH 4/4] asix: Add a new driver for the AX88172A Christian Riesch
2012-07-06 17:37   ` Ben Hutchings
2012-07-08 15:39     ` Michael Riesch [this message]
2012-07-08 15:50       ` Ben Hutchings
2012-07-09 10:30       ` Christian Riesch
2012-07-11  8:27         ` Christian Riesch
2012-07-11 15:10           ` Christian Riesch
2012-07-11 19:23             ` Michael Riesch
2012-07-06 21:20   ` Grant Grundler
2012-07-09 10:22     ` Christian Riesch
2012-07-12  7:22       ` Christian Riesch
2012-07-12 23:10         ` Grant Grundler
2012-07-06 11:51 ` [PATCH 0/4] Add a driver for the ASIX AX88172A Christian Riesch
2012-07-09  2:38 ` ASIX Allan Email [office]
2012-07-09 10:18   ` Christian Riesch
2012-07-09 17:45 ` Grant Grundler
2012-07-09 22:27   ` Mark Lord
2012-07-10  2:20     ` ASIX Allan Email [office]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341761975.2038.28.camel@schesaplana \
    --to=michael@riesch.at \
    --cc=allan@asix.com.tw \
    --cc=bhutchings@solarflare.com \
    --cc=christian.riesch@omicron.at \
    --cc=edumazet@google.com \
    --cc=grundler@chromium.org \
    --cc=kernel@teksavvy.com \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.de \
    --cc=tom.leiming@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.