From patchwork Wed Aug 19 18:56:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan_Hargrave@Dell.com X-Patchwork-Id: 31664 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 43A0DB7088 for ; Thu, 20 Aug 2009 05:01:24 +1000 (EST) Received: by ozlabs.org (Postfix) id 38C0CDDD0B; Thu, 20 Aug 2009 05:01:24 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id CD2ABDDD04 for ; Thu, 20 Aug 2009 05:01:23 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752796AbZHSTAt (ORCPT ); Wed, 19 Aug 2009 15:00:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752414AbZHSTAs (ORCPT ); Wed, 19 Aug 2009 15:00:48 -0400 Received: from ausc60ps301.us.dell.com ([143.166.148.206]:55533 "EHLO ausc60ps301.us.dell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751009AbZHSTAs convert rfc822-to-8bit (ORCPT ); Wed, 19 Aug 2009 15:00:48 -0400 X-Loopcount0: from 10.166.72.160 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: PATCH: Network Device Naming mechanism and policy Date: Wed, 19 Aug 2009 13:56:30 -0500 Message-ID: <5DDAB7BA7BDB58439DD0EED0B8E9A3AE011CD964@ausx3mpc102.aus.amer.dell.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: PATCH: Network Device Naming mechanism and policy Thread-Index: AcoWBN9OX/VnpDfhSiGTsY5w0WAtZAK+eRCo References: <5DDAB7BA7BDB58439DD0EED0B8E9A3AE011CD92D@ausx3mpc102.aus.amer.dell.com> From: To: , X-OriginalArrivalTime: 19 Aug 2009 19:00:49.0852 (UTC) FILETIME=[5DF447C0:01CA20FF] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is from an old discussion several months ago: http://lkml.org/lkml/2009/3/24/357 http://lkml.org/lkml/2009/3/24/380 Basically the issue is that between a race in udev and PCI scan order the ethX IDs may not be consistent between reboots. The idea is to use a mechanism similar to how disks now can be accessed by their LABEL/PATH/UUID instead of raw /dev/sdX ids. example udev config: SUBSYSTEM=="net", SYMLINK+="net/by-mac/$sysfs{ifindex}.$sysfs{address}" SUBSYSTEM=="net", PROGRAM="/sbin/biosdevname -i %k --policy=all_names", SYMLINK+="net/by-chassis-id/%c" The following patch will create a device node for network devices based off their ifindex; udev can then use this device node for creating symlinks in /dev/net/xxxx similar to the way that disks now use by-label and by-path symlinks. Combining this with the biosdevname utility and patches to common network utilities, it could be possible to access ethernet devices by their PCI path or BIOS Label. eg. ifconfig Embedded_NIC_1 --jordan hargrave Dell Enterprise Linux Engineering --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- include/linux/major.h~ 2009-07-30 18:34:47.000000000 -0400 +++ include/linux/major.h 2009-08-05 14:52:10.000000000 -0400 @@ -169,6 +169,7 @@ #define IBM_FS3270_MAJOR 228 #define VIOTAPE_MAJOR 230 +#define NETDEV_MAJOR 234 #define BLOCK_EXT_MAJOR 259 #define SCSI_OSD_MAJOR 260 /* open-osd's OSD scsi device */ --- net/core/net-sysfs.cx 2009-08-05 15:00:13.000000000 -0400 +++ net/core/net-sysfs.c 2009-08-05 15:01:20.000000000 -0400 @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -496,6 +497,7 @@ int netdev_register_kobject(struct net_d dev->class = &net_class; dev->platform_data = net; dev->groups = groups; + dev->devt = MKDEV(NETDEV_MAJOR, net->ifindex); BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ); dev_set_name(dev, "%s", net->name);