The virtchnl v2 VLAN capability handshake now includes the new
VIRTCHNL_VLAN_ETHERTYPE_88E7 flag for IEEE 802.1ah B-TAG support.
Wire up the corresponding software-path handling in ice so the PF
correctly accepts and translates 0x88E7 (ETH_P_8021AH) VLAN filters
requested by VFs.

Three software-only changes, no hardware offload path affected:

 - ice_check_supported_vlan_tpid() (ice_tc_lib.c): accept ETH_P_8021AH
   in the TC VLAN TPID validation switch so 0x88E7-tagged flower filters
   are not rejected early.

 - validate_vlan() (ice_vsi_vlan_lib.c): allow ETH_P_8021AH as a valid
   TPID when adding VLAN filters to a VSI, consistent with the other
   accepted dot1q/dot1ad/QinQ1 TPIDs.

 - ice_vc_validate_vlan_tpid() / ice_vc_get_tpid() (virt/virtchnl.c):
   bidirectional translation between ETH_P_8021AH and
   VIRTCHNL_VLAN_ETHERTYPE_88E7 in the virtchnl VLAN v2 filter path.

This does not add 0x88E7 hardware offload capability, does not change
outer-tag programming, and does not alter any datapath.

Signed-off-by: Aleksandr Loktionov <[email protected]>
---
 drivers/net/ethernet/intel/ice/ice_tc_lib.c       | 1 +
 drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c | 3 ++-
 drivers/net/ethernet/intel/ice/virt/virtchnl.c    | 6 ++++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c 
b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
index d20357c..4560e55 100644
--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
@@ -174,6 +174,7 @@ static u16 ice_check_supported_vlan_tpid(u16 vlan_tpid)
        case ETH_P_8021Q:
        case ETH_P_8021AD:
        case ETH_P_QINQ1:
+       case ETH_P_8021AH:
                return vlan_tpid;
        default:
                return 0;
diff --git a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c 
b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
index 5498496..b67272e 100644
--- a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
@@ -24,7 +24,8 @@ static void print_invalid_tpid(struct ice_vsi *vsi, u16 tpid)
 static bool validate_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
 {
        if (vlan->tpid != ETH_P_8021Q && vlan->tpid != ETH_P_8021AD &&
-           vlan->tpid != ETH_P_QINQ1 && (vlan->tpid || vlan->vid)) {
+           vlan->tpid != ETH_P_QINQ1 && vlan->tpid != ETH_P_8021AH &&
+           (vlan->tpid || vlan->vid)) {
                print_invalid_tpid(vsi, vlan->tpid);
                return false;
        }
diff --git a/drivers/net/ethernet/intel/ice/virt/virtchnl.c 
b/drivers/net/ethernet/intel/ice/virt/virtchnl.c
index ca8018e..06d2f9b 100644
--- a/drivers/net/ethernet/intel/ice/virt/virtchnl.c
+++ b/drivers/net/ethernet/intel/ice/virt/virtchnl.c
@@ -1702,6 +1702,9 @@ static bool ice_vc_validate_vlan_tpid(u16 filtering_caps, 
u16 tpid)
        case ETH_P_QINQ1:
                vlan_ethertype = VIRTCHNL_VLAN_ETHERTYPE_9100;
                break;
+       case ETH_P_8021AH:
+               vlan_ethertype = VIRTCHNL_VLAN_ETHERTYPE_88E7;
+               break;
        }
 
        if (!(filtering_caps & vlan_ethertype))
@@ -2136,6 +2139,9 @@ static int ice_vc_get_tpid(u32 ethertype_setting, u16 
*tpid)
        case VIRTCHNL_VLAN_ETHERTYPE_9100:
                *tpid = ETH_P_QINQ1;
                break;
+       case VIRTCHNL_VLAN_ETHERTYPE_88E7:
+               *tpid = ETH_P_8021AH;
+               break;
        default:
                *tpid = 0;
                return -EINVAL;
-- 
2.52.0

Reply via email to