网卡的name一般是在udev中命名的,这个patch 为https://github.com/systemd/systemd/pull/5933/files
从这个patch中可以看到网卡name有一定的规则,其中vendor id 一般占四个字符
具体的规则如下:
* [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
* — USB port number chain
* v<slot> - VIO slot number (IBM PowerVM)
+ * a<vendor><model>i<instance> — Platform bus ACPI instance id
下面的code中可以看到网卡规则合成网卡name
+ /* Platform devices are named after ACPI table match, and instance id
+ * eg. "/sys/devices/platform/HISI00C2:00");
+ * The Vendor (3 or 4 char), followed by hexdecimal model number : instance id.
+ */
+ if (sscanf(syspath, pattern, vendor, &model, &instance, ðid) != 4)
例如这里的vendor id就是从sys文件系统中会的,例如这里的/sys/devices/platform/HISI00C2:00");