DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/tap: return empty port offload capabilities
@ 2018-04-25 16:15 Ophir Munk
  2018-04-25 16:31 ` Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ophir Munk @ 2018-04-25 16:15 UTC (permalink / raw)
  To: dev, Pascal Mazon
  Cc: Thomas Monjalon, Olga Shern, Ferruh Yigit, Ophir Munk, stable

Fix report on port offload capabilities to be 0 (no capabilities).
Before this commit port capabilities were a clone of queue
capabilities, however the current TAP offload capabilities (e.g.
checksum calculation) are per queue and are not specific per port.

Fixes: 95ae196ae10b ("net/tap: use new Rx offloads API")
Fixes: 818fe14a9891 ("net/tap: use new Tx offloads API")
Cc: stable@dpdk.org

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
 drivers/net/tap/rte_eth_tap.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index fe62ab3..aea73b1 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -269,14 +269,9 @@ static uint64_t
 tap_rx_offload_get_port_capa(void)
 {
 	/*
-	 * In order to support legacy apps,
-	 * report capabilities also as port capabilities.
+	 * No specific port Rx offload capabilities.
 	 */
-	return DEV_RX_OFFLOAD_SCATTER |
-	       DEV_RX_OFFLOAD_IPV4_CKSUM |
-	       DEV_RX_OFFLOAD_UDP_CKSUM |
-	       DEV_RX_OFFLOAD_TCP_CKSUM |
-	       DEV_RX_OFFLOAD_CRC_STRIP;
+	return 0;
 }
 
 static uint64_t
@@ -403,14 +398,9 @@ static uint64_t
 tap_tx_offload_get_port_capa(void)
 {
 	/*
-	 * In order to support legacy apps,
-	 * report capabilities also as port capabilities.
+	 * No specific port Tx offload capabilities.
 	 */
-	return DEV_TX_OFFLOAD_MULTI_SEGS |
-	       DEV_TX_OFFLOAD_IPV4_CKSUM |
-	       DEV_TX_OFFLOAD_UDP_CKSUM |
-	       DEV_TX_OFFLOAD_TCP_CKSUM |
-	       DEV_TX_OFFLOAD_TCP_TSO;
+	return 0;
 }
 
 static uint64_t
@@ -787,7 +777,8 @@ tap_dev_stop(struct rte_eth_dev *dev)
 static int
 tap_dev_configure(struct rte_eth_dev *dev)
 {
-	uint64_t supp_tx_offloads = tap_tx_offload_get_port_capa();
+	uint64_t supp_tx_offloads = tap_tx_offload_get_port_capa() |
+				tap_tx_offload_get_queue_capa();
 	uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads;
 
 	if ((tx_offloads & supp_tx_offloads) != tx_offloads) {
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v1] net/tap: return empty port offload capabilities
  2018-04-25 16:15 [dpdk-dev] [PATCH v1] net/tap: return empty port offload capabilities Ophir Munk
@ 2018-04-25 16:31 ` Ferruh Yigit
  2018-04-26 11:09   ` Ophir Munk
  2018-04-25 16:47 ` Thomas Monjalon
  2018-04-26 11:13 ` [dpdk-dev] [PATCH v2] " Ophir Munk
  2 siblings, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2018-04-25 16:31 UTC (permalink / raw)
  To: Ophir Munk, dev, Pascal Mazon; +Cc: Thomas Monjalon, Olga Shern, stable

On 4/25/2018 5:15 PM, Ophir Munk wrote:
> Fix report on port offload capabilities to be 0 (no capabilities).
> Before this commit port capabilities were a clone of queue
> capabilities, however the current TAP offload capabilities (e.g.
> checksum calculation) are per queue and are not specific per port.

Overall looks good to me, thanks.

Is error log in tap_tx_queue_setup() still valid:
  RTE_LOG(ERR, PMD,
          "%p: Tx queue offloads 0x%" PRIx64
          " don't match port offloads 0x%" PRIx64
          " or supported offloads 0x%" PRIx64,
          (void *)dev, tx_conf->offloads,
          dev->data->dev_conf.txmode.offloads,
          tap_tx_offload_get_port_capa());

There is no match expected, this path can be hit when requested offload out of
reported capabilities, but either log or printed values give much information
about real error cause.

Similar in tap_rx_queue_setup(), at least it does:
 (tap_rx_offload_get_port_capa() | tap_rx_offload_get_queue_capa())



> 
> Fixes: 95ae196ae10b ("net/tap: use new Rx offloads API")
> Fixes: 818fe14a9891 ("net/tap: use new Tx offloads API")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
> ---
>  drivers/net/tap/rte_eth_tap.c | 21 ++++++---------------
>  1 file changed, 6 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index fe62ab3..aea73b1 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -269,14 +269,9 @@ static uint64_t
>  tap_rx_offload_get_port_capa(void)
>  {
>  	/*
> -	 * In order to support legacy apps,
> -	 * report capabilities also as port capabilities.
> +	 * No specific port Rx offload capabilities.
>  	 */
> -	return DEV_RX_OFFLOAD_SCATTER |
> -	       DEV_RX_OFFLOAD_IPV4_CKSUM |
> -	       DEV_RX_OFFLOAD_UDP_CKSUM |
> -	       DEV_RX_OFFLOAD_TCP_CKSUM |
> -	       DEV_RX_OFFLOAD_CRC_STRIP;
> +	return 0;
>  }
>  
>  static uint64_t
> @@ -403,14 +398,9 @@ static uint64_t
>  tap_tx_offload_get_port_capa(void)
>  {
>  	/*
> -	 * In order to support legacy apps,
> -	 * report capabilities also as port capabilities.
> +	 * No specific port Tx offload capabilities.
>  	 */
> -	return DEV_TX_OFFLOAD_MULTI_SEGS |
> -	       DEV_TX_OFFLOAD_IPV4_CKSUM |
> -	       DEV_TX_OFFLOAD_UDP_CKSUM |
> -	       DEV_TX_OFFLOAD_TCP_CKSUM |
> -	       DEV_TX_OFFLOAD_TCP_TSO;
> +	return 0;
>  }
>  
>  static uint64_t
> @@ -787,7 +777,8 @@ tap_dev_stop(struct rte_eth_dev *dev)
>  static int
>  tap_dev_configure(struct rte_eth_dev *dev)
>  {
> -	uint64_t supp_tx_offloads = tap_tx_offload_get_port_capa();
> +	uint64_t supp_tx_offloads = tap_tx_offload_get_port_capa() |
> +				tap_tx_offload_get_queue_capa();
>  	uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads;
>  
>  	if ((tx_offloads & supp_tx_offloads) != tx_offloads) {
> 

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

* Re: [dpdk-dev] [PATCH v1] net/tap: return empty port offload capabilities
  2018-04-25 16:15 [dpdk-dev] [PATCH v1] net/tap: return empty port offload capabilities Ophir Munk
  2018-04-25 16:31 ` Ferruh Yigit
@ 2018-04-25 16:47 ` Thomas Monjalon
  2018-04-25 17:13   ` Ferruh Yigit
  2018-04-26 11:13 ` [dpdk-dev] [PATCH v2] " Ophir Munk
  2 siblings, 1 reply; 8+ messages in thread
From: Thomas Monjalon @ 2018-04-25 16:47 UTC (permalink / raw)
  To: Ophir Munk, Ferruh Yigit; +Cc: dev, Pascal Mazon, Olga Shern, stable

25/04/2018 18:15, Ophir Munk:
> Fix report on port offload capabilities to be 0 (no capabilities).
> Before this commit port capabilities were a clone of queue
> capabilities, however the current TAP offload capabilities (e.g.
> checksum calculation) are per queue and are not specific per port.

I did not follow what is the problem exactly.
But this change looks wrong to me.
Please look at the thread
	"Survey for final decision about per-port offload API"
	http://dpdk.org/ml/archives/dev/2018-March/094459.html
It says:
	"every queue capabilities must be reported as port capabilities"

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

* Re: [dpdk-dev] [PATCH v1] net/tap: return empty port offload capabilities
  2018-04-25 16:47 ` Thomas Monjalon
@ 2018-04-25 17:13   ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2018-04-25 17:13 UTC (permalink / raw)
  To: Thomas Monjalon, Ophir Munk; +Cc: dev, Pascal Mazon, Olga Shern, stable

On 4/25/2018 5:47 PM, Thomas Monjalon wrote:
> 25/04/2018 18:15, Ophir Munk:
>> Fix report on port offload capabilities to be 0 (no capabilities).
>> Before this commit port capabilities were a clone of queue
>> capabilities, however the current TAP offload capabilities (e.g.
>> checksum calculation) are per queue and are not specific per port.
> 
> I did not follow what is the problem exactly.
> But this change looks wrong to me.
> Please look at the thread
> 	"Survey for final decision about per-port offload API"
> 	http://dpdk.org/ml/archives/dev/2018-March/094459.html
> It says:
> 	"every queue capabilities must be reported as port capabilities"

That logic is correct in capability reporting [1].

The problem here is the offload verify function assumes the
tap_rx_offload_get_port_capa() is the only port level offloads. Returning queue
level offloads in this function breaks the verify logic.

I think the reason of this issue is undocumented smart verify function
implementation (copied from mlx5 driver) [2], since it is not easy to understand
it is easy to confuse.


[1]
dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa();
dev_info->rx_offload_capa = tap_rx_offload_get_port_capa() |
                            dev_info->rx_queue_offload_capa;

[2]
static bool
tap_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 = tap_rx_offload_get_queue_capa();
        uint64_t port_supp_offloads = tap_rx_offload_get_port_capa();

        if ((offloads & (queue_supp_offloads | port_supp_offloads)) !=
            offloads)
                return false;
        if ((port_offloads ^ offloads) & port_supp_offloads)
                return false;
        return true;
}

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

* Re: [dpdk-dev] [PATCH v1] net/tap: return empty port offload capabilities
  2018-04-25 16:31 ` Ferruh Yigit
@ 2018-04-26 11:09   ` Ophir Munk
  0 siblings, 0 replies; 8+ messages in thread
From: Ophir Munk @ 2018-04-26 11:09 UTC (permalink / raw)
  To: Ferruh Yigit, dev, Pascal Mazon; +Cc: Thomas Monjalon, Olga Shern, stable

Hi Ferruh,
Thanks for your review.
v2 was sent to mailing list that updates the log message and the commit message (based on Thomas comment that all queues capabilities must be reported as port capabilities)

> -----Original Message-----
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Wednesday, April 25, 2018 7:32 PM
> To: Ophir Munk <ophirmu@mellanox.com>; dev@dpdk.org; Pascal Mazon
> <pascal.mazon@6wind.com>
> Cc: Thomas Monjalon <thomas@monjalon.net>; Olga Shern
> <olgas@mellanox.com>; stable@dpdk.org
> Subject: Re: [PATCH v1] net/tap: return empty port offload capabilities
> 
> On 4/25/2018 5:15 PM, Ophir Munk wrote:
> > Fix report on port offload capabilities to be 0 (no capabilities).
> > Before this commit port capabilities were a clone of queue
> > capabilities, however the current TAP offload capabilities (e.g.
> > checksum calculation) are per queue and are not specific per port.
> 
> Overall looks good to me, thanks.
> 
> Is error log in tap_tx_queue_setup() still valid:
>   RTE_LOG(ERR, PMD,
>           "%p: Tx queue offloads 0x%" PRIx64
>           " don't match port offloads 0x%" PRIx64
>           " or supported offloads 0x%" PRIx64,
>           (void *)dev, tx_conf->offloads,
>           dev->data->dev_conf.txmode.offloads,
>           tap_tx_offload_get_port_capa());
> 
> There is no match expected, this path can be hit when requested offload out
> of reported capabilities, but either log or printed values give much
> information about real error cause.
> 
> Similar in tap_rx_queue_setup(), at least it does:
>  (tap_rx_offload_get_port_capa() | tap_rx_offload_get_queue_capa())
> 
> 
> 
> >
> > Fixes: 95ae196ae10b ("net/tap: use new Rx offloads API")
> > Fixes: 818fe14a9891 ("net/tap: use new Tx offloads API")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
> > ---
> >  drivers/net/tap/rte_eth_tap.c | 21 ++++++---------------
> >  1 file changed, 6 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/net/tap/rte_eth_tap.c
> > b/drivers/net/tap/rte_eth_tap.c index fe62ab3..aea73b1 100644
> > --- a/drivers/net/tap/rte_eth_tap.c
> > +++ b/drivers/net/tap/rte_eth_tap.c
> > @@ -269,14 +269,9 @@ static uint64_t
> >  tap_rx_offload_get_port_capa(void)
> >  {
> >  	/*
> > -	 * In order to support legacy apps,
> > -	 * report capabilities also as port capabilities.
> > +	 * No specific port Rx offload capabilities.
> >  	 */
> > -	return DEV_RX_OFFLOAD_SCATTER |
> > -	       DEV_RX_OFFLOAD_IPV4_CKSUM |
> > -	       DEV_RX_OFFLOAD_UDP_CKSUM |
> > -	       DEV_RX_OFFLOAD_TCP_CKSUM |
> > -	       DEV_RX_OFFLOAD_CRC_STRIP;
> > +	return 0;
> >  }
> >
> >  static uint64_t
> > @@ -403,14 +398,9 @@ static uint64_t
> >  tap_tx_offload_get_port_capa(void)
> >  {
> >  	/*
> > -	 * In order to support legacy apps,
> > -	 * report capabilities also as port capabilities.
> > +	 * No specific port Tx offload capabilities.
> >  	 */
> > -	return DEV_TX_OFFLOAD_MULTI_SEGS |
> > -	       DEV_TX_OFFLOAD_IPV4_CKSUM |
> > -	       DEV_TX_OFFLOAD_UDP_CKSUM |
> > -	       DEV_TX_OFFLOAD_TCP_CKSUM |
> > -	       DEV_TX_OFFLOAD_TCP_TSO;
> > +	return 0;
> >  }
> >
> >  static uint64_t
> > @@ -787,7 +777,8 @@ tap_dev_stop(struct rte_eth_dev *dev)  static int
> > tap_dev_configure(struct rte_eth_dev *dev)  {
> > -	uint64_t supp_tx_offloads = tap_tx_offload_get_port_capa();
> > +	uint64_t supp_tx_offloads = tap_tx_offload_get_port_capa() |
> > +				tap_tx_offload_get_queue_capa();
> >  	uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads;
> >
> >  	if ((tx_offloads & supp_tx_offloads) != tx_offloads) {
> >


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

* [dpdk-dev] [PATCH v2] net/tap: return empty port offload capabilities
  2018-04-25 16:15 [dpdk-dev] [PATCH v1] net/tap: return empty port offload capabilities Ophir Munk
  2018-04-25 16:31 ` Ferruh Yigit
  2018-04-25 16:47 ` Thomas Monjalon
@ 2018-04-26 11:13 ` Ophir Munk
  2018-04-26 16:56   ` Ferruh Yigit
  2 siblings, 1 reply; 8+ messages in thread
From: Ophir Munk @ 2018-04-26 11:13 UTC (permalink / raw)
  To: dev, Pascal Mazon
  Cc: Thomas Monjalon, Olga Shern, Ferruh Yigit, Ophir Munk, stable

Fix internal report on port specific offload capabilities to be 0 (no
capabilities). Before this commit port capabilities were a clone of queue
capabilities, however the current TAP offload capabilities (e.g.
checksum calculation) are per queue and are not specific per port.
This commit fixes an internal validation check for new configured
queue offloads.
The port capability API keeps reporting all queue capabilities as port
capabilities.

Fixes: 95ae196ae10b ("net/tap: use new Rx offloads API")
Fixes: 818fe14a9891 ("net/tap: use new Tx offloads API")
Cc: stable@dpdk.org

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
v1: initial release
v2: Fix log error message and update commit message

 drivers/net/tap/rte_eth_tap.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index fe62ab3..b4420ce 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -269,14 +269,9 @@ static uint64_t
 tap_rx_offload_get_port_capa(void)
 {
 	/*
-	 * In order to support legacy apps,
-	 * report capabilities also as port capabilities.
+	 * No specific port Rx offload capabilities.
 	 */
-	return DEV_RX_OFFLOAD_SCATTER |
-	       DEV_RX_OFFLOAD_IPV4_CKSUM |
-	       DEV_RX_OFFLOAD_UDP_CKSUM |
-	       DEV_RX_OFFLOAD_TCP_CKSUM |
-	       DEV_RX_OFFLOAD_CRC_STRIP;
+	return 0;
 }
 
 static uint64_t
@@ -403,14 +398,9 @@ static uint64_t
 tap_tx_offload_get_port_capa(void)
 {
 	/*
-	 * In order to support legacy apps,
-	 * report capabilities also as port capabilities.
+	 * No specific port Tx offload capabilities.
 	 */
-	return DEV_TX_OFFLOAD_MULTI_SEGS |
-	       DEV_TX_OFFLOAD_IPV4_CKSUM |
-	       DEV_TX_OFFLOAD_UDP_CKSUM |
-	       DEV_TX_OFFLOAD_TCP_CKSUM |
-	       DEV_TX_OFFLOAD_TCP_TSO;
+	return 0;
 }
 
 static uint64_t
@@ -787,7 +777,8 @@ tap_dev_stop(struct rte_eth_dev *dev)
 static int
 tap_dev_configure(struct rte_eth_dev *dev)
 {
-	uint64_t supp_tx_offloads = tap_tx_offload_get_port_capa();
+	uint64_t supp_tx_offloads = tap_tx_offload_get_port_capa() |
+				tap_tx_offload_get_queue_capa();
 	uint64_t tx_offloads = dev->data->dev_conf.txmode.offloads;
 
 	if ((tx_offloads & supp_tx_offloads) != tx_offloads) {
@@ -1351,7 +1342,8 @@ tap_tx_queue_setup(struct rte_eth_dev *dev,
 				" or supported offloads 0x%" PRIx64,
 				(void *)dev, tx_conf->offloads,
 				dev->data->dev_conf.txmode.offloads,
-				tap_tx_offload_get_port_capa());
+				(tap_tx_offload_get_port_capa() |
+				tap_tx_offload_get_queue_capa()));
 			return -rte_errno;
 		}
 	}
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v2] net/tap: return empty port offload capabilities
  2018-04-26 11:13 ` [dpdk-dev] [PATCH v2] " Ophir Munk
@ 2018-04-26 16:56   ` Ferruh Yigit
  2018-04-26 16:57     ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2018-04-26 16:56 UTC (permalink / raw)
  To: Ophir Munk, dev, Pascal Mazon; +Cc: Thomas Monjalon, Olga Shern, stable

On 4/26/2018 12:13 PM, Ophir Munk wrote:
> Fix internal report on port specific offload capabilities to be 0 (no
> capabilities). Before this commit port capabilities were a clone of queue
> capabilities, however the current TAP offload capabilities (e.g.
> checksum calculation) are per queue and are not specific per port.
> This commit fixes an internal validation check for new configured
> queue offloads.
> The port capability API keeps reporting all queue capabilities as port
> capabilities.
> 
> Fixes: 95ae196ae10b ("net/tap: use new Rx offloads API")
> Fixes: 818fe14a9891 ("net/tap: use new Tx offloads API")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] net/tap: return empty port offload capabilities
  2018-04-26 16:56   ` Ferruh Yigit
@ 2018-04-26 16:57     ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2018-04-26 16:57 UTC (permalink / raw)
  To: Ophir Munk, dev, Pascal Mazon; +Cc: Thomas Monjalon, Olga Shern, stable

On 4/26/2018 5:56 PM, Ferruh Yigit wrote:
> On 4/26/2018 12:13 PM, Ophir Munk wrote:
>> Fix internal report on port specific offload capabilities to be 0 (no
>> capabilities). Before this commit port capabilities were a clone of queue
>> capabilities, however the current TAP offload capabilities (e.g.
>> checksum calculation) are per queue and are not specific per port.
>> This commit fixes an internal validation check for new configured
>> queue offloads.
>> The port capability API keeps reporting all queue capabilities as port
>> capabilities.
>>
>> Fixes: 95ae196ae10b ("net/tap: use new Rx offloads API")
>> Fixes: 818fe14a9891 ("net/tap: use new Tx offloads API")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

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

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

end of thread, other threads:[~2018-04-26 16:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-25 16:15 [dpdk-dev] [PATCH v1] net/tap: return empty port offload capabilities Ophir Munk
2018-04-25 16:31 ` Ferruh Yigit
2018-04-26 11:09   ` Ophir Munk
2018-04-25 16:47 ` Thomas Monjalon
2018-04-25 17:13   ` Ferruh Yigit
2018-04-26 11:13 ` [dpdk-dev] [PATCH v2] " Ophir Munk
2018-04-26 16:56   ` Ferruh Yigit
2018-04-26 16:57     ` [dpdk-dev] [dpdk-stable] " 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).