Skip to content

Commit 2f44f75

Browse files
committed
Merge branch 'qed-fixes'
Yuval Mintz says: ==================== qed: Bug fixes Patch #1 addresses a day-one race which is dependent on the number of Vfs [I.e., more child VFs from a single PF make it more probable]. Patch #2 corrects a race that got introduced in the last set of fixes for qed, one that would happen each time PF transitions to UP state. I've built & tested those against current net-next. Please consider applying the series there. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 4ca257e + 6f437d4 commit 2f44f75

File tree

5 files changed

+34
-22
lines changed

5 files changed

+34
-22
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,9 @@ static inline u8 qed_concrete_to_sw_fid(struct qed_dev *cdev,
688688
#define OOO_LB_TC 9
689689

690690
int qed_configure_vport_wfq(struct qed_dev *cdev, u16 vp_id, u32 rate);
691-
void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, u32 min_pf_rate);
691+
void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev,
692+
struct qed_ptt *p_ptt,
693+
u32 min_pf_rate);
692694

693695
void qed_clean_wfq_db(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
694696
#define QED_LEADING_HWFN(dev) (&dev->hwfns[0])

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3198,7 +3198,8 @@ int qed_configure_vport_wfq(struct qed_dev *cdev, u16 vp_id, u32 rate)
31983198
}
31993199

32003200
/* API to configure WFQ from mcp link change */
3201-
void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, u32 min_pf_rate)
3201+
void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev,
3202+
struct qed_ptt *p_ptt, u32 min_pf_rate)
32023203
{
32033204
int i;
32043205

@@ -3212,8 +3213,7 @@ void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, u32 min_pf_rate)
32123213
for_each_hwfn(cdev, i) {
32133214
struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
32143215

3215-
__qed_configure_vp_wfq_on_link_change(p_hwfn,
3216-
p_hwfn->p_dpc_ptt,
3216+
__qed_configure_vp_wfq_on_link_change(p_hwfn, p_ptt,
32173217
min_pf_rate);
32183218
}
32193219
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,8 @@ static void qed_mcp_handle_link_change(struct qed_hwfn *p_hwfn,
679679

680680
/* Min bandwidth configuration */
681681
__qed_configure_pf_min_bandwidth(p_hwfn, p_ptt, p_link, min_bw);
682-
qed_configure_vp_wfq_on_link_change(p_hwfn->cdev, p_link->min_pf_rate);
682+
qed_configure_vp_wfq_on_link_change(p_hwfn->cdev, p_ptt,
683+
p_link->min_pf_rate);
683684

684685
p_link->an = !!(status & LINK_STATUS_AUTO_NEGOTIATE_ENABLED);
685686
p_link->an_complete = !!(status &

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

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,8 +3014,7 @@ qed_iov_execute_vf_flr_cleanup(struct qed_hwfn *p_hwfn,
30143014
ack_vfs[vfid / 32] |= BIT((vfid % 32));
30153015
p_hwfn->pf_iov_info->pending_flr[rel_vf_id / 64] &=
30163016
~(1ULL << (rel_vf_id % 64));
3017-
p_hwfn->pf_iov_info->pending_events[rel_vf_id / 64] &=
3018-
~(1ULL << (rel_vf_id % 64));
3017+
p_vf->vf_mbx.b_pending_msg = false;
30193018
}
30203019

30213020
return rc;
@@ -3128,11 +3127,20 @@ static void qed_iov_process_mbx_req(struct qed_hwfn *p_hwfn,
31283127
mbx = &p_vf->vf_mbx;
31293128

31303129
/* qed_iov_process_mbx_request */
3131-
DP_VERBOSE(p_hwfn, QED_MSG_IOV,
3132-
"VF[%02x]: Processing mailbox message\n", p_vf->abs_vf_id);
3130+
if (!mbx->b_pending_msg) {
3131+
DP_NOTICE(p_hwfn,
3132+
"VF[%02x]: Trying to process mailbox message when none is pending\n",
3133+
p_vf->abs_vf_id);
3134+
return;
3135+
}
3136+
mbx->b_pending_msg = false;
31333137

31343138
mbx->first_tlv = mbx->req_virt->first_tlv;
31353139

3140+
DP_VERBOSE(p_hwfn, QED_MSG_IOV,
3141+
"VF[%02x]: Processing mailbox message [type %04x]\n",
3142+
p_vf->abs_vf_id, mbx->first_tlv.tl.type);
3143+
31363144
/* check if tlv type is known */
31373145
if (qed_iov_tlv_supported(mbx->first_tlv.tl.type) &&
31383146
!p_vf->b_malicious) {
@@ -3219,20 +3227,19 @@ static void qed_iov_process_mbx_req(struct qed_hwfn *p_hwfn,
32193227
}
32203228
}
32213229

3222-
static void qed_iov_pf_add_pending_events(struct qed_hwfn *p_hwfn, u8 vfid)
3230+
void qed_iov_pf_get_pending_events(struct qed_hwfn *p_hwfn, u64 *events)
32233231
{
3224-
u64 add_bit = 1ULL << (vfid % 64);
3232+
int i;
32253233

3226-
p_hwfn->pf_iov_info->pending_events[vfid / 64] |= add_bit;
3227-
}
3234+
memset(events, 0, sizeof(u64) * QED_VF_ARRAY_LENGTH);
32283235

3229-
static void qed_iov_pf_get_and_clear_pending_events(struct qed_hwfn *p_hwfn,
3230-
u64 *events)
3231-
{
3232-
u64 *p_pending_events = p_hwfn->pf_iov_info->pending_events;
3236+
qed_for_each_vf(p_hwfn, i) {
3237+
struct qed_vf_info *p_vf;
32333238

3234-
memcpy(events, p_pending_events, sizeof(u64) * QED_VF_ARRAY_LENGTH);
3235-
memset(p_pending_events, 0, sizeof(u64) * QED_VF_ARRAY_LENGTH);
3239+
p_vf = &p_hwfn->pf_iov_info->vfs_array[i];
3240+
if (p_vf->vf_mbx.b_pending_msg)
3241+
events[i / 64] |= 1ULL << (i % 64);
3242+
}
32363243
}
32373244

32383245
static struct qed_vf_info *qed_sriov_get_vf_from_absid(struct qed_hwfn *p_hwfn,
@@ -3266,7 +3273,7 @@ static int qed_sriov_vfpf_msg(struct qed_hwfn *p_hwfn,
32663273
p_vf->vf_mbx.pending_req = (((u64)vf_msg->hi) << 32) | vf_msg->lo;
32673274

32683275
/* Mark the event and schedule the workqueue */
3269-
qed_iov_pf_add_pending_events(p_hwfn, p_vf->relative_vf_id);
3276+
p_vf->vf_mbx.b_pending_msg = true;
32703277
qed_schedule_iov(p_hwfn, QED_IOV_WQ_MSG_FLAG);
32713278

32723279
return 0;
@@ -4030,7 +4037,7 @@ static void qed_handle_vf_msg(struct qed_hwfn *hwfn)
40304037
return;
40314038
}
40324039

4033-
qed_iov_pf_get_and_clear_pending_events(hwfn, events);
4040+
qed_iov_pf_get_pending_events(hwfn, events);
40344041

40354042
DP_VERBOSE(hwfn, QED_MSG_IOV,
40364043
"Event mask of VF events: 0x%llx 0x%llx 0x%llx\n",

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ struct qed_iov_vf_mbx {
140140
/* Address in VF where a pending message is located */
141141
dma_addr_t pending_req;
142142

143+
/* Message from VF awaits handling */
144+
bool b_pending_msg;
145+
143146
u8 *offset;
144147

145148
/* saved VF request header */
@@ -232,7 +235,6 @@ struct qed_vf_info {
232235
*/
233236
struct qed_pf_iov {
234237
struct qed_vf_info vfs_array[MAX_NUM_VFS];
235-
u64 pending_events[QED_VF_ARRAY_LENGTH];
236238
u64 pending_flr[QED_VF_ARRAY_LENGTH];
237239

238240
/* Allocate message address continuosuly and split to each VF */

0 commit comments

Comments
 (0)