Skip to content

Commit 02dc402

Browse files
Yuval Mintzdavem330
authored andcommitted
bnx2x: Use correct fastpath version for VFs.
Our FW can support several fastpath HSI [for backward compatibility] but up until now VFs were always configured to use latest fastpath HSI [although VF driver might be older and use an older fastpath HSI]. For linux drivers, the differences are insignificant since driver never utilized features that were overridden by the HSI change. But for VMs running other operating systems this might be a problem. In addition, eventually FW might change fastpath HSI in such a manner that backward compatibility WILL break unless configured with proper version. This patch fixes the issue for other operating system VMs, as well as lays the ground work for forward compatibility in regard to the fastpath HSI. Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com> Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 36c71a7 commit 02dc402

7 files changed

Lines changed: 88 additions & 5 deletions

File tree

‎drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3163,6 +3163,8 @@ static void bnx2x_pf_q_prep_general(struct bnx2x *bp,
31633163
gen_init->mtu = bp->dev->mtu;
31643164

31653165
gen_init->cos = cos;
3166+
3167+
gen_init->fp_hsi = ETH_FP_HSI_VERSION;
31663168
}
31673169

31683170
static void bnx2x_pf_rx_q_prep(struct bnx2x *bp,

‎drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4336,7 +4336,7 @@ static void bnx2x_q_fill_init_general_data(struct bnx2x *bp,
43364336
test_bit(BNX2X_Q_FLG_FCOE, flags) ?
43374337
LLFC_TRAFFIC_TYPE_FCOE : LLFC_TRAFFIC_TYPE_NW;
43384338

4339-
gen_data->fp_hsi_ver = ETH_FP_HSI_VERSION;
4339+
gen_data->fp_hsi_ver = params->fp_hsi;
43404340

43414341
DP(BNX2X_MSG_SP, "flags: active %d, cos %d, stats en %d\n",
43424342
gen_data->activate_flg, gen_data->cos, gen_data->statistics_en_flg);

‎drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,8 @@ struct bnx2x_general_setup_params {
937937
u8 spcl_id;
938938
u16 mtu;
939939
u8 cos;
940+
941+
u8 fp_hsi;
940942
};
941943

942944
struct bnx2x_rxq_setup_params {

‎drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ void bnx2x_vfop_qctor_prep(struct bnx2x *bp,
193193
/* Setup-op general parameters */
194194
setup_p->gen_params.spcl_id = vf->sp_cl_id;
195195
setup_p->gen_params.stat_id = vfq_stat_id(vf, q);
196+
setup_p->gen_params.fp_hsi = vf->fp_hsi;
196197

197198
/* Setup-op pause params:
198199
* Nothing to do, the pause thresholds are set by default to 0 which

‎drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ struct bnx2x_virtf {
205205
/* slow-path operations */
206206
struct mutex op_mutex; /* one vfop at a time mutex */
207207
enum channel_tlvs op_current;
208+
209+
u8 fp_hsi;
208210
};
209211

210212
#define BNX2X_NR_VIRTFN(bp) ((bp)->vfdb->sriov.nr_virtfn)

‎drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c‎

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count)
224224
struct vfpf_acquire_tlv *req = &bp->vf2pf_mbox->req.acquire;
225225
struct pfvf_acquire_resp_tlv *resp = &bp->vf2pf_mbox->resp.acquire_resp;
226226
struct vfpf_port_phys_id_resp_tlv *phys_port_resp;
227+
struct vfpf_fp_hsi_resp_tlv *fp_hsi_resp;
227228
u32 vf_id;
228229
bool resources_acquired = false;
229230

@@ -237,6 +238,7 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count)
237238

238239
req->vfdev_info.vf_id = vf_id;
239240
req->vfdev_info.vf_os = 0;
241+
req->vfdev_info.fp_hsi_ver = ETH_FP_HSI_VERSION;
240242

241243
req->resc_request.num_rxqs = rx_count;
242244
req->resc_request.num_txqs = tx_count;
@@ -316,9 +318,14 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count)
316318
memset(&bp->vf2pf_mbox->resp, 0,
317319
sizeof(union pfvf_tlvs));
318320
} else {
319-
/* PF reports error */
320-
BNX2X_ERR("Failed to get the requested amount of resources: %d. Breaking...\n",
321-
bp->acquire_resp.hdr.status);
321+
/* Determine reason of PF failure of acquire process */
322+
fp_hsi_resp = bnx2x_search_tlv_list(bp, resp,
323+
CHANNEL_TLV_FP_HSI_SUPPORT);
324+
if (fp_hsi_resp && !fp_hsi_resp->is_supported)
325+
BNX2X_ERR("Old hypervisor - doesn't support current fastpath HSI version; Need to downgrade VF driver [or upgrade hypervisor]\n");
326+
else
327+
BNX2X_ERR("Failed to get the requested amount of resources: %d. Breaking...\n",
328+
bp->acquire_resp.hdr.status);
322329
rc = -EAGAIN;
323330
goto out;
324331
}
@@ -333,6 +340,25 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count)
333340
bp->flags |= HAS_PHYS_PORT_ID;
334341
}
335342

343+
/* Old Hypevisors might not even support the FP_HSI_SUPPORT TLV.
344+
* If that's the case, we need to make certain required FW was
345+
* supported by such a hypervisor [i.e., v0-v2].
346+
*/
347+
fp_hsi_resp = bnx2x_search_tlv_list(bp, resp,
348+
CHANNEL_TLV_FP_HSI_SUPPORT);
349+
if (!fp_hsi_resp && (ETH_FP_HSI_VERSION > ETH_FP_HSI_VER_2)) {
350+
BNX2X_ERR("Old hypervisor - need to downgrade VF's driver\n");
351+
352+
/* Since acquire succeeded on the PF side, we need to send a
353+
* release message in order to allow future probes.
354+
*/
355+
bnx2x_vfpf_finalize(bp, &req->first_tlv);
356+
bnx2x_vfpf_release(bp);
357+
358+
rc = -EINVAL;
359+
goto out;
360+
}
361+
336362
/* get HW info */
337363
bp->common.chip_id |= (bp->acquire_resp.pfdev_info.chip_num & 0xffff);
338364
bp->link_params.chip_id = bp->common.chip_id;
@@ -1125,6 +1151,26 @@ static void bnx2x_vf_mbx_resp_phys_port(struct bnx2x *bp,
11251151
*offset += sizeof(struct vfpf_port_phys_id_resp_tlv);
11261152
}
11271153

1154+
static void bnx2x_vf_mbx_resp_fp_hsi_ver(struct bnx2x *bp,
1155+
struct bnx2x_virtf *vf,
1156+
void *buffer,
1157+
u16 *offset)
1158+
{
1159+
struct vfpf_fp_hsi_resp_tlv *fp_hsi;
1160+
1161+
bnx2x_add_tlv(bp, buffer, *offset, CHANNEL_TLV_FP_HSI_SUPPORT,
1162+
sizeof(struct vfpf_fp_hsi_resp_tlv));
1163+
1164+
fp_hsi = (struct vfpf_fp_hsi_resp_tlv *)
1165+
(((u8 *)buffer) + *offset);
1166+
fp_hsi->is_supported = (vf->fp_hsi > ETH_FP_HSI_VERSION) ? 0 : 1;
1167+
1168+
/* Offset should continue representing the offset to the tail
1169+
* of TLV data (outside this function scope)
1170+
*/
1171+
*offset += sizeof(struct vfpf_fp_hsi_resp_tlv);
1172+
}
1173+
11281174
static void bnx2x_vf_mbx_acquire_resp(struct bnx2x *bp, struct bnx2x_virtf *vf,
11291175
struct bnx2x_vf_mbx *mbx, int vfop_status)
11301176
{
@@ -1219,6 +1265,12 @@ static void bnx2x_vf_mbx_acquire_resp(struct bnx2x *bp, struct bnx2x_virtf *vf,
12191265
CHANNEL_TLV_PHYS_PORT_ID))
12201266
bnx2x_vf_mbx_resp_phys_port(bp, vf, &mbx->msg->resp, &length);
12211267

1268+
/* `New' vfs will want to know if fastpath HSI is supported, since
1269+
* if that's not the case they could print into system log the fact
1270+
* the driver version must be updated.
1271+
*/
1272+
bnx2x_vf_mbx_resp_fp_hsi_ver(bp, vf, &mbx->msg->resp, &length);
1273+
12221274
bnx2x_add_tlv(bp, &mbx->msg->resp, length, CHANNEL_TLV_LIST_END,
12231275
sizeof(struct channel_list_end_tlv));
12241276

@@ -1288,6 +1340,23 @@ static void bnx2x_vf_mbx_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf,
12881340
goto out;
12891341
}
12901342

1343+
/* Verify the VF fastpath HSI can be supported by the loaded FW.
1344+
* Linux vfs should be oblivious to changes between v0 and v2.
1345+
*/
1346+
if (bnx2x_vf_mbx_is_windows_vm(bp, &mbx->msg->req.acquire))
1347+
vf->fp_hsi = acquire->vfdev_info.fp_hsi_ver;
1348+
else
1349+
vf->fp_hsi = max_t(u8, acquire->vfdev_info.fp_hsi_ver,
1350+
ETH_FP_HSI_VER_2);
1351+
if (vf->fp_hsi > ETH_FP_HSI_VERSION) {
1352+
DP(BNX2X_MSG_IOV,
1353+
"VF [%d] - Can't support acquire request since VF requests a FW version which is too new [%02x > %02x]\n",
1354+
vf->abs_vfid, acquire->vfdev_info.fp_hsi_ver,
1355+
ETH_FP_HSI_VERSION);
1356+
rc = -EINVAL;
1357+
goto out;
1358+
}
1359+
12911360
/* acquire the resources */
12921361
rc = bnx2x_vf_acquire(bp, vf, &acquire->resc_request);
12931362

‎drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct vfpf_acquire_tlv {
124124
#define VF_OS_UNDEFINED (0 << VF_OS_SHIFT)
125125
#define VF_OS_WINDOWS (1 << VF_OS_SHIFT)
126126

127-
u8 padding;
127+
u8 fp_hsi_ver;
128128
u8 caps;
129129
#define VF_CAP_SUPPORT_EXT_BULLETIN (1 << 0)
130130
} vfdev_info;
@@ -204,6 +204,12 @@ struct vfpf_port_phys_id_resp_tlv {
204204
u8 padding[2];
205205
};
206206

207+
struct vfpf_fp_hsi_resp_tlv {
208+
struct channel_tlv tl;
209+
u8 is_supported;
210+
u8 padding[3];
211+
};
212+
207213
#define VFPF_INIT_FLG_STATS_COALESCE (1 << 0) /* when set the VFs queues
208214
* stats will be coalesced on
209215
* the leading RSS queue
@@ -448,6 +454,7 @@ enum channel_tlvs {
448454
CHANNEL_TLV_UPDATE_RSS,
449455
CHANNEL_TLV_PHYS_PORT_ID,
450456
CHANNEL_TLV_UPDATE_TPA,
457+
CHANNEL_TLV_FP_HSI_SUPPORT,
451458
CHANNEL_TLV_MAX
452459
};
453460

0 commit comments

Comments
 (0)