diff options
author | Fugang Duan <B38611@freescale.com> | 2014-03-24 05:56:35 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:58:08 -0400 |
commit | 21620dab8b2702c28fb72b2221133a710f404ce8 (patch) | |
tree | 2e2dfdb111d55375af2f26dddce8c140d65a2ef7 /drivers/net | |
parent | f9c2cbe660ed9eca86bc866ea5267fe404e05fc3 (diff) |
ENGR00305272 net: fec: keep VLAN tag in default
By default, keep VLAN tag and tranfer to user.
If remove the VLAN tag, enable the quirk "FEC_QUIRK_HAS_VLAN" for
enet IP.
Signed-off-by: Fugang Duan <B38611@freescale.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/freescale/fec_main.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 580625659bc3..f5178a9b30c5 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -111,8 +111,7 @@ static struct platform_device_id fec_devtype[] = { | |||
111 | .name = "imx6q-fec", | 111 | .name = "imx6q-fec", |
112 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 112 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
113 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | 113 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
114 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | | 114 | FEC_QUIRK_ERR006358 | FEC_QUIRK_BUG_WAITMODE, |
115 | FEC_QUIRK_BUG_WAITMODE, | ||
116 | }, { | 115 | }, { |
117 | .name = "mvf600-fec", | 116 | .name = "mvf600-fec", |
118 | .driver_data = FEC_QUIRK_ENET_MAC, | 117 | .driver_data = FEC_QUIRK_ENET_MAC, |
@@ -120,8 +119,8 @@ static struct platform_device_id fec_devtype[] = { | |||
120 | .name = "imx6sx-fec", | 119 | .name = "imx6sx-fec", |
121 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 120 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
122 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | 121 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
123 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB | | 122 | FEC_QUIRK_HAS_AVB | FEC_QUIRK_TKT210582 | |
124 | FEC_QUIRK_TKT210582 | FEC_QUIRK_TKT210590, | 123 | FEC_QUIRK_TKT210590, |
125 | }, { | 124 | }, { |
126 | /* sentinel */ | 125 | /* sentinel */ |
127 | } | 126 | } |
@@ -1037,13 +1036,13 @@ fec_enet_rx(struct net_device *ndev, int budget) | |||
1037 | 1036 | ||
1038 | /* If this is a VLAN packet remove the VLAN Tag */ | 1037 | /* If this is a VLAN packet remove the VLAN Tag */ |
1039 | vlan_packet_rcvd = false; | 1038 | vlan_packet_rcvd = false; |
1040 | if ((ndev->features & NETIF_F_HW_VLAN_CTAG_RX) && | 1039 | if (fep->bufdesc_ex && (ebdp->cbd_esc & BD_ENET_RX_VLAN)) { |
1041 | fep->bufdesc_ex && (ebdp->cbd_esc & BD_ENET_RX_VLAN)) { | ||
1042 | /* Push and remove the vlan tag */ | 1040 | /* Push and remove the vlan tag */ |
1043 | struct vlan_hdr *vlan_header = | 1041 | struct vlan_hdr *vlan_header = |
1044 | (struct vlan_hdr *) (data + ETH_HLEN); | 1042 | (struct vlan_hdr *) (data + ETH_HLEN); |
1045 | vlan_tag = ntohs(vlan_header->h_vlan_TCI); | 1043 | vlan_tag = ntohs(vlan_header->h_vlan_TCI); |
1046 | pkt_len -= VLAN_HLEN; | 1044 | if (ndev->features & NETIF_F_HW_VLAN_CTAG_RX) |
1045 | pkt_len -= VLAN_HLEN; | ||
1047 | 1046 | ||
1048 | vlan_packet_rcvd = true; | 1047 | vlan_packet_rcvd = true; |
1049 | } | 1048 | } |
@@ -1063,12 +1062,16 @@ fec_enet_rx(struct net_device *ndev, int budget) | |||
1063 | skb_put(skb, pkt_len - 4); /* Make room */ | 1062 | skb_put(skb, pkt_len - 4); /* Make room */ |
1064 | 1063 | ||
1065 | /* Extract the frame data without the VLAN header. */ | 1064 | /* Extract the frame data without the VLAN header. */ |
1066 | skb_copy_to_linear_data(skb, data, (2 * ETH_ALEN)); | 1065 | if (ndev->features & NETIF_F_HW_VLAN_CTAG_RX && |
1067 | if (vlan_packet_rcvd) | 1066 | vlan_packet_rcvd) { |
1067 | skb_copy_to_linear_data(skb, data, (2 * ETH_ALEN)); | ||
1068 | payload_offset = (2 * ETH_ALEN) + VLAN_HLEN; | 1068 | payload_offset = (2 * ETH_ALEN) + VLAN_HLEN; |
1069 | skb_copy_to_linear_data_offset(skb, (2 * ETH_ALEN), | 1069 | skb_copy_to_linear_data_offset(skb, (2 * ETH_ALEN), |
1070 | data + payload_offset, | 1070 | data + payload_offset, |
1071 | pkt_len - 4 - (2 * ETH_ALEN)); | 1071 | pkt_len - 4 - (2 * ETH_ALEN)); |
1072 | } else { | ||
1073 | skb_copy_to_linear_data(skb, data, pkt_len - 4); | ||
1074 | } | ||
1072 | 1075 | ||
1073 | /* Get receive timestamp from the skb */ | 1076 | /* Get receive timestamp from the skb */ |
1074 | if (fep->hwts_rx_en && fep->bufdesc_ex) { | 1077 | if (fep->hwts_rx_en && fep->bufdesc_ex) { |