All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Dariusz Sosnowski <dsosnowski@nvidia.com>
Cc: Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Suanming Mou <suanmingm@nvidia.com>,
	Matan Azrad <matan@nvidia.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Harman Kalra <hkalra@marvell.com>,
	Thomas Monjalon <thomas@monjalon.net>, <dev@dpdk.org>
Subject: Re: [RFC] ethdev: simplify representor info get API
Date: Mon, 30 Nov 2026 16:59:03 -0800	[thread overview]
Message-ID: <20261130165903.3f39ce82@phoenix.local> (raw)
In-Reply-To: <axbyaqm57t7ngjv2mrfnf4yrk4thrumjg5lbhrbqr3gwz6yzbi@ik3cvcxp5x4b>

On Mon, 7 Sep 2026 17:31:20 +0200
Dariusz Sosnowski <dsosnowski@nvidia.com> wrote:

> On Mon, Aug 31, 2026 at 09:46:54AM -0700, Stephen Hemminger wrote:
> > On Mon, 31 Aug 2026 18:29:05 +0200
> > Dariusz Sosnowski <dsosnowski@nvidia.com> wrote:
> >   
> > > * Background on rte_eth_representor_info_get()
> > > 
> > > rte_eth_representor_info_get() experimental function was added
> > > to ethdev public API in 21.05 DPDK release [1].  
> > 
> > You know the API shouldn't have stayed experimental so long.
> > There is no good reason for API to stay experimental across multiple LTS releases!
> > 
> > The code would be much simpler if you use sentinel values rather than
> > carrying around all the XX_valid flag values.
> > 
> > With int fields and -1 (or a named RTE_ETH_REPRESENTOR_UNSPEC),
> >  the whole comparator collapses to something like:
> > 
> > 
> > static bool field_match(int a, int b)
> > {
> > 	return a == -1 || b == -1 || a == b;
> > }
> > 
> > return field_match(info.controller, other->controller) &&
> >        field_match(info.pf, other->pf) &&
> >        info.type == other->type &&
> >        (info.type != RTE_ETH_REPRESENTOR_VF || field_match(info.vf, other->vf)) &&  
> 
> Ack, I can apply that in the next version of the patches.
> 
> My only worry would be that mlx5 DPDK driver gets these values
> (controller numbers, VF/SF numbers) from phys_port_name
> exported through sysfs.
> phys_port_name is based on devlink port attributes [1] with
> the following types:
> 
> - controller number - u32
> - port number - u32
>     - Used for physical port representors in mlx5 DPDK driver.
>       These are of type RTE_ETH_REPRESENTOR_PF.
> - VF number - u16
> - SF number - u32
> 
> Using int fields would not cover values
> which can be returned by kernel.
> 
> What do you think about going with int64_t for these fields?
> 
> [1]: https://github.com/torvalds/linux/blob/v7.2/include/uapi/linux/devlink.h#L412
> Relevant attributes are:
> - DEVLINK_ATTR_PORT_CONTROLLER_NUMBER
> - DEVLINK_ATTR_PORT_NUMBER
> - DEVLINK_ATTR_PORT_PCI_PF_NUMBER
> - DEVLINK_ATTR_PORT_PCI_VF_NUMBER
> - DEVLINK_ATTR_PORT_PCI_SF_NUMBER

Yes the DPDK fields need to be as wide or wider than current kernel fields
but already is the case. Kernel changes to widths would break uapi so they
are unlikely to change these.

What does kernel use internally for unspecified? Or does unspecified even
matter since driver shouldn't be getting here if it can't read sysfs

      reply	other threads:[~2026-12-01  0:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 16:29 [RFC] ethdev: simplify representor info get API Dariusz Sosnowski
2026-08-31 16:46 ` Stephen Hemminger
2026-09-07 15:31   ` Dariusz Sosnowski
2026-12-01  0:59     ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130165903.3f39ce82@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=hkalra@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=matan@nvidia.com \
    --cc=ndabilpuram@marvell.com \
    --cc=orika@nvidia.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.