DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH] net/octeontx: use the new offload APIs
@ 2018-03-08 19:07 Pavan Nikhilesh
  2018-03-11 18:14 ` santosh
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Pavan Nikhilesh @ 2018-03-08 19:07 UTC (permalink / raw)
  To: jerin.jacob, santosh.shukla, ferruh.yigit; +Cc: dev, Pavan Nikhilesh

Use the new Rx/Tx offload APIs and remove the old style offloads.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---

 Checkpatch reports falsepositive for PRIx64

 drivers/net/octeontx/octeontx_ethdev.c | 82 ++++++++++++++++++++++++++--------
 drivers/net/octeontx/octeontx_ethdev.h |  3 ++
 2 files changed, 67 insertions(+), 18 deletions(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index b739c0b39..0448e3557 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -262,6 +262,8 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
 	struct rte_eth_rxmode *rxmode = &conf->rxmode;
 	struct rte_eth_txmode *txmode = &conf->txmode;
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+	uint64_t configured_offloads;
+	uint64_t unsupported_offloads;
 	int ret;

 	PMD_INIT_FUNC_TRACE();
@@ -283,34 +285,43 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}

-	if (!rxmode->hw_strip_crc) {
+	configured_offloads = rxmode->offloads;
+
+	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
 		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
-		rxmode->hw_strip_crc = 1;
+		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
 	}

-	if (rxmode->hw_ip_checksum) {
+	if (configured_offloads & DEV_RX_OFFLOAD_CHECKSUM) {
 		PMD_INIT_LOG(NOTICE, "rxcksum not supported");
-		rxmode->hw_ip_checksum = 0;
+		configured_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
 	}

-	if (rxmode->split_hdr_size) {
-		octeontx_log_err("rxmode does not support split header");
-		return -EINVAL;
-	}
+	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;

-	if (rxmode->hw_vlan_filter) {
-		octeontx_log_err("VLAN filter not supported");
-		return -EINVAL;
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_RX_OFFLOADS);
+		return -ENOTSUP;
 	}

-	if (rxmode->hw_vlan_extend) {
-		octeontx_log_err("VLAN extended not supported");
-		return -EINVAL;
+	configured_offloads = txmode->offloads;
+
+	if (!(configured_offloads & DEV_TX_OFFLOAD_MT_LOCKFREE)) {
+		PMD_INIT_LOG(NOTICE, "cant disable lockfree tx");
+		configured_offloads |= DEV_TX_OFFLOAD_MT_LOCKFREE;
 	}

-	if (rxmode->enable_lro) {
-		octeontx_log_err("LRO not supported");
-		return -EINVAL;
+	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
+
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_TX_OFFLOADS);
+		return -ENOTSUP;
 	}

 	if (conf->link_speeds & ETH_LINK_SPEED_FIXED) {
@@ -750,10 +761,11 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 	struct octeontx_txq *txq = NULL;
 	uint16_t dq_num;
 	int res = 0;
+	uint64_t configured_offloads;
+	uint64_t unsupported_offloads;

 	RTE_SET_USED(nb_desc);
 	RTE_SET_USED(socket_id);
-	RTE_SET_USED(tx_conf);

 	dq_num = (nic->port_id * PKO_VF_NUM_DQ) + qidx;

@@ -771,6 +783,17 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 		dev->data->tx_queues[qidx] = NULL;
 	}

+	configured_offloads = tx_conf->offloads;
+
+	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_TX_OFFLOADS);
+		return -ENOTSUP;
+	}
+
 	/* Allocating tx queue data structure */
 	txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct octeontx_txq),
 				 RTE_CACHE_LINE_SIZE, nic->node);
@@ -826,6 +849,8 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 	uint8_t gaura;
 	unsigned int ev_queues = (nic->ev_queues * nic->port_id) + qidx;
 	unsigned int ev_ports = (nic->ev_ports * nic->port_id) + qidx;
+	uint64_t configured_offloads;
+	uint64_t unsupported_offloads;

 	RTE_SET_USED(nb_desc);

@@ -848,6 +873,27 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,

 	port = nic->port_id;

+	configured_offloads = rx_conf->offloads;
+
+	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
+		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
+		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
+	}
+
+	if (configured_offloads & DEV_RX_OFFLOAD_CHECKSUM) {
+		PMD_INIT_LOG(NOTICE, "rxcksum not supported");
+		configured_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
+	}
+
+	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;
+
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_RX_OFFLOADS);
+		return -ENOTSUP;
+	}
 	/* Rx deferred start is not supported */
 	if (rx_conf->rx_deferred_start) {
 		octeontx_log_err("rx deferred start not supported");
diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
index 10e42e142..9d6c22b0d 100644
--- a/drivers/net/octeontx/octeontx_ethdev.h
+++ b/drivers/net/octeontx/octeontx_ethdev.h
@@ -28,6 +28,9 @@
 #define OCTEONTX_MAX_BGX_PORTS			4
 #define OCTEONTX_MAX_LMAC_PER_BGX		4

+#define OCTEONTX_RX_OFFLOADS			DEV_RX_OFFLOAD_CRC_STRIP
+#define OCTEONTX_TX_OFFLOADS			DEV_TX_OFFLOAD_MT_LOCKFREE
+
 static inline struct octeontx_nic *
 octeontx_pmd_priv(struct rte_eth_dev *dev)
 {
--
2.16.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs
  2018-03-08 19:07 [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs Pavan Nikhilesh
@ 2018-03-11 18:14 ` santosh
  2018-03-21 19:25 ` Ferruh Yigit
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: santosh @ 2018-03-11 18:14 UTC (permalink / raw)
  To: Pavan Nikhilesh, jerin.jacob, ferruh.yigit; +Cc: dev


On Friday 09 March 2018 12:37 AM, Pavan Nikhilesh wrote:
> Use the new Rx/Tx offload APIs and remove the old style offloads.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---

Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs
  2018-03-08 19:07 [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs Pavan Nikhilesh
  2018-03-11 18:14 ` santosh
@ 2018-03-21 19:25 ` Ferruh Yigit
  2018-03-22  6:26   ` Shahaf Shuler
  2018-03-26  7:30   ` Pavan Nikhilesh
  2018-03-26 11:02 ` [dpdk-dev] [PATCH v2] " Pavan Nikhilesh
  2018-04-05 13:23 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
  3 siblings, 2 replies; 9+ messages in thread
From: Ferruh Yigit @ 2018-03-21 19:25 UTC (permalink / raw)
  To: Pavan Nikhilesh, jerin.jacob, santosh.shukla; +Cc: dev, Shahaf Shuler

On 3/8/2018 7:07 PM, Pavan Nikhilesh wrote:
> Use the new Rx/Tx offload APIs and remove the old style offloads.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
> 
>  Checkpatch reports falsepositive for PRIx64
> 
>  drivers/net/octeontx/octeontx_ethdev.c | 82 ++++++++++++++++++++++++++--------
>  drivers/net/octeontx/octeontx_ethdev.h |  3 ++
>  2 files changed, 67 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
> index b739c0b39..0448e3557 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -262,6 +262,8 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
>  	struct rte_eth_rxmode *rxmode = &conf->rxmode;
>  	struct rte_eth_txmode *txmode = &conf->txmode;
>  	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
> +	uint64_t configured_offloads;
> +	uint64_t unsupported_offloads;
>  	int ret;
> 
>  	PMD_INIT_FUNC_TRACE();
> @@ -283,34 +285,43 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
>  		return -EINVAL;
>  	}
> 
> -	if (!rxmode->hw_strip_crc) {
> +	configured_offloads = rxmode->offloads;
> +
> +	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
>  		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
> -		rxmode->hw_strip_crc = 1;
> +		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
>  	}

Just as a heads up this will be changed in this release [1], CRC_STRIP will be
the default behavior without requiring a flag.

[1]
https://dpdk.org/ml/archives/dev/2018-March/093255.html

> 
> -	if (rxmode->hw_ip_checksum) {
> +	if (configured_offloads & DEV_RX_OFFLOAD_CHECKSUM) {
>  		PMD_INIT_LOG(NOTICE, "rxcksum not supported");
> -		rxmode->hw_ip_checksum = 0;
> +		configured_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
>  	}

No need to specific check for DEV_RX_OFFLOAD_CHECKSUM, if it is not announced as
supported below unsupported_offloads will cover it.

> 
> -	if (rxmode->split_hdr_size) {
> -		octeontx_log_err("rxmode does not support split header");
> -		return -EINVAL;
> -	}
> +	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;
> 
> -	if (rxmode->hw_vlan_filter) {
> -		octeontx_log_err("VLAN filter not supported");
> -		return -EINVAL;
> +	if (unsupported_offloads) {
> +		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
> +		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
> +		      unsupported_offloads, configured_offloads,
> +		      (uint64_t)OCTEONTX_RX_OFFLOADS);
> +		return -ENOTSUP;
>  	}
> 
> -	if (rxmode->hw_vlan_extend) {
> -		octeontx_log_err("VLAN extended not supported");
> -		return -EINVAL;
> +	configured_offloads = txmode->offloads;
> +
> +	if (!(configured_offloads & DEV_TX_OFFLOAD_MT_LOCKFREE)) {
> +		PMD_INIT_LOG(NOTICE, "cant disable lockfree tx");
> +		configured_offloads |= DEV_TX_OFFLOAD_MT_LOCKFREE;
>  	}
> 
> -	if (rxmode->enable_lro) {
> -		octeontx_log_err("LRO not supported");
> -		return -EINVAL;
> +	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
> +
> +	if (unsupported_offloads) {
> +		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
> +		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
> +		      unsupported_offloads, configured_offloads,
> +		      (uint64_t)OCTEONTX_TX_OFFLOADS);
> +		return -ENOTSUP;
>  	}
> 
>  	if (conf->link_speeds & ETH_LINK_SPEED_FIXED) {
> @@ -750,10 +761,11 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
>  	struct octeontx_txq *txq = NULL;
>  	uint16_t dq_num;
>  	int res = 0;
> +	uint64_t configured_offloads;
> +	uint64_t unsupported_offloads;
> 
>  	RTE_SET_USED(nb_desc);
>  	RTE_SET_USED(socket_id);
> -	RTE_SET_USED(tx_conf);
> 
>  	dq_num = (nic->port_id * PKO_VF_NUM_DQ) + qidx;
> 
> @@ -771,6 +783,17 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
>  		dev->data->tx_queues[qidx] = NULL;
>  	}
> 
> +	configured_offloads = tx_conf->offloads;
> +
> +	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
> +	if (unsupported_offloads) {
> +		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
> +		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
> +		      unsupported_offloads, configured_offloads,
> +		      (uint64_t)OCTEONTX_TX_OFFLOADS);
> +		return -ENOTSUP;
> +	}

There is a discussion about the requirement to have port offload in queue setup
or not, more details in [2], any comment is welcome.

[2]
https://dpdk.org/ml/archives/dev/2018-March/092978.html
history: https://dpdk.org/ml/archives/dev/2018-March/092862.html

> +
>  	/* Allocating tx queue data structure */
>  	txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct octeontx_txq),
>  				 RTE_CACHE_LINE_SIZE, nic->node);
> @@ -826,6 +849,8 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
>  	uint8_t gaura;
>  	unsigned int ev_queues = (nic->ev_queues * nic->port_id) + qidx;
>  	unsigned int ev_ports = (nic->ev_ports * nic->port_id) + qidx;
> +	uint64_t configured_offloads;
> +	uint64_t unsupported_offloads;
> 
>  	RTE_SET_USED(nb_desc);
> 
> @@ -848,6 +873,27 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
> 
>  	port = nic->port_id;
> 
> +	configured_offloads = rx_conf->offloads;
> +
> +	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
> +		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
> +		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
> +	}

Same as above.

> +
> +	if (configured_offloads & DEV_RX_OFFLOAD_CHECKSUM) {
> +		PMD_INIT_LOG(NOTICE, "rxcksum not supported");
> +		configured_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
> +	}

Not sure about changing the application configuration, and since this offload is
not reported as supported application should not set it, if it does this should
return an error.

> +
> +	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;
> +
> +	if (unsupported_offloads) {
> +		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
> +		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
> +		      unsupported_offloads, configured_offloads,
> +		      (uint64_t)OCTEONTX_RX_OFFLOADS);
> +		return -ENOTSUP;
> +	}
>  	/* Rx deferred start is not supported */
>  	if (rx_conf->rx_deferred_start) {
>  		octeontx_log_err("rx deferred start not supported");
> diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
> index 10e42e142..9d6c22b0d 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.h
> +++ b/drivers/net/octeontx/octeontx_ethdev.h
> @@ -28,6 +28,9 @@
>  #define OCTEONTX_MAX_BGX_PORTS			4
>  #define OCTEONTX_MAX_LMAC_PER_BGX		4
> 
> +#define OCTEONTX_RX_OFFLOADS			DEV_RX_OFFLOAD_CRC_STRIP
> +#define OCTEONTX_TX_OFFLOADS			DEV_TX_OFFLOAD_MT_LOCKFREE

These should be announced in dev_info as [rt]x_offload_capa, rx one seems missing.

> +
>  static inline struct octeontx_nic *
>  octeontx_pmd_priv(struct rte_eth_dev *dev)
>  {
> --
> 2.16.2
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs
  2018-03-21 19:25 ` Ferruh Yigit
@ 2018-03-22  6:26   ` Shahaf Shuler
  2018-03-26  7:30   ` Pavan Nikhilesh
  1 sibling, 0 replies; 9+ messages in thread
From: Shahaf Shuler @ 2018-03-22  6:26 UTC (permalink / raw)
  To: Ferruh Yigit, Pavan Nikhilesh, jerin.jacob, santosh.shukla; +Cc: dev

Wednesday, March 21, 2018 9:26 PM, Ferruh Yigit:
> Subject: Re: [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs
> 
> > +
> > +	if (configured_offloads & DEV_RX_OFFLOAD_CHECKSUM) {
> > +		PMD_INIT_LOG(NOTICE, "rxcksum not supported");
> > +		configured_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
> > +	}
> 
> Not sure about changing the application configuration, and since this offload
> is not reported as supported application should not set it, if it does this
> should return an error.

Yes, any wrong offload configuration should fail the port/queue configuration with the proper error logging. 
PMDs should not silently adopt to wrong configuration. This might lead the application to believe Rx checksum offload was enabled. 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs
  2018-03-21 19:25 ` Ferruh Yigit
  2018-03-22  6:26   ` Shahaf Shuler
@ 2018-03-26  7:30   ` Pavan Nikhilesh
  1 sibling, 0 replies; 9+ messages in thread
From: Pavan Nikhilesh @ 2018-03-26  7:30 UTC (permalink / raw)
  To: Ferruh Yigit, Shahaf Shuler, jerin.jacob, santosh.shukla; +Cc: dev

Hi Ferruh,

On Wed, Mar 21, 2018 at 07:25:57PM +0000, Ferruh Yigit wrote:
> On 3/8/2018 7:07 PM, Pavan Nikhilesh wrote:
> > Use the new Rx/Tx offload APIs and remove the old style offloads.
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > ---
> >
> >  Checkpatch reports falsepositive for PRIx64
> >
> >  drivers/net/octeontx/octeontx_ethdev.c | 82 ++++++++++++++++++++++++++--------
> >  drivers/net/octeontx/octeontx_ethdev.h |  3 ++
> >  2 files changed, 67 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
> > index b739c0b39..0448e3557 100644
> > --- a/drivers/net/octeontx/octeontx_ethdev.c
> > +++ b/drivers/net/octeontx/octeontx_ethdev.c
> > @@ -262,6 +262,8 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
> >  	struct rte_eth_rxmode *rxmode = &conf->rxmode;
> >  	struct rte_eth_txmode *txmode = &conf->txmode;
> >  	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
> > +	uint64_t configured_offloads;
> > +	uint64_t unsupported_offloads;
> >  	int ret;
> >
> >  	PMD_INIT_FUNC_TRACE();
> > @@ -283,34 +285,43 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
> >  		return -EINVAL;
> >  	}
> >
> > -	if (!rxmode->hw_strip_crc) {
> > +	configured_offloads = rxmode->offloads;
> > +
> > +	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
> >  		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
> > -		rxmode->hw_strip_crc = 1;
> > +		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
> >  	}
>
> Just as a heads up this will be changed in this release [1], CRC_STRIP will be
> the default behavior without requiring a flag.

Thanks for the heads up, will remove the flag.

>
> [1]
> https://dpdk.org/ml/archives/dev/2018-March/093255.html
>
> >
> > -	if (rxmode->hw_ip_checksum) {
> > +	if (configured_offloads & DEV_RX_OFFLOAD_CHECKSUM) {
> >  		PMD_INIT_LOG(NOTICE, "rxcksum not supported");
> > -		rxmode->hw_ip_checksum = 0;
> > +		configured_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
> >  	}
>
> No need to specific check for DEV_RX_OFFLOAD_CHECKSUM, if it is not announced as
> supported below unsupported_offloads will cover it.
>
> >
> > -	if (rxmode->split_hdr_size) {
> > -		octeontx_log_err("rxmode does not support split header");
> > -		return -EINVAL;
> > -	}
> > +	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;
> >
> > -	if (rxmode->hw_vlan_filter) {
> > -		octeontx_log_err("VLAN filter not supported");
> > -		return -EINVAL;
> > +	if (unsupported_offloads) {
> > +		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
> > +		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
> > +		      unsupported_offloads, configured_offloads,
> > +		      (uint64_t)OCTEONTX_RX_OFFLOADS);
> > +		return -ENOTSUP;
> >  	}
> >
> > -	if (rxmode->hw_vlan_extend) {
> > -		octeontx_log_err("VLAN extended not supported");
> > -		return -EINVAL;
> > +	configured_offloads = txmode->offloads;
> > +
> > +	if (!(configured_offloads & DEV_TX_OFFLOAD_MT_LOCKFREE)) {
> > +		PMD_INIT_LOG(NOTICE, "cant disable lockfree tx");
> > +		configured_offloads |= DEV_TX_OFFLOAD_MT_LOCKFREE;
> >  	}
> >
> > -	if (rxmode->enable_lro) {
> > -		octeontx_log_err("LRO not supported");
> > -		return -EINVAL;
> > +	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
> > +
> > +	if (unsupported_offloads) {
> > +		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
> > +		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
> > +		      unsupported_offloads, configured_offloads,
> > +		      (uint64_t)OCTEONTX_TX_OFFLOADS);
> > +		return -ENOTSUP;
> >  	}
> >
> >  	if (conf->link_speeds & ETH_LINK_SPEED_FIXED) {
> > @@ -750,10 +761,11 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
> >  	struct octeontx_txq *txq = NULL;
> >  	uint16_t dq_num;
> >  	int res = 0;
> > +	uint64_t configured_offloads;
> > +	uint64_t unsupported_offloads;
> >
> >  	RTE_SET_USED(nb_desc);
> >  	RTE_SET_USED(socket_id);
> > -	RTE_SET_USED(tx_conf);
> >
> >  	dq_num = (nic->port_id * PKO_VF_NUM_DQ) + qidx;
> >
> > @@ -771,6 +783,17 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
> >  		dev->data->tx_queues[qidx] = NULL;
> >  	}
> >
> > +	configured_offloads = tx_conf->offloads;
> > +
> > +	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
> > +	if (unsupported_offloads) {
> > +		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
> > +		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
> > +		      unsupported_offloads, configured_offloads,
> > +		      (uint64_t)OCTEONTX_TX_OFFLOADS);
> > +		return -ENOTSUP;
> > +	}
>
> There is a discussion about the requirement to have port offload in queue setup
> or not, more details in [2], any comment is welcome.
>
> [2]
> https://dpdk.org/ml/archives/dev/2018-March/092978.html
> history: https://dpdk.org/ml/archives/dev/2018-March/092862.html
>
> > +
> >  	/* Allocating tx queue data structure */
> >  	txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct octeontx_txq),
> >  				 RTE_CACHE_LINE_SIZE, nic->node);
> > @@ -826,6 +849,8 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
> >  	uint8_t gaura;
> >  	unsigned int ev_queues = (nic->ev_queues * nic->port_id) + qidx;
> >  	unsigned int ev_ports = (nic->ev_ports * nic->port_id) + qidx;
> > +	uint64_t configured_offloads;
> > +	uint64_t unsupported_offloads;
> >
> >  	RTE_SET_USED(nb_desc);
> >
> > @@ -848,6 +873,27 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
> >
> >  	port = nic->port_id;
> >
> > +	configured_offloads = rx_conf->offloads;
> > +
> > +	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
> > +		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
> > +		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
> > +	}
>
> Same as above.
>
> > +
> > +	if (configured_offloads & DEV_RX_OFFLOAD_CHECKSUM) {
> > +		PMD_INIT_LOG(NOTICE, "rxcksum not supported");
> > +		configured_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
> > +	}
>
> Not sure about changing the application configuration, and since this offload is
> not reported as supported application should not set it, if it does this should
> return an error.

Will fix it in v2.

>
> > +
> > +	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;
> > +
> > +	if (unsupported_offloads) {
> > +		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
> > +		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
> > +		      unsupported_offloads, configured_offloads,
> > +		      (uint64_t)OCTEONTX_RX_OFFLOADS);
> > +		return -ENOTSUP;
> > +	}
> >  	/* Rx deferred start is not supported */
> >  	if (rx_conf->rx_deferred_start) {
> >  		octeontx_log_err("rx deferred start not supported");
> > diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
> > index 10e42e142..9d6c22b0d 100644
> > --- a/drivers/net/octeontx/octeontx_ethdev.h
> > +++ b/drivers/net/octeontx/octeontx_ethdev.h
> > @@ -28,6 +28,9 @@
> >  #define OCTEONTX_MAX_BGX_PORTS			4
> >  #define OCTEONTX_MAX_LMAC_PER_BGX		4
> >
> > +#define OCTEONTX_RX_OFFLOADS			DEV_RX_OFFLOAD_CRC_STRIP
> > +#define OCTEONTX_TX_OFFLOADS			DEV_TX_OFFLOAD_MT_LOCKFREE
>
> These should be announced in dev_info as [rt]x_offload_capa, rx one seems missing.

If CRC strip is removed (implicit) then I think RX offload can be removed.

>
> > +
> >  static inline struct octeontx_nic *
> >  octeontx_pmd_priv(struct rte_eth_dev *dev)
> >  {
> > --
> > 2.16.2
> >
>

Thanks,
Pavan.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev]  [PATCH v2] net/octeontx: use the new offload APIs
  2018-03-08 19:07 [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs Pavan Nikhilesh
  2018-03-11 18:14 ` santosh
  2018-03-21 19:25 ` Ferruh Yigit
@ 2018-03-26 11:02 ` Pavan Nikhilesh
  2018-04-05 13:13   ` Ferruh Yigit
  2018-04-05 13:23 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
  3 siblings, 1 reply; 9+ messages in thread
From: Pavan Nikhilesh @ 2018-03-26 11:02 UTC (permalink / raw)
  To: jerin.jacob, santosh.shukla, ferruh.yigit, shahafs; +Cc: dev, Pavan Nikhilesh

Use the new Rx/Tx offload APIs and remove the old style offloads.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---
 drivers/net/octeontx/octeontx_ethdev.c | 82 +++++++++++++++++++++++++---------
 drivers/net/octeontx/octeontx_ethdev.h |  3 ++
 2 files changed, 65 insertions(+), 20 deletions(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index b739c0b39..3eb765eb1 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -262,6 +262,8 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
 	struct rte_eth_rxmode *rxmode = &conf->rxmode;
 	struct rte_eth_txmode *txmode = &conf->txmode;
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+	uint64_t configured_offloads;
+	uint64_t unsupported_offloads;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
@@ -283,34 +285,38 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}
 
-	if (!rxmode->hw_strip_crc) {
+	configured_offloads = rxmode->offloads;
+
+	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
 		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
-		rxmode->hw_strip_crc = 1;
+		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
 	}
 
-	if (rxmode->hw_ip_checksum) {
-		PMD_INIT_LOG(NOTICE, "rxcksum not supported");
-		rxmode->hw_ip_checksum = 0;
-	}
+	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;
 
-	if (rxmode->split_hdr_size) {
-		octeontx_log_err("rxmode does not support split header");
-		return -EINVAL;
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_RX_OFFLOADS);
+		return -ENOTSUP;
 	}
 
-	if (rxmode->hw_vlan_filter) {
-		octeontx_log_err("VLAN filter not supported");
-		return -EINVAL;
-	}
+	configured_offloads = txmode->offloads;
 
-	if (rxmode->hw_vlan_extend) {
-		octeontx_log_err("VLAN extended not supported");
-		return -EINVAL;
+	if (!(configured_offloads & DEV_TX_OFFLOAD_MT_LOCKFREE)) {
+		PMD_INIT_LOG(NOTICE, "cant disable lockfree tx");
+		configured_offloads |= DEV_TX_OFFLOAD_MT_LOCKFREE;
 	}
 
-	if (rxmode->enable_lro) {
-		octeontx_log_err("LRO not supported");
-		return -EINVAL;
+	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
+
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_TX_OFFLOADS);
+		return -ENOTSUP;
 	}
 
 	if (conf->link_speeds & ETH_LINK_SPEED_FIXED) {
@@ -630,6 +636,7 @@ octeontx_dev_info(struct rte_eth_dev *dev,
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
 		.rx_free_thresh = 0,
 		.rx_drop_en = 0,
+		.offloads = OCTEONTX_RX_OFFLOADS,
 	};
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -750,10 +757,11 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 	struct octeontx_txq *txq = NULL;
 	uint16_t dq_num;
 	int res = 0;
+	uint64_t configured_offloads;
+	uint64_t unsupported_offloads;
 
 	RTE_SET_USED(nb_desc);
 	RTE_SET_USED(socket_id);
-	RTE_SET_USED(tx_conf);
 
 	dq_num = (nic->port_id * PKO_VF_NUM_DQ) + qidx;
 
@@ -771,6 +779,22 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 		dev->data->tx_queues[qidx] = NULL;
 	}
 
+	configured_offloads = tx_conf->offloads;
+
+	if (!(configured_offloads & DEV_TX_OFFLOAD_MT_LOCKFREE)) {
+		PMD_INIT_LOG(NOTICE, "cant disable lockfree tx");
+		configured_offloads |= DEV_TX_OFFLOAD_MT_LOCKFREE;
+	}
+
+	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_TX_OFFLOADS);
+		return -ENOTSUP;
+	}
+
 	/* Allocating tx queue data structure */
 	txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct octeontx_txq),
 				 RTE_CACHE_LINE_SIZE, nic->node);
@@ -826,6 +850,8 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 	uint8_t gaura;
 	unsigned int ev_queues = (nic->ev_queues * nic->port_id) + qidx;
 	unsigned int ev_ports = (nic->ev_ports * nic->port_id) + qidx;
+	uint64_t configured_offloads;
+	uint64_t unsupported_offloads;
 
 	RTE_SET_USED(nb_desc);
 
@@ -848,6 +874,22 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 
 	port = nic->port_id;
 
+	configured_offloads = rx_conf->offloads;
+
+	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
+		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
+		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
+	}
+
+	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;
+
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_RX_OFFLOADS);
+		return -ENOTSUP;
+	}
 	/* Rx deferred start is not supported */
 	if (rx_conf->rx_deferred_start) {
 		octeontx_log_err("rx deferred start not supported");
diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
index 10e42e142..9d6c22b0d 100644
--- a/drivers/net/octeontx/octeontx_ethdev.h
+++ b/drivers/net/octeontx/octeontx_ethdev.h
@@ -28,6 +28,9 @@
 #define OCTEONTX_MAX_BGX_PORTS			4
 #define OCTEONTX_MAX_LMAC_PER_BGX		4
 
+#define OCTEONTX_RX_OFFLOADS			DEV_RX_OFFLOAD_CRC_STRIP
+#define OCTEONTX_TX_OFFLOADS			DEV_TX_OFFLOAD_MT_LOCKFREE
+
 static inline struct octeontx_nic *
 octeontx_pmd_priv(struct rte_eth_dev *dev)
 {
-- 
2.16.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/octeontx: use the new offload APIs
  2018-03-26 11:02 ` [dpdk-dev] [PATCH v2] " Pavan Nikhilesh
@ 2018-04-05 13:13   ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2018-04-05 13:13 UTC (permalink / raw)
  To: Pavan Nikhilesh, jerin.jacob, santosh.shukla, shahafs; +Cc: dev

On 3/26/2018 12:02 PM, Pavan Nikhilesh wrote:
> Use the new Rx/Tx offload APIs and remove the old style offloads.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

<...>

> @@ -630,6 +636,7 @@ octeontx_dev_info(struct rte_eth_dev *dev,
>  	dev_info->default_rxconf = (struct rte_eth_rxconf) {
>  		.rx_free_thresh = 0,
>  		.rx_drop_en = 0,
> +		.offloads = OCTEONTX_RX_OFFLOADS,
>  	};

OCTEONTX_RX_OFFLOADS need to be reported in "rx_offload_capa", currently
"rx_offload_capa" is zero, technically applications are not allowed to set any
Rx offloads.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev]  [PATCH v3] net/octeontx: use the new offload APIs
  2018-03-08 19:07 [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs Pavan Nikhilesh
                   ` (2 preceding siblings ...)
  2018-03-26 11:02 ` [dpdk-dev] [PATCH v2] " Pavan Nikhilesh
@ 2018-04-05 13:23 ` Pavan Nikhilesh
  2018-04-05 13:50   ` Ferruh Yigit
  3 siblings, 1 reply; 9+ messages in thread
From: Pavan Nikhilesh @ 2018-04-05 13:23 UTC (permalink / raw)
  To: jerin.jacob, santosh.shukla, ferruh.yigit, shahafs; +Cc: dev, Pavan Nikhilesh

Use the new Rx/Tx offload APIs and remove the old style offloads.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
---

 v3 Changes:
 - update dev_info rx_offload_capa to include OCTEONTX_RX_OFFLOADS.

 drivers/net/octeontx/octeontx_ethdev.c | 85 +++++++++++++++++++++++++---------
 drivers/net/octeontx/octeontx_ethdev.h |  3 ++
 2 files changed, 67 insertions(+), 21 deletions(-)

diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 90dd249a6..4d7d1d7f4 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -262,6 +262,8 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
 	struct rte_eth_rxmode *rxmode = &conf->rxmode;
 	struct rte_eth_txmode *txmode = &conf->txmode;
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+	uint64_t configured_offloads;
+	uint64_t unsupported_offloads;
 	int ret;

 	PMD_INIT_FUNC_TRACE();
@@ -283,34 +285,38 @@ octeontx_dev_configure(struct rte_eth_dev *dev)
 		return -EINVAL;
 	}

-	if (!rxmode->hw_strip_crc) {
+	configured_offloads = rxmode->offloads;
+
+	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
 		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
-		rxmode->hw_strip_crc = 1;
+		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
 	}

-	if (rxmode->hw_ip_checksum) {
-		PMD_INIT_LOG(NOTICE, "rxcksum not supported");
-		rxmode->hw_ip_checksum = 0;
-	}
+	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;

-	if (rxmode->split_hdr_size) {
-		octeontx_log_err("rxmode does not support split header");
-		return -EINVAL;
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_RX_OFFLOADS);
+		return -ENOTSUP;
 	}

-	if (rxmode->hw_vlan_filter) {
-		octeontx_log_err("VLAN filter not supported");
-		return -EINVAL;
-	}
+	configured_offloads = txmode->offloads;

-	if (rxmode->hw_vlan_extend) {
-		octeontx_log_err("VLAN extended not supported");
-		return -EINVAL;
+	if (!(configured_offloads & DEV_TX_OFFLOAD_MT_LOCKFREE)) {
+		PMD_INIT_LOG(NOTICE, "cant disable lockfree tx");
+		configured_offloads |= DEV_TX_OFFLOAD_MT_LOCKFREE;
 	}

-	if (rxmode->enable_lro) {
-		octeontx_log_err("LRO not supported");
-		return -EINVAL;
+	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
+
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_TX_OFFLOADS);
+		return -ENOTSUP;
 	}

 	if (conf->link_speeds & ETH_LINK_SPEED_FIXED) {
@@ -616,6 +622,7 @@ octeontx_dev_info(struct rte_eth_dev *dev,
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
 		.rx_free_thresh = 0,
 		.rx_drop_en = 0,
+		.offloads = OCTEONTX_RX_OFFLOADS,
 	};

 	dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -626,7 +633,8 @@ octeontx_dev_info(struct rte_eth_dev *dev,
 			ETH_TXQ_FLAGS_NOXSUMS,
 	};

-	dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MT_LOCKFREE;
+	dev_info->rx_offload_capa = OCTEONTX_RX_OFFLOADS;
+	dev_info->tx_offload_capa = OCTEONTX_TX_OFFLOADS;
 }

 static void
@@ -736,10 +744,11 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 	struct octeontx_txq *txq = NULL;
 	uint16_t dq_num;
 	int res = 0;
+	uint64_t configured_offloads;
+	uint64_t unsupported_offloads;

 	RTE_SET_USED(nb_desc);
 	RTE_SET_USED(socket_id);
-	RTE_SET_USED(tx_conf);

 	dq_num = (nic->port_id * PKO_VF_NUM_DQ) + qidx;

@@ -757,6 +766,22 @@ octeontx_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 		dev->data->tx_queues[qidx] = NULL;
 	}

+	configured_offloads = tx_conf->offloads;
+
+	if (!(configured_offloads & DEV_TX_OFFLOAD_MT_LOCKFREE)) {
+		PMD_INIT_LOG(NOTICE, "cant disable lockfree tx");
+		configured_offloads |= DEV_TX_OFFLOAD_MT_LOCKFREE;
+	}
+
+	unsupported_offloads = configured_offloads & ~OCTEONTX_TX_OFFLOADS;
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Tx offloads 0x%" PRIx64 " are not supported."
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 ".\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_TX_OFFLOADS);
+		return -ENOTSUP;
+	}
+
 	/* Allocating tx queue data structure */
 	txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct octeontx_txq),
 				 RTE_CACHE_LINE_SIZE, nic->node);
@@ -812,6 +837,8 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,
 	uint8_t gaura;
 	unsigned int ev_queues = (nic->ev_queues * nic->port_id) + qidx;
 	unsigned int ev_ports = (nic->ev_ports * nic->port_id) + qidx;
+	uint64_t configured_offloads;
+	uint64_t unsupported_offloads;

 	RTE_SET_USED(nb_desc);

@@ -834,6 +861,22 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx,

 	port = nic->port_id;

+	configured_offloads = rx_conf->offloads;
+
+	if (!(configured_offloads & DEV_RX_OFFLOAD_CRC_STRIP)) {
+		PMD_INIT_LOG(NOTICE, "can't disable hw crc strip");
+		configured_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
+	}
+
+	unsupported_offloads = configured_offloads & ~OCTEONTX_RX_OFFLOADS;
+
+	if (unsupported_offloads) {
+		PMD_INIT_LOG(ERR, "Rx offloads 0x%" PRIx64 " are not supported. "
+		      "Requested 0x%" PRIx64 " supported 0x%" PRIx64 "\n",
+		      unsupported_offloads, configured_offloads,
+		      (uint64_t)OCTEONTX_RX_OFFLOADS);
+		return -ENOTSUP;
+	}
 	/* Rx deferred start is not supported */
 	if (rx_conf->rx_deferred_start) {
 		octeontx_log_err("rx deferred start not supported");
diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h
index 10e42e142..9d6c22b0d 100644
--- a/drivers/net/octeontx/octeontx_ethdev.h
+++ b/drivers/net/octeontx/octeontx_ethdev.h
@@ -28,6 +28,9 @@
 #define OCTEONTX_MAX_BGX_PORTS			4
 #define OCTEONTX_MAX_LMAC_PER_BGX		4

+#define OCTEONTX_RX_OFFLOADS			DEV_RX_OFFLOAD_CRC_STRIP
+#define OCTEONTX_TX_OFFLOADS			DEV_TX_OFFLOAD_MT_LOCKFREE
+
 static inline struct octeontx_nic *
 octeontx_pmd_priv(struct rte_eth_dev *dev)
 {
--
2.16.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v3] net/octeontx: use the new offload APIs
  2018-04-05 13:23 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
@ 2018-04-05 13:50   ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2018-04-05 13:50 UTC (permalink / raw)
  To: Pavan Nikhilesh, jerin.jacob, santosh.shukla, shahafs; +Cc: dev

On 4/5/2018 2:23 PM, Pavan Nikhilesh wrote:
> Use the new Rx/Tx offload APIs and remove the old style offloads.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-04-05 13:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-08 19:07 [dpdk-dev] [PATCH] net/octeontx: use the new offload APIs Pavan Nikhilesh
2018-03-11 18:14 ` santosh
2018-03-21 19:25 ` Ferruh Yigit
2018-03-22  6:26   ` Shahaf Shuler
2018-03-26  7:30   ` Pavan Nikhilesh
2018-03-26 11:02 ` [dpdk-dev] [PATCH v2] " Pavan Nikhilesh
2018-04-05 13:13   ` Ferruh Yigit
2018-04-05 13:23 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
2018-04-05 13:50   ` 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).