+/* In Single VLAN Mode (SVM), single VLAN filters via ICE_SW_LKUP_VLAN are
+ * based on the inner VLAN ID, so the VLAN TPID (i.e. 0x8100 or 0x888a8)
+ * doesn't matter. In Double VLAN Mode (DVM), outer/single VLAN filters via
+ * ICE_SW_LKUP_VLAN are based on the outer/single VLAN ID + VLAN TPID.
+ *
+ * For both modes add a VLAN 0 + no VLAN TPID filter to handle untagged traffic
+ * when VLAN pruning is enabled. Also, this handles VLAN 0 priority tagged
+ * traffic in SVM, since the VLAN TPID isn't part of filtering.
+ *
+ * If DVM is enabled then an explicit VLAN 0 + VLAN TPID filter needs to be
+ * added to allow VLAN 0 priority tagged traffic in DVM, since the VLAN TPID is
+ * part of filtering.
+ */
+static int
+ice_vsi_add_vlan_zero(struct ice_vsi *vsi)
+{
+ struct ice_vlan vlan;
+ int err;
+
+ vlan = ICE_VLAN(0, 0);
+ err = ice_add_vlan_filter(vsi, &vlan);
+ if (err) {
+ PMD_DRV_LOG(DEBUG, "Failed to add VLAN ID 0");
+ return err;
+ }
+
+ /* in SVM both VLAN 0 filters are identical */
+ if (!ice_is_dvm_ena(&vsi->adapter->hw))
+ return 0;
+
+ vlan = ICE_VLAN(RTE_ETHER_TYPE_VLAN, 0);
+ err = ice_add_vlan_filter(vsi, &vlan);
+ if (err) {
+ PMD_DRV_LOG(DEBUG, "Failed to add VLAN ID 0 in double VLAN mode");
+ return err;
+ }
+
+ return 0;
+}
+
+/*
+ * Delete the VLAN 0 filters in the same manner that they were added in
+ * ice_vsi_add_vlan_zero.
+ */
+static int
+ice_vsi_del_vlan_zero(struct ice_vsi *vsi)
+{
+ struct ice_vlan vlan;
+ int err;
+
+ vlan = ICE_VLAN(0, 0);
+ err = ice_remove_vlan_filter(vsi, &vlan);
+ if (err) {
+ PMD_DRV_LOG(DEBUG, "Failed to remove VLAN ID 0");
+ return err;
+ }
+
+ /* in SVM both VLAN 0 filters are identical */
+ if (!ice_is_dvm_ena(&vsi->adapter->hw))
+ return 0;
+
+ vlan = ICE_VLAN(RTE_ETHER_TYPE_VLAN, 0);
+ err = ice_remove_vlan_filter(vsi, &vlan);
+ if (err) {
+ PMD_DRV_LOG(DEBUG, "Failed to remove VLAN ID 0 in double VLAN mode");
+ return err;
+ }
+
+ return 0;
+}
+