Message ID | 1593701075-14566-1-git-send-email-skalluru@marvell.com |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | [net,1/1] qed: Populate nvm-file attributes while reading nvm config partition. | expand |
On Thu, 2 Jul 2020 20:14:35 +0530 Sudarsana Reddy Kalluru wrote: > NVM config file address will be modified when the MBI image is upgraded. > Driver would return stale config values if user reads the nvm-config > (via ethtool -d) in this state. The fix is to re-populate nvm attribute > info while reading the nvm config values/partition. > > Signed-off-by: Sudarsana Reddy Kalluru <skalluru@marvell.com> > Signed-off-by: Igor Russkikh <irusskikh@marvell.com> Could you provide a Fixes tag?
> -----Original Message----- > From: Jakub Kicinski <kuba@kernel.org> > Sent: Thursday, July 2, 2020 10:10 PM > To: Sudarsana Reddy Kalluru <skalluru@marvell.com> > Cc: davem@davemloft.net; netdev@vger.kernel.org; Ariel Elior > <aelior@marvell.com>; Igor Russkikh <irusskikh@marvell.com>; Michal > Kalderon <mkalderon@marvell.com> > Subject: [EXT] Re: [PATCH net 1/1] qed: Populate nvm-file attributes while > reading nvm config partition. > > External Email > > ---------------------------------------------------------------------- > On Thu, 2 Jul 2020 20:14:35 +0530 Sudarsana Reddy Kalluru wrote: > > NVM config file address will be modified when the MBI image is upgraded. > > Driver would return stale config values if user reads the nvm-config > > (via ethtool -d) in this state. The fix is to re-populate nvm > > attribute info while reading the nvm config values/partition. > > > > Signed-off-by: Sudarsana Reddy Kalluru <skalluru@marvell.com> > > Signed-off-by: Igor Russkikh <irusskikh@marvell.com> > > Could you provide a Fixes tag? Thanks for your review. Will add the fixes tag.
diff --git a/drivers/net/ethernet/qlogic/qed/qed_debug.c b/drivers/net/ethernet/qlogic/qed/qed_debug.c index f4eebaa..a1270fd 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_debug.c +++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c @@ -7930,6 +7930,10 @@ int qed_dbg_all_data(struct qed_dev *cdev, void *buffer) DP_ERR(cdev, "qed_dbg_mcp_trace failed. rc = %d\n", rc); } + /* Re-populate nvm attribute info */ + qed_mcp_nvm_info_free(p_hwfn); + qed_mcp_nvm_info_populate(p_hwfn); + /* nvm cfg1 */ rc = qed_dbg_nvm_image(cdev, (u8 *)buffer + offset + diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c index 38a65b9..0331cce 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dev.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c @@ -4461,12 +4461,6 @@ static int qed_get_dev_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) return 0; } -static void qed_nvm_info_free(struct qed_hwfn *p_hwfn) -{ - kfree(p_hwfn->nvm_info.image_att); - p_hwfn->nvm_info.image_att = NULL; -} - static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn, void __iomem *p_regview, void __iomem *p_doorbells, @@ -4551,7 +4545,7 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn, return rc; err3: if (IS_LEAD_HWFN(p_hwfn)) - qed_nvm_info_free(p_hwfn); + qed_mcp_nvm_info_free(p_hwfn); err2: if (IS_LEAD_HWFN(p_hwfn)) qed_iov_free_hw_info(p_hwfn->cdev); @@ -4612,7 +4606,7 @@ int qed_hw_prepare(struct qed_dev *cdev, if (rc) { if (IS_PF(cdev)) { qed_init_free(p_hwfn); - qed_nvm_info_free(p_hwfn); + qed_mcp_nvm_info_free(p_hwfn); qed_mcp_free(p_hwfn); qed_hw_hwfn_free(p_hwfn); } @@ -4646,7 +4640,7 @@ void qed_hw_remove(struct qed_dev *cdev) qed_iov_free_hw_info(cdev); - qed_nvm_info_free(p_hwfn); + qed_mcp_nvm_info_free(p_hwfn); } static void qed_chain_free_next_ptr(struct qed_dev *cdev, diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c index 280527c..99548d5 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c +++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c @@ -3151,6 +3151,13 @@ int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn) return rc; } +void qed_mcp_nvm_info_free(struct qed_hwfn *p_hwfn) +{ + kfree(p_hwfn->nvm_info.image_att); + p_hwfn->nvm_info.image_att = NULL; + p_hwfn->nvm_info.valid = false; +} + int qed_mcp_get_nvm_image_att(struct qed_hwfn *p_hwfn, enum qed_nvm_images image_id, diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.h b/drivers/net/ethernet/qlogic/qed/qed_mcp.h index 9c4c276..e382973 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_mcp.h +++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.h @@ -1193,6 +1193,13 @@ void qed_mcp_resc_lock_default_init(struct qed_resc_lock_params *p_lock, int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn); /** + * @brief Delete nvm info shadow in the given hardware function + * + * @param p_hwfn + */ +void qed_mcp_nvm_info_free(struct qed_hwfn *p_hwfn); + +/** * @brief Get the engine affinity configuration. * * @param p_hwfn