DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tomasz Duszynski <tdu@semihalf.com>
To: dev@dpdk.org
Cc: mw@semihalf.com, dima@marvell.com, nsamsono@marvell.com,
	Jianbo.liu@arm.com, jck@semihalf.com,
	Tomasz Duszynski <tdu@semihalf.com>
Subject: [dpdk-dev] [PATCH v2 2/2] net/mrvl: switch to the new Tx offload API
Date: Tue, 23 Jan 2018 09:46:15 +0100	[thread overview]
Message-ID: <1516697175-31235-3-git-send-email-tdu@semihalf.com> (raw)
In-Reply-To: <1516697175-31235-1-git-send-email-tdu@semihalf.com>

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

  parent reply	other threads:[~2018-01-23  8:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Tomasz Duszynski [this message]
2018-01-24 15:59   ` [dpdk-dev] [PATCH v2 0/2] net/mrvl: switch to the new Rx/Tx offloads API Ferruh Yigit

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=1516697175-31235-3-git-send-email-tdu@semihalf.com \
    --to=tdu@semihalf.com \
    --cc=Jianbo.liu@arm.com \
    --cc=dev@dpdk.org \
    --cc=dima@marvell.com \
    --cc=jck@semihalf.com \
    --cc=mw@semihalf.com \
    --cc=nsamsono@marvell.com \
    /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).