64
64
#define DEFAULT_RX_CSUM_ENABLE (true)
65
65
#define DEFAULT_TSO_CSUM_ENABLE (true)
66
66
#define DEFAULT_VLAN_FILTER_ENABLE (true)
67
+ #define DEFAULT_VLAN_RX_OFFLOAD (true)
67
68
#define TX_OVERHEAD (8)
68
69
#define RXW_PADDING 2
69
70
@@ -2297,6 +2298,11 @@ static int lan78xx_set_features(struct net_device *netdev,
2297
2298
pdata -> rfe_ctl &= ~(RFE_CTL_ICMP_COE_ | RFE_CTL_IGMP_COE_ );
2298
2299
}
2299
2300
2301
+ if (features & NETIF_F_HW_VLAN_CTAG_RX )
2302
+ pdata -> rfe_ctl |= RFE_CTL_VLAN_STRIP_ ;
2303
+ else
2304
+ pdata -> rfe_ctl &= ~RFE_CTL_VLAN_STRIP_ ;
2305
+
2300
2306
if (features & NETIF_F_HW_VLAN_CTAG_FILTER )
2301
2307
pdata -> rfe_ctl |= RFE_CTL_VLAN_FILTER_ ;
2302
2308
else
@@ -2921,6 +2927,9 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
2921
2927
if (DEFAULT_TSO_CSUM_ENABLE )
2922
2928
dev -> net -> features |= NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG ;
2923
2929
2930
+ if (DEFAULT_VLAN_RX_OFFLOAD )
2931
+ dev -> net -> features |= NETIF_F_HW_VLAN_CTAG_RX ;
2932
+
2924
2933
if (DEFAULT_VLAN_FILTER_ENABLE )
2925
2934
dev -> net -> features |= NETIF_F_HW_VLAN_CTAG_FILTER ;
2926
2935
@@ -3001,6 +3010,16 @@ static void lan78xx_rx_csum_offload(struct lan78xx_net *dev,
3001
3010
}
3002
3011
}
3003
3012
3013
+ static void lan78xx_rx_vlan_offload (struct lan78xx_net * dev ,
3014
+ struct sk_buff * skb ,
3015
+ u32 rx_cmd_a , u32 rx_cmd_b )
3016
+ {
3017
+ if ((dev -> net -> features & NETIF_F_HW_VLAN_CTAG_RX ) &&
3018
+ (rx_cmd_a & RX_CMD_A_FVTG_ ))
3019
+ __vlan_hwaccel_put_tag (skb , htons (ETH_P_8021Q ),
3020
+ (rx_cmd_b & 0xffff ));
3021
+ }
3022
+
3004
3023
static void lan78xx_skb_return (struct lan78xx_net * dev , struct sk_buff * skb )
3005
3024
{
3006
3025
int status ;
@@ -3065,6 +3084,8 @@ static int lan78xx_rx(struct lan78xx_net *dev, struct sk_buff *skb)
3065
3084
if (skb -> len == size ) {
3066
3085
lan78xx_rx_csum_offload (dev , skb ,
3067
3086
rx_cmd_a , rx_cmd_b );
3087
+ lan78xx_rx_vlan_offload (dev , skb ,
3088
+ rx_cmd_a , rx_cmd_b );
3068
3089
3069
3090
skb_trim (skb , skb -> len - 4 ); /* remove fcs */
3070
3091
skb -> truesize = size + sizeof (struct sk_buff );
@@ -3083,6 +3104,7 @@ static int lan78xx_rx(struct lan78xx_net *dev, struct sk_buff *skb)
3083
3104
skb_set_tail_pointer (skb2 , size );
3084
3105
3085
3106
lan78xx_rx_csum_offload (dev , skb2 , rx_cmd_a , rx_cmd_b );
3107
+ lan78xx_rx_vlan_offload (dev , skb2 , rx_cmd_a , rx_cmd_b );
3086
3108
3087
3109
skb_trim (skb2 , skb2 -> len - 4 ); /* remove fcs */
3088
3110
skb2 -> truesize = size + sizeof (struct sk_buff );
0 commit comments