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
@@ -2295,6 +2296,11 @@ static int lan78xx_set_features(struct net_device *netdev,
2295
2296
pdata -> rfe_ctl &= ~(RFE_CTL_ICMP_COE_ | RFE_CTL_IGMP_COE_ );
2296
2297
}
2297
2298
2299
+ if (features & NETIF_F_HW_VLAN_CTAG_RX )
2300
+ pdata -> rfe_ctl |= RFE_CTL_VLAN_STRIP_ ;
2301
+ else
2302
+ pdata -> rfe_ctl &= ~RFE_CTL_VLAN_STRIP_ ;
2303
+
2298
2304
if (features & NETIF_F_HW_VLAN_CTAG_FILTER )
2299
2305
pdata -> rfe_ctl |= RFE_CTL_VLAN_FILTER_ ;
2300
2306
else
@@ -2919,6 +2925,9 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf)
2919
2925
if (DEFAULT_TSO_CSUM_ENABLE )
2920
2926
dev -> net -> features |= NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG ;
2921
2927
2928
+ if (DEFAULT_VLAN_RX_OFFLOAD )
2929
+ dev -> net -> features |= NETIF_F_HW_VLAN_CTAG_RX ;
2930
+
2922
2931
if (DEFAULT_VLAN_FILTER_ENABLE )
2923
2932
dev -> net -> features |= NETIF_F_HW_VLAN_CTAG_FILTER ;
2924
2933
@@ -2999,6 +3008,16 @@ static void lan78xx_rx_csum_offload(struct lan78xx_net *dev,
2999
3008
}
3000
3009
}
3001
3010
3011
+ static void lan78xx_rx_vlan_offload (struct lan78xx_net * dev ,
3012
+ struct sk_buff * skb ,
3013
+ u32 rx_cmd_a , u32 rx_cmd_b )
3014
+ {
3015
+ if ((dev -> net -> features & NETIF_F_HW_VLAN_CTAG_RX ) &&
3016
+ (rx_cmd_a & RX_CMD_A_FVTG_ ))
3017
+ __vlan_hwaccel_put_tag (skb , htons (ETH_P_8021Q ),
3018
+ (rx_cmd_b & 0xffff ));
3019
+ }
3020
+
3002
3021
static void lan78xx_skb_return (struct lan78xx_net * dev , struct sk_buff * skb )
3003
3022
{
3004
3023
int status ;
@@ -3063,6 +3082,8 @@ static int lan78xx_rx(struct lan78xx_net *dev, struct sk_buff *skb)
3063
3082
if (skb -> len == size ) {
3064
3083
lan78xx_rx_csum_offload (dev , skb ,
3065
3084
rx_cmd_a , rx_cmd_b );
3085
+ lan78xx_rx_vlan_offload (dev , skb ,
3086
+ rx_cmd_a , rx_cmd_b );
3066
3087
3067
3088
skb_trim (skb , skb -> len - 4 ); /* remove fcs */
3068
3089
skb -> truesize = size + sizeof (struct sk_buff );
@@ -3081,6 +3102,7 @@ static int lan78xx_rx(struct lan78xx_net *dev, struct sk_buff *skb)
3081
3102
skb_set_tail_pointer (skb2 , size );
3082
3103
3083
3104
lan78xx_rx_csum_offload (dev , skb2 , rx_cmd_a , rx_cmd_b );
3105
+ lan78xx_rx_vlan_offload (dev , skb2 , rx_cmd_a , rx_cmd_b );
3084
3106
3085
3107
skb_trim (skb2 , skb2 -> len - 4 ); /* remove fcs */
3086
3108
skb2 -> truesize = size + sizeof (struct sk_buff );
0 commit comments