net/mlx5: update modify field action
[dpdk.git] / drivers / net / tap / rte_eth_tap.c
index 5513cfd..046f176 100644 (file)
 
 #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] = {
@@ -350,6 +361,8 @@ tap_verify_csum(struct rte_mbuf *mbuf)
                return;
        }
        if (l4 == RTE_PTYPE_L4_UDP || l4 == RTE_PTYPE_L4_TCP) {
+               int cksum_ok;
+
                l4_hdr = rte_pktmbuf_mtod_offset(mbuf, void *, l2_len + l3_len);
                /* Don't verify checksum for multi-segment packets. */
                if (mbuf->nb_segs > 1)
@@ -367,34 +380,17 @@ tap_verify_csum(struct rte_mbuf *mbuf)
                                        return;
                                }
                        }
-                       cksum = ~rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr);
+                       cksum_ok = !rte_ipv4_udptcp_cksum_verify(l3_hdr,
+                                                                l4_hdr);
                } else { /* l3 == RTE_PTYPE_L3_IPV6, checked above */
-                       cksum = ~rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr);
+                       cksum_ok = !rte_ipv6_udptcp_cksum_verify(l3_hdr,
+                                                                l4_hdr);
                }
-               mbuf->ol_flags |= cksum ?
-                       PKT_RX_L4_CKSUM_BAD :
-                       PKT_RX_L4_CKSUM_GOOD;
+               mbuf->ol_flags |= cksum_ok ?
+                       PKT_RX_L4_CKSUM_GOOD : PKT_RX_L4_CKSUM_BAD;
        }
 }
 
-static uint64_t
-tap_rx_offload_get_port_capa(void)
-{
-       /*
-        * No specific port Rx offload capabilities.
-        */
-       return 0;
-}
-
-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)
 {
@@ -510,25 +506,6 @@ end:
        return num_rx;
 }
 
-static uint64_t
-tap_tx_offload_get_port_capa(void)
-{
-       /*
-        * No specific port Tx offload capabilities.
-        */
-       return 0;
-}
-
-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,
@@ -1019,12 +996,10 @@ 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_offload_capa = tap_rx_offload_get_port_capa() |
-                                   dev_info->rx_queue_offload_capa;
-       dev_info->tx_queue_offload_capa = tap_tx_offload_get_queue_capa();
-       dev_info->tx_offload_capa = tap_tx_offload_get_port_capa() |
-                                   dev_info->tx_queue_offload_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;
+       dev_info->tx_offload_capa = dev_info->tx_queue_offload_capa;
        dev_info->hash_key_size = TAP_RSS_HASH_KEY_SIZE;
        /*
         * limitation: TAP supports all of IP, UDP and TCP hash
@@ -1176,9 +1151,9 @@ tap_dev_close(struct rte_eth_dev *dev)
 }
 
 static void
-tap_rx_queue_release(void *queue)
+tap_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 {
-       struct rx_queue *rxq = queue;
+       struct rx_queue *rxq = dev->data->rx_queues[qid];
        struct pmd_process_private *process_private;
 
        if (!rxq)
@@ -1195,9 +1170,9 @@ tap_rx_queue_release(void *queue)
 }
 
 static void
-tap_tx_queue_release(void *queue)
+tap_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 {
-       struct tx_queue *txq = queue;
+       struct tx_queue *txq = dev->data->tx_queues[qid];
        struct pmd_process_private *process_private;
 
        if (!txq)