net/pfe: add packet types and basic statistics
authorGagandeep Singh <g.singh@nxp.com>
Thu, 10 Oct 2019 06:32:30 +0000 (12:02 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 23 Oct 2019 14:43:08 +0000 (16:43 +0200)
This patch add support for supported packet types
by the platform andbasic statistics like
numbers of packets/bytes receive and transmit.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
doc/guides/nics/features/pfe.ini
doc/guides/nics/pfe.rst
drivers/net/pfe/pfe_ethdev.c

index 3b96a1a..6274b59 100644 (file)
@@ -6,6 +6,8 @@
 [Features]
 L3 checksum offload  = Y
 L4 checksum offload  = Y
+Packet type parsing  = Y
+Basic stats          = Y
 Linux VFIO           = Y
 ARMv8                = Y
 Usage doc            = Y
index 23aa15b..8a9fc06 100644 (file)
@@ -94,6 +94,8 @@ PFE Features
 ~~~~~~~~~~~~
 
 - L3/L4 checksum offload
+- Packet type parsing
+- Basic stats
 - ARMv8
 
 Supported PFE SoCs
index 4f40805..09ab0b0 100644 (file)
@@ -521,6 +521,47 @@ pfe_tx_queue_setup(struct rte_eth_dev *dev,
        return 0;
 }
 
+static const uint32_t *
+pfe_supported_ptypes_get(struct rte_eth_dev *dev)
+{
+       static const uint32_t ptypes[] = {
+               /*todo -= add more types */
+               RTE_PTYPE_L2_ETHER,
+               RTE_PTYPE_L3_IPV4,
+               RTE_PTYPE_L3_IPV4_EXT,
+               RTE_PTYPE_L3_IPV6,
+               RTE_PTYPE_L3_IPV6_EXT,
+               RTE_PTYPE_L4_TCP,
+               RTE_PTYPE_L4_UDP,
+               RTE_PTYPE_L4_SCTP
+       };
+
+       if (dev->rx_pkt_burst == pfe_recv_pkts ||
+                       dev->rx_pkt_burst == pfe_recv_pkts_on_intr)
+               return ptypes;
+       return NULL;
+}
+
+static int
+pfe_stats_get(struct rte_eth_dev *dev,
+             struct rte_eth_stats *stats)
+{
+       struct pfe_eth_priv_s *priv = dev->data->dev_private;
+       struct rte_eth_stats *eth_stats = &priv->stats;
+
+       if (stats == NULL)
+               return -1;
+
+       memset(stats, 0, sizeof(struct rte_eth_stats));
+
+       stats->ipackets = eth_stats->ipackets;
+       stats->ibytes = eth_stats->ibytes;
+       stats->opackets = eth_stats->opackets;
+       stats->obytes = eth_stats->obytes;
+
+       return 0;
+}
+
 static const struct eth_dev_ops ops = {
        .dev_start = pfe_eth_open,
        .dev_stop = pfe_eth_stop,
@@ -531,6 +572,8 @@ static const struct eth_dev_ops ops = {
        .rx_queue_release  = pfe_rx_queue_release,
        .tx_queue_setup = pfe_tx_queue_setup,
        .tx_queue_release  = pfe_tx_queue_release,
+       .dev_supported_ptypes_get = pfe_supported_ptypes_get,
+       .stats_get            = pfe_stats_get,
 };
 
 static int