[PATCH 1/2] alx: rename vlan flag for new version kernels

xiong xiong at qca.qualcomm.com
Wed May 22 18:13:30 EDT 2013


NETIF_F_HW_VLAN_RX and NETIF_F_HW_VLAN_TX has been rename to
NETIF_F_HW_VLAN_CTAG_RX and NETIF_F_HW_VLAN_CTAG_RX respectively for new
version kernels.
besides, the vlan tag was 'ntohs' twice for __vlan_hwaccel_put_tag for the
previous code, that's wrong.

Signed-off-by: xiong <xiong at qca.qualcomm.com>
---
 src/alx_main.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/alx_main.c b/src/alx_main.c
index ee78ca4..ba29da4 100644
--- a/src/alx_main.c
+++ b/src/alx_main.c
@@ -692,7 +692,7 @@ static bool alx_dispatch_skb(struct alx_rx_queue *rxq)
 		/* vlan tag */
 		if (rrd->word3 & (1 << RRD_VLTAGGED_SHIFT)) {
 			u16 tag = ntohs(FIELD_GETX(rrd->word2, RRD_VLTAG));
-			__vlan_hwaccel_put_tag(skb, ntohs(tag));
+			__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), tag);
 		}
 		qnum = FIELD_GETX(rrd->word2, RRD_RSSQ) % adpt->nr_rxq;
 		tmp_rxq = ALX_CAP(&adpt->hw, MRQ) ?
@@ -1131,7 +1131,7 @@ static int alx_init_sw(struct alx_adapter *adpt)
 static void alx_set_vlan_mode(struct alx_hw *hw,
 			      netdev_features_t features)
 {
-	if (features & NETIF_F_HW_VLAN_RX)
+	if (features & NETIF_F_HW_VLAN_CTAG_RX)
 		hw->rx_ctrl |= ALX_MAC_CTRL_VLANSTRIP;
 	else
 		hw->rx_ctrl &= ~ALX_MAC_CTRL_VLANSTRIP;
@@ -1147,10 +1147,10 @@ static netdev_features_t alx_fix_features(struct net_device *netdev,
 	 * Since there is no support for separate rx/tx vlan accel
 	 * enable/disable make sure tx flag is always in same state as rx.
 	 */
-	if (features & NETIF_F_HW_VLAN_RX)
-		features |= NETIF_F_HW_VLAN_TX;
+	if (features & NETIF_F_HW_VLAN_CTAG_RX)
+		features |= NETIF_F_HW_VLAN_CTAG_TX;
 	else
-		features &= ~NETIF_F_HW_VLAN_TX;
+		features &= ~NETIF_F_HW_VLAN_CTAG_TX;
 
 	if (netdev->mtu > ALX_MAX_TSO_PKT_SIZE)
 		features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
@@ -1165,7 +1165,7 @@ static int alx_set_features(struct net_device *netdev,
 	struct alx_adapter *adpt = netdev_priv(netdev);
 	netdev_features_t changed = netdev->features ^ features;
 
-	if (!(changed & NETIF_F_HW_VLAN_RX))
+	if (!(changed & NETIF_F_HW_VLAN_CTAG_RX))
 		return 0;
 
 	alx_set_vlan_mode(&adpt->hw, features);
@@ -2612,10 +2612,11 @@ alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	netdev->hw_features = NETIF_F_SG	 |
 			      NETIF_F_HW_CSUM	 |
-			      NETIF_F_HW_VLAN_RX |
+			      NETIF_F_HW_VLAN_CTAG_RX |
 			      NETIF_F_TSO        |
 			      NETIF_F_TSO6;
-	netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_TX;
+	netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_CTAG_TX;
+	netdev->vlan_features = netdev->features;
 
 	/* read permanent mac addr from register or eFuse */
 	if (alx_get_perm_macaddr(hw, hw->perm_addr)) {
-- 
1.8.0.msysgit.0




More information about the unified-drivers mailing list