All of lore.kernel.org
 help / color / mirror / Atom feed
From: Subbaraya Sundeep <sbhatta@marvell.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <netdev@vger.kernel.org>
Cc: <sgoutham@marvell.com>, <hkelam@marvell.com>,
	<gakula@marvell.com>, Subbaraya Sundeep <sbhatta@marvell.com>
Subject: [net-next PATCH 01/11] octeontx2-af: Modify install flow error codes
Date: Tue, 17 Aug 2021 10:14:43 +0530	[thread overview]
Message-ID: <1629175493-4895-2-git-send-email-sbhatta@marvell.com> (raw)
In-Reply-To: <1629175493-4895-1-git-send-email-sbhatta@marvell.com>

When installing a flow using npc_install_flow
mailbox there are number of reasons to reject
the request like caller is not permitted,
invalid channel specified in request, flow
not supported in extraction profile and so on.
Hence define new error codes for npc flows and use
them instead of generic error codes.

Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/mbox.h       |  7 +++++++
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 16 ++++++++--------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
index 4470933..3ad10a4 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h
@@ -1078,6 +1078,13 @@ enum npc_af_status {
 	NPC_MCAM_ALLOC_DENIED	= -702,
 	NPC_MCAM_ALLOC_FAILED	= -703,
 	NPC_MCAM_PERM_DENIED	= -704,
+	NPC_FLOW_INTF_INVALID	= -707,
+	NPC_FLOW_CHAN_INVALID	= -708,
+	NPC_FLOW_NO_NIXLF	= -709,
+	NPC_FLOW_NOT_SUPPORTED	= -710,
+	NPC_FLOW_VF_PERM_DENIED	= -711,
+	NPC_FLOW_VF_NOT_INIT	= -712,
+	NPC_FLOW_VF_OVERLAP	= -713,
 };
 
 struct npc_mcam_alloc_entry_req {
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
index 5c01cf4..fd07562 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
@@ -600,7 +600,7 @@ static int npc_check_unsupported_flows(struct rvu *rvu, u64 features, u8 intf)
 		dev_info(rvu->dev, "Unsupported flow(s):\n");
 		for_each_set_bit(bit, (unsigned long *)&unsupported, 64)
 			dev_info(rvu->dev, "%s ", npc_get_field_name(bit));
-		return NIX_AF_ERR_NPC_KEY_NOT_SUPP;
+		return -EOPNOTSUPP;
 	}
 
 	return 0;
@@ -1143,10 +1143,10 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
 	}
 
 	if (!is_npc_interface_valid(rvu, req->intf))
-		return -EINVAL;
+		return NPC_FLOW_INTF_INVALID;
 
 	if (from_vf && req->default_rule)
-		return NPC_MCAM_PERM_DENIED;
+		return NPC_FLOW_VF_PERM_DENIED;
 
 	/* Each PF/VF info is maintained in struct rvu_pfvf.
 	 * rvu_pfvf for the target PF/VF needs to be retrieved
@@ -1172,12 +1172,12 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
 
 	err = npc_check_unsupported_flows(rvu, req->features, req->intf);
 	if (err)
-		return err;
+		return NPC_FLOW_NOT_SUPPORTED;
 
 	/* Skip channel validation if AF is installing */
 	if (!is_pffunc_af(req->hdr.pcifunc) &&
 	    npc_mcam_verify_channel(rvu, target, req->intf, req->channel))
-		return -EINVAL;
+		return NPC_FLOW_CHAN_INVALID;
 
 	pfvf = rvu_get_pfvf(rvu, target);
 
@@ -1195,7 +1195,7 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
 	/* Proceed if NIXLF is attached or not for TX rules */
 	err = nix_get_nixlf(rvu, target, &nixlf, NULL);
 	if (err && is_npc_intf_rx(req->intf) && !pf_set_vfs_mac)
-		return -EINVAL;
+		return NPC_FLOW_NO_NIXLF;
 
 	/* don't enable rule when nixlf not attached or initialized */
 	if (!(is_nixlf_attached(rvu, target) &&
@@ -1211,7 +1211,7 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
 
 	/* Do not allow requests from uninitialized VFs */
 	if (from_vf && !enable)
-		return -EINVAL;
+		return NPC_FLOW_VF_NOT_INIT;
 
 	/* PF sets VF mac & VF NIXLF is not attached, update the mac addr */
 	if (pf_set_vfs_mac && !enable) {
@@ -1226,7 +1226,7 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu,
 	 */
 	if (from_vf && pfvf->def_ucast_rule && is_npc_intf_rx(req->intf) &&
 	    pfvf->def_ucast_rule->features & req->features)
-		return -EINVAL;
+		return NPC_FLOW_VF_OVERLAP;
 
 	return npc_install_flow(rvu, blkaddr, target, nixlf, pfvf, req, rsp,
 				enable, pf_set_vfs_mac);
-- 
2.7.4


  reply	other threads:[~2021-08-17  4:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17  4:44 [net-next PATCH 00/11] octeontx2: Rework MCAM flows management for VFs Subbaraya Sundeep
2021-08-17  4:44 ` Subbaraya Sundeep [this message]
2021-08-17  4:44 ` [net-next PATCH 02/11] octeontx2-af: add proper return codes for AF mailbox handlers Subbaraya Sundeep
2021-08-17  4:44 ` [net-next PATCH 03/11] octeontx2-af: Add debug messages for failures Subbaraya Sundeep
2021-08-17  4:44 ` [net-next PATCH 04/11] octeontx2-pf: Enable NETIF_F_RXALL support for VF driver Subbaraya Sundeep
2021-08-17  4:44 ` [net-next PATCH 05/11] octeontx2-pf: Ntuple filters support for VF netdev Subbaraya Sundeep
2021-08-17  4:44 ` [net-next PATCH 06/11] octeontx2-pf: Sort the allocated MCAM entry indices Subbaraya Sundeep
2021-08-17  4:44 ` [net-next PATCH 07/11] octeontx2-pf: Unify flow management variables Subbaraya Sundeep
2021-08-17  4:44 ` [net-next PATCH 08/11] octeontx2-pf: devlink params support to set mcam entry count Subbaraya Sundeep
2021-08-17  4:44 ` [net-next PATCH 09/11] octeontx2-af: Allocate low priority entries for PF Subbaraya Sundeep
2021-08-17  4:44 ` [net-next PATCH 10/11] octeontx2-af: cn10K: Get NPC counters value Subbaraya Sundeep
2021-08-17  4:44 ` [net-next PATCH 11/11] octeontx2-af: configure npc for cn10k to allow packets from cpt Subbaraya Sundeep
2021-08-17  9:40 ` [net-next PATCH 00/11] octeontx2: Rework MCAM flows management for VFs patchwork-bot+netdevbpf

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=1629175493-4895-2-git-send-email-sbhatta@marvell.com \
    --to=sbhatta@marvell.com \
    --cc=davem@davemloft.net \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sgoutham@marvell.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.