netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org
Cc: sfeldma@gmail.com, David Ahern <dsahern@gmail.com>
Subject: [PATCH] net: rocker: Change netdev names to include slot number
Date: Sun,  1 Feb 2015 23:03:05 -0700	[thread overview]
Message-ID: <1422856985-16530-1-git-send-email-dsahern@gmail.com> (raw)

Currently, rocker devices are given eth%d names. If you have multiple
rocker devices it is difficult to easily correlate eth%d names to a
rocker device and port. Change the device name to sw + PCI slot
number + p + id (sw%dp%d). This makes the device names easier to
correlate. ie., Rather than eth0, ..., eth N (N = number of ports in
device) the ports get netdev names like sw5p0, ..., sw5pN.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 drivers/net/ethernet/rocker/rocker.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c
index 11f4ffcc113d..1d1cf84e6f47 100644
--- a/drivers/net/ethernet/rocker/rocker.c
+++ b/drivers/net/ethernet/rocker/rocker.c
@@ -4010,8 +4010,11 @@ static int rocker_probe_port(struct rocker *rocker, unsigned int port_number)
 	struct rocker_port *rocker_port;
 	struct net_device *dev;
 	int err;
+	char str[IFNAMSIZ];
 
-	dev = alloc_etherdev(sizeof(struct rocker_port));
+	snprintf(str, sizeof(str), "sw%dp%%d", pdev->slot->number);
+	dev = alloc_netdev_mqs(sizeof(struct rocker_port),
+			       str, NET_NAME_UNKNOWN, ether_setup, 1, 1);
 	if (!dev)
 		return -ENOMEM;
 	rocker_port = netdev_priv(dev);
-- 
1.9.3 (Apple Git-50)

             reply	other threads:[~2015-02-02  6:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02  6:03 David Ahern [this message]
2015-02-02 21:33 ` [PATCH] net: rocker: Change netdev names to include slot number Scott Feldman
2015-02-02 21:41   ` David Ahern
2015-02-02 22:03     ` Florian Fainelli
2015-02-02 22:09       ` David Ahern
2015-02-03  5:46         ` Scott Feldman
2015-02-03 16:06           ` David Ahern
2015-02-03  7:33         ` Rosen, Rami
2015-02-02 22:16     ` David Miller
2015-02-02 22:15   ` David Miller

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=1422856985-16530-1-git-send-email-dsahern@gmail.com \
    --to=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sfeldma@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).