net/failsafe: use new Tx offloads API
Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") This commit adds support for the new Tx offloads API. Signed-off-by: Moti Haimovsky <motih@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
This commit is contained in:
parent
3771bd2a40
commit
a11c2422ed
@ -31,6 +31,7 @@
|
|||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <rte_debug.h>
|
#include <rte_debug.h>
|
||||||
@ -84,9 +85,20 @@ static int
|
|||||||
fs_dev_configure(struct rte_eth_dev *dev)
|
fs_dev_configure(struct rte_eth_dev *dev)
|
||||||
{
|
{
|
||||||
struct sub_device *sdev;
|
struct sub_device *sdev;
|
||||||
|
uint64_t supp_tx_offloads;
|
||||||
|
uint64_t tx_offloads;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
supp_tx_offloads = PRIV(dev)->infos.tx_offload_capa;
|
||||||
|
tx_offloads = dev->data->dev_conf.txmode.offloads;
|
||||||
|
if ((tx_offloads & supp_tx_offloads) != tx_offloads) {
|
||||||
|
rte_errno = ENOTSUP;
|
||||||
|
ERROR("Some Tx offloads are not supported, "
|
||||||
|
"requested 0x%" PRIx64 " supported 0x%" PRIx64,
|
||||||
|
tx_offloads, supp_tx_offloads);
|
||||||
|
return -rte_errno;
|
||||||
|
}
|
||||||
FOREACH_SUBDEV(sdev, i, dev) {
|
FOREACH_SUBDEV(sdev, i, dev) {
|
||||||
int rmv_interrupt = 0;
|
int rmv_interrupt = 0;
|
||||||
int lsc_interrupt = 0;
|
int lsc_interrupt = 0;
|
||||||
@ -312,6 +324,25 @@ free_rxq:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
fs_txq_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads)
|
||||||
|
{
|
||||||
|
uint64_t port_offloads;
|
||||||
|
uint64_t queue_supp_offloads;
|
||||||
|
uint64_t port_supp_offloads;
|
||||||
|
|
||||||
|
port_offloads = dev->data->dev_conf.txmode.offloads;
|
||||||
|
queue_supp_offloads = PRIV(dev)->infos.tx_queue_offload_capa;
|
||||||
|
port_supp_offloads = PRIV(dev)->infos.tx_offload_capa;
|
||||||
|
if ((offloads & (queue_supp_offloads | port_supp_offloads)) !=
|
||||||
|
offloads)
|
||||||
|
return false;
|
||||||
|
/* Verify we have no conflict with port offloads */
|
||||||
|
if ((port_offloads ^ offloads) & port_supp_offloads)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fs_tx_queue_release(void *queue)
|
fs_tx_queue_release(void *queue)
|
||||||
{
|
{
|
||||||
@ -348,6 +379,23 @@ fs_tx_queue_setup(struct rte_eth_dev *dev,
|
|||||||
fs_tx_queue_release(txq);
|
fs_tx_queue_release(txq);
|
||||||
dev->data->tx_queues[tx_queue_id] = NULL;
|
dev->data->tx_queues[tx_queue_id] = NULL;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Don't verify queue offloads for applications which
|
||||||
|
* use the old API.
|
||||||
|
*/
|
||||||
|
if (tx_conf != NULL &&
|
||||||
|
(tx_conf->txq_flags & ETH_TXQ_FLAGS_IGNORE) &&
|
||||||
|
fs_txq_offloads_valid(dev, tx_conf->offloads) == false) {
|
||||||
|
rte_errno = ENOTSUP;
|
||||||
|
ERROR("Tx queue offloads 0x%" PRIx64
|
||||||
|
" don't match port offloads 0x%" PRIx64
|
||||||
|
" or supported offloads 0x%" PRIx64,
|
||||||
|
tx_conf->offloads,
|
||||||
|
dev->data->dev_conf.txmode.offloads,
|
||||||
|
PRIV(dev)->infos.tx_offload_capa |
|
||||||
|
PRIV(dev)->infos.tx_queue_offload_capa);
|
||||||
|
return -rte_errno;
|
||||||
|
}
|
||||||
txq = rte_zmalloc("ethdev TX queue",
|
txq = rte_zmalloc("ethdev TX queue",
|
||||||
sizeof(*txq) +
|
sizeof(*txq) +
|
||||||
sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail,
|
sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail,
|
||||||
@ -560,6 +608,8 @@ fs_dev_infos_get(struct rte_eth_dev *dev,
|
|||||||
PRIV(dev)->infos.rx_offload_capa = rx_offload_capa;
|
PRIV(dev)->infos.rx_offload_capa = rx_offload_capa;
|
||||||
PRIV(dev)->infos.tx_offload_capa &=
|
PRIV(dev)->infos.tx_offload_capa &=
|
||||||
default_infos.tx_offload_capa;
|
default_infos.tx_offload_capa;
|
||||||
|
PRIV(dev)->infos.tx_queue_offload_capa &=
|
||||||
|
default_infos.tx_queue_offload_capa;
|
||||||
PRIV(dev)->infos.flow_type_rss_offloads &=
|
PRIV(dev)->infos.flow_type_rss_offloads &=
|
||||||
default_infos.flow_type_rss_offloads;
|
default_infos.flow_type_rss_offloads;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user