udev rules for TX2i on-board Ethernet

I have a need to change the name of the TX2i Ethernet to be eth0 always.
The udev rule:

SUBSYSTEM==“net”, ACTION==“add”, DRIVERS=="?*", ATTR{address}==“00:04:4b:a9:27:f0”, ATTR{dev_id}==“0x0”, ATTR{type}==“1”, NAME=“eth0”

works, but I don’t want to have to look up the mac address for every module.

I went digging around, but I can’t find any other info on the device or the driver, or even how it connects to the Parker chip. There is something called cdc_ether on the usb, but it doesn’t show up on lsusb.

So, I’m looking for something else to come after ATTR that specifies a physical location or driver name.

Any ideas?

Thanks!!

Bob Conklin

Hi,

I think you could read the mac addr from below node.

nvidia@nvidia-desktop:/proc/device-tree/chosen$ xxd nvidia,ether-mac 
00000000: 3030 3a30 343a 3462 3a63 623a 6436 3a34  00:04:4b:cb:d6:4
00000010: 6300                                     c.

I don’t understand how to match this in udev rules. I was hoping to match something like a kernel name or driver name. All I need is one match, because there will only be one of these present.

It might be “ether_qos”…try that and see if it works as a driver name.

Nope

Works:
SUBSYSTEM==“net”, ACTION==“add”, DRIVERS=="?*", ATTR{address}==“00:04:4b:a9:27:f0”, ATTR{dev_id}==“0x0”, ATTR{type}==“1”, NAME=“eth5”

No Work
SUBSYSTEM==“net”, ACTION==“add”, DRIVERS==“ether_qos*”, ATTR{dev_id}==“0x0”, ATTR{type}==“1”, NAME=“eth5”

Hi BConklin,

Sorry I don’t get your need here.

In first comment, “but I don’t want to have to look up the mac address for every module.” I think that is your request, is that right?

If so, why searching the driver or device name matters here?

In production a MAC address will require a query from the running device in order to edit prior to flash (or edit after flash). udev needs something to identify before it can rename an interface, but it doesn’t have to be a MAC address if some other udev identification can be found which is unique to the wired ethernet.

If he can name a driver for the udev rule, versus naming a MAC address, then the same rule will do the job for every Jetson without needing to query the Jetson for its MAC address. This would greatly simplify a production environment.

Thank you linuxdev.
Any of the ATTRs that udev can find would do!!

http://www.reactivated.net/writing_udev_rules.html#sysfsmatch

The example in the man page is

udevinfo
Enter udevinfo, which is probably the most straightforward tool you can use to construct rules. All you need to know is the sysfs device path of the device in question. A trimmed example is shown below:

udevinfo -a -p /sys/block/sda

looking at device ‘/block/sda’:
KERNEL==“sda”
SUBSYSTEM==“block”
ATTR{stat}==" 128535 2246 2788977 766188 73998 317300 3132216 5735004 0 516516 6503316"
ATTR{size}==“234441648”
ATTR{removable}==“0”
ATTR{range}==“16”
ATTR{dev}==“8:0”

looking at parent device ‘/devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0’:
KERNELS==“0:0:0:0”
SUBSYSTEMS==“scsi”
DRIVERS==“sd”
ATTRS{ioerr_cnt}==“0x0”
ATTRS{iodone_cnt}==“0x31737”
ATTRS{iorequest_cnt}==“0x31737”
ATTRS{iocounterbits}==“32”
ATTRS{timeout}==“30”
ATTRS{state}==“running”
ATTRS{rev}==“3.42”
ATTRS{model}=="ST3120827AS "
ATTRS{vendor}=="ATA "
ATTRS{scsi_level}==“6”
ATTRS{type}==“0”
ATTRS{queue_type}==“none”
ATTRS{queue_depth}==“1”
ATTRS{device_blocked}==“0”

I got it. So you want udev rule to find out the device through driver/device name instead of using mac addr.

It should work with DRIVERS “eqos”.

I tried eqos. I’ll try eqos

This line works:

SUBSYSTEM==“net”, ACTION==“add”, DRIVERS==“eqos”, ATTR{dev_id}==“0x0”, ATTR{type}==“1”, NAME=“eth0”

Thanks!