Skip to content

Commit ccd7c7c

Browse files
solbjorndavem330
authored andcommitted
net: qed: fix NVMe login fails over VFs
25ms sleep cycles in waiting for PF response are excessive and may lead to different timeout failures. Start to wait with short udelays, and in most cases polling will end here. If the time was not sufficient, switch to msleeps. usleep_range() may go far beyond 100us depending on platform and tick configuration, hence atomic udelays for consistency. Also add explicit DMA barriers since 'done' always comes from a shared request-response DMA pool, and note that in the comment nearby. Fixes: 1408cc1 ("qed: Introduce VFs") Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: Igor Russkikh <[email protected]> Signed-off-by: Michal Kalderon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4079c7f commit ccd7c7c

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,17 @@ static void qed_vf_pf_req_end(struct qed_hwfn *p_hwfn, int req_status)
8181
mutex_unlock(&(p_hwfn->vf_iov_info->mutex));
8282
}
8383

84+
#define QED_VF_CHANNEL_USLEEP_ITERATIONS 90
85+
#define QED_VF_CHANNEL_USLEEP_DELAY 100
86+
#define QED_VF_CHANNEL_MSLEEP_ITERATIONS 10
87+
#define QED_VF_CHANNEL_MSLEEP_DELAY 25
88+
8489
static int qed_send_msg2pf(struct qed_hwfn *p_hwfn, u8 *done, u32 resp_size)
8590
{
8691
union vfpf_tlvs *p_req = p_hwfn->vf_iov_info->vf2pf_request;
8792
struct ustorm_trigger_vf_zone trigger;
8893
struct ustorm_vf_zone *zone_data;
89-
int rc = 0, time = 100;
94+
int iter, rc = 0;
9095

9196
zone_data = (struct ustorm_vf_zone *)PXP_VF_BAR0_START_USDM_ZONE_B;
9297

@@ -126,11 +131,19 @@ static int qed_send_msg2pf(struct qed_hwfn *p_hwfn, u8 *done, u32 resp_size)
126131
REG_WR(p_hwfn, (uintptr_t)&zone_data->trigger, *((u32 *)&trigger));
127132

128133
/* When PF would be done with the response, it would write back to the
129-
* `done' address. Poll until then.
134+
* `done' address from a coherent DMA zone. Poll until then.
130135
*/
131-
while ((!*done) && time) {
132-
msleep(25);
133-
time--;
136+
137+
iter = QED_VF_CHANNEL_USLEEP_ITERATIONS;
138+
while (!*done && iter--) {
139+
udelay(QED_VF_CHANNEL_USLEEP_DELAY);
140+
dma_rmb();
141+
}
142+
143+
iter = QED_VF_CHANNEL_MSLEEP_ITERATIONS;
144+
while (!*done && iter--) {
145+
msleep(QED_VF_CHANNEL_MSLEEP_DELAY);
146+
dma_rmb();
134147
}
135148

136149
if (!*done) {

0 commit comments

Comments
 (0)