DPDK patches and discussions
 help / color / mirror / Atom feed
From: Soumyadeep Hore <soumyadeep.hore@intel.com>
To: bruce.richardson@intel.com, aman.deep.singh@intel.com
Cc: dev@dpdk.org
Subject: [PATCH v1] net/cpfl: add checks for received ctlq messages
Date: Thu,  4 Jul 2024 05:18:35 +0000	[thread overview]
Message-ID: <20240704051835.2630052-1-soumyadeep.hore@intel.com> (raw)

cpfl_process_rx_ctlq_msg() is used to check error status
returned for specific opcodes.

Previously error codes were only -ve for
cpfl_receive_ctlq_msg() but now there are +ve error codes.
Hence code changes are made accordingly.

Signed-off-by: Soumyadeep Hore <soumyadeep.hore@intel.com>
---
 drivers/net/cpfl/cpfl_flow_engine_fxp.c |  2 +-
 drivers/net/cpfl/cpfl_fxp_rule.c        | 52 +++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/drivers/net/cpfl/cpfl_flow_engine_fxp.c b/drivers/net/cpfl/cpfl_flow_engine_fxp.c
index 39a281fa61..983b4188e4 100644
--- a/drivers/net/cpfl/cpfl_flow_engine_fxp.c
+++ b/drivers/net/cpfl/cpfl_flow_engine_fxp.c
@@ -95,7 +95,7 @@ cpfl_fxp_create(struct rte_eth_dev *dev,
 
 	ret = cpfl_rule_process(itf, ad->ctlqp[cpq_id], ad->ctlqp[cpq_id + 1],
 				rim->rules, rim->rule_num, true);
-	if (ret < 0) {
+	if (ret) {
 		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 				   "cpfl filter create flow fail");
 		rte_free(rim);
diff --git a/drivers/net/cpfl/cpfl_fxp_rule.c b/drivers/net/cpfl/cpfl_fxp_rule.c
index 0e710a007b..fc807e59a0 100644
--- a/drivers/net/cpfl/cpfl_fxp_rule.c
+++ b/drivers/net/cpfl/cpfl_fxp_rule.c
@@ -60,6 +60,52 @@ cpfl_send_ctlq_msg(struct idpf_hw *hw, struct idpf_ctlq_info *cq, u16 num_q_msg,
 	return ret;
 }
 
+static int
+cpfl_process_rx_ctlq_msg(u16 msg_opcode, u16 msg_status)
+{
+	int ret = CPFL_CFG_PKT_ERR_OK;
+
+	if (msg_status &&
+		msg_opcode == cpfl_ctlq_sem_query_rule_hash_addr)
+		return ret;
+
+	switch (msg_status) {
+	case CPFL_CFG_PKT_ERR_EEXIST:
+		PMD_INIT_LOG(ERR, "The rule has confliction with already existed one");
+		ret = CPFL_CFG_PKT_ERR_EEXIST;
+		break;
+	case CPFL_CFG_PKT_ERR_ENOSPC:
+		PMD_INIT_LOG(ERR, "No space left in the table");
+		ret = CPFL_CFG_PKT_ERR_ENOSPC;
+		break;
+	case CPFL_CFG_PKT_ERR_ESRCH:
+		PMD_INIT_LOG(ERR, "Bad opcode");
+		ret = CPFL_CFG_PKT_ERR_ESRCH;
+		break;
+	case CPFL_CFG_PKT_ERR_ERANGE:
+		PMD_INIT_LOG(ERR, "Parameter are out of");
+		ret = CPFL_CFG_PKT_ERR_ERANGE;
+		break;
+	case CPFL_CFG_PKT_ERR_ESBCOMP:
+		PMD_INIT_LOG(ERR, "Completion error");
+		ret = CPFL_CFG_PKT_ERR_ESBCOMP;
+		break;
+	case CPFL_CFG_PKT_ERR_ENOPIN:
+		PMD_INIT_LOG(ERR, "Entry cannot be pinned in the cache");
+		ret = CPFL_CFG_PKT_ERR_ENOPIN;
+		break;
+	case CPFL_CFG_PKT_ERR_ENOTFND:
+		PMD_INIT_LOG(ERR, "Entry does not exists");
+		ret = CPFL_CFG_PKT_ERR_ENOTFND;
+		break;
+	case CPFL_CFG_PKT_ERR_EMAXCOL:
+		PMD_INIT_LOG(ERR, "Maximum number of hash collisons reached");
+		ret = CPFL_CFG_PKT_ERR_EMAXCOL;
+		break;
+	}
+	return ret;
+}
+
 int
 cpfl_receive_ctlq_msg(struct idpf_hw *hw, struct idpf_ctlq_info *cq, u16 num_q_msg,
 		      struct idpf_ctlq_msg q_msg[])
@@ -92,6 +138,12 @@ cpfl_receive_ctlq_msg(struct idpf_hw *hw, struct idpf_ctlq_info *cq, u16 num_q_m
 
 		/* TODO - process rx controlq message */
 		for (i = 0; i < num_q_msg; i++) {
+			ret = cpfl_process_rx_ctlq_msg(q_msg[i].opcode, q_msg[i].status);
+			if (ret) {
+				PMD_INIT_LOG(ERR, "failed to process rx_ctrlq msg");
+				return ret;
+			}
+
 			if (q_msg[i].data_len > 0)
 				dma = q_msg[i].ctx.indirect.payload;
 			else
-- 
2.43.0


             reply	other threads:[~2024-07-04  6:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04  5:18 Soumyadeep Hore [this message]
2024-07-04 12:49 ` Bruce Richardson
2024-07-05  5:08 ` [PATCH v2 0/2] Avoid rule duplication in CPFL PMD Soumyadeep Hore
2024-07-05  5:08   ` [PATCH v2 1/2] net/cpfl: fix check for opcodes of received ctlq messages Soumyadeep Hore
2024-07-05  5:08   ` [PATCH v2 2/2] net/cpfl: fix +ve error codes for " Soumyadeep Hore
2024-07-05  8:30     ` [PATCH v3 0/2] Avoid rule duplication in CPFL PMD Soumyadeep Hore
2024-07-05  8:30       ` [PATCH v3 1/2] net/cpfl: fix check for opcodes of received ctlq messages Soumyadeep Hore
2024-07-05  9:49         ` Bruce Richardson
2024-07-05  8:30       ` [PATCH v3 2/2] net/cpfl: fix +ve error codes for " Soumyadeep Hore
2024-07-05 13:05         ` [PATCH v4 0/2] Avoid rule duplication in CPFL PMD Soumyadeep Hore
2024-07-05 13:05           ` [PATCH v4 1/2] net/cpfl: fix check for opcodes of received ctlq messages Soumyadeep Hore
2024-07-05 14:21             ` Bruce Richardson
2024-07-05 13:05           ` [PATCH v4 2/2] net/cpfl: fix +ve error codes for " Soumyadeep Hore
2024-07-05 14:47           ` [PATCH v4 0/2] Avoid rule duplication in CPFL PMD Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240704051835.2630052-1-soumyadeep.hore@intel.com \
    --to=soumyadeep.hore@intel.com \
    --cc=aman.deep.singh@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).