treewide: replace nbd@openwrt.org with nbd@nbd.name
[openwrt/staging/wigyori.git] / target / linux / generic / files / drivers / net / phy / mvswitch.c
index d754951aca362dcca6f1c37d6ea1f9b23db6ebc0..af31d0b5ac009e818903d285214ad92b02d3adb0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Marvell 88E6060 switch driver
- * Copyright (c) 2008 Felix Fietkau <nbd@openwrt.org>
+ * Copyright (c) 2008 Felix Fietkau <nbd@nbd.name>
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of the GNU General Public License v2 as published by the
@@ -173,7 +173,7 @@ mvswitch_mangle_rx(struct net_device *dev, struct sk_buff *skb)
        if (vlan == -1)
                return;
 
-       __vlan_hwaccel_put_tag(skb, vlan);
+       __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan);
 }
 
 
@@ -307,9 +307,9 @@ mvswitch_config_init(struct phy_device *pdev)
 
 #ifdef HEADER_MODE
        dev->priv_flags |= IFF_NO_IP_ALIGN;
-       dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX;
+       dev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX;
 #else
-       dev->features |= NETIF_F_HW_VLAN_RX;
+       dev->features |= NETIF_F_HW_VLAN_CTAG_RX;
 #endif
 
        return 0;
@@ -348,16 +348,26 @@ mvswitch_config_aneg(struct phy_device *phydev)
 }
 
 static void
-mvswitch_remove(struct phy_device *pdev)
+mvswitch_detach(struct phy_device *pdev)
 {
        struct mvswitch_priv *priv = to_mvsw(pdev);
        struct net_device *dev = pdev->attached_dev;
 
+       if (!dev)
+               return;
+
        dev->phy_ptr = NULL;
        dev->eth_mangle_rx = NULL;
        dev->eth_mangle_tx = NULL;
        dev->features = priv->orig_features;
        dev->priv_flags &= ~IFF_NO_IP_ALIGN;
+}
+
+static void
+mvswitch_remove(struct phy_device *pdev)
+{
+       struct mvswitch_priv *priv = to_mvsw(pdev);
+
        kfree(priv);
 }
 
@@ -399,6 +409,7 @@ static struct phy_driver mvswitch_driver = {
        .features       = PHY_BASIC_FEATURES,
        .probe          = &mvswitch_probe,
        .remove         = &mvswitch_remove,
+       .detach         = &mvswitch_detach,
        .config_init    = &mvswitch_config_init,
        .config_aneg    = &mvswitch_config_aneg,
        .read_status    = &mvswitch_read_status,