Commit 7367096a authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller

ixgbe: move all Rx DMA control register writes to one central location

This change moves all of the Rx DMA control register writes to one central
location.  This should help to avoid accidentally overwriting existing
settings.
Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 477de6ed
...@@ -2616,25 +2616,26 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter) ...@@ -2616,25 +2616,26 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)
* @adapter: address of board private structure * @adapter: address of board private structure
* @index: index of ring to set * @index: index of ring to set
**/ **/
static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, int index) static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter,
struct ixgbe_ring *ring)
{ {
struct ixgbe_ring *rx_ring;
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
int j;
u32 rscctrl; u32 rscctrl;
int rx_buf_len; int rx_buf_len;
u16 reg_idx = ring->reg_idx;
if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))
return;
rx_ring = adapter->rx_ring[index]; rx_buf_len = ring->rx_buf_len;
j = rx_ring->reg_idx; rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(reg_idx));
rx_buf_len = rx_ring->rx_buf_len;
rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j));
rscctrl |= IXGBE_RSCCTL_RSCEN; rscctrl |= IXGBE_RSCCTL_RSCEN;
/* /*
* we must limit the number of descriptors so that the * we must limit the number of descriptors so that the
* total size of max desc * buf_len is not greater * total size of max desc * buf_len is not greater
* than 65535 * than 65535
*/ */
if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) { if (ring->flags & IXGBE_RING_RX_PS_ENABLED) {
#if (MAX_SKB_FRAGS > 16) #if (MAX_SKB_FRAGS > 16)
rscctrl |= IXGBE_RSCCTL_MAXDESC_16; rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
#elif (MAX_SKB_FRAGS > 8) #elif (MAX_SKB_FRAGS > 8)
...@@ -2652,7 +2653,7 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, int index) ...@@ -2652,7 +2653,7 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, int index)
else else
rscctrl |= IXGBE_RSCCTL_MAXDESC_4; rscctrl |= IXGBE_RSCCTL_MAXDESC_4;
} }
IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(j), rscctrl); IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(reg_idx), rscctrl);
} }
static void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, static void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
...@@ -2771,6 +2772,42 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) ...@@ -2771,6 +2772,42 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter)
} }
static void ixgbe_setup_rdrxctl(struct ixgbe_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
u32 rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
switch (hw->mac.type) {
case ixgbe_mac_82598EB:
/*
* For VMDq support of different descriptor types or
* buffer sizes through the use of multiple SRRCTL
* registers, RDRXCTL.MVMEN must be set to 1
*
* also, the manual doesn't mention it clearly but DCA hints
* will only use queue 0's tags unless this bit is set. Side
* effects of setting this bit are only that SRRCTL must be
* fully programmed [0..15]
*/
rdrxctl |= IXGBE_RDRXCTL_MVMEN;
break;
case ixgbe_mac_82599EB:
/* Disable RSC for ACK packets */
IXGBE_WRITE_REG(hw, IXGBE_RSCDBU,
(IXGBE_RSCDBU_RSCACKDIS | IXGBE_READ_REG(hw, IXGBE_RSCDBU)));
rdrxctl &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
/* hardware requires some bits to be set by default */
rdrxctl |= (IXGBE_RDRXCTL_RSCACKC | IXGBE_RDRXCTL_FCOE_WRFIX);
rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
break;
default:
/* We should do nothing since we don't know this hardware */
return;
}
IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl);
}
/** /**
* ixgbe_configure_rx - Configure 8259x Receive Unit after Reset * ixgbe_configure_rx - Configure 8259x Receive Unit after Reset
* @adapter: board private structure * @adapter: board private structure
...@@ -2784,13 +2821,13 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) ...@@ -2784,13 +2821,13 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
int i; int i;
u32 rxctrl; u32 rxctrl;
u32 gcr_ext; u32 gcr_ext;
u32 rdrxctl;
/* disable receives while setting up the descriptors */ /* disable receives while setting up the descriptors */
rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl & ~IXGBE_RXCTRL_RXEN); IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl & ~IXGBE_RXCTRL_RXEN);
ixgbe_setup_psrtype(adapter); ixgbe_setup_psrtype(adapter);
ixgbe_setup_rdrxctl(adapter);
/* set_rx_buffer_len must be called before ring initialization */ /* set_rx_buffer_len must be called before ring initialization */
ixgbe_set_rx_buffer_len(adapter); ixgbe_set_rx_buffer_len(adapter);
...@@ -2803,22 +2840,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) ...@@ -2803,22 +2840,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
rx_ring = adapter->rx_ring[i]; rx_ring = adapter->rx_ring[i];
ixgbe_configure_rx_ring(adapter, rx_ring); ixgbe_configure_rx_ring(adapter, rx_ring);
ixgbe_configure_srrctl(adapter, rx_ring); ixgbe_configure_srrctl(adapter, rx_ring);
} ixgbe_configure_rscctl(adapter, rx_ring);
if (hw->mac.type == ixgbe_mac_82598EB) {
/*
* For VMDq support of different descriptor types or
* buffer sizes through the use of multiple SRRCTL
* registers, RDRXCTL.MVMEN must be set to 1
*
* also, the manual doesn't mention it clearly but DCA hints
* will only use queue 0's tags unless this bit is set. Side
* effects of setting this bit are only that SRRCTL must be
* fully programmed [0..15]
*/
rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
rdrxctl |= IXGBE_RDRXCTL_MVMEN;
IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl);
} }
if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
...@@ -2858,23 +2880,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) ...@@ -2858,23 +2880,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
gcr_ext |= IXGBE_GCR_EXT_SRIOV; gcr_ext |= IXGBE_GCR_EXT_SRIOV;
IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext); IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext);
} }
if (hw->mac.type == ixgbe_mac_82599EB) {
rdrxctl = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
rdrxctl |= IXGBE_RDRXCTL_CRCSTRIP;
rdrxctl &= ~IXGBE_RDRXCTL_RSCFRSTSIZE;
IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl);
}
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
/* Enable 82599 HW-RSC */
for (i = 0; i < adapter->num_rx_queues; i++)
ixgbe_configure_rscctl(adapter, i);
/* Disable RSC for ACK packets */
IXGBE_WRITE_REG(hw, IXGBE_RSCDBU,
(IXGBE_RSCDBU_RSCACKDIS | IXGBE_READ_REG(hw, IXGBE_RSCDBU)));
}
} }
static void ixgbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid) static void ixgbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
......
...@@ -871,6 +871,8 @@ ...@@ -871,6 +871,8 @@
#define IXGBE_RDRXCTL_MVMEN 0x00000020 #define IXGBE_RDRXCTL_MVMEN 0x00000020
#define IXGBE_RDRXCTL_DMAIDONE 0x00000008 /* DMA init cycle done */ #define IXGBE_RDRXCTL_DMAIDONE 0x00000008 /* DMA init cycle done */
#define IXGBE_RDRXCTL_AGGDIS 0x00010000 /* Aggregation disable */ #define IXGBE_RDRXCTL_AGGDIS 0x00010000 /* Aggregation disable */
#define IXGBE_RDRXCTL_RSCACKC 0x02000000 /* must set 1 when RSC enabled */
#define IXGBE_RDRXCTL_FCOE_WRFIX 0x04000000 /* must set 1 when RSC enabled */
/* RQTC Bit Masks and Shifts */ /* RQTC Bit Masks and Shifts */
#define IXGBE_RQTC_SHIFT_TC(_i) ((_i) * 4) #define IXGBE_RQTC_SHIFT_TC(_i) ((_i) * 4)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment