@@ -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+
11281174static 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
0 commit comments