Message ID | 20230817112357.25874-5-hkelam@marvell.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | octeontx2-af: misc MAC block changes | expand |
On Thu, 17 Aug 2023 16:53:56 +0530 Hariprasad Kelam wrote: > currently, if any netdev is not mapped to the MAC block(cgx/rpm) > requests MAC feature, AF driver returns a generic error like -EPERM. > This patch replaces generic error codes with driver-specific error > codes for better debugging The custom error codes are not liked upstream, they make much harder for people who don't work on the driver to refactor it. If you want debugging isn't it better to add a tracepoint to the checks?
> ---------------------------------------------------------------------- > On Thu, 17 Aug 2023 16:53:56 +0530 Hariprasad Kelam wrote: > > currently, if any netdev is not mapped to the MAC block(cgx/rpm) > > requests MAC feature, AF driver returns a generic error like -EPERM. > > This patch replaces generic error codes with driver-specific error > > codes for better debugging > > The custom error codes are not liked upstream, they make much harder for > people who don't work on the driver to refactor it. > > If you want debugging isn't it better to add a tracepoint to the checks? Hari>> These error codes are added in AF mailbox handlers, user space tools like ethool ,tc won't see these since these are between pf netdev and AF. During netdev driver probe/open calls, it requests AF driver to configure different hardware blocks MAC/network etc. If there is any error instead of getting EPERM, we will get block specific error codes like LMAC_AF_ERR_INVALID_PARAM, NIX_AF_ERR_PARAM etc. Thanks, Hariprasad k > -- > pw-bot: cr
> -----Original Message----- > From: Hariprasad Kelam > Sent: Sunday, August 20, 2023 9:42 AM > To: Jakub Kicinski <kuba@kernel.org> > Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; > davem@davemloft.net; Sunil Kovvuri Goutham <sgoutham@marvell.com>; > Geethasowjanya Akula <gakula@marvell.com>; Jerin Jacob Kollanukkaran > <jerinj@marvell.com>; Linu Cherian <lcherian@marvell.com>; Subbaraya > Sundeep Bhatta <sbhatta@marvell.com>; Naveen Mamindlapalli > <naveenm@marvell.com>; edumazet@google.com; pabeni@redhat.com > Subject: Re: [net-next Patch 4/5] octeontx2-af: replace generic error codes > > > > > ---------------------------------------------------------------------- > > On Thu, 17 Aug 2023 16:53:56 +0530 Hariprasad Kelam wrote: > > > currently, if any netdev is not mapped to the MAC block(cgx/rpm) > > > requests MAC feature, AF driver returns a generic error like -EPERM. > > > This patch replaces generic error codes with driver-specific error > > > codes for better debugging > > > > The custom error codes are not liked upstream, they make much harder > > for people who don't work on the driver to refactor it. > > > > If you want debugging isn't it better to add a tracepoint to the checks? > > Hari>> These error codes are added in AF mailbox handlers, user space tools > like ethool ,tc won't see these since these are between pf netdev and AF. > During netdev driver probe/open calls, it requests AF driver to configure > different hardware blocks MAC/network etc. If there is any error instead of > getting EPERM, we will get block specific error codes like > LMAC_AF_ERR_INVALID_PARAM, NIX_AF_ERR_PARAM etc. Jakub, Any comments here? > > Thanks, > Hariprasad k > > -- > > pw-bot: cr
On Thu, 24 Aug 2023 05:41:01 +0000 Hariprasad Kelam wrote: > > > The custom error codes are not liked upstream, they make much harder > > > for people who don't work on the driver to refactor it. > > > > > > If you want debugging isn't it better to add a tracepoint to the checks? > > > > Hari>> These error codes are added in AF mailbox handlers, user space tools > > like ethool ,tc won't see these since these are between pf netdev and AF. > > During netdev driver probe/open calls, it requests AF driver to configure > > different hardware blocks MAC/network etc. If there is any error instead of > > getting EPERM, we will get block specific error codes like > > LMAC_AF_ERR_INVALID_PARAM, NIX_AF_ERR_PARAM etc. > > Jakub, > Any comments here? Please learn how to use email correctly. Hari>> Makes the entire line rendered as a quote in many email clients, because the gt than sign is a quote marker. You should also wrap your lines. If you want to return the block which failed to the caller you can do that, but not instead of the error code.
> On Thu, 24 Aug 2023 05:41:01 +0000 Hariprasad Kelam wrote: > > > > The custom error codes are not liked upstream, they make much > > > > harder for people who don't work on the driver to refactor it. > > > > > > > > If you want debugging isn't it better to add a tracepoint to the checks? > > > > > > Hari>> These error codes are added in AF mailbox handlers, user > > > Hari>> space tools > > > like ethool ,tc won't see these since these are between pf netdev and > AF. > > > During netdev driver probe/open calls, it requests AF driver to > > > configure different hardware blocks MAC/network etc. If there is any > > > error instead of getting EPERM, we will get block specific error > > > codes like LMAC_AF_ERR_INVALID_PARAM, NIX_AF_ERR_PARAM etc. > > > > Jakub, > > Any comments here? > > Please learn how to use email correctly. > > Hari>> > > Makes the entire line rendered as a quote in many email clients, because the > gt than sign is a quote marker. ACK > > You should also wrap your lines. > > If you want to return the block which failed to the caller you can do that, but > not instead of the error code. Ok, will remove this patch from the series. Thanks, Hariprasad k
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c index 4e3aec7bdbee..c96a94303a54 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c @@ -600,7 +600,7 @@ int rvu_mbox_handler_cgx_mac_addr_set(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_set(rvu, req, rsp); @@ -621,7 +621,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); @@ -644,7 +644,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); @@ -690,7 +690,7 @@ int rvu_mbox_handler_cgx_mac_addr_get(struct rvu *rvu, u64 cfg; 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_id, &lmac_id); @@ -709,7 +709,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)) @@ -728,7 +728,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)) @@ -798,7 +798,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); @@ -836,7 +836,7 @@ int rvu_mbox_handler_cgx_get_linkinfo(struct rvu *rvu, struct msg_req *req, pf = rvu_get_pf(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); @@ -897,7 +897,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_PF_NOT_MAPPED; rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); mac_ops = get_mac_ops(rvu_cgx_pdata(cgx_id, rvu)); @@ -1100,7 +1100,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_PERM_DENIED; if (req->fec == OTX2_FEC_OFF) req->fec = OTX2_FEC_NONE; @@ -1119,7 +1119,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_PERM_DENIED; rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); @@ -1144,7 +1144,7 @@ int rvu_mbox_handler_cgx_set_link_mode(struct rvu *rvu, void *cgxd; 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);