Page MenuHomeFreeBSD

D62452.1796506693.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D62452.1796506693.diff

diff --git a/sys/dev/ice/ice_lib.h b/sys/dev/ice/ice_lib.h
--- a/sys/dev/ice/ice_lib.h
+++ b/sys/dev/ice/ice_lib.h
@@ -968,6 +968,7 @@
int ice_cfg_tx_queue(struct ice_tx_queue *txq);
int ice_cfg_vsi_for_tx(struct ice_vsi *vsi);
int ice_cfg_vsi_for_rx(struct ice_vsi *vsi);
+int ice_cfg_vsi_vlan_stripping(struct ice_vsi *vsi, bool ena);
int ice_control_rx_queue(struct ice_vsi *vsi, u16 qidx, bool enable);
int ice_control_all_rx_queues(struct ice_vsi *vsi, bool enable);
int ice_cfg_pf_default_mac_filters(struct ice_softc *sc);
diff --git a/sys/dev/ice/ice_lib.c b/sys/dev/ice/ice_lib.c
--- a/sys/dev/ice/ice_lib.c
+++ b/sys/dev/ice/ice_lib.c
@@ -1903,6 +1903,50 @@
return (0);
}
+/**
+ * ice_cfg_vsi_vlan_stripping - Configure Rx VLAN tag stripping
+ * @vsi: the VSI to configure
+ * @ena: if true, strip the VLAN tag and report it in the Rx descriptor;
+ * otherwise leave the tag in the received frame
+ *
+ * Consumers that see only the frame data, such as netmap(4), need the tag
+ * left in the frame. The driver runs the port in single VLAN mode, so the
+ * inner VLAN settings apply to the only tag.
+ *
+ * @return 0 on success, or EIO if the Update VSI AQ command fails
+ */
+int
+ice_cfg_vsi_vlan_stripping(struct ice_vsi *vsi, bool ena)
+{
+ struct ice_hw *hw = &vsi->sc->hw;
+ struct ice_vsi_ctx ctx = { 0 };
+ int status;
+ u8 flags;
+
+ flags = vsi->info.inner_vlan_flags & ~ICE_AQ_VSI_INNER_VLAN_EMODE_M;
+ if (ena)
+ flags |= ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH;
+ else
+ flags |= ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING;
+ if (flags == vsi->info.inner_vlan_flags)
+ return (0);
+
+ ctx.info = vsi->info;
+ ctx.info.inner_vlan_flags = flags;
+ ctx.info.valid_sections = CPU_TO_LE16(ICE_AQ_VSI_PROP_VLAN_VALID);
+ status = ice_update_vsi(hw, vsi->idx, &ctx, NULL);
+ if (status != 0) {
+ device_printf(vsi->sc->dev,
+ "Unable to %s Rx VLAN stripping, err %s aq_err %s\n",
+ ena ? "enable" : "disable", ice_status_str(status),
+ ice_aq_str(hw->adminq.sq_last_status));
+ return (EIO);
+ }
+ vsi->info.inner_vlan_flags = flags;
+
+ return (0);
+}
+
/**
* ice_is_rxq_ready - Check if an Rx queue is ready
* @hw: ice hw structure
diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c
--- a/sys/dev/ice/if_ice_iflib.c
+++ b/sys/dev/ice/if_ice_iflib.c
@@ -2131,6 +2131,11 @@
goto err_cleanup_tx;
}
+ err = ice_cfg_vsi_vlan_stripping(&sc->pf_vsi,
+ (if_getcapenable(sc->ifp) & IFCAP_VLAN_HWTAGGING) != 0);
+ if (err)
+ goto err_cleanup_tx;
+
err = ice_control_all_rx_queues(&sc->pf_vsi, true);
if (err) {
device_printf(dev,

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 5, 9:38 PM (19 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42241640
Default Alt Text
D62452.1796506693.diff (2 KB)

Event Timeline