On 09/13/2017 09:37 AM, Shahaf Shuler wrote:
Introduce a new API to configure Tx offloads.

In the new API, offloads are divided into per-port and per-queue
offloads. The PMD reports capability for each of them.
Offloads are enabled using the existing DEV_TX_OFFLOAD_* flags.
To enable per-port offload, the offload should be set on both device
configuration and queue configuration. To enable per-queue offload, the
offloads can be set only on queue configuration.

Note about documentation of the per-queue and per-port offloads
coexistence is applicable here as well. It would be really helpful to have it
in the documentation.

In addition the Tx offloads will be disabled by default and be
enabled per application needs. This will much simplify PMD management of
the different offloads.

Applications should set the ETH_TXQ_FLAGS_IGNORE flag on txq_flags
field in order to move to the new API.

The old Tx offloads API is kept for the meanwhile, in order to enable a
smooth transition for PMDs and application to the new API.

Signed-off-by: Shahaf Shuler <shah...@mellanox.com>
---
  doc/guides/nics/features.rst  | 33 +++++++++++++++-----
  lib/librte_ether/rte_ethdev.c | 64 +++++++++++++++++++++++++++++++++++++-
  lib/librte_ether/rte_ethdev.h | 38 +++++++++++++++++++++-
  3 files changed, 125 insertions(+), 10 deletions(-)

diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index 4e68144ef..1a8af473b 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst

[snip]

@@ -620,6 +628,15 @@ Supports packet type parsing and returns a list of 
supported types.
.. _nic_features_timesync: +Mbuf fast free
+--------------
+
+Supports optimization for fast release of mbufs following successful Tx.
+Requires all mbufs to come from the same mempool and has refcnt = 1.

It is ambiguous here in the case of fast free configured on port level.
Please, highlight that "from the same mempool" is per-queue.

+
+* **[uses]       rte_eth_txconf,rte_eth_txmode**: 
``offloads:DEV_TX_OFFLOAD_MBUF_FAST_FREE``.
+* **[provides]   rte_eth_dev_info**: 
``tx_offload_capa,tx_queue_offload_capa:DEV_TX_OFFLOAD_MBUF_FAST_FREE``.
+
  Timesync
  --------
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index b3c10701e..85b99588f 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c

[snip]

@@ -1193,6 +1242,7 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t 
tx_queue_id,
  {
        struct rte_eth_dev *dev;
        struct rte_eth_dev_info dev_info;
+       struct rte_eth_txconf local_conf;
        void **txq;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
@@ -1237,8 +1287,20 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t 
tx_queue_id,
        if (tx_conf == NULL)
                tx_conf = &dev_info.default_txconf;
+ /*
+        * Convert between the offloads API to enable PMDs to support
+        * only one of them.
+        */
+       local_conf = *tx_conf;
+       if (tx_conf->txq_flags & ETH_TXQ_FLAGS_IGNORE)
+               rte_eth_convert_txq_offloads(tx_conf->offloads,
+                                            &local_conf.txq_flags);

Is it intended that ignore flag is lost here?
It mean that failsafe slaves will treat txq_flags as the primary source of offloads
configuration and do conversion from txq_flags to offloads.
For example, it means that DEV_TX_OFFLOAD_QINQ_INSERT will be lost as well
as many other offloads which are not covered by txq_flags.

+       else
+               rte_eth_convert_txq_flags(tx_conf->txq_flags,
+                                         &local_conf.offloads);
+
        return (*dev->dev_ops->tx_queue_setup)(dev, tx_queue_id, nb_tx_desc,
-                                              socket_id, tx_conf);
+                                              socket_id, &local_conf);
  }
void

[snip]

Reply via email to