* [dpdk-dev] [PATCH 0/2] switch to the new Rx/Tx offloads API
@ 2018-01-22 12:04 Tomasz Duszynski
2018-01-22 12:04 ` [dpdk-dev] [PATCH 1/2] net/mrvl: switch to the new Rx offload API Tomasz Duszynski
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Tomasz Duszynski @ 2018-01-22 12:04 UTC (permalink / raw)
To: dev; +Cc: mw, dima, nsamsono, Jianbo.liu, jck, Tomasz Duszynski
This patch series replaces the old Rx/Tx offload API with the
new API.
Tomasz Duszynski (2):
net/mrvl: switch to the new Rx offload API
net/mrvl: switch to the new Tx offload API
drivers/net/mrvl/mrvl_ethdev.c | 125 ++++++++++++++++++++++++++++++++++-------
1 file changed, 106 insertions(+), 19 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 1/2] net/mrvl: switch to the new Rx offload API
2018-01-22 12:04 [dpdk-dev] [PATCH 0/2] switch to the new Rx/Tx offloads API Tomasz Duszynski
@ 2018-01-22 12:04 ` Tomasz Duszynski
2018-01-22 17:53 ` Ferruh Yigit
2018-01-22 12:04 ` [dpdk-dev] [PATCH 2/2] net/mrvl: switch to the new Tx " Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Tomasz Duszynski
2 siblings, 1 reply; 9+ messages in thread
From: Tomasz Duszynski @ 2018-01-22 12:04 UTC (permalink / raw)
To: dev; +Cc: mw, dima, nsamsono, Jianbo.liu, jck, Tomasz Duszynski
Since the old Rx offload API is now depracated
update the driver to use the latest one.
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
drivers/net/mrvl/mrvl_ethdev.c | 73 ++++++++++++++++++++++++++++++++++--------
1 file changed, 59 insertions(+), 14 deletions(-)
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index 4294c56..2e8c6cc 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -94,6 +94,13 @@
/* Memory size (in bytes) for MUSDK dma buffers */
#define MRVL_MUSDK_DMA_MEMSIZE 41943040
+/** Port Rx offload capabilities */
+#define MRVL_RX_OFFLOADS (DEV_RX_OFFLOAD_VLAN_FILTER | \
+ DEV_RX_OFFLOAD_JUMBO_FRAME | \
+ DEV_RX_OFFLOAD_CRC_STRIP | \
+ DEV_RX_OFFLOAD_CHECKSUM)
+
+
static const char * const valid_args[] = {
MRVL_IFACE_NAME_ARG,
MRVL_CFG_ARG,
@@ -302,13 +309,13 @@ mrvl_dev_configure(struct rte_eth_dev *dev)
return -EINVAL;
}
- if (!dev->data->dev_conf.rxmode.hw_strip_crc) {
+ if (!(dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
RTE_LOG(INFO, PMD,
"L2 CRC stripping is always enabled in hw\n");
- dev->data->dev_conf.rxmode.hw_strip_crc = 1;
+ dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
}
- if (dev->data->dev_conf.rxmode.hw_vlan_strip) {
+ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP) {
RTE_LOG(INFO, PMD, "VLAN stripping not supported\n");
return -EINVAL;
}
@@ -318,17 +325,17 @@ mrvl_dev_configure(struct rte_eth_dev *dev)
return -EINVAL;
}
- if (dev->data->dev_conf.rxmode.enable_scatter) {
+ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) {
RTE_LOG(INFO, PMD, "RX Scatter/Gather not supported\n");
return -EINVAL;
}
- if (dev->data->dev_conf.rxmode.enable_lro) {
+ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TCP_LRO) {
RTE_LOG(INFO, PMD, "LRO not supported\n");
return -EINVAL;
}
- if (dev->data->dev_conf.rxmode.jumbo_frame)
+ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)
dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
ETHER_HDR_LEN - ETHER_CRC_LEN;
@@ -1124,11 +1131,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
info->tx_desc_lim.nb_min = MRVL_PP2_TXD_MIN;
info->tx_desc_lim.nb_align = MRVL_PP2_TXD_ALIGN;
- info->rx_offload_capa = DEV_RX_OFFLOAD_JUMBO_FRAME |
- DEV_RX_OFFLOAD_VLAN_FILTER |
- DEV_RX_OFFLOAD_IPV4_CKSUM |
- DEV_RX_OFFLOAD_UDP_CKSUM |
- DEV_RX_OFFLOAD_TCP_CKSUM;
+ info->rx_offload_capa = MRVL_RX_OFFLOADS;
+ info->rx_queue_offload_capa = MRVL_RX_OFFLOADS;
info->tx_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM |
DEV_TX_OFFLOAD_UDP_CKSUM |
@@ -1140,6 +1144,7 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
/* By default packets are dropped if no descriptors are available */
info->default_rxconf.rx_drop_en = 1;
+ info->default_rxconf.offloads = DEV_RX_OFFLOAD_CRC_STRIP;
info->max_rx_pktlen = MRVL_PKT_SIZE_MAX;
}
@@ -1308,6 +1313,42 @@ mrvl_fill_bpool(struct mrvl_rxq *rxq, int num)
}
/**
+ * Check whether requested rx queue offloads match port offloads.
+ *
+ * @param
+ * dev Pointer to the device.
+ * @param
+ * requested Bitmap of the requested offloads.
+ *
+ * @return
+ * 1 if requested offloads are okay, 0 otherwise.
+ */
+static int
+mrvl_rx_queue_offloads_okay(struct rte_eth_dev *dev, uint64_t requested)
+{
+ uint64_t mandatory = dev->data->dev_conf.rxmode.offloads;
+ uint64_t supported = MRVL_RX_OFFLOADS;
+ uint64_t unsupported = requested & ~supported;
+ uint64_t missing = (requested & mandatory) ^ mandatory;
+
+ if (unsupported) {
+ RTE_LOG(ERR, PMD, "Some Rx offloads are not supported. "
+ "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+ requested, supported);
+ return 0;
+ }
+
+ if (missing) {
+ RTE_LOG(ERR, PMD, "Some Rx offloads are missing. "
+ "Requested 0x%" PRIx64 " missing 0x%" PRIx64 ".\n",
+ requested, missing);
+ return 0;
+ }
+
+ return 1;
+}
+
+/**
* DPDK callback to configure the receive queue.
*
* @param dev
@@ -1319,7 +1360,7 @@ mrvl_fill_bpool(struct mrvl_rxq *rxq, int num)
* @param socket
* NUMA socket on which memory must be allocated.
* @param conf
- * Thresholds parameters (unused_).
+ * Thresholds parameters.
* @param mp
* Memory pool for buffer allocations.
*
@@ -1329,7 +1370,7 @@ mrvl_fill_bpool(struct mrvl_rxq *rxq, int num)
static int
mrvl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
unsigned int socket,
- const struct rte_eth_rxconf *conf __rte_unused,
+ const struct rte_eth_rxconf *conf,
struct rte_mempool *mp)
{
struct mrvl_priv *priv = dev->data->dev_private;
@@ -1338,6 +1379,9 @@ mrvl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
max_rx_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
int ret, tc, inq;
+ if (!mrvl_rx_queue_offloads_okay(dev, conf->offloads))
+ return -ENOTSUP;
+
if (priv->rxq_map[idx].tc == MRVL_UNKNOWN_TC) {
/*
* Unknown TC mapping, mapping will not have a correct queue.
@@ -1369,7 +1413,8 @@ mrvl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
rxq->priv = priv;
rxq->mp = mp;
- rxq->cksum_enabled = dev->data->dev_conf.rxmode.hw_ip_checksum;
+ rxq->cksum_enabled =
+ dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_IPV4_CKSUM;
rxq->queue_id = idx;
rxq->port_id = dev->data->port_id;
mrvl_port_to_bpool_lookup[rxq->port_id] = priv->bpool;
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 2/2] net/mrvl: switch to the new Tx offload API
2018-01-22 12:04 [dpdk-dev] [PATCH 0/2] switch to the new Rx/Tx offloads API Tomasz Duszynski
2018-01-22 12:04 ` [dpdk-dev] [PATCH 1/2] net/mrvl: switch to the new Rx offload API Tomasz Duszynski
@ 2018-01-22 12:04 ` Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Tomasz Duszynski
2 siblings, 0 replies; 9+ messages in thread
From: Tomasz Duszynski @ 2018-01-22 12:04 UTC (permalink / raw)
To: dev; +Cc: mw, dima, nsamsono, Jianbo.liu, jck, Tomasz Duszynski
Since the old Tx offload API was depracated
update the driver to use the latest one.
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
drivers/net/mrvl/mrvl_ethdev.c | 52 ++++++++++++++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index 2e8c6cc..dec56f3 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -100,6 +100,10 @@
DEV_RX_OFFLOAD_CRC_STRIP | \
DEV_RX_OFFLOAD_CHECKSUM)
+/** Port Tx offloads capabilities */
+#define MRVL_TX_OFFLOADS (DEV_TX_OFFLOAD_IPV4_CKSUM | \
+ DEV_TX_OFFLOAD_UDP_CKSUM | \
+ DEV_TX_OFFLOAD_TCP_CKSUM)
static const char * const valid_args[] = {
MRVL_IFACE_NAME_ARG,
@@ -1134,9 +1138,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
info->rx_offload_capa = MRVL_RX_OFFLOADS;
info->rx_queue_offload_capa = MRVL_RX_OFFLOADS;
- info->tx_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM |
- DEV_TX_OFFLOAD_UDP_CKSUM |
- DEV_TX_OFFLOAD_TCP_CKSUM;
+ info->tx_offload_capa = MRVL_TX_OFFLOADS;
+ info->tx_queue_offload_capa = MRVL_TX_OFFLOADS;
info->flow_type_rss_offloads = ETH_RSS_IPV4 |
ETH_RSS_NONFRAG_IPV4_TCP |
@@ -1477,6 +1480,42 @@ mrvl_rx_queue_release(void *rxq)
}
/**
+ * Check whether requested tx queue offloads match port offloads.
+ *
+ * @param
+ * dev Pointer to the device.
+ * @param
+ * requested Bitmap of the requested offloads.
+ *
+ * @return
+ * 1 if requested offloads are okay, 0 otherwise.
+ */
+static int
+mrvl_tx_queue_offloads_okay(struct rte_eth_dev *dev, uint64_t requested)
+{
+ uint64_t mandatory = dev->data->dev_conf.txmode.offloads;
+ uint64_t supported = MRVL_TX_OFFLOADS;
+ uint64_t unsupported = requested & ~supported;
+ uint64_t missing = (requested & mandatory) ^ mandatory;
+
+ if (unsupported) {
+ RTE_LOG(ERR, PMD, "Some Rx offloads are not supported. "
+ "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+ requested, supported);
+ return 0;
+ }
+
+ if (missing) {
+ RTE_LOG(ERR, PMD, "Some Rx offloads are missing. "
+ "Requested 0x%" PRIx64 " missing 0x%" PRIx64 ".\n",
+ requested, missing);
+ return 0;
+ }
+
+ return 1;
+}
+
+/**
* DPDK callback to configure the transmit queue.
*
* @param dev
@@ -1488,7 +1527,7 @@ mrvl_rx_queue_release(void *rxq)
* @param socket
* NUMA socket on which memory must be allocated.
* @param conf
- * Thresholds parameters (unused).
+ * Thresholds parameters.
*
* @return
* 0 on success, negative error value otherwise.
@@ -1496,11 +1535,14 @@ mrvl_rx_queue_release(void *rxq)
static int
mrvl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
unsigned int socket,
- const struct rte_eth_txconf *conf __rte_unused)
+ const struct rte_eth_txconf *conf)
{
struct mrvl_priv *priv = dev->data->dev_private;
struct mrvl_txq *txq;
+ if (!mrvl_tx_queue_offloads_okay(dev, conf->offloads))
+ return -ENOTSUP;
+
if (dev->data->tx_queues[idx]) {
rte_free(dev->data->tx_queues[idx]);
dev->data->tx_queues[idx] = NULL;
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] net/mrvl: switch to the new Rx offload API
2018-01-22 12:04 ` [dpdk-dev] [PATCH 1/2] net/mrvl: switch to the new Rx offload API Tomasz Duszynski
@ 2018-01-22 17:53 ` Ferruh Yigit
2018-01-23 8:14 ` Tomasz Duszynski
0 siblings, 1 reply; 9+ messages in thread
From: Ferruh Yigit @ 2018-01-22 17:53 UTC (permalink / raw)
To: Tomasz Duszynski, dev; +Cc: mw, dima, nsamsono, Jianbo.liu, jck
On 1/22/2018 12:04 PM, Tomasz Duszynski wrote:
> Since the old Rx offload API is now depracated
> update the driver to use the latest one.
>
> Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
<...>
> @@ -1308,6 +1313,42 @@ mrvl_fill_bpool(struct mrvl_rxq *rxq, int num)
> }
>
> /**
> + * Check whether requested rx queue offloads match port offloads.
> + *
> + * @param
> + * dev Pointer to the device.
> + * @param
> + * requested Bitmap of the requested offloads.
> + *
> + * @return
> + * 1 if requested offloads are okay, 0 otherwise.
> + */
> +static int
> +mrvl_rx_queue_offloads_okay(struct rte_eth_dev *dev, uint64_t requested)
> +{
> + uint64_t mandatory = dev->data->dev_conf.rxmode.offloads;
> + uint64_t supported = MRVL_RX_OFFLOADS;
> + uint64_t unsupported = requested & ~supported;
> + uint64_t missing = (requested & mandatory) ^ mandatory;
Isn't this same as:
missing = mandatory & ~requested;
Since "unsupported" use same logic, it can be easier to understand this way.
Or just putting following comment may be useful enough:
"mandatory subset of requested subset of supported", assuming it is correct :)
<...>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] net/mrvl: switch to the new Rx offload API
2018-01-22 17:53 ` Ferruh Yigit
@ 2018-01-23 8:14 ` Tomasz Duszynski
0 siblings, 0 replies; 9+ messages in thread
From: Tomasz Duszynski @ 2018-01-23 8:14 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Tomasz Duszynski, dev, mw, dima, nsamsono, Jianbo.liu, jck
Hi Ferruh,
On Mon, Jan 22, 2018 at 05:53:45PM +0000, Ferruh Yigit wrote:
> On 1/22/2018 12:04 PM, Tomasz Duszynski wrote:
> > Since the old Rx offload API is now depracated
> > update the driver to use the latest one.
> >
> > Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
>
> <...>
>
> > @@ -1308,6 +1313,42 @@ mrvl_fill_bpool(struct mrvl_rxq *rxq, int num)
> > }
> >
> > /**
> > + * Check whether requested rx queue offloads match port offloads.
> > + *
> > + * @param
> > + * dev Pointer to the device.
> > + * @param
> > + * requested Bitmap of the requested offloads.
> > + *
> > + * @return
> > + * 1 if requested offloads are okay, 0 otherwise.
> > + */
> > +static int
> > +mrvl_rx_queue_offloads_okay(struct rte_eth_dev *dev, uint64_t requested)
> > +{
> > + uint64_t mandatory = dev->data->dev_conf.rxmode.offloads;
> > + uint64_t supported = MRVL_RX_OFFLOADS;
> > + uint64_t unsupported = requested & ~supported;
> > + uint64_t missing = (requested & mandatory) ^ mandatory;
>
> Isn't this same as:
> missing = mandatory & ~requested;
>
> Since "unsupported" use same logic, it can be easier to understand this way.
Fair enough. I'll prepare v2 then.
Thanks for catching this.
>
> Or just putting following comment may be useful enough:
> "mandatory subset of requested subset of supported", assuming it is correct :)
>
> <...>
--
- Tomasz Duszyński
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API
2018-01-22 12:04 [dpdk-dev] [PATCH 0/2] switch to the new Rx/Tx offloads API Tomasz Duszynski
2018-01-22 12:04 ` [dpdk-dev] [PATCH 1/2] net/mrvl: switch to the new Rx offload API Tomasz Duszynski
2018-01-22 12:04 ` [dpdk-dev] [PATCH 2/2] net/mrvl: switch to the new Tx " Tomasz Duszynski
@ 2018-01-23 8:46 ` Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 1/2] net/mrvl: switch to the new Rx offload API Tomasz Duszynski
` (2 more replies)
2 siblings, 3 replies; 9+ messages in thread
From: Tomasz Duszynski @ 2018-01-23 8:46 UTC (permalink / raw)
To: dev; +Cc: mw, dima, nsamsono, Jianbo.liu, jck, Tomasz Duszynski
This patch series replaces the old Rx/Tx offload API with the
new API.
v2:
* Follow the same logic for calculating both unsupported and missing flags.
Tomasz Duszynski (2):
net/mrvl: switch to the new Rx offload API
net/mrvl: switch to the new Tx offload API
drivers/net/mrvl/mrvl_ethdev.c | 125 ++++++++++++++++++++++++++++++++++-------
1 file changed, 106 insertions(+), 19 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] net/mrvl: switch to the new Rx offload API
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Tomasz Duszynski
@ 2018-01-23 8:46 ` Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 2/2] net/mrvl: switch to the new Tx " Tomasz Duszynski
2018-01-24 15:59 ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Ferruh Yigit
2 siblings, 0 replies; 9+ messages in thread
From: Tomasz Duszynski @ 2018-01-23 8:46 UTC (permalink / raw)
To: dev; +Cc: mw, dima, nsamsono, Jianbo.liu, jck, Tomasz Duszynski
Since the old Rx offload API is now depracated
update the driver to use the latest one.
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
drivers/net/mrvl/mrvl_ethdev.c | 73 ++++++++++++++++++++++++++++++++++--------
1 file changed, 59 insertions(+), 14 deletions(-)
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index 4294c56..c313bda 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -94,6 +94,13 @@
/* Memory size (in bytes) for MUSDK dma buffers */
#define MRVL_MUSDK_DMA_MEMSIZE 41943040
+/** Port Rx offload capabilities */
+#define MRVL_RX_OFFLOADS (DEV_RX_OFFLOAD_VLAN_FILTER | \
+ DEV_RX_OFFLOAD_JUMBO_FRAME | \
+ DEV_RX_OFFLOAD_CRC_STRIP | \
+ DEV_RX_OFFLOAD_CHECKSUM)
+
+
static const char * const valid_args[] = {
MRVL_IFACE_NAME_ARG,
MRVL_CFG_ARG,
@@ -302,13 +309,13 @@ mrvl_dev_configure(struct rte_eth_dev *dev)
return -EINVAL;
}
- if (!dev->data->dev_conf.rxmode.hw_strip_crc) {
+ if (!(dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
RTE_LOG(INFO, PMD,
"L2 CRC stripping is always enabled in hw\n");
- dev->data->dev_conf.rxmode.hw_strip_crc = 1;
+ dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
}
- if (dev->data->dev_conf.rxmode.hw_vlan_strip) {
+ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP) {
RTE_LOG(INFO, PMD, "VLAN stripping not supported\n");
return -EINVAL;
}
@@ -318,17 +325,17 @@ mrvl_dev_configure(struct rte_eth_dev *dev)
return -EINVAL;
}
- if (dev->data->dev_conf.rxmode.enable_scatter) {
+ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) {
RTE_LOG(INFO, PMD, "RX Scatter/Gather not supported\n");
return -EINVAL;
}
- if (dev->data->dev_conf.rxmode.enable_lro) {
+ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TCP_LRO) {
RTE_LOG(INFO, PMD, "LRO not supported\n");
return -EINVAL;
}
- if (dev->data->dev_conf.rxmode.jumbo_frame)
+ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)
dev->data->mtu = dev->data->dev_conf.rxmode.max_rx_pkt_len -
ETHER_HDR_LEN - ETHER_CRC_LEN;
@@ -1124,11 +1131,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
info->tx_desc_lim.nb_min = MRVL_PP2_TXD_MIN;
info->tx_desc_lim.nb_align = MRVL_PP2_TXD_ALIGN;
- info->rx_offload_capa = DEV_RX_OFFLOAD_JUMBO_FRAME |
- DEV_RX_OFFLOAD_VLAN_FILTER |
- DEV_RX_OFFLOAD_IPV4_CKSUM |
- DEV_RX_OFFLOAD_UDP_CKSUM |
- DEV_RX_OFFLOAD_TCP_CKSUM;
+ info->rx_offload_capa = MRVL_RX_OFFLOADS;
+ info->rx_queue_offload_capa = MRVL_RX_OFFLOADS;
info->tx_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM |
DEV_TX_OFFLOAD_UDP_CKSUM |
@@ -1140,6 +1144,7 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
/* By default packets are dropped if no descriptors are available */
info->default_rxconf.rx_drop_en = 1;
+ info->default_rxconf.offloads = DEV_RX_OFFLOAD_CRC_STRIP;
info->max_rx_pktlen = MRVL_PKT_SIZE_MAX;
}
@@ -1308,6 +1313,42 @@ mrvl_fill_bpool(struct mrvl_rxq *rxq, int num)
}
/**
+ * Check whether requested rx queue offloads match port offloads.
+ *
+ * @param
+ * dev Pointer to the device.
+ * @param
+ * requested Bitmap of the requested offloads.
+ *
+ * @return
+ * 1 if requested offloads are okay, 0 otherwise.
+ */
+static int
+mrvl_rx_queue_offloads_okay(struct rte_eth_dev *dev, uint64_t requested)
+{
+ uint64_t mandatory = dev->data->dev_conf.rxmode.offloads;
+ uint64_t supported = MRVL_RX_OFFLOADS;
+ uint64_t unsupported = requested & ~supported;
+ uint64_t missing = mandatory & ~requested;
+
+ if (unsupported) {
+ RTE_LOG(ERR, PMD, "Some Rx offloads are not supported. "
+ "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+ requested, supported);
+ return 0;
+ }
+
+ if (missing) {
+ RTE_LOG(ERR, PMD, "Some Rx offloads are missing. "
+ "Requested 0x%" PRIx64 " missing 0x%" PRIx64 ".\n",
+ requested, missing);
+ return 0;
+ }
+
+ return 1;
+}
+
+/**
* DPDK callback to configure the receive queue.
*
* @param dev
@@ -1319,7 +1360,7 @@ mrvl_fill_bpool(struct mrvl_rxq *rxq, int num)
* @param socket
* NUMA socket on which memory must be allocated.
* @param conf
- * Thresholds parameters (unused_).
+ * Thresholds parameters.
* @param mp
* Memory pool for buffer allocations.
*
@@ -1329,7 +1370,7 @@ mrvl_fill_bpool(struct mrvl_rxq *rxq, int num)
static int
mrvl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
unsigned int socket,
- const struct rte_eth_rxconf *conf __rte_unused,
+ const struct rte_eth_rxconf *conf,
struct rte_mempool *mp)
{
struct mrvl_priv *priv = dev->data->dev_private;
@@ -1338,6 +1379,9 @@ mrvl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
max_rx_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;
int ret, tc, inq;
+ if (!mrvl_rx_queue_offloads_okay(dev, conf->offloads))
+ return -ENOTSUP;
+
if (priv->rxq_map[idx].tc == MRVL_UNKNOWN_TC) {
/*
* Unknown TC mapping, mapping will not have a correct queue.
@@ -1369,7 +1413,8 @@ mrvl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
rxq->priv = priv;
rxq->mp = mp;
- rxq->cksum_enabled = dev->data->dev_conf.rxmode.hw_ip_checksum;
+ rxq->cksum_enabled =
+ dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_IPV4_CKSUM;
rxq->queue_id = idx;
rxq->port_id = dev->data->port_id;
mrvl_port_to_bpool_lookup[rxq->port_id] = priv->bpool;
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] net/mrvl: switch to the new Tx offload API
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 1/2] net/mrvl: switch to the new Rx offload API Tomasz Duszynski
@ 2018-01-23 8:46 ` Tomasz Duszynski
2018-01-24 15:59 ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Ferruh Yigit
2 siblings, 0 replies; 9+ messages in thread
From: Tomasz Duszynski @ 2018-01-23 8:46 UTC (permalink / raw)
To: dev; +Cc: mw, dima, nsamsono, Jianbo.liu, jck, Tomasz Duszynski
Since the old Tx offload API was depracated
update the driver to use the latest one.
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
drivers/net/mrvl/mrvl_ethdev.c | 52 ++++++++++++++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c
index c313bda..af8f215 100644
--- a/drivers/net/mrvl/mrvl_ethdev.c
+++ b/drivers/net/mrvl/mrvl_ethdev.c
@@ -100,6 +100,10 @@
DEV_RX_OFFLOAD_CRC_STRIP | \
DEV_RX_OFFLOAD_CHECKSUM)
+/** Port Tx offloads capabilities */
+#define MRVL_TX_OFFLOADS (DEV_TX_OFFLOAD_IPV4_CKSUM | \
+ DEV_TX_OFFLOAD_UDP_CKSUM | \
+ DEV_TX_OFFLOAD_TCP_CKSUM)
static const char * const valid_args[] = {
MRVL_IFACE_NAME_ARG,
@@ -1134,9 +1138,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
info->rx_offload_capa = MRVL_RX_OFFLOADS;
info->rx_queue_offload_capa = MRVL_RX_OFFLOADS;
- info->tx_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM |
- DEV_TX_OFFLOAD_UDP_CKSUM |
- DEV_TX_OFFLOAD_TCP_CKSUM;
+ info->tx_offload_capa = MRVL_TX_OFFLOADS;
+ info->tx_queue_offload_capa = MRVL_TX_OFFLOADS;
info->flow_type_rss_offloads = ETH_RSS_IPV4 |
ETH_RSS_NONFRAG_IPV4_TCP |
@@ -1477,6 +1480,42 @@ mrvl_rx_queue_release(void *rxq)
}
/**
+ * Check whether requested tx queue offloads match port offloads.
+ *
+ * @param
+ * dev Pointer to the device.
+ * @param
+ * requested Bitmap of the requested offloads.
+ *
+ * @return
+ * 1 if requested offloads are okay, 0 otherwise.
+ */
+static int
+mrvl_tx_queue_offloads_okay(struct rte_eth_dev *dev, uint64_t requested)
+{
+ uint64_t mandatory = dev->data->dev_conf.txmode.offloads;
+ uint64_t supported = MRVL_TX_OFFLOADS;
+ uint64_t unsupported = requested & ~supported;
+ uint64_t missing = mandatory & ~requested;
+
+ if (unsupported) {
+ RTE_LOG(ERR, PMD, "Some Rx offloads are not supported. "
+ "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+ requested, supported);
+ return 0;
+ }
+
+ if (missing) {
+ RTE_LOG(ERR, PMD, "Some Rx offloads are missing. "
+ "Requested 0x%" PRIx64 " missing 0x%" PRIx64 ".\n",
+ requested, missing);
+ return 0;
+ }
+
+ return 1;
+}
+
+/**
* DPDK callback to configure the transmit queue.
*
* @param dev
@@ -1488,7 +1527,7 @@ mrvl_rx_queue_release(void *rxq)
* @param socket
* NUMA socket on which memory must be allocated.
* @param conf
- * Thresholds parameters (unused).
+ * Thresholds parameters.
*
* @return
* 0 on success, negative error value otherwise.
@@ -1496,11 +1535,14 @@ mrvl_rx_queue_release(void *rxq)
static int
mrvl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
unsigned int socket,
- const struct rte_eth_txconf *conf __rte_unused)
+ const struct rte_eth_txconf *conf)
{
struct mrvl_priv *priv = dev->data->dev_private;
struct mrvl_txq *txq;
+ if (!mrvl_tx_queue_offloads_okay(dev, conf->offloads))
+ return -ENOTSUP;
+
if (dev->data->tx_queues[idx]) {
rte_free(dev->data->tx_queues[idx]);
dev->data->tx_queues[idx] = NULL;
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 1/2] net/mrvl: switch to the new Rx offload API Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 2/2] net/mrvl: switch to the new Tx " Tomasz Duszynski
@ 2018-01-24 15:59 ` Ferruh Yigit
2 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2018-01-24 15:59 UTC (permalink / raw)
To: Tomasz Duszynski, dev; +Cc: mw, dima, nsamsono, Jianbo.liu, jck
On 1/23/2018 8:46 AM, Tomasz Duszynski wrote:
> This patch series replaces the old Rx/Tx offload API with the
> new API.
>
> v2:
> * Follow the same logic for calculating both unsupported and missing flags.
>
> Tomasz Duszynski (2):
> net/mrvl: switch to the new Rx offload API
> net/mrvl: switch to the new Tx offload API
Series applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-01-24 15:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 12:04 [dpdk-dev] [PATCH 0/2] switch to the new Rx/Tx offloads API Tomasz Duszynski
2018-01-22 12:04 ` [dpdk-dev] [PATCH 1/2] net/mrvl: switch to the new Rx offload API Tomasz Duszynski
2018-01-22 17:53 ` Ferruh Yigit
2018-01-23 8:14 ` Tomasz Duszynski
2018-01-22 12:04 ` [dpdk-dev] [PATCH 2/2] net/mrvl: switch to the new Tx " Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 1/2] net/mrvl: switch to the new Rx offload API Tomasz Duszynski
2018-01-23 8:46 ` [dpdk-dev] [PATCH v2 2/2] net/mrvl: switch to the new Tx " Tomasz Duszynski
2018-01-24 15:59 ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Ferruh Yigit
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).