aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/igb_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/igb/igb_main.c')
-rw-r--r--drivers/net/igb/igb_main.c77
1 files changed, 30 insertions, 47 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 87eed88d9586..5a6fff622e4f 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -106,7 +106,6 @@ static irqreturn_t igb_intr_msi(int irq, void *);
106static irqreturn_t igb_msix_other(int irq, void *); 106static irqreturn_t igb_msix_other(int irq, void *);
107static irqreturn_t igb_msix_rx(int irq, void *); 107static irqreturn_t igb_msix_rx(int irq, void *);
108static irqreturn_t igb_msix_tx(int irq, void *); 108static irqreturn_t igb_msix_tx(int irq, void *);
109static int igb_clean_rx_ring_msix(struct napi_struct *, int);
110#ifdef CONFIG_IGB_DCA 109#ifdef CONFIG_IGB_DCA
111static void igb_update_rx_dca(struct igb_ring *); 110static void igb_update_rx_dca(struct igb_ring *);
112static void igb_update_tx_dca(struct igb_ring *); 111static void igb_update_tx_dca(struct igb_ring *);
@@ -3688,50 +3687,35 @@ static irqreturn_t igb_intr(int irq, void *data)
3688 return IRQ_HANDLED; 3687 return IRQ_HANDLED;
3689} 3688}
3690 3689
3691/** 3690static inline void igb_rx_irq_enable(struct igb_ring *rx_ring)
3692 * igb_poll - NAPI Rx polling callback
3693 * @napi: napi polling structure
3694 * @budget: count of how many packets we should handle
3695 **/
3696static int igb_poll(struct napi_struct *napi, int budget)
3697{ 3691{
3698 struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi);
3699 struct igb_adapter *adapter = rx_ring->adapter; 3692 struct igb_adapter *adapter = rx_ring->adapter;
3700 struct net_device *netdev = adapter->netdev; 3693 struct e1000_hw *hw = &adapter->hw;
3701 int tx_clean_complete, work_done = 0;
3702
3703 /* this poll routine only supports one tx and one rx queue */
3704#ifdef CONFIG_IGB_DCA
3705 if (adapter->flags & IGB_FLAG_DCA_ENABLED)
3706 igb_update_tx_dca(&adapter->tx_ring[0]);
3707#endif
3708 tx_clean_complete = igb_clean_tx_irq(&adapter->tx_ring[0]);
3709
3710#ifdef CONFIG_IGB_DCA
3711 if (adapter->flags & IGB_FLAG_DCA_ENABLED)
3712 igb_update_rx_dca(&adapter->rx_ring[0]);
3713#endif
3714 igb_clean_rx_irq_adv(&adapter->rx_ring[0], &work_done, budget);
3715 3694
3716 /* If no Tx and not enough Rx work done, exit the polling mode */ 3695 if (adapter->itr_setting & 3) {
3717 if ((tx_clean_complete && (work_done < budget)) || 3696 if (adapter->num_rx_queues == 1)
3718 !netif_running(netdev)) {
3719 if (adapter->itr_setting & 3)
3720 igb_set_itr(adapter); 3697 igb_set_itr(adapter);
3721 napi_complete(napi); 3698 else
3722 if (!test_bit(__IGB_DOWN, &adapter->state)) 3699 igb_update_ring_itr(rx_ring);
3723 igb_irq_enable(adapter);
3724 return 0;
3725 } 3700 }
3726 3701
3727 return 1; 3702 if (!test_bit(__IGB_DOWN, &adapter->state)) {
3703 if (adapter->msix_entries)
3704 wr32(E1000_EIMS, rx_ring->eims_value);
3705 else
3706 igb_irq_enable(adapter);
3707 }
3728} 3708}
3729 3709
3730static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget) 3710/**
3711 * igb_poll - NAPI Rx polling callback
3712 * @napi: napi polling structure
3713 * @budget: count of how many packets we should handle
3714 **/
3715static int igb_poll(struct napi_struct *napi, int budget)
3731{ 3716{
3732 struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi); 3717 struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi);
3733 struct igb_adapter *adapter = rx_ring->adapter; 3718 struct igb_adapter *adapter = rx_ring->adapter;
3734 struct e1000_hw *hw = &adapter->hw;
3735 struct net_device *netdev = adapter->netdev; 3719 struct net_device *netdev = adapter->netdev;
3736 int work_done = 0; 3720 int work_done = 0;
3737 3721
@@ -3741,23 +3725,22 @@ static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget)
3741#endif 3725#endif
3742 igb_clean_rx_irq_adv(rx_ring, &work_done, budget); 3726 igb_clean_rx_irq_adv(rx_ring, &work_done, budget);
3743 3727
3728 if (rx_ring->buddy) {
3729#ifdef CONFIG_IGB_DCA
3730 if (adapter->flags & IGB_FLAG_DCA_ENABLED)
3731 igb_update_tx_dca(rx_ring->buddy);
3732#endif
3733 if (!igb_clean_tx_irq(rx_ring->buddy))
3734 work_done = budget;
3735 }
3736
3744 /* If not enough Rx work done, exit the polling mode */ 3737 /* If not enough Rx work done, exit the polling mode */
3745 if ((work_done == 0) || !netif_running(netdev)) { 3738 if ((work_done < budget) || !netif_running(netdev)) {
3746 napi_complete(napi); 3739 napi_complete(napi);
3747 3740 igb_rx_irq_enable(rx_ring);
3748 if (adapter->itr_setting & 3) {
3749 if (adapter->num_rx_queues == 1)
3750 igb_set_itr(adapter);
3751 else
3752 igb_update_ring_itr(rx_ring);
3753 }
3754 if (!test_bit(__IGB_DOWN, &adapter->state))
3755 wr32(E1000_EIMS, rx_ring->eims_value);
3756
3757 return 0;
3758 } 3741 }
3759 3742
3760 return 1; 3743 return work_done;
3761} 3744}
3762 3745
3763/** 3746/**