aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hao <kexin.hao@windriver.com>2008-09-25 12:20:11 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-08 18:49:24 -0400
commit87241840b214734c023bda83372059de3f7eeabd (patch)
tree805f28f7636a7f0d708c01c6d2260065aa477c7a
parent0acb28396728f42b6b1553c85d27c37513796043 (diff)
net: remove LLTX in atl2 driver
When NETIF_F_LLTX is set, the atlx driver will use a private lock. But in recent kernels this implementation seems redundant and can cause problems where AF_PACKET sees things twice. Since NETIF_F_LLTX is marked as deprecated and shouldn't be used in new driver, this patch removes NETIF_F_LLTX and adds a mmiowb before sending packet. I have tested this driver on a Eee PC. It works well. Signed-off-by: Kevin Hao <kexin.hao@windriver.com> Acked-by: Jay Cliburn <jacliburn@bellsouth.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/atlx/atl2.c24
-rw-r--r--drivers/net/atlx/atl2.h1
2 files changed, 1 insertions, 24 deletions
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index 4f82f666153..f5bdc92c1a6 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -116,7 +116,6 @@ static int __devinit atl2_sw_init(struct atl2_adapter *adapter)
116 hw->max_frame_size = adapter->netdev->mtu; 116 hw->max_frame_size = adapter->netdev->mtu;
117 117
118 spin_lock_init(&adapter->stats_lock); 118 spin_lock_init(&adapter->stats_lock);
119 spin_lock_init(&adapter->tx_lock);
120 119
121 set_bit(__ATL2_DOWN, &adapter->flags); 120 set_bit(__ATL2_DOWN, &adapter->flags);
122 121
@@ -751,11 +750,7 @@ static void atl2_down(struct atl2_adapter *adapter)
751 * reschedule our watchdog timer */ 750 * reschedule our watchdog timer */
752 set_bit(__ATL2_DOWN, &adapter->flags); 751 set_bit(__ATL2_DOWN, &adapter->flags);
753 752
754#ifdef NETIF_F_LLTX
755 netif_stop_queue(netdev);
756#else
757 netif_tx_disable(netdev); 753 netif_tx_disable(netdev);
758#endif
759 754
760 /* reset MAC to disable all RX/TX */ 755 /* reset MAC to disable all RX/TX */
761 atl2_reset_hw(&adapter->hw); 756 atl2_reset_hw(&adapter->hw);
@@ -831,7 +826,6 @@ static inline int TxdFreeBytes(struct atl2_adapter *adapter)
831static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 826static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
832{ 827{
833 struct atl2_adapter *adapter = netdev_priv(netdev); 828 struct atl2_adapter *adapter = netdev_priv(netdev);
834 unsigned long flags;
835 struct tx_pkt_header *txph; 829 struct tx_pkt_header *txph;
836 u32 offset, copy_len; 830 u32 offset, copy_len;
837 int txs_unused; 831 int txs_unused;
@@ -847,16 +841,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
847 return NETDEV_TX_OK; 841 return NETDEV_TX_OK;
848 } 842 }
849 843
850#ifdef NETIF_F_LLTX
851 local_irq_save(flags);
852 if (!spin_trylock(&adapter->tx_lock)) {
853 /* Collision - tell upper layer to requeue */
854 local_irq_restore(flags);
855 return NETDEV_TX_LOCKED;
856 }
857#else
858 spin_lock_irqsave(&adapter->tx_lock, flags);
859#endif
860 txs_unused = TxsFreeUnit(adapter); 844 txs_unused = TxsFreeUnit(adapter);
861 txbuf_unused = TxdFreeBytes(adapter); 845 txbuf_unused = TxdFreeBytes(adapter);
862 846
@@ -864,7 +848,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
864 txs_unused < 1) { 848 txs_unused < 1) {
865 /* not enough resources */ 849 /* not enough resources */
866 netif_stop_queue(netdev); 850 netif_stop_queue(netdev);
867 spin_unlock_irqrestore(&adapter->tx_lock, flags);
868 return NETDEV_TX_BUSY; 851 return NETDEV_TX_BUSY;
869 } 852 }
870 853
@@ -910,8 +893,7 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
910 ATL2_WRITE_REGW(&adapter->hw, REG_MB_TXD_WR_IDX, 893 ATL2_WRITE_REGW(&adapter->hw, REG_MB_TXD_WR_IDX,
911 (adapter->txd_write_ptr >> 2)); 894 (adapter->txd_write_ptr >> 2));
912 895
913 spin_unlock_irqrestore(&adapter->tx_lock, flags); 896 mmiowb();
914
915 netdev->trans_start = jiffies; 897 netdev->trans_start = jiffies;
916 dev_kfree_skb_any(skb); 898 dev_kfree_skb_any(skb);
917 return NETDEV_TX_OK; 899 return NETDEV_TX_OK;
@@ -1449,10 +1431,6 @@ static int __devinit atl2_probe(struct pci_dev *pdev,
1449 netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); 1431 netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
1450#endif 1432#endif
1451 1433
1452#ifdef NETIF_F_LLTX
1453 netdev->features |= NETIF_F_LLTX;
1454#endif
1455
1456 /* Init PHY as early as possible due to power saving issue */ 1434 /* Init PHY as early as possible due to power saving issue */
1457 atl2_phy_init(&adapter->hw); 1435 atl2_phy_init(&adapter->hw);
1458 1436
diff --git a/drivers/net/atlx/atl2.h b/drivers/net/atlx/atl2.h
index 6e1f28ff227..09974df76b1 100644
--- a/drivers/net/atlx/atl2.h
+++ b/drivers/net/atlx/atl2.h
@@ -462,7 +462,6 @@ struct atl2_adapter {
462 u16 link_duplex; 462 u16 link_duplex;
463 463
464 spinlock_t stats_lock; 464 spinlock_t stats_lock;
465 spinlock_t tx_lock;
466 465
467 struct work_struct reset_task; 466 struct work_struct reset_task;
468 struct work_struct link_chg_task; 467 struct work_struct link_chg_task;