Re: [PATCH net v6 3/5] net: stmmac: Rename double VLAN references to svlan
From: Maxime Chevallier
Date: Wed Sep 30 2026 - 18:26:19 EST
Hi,
On 9/28/26 22:34, Ovidiu Panait wrote:
> The ESVL and DOVLTC bits control S-VLAN tag processing and have
> nothing to do with the double VLAN feature, which only provides a way
> to process an additional inner VLAN tag. However, the driver code
> that handles them always refers to "double VLAN", which is unrelated
> and makes the implementation confusing. The driver does not use any
> of the inner VLAN tag features, and the networking core does not
> support offloads for the inner tag anyway.
>
> To reduce the confusion regarding S-Tag vs double VLAN handling,
> rename double -> svlan.
>
> No functional change intended.
>
> Suggested-by: Joseph Steel <recv.jo@xxxxxxxxx>
> Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@xxxxxxxxxxx>
Reviewed-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
Maxime
> ---
> v6 changes:
> - Rebased on top of latest net.
>
> v5 changes: New patch.
>
> drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +-
> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +-
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 34 +++++++++----------
> .../stmicro/stmmac/stmmac_selftests.c | 30 ++++++++--------
> .../net/ethernet/stmicro/stmmac/stmmac_vlan.c | 8 ++---
> 5 files changed, 38 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
> index df2126d71c2f..5e2654c91b41 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
> @@ -633,7 +633,7 @@ struct stmmac_est_ops {
> struct stmmac_vlan_ops {
> /* VLAN */
> void (*update_vlan_hash)(struct mac_device_info *hw, u32 hash,
> - bool is_double);
> + bool is_svlan);
> void (*enable_vlan)(struct mac_device_info *hw, u32 type);
> void (*rx_hw_vlan)(struct mac_device_info *hw, struct dma_desc *rx_desc,
> struct sk_buff *skb);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index 7582fca63741..d2d387f45c10 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> @@ -344,7 +344,7 @@ struct stmmac_priv {
> void __iomem *ptpaddr;
> void __iomem *estaddr;
> unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
> - unsigned int num_double_vlans;
> + unsigned int num_svlans;
> int sfty_irq;
> struct stmmac_msi *msi;
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 14183f92663a..0d70eb452af7 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -6835,7 +6835,7 @@ static u32 stmmac_vid_crc32_le(__le16 vid_le)
> return crc;
> }
>
> -static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double)
> +static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_svlan)
> {
> u32 crc, hash = 0;
> u16 vid = 0;
> @@ -6849,7 +6849,7 @@ static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double)
> if (!netif_running(priv->dev))
> return 0;
>
> - return stmmac_update_vlan_hash(priv, priv->hw, hash, is_double);
> + return stmmac_update_vlan_hash(priv, priv->hw, hash, is_svlan);
> }
>
> /* FIXME: This may need RXC to be running, but it may be called with BH
> @@ -6858,8 +6858,8 @@ static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double)
> static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid)
> {
> struct stmmac_priv *priv = netdev_priv(ndev);
> - unsigned int num_double_vlans;
> - bool is_double = false;
> + unsigned int num_svlans;
> + bool is_svlan = false;
> int ret;
>
> ret = pm_runtime_resume_and_get(priv->device);
> @@ -6867,11 +6867,11 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid
> return ret;
>
> if (be16_to_cpu(proto) == ETH_P_8021AD)
> - is_double = true;
> + is_svlan = true;
>
> set_bit(vid, priv->active_vlans);
> - num_double_vlans = priv->num_double_vlans + is_double;
> - ret = stmmac_vlan_update(priv, num_double_vlans);
> + num_svlans = priv->num_svlans + is_svlan;
> + ret = stmmac_vlan_update(priv, num_svlans);
> if (ret) {
> clear_bit(vid, priv->active_vlans);
> goto err_pm_put;
> @@ -6881,12 +6881,12 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid
> ret = stmmac_add_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid);
> if (ret) {
> clear_bit(vid, priv->active_vlans);
> - stmmac_vlan_update(priv, priv->num_double_vlans);
> + stmmac_vlan_update(priv, priv->num_svlans);
> goto err_pm_put;
> }
> }
>
> - priv->num_double_vlans = num_double_vlans;
> + priv->num_svlans = num_svlans;
>
> err_pm_put:
> pm_runtime_put(priv->device);
> @@ -6900,8 +6900,8 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid
> static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid)
> {
> struct stmmac_priv *priv = netdev_priv(ndev);
> - unsigned int num_double_vlans;
> - bool is_double = false;
> + unsigned int num_svlans;
> + bool is_svlan = false;
> int ret;
>
> ret = pm_runtime_resume_and_get(priv->device);
> @@ -6909,11 +6909,11 @@ static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vi
> return ret;
>
> if (be16_to_cpu(proto) == ETH_P_8021AD)
> - is_double = true;
> + is_svlan = true;
>
> clear_bit(vid, priv->active_vlans);
> - num_double_vlans = priv->num_double_vlans - is_double;
> - ret = stmmac_vlan_update(priv, num_double_vlans);
> + num_svlans = priv->num_svlans - is_svlan;
> + ret = stmmac_vlan_update(priv, num_svlans);
> if (ret) {
> set_bit(vid, priv->active_vlans);
> goto del_vlan_error;
> @@ -6923,12 +6923,12 @@ static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vi
> ret = stmmac_del_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid);
> if (ret) {
> set_bit(vid, priv->active_vlans);
> - stmmac_vlan_update(priv, priv->num_double_vlans);
> + stmmac_vlan_update(priv, priv->num_svlans);
> goto del_vlan_error;
> }
> }
>
> - priv->num_double_vlans = num_double_vlans;
> + priv->num_svlans = num_svlans;
>
> del_vlan_error:
> pm_runtime_put(priv->device);
> @@ -6944,7 +6944,7 @@ static void stmmac_vlan_restore(struct stmmac_priv *priv)
> if (priv->hw->num_vlan)
> stmmac_restore_hw_vlan_rx_fltr(priv, priv->dev, priv->hw);
>
> - stmmac_vlan_update(priv, priv->num_double_vlans);
> + stmmac_vlan_update(priv, priv->num_svlans);
> }
>
> static int stmmac_bpf(struct net_device *dev, struct netdev_bpf *bpf)
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
> index c25dc9f89270..c485217ba880 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
> @@ -243,7 +243,7 @@ struct stmmac_test_priv {
> int (*func)(struct sk_buff *skb, struct net_device *ndev,
> struct packet_type *pt, struct net_device *orig_ndev);
> bool capture_all;
> - int double_vlan;
> + int svlan;
> int vlan_id;
> int ok;
> };
> @@ -285,7 +285,7 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb,
> }
>
> ihdr = ip_hdr(skb);
> - if (tpriv->double_vlan)
> + if (tpriv->svlan)
> ihdr = (struct iphdr *)(skb_network_header(skb) + 4);
>
> if (tpriv->packet->tcp) {
> @@ -936,7 +936,7 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb,
> struct iphdr *ihdr;
> u16 proto;
>
> - proto = tpriv->double_vlan ? ETH_P_8021AD : ETH_P_8021Q;
> + proto = tpriv->svlan ? ETH_P_8021AD : ETH_P_8021Q;
>
> skb = skb_unshare(skb, GFP_ATOMIC);
> if (!skb)
> @@ -963,7 +963,7 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb,
> }
>
> ihdr = ip_hdr(skb);
> - if (tpriv->double_vlan)
> + if (tpriv->svlan)
> ihdr = (struct iphdr *)(skb_network_header(skb) + 4);
> if (ihdr->protocol != IPPROTO_UDP)
> goto out;
> @@ -1080,7 +1080,7 @@ static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv)
> return ret;
> }
>
> -static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv)
> +static int __stmmac_test_svlanfilt(struct stmmac_priv *priv)
> {
> struct stmmac_packet_attrs attr = { };
> struct stmmac_test_priv *tpriv;
> @@ -1092,7 +1092,7 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv)
> return -ENOMEM;
>
> tpriv->ok = false;
> - tpriv->double_vlan = true;
> + tpriv->svlan = true;
> init_completion(&tpriv->comp);
>
> tpriv->pt.type = htons(ETH_P_8021Q);
> @@ -1155,15 +1155,15 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv)
> return ret;
> }
>
> -static int stmmac_test_dvlanfilt(struct stmmac_priv *priv)
> +static int stmmac_test_svlanfilt(struct stmmac_priv *priv)
> {
> if (!priv->dma_cap.vlhash)
> return -EOPNOTSUPP;
>
> - return __stmmac_test_dvlanfilt(priv);
> + return __stmmac_test_svlanfilt(priv);
> }
>
> -static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv)
> +static int stmmac_test_svlanfilt_perfect(struct stmmac_priv *priv)
> {
> int ret, prev_cap = priv->dma_cap.vlhash;
>
> @@ -1171,7 +1171,7 @@ static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv)
> return -EOPNOTSUPP;
>
> priv->dma_cap.vlhash = 0;
> - ret = __stmmac_test_dvlanfilt(priv);
> + ret = __stmmac_test_svlanfilt(priv);
> priv->dma_cap.vlhash = prev_cap;
>
> return ret;
> @@ -1372,7 +1372,7 @@ static int stmmac_test_vlanoff_common(struct stmmac_priv *priv, bool svlan)
> proto = svlan ? ETH_P_8021AD : ETH_P_8021Q;
>
> tpriv->ok = false;
> - tpriv->double_vlan = svlan;
> + tpriv->svlan = svlan;
> init_completion(&tpriv->comp);
>
> tpriv->pt.type = svlan ? htons(ETH_P_8021Q) : htons(ETH_P_IP);
> @@ -1960,11 +1960,11 @@ static const struct stmmac_test {
> .name = "VLAN Filtering (perf) ",
> .fn = stmmac_test_vlanfilt_perfect,
> }, {
> - .name = "Double VLAN Filter ",
> - .fn = stmmac_test_dvlanfilt,
> + .name = "SVLAN Filtering ",
> + .fn = stmmac_test_svlanfilt,
> }, {
> - .name = "Double VLAN Filter (perf) ",
> - .fn = stmmac_test_dvlanfilt_perfect,
> + .name = "SVLAN Filtering (perf) ",
> + .fn = stmmac_test_svlanfilt_perfect,
> }, {
> .name = "Flexible RX Parser ",
> .fn = stmmac_test_rxp,
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c
> index 200b34588c7f..fb9aad748cb3 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c
> @@ -162,7 +162,7 @@ static void vlan_restore_hw_rx_fltr(struct net_device *dev,
> }
>
> static void vlan_update_hash(struct mac_device_info *hw, u32 hash,
> - bool is_double)
> + bool is_svlan)
> {
> void __iomem *ioaddr = hw->pcsr;
> u32 value;
> @@ -173,7 +173,7 @@ static void vlan_update_hash(struct mac_device_info *hw, u32 hash,
>
> if (hash) {
> value |= VLAN_VTHM | VLAN_ETV;
> - if (is_double) {
> + if (is_svlan) {
> value |= VLAN_ESVL;
> value |= VLAN_DOVLTC;
> } else {
> @@ -235,7 +235,7 @@ static void vlan_set_hw_mode(struct mac_device_info *hw)
> }
>
> static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash,
> - bool is_double)
> + bool is_svlan)
> {
> void __iomem *ioaddr = hw->pcsr;
>
> @@ -251,7 +251,7 @@ static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash,
> value = readl(ioaddr + VLAN_TAG);
>
> value |= VLAN_VTHM | VLAN_ETV;
> - if (is_double) {
> + if (is_svlan) {
> value |= VLAN_ESVL;
> value |= VLAN_DOVLTC;
> } else {