From: Moti Haimovsky <motih@mellanox.com>
To: ferruh.yigit@intel.com, stephen@networkplumber.org
Cc: gaetan.rivet@6wind.com, dev@dpdk.org,
Moti Haimovsky <motih@mellanox.com>
Subject: [dpdk-dev] [PATCH v4 2/2] net/failsafe: use new Rx offloads API
Date: Wed, 17 Jan 2018 16:30:13 +0200 [thread overview]
Message-ID: <1516199413-134187-2-git-send-email-motih@mellanox.com> (raw)
In-Reply-To: <1516199413-134187-1-git-send-email-motih@mellanox.com>
Ethdev Rx offloads API has changed since:
commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
This commit adds support for the new Rx offloads API.
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
V4:
Modifications according to inputs from Gaetan Rivet in reply to
1515595223-36144-2-git-send-email-motih@mellanox.com
V2:
* Fixed coding style warnings.
---
drivers/net/failsafe/failsafe_ops.c | 45 ++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 53a242e..a2c74f5 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -77,6 +77,13 @@
DEV_RX_OFFLOAD_UDP_CKSUM |
DEV_RX_OFFLOAD_TCP_CKSUM |
DEV_RX_OFFLOAD_TCP_LRO,
+ .rx_queue_offload_capa =
+ DEV_RX_OFFLOAD_VLAN_STRIP |
+ DEV_RX_OFFLOAD_QINQ_STRIP |
+ DEV_RX_OFFLOAD_IPV4_CKSUM |
+ DEV_RX_OFFLOAD_UDP_CKSUM |
+ DEV_RX_OFFLOAD_TCP_CKSUM |
+ DEV_RX_OFFLOAD_TCP_LRO,
.tx_offload_capa = 0x0,
.flow_type_rss_offloads = 0x0,
};
@@ -255,6 +262,25 @@
fs_dev_free_queues(dev);
}
+static bool
+fs_rxq_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.rxmode.offloads;
+ queue_supp_offloads = PRIV(dev)->infos.rx_queue_offload_capa;
+ port_supp_offloads = PRIV(dev)->infos.rx_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
fs_rx_queue_release(void *queue)
{
@@ -292,6 +318,18 @@
fs_rx_queue_release(rxq);
dev->data->rx_queues[rx_queue_id] = NULL;
}
+ /* Verify application offloads are valid for our port and queue. */
+ if (fs_rxq_offloads_valid(dev, rx_conf->offloads) == false) {
+ rte_errno = ENOTSUP;
+ ERROR("Rx queue offloads 0x%" PRIx64
+ " don't match port offloads 0x%" PRIx64
+ " or supported offloads 0x%" PRIx64,
+ rx_conf->offloads,
+ dev->data->dev_conf.rxmode.offloads,
+ PRIV(dev)->infos.rx_offload_capa |
+ PRIV(dev)->infos.rx_queue_offload_capa);
+ return -rte_errno;
+ }
rxq = rte_zmalloc(NULL,
sizeof(*rxq) +
sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail,
@@ -595,17 +633,22 @@
rte_memcpy(&PRIV(dev)->infos, &default_infos,
sizeof(default_infos));
} else {
- uint32_t rx_offload_capa;
+ uint64_t rx_offload_capa;
+ uint64_t rxq_offload_capa;
rx_offload_capa = default_infos.rx_offload_capa;
+ rxq_offload_capa = default_infos.rx_queue_offload_capa;
FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
rte_eth_dev_info_get(PORT_ID(sdev),
&PRIV(dev)->infos);
rx_offload_capa &= PRIV(dev)->infos.rx_offload_capa;
+ rxq_offload_capa &=
+ PRIV(dev)->infos.rx_queue_offload_capa;
}
sdev = TX_SUBDEV(dev);
rte_eth_dev_info_get(PORT_ID(sdev), &PRIV(dev)->infos);
PRIV(dev)->infos.rx_offload_capa = rx_offload_capa;
+ PRIV(dev)->infos.rx_queue_offload_capa = rxq_offload_capa;
PRIV(dev)->infos.tx_offload_capa &=
default_infos.tx_offload_capa;
PRIV(dev)->infos.tx_queue_offload_capa &=
--
1.8.3.1
next prev parent reply other threads:[~2018-01-17 14:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-04 19:31 [dpdk-dev] [PATCH 0/2] net/failsafe: convert to new ethdev " Moti Haimovsky
2018-01-04 19:31 ` [dpdk-dev] [PATCH 1/2] net/failsafe: convert to new Tx " Moti Haimovsky
2018-01-04 19:50 ` [dpdk-dev] [PATCH V2 0/2] net/failsafe: convert to new ethdev " Moti Haimovsky
2018-01-04 19:50 ` [dpdk-dev] [PATCH V2 1/2] net/failsafe: convert to new Tx " Moti Haimovsky
2018-01-04 20:15 ` Stephen Hemminger
2018-01-10 14:40 ` [dpdk-dev] [PATCH V3 " Moti Haimovsky
2018-01-10 14:40 ` [dpdk-dev] [PATCH V3 2/2] net/failsafe: convert to new Rx " Moti Haimovsky
2018-01-15 16:02 ` Gaëtan Rivet
2018-01-15 15:57 ` [dpdk-dev] [PATCH V3 1/2] net/failsafe: convert to new Tx " Gaëtan Rivet
2018-01-17 14:30 ` [dpdk-dev] [PATCH v4 1/2] net/failsafe: use " Moti Haimovsky
2018-01-17 14:30 ` Moti Haimovsky [this message]
2018-01-17 17:30 ` Gaëtan Rivet
2018-01-17 19:24 ` Ferruh Yigit
2018-01-04 19:50 ` [dpdk-dev] [PATCH V2 2/2] net/failsafe: convert to new Rx " Moti Haimovsky
2018-01-04 19:31 ` [dpdk-dev] [PATCH " Moti Haimovsky
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=1516199413-134187-2-git-send-email-motih@mellanox.com \
--to=motih@mellanox.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=gaetan.rivet@6wind.com \
--cc=stephen@networkplumber.org \
/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).