[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: persistent-net.rules for fixed ethX names and VLANs



Hi,

this is a reply to an very old posting just to tell the solution
to the mailing list archives.

Problem was that Micrel Driver does net set DRIVER name. Here a patch.

On Tue, Nov 26, 2013, Steffen Dettmer <steffen.dettmer@gmail.com> wrote:
> On Tue, Nov 19, 2013, Pascal Hambourg <pascal@plouf.fr.eu.org> wrote:
>>> On Thu, Nov 14, 2013, Steffen Dettmer <steffen.dettmer@gmail.com> wrote:
>>>> I have persistent-net.rules in form:
>>>>
>>>>   SUBSYSTEM=="net", KERNEL=="eth*" ACTION=="add",
>>>>     ATTR{address}=="40:d8:55:09:43:0f", NAME="eth3"
>>>>
>>>> How to use fixed ethX device names and VLAN devices at the same time?
>>
>> The behaviour you describe does not happen on a standard Debian system.
>> I guess it is because the standard rules have the DRIVERS="?*"
>
> Yes, the rules generated by the Debian net rule generator (which
> are the "standard rules", right?) include DRIVERS="?*" (and are
> only generated for devices that have a DRIVER=).
>
>> condition. A "real" network interface has the (non-null) driver name in
>> its parent device and thus matches the rule, whereas a "virtual" VLAN
>> interface does not.
>
> Thank you for your explanation. I think I understood well, but
> there seems to be a missing detail in my case: although for
> almost any device this might be true, but as the "udevadm info" from
> my original posting shows, there are drivers that do not do so.
>   (For such devices, the Debian udev scripts do not even generate
>   persistent net rules, because DRIVER must match non-empty in
>   the generator script).
>
> The driver used here is "ksz884x".

The following patch solves this problem:

------------------------------------------------------------------->8=======
diff --git a/drivers/net/ethernet/micrel/ksz884x.c
b/drivers/net/ethernet/micrel/ksz884x.c
index 14ac0e2..023f2f9 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -7072,6 +7072,7 @@ static int pcidev_init(struct pci_dev *pdev,
const struct pci_device_id *id)
     dev = alloc_etherdev(sizeof(struct dev_priv));
     if (!dev)
       goto pcidev_init_reg_err;
+ SET_NETDEV_DEV(dev, &pdev->dev);
     info->netdev[i] = dev;

     priv = netdev_priv(dev);
=======8<-------------------------------------------------------------------

Regards,
Steffen


Reply to: