Commit e0f9956a authored by Chuah, Kim Tatt's avatar Chuah, Kim Tatt Committed by David S. Miller

net: stmmac: Add option for VLAN filter fail queue enable

Add option in plat_stmmacenet_data struct to enable VLAN Filter Fail
Queuing. This option allows packets that fail VLAN filter to be routed
to a specific Rx queue when Receive All is also set.

When this option is enabled:
- Enable VFFQ only when entering promiscuous mode, because Receive All
  will pass up all rx packets that failed address filtering (similar to
  promiscuous mode).
- VLAN-promiscuous mode is never entered to allow rx packet to fail VLAN
  filters and get routed to selected VFFQ Rx queue.
Reviewed-by: default avatarVoon Weifeng <weifeng.voon@intel.com>
Reviewed-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: default avatarChuah, Kim Tatt <kim.tatt.chuah@intel.com>
Signed-off-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 17705434
...@@ -481,6 +481,8 @@ struct mac_device_info { ...@@ -481,6 +481,8 @@ struct mac_device_info {
unsigned int num_vlan; unsigned int num_vlan;
u32 vlan_filter[32]; u32 vlan_filter[32];
unsigned int promisc; unsigned int promisc;
bool vlan_fail_q_en;
u8 vlan_fail_q;
}; };
struct stmmac_rx_routing { struct stmmac_rx_routing {
......
...@@ -321,6 +321,11 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, ...@@ -321,6 +321,11 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
/* Set the maxmtu to a default of JUMBO_LEN */ /* Set the maxmtu to a default of JUMBO_LEN */
plat->maxmtu = JUMBO_LEN; plat->maxmtu = JUMBO_LEN;
plat->vlan_fail_q_en = true;
/* Use the last Rx queue */
plat->vlan_fail_q = plat->rx_queues_to_use - 1;
return 0; return 0;
} }
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
#define GMAC_PACKET_FILTER_HPF BIT(10) #define GMAC_PACKET_FILTER_HPF BIT(10)
#define GMAC_PACKET_FILTER_VTFE BIT(16) #define GMAC_PACKET_FILTER_VTFE BIT(16)
#define GMAC_PACKET_FILTER_IPFE BIT(20) #define GMAC_PACKET_FILTER_IPFE BIT(20)
#define GMAC_PACKET_FILTER_RA BIT(31)
#define GMAC_MAX_PERFECT_ADDRESSES 128 #define GMAC_MAX_PERFECT_ADDRESSES 128
......
...@@ -618,7 +618,18 @@ static void dwmac4_set_filter(struct mac_device_info *hw, ...@@ -618,7 +618,18 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
value &= ~GMAC_PACKET_FILTER_PM; value &= ~GMAC_PACKET_FILTER_PM;
value &= ~GMAC_PACKET_FILTER_PR; value &= ~GMAC_PACKET_FILTER_PR;
if (dev->flags & IFF_PROMISC) { if (dev->flags & IFF_PROMISC) {
/* VLAN Tag Filter Fail Packets Queuing */
if (hw->vlan_fail_q_en) {
value = readl(ioaddr + GMAC_RXQ_CTRL4);
value &= ~GMAC_RXQCTRL_VFFQ_MASK;
value |= GMAC_RXQCTRL_VFFQE |
(hw->vlan_fail_q << GMAC_RXQCTRL_VFFQ_SHIFT);
writel(value, ioaddr + GMAC_RXQ_CTRL4);
value = GMAC_PACKET_FILTER_PR | GMAC_PACKET_FILTER_RA;
} else {
value = GMAC_PACKET_FILTER_PR | GMAC_PACKET_FILTER_PCF; value = GMAC_PACKET_FILTER_PR | GMAC_PACKET_FILTER_PCF;
}
} else if ((dev->flags & IFF_ALLMULTI) || } else if ((dev->flags & IFF_ALLMULTI) ||
(netdev_mc_count(dev) > hw->multicast_filter_bins)) { (netdev_mc_count(dev) > hw->multicast_filter_bins)) {
/* Pass all multi */ /* Pass all multi */
...@@ -680,7 +691,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, ...@@ -680,7 +691,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
writel(value, ioaddr + GMAC_PACKET_FILTER); writel(value, ioaddr + GMAC_PACKET_FILTER);
if (dev->flags & IFF_PROMISC) { if (dev->flags & IFF_PROMISC && !hw->vlan_fail_q_en) {
if (!hw->promisc) { if (!hw->promisc) {
hw->promisc = 1; hw->promisc = 1;
dwmac4_vlan_promisc_enable(dev, hw); dwmac4_vlan_promisc_enable(dev, hw);
......
...@@ -92,6 +92,12 @@ ...@@ -92,6 +92,12 @@
#define TCEIE BIT(0) #define TCEIE BIT(0)
#define DMA_ECC_INT_STATUS 0x00001088 #define DMA_ECC_INT_STATUS 0x00001088
/* EQoS version 5.xx VLAN Tag Filter Fail Packets Queuing */
#define GMAC_RXQ_CTRL4 0x00000094
#define GMAC_RXQCTRL_VFFQ_MASK GENMASK(19, 17)
#define GMAC_RXQCTRL_VFFQ_SHIFT 17
#define GMAC_RXQCTRL_VFFQE BIT(16)
int dwmac5_safety_feat_config(void __iomem *ioaddr, unsigned int asp); int dwmac5_safety_feat_config(void __iomem *ioaddr, unsigned int asp);
int dwmac5_safety_feat_irq_status(struct net_device *ndev, int dwmac5_safety_feat_irq_status(struct net_device *ndev,
void __iomem *ioaddr, unsigned int asp, void __iomem *ioaddr, unsigned int asp,
......
...@@ -4713,6 +4713,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv) ...@@ -4713,6 +4713,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
if (priv->dma_cap.tsoen) if (priv->dma_cap.tsoen)
dev_info(priv->device, "TSO supported\n"); dev_info(priv->device, "TSO supported\n");
priv->hw->vlan_fail_q_en = priv->plat->vlan_fail_q_en;
priv->hw->vlan_fail_q = priv->plat->vlan_fail_q;
/* Run HW quirks, if any */ /* Run HW quirks, if any */
if (priv->hwif_quirks) { if (priv->hwif_quirks) {
ret = priv->hwif_quirks(priv); ret = priv->hwif_quirks(priv);
......
...@@ -198,5 +198,7 @@ struct plat_stmmacenet_data { ...@@ -198,5 +198,7 @@ struct plat_stmmacenet_data {
int mac_port_sel_speed; int mac_port_sel_speed;
bool en_tx_lpi_clockgating; bool en_tx_lpi_clockgating;
int has_xgmac; int has_xgmac;
bool vlan_fail_q_en;
u8 vlan_fail_q;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment