提交 87241840 编写于 作者: K Kevin Hao 提交者: David S. Miller

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: NKevin Hao <kexin.hao@windriver.com>
Acked-by: NJay Cliburn <jacliburn@bellsouth.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0acb2839
...@@ -116,7 +116,6 @@ static int __devinit atl2_sw_init(struct atl2_adapter *adapter) ...@@ -116,7 +116,6 @@ static int __devinit atl2_sw_init(struct atl2_adapter *adapter)
hw->max_frame_size = adapter->netdev->mtu; hw->max_frame_size = adapter->netdev->mtu;
spin_lock_init(&adapter->stats_lock); spin_lock_init(&adapter->stats_lock);
spin_lock_init(&adapter->tx_lock);
set_bit(__ATL2_DOWN, &adapter->flags); set_bit(__ATL2_DOWN, &adapter->flags);
...@@ -751,11 +750,7 @@ static void atl2_down(struct atl2_adapter *adapter) ...@@ -751,11 +750,7 @@ static void atl2_down(struct atl2_adapter *adapter)
* reschedule our watchdog timer */ * reschedule our watchdog timer */
set_bit(__ATL2_DOWN, &adapter->flags); set_bit(__ATL2_DOWN, &adapter->flags);
#ifdef NETIF_F_LLTX
netif_stop_queue(netdev);
#else
netif_tx_disable(netdev); netif_tx_disable(netdev);
#endif
/* reset MAC to disable all RX/TX */ /* reset MAC to disable all RX/TX */
atl2_reset_hw(&adapter->hw); atl2_reset_hw(&adapter->hw);
...@@ -831,7 +826,6 @@ static inline int TxdFreeBytes(struct atl2_adapter *adapter) ...@@ -831,7 +826,6 @@ static inline int TxdFreeBytes(struct atl2_adapter *adapter)
static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev) static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
{ {
struct atl2_adapter *adapter = netdev_priv(netdev); struct atl2_adapter *adapter = netdev_priv(netdev);
unsigned long flags;
struct tx_pkt_header *txph; struct tx_pkt_header *txph;
u32 offset, copy_len; u32 offset, copy_len;
int txs_unused; int txs_unused;
...@@ -847,16 +841,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -847,16 +841,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
#ifdef NETIF_F_LLTX
local_irq_save(flags);
if (!spin_trylock(&adapter->tx_lock)) {
/* Collision - tell upper layer to requeue */
local_irq_restore(flags);
return NETDEV_TX_LOCKED;
}
#else
spin_lock_irqsave(&adapter->tx_lock, flags);
#endif
txs_unused = TxsFreeUnit(adapter); txs_unused = TxsFreeUnit(adapter);
txbuf_unused = TxdFreeBytes(adapter); txbuf_unused = TxdFreeBytes(adapter);
...@@ -864,7 +848,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -864,7 +848,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
txs_unused < 1) { txs_unused < 1) {
/* not enough resources */ /* not enough resources */
netif_stop_queue(netdev); netif_stop_queue(netdev);
spin_unlock_irqrestore(&adapter->tx_lock, flags);
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
...@@ -910,8 +893,7 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -910,8 +893,7 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
ATL2_WRITE_REGW(&adapter->hw, REG_MB_TXD_WR_IDX, ATL2_WRITE_REGW(&adapter->hw, REG_MB_TXD_WR_IDX,
(adapter->txd_write_ptr >> 2)); (adapter->txd_write_ptr >> 2));
spin_unlock_irqrestore(&adapter->tx_lock, flags); mmiowb();
netdev->trans_start = jiffies; netdev->trans_start = jiffies;
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
...@@ -1449,10 +1431,6 @@ static int __devinit atl2_probe(struct pci_dev *pdev, ...@@ -1449,10 +1431,6 @@ static int __devinit atl2_probe(struct pci_dev *pdev,
netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); netdev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
#endif #endif
#ifdef NETIF_F_LLTX
netdev->features |= NETIF_F_LLTX;
#endif
/* Init PHY as early as possible due to power saving issue */ /* Init PHY as early as possible due to power saving issue */
atl2_phy_init(&adapter->hw); atl2_phy_init(&adapter->hw);
......
...@@ -462,7 +462,6 @@ struct atl2_adapter { ...@@ -462,7 +462,6 @@ struct atl2_adapter {
u16 link_duplex; u16 link_duplex;
spinlock_t stats_lock; spinlock_t stats_lock;
spinlock_t tx_lock;
struct work_struct reset_task; struct work_struct reset_task;
struct work_struct link_chg_task; struct work_struct link_chg_task;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册