All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Doherty, Declan" <declan.doherty@intel.com>
To: Shahaf Shuler <shahafs@mellanox.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Alex Rosenbaum <alexr@mellanox.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Qi Zhang <qi.z.zhang@intel.com>,
	Alejandro Lucero <alejandro.lucero@netronome.com>,
	Andrew Rybchenko <arybchenko@solarflare.com>,
	Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>,
	Remy Horton <remy.horton@intel.com>,
	John McNamara <john.mcnamara@intel.com>,
	Rony Efraim <ronye@mellanox.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Vincent Jardin <vincent.jardin@6wind.com>,
	Yuanhan Liu <yliu@fridaylinux.org>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>,
	Zhihong Wang <zhihong.wang@intel.com>
Subject: Re: [PATCH v6 2/8] ethdev: add switch identifier parameter to port
Date: Thu, 29 Mar 2018 16:12:31 +0100	[thread overview]
Message-ID: <3c33e34e-1ea7-8c3d-cf08-db0028910f00@intel.com> (raw)
In-Reply-To: <DB7PR05MB44267CEE94CD0A387D2DCFD9C3A20@DB7PR05MB4426.eurprd05.prod.outlook.com>

On 29/03/2018 11:12 AM, Shahaf Shuler wrote:
> Thursday, March 29, 2018 12:14 PM, Doherty, Declan:
>> On 29/03/2018 7:13 AM, Shahaf Shuler wrote:
>>> Hi Declan,
>>>
>>> Thanks for the series! See some comments below
>>>
>>> Wednesday, March 28, 2018 4:54 PM, Declan Doherty:
>>>> Subject: [dpdk-dev][PATCH v6 2/8] ethdev: add switch identifier
>>>> parameter to port
>>>>
>>>> Introduces a new port attribute to ethdev port's which denotes the
>>>> switch domain a port belongs to. By default all port's switch
>>>> identifiers are the their port_id. Ports which share a common switch
>>>> domain are configured with the same switch id.
>>>>
>>>> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
>>>> ---
>>>>    app/test-pmd/config.c              | 1 +
>>>>    lib/librte_ether/rte_ethdev.c      | 3 +++
>>>>    lib/librte_ether/rte_ethdev.h      | 1 +
>>>>    lib/librte_ether/rte_ethdev_core.h | 1 +
>>>>    4 files changed, 6 insertions(+)
>>>>
>>>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
>>>> 4bb255c62..e12f8c515 100644
>>>> --- a/app/test-pmd/config.c
>>>> +++ b/app/test-pmd/config.c
>>>> @@ -517,6 +517,7 @@ port_infos_display(portid_t port_id)
>>>>    	printf("Min possible number of TXDs per queue: %hu\n",
>>>>    		dev_info.tx_desc_lim.nb_min);
>>>>    	printf("TXDs number alignment: %hu\n",
>>>> dev_info.tx_desc_lim.nb_align);
>>>> +	printf("Switch Id: %u\n", dev_info.switch_id);
>>>>    }
>>>>
>>>>    void
>>>> diff --git a/lib/librte_ether/rte_ethdev.c
>>>> b/lib/librte_ether/rte_ethdev.c index 23857c91f..f32d18cad 100644
>>>> --- a/lib/librte_ether/rte_ethdev.c
>>>> +++ b/lib/librte_ether/rte_ethdev.c
>>>> @@ -290,6 +290,8 @@ rte_eth_dev_allocate(const char *name)
>>>>    	eth_dev = eth_dev_get(port_id);
>>>>    	snprintf(eth_dev->data->name, sizeof(eth_dev->data->name),
>> "%s",
>>>> name);
>>>>    	eth_dev->data->port_id = port_id;
>>>> +	eth_dev->data->switch_id = port_id;
>>>> +	/**< Default switch_id is the port_id of the device */
>>>
>>> Why such default is needed? Why not let the PMD to set it always?
>>
>> I saw this a simple way to have a consistent default value (the port_id) for all
>> PMDs, without the need to modify existing PMD which don't currently have
>> any concept of a switch domain.
> 
> The default value don't makes much sense though. By default it would mean the application each port is on different switch domain. This is obviously not true in case of multiple VFs

But it is the case today for all ports, that they are assumed to be in 
separate switch domains or at least in unknowable switch domains by 
applications, with the exception of LAG groups, were it is implicit that 
they are in the same domain. Even if two ports were attached to the same 
switch, or if you where using multiple VFs from the same switch there is 
currently no way of telling the application that this is the case. What 
would be the use case for having multiple VFs from the same port/switch 
domain in a single data path application. It doesn't seem likely to me 
that you would use hardware switching to move traffic between 2 VFs in 
the same data path application.

If you are using port representors, I assumed that you would set a valid 
switch domain id, possibly picking up the port id of the first port 
created on that switch domain, but it would be completely up to the PMD 
how this was done, I have just shown the simplest model in which the 
port_id of the PF is used for all subsequent representor ports in that 
switch domain, but if you wanted to create multiple domains within the 
same device, you could just use subsequent port representors port_ids to 
setup further switch domains. A switch_id is only meaningful within the 
contex of DPDK process it is running in.

> 
> Maybe we can define ETH_SWITCH_ID_INVALID (0) to emphasis 0 is not the switch_id for the PMDs which didn't implemented it.
> 
>>
>> Also taking the approach of just leaving it up to the PMD to decide the value
>> would mean that some form of synchronisation would be required so that
>> two device don't select the switch domain identifier.
> 
> What kind of knowledge ethdev layer has to set the switche_id? It should be based on the underlying capabilities of the device.
> Some devices will use the kernel sysfs  to check that.
> 
> Maybe there are devices which are able to expose the same switch for multiple devices, passing the packet between them using  peer2peer trough the PCI.
> 
> The point is we need to have APIs which will enable all the future flexibility.
> 
> Maybe we can have array of switch_id which are allready taken by the underlying devices, and PMD will register their switch_id to it atomically. To ease the synchronization.
> 
>>
>>>
>>>>    	eth_dev->data->mtu = ETHER_MTU;
>>>>
>>>>    unlock:
>>>> @@ -2395,6 +2397,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct
>>>> rte_eth_dev_info *dev_info)
>>>>    	dev_info->driver_name = dev->device->driver->name;
>>>>    	dev_info->nb_rx_queues = dev->data->nb_rx_queues;
>>>>    	dev_info->nb_tx_queues = dev->data->nb_tx_queues;
>>>> +	dev_info->switch_id = dev->data->switch_id;
>>>
>>> Why there is a need to keep the switch_id on device data?
>>> I think PMD to store it on its private structure and report it in dev_info is
>> enough.
>>>
>>
>> That way would require every PMD to be modified to maintain a switch_id
>> structure, which I know isn't a big deal, as only the device which need to
>> support it would need it, but we would need to change the dev_info-
>>> switch_id from being a uint16_t to being a signed value so we could have a
>> default of -1 for device which don't support switch domain.
> 
> We can say also 0 is the invalid switch id.
> 
>> I thought the former approach was cleaner.
>>
>>>>    }
>>>>
>>>>    int
>>>> diff --git a/lib/librte_ether/rte_ethdev.h
>>>> b/lib/librte_ether/rte_ethdev.h index 036153306..dced4fc41 100644
>>>> --- a/lib/librte_ether/rte_ethdev.h
>>>> +++ b/lib/librte_ether/rte_ethdev.h
>>>> @@ -1029,6 +1029,7 @@ struct rte_eth_dev_info {
>>>>    	/** Configured number of rx/tx queues */
>>>>    	uint16_t nb_rx_queues; /**< Number of RX queues. */
>>>>    	uint16_t nb_tx_queues; /**< Number of TX queues. */
>>>> +	uint16_t switch_id; /**< Switch Domain Id */
>>>>    };
>>>>
>>>>    /**
>>>> diff --git a/lib/librte_ether/rte_ethdev_core.h
>>>> b/lib/librte_ether/rte_ethdev_core.h
>>>> index e5681e466..caed7a4e6 100644
>>>> --- a/lib/librte_ether/rte_ethdev_core.h
>>>> +++ b/lib/librte_ether/rte_ethdev_core.h
>>>> @@ -585,6 +585,7 @@ struct rte_eth_dev_data {
>>>>    	struct ether_addr* hash_mac_addrs;
>>>>    	/** Device Ethernet MAC addresses of hash filtering. */
>>>>    	uint16_t port_id;           /**< Device [external] port identifier. */
>>>> +	uint16_t switch_id;	    /**< Switch which port is associated with
>>>> */
>>>>    	__extension__
>>>>    	uint8_t promiscuous   : 1, /**< RX promiscuous mode ON(1) / OFF(0).
>>>> */
>>>>    		scattered_rx : 1,  /**< RX of scattered packets is ON(1) /
>>>> OFF(0) */
>>>> --
>>>> 2.14.3
>>>
> 

  reply	other threads:[~2018-03-29 15:12 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 13:54 [PATCH v6 0/7] switching device representation Declan Doherty
2018-03-28 13:54 ` [PATCH v6 1/8] doc: add switch representation documentation Declan Doherty
2018-03-28 14:53   ` Thomas Monjalon
2018-03-28 15:05     ` Doherty, Declan
2018-04-03 15:52   ` Adrien Mazarguil
2018-03-28 13:54 ` [PATCH v6 2/8] ethdev: add switch identifier parameter to port Declan Doherty
2018-03-29  6:13   ` Shahaf Shuler
2018-03-29  9:13     ` Doherty, Declan
2018-03-29 10:12       ` Shahaf Shuler
2018-03-29 15:12         ` Doherty, Declan [this message]
2018-04-01  6:10           ` Shahaf Shuler
2018-03-28 13:54 ` [PATCH v6 3/8] ethdev: add generic create/destroy ethdev APIs Declan Doherty
2018-03-29  6:13   ` Shahaf Shuler
2018-03-29  9:22     ` Doherty, Declan
2018-03-28 13:54 ` [PATCH v6 4/8] ethdev: Add port representor device flag Declan Doherty
2018-03-29  6:13   ` Shahaf Shuler
2018-03-29  7:34     ` Thomas Monjalon
2018-03-29 14:53     ` Doherty, Declan
2018-04-01  6:14       ` Shahaf Shuler
2018-03-28 13:54 ` [PATCH v6 5/8] app/testpmd: add port name to device info Declan Doherty
2018-03-28 13:54 ` [PATCH v6 6/8] ethdev: add common devargs parser Declan Doherty
2018-03-29 12:12   ` Gaëtan Rivet
2018-03-28 13:54 ` [PATCH v6 7/8] net/i40e: add support for representor ports Declan Doherty
2018-03-28 13:54 ` [PATCH v6 8/8] net/ixgbe: " Declan Doherty
2018-04-16 13:05 ` [PATCH v7 0/9] switching devices representation Declan Doherty
2018-04-16 13:05   ` [PATCH v7 1/9] doc: add switch representation documentation Declan Doherty
2018-04-16 15:55     ` Kovacevic, Marko
2018-04-16 13:05   ` [PATCH v7 2/9] ethdev: add switch identifier parameter to port Declan Doherty
2018-04-24 16:38     ` Thomas Monjalon
2018-04-16 13:05   ` [PATCH v7 3/9] ethdev: add generic create/destroy ethdev APIs Declan Doherty
2018-04-20 13:01     ` Ananyev, Konstantin
2018-04-24 17:48     ` Thomas Monjalon
2018-04-16 13:06   ` [PATCH v7 4/9] ethdev: Add port representor device flag Declan Doherty
2018-04-24 19:37     ` Thomas Monjalon
2018-04-25 12:17       ` Doherty, Declan
2018-04-25 12:23         ` Thomas Monjalon
2018-04-16 13:06   ` [PATCH v7 5/9] app/testpmd: add port name to device info Declan Doherty
2018-04-16 13:06   ` [PATCH v7 6/9] ethdev: add common devargs parser Declan Doherty
2018-04-20 13:16     ` Ananyev, Konstantin
2018-04-24 19:53     ` Thomas Monjalon
2018-04-25  9:40       ` Remy Horton
2018-04-25 10:06         ` Thomas Monjalon
2018-04-25 10:45           ` Remy Horton
2018-04-16 13:06   ` [PATCH v7 7/9] ethdev: add switch domain allocator Declan Doherty
2018-04-20 13:22     ` Ananyev, Konstantin
2018-04-24 19:58     ` Thomas Monjalon
2018-04-16 13:06   ` [PATCH v7 8/9] net/i40e: add support for representor ports Declan Doherty
2018-04-16 13:06   ` [PATCH v7 9/9] net/ixgbe: " Declan Doherty
2018-04-20 13:29     ` Ananyev, Konstantin
2018-04-26 10:40   ` [dpdk=-dev][PATCH v8 0/9] switching devices representation Declan Doherty
2018-04-26 10:40     ` [PATCH v8 1/9] doc: add switch representation documentation Declan Doherty
2018-04-26 10:40     ` [PATCH v8 2/9] ethdev: add switch identifier parameter to port Declan Doherty
2018-04-26 12:02       ` Thomas Monjalon
2018-04-26 14:26         ` Thomas Monjalon
2018-04-27 16:29       ` Ferruh Yigit
2018-04-26 10:40     ` [PATCH v8 3/9] ethdev: add generic create/destroy ethdev APIs Declan Doherty
2018-04-26 12:16       ` Ferruh Yigit
2018-04-26 10:41     ` [PATCH v8 4/9] ethdev: Add port representor device flag Declan Doherty
2018-04-26 10:41     ` [PATCH v8 5/9] app/testpmd: add port name to device info Declan Doherty
2018-04-26 10:41     ` [PATCH v8 6/9] ethdev: add common devargs parser Declan Doherty
2018-04-26 12:03       ` Ananyev, Konstantin
2018-04-26 14:21         ` Ferruh Yigit
2018-04-26 14:28         ` Doherty, Declan
2018-04-26 14:44           ` Thomas Monjalon
2018-04-26 14:48           ` Ananyev, Konstantin
2018-04-26 14:30         ` Remy Horton
2018-04-26 12:15       ` Ferruh Yigit
2018-04-26 10:41     ` [PATCH v8 7/9] ethdev: add switch domain allocator Declan Doherty
2018-04-26 12:27       ` Ananyev, Konstantin
2018-04-26 10:41     ` [PATCH v8 8/9] net/i40e: add support for representor ports Declan Doherty
2018-04-26 10:41     ` [PATCH v8 9/9] net/ixgbe: " Declan Doherty
2018-04-26 16:24     ` [dpdk=-dev][PATCH v8 0/9] switching devices representation Ferruh Yigit
2018-04-26 16:35       ` Ferruh Yigit

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=3c33e34e-1ea7-8c3d-cf08-db0028910f00@intel.com \
    --to=declan.doherty@intel.com \
    --cc=alejandro.lucero@netronome.com \
    --cc=alexr@mellanox.com \
    --cc=arybchenko@solarflare.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=mohammad.abdul.awal@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=remy.horton@intel.com \
    --cc=ronye@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=thomas@monjalon.net \
    --cc=vincent.jardin@6wind.com \
    --cc=wenzhuo.lu@intel.com \
    --cc=yliu@fridaylinux.org \
    --cc=zhihong.wang@intel.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.