diff mbox series

[v2,8/8] net/dpaa: send error packets to application

Message ID 20200911083520.24020-9-sachin.saxena@oss.nxp.com
State Superseded
Headers show
Series None | expand

Commit Message

Sachin Saxena (OSS) Sept. 11, 2020, 8:35 a.m. UTC
From: Nipun Gupta <nipun.gupta@nxp.com>


Send error packets to main queue (rx) to make application
enable to receive error packets.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

---
 drivers/net/dpaa/dpaa_ethdev.c | 10 ++++------
 drivers/net/dpaa/dpaa_rxtx.c   | 17 +++++++++++++----
 drivers/net/dpaa/dpaa_rxtx.h   | 21 +++++++++++++++++++--
 3 files changed, 36 insertions(+), 12 deletions(-)

-- 
2.28.0
diff mbox series

Patch

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 66bb6eb00..edd63b0d2 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1068,7 +1068,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;
 }
 
@@ -2030,13 +2031,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);
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 6eadbfa14..e4f012c23 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -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)
diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h
index fe8eb6dc7..d9d7e04f5 100644
--- a/drivers/net/dpaa/dpaa_rxtx.h
+++ b/drivers/net/dpaa/dpaa_rxtx.h
@@ -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) */
@@ -137,6 +137,23 @@ 
 			(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
 
 /**