@@ -1623,6 +1623,15 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
1623
1623
goto error_param ;
1624
1624
}
1625
1625
1626
+ for (i = 0 ; i < qci -> num_queue_pairs ; i ++ ) {
1627
+ if (!qci -> qpair [i ].rxq .crc_disable )
1628
+ continue ;
1629
+
1630
+ if (!(vf -> driver_caps & VIRTCHNL_VF_OFFLOAD_CRC ) ||
1631
+ vf -> vlan_strip_ena )
1632
+ goto error_param ;
1633
+ }
1634
+
1626
1635
for (i = 0 ; i < qci -> num_queue_pairs ; i ++ ) {
1627
1636
qpi = & qci -> qpair [i ];
1628
1637
if (qpi -> txq .vsi_id != qci -> vsi_id ||
@@ -1669,11 +1678,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
1669
1678
vsi -> rx_rings [i ]-> dma = qpi -> rxq .dma_ring_addr ;
1670
1679
vsi -> rx_rings [i ]-> count = qpi -> rxq .ring_len ;
1671
1680
1672
- if (qpi -> rxq .crc_disable &&
1673
- !(vf -> driver_caps & VIRTCHNL_VF_OFFLOAD_CRC )) {
1674
- goto error_param ;
1675
- }
1676
-
1677
1681
if (qpi -> rxq .crc_disable )
1678
1682
vsi -> rx_rings [q_idx ]-> flags |=
1679
1683
ICE_RX_FLAGS_CRC_STRIP_DIS ;
@@ -2425,6 +2429,21 @@ static int ice_vc_remove_vlan_msg(struct ice_vf *vf, u8 *msg)
2425
2429
return ice_vc_process_vlan_msg (vf , msg , false);
2426
2430
}
2427
2431
2432
+ /**
2433
+ * ice_vsi_is_rxq_crc_strip_dis - check if Rx queue CRC strip is disabled or not
2434
+ * @vsi: pointer to the VF VSI info
2435
+ */
2436
+ static bool ice_vsi_is_rxq_crc_strip_dis (struct ice_vsi * vsi )
2437
+ {
2438
+ unsigned int i ;
2439
+
2440
+ ice_for_each_alloc_rxq (vsi , i )
2441
+ if (vsi -> rx_rings [i ]-> flags & ICE_RX_FLAGS_CRC_STRIP_DIS )
2442
+ return true;
2443
+
2444
+ return false;
2445
+ }
2446
+
2428
2447
/**
2429
2448
* ice_vc_ena_vlan_stripping
2430
2449
* @vf: pointer to the VF info
@@ -2454,6 +2473,8 @@ static int ice_vc_ena_vlan_stripping(struct ice_vf *vf)
2454
2473
2455
2474
if (vsi -> inner_vlan_ops .ena_stripping (vsi , ETH_P_8021Q ))
2456
2475
v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
2476
+ else
2477
+ vf -> vlan_strip_ena |= ICE_INNER_VLAN_STRIP_ENA ;
2457
2478
2458
2479
error_param :
2459
2480
return ice_vc_send_msg_to_vf (vf , VIRTCHNL_OP_ENABLE_VLAN_STRIPPING ,
@@ -2489,6 +2510,8 @@ static int ice_vc_dis_vlan_stripping(struct ice_vf *vf)
2489
2510
2490
2511
if (vsi -> inner_vlan_ops .dis_stripping (vsi ))
2491
2512
v_ret = VIRTCHNL_STATUS_ERR_PARAM ;
2513
+ else
2514
+ vf -> vlan_strip_ena &= ~ICE_INNER_VLAN_STRIP_ENA ;
2492
2515
2493
2516
error_param :
2494
2517
return ice_vc_send_msg_to_vf (vf , VIRTCHNL_OP_DISABLE_VLAN_STRIPPING ,
@@ -2664,6 +2687,8 @@ static int ice_vf_init_vlan_stripping(struct ice_vf *vf)
2664
2687
{
2665
2688
struct ice_vsi * vsi = ice_get_vf_vsi (vf );
2666
2689
2690
+ vf -> vlan_strip_ena = 0 ;
2691
+
2667
2692
if (!vsi )
2668
2693
return - EINVAL ;
2669
2694
@@ -2673,10 +2698,16 @@ static int ice_vf_init_vlan_stripping(struct ice_vf *vf)
2673
2698
if (ice_vf_is_port_vlan_ena (vf ) && !ice_is_dvm_ena (& vsi -> back -> hw ))
2674
2699
return 0 ;
2675
2700
2676
- if (ice_vf_vlan_offload_ena (vf -> driver_caps ))
2677
- return vsi -> inner_vlan_ops .ena_stripping (vsi , ETH_P_8021Q );
2678
- else
2679
- return vsi -> inner_vlan_ops .dis_stripping (vsi );
2701
+ if (ice_vf_vlan_offload_ena (vf -> driver_caps )) {
2702
+ int err ;
2703
+
2704
+ err = vsi -> inner_vlan_ops .ena_stripping (vsi , ETH_P_8021Q );
2705
+ if (!err )
2706
+ vf -> vlan_strip_ena |= ICE_INNER_VLAN_STRIP_ENA ;
2707
+ return err ;
2708
+ }
2709
+
2710
+ return vsi -> inner_vlan_ops .dis_stripping (vsi );
2680
2711
}
2681
2712
2682
2713
static u16 ice_vc_get_max_vlan_fltrs (struct ice_vf * vf )
@@ -3450,6 +3481,11 @@ static int ice_vc_ena_vlan_stripping_v2_msg(struct ice_vf *vf, u8 *msg)
3450
3481
goto out ;
3451
3482
}
3452
3483
3484
+ if (ice_vsi_is_rxq_crc_strip_dis (vsi )) {
3485
+ v_ret = VIRTCHNL_STATUS_ERR_NOT_SUPPORTED ;
3486
+ goto out ;
3487
+ }
3488
+
3453
3489
ethertype_setting = strip_msg -> outer_ethertype_setting ;
3454
3490
if (ethertype_setting ) {
3455
3491
if (ice_vc_ena_vlan_offload (vsi ,
@@ -3470,6 +3506,8 @@ static int ice_vc_ena_vlan_stripping_v2_msg(struct ice_vf *vf, u8 *msg)
3470
3506
* enabled, is extracted in L2TAG1.
3471
3507
*/
3472
3508
ice_vsi_update_l2tsel (vsi , l2tsel );
3509
+
3510
+ vf -> vlan_strip_ena |= ICE_OUTER_VLAN_STRIP_ENA ;
3473
3511
}
3474
3512
}
3475
3513
@@ -3481,6 +3519,9 @@ static int ice_vc_ena_vlan_stripping_v2_msg(struct ice_vf *vf, u8 *msg)
3481
3519
goto out ;
3482
3520
}
3483
3521
3522
+ if (ethertype_setting )
3523
+ vf -> vlan_strip_ena |= ICE_INNER_VLAN_STRIP_ENA ;
3524
+
3484
3525
out :
3485
3526
return ice_vc_send_msg_to_vf (vf , VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2 ,
3486
3527
v_ret , NULL , 0 );
@@ -3542,6 +3583,8 @@ static int ice_vc_dis_vlan_stripping_v2_msg(struct ice_vf *vf, u8 *msg)
3542
3583
* in L2TAG1.
3543
3584
*/
3544
3585
ice_vsi_update_l2tsel (vsi , l2tsel );
3586
+
3587
+ vf -> vlan_strip_ena &= ~ICE_OUTER_VLAN_STRIP_ENA ;
3545
3588
}
3546
3589
}
3547
3590
@@ -3551,6 +3594,9 @@ static int ice_vc_dis_vlan_stripping_v2_msg(struct ice_vf *vf, u8 *msg)
3551
3594
goto out ;
3552
3595
}
3553
3596
3597
+ if (ethertype_setting )
3598
+ vf -> vlan_strip_ena &= ~ICE_INNER_VLAN_STRIP_ENA ;
3599
+
3554
3600
out :
3555
3601
return ice_vc_send_msg_to_vf (vf , VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2 ,
3556
3602
v_ret , NULL , 0 );
0 commit comments