aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000/e1000_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r--drivers/net/e1000/e1000_main.c41
1 files changed, 9 insertions, 32 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 6bd63cc67b3..ca7cd7e2bf2 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1048,8 +1048,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1048 if (pci_using_dac) 1048 if (pci_using_dac)
1049 netdev->features |= NETIF_F_HIGHDMA; 1049 netdev->features |= NETIF_F_HIGHDMA;
1050 1050
1051 netdev->features |= NETIF_F_LLTX;
1052
1053 netdev->vlan_features |= NETIF_F_TSO; 1051 netdev->vlan_features |= NETIF_F_TSO;
1054 netdev->vlan_features |= NETIF_F_TSO6; 1052 netdev->vlan_features |= NETIF_F_TSO6;
1055 netdev->vlan_features |= NETIF_F_HW_CSUM; 1053 netdev->vlan_features |= NETIF_F_HW_CSUM;
@@ -1368,8 +1366,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
1368 return -ENOMEM; 1366 return -ENOMEM;
1369 } 1367 }
1370 1368
1371 spin_lock_init(&adapter->tx_queue_lock);
1372
1373 /* Explicitly disable IRQ since the NIC can be in any state. */ 1369 /* Explicitly disable IRQ since the NIC can be in any state. */
1374 e1000_irq_disable(adapter); 1370 e1000_irq_disable(adapter);
1375 1371
@@ -1624,7 +1620,6 @@ setup_tx_desc_die:
1624 1620
1625 txdr->next_to_use = 0; 1621 txdr->next_to_use = 0;
1626 txdr->next_to_clean = 0; 1622 txdr->next_to_clean = 0;
1627 spin_lock_init(&txdr->tx_lock);
1628 1623
1629 return 0; 1624 return 0;
1630} 1625}
@@ -2865,11 +2860,11 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter,
2865 return false; 2860 return false;
2866 2861
2867 switch (skb->protocol) { 2862 switch (skb->protocol) {
2868 case __constant_htons(ETH_P_IP): 2863 case cpu_to_be16(ETH_P_IP):
2869 if (ip_hdr(skb)->protocol == IPPROTO_TCP) 2864 if (ip_hdr(skb)->protocol == IPPROTO_TCP)
2870 cmd_len |= E1000_TXD_CMD_TCP; 2865 cmd_len |= E1000_TXD_CMD_TCP;
2871 break; 2866 break;
2872 case __constant_htons(ETH_P_IPV6): 2867 case cpu_to_be16(ETH_P_IPV6):
2873 /* XXX not handling all IPV6 headers */ 2868 /* XXX not handling all IPV6 headers */
2874 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP) 2869 if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
2875 cmd_len |= E1000_TXD_CMD_TCP; 2870 cmd_len |= E1000_TXD_CMD_TCP;
@@ -3185,7 +3180,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3185 unsigned int max_txd_pwr = E1000_MAX_TXD_PWR; 3180 unsigned int max_txd_pwr = E1000_MAX_TXD_PWR;
3186 unsigned int tx_flags = 0; 3181 unsigned int tx_flags = 0;
3187 unsigned int len = skb->len - skb->data_len; 3182 unsigned int len = skb->len - skb->data_len;
3188 unsigned long flags;
3189 unsigned int nr_frags; 3183 unsigned int nr_frags;
3190 unsigned int mss; 3184 unsigned int mss;
3191 int count = 0; 3185 int count = 0;
@@ -3290,22 +3284,15 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3290 (hw->mac_type == e1000_82573)) 3284 (hw->mac_type == e1000_82573))
3291 e1000_transfer_dhcp_info(adapter, skb); 3285 e1000_transfer_dhcp_info(adapter, skb);
3292 3286
3293 if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags))
3294 /* Collision - tell upper layer to requeue */
3295 return NETDEV_TX_LOCKED;
3296
3297 /* need: count + 2 desc gap to keep tail from touching 3287 /* need: count + 2 desc gap to keep tail from touching
3298 * head, otherwise try next time */ 3288 * head, otherwise try next time */
3299 if (unlikely(e1000_maybe_stop_tx(netdev, tx_ring, count + 2))) { 3289 if (unlikely(e1000_maybe_stop_tx(netdev, tx_ring, count + 2)))
3300 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
3301 return NETDEV_TX_BUSY; 3290 return NETDEV_TX_BUSY;
3302 }
3303 3291
3304 if (unlikely(hw->mac_type == e1000_82547)) { 3292 if (unlikely(hw->mac_type == e1000_82547)) {
3305 if (unlikely(e1000_82547_fifo_workaround(adapter, skb))) { 3293 if (unlikely(e1000_82547_fifo_workaround(adapter, skb))) {
3306 netif_stop_queue(netdev); 3294 netif_stop_queue(netdev);
3307 mod_timer(&adapter->tx_fifo_stall_timer, jiffies + 1); 3295 mod_timer(&adapter->tx_fifo_stall_timer, jiffies + 1);
3308 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
3309 return NETDEV_TX_BUSY; 3296 return NETDEV_TX_BUSY;
3310 } 3297 }
3311 } 3298 }
@@ -3320,7 +3307,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3320 tso = e1000_tso(adapter, tx_ring, skb); 3307 tso = e1000_tso(adapter, tx_ring, skb);
3321 if (tso < 0) { 3308 if (tso < 0) {
3322 dev_kfree_skb_any(skb); 3309 dev_kfree_skb_any(skb);
3323 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
3324 return NETDEV_TX_OK; 3310 return NETDEV_TX_OK;
3325 } 3311 }
3326 3312
@@ -3345,7 +3331,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3345 /* Make sure there is space in the ring for the next send. */ 3331 /* Make sure there is space in the ring for the next send. */
3346 e1000_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 2); 3332 e1000_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 2);
3347 3333
3348 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
3349 return NETDEV_TX_OK; 3334 return NETDEV_TX_OK;
3350} 3335}
3351 3336
@@ -3687,12 +3672,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
3687 mod_timer(&adapter->watchdog_timer, jiffies + 1); 3672 mod_timer(&adapter->watchdog_timer, jiffies + 1);
3688 } 3673 }
3689 3674
3690 if (likely(netif_rx_schedule_prep(&adapter->napi))) { 3675 if (likely(napi_schedule_prep(&adapter->napi))) {
3691 adapter->total_tx_bytes = 0; 3676 adapter->total_tx_bytes = 0;
3692 adapter->total_tx_packets = 0; 3677 adapter->total_tx_packets = 0;
3693 adapter->total_rx_bytes = 0; 3678 adapter->total_rx_bytes = 0;
3694 adapter->total_rx_packets = 0; 3679 adapter->total_rx_packets = 0;
3695 __netif_rx_schedule(&adapter->napi); 3680 __napi_schedule(&adapter->napi);
3696 } else 3681 } else
3697 e1000_irq_enable(adapter); 3682 e1000_irq_enable(adapter);
3698 3683
@@ -3747,12 +3732,12 @@ static irqreturn_t e1000_intr(int irq, void *data)
3747 ew32(IMC, ~0); 3732 ew32(IMC, ~0);
3748 E1000_WRITE_FLUSH(); 3733 E1000_WRITE_FLUSH();
3749 } 3734 }
3750 if (likely(netif_rx_schedule_prep(&adapter->napi))) { 3735 if (likely(napi_schedule_prep(&adapter->napi))) {
3751 adapter->total_tx_bytes = 0; 3736 adapter->total_tx_bytes = 0;
3752 adapter->total_tx_packets = 0; 3737 adapter->total_tx_packets = 0;
3753 adapter->total_rx_bytes = 0; 3738 adapter->total_rx_bytes = 0;
3754 adapter->total_rx_packets = 0; 3739 adapter->total_rx_packets = 0;
3755 __netif_rx_schedule(&adapter->napi); 3740 __napi_schedule(&adapter->napi);
3756 } else 3741 } else
3757 /* this really should not happen! if it does it is basically a 3742 /* this really should not happen! if it does it is basically a
3758 * bug, but not a hard error, so enable ints and continue */ 3743 * bug, but not a hard error, so enable ints and continue */
@@ -3773,15 +3758,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
3773 3758
3774 adapter = netdev_priv(poll_dev); 3759 adapter = netdev_priv(poll_dev);
3775 3760
3776 /* e1000_clean is called per-cpu. This lock protects 3761 tx_cleaned = e1000_clean_tx_irq(adapter, &adapter->tx_ring[0]);
3777 * tx_ring[0] from being cleaned by multiple cpus
3778 * simultaneously. A failure obtaining the lock means
3779 * tx_ring[0] is currently being cleaned anyway. */
3780 if (spin_trylock(&adapter->tx_queue_lock)) {
3781 tx_cleaned = e1000_clean_tx_irq(adapter,
3782 &adapter->tx_ring[0]);
3783 spin_unlock(&adapter->tx_queue_lock);
3784 }
3785 3762
3786 adapter->clean_rx(adapter, &adapter->rx_ring[0], 3763 adapter->clean_rx(adapter, &adapter->rx_ring[0],
3787 &work_done, budget); 3764 &work_done, budget);
@@ -3793,7 +3770,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
3793 if (work_done < budget) { 3770 if (work_done < budget) {
3794 if (likely(adapter->itr_setting & 3)) 3771 if (likely(adapter->itr_setting & 3))
3795 e1000_set_itr(adapter); 3772 e1000_set_itr(adapter);
3796 netif_rx_complete(napi); 3773 napi_complete(napi);
3797 e1000_irq_enable(adapter); 3774 e1000_irq_enable(adapter);
3798 } 3775 }
3799 3776