[dpdk-dev] [PATCH v8] ethdev: check Rx/Tx offloads

Dai, Wei wei.dai at intel.com
Tue May 8 14:34:36 CEST 2018


Hi, Andrew
See my in-line comments as below.

From: Andrew Rybchenko [mailto:arybchenko at solarflare.com] 
Sent: Tuesday, May 8, 2018 7:37 PM
To: Dai, Wei <wei.dai at intel.com>; Yigit, Ferruh <ferruh.yigit at intel.com>; thomas at monjalon.net; Doherty, Declan <declan.doherty at intel.com>; linville at tuxdriver.com; mw at semihalf.com; mk at semihalf.com; gtzalik at amazon.com; evgenys at amazon.com; ravi1.kumar at amd.com; shepard.siegel at atomicrules.com; ed.czeck at atomicrules.com; john.miller at atomicrules.com; ajit.khaparde at broadcom.com; somnath.kotur at broadcom.com; jerin.jacob at caviumnetworks.com; maciej.czekaj at caviumnetworks.com; shijith.thotton at cavium.com; ssrinivasan at cavium.com; santosh.shukla at caviumnetworks.com; rahul.lakkireddy at chelsio.com; ohndale at cisco.com; hyonkim at cisco.com; Lu, Wenzhuo <wenzhuo.lu at intel.com>; Ananyev, Konstantin <konstantin.ananyev at intel.com>; Xing, Beilei <beilei.xing at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>; Wang, Xiao W <xiao.w.wang at intel.com>; Wu, Jingjing <jingjing.wu at intel.com>; tdu at semihalf.com; dima at marvell.com; nsamsono at marvell.com; jianbo.liu at arm.com; adrien.mazarguil at 6wind.com; nelio.laranjeiro at 6wind.com; yskoh at mellanox.com; matan at mellanox.com; vido at cesnet.cz; alejandro.lucero at netronome.com; emant.agrawal at nxp.com; shreyansh.jain at nxp.com; hemant.agrawal at nxp.com; harish.patil at cavium.com; rasesh.mody at cavium.com; asesh.mody at cavium.com; shahed.shaikh at cavium.com; yongwang at vmware.com; maxime.coquelin at redhat.com; mtetsuyah at gmail.com; Bie, Tiwei <tiwei.bie at intel.com>; Legacy, Allain (Wind River) <allain.legacy at windriver.com>; Peters, Matt (Wind River) <matt.peters at windriver.com>; pascal.mazon at 6wind.com; Richardson, Bruce <bruce.richardson at intel.com>; gaetan.rivet at 6wind.com; Singh, Jasvinder <jasvinder.singh at intel.com>; Dumitrescu, Cristian <cristian.dumitrescu at intel.com>
Cc: dev at dpdk.org; Ivan Malov <Ivan.Malov at oktetlabs.ru>
Subject: Re: [PATCH v8] ethdev: check Rx/Tx offloads

On 05/08/2018 01:05 PM, Wei Dai wrote:
This patch check if a input requested offloading is valid or not.
Any reuqested offloading must be supported in the device capabilities.
Any offloading is disabled by default if it is not set in the parameter
dev_conf->[rt]xmode.offloads to rte_eth_dev_configure( ) and
[rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ).
If any offloading is enabled in rte_eth_dev_configure( ) by application,
it is enabled on all queues no matter whether it is per-queue or
per-port type and no matter whether it is set or cleared in
[rt]x_conf->offloads to rte_eth_[rt]x_queue_setup( ).
If a per-queue offloading hasn't be enabled in rte_eth_dev_configure( ),
it can be enabled or disabled for individual queue in
ret_eth_[rt]x_queue_setup( ).
A new added offloading is the one which hasn't been enabled in
rte_eth_dev_configure( ) and is reuqested to be enabled in
rte_eth_[rt]x_queue_setup( ), it must be per-queue type,
otherwise return error.
The underlying PMD must be aware that the requested offloadings
to PMD specific queue_setup( ) function only carries those
new added offloadings of per-queue type.

This patch can make above such checking in a common way in rte_ethdev
layer to avoid same checking in underlying PMD.

This patch assumes that all PMDs in 18.05-rc2 have already
converted to offload API defined in 17.11 . It also assumes
that all PMDs can return correct offloading capabilities
in rte_eth_dev_infos_get( ).

In the beginning of [rt]x_queue_setup( ) of underlying PMD,
add offloads = [rt]xconf->offloads |
dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API
defined in 17.11 to avoid upper application broken due to offload
API change.
PMD can use the info that input [rt]xconf->offloads only carry
the new added per-queue offloads to do some optimization or some
code change on base of this patch.

Signed-off-by: Wei Dai <wei.dai at intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang at intel.com>

[...]


diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index e42d553..fc2b254 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -413,14 +413,16 @@ sfc_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
 {
 	struct sfc_adapter *sa = dev->data->dev_private;
 	int rc;
+	uint64_t offloads;
 
 	sfc_log_init(sa, "RxQ=%u nb_rx_desc=%u socket_id=%u",
 		     rx_queue_id, nb_rx_desc, socket_id);
 
 	sfc_adapter_lock(sa);
 
+	offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads;

I'd prefer to see it inside sfc_rx_qinit() function. It would allow to avoid
sfc_rx_qinit() function prototype changes.
[Wei: As rx_conf is a const argument in sfc_rx_queue_setup( ), rx_conf->offloads can't be updated.
  If sfc_rx_qinit( ) function prototype keep unchanged,  the dev->data can be deduced from the
 1st argument sa .  Andrew, if my code works well, can it be kept here,  you can change it later
 in your separate patch, OK ? ]

 	rc = sfc_rx_qinit(sa, rx_queue_id, nb_rx_desc, socket_id,
-			  rx_conf, mb_pool);
+			  rx_conf, mb_pool, offloads);
 	if (rc != 0)
 		goto fail_rx_qinit;
 
@@ -469,13 +471,16 @@ sfc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
 {
 	struct sfc_adapter *sa = dev->data->dev_private;
 	int rc;
+	uint64_t offloads;
 
 	sfc_log_init(sa, "TxQ = %u, nb_tx_desc = %u, socket_id = %u",
 		     tx_queue_id, nb_tx_desc, socket_id);
 
 	sfc_adapter_lock(sa);
 
-	rc = sfc_tx_qinit(sa, tx_queue_id, nb_tx_desc, socket_id, tx_conf);
+	offloads = tx_conf->offloads | dev->data->dev_conf.txmode.offloads;

Same as above.


+	rc = sfc_tx_qinit(sa, tx_queue_id, nb_tx_desc, socket_id,
+			  tx_conf, offloads);
 	if (rc != 0)
 		goto fail_tx_qinit;

[...]

It looks like device level offloads are checked on ethdev layer now.
So, I think check in sfc_rx_check_mode () and sfc_tx_check_mode()
may be removed as well (see offloads_rejected).
I think it will make functions sfc_rx_log_offloads() and
sfc_tx_log_offloads() unused and these functions should be removed.
[Wei: sorry, I miss the sf_[rt]x_check_mode( ). Yes, offloads_rejected in this function checking can be removed.
 But as this patch is a big one, I'd like it keep as it is if it works well. And I'd like you remove such checking or 
do other changes in your own patch]
[Wei: by the way, your mail is HTML format,  I am afraid it is missed from mail archives.]


More information about the dev mailing list