* [dpdk-dev] [PATCH 0/2] net/failsafe: convert to new ethdev offloads API @ 2018-01-04 19:31 Moti Haimovsky 2018-01-04 19:31 ` [dpdk-dev] [PATCH 1/2] net/failsafe: convert to new Tx " Moti Haimovsky 2018-01-04 19:31 ` [dpdk-dev] [PATCH " Moti Haimovsky 0 siblings, 2 replies; 15+ messages in thread From: Moti Haimovsky @ 2018-01-04 19:31 UTC (permalink / raw) To: gaetan.rivet; +Cc: dev, Moti Haimovsky Ethdev offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") The following commits add support the new offloads API for Tx and Rx respectively. Moti Haimovsky (2): net/failsafe: convert to new Tx offloads API net/failsafe: convert to new Rx offloads API drivers/net/failsafe/failsafe_ops.c | 83 +++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [dpdk-dev] [PATCH 1/2] net/failsafe: convert to new Tx offloads API 2018-01-04 19:31 [dpdk-dev] [PATCH 0/2] net/failsafe: convert to new ethdev offloads API Moti Haimovsky @ 2018-01-04 19:31 ` 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:31 ` [dpdk-dev] [PATCH " Moti Haimovsky 1 sibling, 1 reply; 15+ messages in thread From: Moti Haimovsky @ 2018-01-04 19:31 UTC (permalink / raw) To: gaetan.rivet; +Cc: dev, Moti Haimovsky Ethdev Tx offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API) This commit adds support to the new Tx offloads API. Signed-off-by: Moti Haimovsky <motih@mellanox.com> --- drivers/net/failsafe/failsafe_ops.c | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index e16a590..1fd845f 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -31,6 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <stdbool.h> #include <stdint.h> #include <rte_debug.h> @@ -77,6 +78,7 @@ DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_TCP_LRO, .tx_offload_capa = 0x0, + .tx_queue_offload_capa = 0x0, .flow_type_rss_offloads = 0x0, }; @@ -84,9 +86,18 @@ fs_dev_configure(struct rte_eth_dev *dev) { struct sub_device *sdev; + uint64_t supp_tx_offloads = PRIV(dev)->infos.tx_offload_capa; + uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads; uint8_t i; int ret; + if ((tx_offloads & supp_tx_offloads) != tx_offloads) { + rte_errno = ENOTSUP; + ERROR("Some Tx offloads are not supported, " + "requested 0x%lx supported 0x%lx\n", + tx_offloads, supp_tx_offloads); + return -rte_errno; + } FOREACH_SUBDEV(sdev, i, dev) { int rmv_interrupt = 0; int lsc_interrupt = 0; @@ -311,6 +322,22 @@ return ret; } +static bool +fs_txq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads = dev->data->dev_conf.txmode.offloads; + uint64_t queue_supp_offloads = PRIV(dev)->infos.tx_queue_offload_capa; + uint64_t 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 fs_tx_queue_release(void *queue) { @@ -347,6 +374,22 @@ fs_tx_queue_release(txq); 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_are_offloads_valid(dev, tx_conf->offloads)) { + rte_errno = ENOTSUP; + ERROR("%p: Tx queue offloads 0x%lx don't match port " + "offloads 0x%lx or supported offloads 0x%lx", + (void *)dev, 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", sizeof(*txq) + sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail, @@ -559,6 +602,8 @@ PRIV(dev)->infos.rx_offload_capa = rx_offload_capa; PRIV(dev)->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 &= default_infos.flow_type_rss_offloads; } -- 1.8.3.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [dpdk-dev] [PATCH V2 0/2] net/failsafe: convert to new ethdev offloads API 2018-01-04 19:31 ` [dpdk-dev] [PATCH 1/2] net/failsafe: convert to new Tx " Moti Haimovsky @ 2018-01-04 19:50 ` Moti Haimovsky 2018-01-04 19:50 ` [dpdk-dev] [PATCH V2 1/2] net/failsafe: convert to new Tx " Moti Haimovsky 2018-01-04 19:50 ` [dpdk-dev] [PATCH V2 2/2] net/failsafe: convert to new Rx " Moti Haimovsky 0 siblings, 2 replies; 15+ messages in thread From: Moti Haimovsky @ 2018-01-04 19:50 UTC (permalink / raw) To: gaetan.rivet; +Cc: dev, Moti Haimovsky Ethdev offloads API has changed since: commit cba7f53b717d ("ethdev: introduce Tx queue offloads API") commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") The following commits add support the new offloads API for Tx and Rx respectively. Moti Haimovsky (2): net/failsafe: convert to new Tx offloads API net/failsafe: convert to new Rx offloads API Signed-off-by: Moti Haimovsky <motih@mellanox.com> drivers/net/failsafe/failsafe_ops.c | 83 +++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [dpdk-dev] [PATCH V2 1/2] net/failsafe: convert to new Tx offloads API 2018-01-04 19:50 ` [dpdk-dev] [PATCH V2 0/2] net/failsafe: convert to new ethdev " Moti Haimovsky @ 2018-01-04 19:50 ` Moti Haimovsky 2018-01-04 20:15 ` Stephen Hemminger 2018-01-10 14:40 ` [dpdk-dev] [PATCH V3 " Moti Haimovsky 2018-01-04 19:50 ` [dpdk-dev] [PATCH V2 2/2] net/failsafe: convert to new Rx " Moti Haimovsky 1 sibling, 2 replies; 15+ messages in thread From: Moti Haimovsky @ 2018-01-04 19:50 UTC (permalink / raw) To: gaetan.rivet; +Cc: dev, Moti Haimovsky 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> --- V2: * Fixed coding style warnings. --- drivers/net/failsafe/failsafe_ops.c | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index e16a590..e498c49 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -31,6 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <stdbool.h> #include <stdint.h> #include <rte_debug.h> @@ -77,6 +78,7 @@ DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_TCP_LRO, .tx_offload_capa = 0x0, + .tx_queue_offload_capa = 0x0, .flow_type_rss_offloads = 0x0, }; @@ -84,9 +86,18 @@ fs_dev_configure(struct rte_eth_dev *dev) { struct sub_device *sdev; + uint64_t supp_tx_offloads = PRIV(dev)->infos.tx_offload_capa; + uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads; uint8_t i; int ret; + if ((tx_offloads & supp_tx_offloads) != tx_offloads) { + rte_errno = ENOTSUP; + ERROR("Some Tx offloads are not supported, " + "requested 0x%lx supported 0x%lx\n", + tx_offloads, supp_tx_offloads); + return -rte_errno; + } FOREACH_SUBDEV(sdev, i, dev) { int rmv_interrupt = 0; int lsc_interrupt = 0; @@ -311,6 +322,22 @@ return ret; } +static bool +fs_txq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads = dev->data->dev_conf.txmode.offloads; + uint64_t queue_supp_offloads = PRIV(dev)->infos.tx_queue_offload_capa; + uint64_t 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 fs_tx_queue_release(void *queue) { @@ -347,6 +374,22 @@ fs_tx_queue_release(txq); 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_are_offloads_valid(dev, tx_conf->offloads)) { + rte_errno = ENOTSUP; + ERROR("%p: Tx queue offloads 0x%lx don't match port " + "offloads 0x%lx or supported offloads 0x%lx", + (void *)dev, 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", sizeof(*txq) + sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail, @@ -559,6 +602,8 @@ PRIV(dev)->infos.rx_offload_capa = rx_offload_capa; PRIV(dev)->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 &= default_infos.flow_type_rss_offloads; } -- 1.8.3.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [dpdk-dev] [PATCH V2 1/2] net/failsafe: convert to new Tx offloads API 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 1 sibling, 0 replies; 15+ messages in thread From: Stephen Hemminger @ 2018-01-04 20:15 UTC (permalink / raw) To: Moti Haimovsky; +Cc: gaetan.rivet, dev On Thu, 4 Jan 2018 21:50:57 +0200 Moti Haimovsky <motih@mellanox.com> wrote: > .tx_offload_capa = 0x0, > + .tx_queue_offload_capa = 0x0, > .flow_type_rss_offloads = 0x0, Minor nit you don't need to initialize every structure element. Compiler defaults everything to zero. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [dpdk-dev] [PATCH V3 1/2] net/failsafe: convert to new Tx offloads API 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 ` Moti Haimovsky 2018-01-10 14:40 ` [dpdk-dev] [PATCH V3 2/2] net/failsafe: convert to new Rx " Moti Haimovsky ` (2 more replies) 1 sibling, 3 replies; 15+ messages in thread From: Moti Haimovsky @ 2018-01-10 14:40 UTC (permalink / raw) To: ferruh.yigit, stephen; +Cc: gaetan.rivet, dev, Moti Haimovsky 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> --- V3: Modification according to inputs from Stephen Hemminger * Removed unnecessary initialization of tx_queue_offload_capa V2: * Fixed coding style warnings. --- drivers/net/failsafe/failsafe_ops.c | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index e16a590..fc1b85a 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -31,6 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <stdbool.h> #include <stdint.h> #include <rte_debug.h> @@ -84,9 +85,18 @@ fs_dev_configure(struct rte_eth_dev *dev) { struct sub_device *sdev; + uint64_t supp_tx_offloads = PRIV(dev)->infos.tx_offload_capa; + uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads; uint8_t i; int ret; + if ((tx_offloads & supp_tx_offloads) != tx_offloads) { + rte_errno = ENOTSUP; + ERROR("Some Tx offloads are not supported, " + "requested 0x%lx supported 0x%lx\n", + tx_offloads, supp_tx_offloads); + return -rte_errno; + } FOREACH_SUBDEV(sdev, i, dev) { int rmv_interrupt = 0; int lsc_interrupt = 0; @@ -311,6 +321,22 @@ return ret; } +static bool +fs_txq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads = dev->data->dev_conf.txmode.offloads; + uint64_t queue_supp_offloads = PRIV(dev)->infos.tx_queue_offload_capa; + uint64_t 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 fs_tx_queue_release(void *queue) { @@ -347,6 +373,22 @@ fs_tx_queue_release(txq); 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_are_offloads_valid(dev, tx_conf->offloads)) { + rte_errno = ENOTSUP; + ERROR("%p: Tx queue offloads 0x%lx don't match port " + "offloads 0x%lx or supported offloads 0x%lx", + (void *)dev, 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", sizeof(*txq) + sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail, @@ -559,6 +601,8 @@ PRIV(dev)->infos.rx_offload_capa = rx_offload_capa; PRIV(dev)->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 &= default_infos.flow_type_rss_offloads; } -- 1.8.3.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [dpdk-dev] [PATCH V3 2/2] net/failsafe: convert to new Rx offloads API 2018-01-10 14:40 ` [dpdk-dev] [PATCH V3 " Moti Haimovsky @ 2018-01-10 14:40 ` 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 2 siblings, 1 reply; 15+ messages in thread From: Moti Haimovsky @ 2018-01-10 14:40 UTC (permalink / raw) To: ferruh.yigit, stephen; +Cc: gaetan.rivet, dev, Moti Haimovsky 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> --- V2: * Fixed coding style warnings. --- drivers/net/failsafe/failsafe_ops.c | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index fc1b85a..c2b01e9 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, }; @@ -253,6 +260,22 @@ fs_dev_free_queues(dev); } +static bool +fs_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads; + uint64_t queue_supp_offloads = PRIV(dev)->infos.rx_queue_offload_capa; + uint64_t 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) { @@ -290,6 +313,17 @@ 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_are_offloads_valid(dev, rx_conf->offloads)) { + rte_errno = ENOTSUP; + ERROR("%p: Rx queue offloads 0x%lx don't match port " + "offloads 0x%lx or supported offloads 0x%lx", + (void *)dev, 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, @@ -589,12 +623,16 @@ sizeof(default_infos)); } else { uint32_t rx_offload_capa; + uint32_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); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [dpdk-dev] [PATCH V3 2/2] net/failsafe: convert to new Rx offloads API 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 0 siblings, 0 replies; 15+ messages in thread From: Gaëtan Rivet @ 2018-01-15 16:02 UTC (permalink / raw) To: Moti Haimovsky; +Cc: ferruh.yigit, stephen, dev My remarks for this one are mostly the same, I will try to repeat them faithfully... "convert to" -> "use" On Wed, Jan 10, 2018 at 04:40:23PM +0200, Moti Haimovsky wrote: ... > +static bool > +fs_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) function name can be shortened (s/_are//). > +{ > + uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads; > + uint64_t queue_supp_offloads = PRIV(dev)->infos.rx_queue_offload_capa; > + uint64_t port_supp_offloads = PRIV(dev)->infos.rx_offload_capa; > + Please separate variable definition and initialization. > + 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) > { > @@ -290,6 +313,17 @@ > 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_are_offloads_valid(dev, rx_conf->offloads)) { > + rte_errno = ENOTSUP; > + ERROR("%p: Rx queue offloads 0x%lx don't match port " Here, the device pointer should not be displayed. It may be a larger issue with the fail-safe, that should be fixed (when using multiple fail-safe instances), but for now, all outputs should follow the same format. Otherwise, use PRIx64 for displaying uint64_t. > + "offloads 0x%lx or supported offloads 0x%lx", > + (void *)dev, 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, > @@ -589,12 +623,16 @@ > sizeof(default_infos)); > } else { > uint32_t rx_offload_capa; > + uint32_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); > -- > 1.8.3.1 > Regards, -- Gaëtan Rivet 6WIND ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [dpdk-dev] [PATCH V3 1/2] net/failsafe: convert to new Tx offloads API 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 15:57 ` Gaëtan Rivet 2018-01-17 14:30 ` [dpdk-dev] [PATCH v4 1/2] net/failsafe: use " Moti Haimovsky 2 siblings, 0 replies; 15+ messages in thread From: Gaëtan Rivet @ 2018-01-15 15:57 UTC (permalink / raw) To: Moti Haimovsky; +Cc: ferruh.yigit, stephen, dev Hi Moti, Thanks for the patches. I have some nitpicks, but overall it is good. Sorry for doing the review so late, the changes should not take long, it's mostly syntax. For the commit title, I'd prefer "use" instead of "convert to" [PATCH V3 1/2] net/failsafe: use new Tx offloads API As the old API is still supported and used. On Wed, Jan 10, 2018 at 04:40:22PM +0200, Moti Haimovsky wrote: .. > @@ -84,9 +85,18 @@ > fs_dev_configure(struct rte_eth_dev *dev) > { > struct sub_device *sdev; > + uint64_t supp_tx_offloads = PRIV(dev)->infos.tx_offload_capa; > + uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads; I'm not fond of compound variable definition and initialization. Initialization should be done after the definition list. > uint8_t i; > int ret; > > + if ((tx_offloads & supp_tx_offloads) != tx_offloads) { > + rte_errno = ENOTSUP; > + ERROR("Some Tx offloads are not supported, " > + "requested 0x%lx supported 0x%lx\n", Please use PRIx64 instead of %lx for displaying uint64_t. > + tx_offloads, supp_tx_offloads); > + return -rte_errno; > + } > FOREACH_SUBDEV(sdev, i, dev) { > int rmv_interrupt = 0; > int lsc_interrupt = 0; > @@ -311,6 +321,22 @@ > return ret; > } > > +static bool > +fs_txq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) _are seems unnecessary here: if (fs_txq_offloads_valid() == false) { ... } reads well enough and is shorter. > +{ > + uint64_t port_offloads = dev->data->dev_conf.txmode.offloads; > + uint64_t queue_supp_offloads = PRIV(dev)->infos.tx_queue_offload_capa; > + uint64_t 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 > fs_tx_queue_release(void *queue) > { > @@ -347,6 +373,22 @@ > fs_tx_queue_release(txq); > 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) && No need for !! > + !fs_txq_are_offloads_valid(dev, tx_conf->offloads)) { Please check against explicit "false" instead of using '!'. -- Gaëtan Rivet 6WIND ^ permalink raw reply [flat|nested] 15+ messages in thread
* [dpdk-dev] [PATCH v4 1/2] net/failsafe: use new Tx offloads API 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 15:57 ` [dpdk-dev] [PATCH V3 1/2] net/failsafe: convert to new Tx " Gaëtan Rivet @ 2018-01-17 14:30 ` Moti Haimovsky 2018-01-17 14:30 ` [dpdk-dev] [PATCH v4 2/2] net/failsafe: use new Rx " Moti Haimovsky 2018-01-17 17:30 ` [dpdk-dev] [PATCH v4 1/2] net/failsafe: use new Tx " Gaëtan Rivet 2 siblings, 2 replies; 15+ messages in thread From: Moti Haimovsky @ 2018-01-17 14:30 UTC (permalink / raw) To: ferruh.yigit, stephen; +Cc: gaetan.rivet, dev, Moti Haimovsky 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> --- V4: Modifications according to inputs from Gaetan Rivet in reply to 1515595223-36144-1-git-send-email-motih@mellanox.com V3: Modifications according to inputs from Stephen Hemminger * Removed unnecessary initialization of tx_queue_offload_capa V2: * Fixed coding style warnings. --- drivers/net/failsafe/failsafe_ops.c | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index fe957ad..53a242e 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -31,6 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <stdbool.h> #include <stdint.h> #include <rte_debug.h> @@ -84,9 +85,20 @@ fs_dev_configure(struct rte_eth_dev *dev) { struct sub_device *sdev; + uint64_t supp_tx_offloads; + uint64_t tx_offloads; uint8_t i; 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) { int rmv_interrupt = 0; int lsc_interrupt = 0; @@ -312,6 +324,25 @@ 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 fs_tx_queue_release(void *queue) { @@ -348,6 +379,23 @@ fs_tx_queue_release(txq); 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", sizeof(*txq) + sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail, @@ -560,6 +608,8 @@ PRIV(dev)->infos.rx_offload_capa = rx_offload_capa; PRIV(dev)->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 &= default_infos.flow_type_rss_offloads; } -- 1.8.3.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [dpdk-dev] [PATCH v4 2/2] net/failsafe: use new Rx offloads API 2018-01-17 14:30 ` [dpdk-dev] [PATCH v4 1/2] net/failsafe: use " Moti Haimovsky @ 2018-01-17 14:30 ` Moti Haimovsky 2018-01-17 17:30 ` [dpdk-dev] [PATCH v4 1/2] net/failsafe: use new Tx " Gaëtan Rivet 1 sibling, 0 replies; 15+ messages in thread From: Moti Haimovsky @ 2018-01-17 14:30 UTC (permalink / raw) To: ferruh.yigit, stephen; +Cc: gaetan.rivet, dev, Moti Haimovsky 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/2] net/failsafe: use new Tx offloads API 2018-01-17 14:30 ` [dpdk-dev] [PATCH v4 1/2] net/failsafe: use " Moti Haimovsky 2018-01-17 14:30 ` [dpdk-dev] [PATCH v4 2/2] net/failsafe: use new Rx " Moti Haimovsky @ 2018-01-17 17:30 ` Gaëtan Rivet 2018-01-17 19:24 ` Ferruh Yigit 1 sibling, 1 reply; 15+ messages in thread From: Gaëtan Rivet @ 2018-01-17 17:30 UTC (permalink / raw) To: Moti Haimovsky; +Cc: ferruh.yigit, stephen, dev Hi Moti, On Wed, Jan 17, 2018 at 04:30:12PM +0200, Moti Haimovsky wrote: > 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> > --- > V4: > Modifications according to inputs from Gaetan Rivet in reply to > 1515595223-36144-1-git-send-email-motih@mellanox.com > > V3: > Modifications according to inputs from Stephen Hemminger > * Removed unnecessary initialization of tx_queue_offload_capa > > V2: > * Fixed coding style warnings. For both patches: Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com> -- Gaëtan Rivet 6WIND ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/2] net/failsafe: use new Tx offloads API 2018-01-17 17:30 ` [dpdk-dev] [PATCH v4 1/2] net/failsafe: use new Tx " Gaëtan Rivet @ 2018-01-17 19:24 ` Ferruh Yigit 0 siblings, 0 replies; 15+ messages in thread From: Ferruh Yigit @ 2018-01-17 19:24 UTC (permalink / raw) To: Gaëtan Rivet, Moti Haimovsky; +Cc: stephen, dev On 1/17/2018 5:30 PM, Gaëtan Rivet wrote: > Hi Moti, > > On Wed, Jan 17, 2018 at 04:30:12PM +0200, Moti Haimovsky wrote: >> 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> >> --- >> V4: >> Modifications according to inputs from Gaetan Rivet in reply to >> 1515595223-36144-1-git-send-email-motih@mellanox.com >> >> V3: >> Modifications according to inputs from Stephen Hemminger >> * Removed unnecessary initialization of tx_queue_offload_capa >> >> V2: >> * Fixed coding style warnings. > > For both patches: > > Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com> Series applied to dpdk-next-net/master, thanks. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [dpdk-dev] [PATCH V2 2/2] net/failsafe: convert to new Rx offloads API 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 19:50 ` Moti Haimovsky 1 sibling, 0 replies; 15+ messages in thread From: Moti Haimovsky @ 2018-01-04 19:50 UTC (permalink / raw) To: gaetan.rivet; +Cc: dev, Moti Haimovsky 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> --- V2: * Fixed coding style warnings. --- drivers/net/failsafe/failsafe_ops.c | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index e498c49..e4aa82d 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, .tx_queue_offload_capa = 0x0, .flow_type_rss_offloads = 0x0, @@ -254,6 +261,22 @@ fs_dev_free_queues(dev); } +static bool +fs_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads; + uint64_t queue_supp_offloads = PRIV(dev)->infos.rx_queue_offload_capa; + uint64_t 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) { @@ -291,6 +314,17 @@ 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_are_offloads_valid(dev, rx_conf->offloads)) { + rte_errno = ENOTSUP; + ERROR("%p: Rx queue offloads 0x%lx don't match port " + "offloads 0x%lx or supported offloads 0x%lx", + (void *)dev, 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, @@ -590,12 +624,16 @@ sizeof(default_infos)); } else { uint32_t rx_offload_capa; + uint32_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); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [dpdk-dev] [PATCH 2/2] net/failsafe: convert to new Rx offloads API 2018-01-04 19:31 [dpdk-dev] [PATCH 0/2] net/failsafe: convert to new ethdev offloads API Moti Haimovsky 2018-01-04 19:31 ` [dpdk-dev] [PATCH 1/2] net/failsafe: convert to new Tx " Moti Haimovsky @ 2018-01-04 19:31 ` Moti Haimovsky 1 sibling, 0 replies; 15+ messages in thread From: Moti Haimovsky @ 2018-01-04 19:31 UTC (permalink / raw) To: gaetan.rivet; +Cc: dev, Moti Haimovsky 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> --- drivers/net/failsafe/failsafe_ops.c | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 1fd845f..6532a62 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, .tx_queue_offload_capa = 0x0, .flow_type_rss_offloads = 0x0, @@ -254,6 +261,22 @@ fs_dev_free_queues(dev); } +static bool +fs_rxq_are_offloads_valid(struct rte_eth_dev *dev, uint64_t offloads) +{ + uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads; + uint64_t queue_supp_offloads = PRIV(dev)->infos.rx_queue_offload_capa; + uint64_t 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) { @@ -291,6 +314,17 @@ 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_are_offloads_valid(dev, rx_conf->offloads)) { + rte_errno = ENOTSUP; + ERROR("%p: Rx queue offloads 0x%lx don't match port " + "offloads 0x%lx or supported offloads 0x%lx", + (void *)dev, 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, @@ -590,12 +624,16 @@ sizeof(default_infos)); } else { uint32_t rx_offload_capa; + uint32_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); -- 1.8.3.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2018-01-17 19:24 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-01-04 19:31 [dpdk-dev] [PATCH 0/2] net/failsafe: convert to new ethdev offloads API 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 ` [dpdk-dev] [PATCH v4 2/2] net/failsafe: use new Rx " Moti Haimovsky 2018-01-17 17:30 ` [dpdk-dev] [PATCH v4 1/2] net/failsafe: use new Tx " 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
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).