Skip to content

Commit dd90c39

Browse files
committed
HSD #15012455743: net: stmmac: Add Double VLAN handling for VLAN Rx filtering
Add double VLAN handling for VLAN Rx Filtering. Signed-off-by: Boon Khai Ng <boon.khai.ng@intel.com>
1 parent a1c16b5 commit dd90c39

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ struct mac_device_info {
534534
unsigned int promisc;
535535
bool vlan_fail_q_en;
536536
u8 vlan_fail_q;
537+
unsigned int double_vlan;
537538
};
538539

539540
struct stmmac_rx_routing {

drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,9 @@
499499
#define XGMAC_VLAN_TAG_STRIP_ALL (0x3 << XGMAC_VLAN_TAG_CTRL_EVLS_SHIFT)
500500

501501
#define XGMAC_VLAN_TAG_DATA 0x00000054
502+
#define XGMAC_VLAN_TAG_DATA_ERIVLT BIT(20)
503+
#define XGMAC_VLAN_TAG_DATA_ERSVLM BIT(19)
504+
#define XGMAC_VLAN_TAG_DATA_DOVLTC BIT(18)
502505
#define XGMAC_VLAN_TAG_DATA_ETV BIT(17)
503506
#define XGMAC_VLAN_TAG_DATA_VEN BIT(16)
504507
#define XGMAC_VLAN_TAG_DATA_VID GENMASK(15, 0)

drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,15 @@ static int dwxgmac2_write_vlan_filter(struct net_device *dev,
438438
if (index >= hw->num_vlan)
439439
return -EINVAL;
440440

441+
if (hw->double_vlan) {
442+
data |= XGMAC_VLAN_TAG_DATA_DOVLTC;
443+
data |= XGMAC_VLAN_TAG_DATA_ERIVLT;
444+
data &= ~XGMAC_VLAN_TAG_DATA_ERSVLM;
445+
} else {
446+
data &= ~XGMAC_VLAN_TAG_DATA_DOVLTC;
447+
data &= ~XGMAC_VLAN_TAG_DATA_ERIVLT;
448+
}
449+
441450
writel(data, ioaddr + XGMAC_VLAN_TAG_DATA);
442451

443452
val = readl(ioaddr + XGMAC_VLAN_TAG);
@@ -1855,6 +1864,13 @@ static u32 dwxgmac2_get_num_vlan(void __iomem *ioaddr)
18551864
return num_vlan;
18561865
}
18571866

1867+
static u32 dwxgmac2_is_double_vlan(void __iomem *ioaddr)
1868+
{
1869+
u32 val;
1870+
val = readl(ioaddr + XGMAC_HW_FEATURE3);
1871+
return (val & XGMAC_HWFEAT_DVLAN);
1872+
}
1873+
18581874
int dwxgmac2_setup(struct stmmac_priv *priv)
18591875
{
18601876
struct mac_device_info *mac = priv->hw;
@@ -1889,6 +1905,7 @@ int dwxgmac2_setup(struct stmmac_priv *priv)
18891905
mac->mii.clk_csr_shift = 19;
18901906
mac->mii.clk_csr_mask = GENMASK(21, 19);
18911907
mac->num_vlan = dwxgmac2_get_num_vlan(priv->ioaddr);
1908+
mac->double_vlan = dwxgmac2_is_double_vlan(priv->ioaddr);
18921909
return 0;
18931910
}
18941911

0 commit comments

Comments
 (0)