[dpdk-dev] [PATCH] [RFC] ether: standardize getting the port by name

Stephen Hemminger stephen at networkplumber.org
Thu Nov 30 18:15:52 CET 2017


On Thu, 30 Nov 2017 15:35:30 +0800
Yuanhan Liu <yliu at fridaylinux.org> wrote:

> The ethdev name is taken from the "name" parameter from the helper
> function rte_eth_dev_allocate(name). The name is given by the caller,
> thus, there is no way to guarantee all the callers will follow the
> same syntax, leaving us the port name is not standardized.
> 
> For example, for all ports probed by the generic pci probe function,
> the name is set to the PCI id. For all others, it's set by the caller,
> aka, the PMD driver. Taking mlx PMD driver as the example, it's set
> to something like "mlx5_0 port 0".
> 
> Unfortunately, ovs-dpdk uses such name for referencing a specific port.
> Since there is no standard, user has to figure out what is the right
> name for the nic he is using. That adds extra (unnecessary) obstruction
> to users.
> 
> Thus, the name should be standardized. We should give user a consistent
> interface for finding a specific port.
> 
> What this patch proposes is to use "name[,mac]" syntax. "name" is the
> PCI id for pci device. For vdev, it's the vdev name given by user. The
> reason "mac" is needed is for some devices (say ConnectX-3), 2 ports
> (in a single NIC) have the same PCI id.
> 
> There are 2 reasons I didn't make "mac" mandatory:
> - it keeps the compatibility
> - in most cases, the pci id is good enough to identify a port
> 
> However, while writing this commit log, I think it might be better to
> use something like UUID for standardizing the port name. This way, we
> will always have a very consistent naming, no matter whether it's PCI
> device or vdev device and whether a PCI devices has 2 ports share the
> same PIC id, or something we have considered so far (say, few ports
> sharing same PCI and mac address :/).
> 
> It's also simpler and cleaner. The only drawback is such ID is meaningless
> to human.
> 
> Please also note that this patch just comes up with an API to query
> a port from standard name suggested above. The ethdev name isn't really
> standardized here. This patch is asking for comments after all.
> 
> Thoughts?
> 
> Cc: Thomas Monjalon <thomas at monjalon.net>
> Cc: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
> Cc: Ciara Loftus <ciara.loftus at intel.com>
> Cc: Kevin Traynor <ktraynor at redhat.com>
> Signed-off-by: Yuanhan Liu <yliu at fridaylinux.org>

Some thoughts.
1) Not all devices are PCI; look at recent VMBUS
2) The name may have to be set before MAC address is determined on boot.
3) The names themselves are not persistent or human friendly. This is hard
   see the effort udev goes to.


More information about the dev mailing list