From patchwork Thu Feb 22 12:23:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 137032 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B510843B74; Thu, 22 Feb 2024 13:24:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 451D240E54; Thu, 22 Feb 2024 13:24:10 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id DC59A40A7F for ; Thu, 22 Feb 2024 13:24:05 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41M9BWFI021919; Thu, 22 Feb 2024 04:24:02 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=Z8cq5e6L6bFw3u3xzLUEpmFPhasJoGYClZUnneRIIXo=; b=IvO FzhQc4bRmqMgpG5XC4aSQTIi7R5qOpdPo77ITkjxmdVyDnflU3/m8U05YzpElWw8 /+l9e3+J2UuDlxE2zoBiIqF1tGs5fzCems680xotz5O6tyx1Ks7pDn5muLElDzhj hgRDlVT5NJWtMB2dV3Nj7PH6YUd1zOJmi1jyN0WEZgaSD7E4JM/j5+hoeMiJViGZ dlbSAqkzLsJ/ubOMQ6B9Y4xN8quXTJT25oOUCVw2VQJb2ni6j4aHXDs+aaaiWZUO Q0roF7fBFhF/S4l7n4EMVRu63P0FfP9MmHlMK8C60TpOFZCi5hl8eJe+gyuXiGBE 3fTnl+68lR+K5ykM3Jg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3we3dw8j6w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 04:24:02 -0800 (PST) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 22 Feb 2024 04:24:00 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Thu, 22 Feb 2024 04:24:00 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 22 Feb 2024 04:24:00 -0800 Received: from MININT-80QBFE8.corp.innovium.com (unknown [10.28.164.106]) by maili.marvell.com (Postfix) with ESMTP id 119F33F71CF; Thu, 22 Feb 2024 04:23:56 -0800 (PST) From: To: , , , , Pavan Nikhilesh , Ruifeng Wang , "Bruce Richardson" , Konstantin Ananyev CC: Subject: [24.11 PATCH v3 4/5] node: add error stats for ip4 lookup node Date: Thu, 22 Feb 2024 17:53:41 +0530 Message-ID: <20240222122342.16375-4-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240222122342.16375-1-pbhagavatula@marvell.com> References: <20240222053639.15057-1-pbhagavatula@marvell.com> <20240222122342.16375-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: oMxLMPVYWRTl5Zo5rHQdAmfi_FgFUg9_ X-Proofpoint-ORIG-GUID: oMxLMPVYWRTl5Zo5rHQdAmfi_FgFUg9_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_09,2024-02-22_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Pavan Nikhilesh Add error counters for ip4 LPM lookup failures in ip4_lookup node. Signed-off-by: Pavan Nikhilesh --- lib/node/ip4_lookup.c | 9 +++++++++ lib/node/ip4_lookup_neon.h | 5 +++++ lib/node/ip4_lookup_sse.h | 6 ++++++ lib/node/node_private.h | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/lib/node/ip4_lookup.c b/lib/node/ip4_lookup.c index 18955971f6..5a7921db75 100644 --- a/lib/node/ip4_lookup.c +++ b/lib/node/ip4_lookup.c @@ -86,6 +86,7 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; + NODE_INCREMENT_ERROR_ID(node, 0, (rc != 0), 1); node_mbuf_priv1(mbuf, dyn)->nh = (uint16_t)next_hop; next_hop = next_hop >> 16; @@ -219,11 +220,19 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node) return 0; } +static struct rte_node_errors ip4_lookup_errors = { + .nb_errors = 1, + .err_desc = { + [0] = "ip4_lookup_error", + }, +}; + static struct rte_node_register ip4_lookup_node = { .process = ip4_lookup_node_process_scalar, .name = "ip4_lookup", .init = ip4_lookup_node_init, + .errs = &ip4_lookup_errors, .nb_edges = RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP + 1, .next_nodes = { diff --git a/lib/node/ip4_lookup_neon.h b/lib/node/ip4_lookup_neon.h index d5c8da3719..907c7c955a 100644 --- a/lib/node/ip4_lookup_neon.h +++ b/lib/node/ip4_lookup_neon.h @@ -116,6 +116,10 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, priv01.u16[4] = result.u16[2]; priv23.u16[0] = result.u16[4]; priv23.u16[4] = result.u16[6]; + NODE_INCREMENT_ERROR_ID(node, 0, result.u16[1] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, result.u16[3] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, result.u16[5] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, result.u16[7] == (drop_nh >> 16), 1); node_mbuf_priv1(mbuf0, dyn)->u = priv01.u64[0]; node_mbuf_priv1(mbuf1, dyn)->u = priv01.u64[1]; @@ -202,6 +206,7 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; + NODE_INCREMENT_ERROR_ID(node, 0, (rc != 0), 1); node_mbuf_priv1(mbuf0, dyn)->nh = (uint16_t)next_hop; next_hop = next_hop >> 16; next0 = (uint16_t)next_hop; diff --git a/lib/node/ip4_lookup_sse.h b/lib/node/ip4_lookup_sse.h index 74dbf97533..a38131e629 100644 --- a/lib/node/ip4_lookup_sse.h +++ b/lib/node/ip4_lookup_sse.h @@ -115,6 +115,11 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, /* Perform LPM lookup to get NH and next node */ rte_lpm_lookupx4(lpm, dip, dst.u32, drop_nh); + NODE_INCREMENT_ERROR_ID(node, 0, dst.u16[1] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, dst.u16[3] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, dst.u16[5] == (drop_nh >> 16), 1); + NODE_INCREMENT_ERROR_ID(node, 0, dst.u16[7] == (drop_nh >> 16), 1); + /* Extract next node id and NH */ node_mbuf_priv1(mbuf0, dyn)->nh = dst.u32[0] & 0xFFFF; next0 = (dst.u32[0] >> 16); @@ -206,6 +211,7 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; + NODE_INCREMENT_ERROR_ID(node, 0, rc != 0, 1); node_mbuf_priv1(mbuf0, dyn)->nh = next_hop & 0xFFFF; next0 = (next_hop >> 16); diff --git a/lib/node/node_private.h b/lib/node/node_private.h index 2b9bad1a11..25870f97fe 100644 --- a/lib/node/node_private.h +++ b/lib/node/node_private.h @@ -12,6 +12,8 @@ #include #include +#include + extern int rte_node_logtype; #define RTE_LOGTYPE_NODE rte_node_logtype @@ -89,4 +91,10 @@ node_mbuf_priv2(struct rte_mbuf *m) return (struct node_mbuf_priv2 *)rte_mbuf_to_priv(m); } +#define NODE_INCREMENT_ERROR_ID(node, id, cond, cnt) \ + { \ + if (unlikely(rte_graph_has_stats_feature() && (cond))) \ + ((uint64_t *)RTE_PTR_ADD(node, node->err_off))[id] += (cnt); \ + } + #endif /* __NODE_PRIVATE_H__ */