Skip to content

Commit 13cf8aa

Browse files
Sudarsana Reddy Kallurudavem330
authored andcommitted
qed: Populate nvm-file attributes while reading nvm config partition.
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. Changes from previous version: ------------------------------- v3: Corrected the formatting in 'Fixes' tag. v2: Added 'Fixes' tag. Fixes: 1ac4329 ("qed: Add configuration information to register dump and debug data") Signed-off-by: Sudarsana Reddy Kalluru <[email protected]> Signed-off-by: Igor Russkikh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 76c4d85 commit 13cf8aa

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

drivers/net/ethernet/qlogic/qed/qed_debug.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7941,6 +7941,10 @@ int qed_dbg_all_data(struct qed_dev *cdev, void *buffer)
79417941
DP_ERR(cdev, "qed_dbg_mcp_trace failed. rc = %d\n", rc);
79427942
}
79437943

7944+
/* Re-populate nvm attribute info */
7945+
qed_mcp_nvm_info_free(p_hwfn);
7946+
qed_mcp_nvm_info_populate(p_hwfn);
7947+
79447948
/* nvm cfg1 */
79457949
rc = qed_dbg_nvm_image(cdev,
79467950
(u8 *)buffer + offset +

drivers/net/ethernet/qlogic/qed/qed_dev.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4472,12 +4472,6 @@ static int qed_get_dev_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
44724472
return 0;
44734473
}
44744474

4475-
static void qed_nvm_info_free(struct qed_hwfn *p_hwfn)
4476-
{
4477-
kfree(p_hwfn->nvm_info.image_att);
4478-
p_hwfn->nvm_info.image_att = NULL;
4479-
}
4480-
44814475
static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn,
44824476
void __iomem *p_regview,
44834477
void __iomem *p_doorbells,
@@ -4562,7 +4556,7 @@ static int qed_hw_prepare_single(struct qed_hwfn *p_hwfn,
45624556
return rc;
45634557
err3:
45644558
if (IS_LEAD_HWFN(p_hwfn))
4565-
qed_nvm_info_free(p_hwfn);
4559+
qed_mcp_nvm_info_free(p_hwfn);
45664560
err2:
45674561
if (IS_LEAD_HWFN(p_hwfn))
45684562
qed_iov_free_hw_info(p_hwfn->cdev);
@@ -4623,7 +4617,7 @@ int qed_hw_prepare(struct qed_dev *cdev,
46234617
if (rc) {
46244618
if (IS_PF(cdev)) {
46254619
qed_init_free(p_hwfn);
4626-
qed_nvm_info_free(p_hwfn);
4620+
qed_mcp_nvm_info_free(p_hwfn);
46274621
qed_mcp_free(p_hwfn);
46284622
qed_hw_hwfn_free(p_hwfn);
46294623
}
@@ -4657,7 +4651,7 @@ void qed_hw_remove(struct qed_dev *cdev)
46574651

46584652
qed_iov_free_hw_info(cdev);
46594653

4660-
qed_nvm_info_free(p_hwfn);
4654+
qed_mcp_nvm_info_free(p_hwfn);
46614655
}
46624656

46634657
static void qed_chain_free_next_ptr(struct qed_dev *cdev,

drivers/net/ethernet/qlogic/qed/qed_mcp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3280,6 +3280,13 @@ int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn)
32803280
return rc;
32813281
}
32823282

3283+
void qed_mcp_nvm_info_free(struct qed_hwfn *p_hwfn)
3284+
{
3285+
kfree(p_hwfn->nvm_info.image_att);
3286+
p_hwfn->nvm_info.image_att = NULL;
3287+
p_hwfn->nvm_info.valid = false;
3288+
}
3289+
32833290
int
32843291
qed_mcp_get_nvm_image_att(struct qed_hwfn *p_hwfn,
32853292
enum qed_nvm_images image_id,

drivers/net/ethernet/qlogic/qed/qed_mcp.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,13 @@ void qed_mcp_read_ufp_config(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
12201220
*/
12211221
int qed_mcp_nvm_info_populate(struct qed_hwfn *p_hwfn);
12221222

1223+
/**
1224+
* @brief Delete nvm info shadow in the given hardware function
1225+
*
1226+
* @param p_hwfn
1227+
*/
1228+
void qed_mcp_nvm_info_free(struct qed_hwfn *p_hwfn);
1229+
12231230
/**
12241231
* @brief Get the engine affinity configuration.
12251232
*

0 commit comments

Comments
 (0)