summaryrefslogtreecommitdiff
path: root/drivers/net/usb/aqc111.c
diff options
context:
space:
mode:
authorDmitry Bezrukov <dmitry.bezrukov@aquantia.com>2018-11-26 09:33:33 +0000
committerDavid S. Miller <davem@davemloft.net>2018-11-27 15:46:07 -0800
commit7afa6c9803eac43b205c9e33a5ea543b2c51d026 (patch)
tree240dc94547291290f2a03cace1985015d3966d00 /drivers/net/usb/aqc111.c
parent59b04eeaf294704f29052216344ce52294d7d4e1 (diff)
net: usb: aqc111: Add support for VLAN_CTAG_TX/RX offload
Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/aqc111.c')
-rw-r--r--drivers/net/usb/aqc111.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index 29131b1e0eec..3590d18ac44d 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -452,6 +452,7 @@ static int aqc111_bind(struct usbnet *dev, struct usb_interface *intf)
dev->net->hw_features |= AQ_SUPPORT_HW_FEATURE;
dev->net->features |= AQ_SUPPORT_FEATURE;
+ dev->net->vlan_features |= AQ_SUPPORT_VLAN_FEATURE;
netif_set_gso_max_size(dev->net, 65535);
@@ -714,6 +715,7 @@ static int aqc111_reset(struct usbnet *dev)
dev->net->hw_features |= AQ_SUPPORT_HW_FEATURE;
dev->net->features |= AQ_SUPPORT_FEATURE;
+ dev->net->vlan_features |= AQ_SUPPORT_VLAN_FEATURE;
/* Power up ethernet PHY */
aqc111_data->phy_cfg = AQ_PHY_POWER_EN;
@@ -793,6 +795,7 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
u32 desc_offset = 0; /*RX Header Offset*/
u16 pkt_count = 0;
u64 desc_hdr = 0;
+ u16 vlan_tag = 0;
u32 skb_len = 0;
if (!skb)
@@ -864,6 +867,12 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
if (aqc111_data->rx_checksum)
aqc111_rx_checksum(new_skb, pkt_desc);
+ if (pkt_desc & AQ_RX_PD_VLAN) {
+ vlan_tag = pkt_desc >> AQ_RX_PD_VLAN_SHIFT;
+ __vlan_hwaccel_put_tag(new_skb, htons(ETH_P_8021Q),
+ vlan_tag & VLAN_VID_MASK);
+ }
+
usbnet_skb_return(dev, new_skb);
if (pkt_count == 0)
break;
@@ -892,6 +901,7 @@ static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
int headroom = 0;
int tailroom = 0;
u64 tx_desc = 0;
+ u16 tci = 0;
/*Length of actual data*/
tx_desc |= skb->len & AQ_TX_DESC_LEN_MASK;
@@ -909,6 +919,13 @@ static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
tx_desc |= AQ_TX_DESC_DROP_PADD;
}
+ /* Vlan Tag */
+ if (vlan_get_tag(skb, &tci) >= 0) {
+ tx_desc |= AQ_TX_DESC_VLAN;
+ tx_desc |= ((u64)tci & AQ_TX_DESC_VLAN_MASK) <<
+ AQ_TX_DESC_VLAN_SHIFT;
+ }
+
if (!dev->can_dma_sg && (dev->net->features & NETIF_F_SG) &&
skb_linearize(skb))
return NULL;