ethdev: query supported packet types
[dpdk.git] / drivers / net / nfp / nfp_net.c
index ffa5730..e856b2f 100644 (file)
  * Netronome vNIC DPDK Poll-Mode Driver: Main entry point
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/socket.h>
-#include <sys/io.h>
-#include <assert.h>
-#include <time.h>
 #include <math.h>
-#include <inttypes.h>
 
 #include <rte_byteorder.h>
 #include <rte_common.h>
@@ -358,6 +347,7 @@ nfp_net_reset_tx_queue(struct nfp_net_txq *txq)
        txq->wr_p = 0;
        txq->rd_p = 0;
        txq->tail = 0;
+       txq->qcp_rd_p = 0;
 }
 
 static int
@@ -1070,9 +1060,24 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        };
 
        dev_info->reta_size = NFP_NET_CFG_RSS_ITBL_SZ;
-#if RTE_VER_MAJOR == 2 && RTE_VER_MINOR >= 1
        dev_info->hash_key_size = NFP_NET_CFG_RSS_KEY_SZ;
-#endif
+}
+
+static const uint32_t *
+nfp_net_supported_ptypes_get(struct rte_eth_dev *dev)
+{
+       static const uint32_t ptypes[] = {
+               /* refers to nfp_net_set_hash() */
+               RTE_PTYPE_INNER_L3_IPV4,
+               RTE_PTYPE_INNER_L3_IPV6,
+               RTE_PTYPE_INNER_L3_IPV6_EXT,
+               RTE_PTYPE_INNER_L4_MASK,
+               RTE_PTYPE_UNKNOWN
+       };
+
+       if (dev->rx_pkt_burst == nfp_net_recv_pkts)
+               return ptypes;
+       return NULL;
 }
 
 static uint32_t
@@ -1524,7 +1529,7 @@ static inline void
 nfp_net_tx_cksum(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd,
                 struct rte_mbuf *mb)
 {
-       uint16_t ol_flags;
+       uint64_t ol_flags;
        struct nfp_net_hw *hw = txq->hw;
 
        if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM))
@@ -1545,7 +1550,8 @@ nfp_net_tx_cksum(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd,
                break;
        }
 
-       txd->flags |= PCIE_DESC_TX_CSUM;
+       if (ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK))
+               txd->flags |= PCIE_DESC_TX_CSUM;
 }
 
 /* nfp_net_rx_cksum - set mbuf checksum flags based on RX descriptor flags */
@@ -1987,7 +1993,7 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
                                rte_pktmbuf_free_seg(*lmbuf);
 
                        dma_size = pkt->data_len;
-                       dma_addr = RTE_MBUF_DATA_DMA_ADDR(pkt);
+                       dma_addr = rte_mbuf_data_dma_addr(pkt);
                        PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:"
                                   "%" PRIx64 "\n", dma_addr);
 
@@ -2294,6 +2300,7 @@ static struct eth_dev_ops nfp_net_eth_dev_ops = {
        .stats_get              = nfp_net_stats_get,
        .stats_reset            = nfp_net_stats_reset,
        .dev_infos_get          = nfp_net_infos_get,
+       .dev_supported_ptypes_get = nfp_net_supported_ptypes_get,
        .mtu_set                = nfp_net_dev_mtu_set,
        .vlan_offload_set       = nfp_net_vlan_offload_set,
        .reta_update            = nfp_net_reta_update,