From: Shahaf Shuler <shahafs@mellanox.com>
To: Shahaf Shuler <shahafs@mellanox.com>,
Andrew Rybchenko <arybchenko@solarflare.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
Thomas Monjalon <thomas@monjalon.net>,
Wei Dai <wei.dai@intel.com>
Subject: Re: [dpdk-dev] [PATCH 2/3] ethdev: fail if Tx queue offload is not supported at all
Date: Sun, 13 May 2018 13:30:25 +0000 [thread overview]
Message-ID: <DB7PR05MB44267688484689C9ECE98B49C39D0@DB7PR05MB4426.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <DB7PR05MB4426D63457570BCC36C7ED40C39D0@DB7PR05MB4426.eurprd05.prod.outlook.com>
Sunday, May 13, 2018 8:38 AM, Shahaf Shuler:
> Subject: Re: [dpdk-dev] [PATCH 2/3] ethdev: fail if Tx queue offload is not
> supported at all
> > -----Original Message-----
> > From: Andrew Rybchenko <arybchenko@solarflare.com>
> > Sent: Friday, May 11, 2018 7:26 PM
> > To: dev@dpdk.org
> > Cc: Ferruh Yigit <ferruh.yigit@intel.com>; Thomas Monjalon
> > <thomas@monjalon.net>; Shahaf Shuler <shahafs@mellanox.com>; Wei
> Dai
> > <wei.dai@intel.com>
> > Subject: [PATCH 2/3] ethdev: fail if Tx queue offload is not supported
> > at all
> >
> > Do not allow to request unsupported Tx offload since all checks are
> > removed from PMDs because of consistency check in ethdev.
> > Otherwise application may rely on offload which is not actually
> > supported and send traffic with, for example, wrong checksums,
> > truncated packets or packets with garbage.
> >
> > Fixes: d04dd6d4ed67 ("ethdev: new Rx/Tx offloads API")
> >
> > Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> > ---
> > lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/lib/librte_ethdev/rte_ethdev.c
> > b/lib/librte_ethdev/rte_ethdev.c index dd36e6270..60577efcf 100644
> > --- a/lib/librte_ethdev/rte_ethdev.c
> > +++ b/lib/librte_ethdev/rte_ethdev.c
> > @@ -1744,6 +1744,16 @@ rte_eth_tx_queue_setup(uint16_t port_id,
> > uint16_t tx_queue_id,
> > local_conf.offloads,
> > dev_info.tx_queue_offload_capa,
> > __func__);
> > + /*
> > + * Applications which are not converted yet to the new
> > + * Tx offload API may request device level offloads on
> > + * queue level (and nothing is requested on device level).
> > + * However, if the offload is not supported at all Tx
> > + * queue setup must fail.
> > + */
> > + if ((local_conf.offloads & dev_info.tx_offload_capa) !=
> > + local_conf.offloads)
> > + return -EINVAL;
>
> Not converted application doesn't have a clue what are per-queue offloads,
> and this is the error they will get when the Tx queue configuration will fail.
>
> How about using ETH_TXQ_FLAGS_IGNORE flag, which explicitly says
> "application converted to the new Tx offloads API". and have 2 different
> checks:
> 1. for converted application the already exist check[1] with the related error.
> 2. for not converted application your check with a related error.
>
>
As a suggestion maybe the below diff can be squashed into this one:
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index b3dac067c5..4763718b9c 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1727,25 +1727,29 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
*/
local_conf.offloads &= ~dev->data->dev_conf.txmode.offloads;
- /*
- * New added offloadings for this queue are those not enabled in
- * rte_eth_dev_configure( ) and they must be per-queue type.
- * A pure per-port offloading can't be enabled on a queue while
- * disabled on another queue. A pure per-port offloading can't
- * be enabled for any queue as new added one if it hasn't been
- * enabled in rte_eth_dev_configure( ).
- */
- if ((local_conf.offloads & dev_info.tx_queue_offload_capa) !=
- local_conf.offloads) {
- ethdev_log(ERR, "Ethdev port_id=%d tx_queue_id=%d, new "
- "added offloads 0x%" PRIx64 " must be "
- "within pre-queue offload capabilities 0x%"
- PRIx64 " in %s( )\n",
- port_id,
- tx_queue_id,
- local_conf.offloads,
- dev_info.tx_queue_offload_capa,
- __func__);
+ if (tx_conf->txq_flags & ETH_TXQ_FLAGS_IGNORE) {
+ /*
+ * New added offloadings for this queue are those not enabled in
+ * rte_eth_dev_configure( ) and they must be per-queue type.
+ * A pure per-port offloading can't be enabled on a queue while
+ * disabled on another queue. A pure per-port offloading can't
+ * be enabled for any queue as new added one if it hasn't been
+ * enabled in rte_eth_dev_configure( ).
+ */
+ if ((local_conf.offloads & dev_info.tx_queue_offload_capa) !=
+ local_conf.offloads) {
+ ethdev_log(ERR, "Ethdev port_id=%d tx_queue_id=%d, new "
+ "added offloads 0x%" PRIx64 " must be "
+ "within pre-queue offload capabilities "
+ " 0x%" PRIx64 " in %s( )\n",
+ port_id,
+ tx_queue_id,
+ local_conf.offloads,
+ dev_info.tx_queue_offload_capa,
+ __func__);
+ return -EINVAL;
+ }
+ } else {
/*
* Applications which are not converted yet to the new
* Tx offload API may request device level offloads on
@@ -1754,8 +1758,18 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
* queue setup must fail.
next prev parent reply other threads:[~2018-05-13 13:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 16:25 [dpdk-dev] [PATCH 0/3] ethdev: fail if requested offload is not supported Andrew Rybchenko
2018-05-11 16:25 ` [dpdk-dev] [PATCH 1/3] ethdev: fail configure " Andrew Rybchenko
2018-05-11 16:25 ` [dpdk-dev] [PATCH 2/3] ethdev: fail if Tx queue offload is not supported at all Andrew Rybchenko
2018-05-13 5:37 ` Shahaf Shuler
2018-05-13 13:30 ` Shahaf Shuler [this message]
2018-05-14 6:54 ` Andrew Rybchenko
2018-05-11 16:25 ` [dpdk-dev] [PATCH 3/3] ethdev: fail if Rx queue offload is not supported Andrew Rybchenko
2018-05-14 7:36 ` [dpdk-dev] [PATCH v2 0/3] ethdev: fail if requested " Andrew Rybchenko
2018-05-14 7:36 ` [dpdk-dev] [PATCH v2 1/3] ethdev: fail configure " Andrew Rybchenko
2018-05-14 7:36 ` [dpdk-dev] [PATCH v2 2/3] ethdev: fail if Tx queue " Andrew Rybchenko
2018-05-14 7:36 ` [dpdk-dev] [PATCH v2 3/3] ethdev: fail if Rx " Andrew Rybchenko
2018-05-14 7:51 ` [dpdk-dev] [PATCH v2 0/3] ethdev: fail if requested " Shahaf Shuler
2018-05-14 14:48 ` Ferruh Yigit
2018-06-18 8:43 ` 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=DB7PR05MB44267688484689C9ECE98B49C39D0@DB7PR05MB4426.eurprd05.prod.outlook.com \
--to=shahafs@mellanox.com \
--cc=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=thomas@monjalon.net \
--cc=wei.dai@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).