* [PATCH net-next v2] octeontx2-af: Use LMAC_AF_ERR codes in CGX handlers
@ 2026-07-22 4:03 nshettyj
2026-07-27 17:25 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: nshettyj @ 2026-07-22 4:03 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Hariprasad Kelam, Nitin Shetty J, Sunil Goutham, Ratheesh Kannoth,
Geetha sowjanya, Subbaraya Sundeep, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
From: Hariprasad Kelam <hkelam@marvell.com>
When a netdev that is not mapped to a MAC block (cgx/rpm) requests a
MAC feature, the AF driver currently returns generic errors like -EPERM.
Replace these generic error codes with driver-specific LMAC_AF_ERR_*
error codes to provide better debugging information.
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Nitin Shetty J <nshettyj@marvell.com>
---
v2:
- Fix rvu_mbox_handler_cgx_start_linkevents() and
rvu_mbox_handler_cgx_stop_linkevents() to propagate the return value
of rvu_cgx_config_linkevents() to the caller instead of
unconditionally returning 0.
---
.../ethernet/marvell/octeontx2/af/rvu_cgx.c | 26 +++++++++----------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
index 4ff3935ed3fe..61126afefe2b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
@@ -709,7 +709,7 @@ int rvu_mbox_handler_cgx_mac_addr_add(struct rvu *rvu,
int rc = 0;
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
- return -EPERM;
+ return LMAC_AF_ERR_PERM_DENIED;
if (rvu_npc_exact_has_match_table(rvu))
return rvu_npc_exact_mac_addr_add(rvu, req, rsp);
@@ -732,7 +732,7 @@ int rvu_mbox_handler_cgx_mac_addr_del(struct rvu *rvu,
u8 cgx_id, lmac_id;
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
- return -EPERM;
+ return LMAC_AF_ERR_PERM_DENIED;
if (rvu_npc_exact_has_match_table(rvu))
return rvu_npc_exact_mac_addr_del(rvu, req, rsp);
@@ -789,7 +789,7 @@ int rvu_mbox_handler_cgx_promisc_enable(struct rvu *rvu, struct msg_req *req,
u8 cgx_id, lmac_id;
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
- return -EPERM;
+ return LMAC_AF_ERR_PERM_DENIED;
/* Disable drop on non hit rule */
if (rvu_npc_exact_has_match_table(rvu))
@@ -808,7 +808,7 @@ int rvu_mbox_handler_cgx_promisc_disable(struct rvu *rvu, struct msg_req *req,
u8 cgx_id, lmac_id;
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
- return -EPERM;
+ return LMAC_AF_ERR_PERM_DENIED;
/* Disable drop on non hit rule */
if (rvu_npc_exact_has_match_table(rvu))
@@ -877,7 +877,7 @@ static int rvu_cgx_config_linkevents(struct rvu *rvu, u16 pcifunc, bool en)
u8 cgx_id, lmac_id;
if (!is_cgx_config_permitted(rvu, pcifunc))
- return -EPERM;
+ return LMAC_AF_ERR_PERM_DENIED;
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
@@ -895,15 +895,13 @@ static int rvu_cgx_config_linkevents(struct rvu *rvu, u16 pcifunc, bool en)
int rvu_mbox_handler_cgx_start_linkevents(struct rvu *rvu, struct msg_req *req,
struct msg_rsp *rsp)
{
- rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, true);
- return 0;
+ return rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, true);
}
int rvu_mbox_handler_cgx_stop_linkevents(struct rvu *rvu, struct msg_req *req,
struct msg_rsp *rsp)
{
- rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, false);
- return 0;
+ return rvu_cgx_config_linkevents(rvu, req->hdr.pcifunc, false);
}
int rvu_mbox_handler_cgx_get_linkinfo(struct rvu *rvu, struct msg_req *req,
@@ -915,7 +913,7 @@ int rvu_mbox_handler_cgx_get_linkinfo(struct rvu *rvu, struct msg_req *req,
pf = rvu_get_pf(rvu->pdev, req->hdr.pcifunc);
if (!is_pf_cgxmapped(rvu, pf))
- return -ENODEV;
+ return LMAC_AF_ERR_PF_NOT_MAPPED;
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
@@ -975,7 +973,7 @@ static int rvu_cgx_config_intlbk(struct rvu *rvu, u16 pcifunc, bool en)
u8 cgx_id, lmac_id;
if (!is_cgx_config_permitted(rvu, pcifunc))
- return -EPERM;
+ return LMAC_AF_ERR_PERM_DENIED;
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
mac_ops = get_mac_ops(rvu_cgx_pdata(cgx_id, rvu));
@@ -1178,7 +1176,7 @@ int rvu_mbox_handler_cgx_set_fec_param(struct rvu *rvu,
u8 cgx_id, lmac_id;
if (!is_pf_cgxmapped(rvu, pf))
- return -EPERM;
+ return LMAC_AF_ERR_PF_NOT_MAPPED;
if (req->fec == OTX2_FEC_OFF)
req->fec = OTX2_FEC_NONE;
@@ -1197,7 +1195,7 @@ int rvu_mbox_handler_cgx_get_aux_link_info(struct rvu *rvu, struct msg_req *req,
return LMAC_AF_ERR_FIRMWARE_DATA_NOT_MAPPED;
if (!is_pf_cgxmapped(rvu, pf))
- return -EPERM;
+ return LMAC_AF_ERR_PF_NOT_MAPPED;
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
@@ -1226,7 +1224,7 @@ int rvu_mbox_handler_cgx_set_link_mode(struct rvu *rvu,
return LMAC_AF_ERR_FIRMWARE_DATA_NOT_MAPPED;
if (!is_cgx_config_permitted(rvu, req->hdr.pcifunc))
- return -EPERM;
+ return LMAC_AF_ERR_PERM_DENIED;
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_idx, &lmac);
cgxd = rvu_cgx_pdata(cgx_idx, rvu);
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next v2] octeontx2-af: Use LMAC_AF_ERR codes in CGX handlers
2026-07-22 4:03 [PATCH net-next v2] octeontx2-af: Use LMAC_AF_ERR codes in CGX handlers nshettyj
@ 2026-07-27 17:25 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2026-07-27 17:25 UTC (permalink / raw)
To: nshettyj
Cc: netdev, linux-kernel, Hariprasad Kelam, Sunil Goutham,
Ratheesh Kannoth, Geetha sowjanya, Subbaraya Sundeep, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
On Wed, Jul 22, 2026 at 09:33:07AM +0530, nshettyj@marvell.com wrote:
> From: Hariprasad Kelam <hkelam@marvell.com>
>
> When a netdev that is not mapped to a MAC block (cgx/rpm) requests a
> MAC feature, the AF driver currently returns generic errors like -EPERM.
>
> Replace these generic error codes with driver-specific LMAC_AF_ERR_*
> error codes to provide better debugging information.
>
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> Signed-off-by: Nitin Shetty J <nshettyj@marvell.com>
...
> @@ -1178,7 +1176,7 @@ int rvu_mbox_handler_cgx_set_fec_param(struct rvu *rvu,
> u8 cgx_id, lmac_id;
>
> if (!is_pf_cgxmapped(rvu, pf))
> - return -EPERM;
> + return LMAC_AF_ERR_PF_NOT_MAPPED;
Hi,
The AI-generated review of this patch [1] flags a number of pre-existing
issues. Which I think they can be considered in the context of possible
follow-up.
But it also flags that the change on the line above (and other similar
changes in this patch) will result in custom error values being propagated
to user-space. Which seems undesirable.
I think one possible solution is to convert the custom error codes
to standard ones before they are propagated to user-space.
But I'm unsure of the overall effect of that on this patch.
https://sashiko.dev/#/patchset/20260722040307.3393236-1-nshettyj%40marvell.com
>
> if (req->fec == OTX2_FEC_OFF)
> req->fec = OTX2_FEC_NONE;
...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-27 17:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 4:03 [PATCH net-next v2] octeontx2-af: Use LMAC_AF_ERR codes in CGX handlers nshettyj
2026-07-27 17:25 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox