@@ -1918,9 +1918,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
1918
1918
1919
1919
while (done < budget ) {
1920
1920
unsigned int pktlen , * rxdcsum ;
1921
- bool has_hwaccel_tag = false;
1922
1921
struct net_device * netdev ;
1923
- u16 vlan_proto , vlan_tci ;
1924
1922
dma_addr_t dma_addr ;
1925
1923
u32 hash , reason ;
1926
1924
int mac = 0 ;
@@ -2055,31 +2053,16 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
2055
2053
skb_checksum_none_assert (skb );
2056
2054
skb -> protocol = eth_type_trans (skb , netdev );
2057
2055
2058
- if (netdev -> features & NETIF_F_HW_VLAN_CTAG_RX ) {
2059
- if (MTK_HAS_CAPS (eth -> soc -> caps , MTK_NETSYS_V2 )) {
2060
- if (trxd .rxd3 & RX_DMA_VTAG_V2 ) {
2061
- vlan_proto = RX_DMA_VPID (trxd .rxd4 );
2062
- vlan_tci = RX_DMA_VID (trxd .rxd4 );
2063
- has_hwaccel_tag = true;
2064
- }
2065
- } else if (trxd .rxd2 & RX_DMA_VTAG ) {
2066
- vlan_proto = RX_DMA_VPID (trxd .rxd3 );
2067
- vlan_tci = RX_DMA_VID (trxd .rxd3 );
2068
- has_hwaccel_tag = true;
2069
- }
2070
- }
2071
-
2072
2056
/* When using VLAN untagging in combination with DSA, the
2073
2057
* hardware treats the MTK special tag as a VLAN and untags it.
2074
2058
*/
2075
- if (has_hwaccel_tag && netdev_uses_dsa (netdev )) {
2076
- unsigned int port = vlan_proto & GENMASK (2 , 0 );
2059
+ if (!MTK_HAS_CAPS (eth -> soc -> caps , MTK_NETSYS_V2 ) &&
2060
+ (trxd .rxd2 & RX_DMA_VTAG ) && netdev_uses_dsa (netdev )) {
2061
+ unsigned int port = RX_DMA_VPID (trxd .rxd3 ) & GENMASK (2 , 0 );
2077
2062
2078
2063
if (port < ARRAY_SIZE (eth -> dsa_meta ) &&
2079
2064
eth -> dsa_meta [port ])
2080
2065
skb_dst_set_noref (skb , & eth -> dsa_meta [port ]-> dst );
2081
- } else if (has_hwaccel_tag ) {
2082
- __vlan_hwaccel_put_tag (skb , htons (vlan_proto ), vlan_tci );
2083
2066
}
2084
2067
2085
2068
if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED )
@@ -2907,29 +2890,11 @@ static netdev_features_t mtk_fix_features(struct net_device *dev,
2907
2890
2908
2891
static int mtk_set_features (struct net_device * dev , netdev_features_t features )
2909
2892
{
2910
- struct mtk_mac * mac = netdev_priv (dev );
2911
- struct mtk_eth * eth = mac -> hw ;
2912
2893
netdev_features_t diff = dev -> features ^ features ;
2913
- int i ;
2914
2894
2915
2895
if ((diff & NETIF_F_LRO ) && !(features & NETIF_F_LRO ))
2916
2896
mtk_hwlro_netdev_disable (dev );
2917
2897
2918
- /* Set RX VLAN offloading */
2919
- if (!(diff & NETIF_F_HW_VLAN_CTAG_RX ))
2920
- return 0 ;
2921
-
2922
- mtk_w32 (eth , !!(features & NETIF_F_HW_VLAN_CTAG_RX ),
2923
- MTK_CDMP_EG_CTRL );
2924
-
2925
- /* sync features with other MAC */
2926
- for (i = 0 ; i < MTK_MAC_COUNT ; i ++ ) {
2927
- if (!eth -> netdev [i ] || eth -> netdev [i ] == dev )
2928
- continue ;
2929
- eth -> netdev [i ]-> features &= ~NETIF_F_HW_VLAN_CTAG_RX ;
2930
- eth -> netdev [i ]-> features |= features & NETIF_F_HW_VLAN_CTAG_RX ;
2931
- }
2932
-
2933
2898
return 0 ;
2934
2899
}
2935
2900
@@ -3247,30 +3212,6 @@ static int mtk_open(struct net_device *dev)
3247
3212
struct mtk_eth * eth = mac -> hw ;
3248
3213
int i , err ;
3249
3214
3250
- if (mtk_uses_dsa (dev ) && !eth -> prog ) {
3251
- for (i = 0 ; i < ARRAY_SIZE (eth -> dsa_meta ); i ++ ) {
3252
- struct metadata_dst * md_dst = eth -> dsa_meta [i ];
3253
-
3254
- if (md_dst )
3255
- continue ;
3256
-
3257
- md_dst = metadata_dst_alloc (0 , METADATA_HW_PORT_MUX ,
3258
- GFP_KERNEL );
3259
- if (!md_dst )
3260
- return - ENOMEM ;
3261
-
3262
- md_dst -> u .port_info .port_id = i ;
3263
- eth -> dsa_meta [i ] = md_dst ;
3264
- }
3265
- } else {
3266
- /* Hardware special tag parsing needs to be disabled if at least
3267
- * one MAC does not use DSA.
3268
- */
3269
- u32 val = mtk_r32 (eth , MTK_CDMP_IG_CTRL );
3270
- val &= ~MTK_CDMP_STAG_EN ;
3271
- mtk_w32 (eth , val , MTK_CDMP_IG_CTRL );
3272
- }
3273
-
3274
3215
err = phylink_of_phy_connect (mac -> phylink , mac -> of_node , 0 );
3275
3216
if (err ) {
3276
3217
netdev_err (dev , "%s: could not attach PHY: %d\n" , __func__ ,
@@ -3309,6 +3250,40 @@ static int mtk_open(struct net_device *dev)
3309
3250
phylink_start (mac -> phylink );
3310
3251
netif_tx_start_all_queues (dev );
3311
3252
3253
+ if (MTK_HAS_CAPS (eth -> soc -> caps , MTK_NETSYS_V2 ))
3254
+ return 0 ;
3255
+
3256
+ if (mtk_uses_dsa (dev ) && !eth -> prog ) {
3257
+ for (i = 0 ; i < ARRAY_SIZE (eth -> dsa_meta ); i ++ ) {
3258
+ struct metadata_dst * md_dst = eth -> dsa_meta [i ];
3259
+
3260
+ if (md_dst )
3261
+ continue ;
3262
+
3263
+ md_dst = metadata_dst_alloc (0 , METADATA_HW_PORT_MUX ,
3264
+ GFP_KERNEL );
3265
+ if (!md_dst )
3266
+ return - ENOMEM ;
3267
+
3268
+ md_dst -> u .port_info .port_id = i ;
3269
+ eth -> dsa_meta [i ] = md_dst ;
3270
+ }
3271
+ } else {
3272
+ /* Hardware special tag parsing needs to be disabled if at least
3273
+ * one MAC does not use DSA.
3274
+ */
3275
+ u32 val = mtk_r32 (eth , MTK_CDMP_IG_CTRL );
3276
+
3277
+ val &= ~MTK_CDMP_STAG_EN ;
3278
+ mtk_w32 (eth , val , MTK_CDMP_IG_CTRL );
3279
+
3280
+ val = mtk_r32 (eth , MTK_CDMQ_IG_CTRL );
3281
+ val &= ~MTK_CDMQ_STAG_EN ;
3282
+ mtk_w32 (eth , val , MTK_CDMQ_IG_CTRL );
3283
+
3284
+ mtk_w32 (eth , 0 , MTK_CDMP_EG_CTRL );
3285
+ }
3286
+
3312
3287
return 0 ;
3313
3288
}
3314
3289
@@ -3793,10 +3768,9 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)
3793
3768
if (!MTK_HAS_CAPS (eth -> soc -> caps , MTK_NETSYS_V2 )) {
3794
3769
val = mtk_r32 (eth , MTK_CDMP_IG_CTRL );
3795
3770
mtk_w32 (eth , val | MTK_CDMP_STAG_EN , MTK_CDMP_IG_CTRL );
3796
- }
3797
3771
3798
- /* Enable RX VLan Offloading */
3799
- mtk_w32 ( eth , 1 , MTK_CDMP_EG_CTRL );
3772
+ mtk_w32 ( eth , 1 , MTK_CDMP_EG_CTRL );
3773
+ }
3800
3774
3801
3775
/* set interrupt delays based on current Net DIM sample */
3802
3776
mtk_dim_rx (& eth -> rx_dim .work );
@@ -4453,7 +4427,7 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
4453
4427
eth -> netdev [id ]-> hw_features |= NETIF_F_LRO ;
4454
4428
4455
4429
eth -> netdev [id ]-> vlan_features = eth -> soc -> hw_features &
4456
- ~( NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX ) ;
4430
+ ~NETIF_F_HW_VLAN_CTAG_TX ;
4457
4431
eth -> netdev [id ]-> features |= eth -> soc -> hw_features ;
4458
4432
eth -> netdev [id ]-> ethtool_ops = & mtk_ethtool_ops ;
4459
4433
0 commit comments