本文共 691 字,大约阅读时间需要 2 分钟。
网卡的name一般是在udev中命名的,这个patch 为https://github.com/systemd/systemd/pull/5933/files从这个patch中可以看到网卡name有一定的规则,其中vendor id 一般占四个字符具体的规则如下: * [P]p s [f ][u ][..][c ][i ] * — USB port number chain * v - VIO slot number (IBM PowerVM)+ * a i — 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");
转载地址:http://yinmi.baihongyu.com/