octeontx2-pf: handle otx2_mbox_get_rsp errors
v4 cover octeontx2-pf: handle otx2_mbox_get_rsp errors
This patch series improves error handling in the Marvell OcteonTX2 NIC driver. Specifically, it adds error pointer checks after otx2_mbox_get_rsp() to ensure the driver handles error cases more gracefully.
Changes in v4:
- Patch series thrading fixed.
- Error handling changed in otx2_flows.c.
- Used correct To: and CC:
Changes in v3:
- Created a patch-set as per the feedback
- Corrected patch subject
- Added error handling in the new files
Dipendra Khadka (6):
octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_common.c
octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_ethtool.c
octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c
octeontx2-pf: handle otx2_mbox_get_rsp errors in cn10k.c
octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dmac_flt.c
octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dcbnl.c
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 5 +++++ .../net/ethernet/marvell/octeontx2/nic/otx2_common.c | 4 ++++ .../net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c | 5 +++++ .../net/ethernet/marvell/octeontx2/nic/otx2_dmac_flt.c | 9 +++++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 10 ++++++++++ .../net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 10 ++++++++++ 6 files changed, 43 insertions(+)
--
2.43.0
PATCH v4 1/6 octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_common.c
Add error pointer check after calling otx2_mbox_get_rsp().
---
v4:
- Sent for patch version consistency.
v3:https://lore.kernel.org/all/[email protected]/
- Included in the patch set
- Changed the patch subject
v2: https://lore.kernel.org/all/[email protected]/
- Added Fixes: tag.
- Changed the return logic to follow the existing return path.
v1: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +4 -0
@@ -1837,6 +1837,10 @@ u16 otx2_get_max_mtu(struct otx2_nic *pfvf)if (!rc) { rsp = (struct nix_hw_info *)otx2_mbox_get_rsp (&pfvf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) { + rc =PTR_ERR (rsp); + goto out; + }/* HW counts VLAN insertion bytes (8 for double tag) * irrespective of whether SQE is requesting to insert VLAN
Signature · 1 line
2.43.0
Re: [PATCH v4 1/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_common.c
Quoted 36 lines · Dipendra Khadka
Add error pointer check after calling
otx2_mbox_get_rsp().Fixes ab58a416c93f ("octeontx2-pf: cn10k: Get max mtu supported from admin function")Signed-off-by Dipendra Khadka <[email protected]>---
v4:
- Sent for patch version consistency.
v3:https://lore.kernel.org/all/[email protected]/
- Included in the patch set
- Changed the patch subject
v2: https://lore.kernel.org/all/[email protected]/
- Added Fixes: tag.
- Changed the return logic to follow the existing return path.
v1: https://lore.kernel.org/all/[email protected]/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +4
-1@@ -1837,6 +1837,10 @@ u16 otx2_get_max_mtu(struct otx2_nic *pfvf)if (!rc) { rsp = (struct nix_hw_info *)otx2_mbox_get_rsp (&pfvf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) { + rc =PTR_ERR (rsp); + goto out; + }/* HW counts VLAN insertion bytes (8 for double tag) * irrespective of whether SQE is requesting to insert VLAN -- 2.43.0
Re: [PATCH v4 1/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_common.c
In reply to Dipendra KhadkaQuoted 4 lines · Dipendra Khadka
Add error pointer check after calling
otx2_mbox_get_rsp().Fixes ab58a416c93f ("octeontx2-pf: cn10k: Get max mtu supported from admin function")Signed-off-by Dipendra Khadka <[email protected]>
PATCH v4 2/6 octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_ethtool.c
In reply to Dipendra KhadkaAdd error pointer check after calling otx2_mbox_get_rsp().
---
v4:
- Sent for patch version consistenct.
v3: https://lore.kernel.org/all/[email protected]/
- Included in the patch set
- Changed the patch subject
- Added Fixes: tag
v2: Skipped for consitency in the patch set
v1: https://lore.kernel.org/all/[email protected]/
.../net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +10 -0
@@ -343,6 +343,11 @@ static void otx2_get_pauseparam(struct net_device *netdev,if (!otx2_sync_mbox_msg (&pfvf->mbox)) { rsp = (struct cgx_pause_frm_cfg *)otx2_mbox_get_rsp (&pfvf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) { +mutex_unlock (&pfvf->mbox.lock); +return ; + } + pause->rx_pause = rsp->rx_pause; pause->tx_pause = rsp->tx_pause; }
@@ -1072,6 +1077,11 @@ static int otx2_set_fecparam(struct net_device *netdev, rsp = (struct fec_mode *)otx2_mbox_get_rsp (&pfvf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) { + err =PTR_ERR (rsp); + goto end; + } +if (rsp->fec >=0 ) pfvf->linfo.fec = rsp->fec;else
Signature · 1 line
2.43.0
Re: [PATCH v4 2/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_ethtool.c
Quoted 5 lines · Dipendra Khadka
Add error pointer check after calling
otx2_mbox_get_rsp().Fixes 75f36270990c ("octeontx2-pf: Support to enable/disable pause frames via ethtool")Fixes d0cf9503e908 ("octeontx2-pf: ethtool fec mode support")Signed-off-by Dipendra Khadka <[email protected]>
PATCH v4 3/6 octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c
In reply to Dipendra KhadkaAdding error pointer check after calling otx2_mbox_get_rsp().
---
v4:
- removed unnecessary line "allocated = PTR_ERR(rsp);"
v3: https://lore.kernel.org/all/[email protected]/
- Included in the patch set
- Changed patch subject
- Added Fixes: tag
v2: https://lore.kernel.org/all/[email protected]/
- Changed the subject to net
- Changed the typo of the variable from bfvp to pfvf
v1: https://lore.kernel.org/all/[email protected]/
.../net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +10 -0
@@ -119,6 +119,8 @@ int otx2_alloc_mcam_entries(struct otx2_nic *pfvf, u16 count) rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp (&pfvf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) + goto exit;for (ent =0 ; ent < rsp->count; ent++) flow_cfg->flow_ent[ent + allocated] = rsp->entry_list[ent];
@@ -197,6 +199,10 @@ int otx2_mcam_entry_init(struct otx2_nic *pfvf) rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp (&pfvf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) { +mutex_unlock (&pfvf->mbox.lock); +return PTR_ERR (rsp); + }if (rsp->count != req->count) { netdev_info(pfvf->netdev,
@@ -232,6 +238,10 @@ int otx2_mcam_entry_init(struct otx2_nic *pfvf) frsp = (struct npc_get_field_status_rsp *)otx2_mbox_get_rsp (&pfvf->mbox.mbox,0 , &freq->hdr); +if (IS_ERR (frsp)) { +mutex_unlock (&pfvf->mbox.lock); +return PTR_ERR (frsp); + }if (frsp->enable) { pfvf->flags |=OTX2_FLAG_RX_VLAN_SUPPORT ;
Signature · 1 line
2.43.0
Re: [PATCH v4 3/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c
Quoted 6 lines · Dipendra Khadka
Adding error pointer check after calling
otx2_mbox_get_rsp().Fixes 9917060fc30a ("octeontx2-pf: Cleanup flow rule management")Fixes f0a1913f8a6f ("octeontx2-pf: Add support for ethtool ntuple filters")Fixes 674b3e164238 ("octeontx2-pf: Add additional checks while configuring ucast/bcast/mcast rules")Signed-off-by Dipendra Khadka <[email protected]>
PATCH v4 4/6 octeontx2-pf: handle otx2_mbox_get_rsp errors in cn10k.c
In reply to Dipendra KhadkaAdd error pointer check after calling otx2_mbox_get_rsp().
--- drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c +5 -0
@@ -203,6 +203,11 @@ int cn10k_alloc_leaf_profile(struct otx2_nic *pfvf, u16 *leaf) rsp = (struct nix_bandprof_alloc_rsp *)otx2_mbox_get_rsp (&pfvf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) { + rc =PTR_ERR (rsp); + goto out; + } +if (!rsp->prof_count[BAND_PROF_LEAF_LAYER ]) { rc = -EIO ; goto out;
Signature · 1 line
2.43.0
Re: [PATCH v4 4/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in cn10k.c
Quoted 4 lines · Dipendra Khadka
Add error pointer check after calling
otx2_mbox_get_rsp().Fixes 2ca89a2c3752 ("octeontx2-pf: TC_MATCHALL ingress ratelimiting offload")Signed-off-by Dipendra Khadka <[email protected]>
PATCH v4 5/6 octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dmac_flt.c
In reply to Dipendra KhadkaAdd error pointer checks after calling otx2_mbox_get_rsp().
---
v4:
- Sent for patch series consistency.
v3: https://lore.kernel.org/all/[email protected]/
.../net/ethernet/marvell/octeontx2/nic/otx2_dmac_flt.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_dmac_flt.c +9 -0
@@ -28,6 +28,11 @@ static int otx2_dmacflt_do_add(struct otx2_nic *pf, const u8 *mac,if (!err) { rsp = (struct cgx_mac_addr_add_rsp *)otx2_mbox_get_rsp (&pf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) { +mutex_unlock (&pf->mbox.lock); +return PTR_ERR (rsp); + } + *dmac_index = rsp->index; }
@@ -200,6 +205,10 @@ int otx2_dmacflt_update(struct otx2_nic *pf, u8 *mac, u32 bit_pos) rsp = (struct cgx_mac_addr_update_rsp *)otx2_mbox_get_rsp (&pf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) { + rc =PTR_ERR (rsp); + goto out; + } pf->flow_cfg->bmap_to_dmacindex[bit_pos] = rsp->index;
Signature · 1 line
2.43.0
Re: [PATCH v4 5/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dmac_flt.c
Quoted 5 lines · Dipendra Khadka
Add error pointer checks after calling
otx2_mbox_get_rsp().Fixes 79d2be385e9e ("octeontx2-pf: offload DMAC filters to CGX/RPM block")Fixes fa5e0ccb8f3a ("octeontx2-pf: Add support for exact match table.")Signed-off-by Dipendra Khadka <[email protected]>
PATCH v4 6/6 octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dcbnl.c
In reply to Dipendra KhadkaAdd error pointer check after calling otx2_mbox_get_rsp().
---
v4:
- Changed Fixes commit has to 12 count.
v3: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c +5 -0
@@ -315,6 +315,11 @@ int otx2_config_priority_flow_ctrl(struct otx2_nic *pfvf)if (!otx2_sync_mbox_msg (&pfvf->mbox)) { rsp = (struct cgx_pfc_rsp *)otx2_mbox_get_rsp (&pfvf->mbox.mbox,0 , &req->hdr); +if (IS_ERR (rsp)) { + err =PTR_ERR (rsp); + goto unlock; + } +if (req->rx_pause != rsp->rx_pause || req->tx_pause != rsp->tx_pause) {dev_warn (pfvf->dev,"Failed to config PFC\n" );
Signature · 1 line
2.43.0
Re: [PATCH v4 6/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dcbnl.c
Quoted 4 lines · Dipendra Khadka
Add error pointer check after calling
otx2_mbox_get_rsp().Fixes 8e67558177f8 ("octeontx2-pf: PFC config support with DCBx")Signed-off-by Dipendra Khadka <[email protected]>
This series was applied to netdev/net-next.git (main) by Andrew Lunn <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Andrew Lunn <[email protected]>:
Quoted 11 lines · On Thu, 17 Oct 2024 18:51:15 +0000 you wrote:
This patch series improves error handling in the Marvell OcteonTX2 NIC driver. Specifically, it adds error pointer checks after
otx2_mbox_get_rsp()to ensure the driver handles error cases more gracefully.Changes in v4:
- Patch series thrading fixed.
- Error handling changed inotx2_flows.c.
- Used correct To: and CC:[...]
Here is the summary with links:
- [v4,1/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_common.c
https://git.kernel.org/netdev/net-next/c/0fbc7a5027c6 - [v4,2/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_ethtool.c https://git.kernel.org/netdev/net-next/c/e26f8eac6bb2 - [v4,3/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c https://git.kernel.org/netdev/net-next/c/bd3110bc102a - [v4,4/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in cn10k.c https://git.kernel.org/netdev/net-next/c/ac9183023b6a - [v4,5/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dmac_flt.c https://git.kernel.org/netdev/net-next/c/f5b942e6c54b - [v4,6/6] octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_dcbnl.c https://git.kernel.org/netdev/net-next/c/69297b0d3369
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html