[dpdk-dev] [PATCH 6/7] net/mlx5: probe all port representors

Adrien Mazarguil adrien.mazarguil at 6wind.com
Tue Jun 12 15:20:33 CEST 2018


On Tue, Jun 12, 2018 at 06:42:38AM +0000, Xueming(Steven) Li wrote:
> Hi Adrien,
> 
> > -----Original Message-----
> > From: dev <dev-bounces at dpdk.org> On Behalf Of Adrien Mazarguil
> > Sent: Saturday, May 26, 2018 12:35 AM
> > To: Shahaf Shuler <shahafs at mellanox.com>
> > Cc: dev at dpdk.org
> > Subject: [dpdk-dev] [PATCH 6/7] net/mlx5: probe all port representors
> > 
> > Probe existing port representors in addition to their master device and associate them automatically.
> > 
> > To avoid name collision between Ethernet devices, their names use the same convention as ixgbe and
> > i40e PMDs, that is, instead of only a PCI address in DBDF notation:
> > 
> > - "net_{DBDF}_0" for master/switch devices.
> > - "net_{DBDF}_representor_{rep}" with "rep" starting from 0 for port
> >   representors.
> > 
> > Both optionally suffixed with "_port_{num}" instead of " port {num}" for devices that expose several
> > Verbs ports (note this is never the case on mlx5, but kept for historical reasons for the time being).
> > 
> > (Patch based on prior work from Yuanhan Liu)
> > 
> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
<snip>
> > +	/*
> > +	 * Allocate a switch domain for master devices and share it with
> > +	 * port representors.
> > +	 */
> > +	if (!master) {
> > +		priv->representor = 0;
> > +		priv->domain_id = RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID;
> > +		priv->rep_id = 0;
> > +		err = rte_eth_switch_domain_alloc(&priv->domain_id);
> 
> So domain_id is used to identify relation between PF and representor port?

Right, as described by the API [1]. What's missing in this patch is that
this information is not reported through dev_infos_get(). I'll add it for
v2.

[1] https://www.dpdk.org/doc/guides/prog_guide/switch_representation.html#port-representors

<snip>
> > +	DRV_LOG(INFO, "%u port(s) detected on \"%s\"",
> > +		attr.orig_attr.phys_port_cnt, ibv_dev[j]->name);
> > +	tmp = realloc(eth_list, sizeof(*eth_list) *
> > +		      (n + attr.orig_attr.phys_port_cnt + 1));
> > +	if (!tmp) {
> >  		rte_errno = errno;
> > -		return NULL;
> > +		goto error;
> >  	}
> > +	eth_list = tmp;
> >  	for (i = 0; i < attr.orig_attr.phys_port_cnt; ++i) {
> 
> Is there any mlx5 device that support more than physical ports on same PCI id?
> I remember this is major difference between mlx5 and mlx4.

Unlike mlx4, no known mlx5 adapter exposes more than a single port per PCI
address. This is kept for historical reasons (i.e. because it's always been
there) and the fact that since Verbs exposes it, phys_port_cnt should at
least be checked, if only to return an error when somehow multiple ports are
detected.

This series just makes easier to drop this intermediate loop if deemed
necessary later, simply by calling mlx5_dev_spawn_one() directly. In the
meantime, separation of low-level PCI from Verbs device instantiation means
there is an extra step to iterate on all possible IB ports. Same behavior as
usual, modifying it is not the purpose of this series.

-- 
Adrien Mazarguil
6WIND


More information about the dev mailing list