aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2010-11-16 22:26:49 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2010-11-16 22:26:49 -0500
commit84ea2591e4a24775c2735511a1cc3cf88edd249d (patch)
treef2189b6c1a5437639291eab40a34034e6f7f6c8f /drivers/net/ixgbe/ixgbe_main.c
parentd5f398ed73522b9f76861af6553775c5851de0d0 (diff)
ixgbe: drop ring->head, make ring->tail a pointer instead of offset
This change drops ring->head since it is not used in any hot-path and can easily be determined using IXGBE_[RT]DH(ring->reg_idx). It also changes ring->tail into a true pointer so we can avoid unnecessary pointer math to find the location of the tail. In addition I also dropped the setting of head and tail in ixgbe_clean_[rx|tx]_ring. The only location that should be setting the head and tail values is ixgbe_configure_[rx|tx]_ring and that is only while the queue is disabled. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index e838479d2d9..8f2afaa35dd 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -704,8 +704,8 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter,
704 " time_stamp <%lx>\n" 704 " time_stamp <%lx>\n"
705 " jiffies <%lx>\n", 705 " jiffies <%lx>\n",
706 tx_ring->queue_index, 706 tx_ring->queue_index,
707 IXGBE_READ_REG(hw, tx_ring->head), 707 IXGBE_READ_REG(hw, IXGBE_TDH(tx_ring->reg_idx)),
708 IXGBE_READ_REG(hw, tx_ring->tail), 708 IXGBE_READ_REG(hw, IXGBE_TDT(tx_ring->reg_idx)),
709 tx_ring->next_to_use, eop, 709 tx_ring->next_to_use, eop,
710 tx_ring->tx_buffer_info[eop].time_stamp, jiffies); 710 tx_ring->tx_buffer_info[eop].time_stamp, jiffies);
711 return true; 711 return true;
@@ -991,8 +991,7 @@ static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter,
991 skb->ip_summed = CHECKSUM_UNNECESSARY; 991 skb->ip_summed = CHECKSUM_UNNECESSARY;
992} 992}
993 993
994static inline void ixgbe_release_rx_desc(struct ixgbe_hw *hw, 994static inline void ixgbe_release_rx_desc(struct ixgbe_ring *rx_ring, u32 val)
995 struct ixgbe_ring *rx_ring, u32 val)
996{ 995{
997 /* 996 /*
998 * Force memory writes to complete before letting h/w 997 * Force memory writes to complete before letting h/w
@@ -1001,7 +1000,7 @@ static inline void ixgbe_release_rx_desc(struct ixgbe_hw *hw,
1001 * such as IA-64). 1000 * such as IA-64).
1002 */ 1001 */
1003 wmb(); 1002 wmb();
1004 IXGBE_WRITE_REG(hw, IXGBE_RDT(rx_ring->reg_idx), val); 1003 writel(val, rx_ring->tail);
1005} 1004}
1006 1005
1007/** 1006/**
@@ -1089,7 +1088,7 @@ void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,
1089no_buffers: 1088no_buffers:
1090 if (rx_ring->next_to_use != i) { 1089 if (rx_ring->next_to_use != i) {
1091 rx_ring->next_to_use = i; 1090 rx_ring->next_to_use = i;
1092 ixgbe_release_rx_desc(&adapter->hw, rx_ring, i); 1091 ixgbe_release_rx_desc(rx_ring, i);
1093 } 1092 }
1094} 1093}
1095 1094
@@ -2465,8 +2464,7 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,
2465 ring->count * sizeof(union ixgbe_adv_tx_desc)); 2464 ring->count * sizeof(union ixgbe_adv_tx_desc));
2466 IXGBE_WRITE_REG(hw, IXGBE_TDH(reg_idx), 0); 2465 IXGBE_WRITE_REG(hw, IXGBE_TDH(reg_idx), 0);
2467 IXGBE_WRITE_REG(hw, IXGBE_TDT(reg_idx), 0); 2466 IXGBE_WRITE_REG(hw, IXGBE_TDT(reg_idx), 0);
2468 ring->head = IXGBE_TDH(reg_idx); 2467 ring->tail = hw->hw_addr + IXGBE_TDT(reg_idx);
2469 ring->tail = IXGBE_TDT(reg_idx);
2470 2468
2471 /* configure fetching thresholds */ 2469 /* configure fetching thresholds */
2472 if (adapter->rx_itr_setting == 0) { 2470 if (adapter->rx_itr_setting == 0) {
@@ -2791,8 +2789,7 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
2791 ring->count * sizeof(union ixgbe_adv_rx_desc)); 2789 ring->count * sizeof(union ixgbe_adv_rx_desc));
2792 IXGBE_WRITE_REG(hw, IXGBE_RDH(reg_idx), 0); 2790 IXGBE_WRITE_REG(hw, IXGBE_RDH(reg_idx), 0);
2793 IXGBE_WRITE_REG(hw, IXGBE_RDT(reg_idx), 0); 2791 IXGBE_WRITE_REG(hw, IXGBE_RDT(reg_idx), 0);
2794 ring->head = IXGBE_RDH(reg_idx); 2792 ring->tail = hw->hw_addr + IXGBE_RDT(reg_idx);
2795 ring->tail = IXGBE_RDT(reg_idx);
2796 2793
2797 ixgbe_configure_srrctl(adapter, ring); 2794 ixgbe_configure_srrctl(adapter, ring);
2798 ixgbe_configure_rscctl(adapter, ring); 2795 ixgbe_configure_rscctl(adapter, ring);
@@ -3730,11 +3727,6 @@ static void ixgbe_clean_rx_ring(struct ixgbe_adapter *adapter,
3730 3727
3731 rx_ring->next_to_clean = 0; 3728 rx_ring->next_to_clean = 0;
3732 rx_ring->next_to_use = 0; 3729 rx_ring->next_to_use = 0;
3733
3734 if (rx_ring->head)
3735 writel(0, adapter->hw.hw_addr + rx_ring->head);
3736 if (rx_ring->tail)
3737 writel(0, adapter->hw.hw_addr + rx_ring->tail);
3738} 3730}
3739 3731
3740/** 3732/**
@@ -3767,11 +3759,6 @@ static void ixgbe_clean_tx_ring(struct ixgbe_adapter *adapter,
3767 3759
3768 tx_ring->next_to_use = 0; 3760 tx_ring->next_to_use = 0;
3769 tx_ring->next_to_clean = 0; 3761 tx_ring->next_to_clean = 0;
3770
3771 if (tx_ring->head)
3772 writel(0, adapter->hw.hw_addr + tx_ring->head);
3773 if (tx_ring->tail)
3774 writel(0, adapter->hw.hw_addr + tx_ring->tail);
3775} 3762}
3776 3763
3777/** 3764/**
@@ -6116,8 +6103,7 @@ dma_error:
6116 return 0; 6103 return 0;
6117} 6104}
6118 6105
6119static void ixgbe_tx_queue(struct ixgbe_adapter *adapter, 6106static void ixgbe_tx_queue(struct ixgbe_ring *tx_ring,
6120 struct ixgbe_ring *tx_ring,
6121 int tx_flags, int count, u32 paylen, u8 hdr_len) 6107 int tx_flags, int count, u32 paylen, u8 hdr_len)
6122{ 6108{
6123 union ixgbe_adv_tx_desc *tx_desc = NULL; 6109 union ixgbe_adv_tx_desc *tx_desc = NULL;
@@ -6182,7 +6168,7 @@ static void ixgbe_tx_queue(struct ixgbe_adapter *adapter,
6182 wmb(); 6168 wmb();
6183 6169
6184 tx_ring->next_to_use = i; 6170 tx_ring->next_to_use = i;
6185 writel(i, adapter->hw.hw_addr + tx_ring->tail); 6171 writel(i, tx_ring->tail);
6186} 6172}
6187 6173
6188static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, 6174static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
@@ -6414,8 +6400,7 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb, struct net_device *netdev
6414 txq = netdev_get_tx_queue(netdev, tx_ring->queue_index); 6400 txq = netdev_get_tx_queue(netdev, tx_ring->queue_index);
6415 txq->tx_bytes += skb->len; 6401 txq->tx_bytes += skb->len;
6416 txq->tx_packets++; 6402 txq->tx_packets++;
6417 ixgbe_tx_queue(adapter, tx_ring, tx_flags, count, skb->len, 6403 ixgbe_tx_queue(tx_ring, tx_flags, count, skb->len, hdr_len);
6418 hdr_len);
6419 ixgbe_maybe_stop_tx(netdev, tx_ring, DESC_NEEDED); 6404 ixgbe_maybe_stop_tx(netdev, tx_ring, DESC_NEEDED);
6420 6405
6421 } else { 6406 } else {