aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorNelson, Shannon <shannon.nelson@intel.com>2009-09-18 05:46:27 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-21 14:32:32 -0400
commitbb5a9ad2b81bba0cccc1c78f101e38ea785c56b3 (patch)
tree0f7cd4fe6829d67c9932b900057ffb4d261fbd45 /drivers/net/ixgbe
parentf7554a2bf2696daad25465734bb962d0184469f2 (diff)
ixgbe: move rx queue RSC configuration to a separate function
Shorten ixgbe_configure_rx() and lessen indent depth. Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c78
1 files changed, 47 insertions, 31 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 1aa9f6a5adf1..c407bd9de0dd 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1970,6 +1970,50 @@ static u32 ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)
1970} 1970}
1971 1971
1972/** 1972/**
1973 * ixgbe_configure_rscctl - enable RSC for the indicated ring
1974 * @adapter: address of board private structure
1975 * @index: index of ring to set
1976 * @rx_buf_len: rx buffer length
1977 **/
1978static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, int index,
1979 int rx_buf_len)
1980{
1981 struct ixgbe_ring *rx_ring;
1982 struct ixgbe_hw *hw = &adapter->hw;
1983 int j;
1984 u32 rscctrl;
1985
1986 rx_ring = &adapter->rx_ring[index];
1987 j = rx_ring->reg_idx;
1988 rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j));
1989 rscctrl |= IXGBE_RSCCTL_RSCEN;
1990 /*
1991 * we must limit the number of descriptors so that the
1992 * total size of max desc * buf_len is not greater
1993 * than 65535
1994 */
1995 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
1996#if (MAX_SKB_FRAGS > 16)
1997 rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
1998#elif (MAX_SKB_FRAGS > 8)
1999 rscctrl |= IXGBE_RSCCTL_MAXDESC_8;
2000#elif (MAX_SKB_FRAGS > 4)
2001 rscctrl |= IXGBE_RSCCTL_MAXDESC_4;
2002#else
2003 rscctrl |= IXGBE_RSCCTL_MAXDESC_1;
2004#endif
2005 } else {
2006 if (rx_buf_len < IXGBE_RXBUFFER_4096)
2007 rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
2008 else if (rx_buf_len < IXGBE_RXBUFFER_8192)
2009 rscctrl |= IXGBE_RSCCTL_MAXDESC_8;
2010 else
2011 rscctrl |= IXGBE_RSCCTL_MAXDESC_4;
2012 }
2013 IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(j), rscctrl);
2014}
2015
2016/**
1973 * ixgbe_configure_rx - Configure 8259x Receive Unit after Reset 2017 * ixgbe_configure_rx - Configure 8259x Receive Unit after Reset
1974 * @adapter: board private structure 2018 * @adapter: board private structure
1975 * 2019 *
@@ -1990,7 +2034,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
1990 u32 fctrl, hlreg0; 2034 u32 fctrl, hlreg0;
1991 u32 reta = 0, mrqc = 0; 2035 u32 reta = 0, mrqc = 0;
1992 u32 rdrxctl; 2036 u32 rdrxctl;
1993 u32 rscctrl;
1994 int rx_buf_len; 2037 int rx_buf_len;
1995 2038
1996 /* Decide whether to use packet split mode or not */ 2039 /* Decide whether to use packet split mode or not */
@@ -2148,36 +2191,9 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2148 2191
2149 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { 2192 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
2150 /* Enable 82599 HW-RSC */ 2193 /* Enable 82599 HW-RSC */
2151 for (i = 0; i < adapter->num_rx_queues; i++) { 2194 for (i = 0; i < adapter->num_rx_queues; i++)
2152 rx_ring = &adapter->rx_ring[i]; 2195 ixgbe_configure_rscctl(adapter, i, rx_buf_len);
2153 j = rx_ring->reg_idx; 2196
2154 rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j));
2155 rscctrl |= IXGBE_RSCCTL_RSCEN;
2156 /*
2157 * we must limit the number of descriptors so that the
2158 * total size of max desc * buf_len is not greater
2159 * than 65535
2160 */
2161 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
2162#if (MAX_SKB_FRAGS > 16)
2163 rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
2164#elif (MAX_SKB_FRAGS > 8)
2165 rscctrl |= IXGBE_RSCCTL_MAXDESC_8;
2166#elif (MAX_SKB_FRAGS > 4)
2167 rscctrl |= IXGBE_RSCCTL_MAXDESC_4;
2168#else
2169 rscctrl |= IXGBE_RSCCTL_MAXDESC_1;
2170#endif
2171 } else {
2172 if (rx_buf_len < IXGBE_RXBUFFER_4096)
2173 rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
2174 else if (rx_buf_len < IXGBE_RXBUFFER_8192)
2175 rscctrl |= IXGBE_RSCCTL_MAXDESC_8;
2176 else
2177 rscctrl |= IXGBE_RSCCTL_MAXDESC_4;
2178 }
2179 IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(j), rscctrl);
2180 }
2181 /* Disable RSC for ACK packets */ 2197 /* Disable RSC for ACK packets */
2182 IXGBE_WRITE_REG(hw, IXGBE_RSCDBU, 2198 IXGBE_WRITE_REG(hw, IXGBE_RSCDBU,
2183 (IXGBE_RSCDBU_RSCACKDIS | IXGBE_READ_REG(hw, IXGBE_RSCDBU))); 2199 (IXGBE_RSCDBU_RSCACKDIS | IXGBE_READ_REG(hw, IXGBE_RSCDBU)));