[dpdk-dev,v2] net/tap: return empty port offload capabilities

Message ID 1524741182-5758-1-git-send-email-ophirmu@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ophir Munk April 26, 2018, 11:13 a.m. UTC
  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(-)
  

Comments

Ferruh Yigit April 26, 2018, 4:56 p.m. UTC | #1
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>
  
Ferruh Yigit April 26, 2018, 4:57 p.m. UTC | #2
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.
  

Patch

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;
 		}
 	}