Skip to content

Commit 6bc82d9

Browse files
Michal Kalderondavem330
authored andcommitted
qed: rt init valid initialization changed
The QM phase init tool can be invoked multiple times during the driver lifetime. Part of the init comes from the runtime array. The logic for setting the values did not init all values, basically assuming the runtime array was all zeroes. But if it was invoked multiple times, nobody was zeroing it after the first time. In this change we zero the runtime array right after using it. Signed-off-by: Ariel Elior <[email protected]> Signed-off-by: Michal Kalderon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8a52bba commit 6bc82d9

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,9 +2106,6 @@ int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
21062106
if (!b_rc)
21072107
return -EINVAL;
21082108

2109-
/* clear the QM_PF runtime phase leftovers from previous init */
2110-
qed_init_clear_rt_data(p_hwfn);
2111-
21122109
/* prepare QM portion of runtime array */
21132110
qed_qm_init_pf(p_hwfn, p_ptt, false);
21142111

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ void qed_init_iro_array(struct qed_dev *cdev)
7474
cdev->iro_arr = iro_arr;
7575
}
7676

77-
/* Runtime configuration helpers */
78-
void qed_init_clear_rt_data(struct qed_hwfn *p_hwfn)
79-
{
80-
int i;
81-
82-
for (i = 0; i < RUNTIME_ARRAY_SIZE; i++)
83-
p_hwfn->rt_data.b_valid[i] = false;
84-
}
85-
8677
void qed_init_store_rt_reg(struct qed_hwfn *p_hwfn, u32 rt_offset, u32 val)
8778
{
8879
p_hwfn->rt_data.init_val[rt_offset] = val;
@@ -106,7 +97,7 @@ static int qed_init_rt(struct qed_hwfn *p_hwfn,
10697
{
10798
u32 *p_init_val = &p_hwfn->rt_data.init_val[rt_offset];
10899
bool *p_valid = &p_hwfn->rt_data.b_valid[rt_offset];
109-
u16 i, segment;
100+
u16 i, j, segment;
110101
int rc = 0;
111102

112103
/* Since not all RT entries are initialized, go over the RT and
@@ -121,6 +112,7 @@ static int qed_init_rt(struct qed_hwfn *p_hwfn,
121112
*/
122113
if (!b_must_dmae) {
123114
qed_wr(p_hwfn, p_ptt, addr + (i << 2), p_init_val[i]);
115+
p_valid[i] = false;
124116
continue;
125117
}
126118

@@ -135,6 +127,10 @@ static int qed_init_rt(struct qed_hwfn *p_hwfn,
135127
if (rc)
136128
return rc;
137129

130+
/* invalidate after writing */
131+
for (j = i; j < i + segment; j++)
132+
p_valid[j] = false;
133+
138134
/* Jump over the entire segment, including invalid entry */
139135
i += segment;
140136
}

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,6 @@ int qed_init_alloc(struct qed_hwfn *p_hwfn);
8080
*/
8181
void qed_init_free(struct qed_hwfn *p_hwfn);
8282

83-
/**
84-
* @brief qed_init_clear_rt_data - Clears the runtime init array.
85-
*
86-
*
87-
* @param p_hwfn
88-
*/
89-
void qed_init_clear_rt_data(struct qed_hwfn *p_hwfn);
90-
9183
/**
9284
* @brief qed_init_store_rt_reg - Store a configuration value in the RT array.
9385
*

0 commit comments

Comments
 (0)