From 73cd78f1d36da244b8b3b81d3a0f32372a636e5c Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Thu, 12 Feb 2009 18:16:59 +0000 Subject: [PATCH] igb: misc whitespace/formatting cleanups This patch is intended to hold several whitespace, formatting, and comment cleanups that have been found while cleaning up the igb driver. Signed-off-by: Alexander Duyck Acked-by: Peter P Waskiewicz Jr Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/igb/igb_main.c | 58 ++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index f9d576b..53e580b 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c @@ -1691,7 +1691,6 @@ static int igb_close(struct net_device *netdev) * * Return 0 on success, negative on failure **/ - int igb_setup_tx_resources(struct igb_adapter *adapter, struct igb_ring *tx_ring) { @@ -1771,13 +1770,13 @@ static void igb_configure_tx(struct igb_adapter *adapter) int i, j; for (i = 0; i < adapter->num_tx_queues; i++) { - struct igb_ring *ring = &(adapter->tx_ring[i]); + struct igb_ring *ring = &adapter->tx_ring[i]; j = ring->reg_idx; wr32(E1000_TDLEN(j), - ring->count * sizeof(struct e1000_tx_desc)); + ring->count * sizeof(struct e1000_tx_desc)); tdba = ring->dma; wr32(E1000_TDBAL(j), - tdba & 0x00000000ffffffffULL); + tdba & 0x00000000ffffffffULL); wr32(E1000_TDBAH(j), tdba >> 32); ring->head = E1000_TDH(j); @@ -1797,8 +1796,6 @@ static void igb_configure_tx(struct igb_adapter *adapter) wr32(E1000_DCA_TXCTRL(j), txctrl); } - - /* Use the default values for the Tx Inter Packet Gap (IPG) timer */ /* Program the Transmit Control Register */ @@ -1826,7 +1823,6 @@ static void igb_configure_tx(struct igb_adapter *adapter) * * Returns 0 on success, negative on failure **/ - int igb_setup_rx_resources(struct igb_adapter *adapter, struct igb_ring *rx_ring) { @@ -1913,7 +1909,7 @@ static void igb_setup_rctl(struct igb_adapter *adapter) * enable stripping of CRC. It's unlikely this will break BMC * redirection as it did with e1000. Newer features require * that the HW strips the CRC. - */ + */ rctl |= E1000_RCTL_SECRC; /* @@ -1991,14 +1987,14 @@ static void igb_configure_rx(struct igb_adapter *adapter) /* Setup the HW Rx Head and Tail Descriptor Pointers and * the Base and Length of the Rx Descriptor Ring */ for (i = 0; i < adapter->num_rx_queues; i++) { - struct igb_ring *ring = &(adapter->rx_ring[i]); + struct igb_ring *ring = &adapter->rx_ring[i]; j = ring->reg_idx; rdba = ring->dma; wr32(E1000_RDBAL(j), - rdba & 0x00000000ffffffffULL); + rdba & 0x00000000ffffffffULL); wr32(E1000_RDBAH(j), rdba >> 32); wr32(E1000_RDLEN(j), - ring->count * sizeof(union e1000_adv_rx_desc)); + ring->count * sizeof(union e1000_adv_rx_desc)); ring->head = E1000_RDH(j); ring->tail = E1000_RDT(j); @@ -2136,6 +2132,7 @@ static void igb_unmap_and_free_tx_resource(struct igb_adapter *adapter, buffer_info->skb = NULL; } buffer_info->time_stamp = 0; + buffer_info->next_to_watch = 0; /* buffer_info must be completely set up in the transmit path */ } @@ -2701,15 +2698,13 @@ static void igb_set_itr(struct igb_adapter *adapter) adapter->tx_itr, adapter->tx_ring->total_packets, adapter->tx_ring->total_bytes); - current_itr = max(adapter->rx_itr, adapter->tx_itr); } else { current_itr = adapter->rx_itr; } /* conservative mode (itr 3) eliminates the lowest_latency setting */ - if (adapter->itr_setting == 3 && - current_itr == lowest_latency) + if (adapter->itr_setting == 3 && current_itr == lowest_latency) current_itr = low_latency; switch (current_itr) { @@ -2827,7 +2822,7 @@ static inline int igb_tso_adv(struct igb_adapter *adapter, mss_l4len_idx = (skb_shinfo(skb)->gso_size << E1000_ADVTXD_MSS_SHIFT); mss_l4len_idx |= (l4len << E1000_ADVTXD_L4LEN_SHIFT); - /* Context index must be unique per ring. */ + /* For 82575, context index must be unique per ring. */ if (adapter->flags & IGB_FLAG_NEED_CTX_IDX) mss_l4len_idx |= tx_ring->queue_index << 4; @@ -2911,8 +2906,6 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter, return true; } - - return false; } @@ -3136,7 +3129,6 @@ static int igb_xmit_frame_ring_adv(struct sk_buff *skb, tx_flags |= IGB_TX_FLAGS_IPV4; first = tx_ring->next_to_use; - tso = skb_is_gso(skb) ? igb_tso_adv(adapter, tx_ring, skb, tx_flags, &hdr_len) : 0; @@ -3210,8 +3202,7 @@ static void igb_reset_task(struct work_struct *work) * Returns the address of the device statistics structure. * The statistics are actually updated from the timer callback. **/ -static struct net_device_stats * -igb_get_stats(struct net_device *netdev) +static struct net_device_stats *igb_get_stats(struct net_device *netdev) { struct igb_adapter *adapter = netdev_priv(netdev); @@ -3245,6 +3236,7 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu) while (test_and_set_bit(__IGB_RESETTING, &adapter->state)) msleep(1); + /* igb_down has a dependency on max_frame_size */ adapter->max_frame_size = max_frame; if (netif_running(netdev)) @@ -3414,8 +3406,7 @@ void igb_update_stats(struct igb_adapter *adapter) /* Phy Stats */ if (hw->phy.media_type == e1000_media_type_copper) { if ((adapter->link_speed == SPEED_1000) && - (!igb_read_phy_reg(hw, PHY_1000T_STATUS, - &phy_tmp))) { + (!igb_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) { phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK; adapter->phy_stats.idle_errors += phy_tmp; } @@ -3427,7 +3418,6 @@ void igb_update_stats(struct igb_adapter *adapter) adapter->stats.mgpdc += rd32(E1000_MGTPDC); } - static irqreturn_t igb_msix_other(int irq, void *data) { struct net_device *netdev = data; @@ -3465,6 +3455,7 @@ static irqreturn_t igb_msix_tx(int irq, void *data) if (adapter->flags & IGB_FLAG_DCA_ENABLED) igb_update_tx_dca(tx_ring); #endif + tx_ring->total_bytes = 0; tx_ring->total_packets = 0; @@ -3485,13 +3476,11 @@ static void igb_write_itr(struct igb_ring *ring) if ((ring->adapter->itr_setting & 3) && ring->set_itr) { switch (hw->mac.type) { case e1000_82576: - wr32(ring->itr_register, - ring->itr_val | + wr32(ring->itr_register, ring->itr_val | 0x80000000); break; default: - wr32(ring->itr_register, - ring->itr_val | + wr32(ring->itr_register, ring->itr_val | (ring->itr_val << 16)); break; } @@ -3762,7 +3751,6 @@ static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget) #endif igb_clean_rx_irq_adv(rx_ring, &work_done, budget); - /* If not enough Rx work done, exit the polling mode */ if ((work_done == 0) || !netif_running(netdev)) { napi_complete(napi); @@ -3773,7 +3761,6 @@ static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget) else igb_update_ring_itr(rx_ring); } - if (!test_bit(__IGB_DOWN, &adapter->state)) wr32(E1000_EIMS, rx_ring->eims_value); @@ -3869,7 +3856,6 @@ static bool igb_clean_tx_irq(struct igb_ring *tx_ring) if (i == tx_ring->count) i = 0; } - eop = tx_ring->buffer_info[i].next_to_watch; eop_desc = E1000_TX_DESC_ADV(*tx_ring, eop); } @@ -3938,7 +3924,7 @@ static bool igb_clean_tx_irq(struct igb_ring *tx_ring) * igb_receive_skb - helper function to handle rx indications * @ring: pointer to receive ring receving this packet * @status: descriptor status field as written by hardware - * @vlan: descriptor vlan field as written by hardware (no le/be conversion) + * @rx_desc: receive descriptor containing vlan and type information. * @skb: pointer to sk_buff to be indicated to stack **/ static void igb_receive_skb(struct igb_ring *ring, u8 status, @@ -3965,7 +3951,6 @@ static void igb_receive_skb(struct igb_ring *ring, u8 status, } } - static inline void igb_rx_checksum_adv(struct igb_adapter *adapter, u32 status_err, struct sk_buff *skb) { @@ -3998,11 +3983,11 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring, union e1000_adv_rx_desc *rx_desc , *next_rxd; struct igb_buffer *buffer_info , *next_buffer; struct sk_buff *skb; - unsigned int i; - u32 length, hlen, staterr; bool cleaned = false; int cleaned_count = 0; unsigned int total_bytes = 0, total_packets = 0; + unsigned int i; + u32 length, hlen, staterr; i = rx_ring->next_to_clean; buffer_info = &rx_ring->buffer_info[i]; @@ -4050,8 +4035,7 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring, if (!skb_shinfo(skb)->nr_frags) { pci_unmap_single(pdev, buffer_info->dma, - adapter->rx_ps_hdr_size + - NET_IP_ALIGN, + adapter->rx_ps_hdr_size + NET_IP_ALIGN, PCI_DMA_FROMDEVICE); skb_put(skb, hlen); } @@ -4171,7 +4155,6 @@ next_desc: return cleaned; } - /** * igb_alloc_rx_buffers_adv - Replace used receive buffers; packet split * @adapter: address of board private structure @@ -4619,7 +4602,6 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u16 spddplx) return 0; } - static int igb_suspend(struct pci_dev *pdev, pm_message_t state) { struct net_device *netdev = pci_get_drvdata(pdev); -- 2.7.4