* [net-next,15/19] net: usb: aqc111: Add support for VLAN_CTAG_TX/RX offload
@ 2018-10-08 14:14 Oliver Neukum
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2018-10-08 14:14 UTC (permalink / raw)
To: Igor Russkikh, David S . Miller
Cc: Dmitry Bezrukov, linux-usb@vger.kernel.org,
netdev@vger.kernel.org
On Fr, 2018-10-05 at 10:25 +0000, Igor Russkikh wrote:
> From: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
>
> Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
> ---
> drivers/net/usb/aqc111.c | 14 ++++++++++++++
> drivers/net/usb/aqc111.h | 7 ++++++-
> 2 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
> index cc23c39beab3..a9051dd7c5bd 100644
> --- a/drivers/net/usb/aqc111.c
> +++ b/drivers/net/usb/aqc111.c
> @@ -524,6 +524,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;
>
> aqc111_read_fw_version(dev, aqc111_data);
> aqc111_data->autoneg = AUTONEG_ENABLE;
> @@ -817,6 +818,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_ops.advertising = 0;
> @@ -992,6 +994,11 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
> new_skb->truesize = new_skb->len + sizeof(struct sk_buff);
> if (aqc111_data->rx_checksum)
> aqc111_rx_checksum(new_skb, &pkt_desc);
> + if (pkt_desc->vlan_ind)
> + __vlan_hwaccel_put_tag(new_skb,
> + htons(ETH_P_8021Q),
> + pkt_desc->vlan_tag &
> + VLAN_VID_MASK);
>
> usbnet_skb_return(dev, new_skb);
> if (pkt_count == 0)
> @@ -1020,6 +1027,7 @@ static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
> int tailroom = 0;
> int padding_size = 0;
> struct sk_buff *new_skb = NULL;
> + u16 tci = 0;
>
> memset(&tx_hdr, 0x00, sizeof(tx_hdr));
>
> @@ -1038,6 +1046,12 @@ static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
> tx_hdr.drop_padding = 1;
> }
>
> + /* Vlan Tag */
> + if (vlan_get_tag(skb, &tci) >= 0) {
> + tx_hdr.vlan_tag = 1;
> + tx_hdr.vlan_info = tci;
Endianness
Regards
Oliver
^ permalink raw reply [flat|nested] 2+ messages in thread* [net-next,15/19] net: usb: aqc111: Add support for VLAN_CTAG_TX/RX offload
@ 2018-10-05 10:25 Igor Russkikh
0 siblings, 0 replies; 2+ messages in thread
From: Igor Russkikh @ 2018-10-05 10:25 UTC (permalink / raw)
To: David S . Miller
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, Igor Russkikh,
Dmitry Bezrukov
From: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Dmitry Bezrukov <dmitry.bezrukov@aquantia.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
drivers/net/usb/aqc111.c | 14 ++++++++++++++
drivers/net/usb/aqc111.h | 7 ++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
index cc23c39beab3..a9051dd7c5bd 100644
--- a/drivers/net/usb/aqc111.c
+++ b/drivers/net/usb/aqc111.c
@@ -524,6 +524,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;
aqc111_read_fw_version(dev, aqc111_data);
aqc111_data->autoneg = AUTONEG_ENABLE;
@@ -817,6 +818,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_ops.advertising = 0;
@@ -992,6 +994,11 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
new_skb->truesize = new_skb->len + sizeof(struct sk_buff);
if (aqc111_data->rx_checksum)
aqc111_rx_checksum(new_skb, &pkt_desc);
+ if (pkt_desc->vlan_ind)
+ __vlan_hwaccel_put_tag(new_skb,
+ htons(ETH_P_8021Q),
+ pkt_desc->vlan_tag &
+ VLAN_VID_MASK);
usbnet_skb_return(dev, new_skb);
if (pkt_count == 0)
@@ -1020,6 +1027,7 @@ static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
int tailroom = 0;
int padding_size = 0;
struct sk_buff *new_skb = NULL;
+ u16 tci = 0;
memset(&tx_hdr, 0x00, sizeof(tx_hdr));
@@ -1038,6 +1046,12 @@ static struct sk_buff *aqc111_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
tx_hdr.drop_padding = 1;
}
+ /* Vlan Tag */
+ if (vlan_get_tag(skb, &tci) >= 0) {
+ tx_hdr.vlan_tag = 1;
+ tx_hdr.vlan_info = tci;
+ }
+
if (!dev->can_dma_sg && (dev->net->features & NETIF_F_SG) &&
skb_linearize(skb))
return NULL;
diff --git a/drivers/net/usb/aqc111.h b/drivers/net/usb/aqc111.h
index 2f324ec66a65..e33459d90ddd 100644
--- a/drivers/net/usb/aqc111.h
+++ b/drivers/net/usb/aqc111.h
@@ -68,12 +68,17 @@
/* Feature. ********************************************/
#define AQ_SUPPORT_FEATURE (NETIF_F_SG | NETIF_F_IP_CSUM |\
NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |\
- NETIF_F_TSO)
+ NETIF_F_TSO | NETIF_F_HW_VLAN_CTAG_TX |\
+ NETIF_F_HW_VLAN_CTAG_RX)
#define AQ_SUPPORT_HW_FEATURE (NETIF_F_SG | NETIF_F_IP_CSUM |\
NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |\
NETIF_F_TSO)
+#define AQ_SUPPORT_VLAN_FEATURE (NETIF_F_SG | NETIF_F_IP_CSUM |\
+ NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |\
+ NETIF_F_TSO)
+
/* SFR Reg. ********************************************/
#define SFR_GENERAL_STATUS 0x03
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-08 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-08 14:14 [net-next,15/19] net: usb: aqc111: Add support for VLAN_CTAG_TX/RX offload Oliver Neukum
-- strict thread matches above, loose matches on Subject: below --
2018-10-05 10:25 Igor Russkikh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).