mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 13:48:06 +00:00
ramips: implement vlan rx offload on MT7621
Avoids the overhead of software VLAN untagging in the network stack Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
701b8d0050
commit
c9262a96d1
@ -933,6 +933,11 @@ static int fe_poll_rx(struct napi_struct *napi, int budget,
|
|||||||
skb_checksum_none_assert(skb);
|
skb_checksum_none_assert(skb);
|
||||||
skb->protocol = eth_type_trans(skb, netdev);
|
skb->protocol = eth_type_trans(skb, netdev);
|
||||||
|
|
||||||
|
if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX &&
|
||||||
|
RX_DMA_VID(trxd.rxd3))
|
||||||
|
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
|
||||||
|
RX_DMA_VID(trxd.rxd3));
|
||||||
|
|
||||||
#ifdef CONFIG_NET_MEDIATEK_OFFLOAD
|
#ifdef CONFIG_NET_MEDIATEK_OFFLOAD
|
||||||
if (mtk_offload_check_rx(priv, skb, trxd.rxd4) == 0) {
|
if (mtk_offload_check_rx(priv, skb, trxd.rxd4) == 0) {
|
||||||
#endif
|
#endif
|
||||||
@ -1585,7 +1590,9 @@ static int fe_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
if (soc->init_data)
|
if (soc->init_data)
|
||||||
soc->init_data(soc, netdev);
|
soc->init_data(soc, netdev);
|
||||||
netdev->vlan_features = netdev->hw_features & ~NETIF_F_HW_VLAN_CTAG_TX;
|
netdev->vlan_features = netdev->hw_features &
|
||||||
|
~(NETIF_F_HW_VLAN_CTAG_TX |
|
||||||
|
NETIF_F_HW_VLAN_CTAG_RX);
|
||||||
netdev->features |= netdev->hw_features;
|
netdev->features |= netdev->hw_features;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_SOC_MT7621))
|
if (IS_ENABLED(CONFIG_SOC_MT7621))
|
||||||
|
@ -406,7 +406,6 @@ struct fe_soc_data {
|
|||||||
#define FE_FLAG_JUMBO_FRAME BIT(2)
|
#define FE_FLAG_JUMBO_FRAME BIT(2)
|
||||||
#define FE_FLAG_RX_2B_OFFSET BIT(3)
|
#define FE_FLAG_RX_2B_OFFSET BIT(3)
|
||||||
#define FE_FLAG_RX_SG_DMA BIT(4)
|
#define FE_FLAG_RX_SG_DMA BIT(4)
|
||||||
#define FE_FLAG_RX_VLAN_CTAG BIT(5)
|
|
||||||
#define FE_FLAG_NAPI_WEIGHT BIT(6)
|
#define FE_FLAG_NAPI_WEIGHT BIT(6)
|
||||||
#define FE_FLAG_CALIBRATE_CLK BIT(7)
|
#define FE_FLAG_CALIBRATE_CLK BIT(7)
|
||||||
#define FE_FLAG_HAS_SWITCH BIT(8)
|
#define FE_FLAG_HAS_SWITCH BIT(8)
|
||||||
|
@ -122,7 +122,7 @@ static int mt7621_fwd_config(struct fe_priv *priv)
|
|||||||
|
|
||||||
/* mt7621 doesn't have txcsum config */
|
/* mt7621 doesn't have txcsum config */
|
||||||
mt7621_rxcsum_config((dev->features & NETIF_F_RXCSUM));
|
mt7621_rxcsum_config((dev->features & NETIF_F_RXCSUM));
|
||||||
mt7621_rxvlan_config(priv->flags & FE_FLAG_RX_VLAN_CTAG);
|
mt7621_rxvlan_config(dev->features & NETIF_F_HW_VLAN_CTAG_RX);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -142,7 +142,8 @@ static void mt7621_init_data(struct fe_soc_data *data,
|
|||||||
FE_FLAG_HAS_SWITCH | FE_FLAG_JUMBO_FRAME;
|
FE_FLAG_HAS_SWITCH | FE_FLAG_JUMBO_FRAME;
|
||||||
|
|
||||||
netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
|
netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
|
||||||
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_SG | NETIF_F_TSO |
|
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
|
||||||
|
NETIF_F_SG | NETIF_F_TSO |
|
||||||
NETIF_F_TSO6 | NETIF_F_IPV6_CSUM |
|
NETIF_F_TSO6 | NETIF_F_IPV6_CSUM |
|
||||||
NETIF_F_TSO_MANGLEID;
|
NETIF_F_TSO_MANGLEID;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user