diff mbox series

[2/2] net/tap: replace offload_capa function with define

Message ID 20210616041528.4229-3-stephen@networkplumber.org (mailing list archive)
State Accepted
Delegated to: Andrew Rybchenko
Headers show
Series net/tap: remove useless offload setup | expand

Checks

Context Check Description
ci/iol-mellanox-Functional fail Functional Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot success github build: passed
ci/iol-testing success Testing PASS
ci/iol-abi-testing warning Testing issues
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger June 16, 2021, 4:15 a.m. UTC
Since the offload values are always the same, these can
just be data instead of code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/rte_eth_tap.c | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

Comments

Andrew Rybchenko July 1, 2021, 2:18 p.m. UTC | #1
On 6/16/21 7:15 AM, Stephen Hemminger wrote:
> Since the offload values are always the same, these can
> just be data instead of code.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

No strong opinion as well, but above reason is not strong
enough to touch the code. So, I'll wait for the maintainer
here as well.
diff mbox series

Patch

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index aeae6e8f5e93..c31739abf967 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -70,6 +70,17 @@ 
 
 #define TAP_IOV_DEFAULT_MAX 1024
 
+#define TAP_RX_OFFLOAD (DEV_RX_OFFLOAD_SCATTER |	\
+			DEV_RX_OFFLOAD_IPV4_CKSUM |	\
+			DEV_RX_OFFLOAD_UDP_CKSUM |	\
+			DEV_RX_OFFLOAD_TCP_CKSUM)
+
+#define TAP_TX_OFFLOAD (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)
+
 static int tap_devices_count;
 
 static const char *tuntap_types[ETH_TUNTAP_TYPE_MAX] = {
@@ -373,15 +384,6 @@  tap_verify_csum(struct rte_mbuf *mbuf)
 	}
 }
 
-static uint64_t
-tap_rx_offload_get_queue_capa(void)
-{
-	return DEV_RX_OFFLOAD_SCATTER |
-	       DEV_RX_OFFLOAD_IPV4_CKSUM |
-	       DEV_RX_OFFLOAD_UDP_CKSUM |
-	       DEV_RX_OFFLOAD_TCP_CKSUM;
-}
-
 static void
 tap_rxq_pool_free(struct rte_mbuf *pool)
 {
@@ -497,16 +499,6 @@  pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 	return num_rx;
 }
 
-static uint64_t
-tap_tx_offload_get_queue_capa(void)
-{
-	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;
-}
-
 /* Finalize l4 checksum calculation */
 static void
 tap_tx_l4_cksum(uint16_t *l4_cksum, uint16_t l4_phdr_cksum,
@@ -997,9 +989,9 @@  tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_tx_queues = RTE_PMD_TAP_MAX_QUEUES;
 	dev_info->min_rx_bufsize = 0;
 	dev_info->speed_capa = tap_dev_speed_capa();
-	dev_info->rx_queue_offload_capa = tap_rx_offload_get_queue_capa();
+	dev_info->rx_queue_offload_capa = TAP_RX_OFFLOAD;
 	dev_info->rx_offload_capa = dev_info->rx_queue_offload_capa;
-	dev_info->tx_queue_offload_capa = tap_tx_offload_get_queue_capa();
+	dev_info->tx_queue_offload_capa = TAP_TX_OFFLOAD;
 	dev_info->tx_offload_capa = dev_info->tx_queue_offload_capa;
 	dev_info->hash_key_size = TAP_RSS_HASH_KEY_SIZE;
 	/*