net/dpaa: send error packets to application
authorNipun Gupta <nipun.gupta@nxp.com>
Thu, 24 Sep 2020 04:02:08 +0000 (09:32 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 6 Oct 2020 12:43:40 +0000 (14:43 +0200)
Send error packets to main queue (rx) to make application
enable to receive error packets.
Earlier all packets with L3/L4 checksum errors were getting
dropped by the hardware.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
drivers/net/dpaa/dpaa_ethdev.c
drivers/net/dpaa/dpaa_rxtx.c
drivers/net/dpaa/dpaa_rxtx.h

index cc20f28..5c2acea 100644 (file)
@@ -1045,7 +1045,8 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
                                rxq->fqid, ret);
                }
        }
-
+       /* Enable main queue to receive error packets also by default */
+       fman_if_set_err_fqid(fif, rxq->fqid);
        return 0;
 }
 
@@ -2007,13 +2008,10 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
                fman_intf->mac_addr.addr_bytes[5]);
 
        if (!fman_intf->is_shared_mac) {
-               /* Disable RX mode */
-#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+               /* Configure error packet handling */
                fman_if_receive_rx_errors(fman_intf,
                        FM_FD_RX_STATUS_ERR_MASK);
-#else
-               fman_if_discard_rx_errors(fman_intf);
-#endif
+               /* Disable RX mode */
                fman_if_disable_rx(fman_intf);
                /* Disable promiscuous mode */
                fman_if_promiscuous_disable(fman_intf);
index 6eadbfa..e4f012c 100644 (file)
@@ -125,6 +125,9 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
 
        DPAA_DP_LOG(DEBUG, " Parsing mbuf: %p with annotations: %p", m, annot);
 
+       m->ol_flags = PKT_RX_RSS_HASH | PKT_RX_IP_CKSUM_GOOD |
+               PKT_RX_L4_CKSUM_GOOD;
+
        switch (prs) {
        case DPAA_PKT_TYPE_IPV4:
                m->packet_type = RTE_PTYPE_L2_ETHER |
@@ -199,6 +202,16 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
                m->packet_type = RTE_PTYPE_L2_ETHER |
                        RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_SCTP;
                break;
+       case DPAA_PKT_TYPE_IPV4_CSUM_ERR:
+       case DPAA_PKT_TYPE_IPV6_CSUM_ERR:
+               m->ol_flags = PKT_RX_RSS_HASH | PKT_RX_IP_CKSUM_BAD;
+               break;
+       case DPAA_PKT_TYPE_IPV4_TCP_CSUM_ERR:
+       case DPAA_PKT_TYPE_IPV6_TCP_CSUM_ERR:
+       case DPAA_PKT_TYPE_IPV4_UDP_CSUM_ERR:
+       case DPAA_PKT_TYPE_IPV6_UDP_CSUM_ERR:
+               m->ol_flags = PKT_RX_RSS_HASH | PKT_RX_L4_CKSUM_BAD;
+               break;
        case DPAA_PKT_TYPE_NONE:
                m->packet_type = 0;
                break;
@@ -213,10 +226,6 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
 
        /* Set the hash values */
        m->hash.rss = (uint32_t)(annot->hash);
-       /* All packets with Bad checksum are dropped by interface (and
-        * corresponding notification issued to RX error queues).
-        */
-       m->ol_flags = PKT_RX_RSS_HASH | PKT_RX_IP_CKSUM_GOOD;
 
        /* Check if Vlan is present */
        if (prs & DPAA_PARSE_VLAN_MASK)
index fe8eb6d..d9d7e04 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2017 NXP
+ *   Copyright 2017,2020 NXP
  *
  */
 
@@ -61,7 +61,7 @@
  *             0x8000 - Ethernet type
  *     ShimR & Logical Port ID 0x0000
  */
-#define DPAA_PARSE_MASK                        0x00E044ED00800000
+#define DPAA_PARSE_MASK                        0x00F044EF00800000
 #define DPAA_PARSE_VLAN_MASK           0x0000000000700000
 
 /* Parsed values (Little Endian) */
                        (0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_4_6)
 #define DPAA_PKT_TYPE_TUNNEL_6_4_TCP \
                        (0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_6_4)
+
+/* Checksum Errors */
+#define DPAA_PKT_IP_CSUM_ERR           0x0000400200000000
+#define DPAA_PKT_L4_CSUM_ERR           0x0010000000000000
+#define DPAA_PKT_TYPE_IPV4_CSUM_ERR \
+                       (DPAA_PKT_IP_CSUM_ERR | DPAA_PKT_TYPE_IPV4)
+#define DPAA_PKT_TYPE_IPV6_CSUM_ERR \
+                       (DPAA_PKT_IP_CSUM_ERR | DPAA_PKT_TYPE_IPV6)
+#define DPAA_PKT_TYPE_IPV4_TCP_CSUM_ERR \
+                       (DPAA_PKT_L4_CSUM_ERR | DPAA_PKT_TYPE_IPV4_TCP)
+#define DPAA_PKT_TYPE_IPV6_TCP_CSUM_ERR \
+                       (DPAA_PKT_L4_CSUM_ERR | DPAA_PKT_TYPE_IPV6_TCP)
+#define DPAA_PKT_TYPE_IPV4_UDP_CSUM_ERR \
+                       (DPAA_PKT_L4_CSUM_ERR | DPAA_PKT_TYPE_IPV4_UDP)
+#define DPAA_PKT_TYPE_IPV6_UDP_CSUM_ERR \
+                       (DPAA_PKT_L4_CSUM_ERR | DPAA_PKT_TYPE_IPV6_UDP)
+
 #define DPAA_PKT_L3_LEN_SHIFT  7
 
 /**