aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c125
1 files changed, 54 insertions, 71 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a8edbad0335e..ca17af4349d0 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -117,19 +117,6 @@ static void ixgbe_get_hw_control(struct ixgbe_adapter *adapter)
117 ctrl_ext | IXGBE_CTRL_EXT_DRV_LOAD); 117 ctrl_ext | IXGBE_CTRL_EXT_DRV_LOAD);
118} 118}
119 119
120#ifdef DEBUG
121/**
122 * ixgbe_get_hw_dev_name - return device name string
123 * used by hardware layer to print debugging information
124 **/
125char *ixgbe_get_hw_dev_name(struct ixgbe_hw *hw)
126{
127 struct ixgbe_adapter *adapter = hw->back;
128 struct net_device *netdev = adapter->netdev;
129 return netdev->name;
130}
131#endif
132
133static void ixgbe_set_ivar(struct ixgbe_adapter *adapter, u16 int_alloc_entry, 120static void ixgbe_set_ivar(struct ixgbe_adapter *adapter, u16 int_alloc_entry,
134 u8 msix_vector) 121 u8 msix_vector)
135{ 122{
@@ -1315,7 +1302,6 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
1315 struct ixgbe_hw *hw = &adapter->hw; 1302 struct ixgbe_hw *hw = &adapter->hw;
1316 u32 eicr; 1303 u32 eicr;
1317 1304
1318
1319 /* for NAPI, using EIAM to auto-mask tx/rx interrupt bits on read 1305 /* for NAPI, using EIAM to auto-mask tx/rx interrupt bits on read
1320 * therefore no explict interrupt disable is necessary */ 1306 * therefore no explict interrupt disable is necessary */
1321 eicr = IXGBE_READ_REG(hw, IXGBE_EICR); 1307 eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
@@ -2659,6 +2645,31 @@ err:
2659} 2645}
2660 2646
2661/** 2647/**
2648 * ixgbe_setup_all_tx_resources - allocate all queues Tx resources
2649 * @adapter: board private structure
2650 *
2651 * If this function returns with an error, then it's possible one or
2652 * more of the rings is populated (while the rest are not). It is the
2653 * callers duty to clean those orphaned rings.
2654 *
2655 * Return 0 on success, negative on failure
2656 **/
2657static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter)
2658{
2659 int i, err = 0;
2660
2661 for (i = 0; i < adapter->num_tx_queues; i++) {
2662 err = ixgbe_setup_tx_resources(adapter, &adapter->tx_ring[i]);
2663 if (!err)
2664 continue;
2665 DPRINTK(PROBE, ERR, "Allocation for Tx Queue %u failed\n", i);
2666 break;
2667 }
2668
2669 return err;
2670}
2671
2672/**
2662 * ixgbe_setup_rx_resources - allocate Rx resources (Descriptors) 2673 * ixgbe_setup_rx_resources - allocate Rx resources (Descriptors)
2663 * @adapter: board private structure 2674 * @adapter: board private structure
2664 * @rx_ring: rx descriptor ring (for a specific queue) to setup 2675 * @rx_ring: rx descriptor ring (for a specific queue) to setup
@@ -2711,6 +2722,32 @@ alloc_failed:
2711} 2722}
2712 2723
2713/** 2724/**
2725 * ixgbe_setup_all_rx_resources - allocate all queues Rx resources
2726 * @adapter: board private structure
2727 *
2728 * If this function returns with an error, then it's possible one or
2729 * more of the rings is populated (while the rest are not). It is the
2730 * callers duty to clean those orphaned rings.
2731 *
2732 * Return 0 on success, negative on failure
2733 **/
2734
2735static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter)
2736{
2737 int i, err = 0;
2738
2739 for (i = 0; i < adapter->num_rx_queues; i++) {
2740 err = ixgbe_setup_rx_resources(adapter, &adapter->rx_ring[i]);
2741 if (!err)
2742 continue;
2743 DPRINTK(PROBE, ERR, "Allocation for Rx Queue %u failed\n", i);
2744 break;
2745 }
2746
2747 return err;
2748}
2749
2750/**
2714 * ixgbe_free_tx_resources - Free Tx Resources per Queue 2751 * ixgbe_free_tx_resources - Free Tx Resources per Queue
2715 * @adapter: board private structure 2752 * @adapter: board private structure
2716 * @tx_ring: Tx descriptor ring for a specific queue 2753 * @tx_ring: Tx descriptor ring for a specific queue
@@ -2786,57 +2823,6 @@ static void ixgbe_free_all_rx_resources(struct ixgbe_adapter *adapter)
2786} 2823}
2787 2824
2788/** 2825/**
2789 * ixgbe_setup_all_tx_resources - allocate all queues Tx resources
2790 * @adapter: board private structure
2791 *
2792 * If this function returns with an error, then it's possible one or
2793 * more of the rings is populated (while the rest are not). It is the
2794 * callers duty to clean those orphaned rings.
2795 *
2796 * Return 0 on success, negative on failure
2797 **/
2798static int ixgbe_setup_all_tx_resources(struct ixgbe_adapter *adapter)
2799{
2800 int i, err = 0;
2801
2802 for (i = 0; i < adapter->num_tx_queues; i++) {
2803 err = ixgbe_setup_tx_resources(adapter, &adapter->tx_ring[i]);
2804 if (!err)
2805 continue;
2806 DPRINTK(PROBE, ERR, "Allocation for Tx Queue %u failed\n", i);
2807 break;
2808 }
2809
2810 return err;
2811}
2812
2813/**
2814 * ixgbe_setup_all_rx_resources - allocate all queues Rx resources
2815 * @adapter: board private structure
2816 *
2817 * If this function returns with an error, then it's possible one or
2818 * more of the rings is populated (while the rest are not). It is the
2819 * callers duty to clean those orphaned rings.
2820 *
2821 * Return 0 on success, negative on failure
2822 **/
2823
2824static int ixgbe_setup_all_rx_resources(struct ixgbe_adapter *adapter)
2825{
2826 int i, err = 0;
2827
2828 for (i = 0; i < adapter->num_rx_queues; i++) {
2829 err = ixgbe_setup_rx_resources(adapter, &adapter->rx_ring[i]);
2830 if (!err)
2831 continue;
2832 DPRINTK(PROBE, ERR, "Allocation for Rx Queue %u failed\n", i);
2833 break;
2834 }
2835
2836 return err;
2837}
2838
2839/**
2840 * ixgbe_change_mtu - Change the Maximum Transfer Unit 2826 * ixgbe_change_mtu - Change the Maximum Transfer Unit
2841 * @netdev: network interface device structure 2827 * @netdev: network interface device structure
2842 * @new_mtu: new value for maximum frame size 2828 * @new_mtu: new value for maximum frame size
@@ -3001,7 +2987,7 @@ static int ixgbe_resume(struct pci_dev *pdev)
3001 pci_restore_state(pdev); 2987 pci_restore_state(pdev);
3002 err = pci_enable_device(pdev); 2988 err = pci_enable_device(pdev);
3003 if (err) { 2989 if (err) {
3004 printk(KERN_ERR "ixgbe: Cannot enable PCI device from " \ 2990 printk(KERN_ERR "ixgbe: Cannot enable PCI device from "
3005 "suspend\n"); 2991 "suspend\n");
3006 return err; 2992 return err;
3007 } 2993 }
@@ -3189,8 +3175,8 @@ static void ixgbe_watchdog(unsigned long data)
3189} 3175}
3190 3176
3191/** 3177/**
3192 * ixgbe_watchdog_task - worker thread to bring link up 3178 * ixgbe_watchdog_task - worker thread to bring link up
3193 * @work: pointer to work_struct containing our data 3179 * @work: pointer to work_struct containing our data
3194 **/ 3180 **/
3195static void ixgbe_watchdog_task(struct work_struct *work) 3181static void ixgbe_watchdog_task(struct work_struct *work)
3196{ 3182{
@@ -3526,7 +3512,6 @@ static void ixgbe_tx_queue(struct ixgbe_adapter *adapter,
3526 tx_desc->read.cmd_type_len = 3512 tx_desc->read.cmd_type_len =
3527 cpu_to_le32(cmd_type_len | tx_buffer_info->length); 3513 cpu_to_le32(cmd_type_len | tx_buffer_info->length);
3528 tx_desc->read.olinfo_status = cpu_to_le32(olinfo_status); 3514 tx_desc->read.olinfo_status = cpu_to_le32(olinfo_status);
3529
3530 i++; 3515 i++;
3531 if (i == tx_ring->count) 3516 if (i == tx_ring->count)
3532 i = 0; 3517 i = 0;
@@ -3576,7 +3561,6 @@ static int ixgbe_maybe_stop_tx(struct net_device *netdev,
3576 return __ixgbe_maybe_stop_tx(netdev, tx_ring, size); 3561 return __ixgbe_maybe_stop_tx(netdev, tx_ring, size);
3577} 3562}
3578 3563
3579
3580static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 3564static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
3581{ 3565{
3582 struct ixgbe_adapter *adapter = netdev_priv(netdev); 3566 struct ixgbe_adapter *adapter = netdev_priv(netdev);
@@ -4086,7 +4070,6 @@ static void ixgbe_io_resume(struct pci_dev *pdev)
4086 } 4070 }
4087 4071
4088 netif_device_attach(netdev); 4072 netif_device_attach(netdev);
4089
4090} 4073}
4091 4074
4092static struct pci_error_handlers ixgbe_err_handler = { 4075static struct pci_error_handlers ixgbe_err_handler = {