|
@@ -292,9 +292,7 @@ static const struct igb_reg_info igb_reg_info_tbl[] = {
|
|
{}
|
|
{}
|
|
};
|
|
};
|
|
|
|
|
|
-/*
|
|
|
|
- * igb_regdump - register printout routine
|
|
|
|
- */
|
|
|
|
|
|
+/* igb_regdump - register printout routine */
|
|
static void igb_regdump(struct e1000_hw *hw, struct igb_reg_info *reginfo)
|
|
static void igb_regdump(struct e1000_hw *hw, struct igb_reg_info *reginfo)
|
|
{
|
|
{
|
|
int n = 0;
|
|
int n = 0;
|
|
@@ -360,9 +358,7 @@ static void igb_regdump(struct e1000_hw *hw, struct igb_reg_info *reginfo)
|
|
regs[2], regs[3]);
|
|
regs[2], regs[3]);
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * igb_dump - Print registers, tx-rings and rx-rings
|
|
|
|
- */
|
|
|
|
|
|
+/* igb_dump - Print registers, Tx-rings and Rx-rings */
|
|
static void igb_dump(struct igb_adapter *adapter)
|
|
static void igb_dump(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
struct net_device *netdev = adapter->netdev;
|
|
struct net_device *netdev = adapter->netdev;
|
|
@@ -569,12 +565,13 @@ exit:
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
-/* igb_get_i2c_data - Reads the I2C SDA data bit
|
|
|
|
|
|
+/**
|
|
|
|
+ * igb_get_i2c_data - Reads the I2C SDA data bit
|
|
* @hw: pointer to hardware structure
|
|
* @hw: pointer to hardware structure
|
|
* @i2cctl: Current value of I2CCTL register
|
|
* @i2cctl: Current value of I2CCTL register
|
|
*
|
|
*
|
|
* Returns the I2C data bit value
|
|
* Returns the I2C data bit value
|
|
- */
|
|
|
|
|
|
+ **/
|
|
static int igb_get_i2c_data(void *data)
|
|
static int igb_get_i2c_data(void *data)
|
|
{
|
|
{
|
|
struct igb_adapter *adapter = (struct igb_adapter *)data;
|
|
struct igb_adapter *adapter = (struct igb_adapter *)data;
|
|
@@ -584,12 +581,13 @@ static int igb_get_i2c_data(void *data)
|
|
return ((i2cctl & E1000_I2C_DATA_IN) != 0);
|
|
return ((i2cctl & E1000_I2C_DATA_IN) != 0);
|
|
}
|
|
}
|
|
|
|
|
|
-/* igb_set_i2c_data - Sets the I2C data bit
|
|
|
|
|
|
+/**
|
|
|
|
+ * igb_set_i2c_data - Sets the I2C data bit
|
|
* @data: pointer to hardware structure
|
|
* @data: pointer to hardware structure
|
|
* @state: I2C data value (0 or 1) to set
|
|
* @state: I2C data value (0 or 1) to set
|
|
*
|
|
*
|
|
* Sets the I2C data bit
|
|
* Sets the I2C data bit
|
|
- */
|
|
|
|
|
|
+ **/
|
|
static void igb_set_i2c_data(void *data, int state)
|
|
static void igb_set_i2c_data(void *data, int state)
|
|
{
|
|
{
|
|
struct igb_adapter *adapter = (struct igb_adapter *)data;
|
|
struct igb_adapter *adapter = (struct igb_adapter *)data;
|
|
@@ -608,12 +606,13 @@ static void igb_set_i2c_data(void *data, int state)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-/* igb_set_i2c_clk - Sets the I2C SCL clock
|
|
|
|
|
|
+/**
|
|
|
|
+ * igb_set_i2c_clk - Sets the I2C SCL clock
|
|
* @data: pointer to hardware structure
|
|
* @data: pointer to hardware structure
|
|
* @state: state to set clock
|
|
* @state: state to set clock
|
|
*
|
|
*
|
|
* Sets the I2C clock line to state
|
|
* Sets the I2C clock line to state
|
|
- */
|
|
|
|
|
|
+ **/
|
|
static void igb_set_i2c_clk(void *data, int state)
|
|
static void igb_set_i2c_clk(void *data, int state)
|
|
{
|
|
{
|
|
struct igb_adapter *adapter = (struct igb_adapter *)data;
|
|
struct igb_adapter *adapter = (struct igb_adapter *)data;
|
|
@@ -631,11 +630,12 @@ static void igb_set_i2c_clk(void *data, int state)
|
|
wrfl();
|
|
wrfl();
|
|
}
|
|
}
|
|
|
|
|
|
-/* igb_get_i2c_clk - Gets the I2C SCL clock state
|
|
|
|
|
|
+/**
|
|
|
|
+ * igb_get_i2c_clk - Gets the I2C SCL clock state
|
|
* @data: pointer to hardware structure
|
|
* @data: pointer to hardware structure
|
|
*
|
|
*
|
|
* Gets the I2C clock state
|
|
* Gets the I2C clock state
|
|
- */
|
|
|
|
|
|
+ **/
|
|
static int igb_get_i2c_clk(void *data)
|
|
static int igb_get_i2c_clk(void *data)
|
|
{
|
|
{
|
|
struct igb_adapter *adapter = (struct igb_adapter *)data;
|
|
struct igb_adapter *adapter = (struct igb_adapter *)data;
|
|
@@ -655,8 +655,10 @@ static const struct i2c_algo_bit_data igb_i2c_algo = {
|
|
};
|
|
};
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_get_hw_dev - return device
|
|
|
|
- * used by hardware layer to print debugging information
|
|
|
|
|
|
+ * igb_get_hw_dev - return device
|
|
|
|
+ * @hw: pointer to hardware structure
|
|
|
|
+ *
|
|
|
|
+ * used by hardware layer to print debugging information
|
|
**/
|
|
**/
|
|
struct net_device *igb_get_hw_dev(struct e1000_hw *hw)
|
|
struct net_device *igb_get_hw_dev(struct e1000_hw *hw)
|
|
{
|
|
{
|
|
@@ -665,10 +667,10 @@ struct net_device *igb_get_hw_dev(struct e1000_hw *hw)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_init_module - Driver Registration Routine
|
|
|
|
|
|
+ * igb_init_module - Driver Registration Routine
|
|
*
|
|
*
|
|
- * igb_init_module is the first routine called when the driver is
|
|
|
|
- * loaded. All it does is register with the PCI subsystem.
|
|
|
|
|
|
+ * igb_init_module is the first routine called when the driver is
|
|
|
|
+ * loaded. All it does is register with the PCI subsystem.
|
|
**/
|
|
**/
|
|
static int __init igb_init_module(void)
|
|
static int __init igb_init_module(void)
|
|
{
|
|
{
|
|
@@ -688,10 +690,10 @@ static int __init igb_init_module(void)
|
|
module_init(igb_init_module);
|
|
module_init(igb_init_module);
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_exit_module - Driver Exit Cleanup Routine
|
|
|
|
|
|
+ * igb_exit_module - Driver Exit Cleanup Routine
|
|
*
|
|
*
|
|
- * igb_exit_module is called just before the driver is removed
|
|
|
|
- * from memory.
|
|
|
|
|
|
+ * igb_exit_module is called just before the driver is removed
|
|
|
|
+ * from memory.
|
|
**/
|
|
**/
|
|
static void __exit igb_exit_module(void)
|
|
static void __exit igb_exit_module(void)
|
|
{
|
|
{
|
|
@@ -705,11 +707,11 @@ module_exit(igb_exit_module);
|
|
|
|
|
|
#define Q_IDX_82576(i) (((i & 0x1) << 3) + (i >> 1))
|
|
#define Q_IDX_82576(i) (((i & 0x1) << 3) + (i >> 1))
|
|
/**
|
|
/**
|
|
- * igb_cache_ring_register - Descriptor ring to register mapping
|
|
|
|
- * @adapter: board private structure to initialize
|
|
|
|
|
|
+ * igb_cache_ring_register - Descriptor ring to register mapping
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
*
|
|
*
|
|
- * Once we know the feature-set enabled for the device, we'll cache
|
|
|
|
- * the register offset the descriptor ring is assigned to.
|
|
|
|
|
|
+ * Once we know the feature-set enabled for the device, we'll cache
|
|
|
|
+ * the register offset the descriptor ring is assigned to.
|
|
**/
|
|
**/
|
|
static void igb_cache_ring_register(struct igb_adapter *adapter)
|
|
static void igb_cache_ring_register(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -726,7 +728,7 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)
|
|
if (adapter->vfs_allocated_count) {
|
|
if (adapter->vfs_allocated_count) {
|
|
for (; i < adapter->rss_queues; i++)
|
|
for (; i < adapter->rss_queues; i++)
|
|
adapter->rx_ring[i]->reg_idx = rbase_offset +
|
|
adapter->rx_ring[i]->reg_idx = rbase_offset +
|
|
- Q_IDX_82576(i);
|
|
|
|
|
|
+ Q_IDX_82576(i);
|
|
}
|
|
}
|
|
case e1000_82575:
|
|
case e1000_82575:
|
|
case e1000_82580:
|
|
case e1000_82580:
|
|
@@ -785,9 +787,10 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
|
|
switch (hw->mac.type) {
|
|
switch (hw->mac.type) {
|
|
case e1000_82575:
|
|
case e1000_82575:
|
|
/* The 82575 assigns vectors using a bitmask, which matches the
|
|
/* The 82575 assigns vectors using a bitmask, which matches the
|
|
- bitmask for the EICR/EIMS/EIMC registers. To assign one
|
|
|
|
- or more queues to a vector, we write the appropriate bits
|
|
|
|
- into the MSIXBM register for that vector. */
|
|
|
|
|
|
+ * bitmask for the EICR/EIMS/EIMC registers. To assign one
|
|
|
|
+ * or more queues to a vector, we write the appropriate bits
|
|
|
|
+ * into the MSIXBM register for that vector.
|
|
|
|
+ */
|
|
if (rx_queue > IGB_N0_QUEUE)
|
|
if (rx_queue > IGB_N0_QUEUE)
|
|
msixbm = E1000_EICR_RX_QUEUE0 << rx_queue;
|
|
msixbm = E1000_EICR_RX_QUEUE0 << rx_queue;
|
|
if (tx_queue > IGB_N0_QUEUE)
|
|
if (tx_queue > IGB_N0_QUEUE)
|
|
@@ -798,8 +801,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
|
|
q_vector->eims_value = msixbm;
|
|
q_vector->eims_value = msixbm;
|
|
break;
|
|
break;
|
|
case e1000_82576:
|
|
case e1000_82576:
|
|
- /*
|
|
|
|
- * 82576 uses a table that essentially consists of 2 columns
|
|
|
|
|
|
+ /* 82576 uses a table that essentially consists of 2 columns
|
|
* with 8 rows. The ordering is column-major so we use the
|
|
* with 8 rows. The ordering is column-major so we use the
|
|
* lower 3 bits as the row index, and the 4th bit as the
|
|
* lower 3 bits as the row index, and the 4th bit as the
|
|
* column offset.
|
|
* column offset.
|
|
@@ -818,8 +820,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
|
|
case e1000_i350:
|
|
case e1000_i350:
|
|
case e1000_i210:
|
|
case e1000_i210:
|
|
case e1000_i211:
|
|
case e1000_i211:
|
|
- /*
|
|
|
|
- * On 82580 and newer adapters the scheme is similar to 82576
|
|
|
|
|
|
+ /* On 82580 and newer adapters the scheme is similar to 82576
|
|
* however instead of ordering column-major we have things
|
|
* however instead of ordering column-major we have things
|
|
* ordered row-major. So we traverse the table by using
|
|
* ordered row-major. So we traverse the table by using
|
|
* bit 0 as the column offset, and the remaining bits as the
|
|
* bit 0 as the column offset, and the remaining bits as the
|
|
@@ -848,10 +849,11 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_configure_msix - Configure MSI-X hardware
|
|
|
|
|
|
+ * igb_configure_msix - Configure MSI-X hardware
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
*
|
|
*
|
|
- * igb_configure_msix sets up the hardware to properly
|
|
|
|
- * generate MSI-X interrupts.
|
|
|
|
|
|
+ * igb_configure_msix sets up the hardware to properly
|
|
|
|
+ * generate MSI-X interrupts.
|
|
**/
|
|
**/
|
|
static void igb_configure_msix(struct igb_adapter *adapter)
|
|
static void igb_configure_msix(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -875,8 +877,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
|
|
wr32(E1000_CTRL_EXT, tmp);
|
|
wr32(E1000_CTRL_EXT, tmp);
|
|
|
|
|
|
/* enable msix_other interrupt */
|
|
/* enable msix_other interrupt */
|
|
- array_wr32(E1000_MSIXBM(0), vector++,
|
|
|
|
- E1000_EIMS_OTHER);
|
|
|
|
|
|
+ array_wr32(E1000_MSIXBM(0), vector++, E1000_EIMS_OTHER);
|
|
adapter->eims_other = E1000_EIMS_OTHER;
|
|
adapter->eims_other = E1000_EIMS_OTHER;
|
|
|
|
|
|
break;
|
|
break;
|
|
@@ -887,10 +888,11 @@ static void igb_configure_msix(struct igb_adapter *adapter)
|
|
case e1000_i210:
|
|
case e1000_i210:
|
|
case e1000_i211:
|
|
case e1000_i211:
|
|
/* Turn on MSI-X capability first, or our settings
|
|
/* Turn on MSI-X capability first, or our settings
|
|
- * won't stick. And it will take days to debug. */
|
|
|
|
|
|
+ * won't stick. And it will take days to debug.
|
|
|
|
+ */
|
|
wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE |
|
|
wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE |
|
|
- E1000_GPIE_PBA | E1000_GPIE_EIAME |
|
|
|
|
- E1000_GPIE_NSICR);
|
|
|
|
|
|
+ E1000_GPIE_PBA | E1000_GPIE_EIAME |
|
|
|
|
+ E1000_GPIE_NSICR);
|
|
|
|
|
|
/* enable msix_other interrupt */
|
|
/* enable msix_other interrupt */
|
|
adapter->eims_other = 1 << vector;
|
|
adapter->eims_other = 1 << vector;
|
|
@@ -912,10 +914,11 @@ static void igb_configure_msix(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_request_msix - Initialize MSI-X interrupts
|
|
|
|
|
|
+ * igb_request_msix - Initialize MSI-X interrupts
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
*
|
|
*
|
|
- * igb_request_msix allocates MSI-X vectors and requests interrupts from the
|
|
|
|
- * kernel.
|
|
|
|
|
|
+ * igb_request_msix allocates MSI-X vectors and requests interrupts from the
|
|
|
|
+ * kernel.
|
|
**/
|
|
**/
|
|
static int igb_request_msix(struct igb_adapter *adapter)
|
|
static int igb_request_msix(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -924,7 +927,7 @@ static int igb_request_msix(struct igb_adapter *adapter)
|
|
int i, err = 0, vector = 0, free_vector = 0;
|
|
int i, err = 0, vector = 0, free_vector = 0;
|
|
|
|
|
|
err = request_irq(adapter->msix_entries[vector].vector,
|
|
err = request_irq(adapter->msix_entries[vector].vector,
|
|
- igb_msix_other, 0, netdev->name, adapter);
|
|
|
|
|
|
+ igb_msix_other, 0, netdev->name, adapter);
|
|
if (err)
|
|
if (err)
|
|
goto err_out;
|
|
goto err_out;
|
|
|
|
|
|
@@ -948,8 +951,8 @@ static int igb_request_msix(struct igb_adapter *adapter)
|
|
sprintf(q_vector->name, "%s-unused", netdev->name);
|
|
sprintf(q_vector->name, "%s-unused", netdev->name);
|
|
|
|
|
|
err = request_irq(adapter->msix_entries[vector].vector,
|
|
err = request_irq(adapter->msix_entries[vector].vector,
|
|
- igb_msix_ring, 0, q_vector->name,
|
|
|
|
- q_vector);
|
|
|
|
|
|
+ igb_msix_ring, 0, q_vector->name,
|
|
|
|
+ q_vector);
|
|
if (err)
|
|
if (err)
|
|
goto err_free;
|
|
goto err_free;
|
|
}
|
|
}
|
|
@@ -982,13 +985,13 @@ static void igb_reset_interrupt_capability(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_free_q_vector - Free memory allocated for specific interrupt vector
|
|
|
|
- * @adapter: board private structure to initialize
|
|
|
|
- * @v_idx: Index of vector to be freed
|
|
|
|
|
|
+ * igb_free_q_vector - Free memory allocated for specific interrupt vector
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
|
|
+ * @v_idx: Index of vector to be freed
|
|
*
|
|
*
|
|
- * This function frees the memory allocated to the q_vector. In addition if
|
|
|
|
- * NAPI is enabled it will delete any references to the NAPI struct prior
|
|
|
|
- * to freeing the q_vector.
|
|
|
|
|
|
+ * This function frees the memory allocated to the q_vector. In addition if
|
|
|
|
+ * NAPI is enabled it will delete any references to the NAPI struct prior
|
|
|
|
+ * to freeing the q_vector.
|
|
**/
|
|
**/
|
|
static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx)
|
|
static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx)
|
|
{
|
|
{
|
|
@@ -1003,20 +1006,19 @@ static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx)
|
|
adapter->q_vector[v_idx] = NULL;
|
|
adapter->q_vector[v_idx] = NULL;
|
|
netif_napi_del(&q_vector->napi);
|
|
netif_napi_del(&q_vector->napi);
|
|
|
|
|
|
- /*
|
|
|
|
- * ixgbe_get_stats64() might access the rings on this vector,
|
|
|
|
|
|
+ /* ixgbe_get_stats64() might access the rings on this vector,
|
|
* we must wait a grace period before freeing it.
|
|
* we must wait a grace period before freeing it.
|
|
*/
|
|
*/
|
|
kfree_rcu(q_vector, rcu);
|
|
kfree_rcu(q_vector, rcu);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_free_q_vectors - Free memory allocated for interrupt vectors
|
|
|
|
- * @adapter: board private structure to initialize
|
|
|
|
|
|
+ * igb_free_q_vectors - Free memory allocated for interrupt vectors
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
*
|
|
*
|
|
- * This function frees the memory allocated to the q_vectors. In addition if
|
|
|
|
- * NAPI is enabled it will delete any references to the NAPI struct prior
|
|
|
|
- * to freeing the q_vector.
|
|
|
|
|
|
+ * This function frees the memory allocated to the q_vectors. In addition if
|
|
|
|
+ * NAPI is enabled it will delete any references to the NAPI struct prior
|
|
|
|
+ * to freeing the q_vector.
|
|
**/
|
|
**/
|
|
static void igb_free_q_vectors(struct igb_adapter *adapter)
|
|
static void igb_free_q_vectors(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1031,10 +1033,11 @@ static void igb_free_q_vectors(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_clear_interrupt_scheme - reset the device to a state of no interrupts
|
|
|
|
|
|
+ * igb_clear_interrupt_scheme - reset the device to a state of no interrupts
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
*
|
|
*
|
|
- * This function resets the device so that it has 0 rx queues, tx queues, and
|
|
|
|
- * MSI-X interrupts allocated.
|
|
|
|
|
|
+ * This function resets the device so that it has 0 Rx queues, Tx queues, and
|
|
|
|
+ * MSI-X interrupts allocated.
|
|
*/
|
|
*/
|
|
static void igb_clear_interrupt_scheme(struct igb_adapter *adapter)
|
|
static void igb_clear_interrupt_scheme(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1043,10 +1046,12 @@ static void igb_clear_interrupt_scheme(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_set_interrupt_capability - set MSI or MSI-X if supported
|
|
|
|
|
|
+ * igb_set_interrupt_capability - set MSI or MSI-X if supported
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
|
|
+ * @msix: boolean value of MSIX capability
|
|
*
|
|
*
|
|
- * Attempt to configure interrupts using the best available
|
|
|
|
- * capabilities of the hardware and kernel.
|
|
|
|
|
|
+ * Attempt to configure interrupts using the best available
|
|
|
|
+ * capabilities of the hardware and kernel.
|
|
**/
|
|
**/
|
|
static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
|
|
static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
|
|
{
|
|
{
|
|
@@ -1063,10 +1068,10 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
|
|
else
|
|
else
|
|
adapter->num_tx_queues = adapter->rss_queues;
|
|
adapter->num_tx_queues = adapter->rss_queues;
|
|
|
|
|
|
- /* start with one vector for every rx queue */
|
|
|
|
|
|
+ /* start with one vector for every Rx queue */
|
|
numvecs = adapter->num_rx_queues;
|
|
numvecs = adapter->num_rx_queues;
|
|
|
|
|
|
- /* if tx handler is separate add 1 for every tx queue */
|
|
|
|
|
|
+ /* if Tx handler is separate add 1 for every Tx queue */
|
|
if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS))
|
|
if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS))
|
|
numvecs += adapter->num_tx_queues;
|
|
numvecs += adapter->num_tx_queues;
|
|
|
|
|
|
@@ -1128,16 +1133,16 @@ static void igb_add_ring(struct igb_ring *ring,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_alloc_q_vector - Allocate memory for a single interrupt vector
|
|
|
|
- * @adapter: board private structure to initialize
|
|
|
|
- * @v_count: q_vectors allocated on adapter, used for ring interleaving
|
|
|
|
- * @v_idx: index of vector in adapter struct
|
|
|
|
- * @txr_count: total number of Tx rings to allocate
|
|
|
|
- * @txr_idx: index of first Tx ring to allocate
|
|
|
|
- * @rxr_count: total number of Rx rings to allocate
|
|
|
|
- * @rxr_idx: index of first Rx ring to allocate
|
|
|
|
|
|
+ * igb_alloc_q_vector - Allocate memory for a single interrupt vector
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
|
|
+ * @v_count: q_vectors allocated on adapter, used for ring interleaving
|
|
|
|
+ * @v_idx: index of vector in adapter struct
|
|
|
|
+ * @txr_count: total number of Tx rings to allocate
|
|
|
|
+ * @txr_idx: index of first Tx ring to allocate
|
|
|
|
+ * @rxr_count: total number of Rx rings to allocate
|
|
|
|
+ * @rxr_idx: index of first Rx ring to allocate
|
|
*
|
|
*
|
|
- * We allocate one q_vector. If allocation fails we return -ENOMEM.
|
|
|
|
|
|
+ * We allocate one q_vector. If allocation fails we return -ENOMEM.
|
|
**/
|
|
**/
|
|
static int igb_alloc_q_vector(struct igb_adapter *adapter,
|
|
static int igb_alloc_q_vector(struct igb_adapter *adapter,
|
|
int v_count, int v_idx,
|
|
int v_count, int v_idx,
|
|
@@ -1231,10 +1236,9 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter,
|
|
if (adapter->hw.mac.type >= e1000_82576)
|
|
if (adapter->hw.mac.type >= e1000_82576)
|
|
set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags);
|
|
set_bit(IGB_RING_FLAG_RX_SCTP_CSUM, &ring->flags);
|
|
|
|
|
|
- /*
|
|
|
|
- * On i350, i210, and i211, loopback VLAN packets
|
|
|
|
|
|
+ /* On i350, i210, and i211, loopback VLAN packets
|
|
* have the tag byte-swapped.
|
|
* have the tag byte-swapped.
|
|
- * */
|
|
|
|
|
|
+ */
|
|
if (adapter->hw.mac.type >= e1000_i350)
|
|
if (adapter->hw.mac.type >= e1000_i350)
|
|
set_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &ring->flags);
|
|
set_bit(IGB_RING_FLAG_RX_LB_VLAN_BSWAP, &ring->flags);
|
|
|
|
|
|
@@ -1251,11 +1255,11 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter,
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_alloc_q_vectors - Allocate memory for interrupt vectors
|
|
|
|
- * @adapter: board private structure to initialize
|
|
|
|
|
|
+ * igb_alloc_q_vectors - Allocate memory for interrupt vectors
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
*
|
|
*
|
|
- * We allocate one q_vector per queue interrupt. If allocation fails we
|
|
|
|
- * return -ENOMEM.
|
|
|
|
|
|
+ * We allocate one q_vector per queue interrupt. If allocation fails we
|
|
|
|
+ * return -ENOMEM.
|
|
**/
|
|
**/
|
|
static int igb_alloc_q_vectors(struct igb_adapter *adapter)
|
|
static int igb_alloc_q_vectors(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1309,9 +1313,11 @@ err_out:
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_init_interrupt_scheme - initialize interrupts, allocate queues/vectors
|
|
|
|
|
|
+ * igb_init_interrupt_scheme - initialize interrupts, allocate queues/vectors
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
|
|
+ * @msix: boolean value of MSIX capability
|
|
*
|
|
*
|
|
- * This function initializes the interrupts and allocates all of the queues.
|
|
|
|
|
|
+ * This function initializes the interrupts and allocates all of the queues.
|
|
**/
|
|
**/
|
|
static int igb_init_interrupt_scheme(struct igb_adapter *adapter, bool msix)
|
|
static int igb_init_interrupt_scheme(struct igb_adapter *adapter, bool msix)
|
|
{
|
|
{
|
|
@@ -1336,10 +1342,11 @@ err_alloc_q_vectors:
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_request_irq - initialize interrupts
|
|
|
|
|
|
+ * igb_request_irq - initialize interrupts
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
*
|
|
*
|
|
- * Attempts to configure interrupts using the best available
|
|
|
|
- * capabilities of the hardware and kernel.
|
|
|
|
|
|
+ * Attempts to configure interrupts using the best available
|
|
|
|
+ * capabilities of the hardware and kernel.
|
|
**/
|
|
**/
|
|
static int igb_request_irq(struct igb_adapter *adapter)
|
|
static int igb_request_irq(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1405,15 +1412,14 @@ static void igb_free_irq(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_irq_disable - Mask off interrupt generation on the NIC
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_irq_disable - Mask off interrupt generation on the NIC
|
|
|
|
+ * @adapter: board private structure
|
|
**/
|
|
**/
|
|
static void igb_irq_disable(struct igb_adapter *adapter)
|
|
static void igb_irq_disable(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
|
|
|
|
- /*
|
|
|
|
- * we need to be careful when disabling interrupts. The VFs are also
|
|
|
|
|
|
+ /* we need to be careful when disabling interrupts. The VFs are also
|
|
* mapped into these registers and so clearing the bits can cause
|
|
* mapped into these registers and so clearing the bits can cause
|
|
* issues on the VF drivers so we only need to clear what we set
|
|
* issues on the VF drivers so we only need to clear what we set
|
|
*/
|
|
*/
|
|
@@ -1438,8 +1444,8 @@ static void igb_irq_disable(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_irq_enable - Enable default interrupt generation settings
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_irq_enable - Enable default interrupt generation settings
|
|
|
|
+ * @adapter: board private structure
|
|
**/
|
|
**/
|
|
static void igb_irq_enable(struct igb_adapter *adapter)
|
|
static void igb_irq_enable(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1488,13 +1494,12 @@ static void igb_update_mng_vlan(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_release_hw_control - release control of the h/w to f/w
|
|
|
|
- * @adapter: address of board private structure
|
|
|
|
- *
|
|
|
|
- * igb_release_hw_control resets CTRL_EXT:DRV_LOAD bit.
|
|
|
|
- * For ASF and Pass Through versions of f/w this means that the
|
|
|
|
- * driver is no longer loaded.
|
|
|
|
|
|
+ * igb_release_hw_control - release control of the h/w to f/w
|
|
|
|
+ * @adapter: address of board private structure
|
|
*
|
|
*
|
|
|
|
+ * igb_release_hw_control resets CTRL_EXT:DRV_LOAD bit.
|
|
|
|
+ * For ASF and Pass Through versions of f/w this means that the
|
|
|
|
+ * driver is no longer loaded.
|
|
**/
|
|
**/
|
|
static void igb_release_hw_control(struct igb_adapter *adapter)
|
|
static void igb_release_hw_control(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1508,13 +1513,12 @@ static void igb_release_hw_control(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_get_hw_control - get control of the h/w from f/w
|
|
|
|
- * @adapter: address of board private structure
|
|
|
|
- *
|
|
|
|
- * igb_get_hw_control sets CTRL_EXT:DRV_LOAD bit.
|
|
|
|
- * For ASF and Pass Through versions of f/w this means that
|
|
|
|
- * the driver is loaded.
|
|
|
|
|
|
+ * igb_get_hw_control - get control of the h/w from f/w
|
|
|
|
+ * @adapter: address of board private structure
|
|
*
|
|
*
|
|
|
|
+ * igb_get_hw_control sets CTRL_EXT:DRV_LOAD bit.
|
|
|
|
+ * For ASF and Pass Through versions of f/w this means that
|
|
|
|
+ * the driver is loaded.
|
|
**/
|
|
**/
|
|
static void igb_get_hw_control(struct igb_adapter *adapter)
|
|
static void igb_get_hw_control(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1528,8 +1532,8 @@ static void igb_get_hw_control(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_configure - configure the hardware for RX and TX
|
|
|
|
- * @adapter: private board structure
|
|
|
|
|
|
+ * igb_configure - configure the hardware for RX and TX
|
|
|
|
+ * @adapter: private board structure
|
|
**/
|
|
**/
|
|
static void igb_configure(struct igb_adapter *adapter)
|
|
static void igb_configure(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1552,7 +1556,8 @@ static void igb_configure(struct igb_adapter *adapter)
|
|
|
|
|
|
/* call igb_desc_unused which always leaves
|
|
/* call igb_desc_unused which always leaves
|
|
* at least 1 descriptor unused to make sure
|
|
* at least 1 descriptor unused to make sure
|
|
- * next_to_use != next_to_clean */
|
|
|
|
|
|
+ * next_to_use != next_to_clean
|
|
|
|
+ */
|
|
for (i = 0; i < adapter->num_rx_queues; i++) {
|
|
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];
|
|
igb_alloc_rx_buffers(ring, igb_desc_unused(ring));
|
|
igb_alloc_rx_buffers(ring, igb_desc_unused(ring));
|
|
@@ -1560,8 +1565,8 @@ static void igb_configure(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_power_up_link - Power up the phy/serdes link
|
|
|
|
- * @adapter: address of board private structure
|
|
|
|
|
|
+ * igb_power_up_link - Power up the phy/serdes link
|
|
|
|
+ * @adapter: address of board private structure
|
|
**/
|
|
**/
|
|
void igb_power_up_link(struct igb_adapter *adapter)
|
|
void igb_power_up_link(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1574,8 +1579,8 @@ void igb_power_up_link(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_power_down_link - Power down the phy/serdes link
|
|
|
|
- * @adapter: address of board private structure
|
|
|
|
|
|
+ * igb_power_down_link - Power down the phy/serdes link
|
|
|
|
+ * @adapter: address of board private structure
|
|
*/
|
|
*/
|
|
static void igb_power_down_link(struct igb_adapter *adapter)
|
|
static void igb_power_down_link(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1586,8 +1591,8 @@ static void igb_power_down_link(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_up - Open the interface and prepare it to handle traffic
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_up - Open the interface and prepare it to handle traffic
|
|
|
|
+ * @adapter: board private structure
|
|
**/
|
|
**/
|
|
int igb_up(struct igb_adapter *adapter)
|
|
int igb_up(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1635,7 +1640,8 @@ void igb_down(struct igb_adapter *adapter)
|
|
int i;
|
|
int i;
|
|
|
|
|
|
/* signal that we're down so the interrupt handler does not
|
|
/* signal that we're down so the interrupt handler does not
|
|
- * reschedule our watchdog timer */
|
|
|
|
|
|
+ * reschedule our watchdog timer
|
|
|
|
+ */
|
|
set_bit(__IGB_DOWN, &adapter->state);
|
|
set_bit(__IGB_DOWN, &adapter->state);
|
|
|
|
|
|
/* disable receives in the hardware */
|
|
/* disable receives in the hardware */
|
|
@@ -1731,14 +1737,16 @@ void igb_reset(struct igb_adapter *adapter)
|
|
* rounded up to the next 1KB and expressed in KB. Likewise,
|
|
* rounded up to the next 1KB and expressed in KB. Likewise,
|
|
* the Rx FIFO should be large enough to accommodate at least
|
|
* the Rx FIFO should be large enough to accommodate at least
|
|
* one full receive packet and is similarly rounded up and
|
|
* one full receive packet and is similarly rounded up and
|
|
- * expressed in KB. */
|
|
|
|
|
|
+ * expressed in KB.
|
|
|
|
+ */
|
|
pba = rd32(E1000_PBA);
|
|
pba = rd32(E1000_PBA);
|
|
/* upper 16 bits has Tx packet buffer allocation size in KB */
|
|
/* upper 16 bits has Tx packet buffer allocation size in KB */
|
|
tx_space = pba >> 16;
|
|
tx_space = pba >> 16;
|
|
/* lower 16 bits has Rx packet buffer allocation size in KB */
|
|
/* lower 16 bits has Rx packet buffer allocation size in KB */
|
|
pba &= 0xffff;
|
|
pba &= 0xffff;
|
|
- /* the tx fifo also stores 16 bytes of information about the tx
|
|
|
|
- * but don't include ethernet FCS because hardware appends it */
|
|
|
|
|
|
+ /* the Tx fifo also stores 16 bytes of information about the Tx
|
|
|
|
+ * but don't include ethernet FCS because hardware appends it
|
|
|
|
+ */
|
|
min_tx_space = (adapter->max_frame_size +
|
|
min_tx_space = (adapter->max_frame_size +
|
|
sizeof(union e1000_adv_tx_desc) -
|
|
sizeof(union e1000_adv_tx_desc) -
|
|
ETH_FCS_LEN) * 2;
|
|
ETH_FCS_LEN) * 2;
|
|
@@ -1751,13 +1759,15 @@ void igb_reset(struct igb_adapter *adapter)
|
|
|
|
|
|
/* If current Tx allocation is less than the min Tx FIFO size,
|
|
/* If current Tx allocation is less than the min Tx FIFO size,
|
|
* and the min Tx FIFO size is less than the current Rx FIFO
|
|
* and the min Tx FIFO size is less than the current Rx FIFO
|
|
- * allocation, take space away from current Rx allocation */
|
|
|
|
|
|
+ * allocation, take space away from current Rx allocation
|
|
|
|
+ */
|
|
if (tx_space < min_tx_space &&
|
|
if (tx_space < min_tx_space &&
|
|
((min_tx_space - tx_space) < pba)) {
|
|
((min_tx_space - tx_space) < pba)) {
|
|
pba = pba - (min_tx_space - tx_space);
|
|
pba = pba - (min_tx_space - tx_space);
|
|
|
|
|
|
- /* if short on rx space, rx wins and must trump tx
|
|
|
|
- * adjustment */
|
|
|
|
|
|
+ /* if short on Rx space, Rx wins and must trump Tx
|
|
|
|
+ * adjustment
|
|
|
|
+ */
|
|
if (pba < min_rx_space)
|
|
if (pba < min_rx_space)
|
|
pba = min_rx_space;
|
|
pba = min_rx_space;
|
|
}
|
|
}
|
|
@@ -1769,7 +1779,8 @@ void igb_reset(struct igb_adapter *adapter)
|
|
* (or the size used for early receive) above it in the Rx FIFO.
|
|
* (or the size used for early receive) above it in the Rx FIFO.
|
|
* Set it to the lower of:
|
|
* Set it to the lower of:
|
|
* - 90% of the Rx FIFO size, or
|
|
* - 90% of the Rx FIFO size, or
|
|
- * - the full Rx FIFO size minus one full frame */
|
|
|
|
|
|
+ * - the full Rx FIFO size minus one full frame
|
|
|
|
+ */
|
|
hwm = min(((pba << 10) * 9 / 10),
|
|
hwm = min(((pba << 10) * 9 / 10),
|
|
((pba << 10) - 2 * adapter->max_frame_size));
|
|
((pba << 10) - 2 * adapter->max_frame_size));
|
|
|
|
|
|
@@ -1800,8 +1811,7 @@ void igb_reset(struct igb_adapter *adapter)
|
|
if (hw->mac.ops.init_hw(hw))
|
|
if (hw->mac.ops.init_hw(hw))
|
|
dev_err(&pdev->dev, "Hardware Error\n");
|
|
dev_err(&pdev->dev, "Hardware Error\n");
|
|
|
|
|
|
- /*
|
|
|
|
- * Flow control settings reset on hardware reset, so guarantee flow
|
|
|
|
|
|
+ /* Flow control settings reset on hardware reset, so guarantee flow
|
|
* control is off when forcing speed.
|
|
* control is off when forcing speed.
|
|
*/
|
|
*/
|
|
if (!hw->mac.autoneg)
|
|
if (!hw->mac.autoneg)
|
|
@@ -1837,9 +1847,8 @@ void igb_reset(struct igb_adapter *adapter)
|
|
static netdev_features_t igb_fix_features(struct net_device *netdev,
|
|
static netdev_features_t igb_fix_features(struct net_device *netdev,
|
|
netdev_features_t features)
|
|
netdev_features_t features)
|
|
{
|
|
{
|
|
- /*
|
|
|
|
- * Since there is no support for separate rx/tx vlan accel
|
|
|
|
- * enable/disable make sure tx flag is always in same state as rx.
|
|
|
|
|
|
+ /* Since there is no support for separate Rx/Tx vlan accel
|
|
|
|
+ * enable/disable make sure Tx flag is always in same state as Rx.
|
|
*/
|
|
*/
|
|
if (features & NETIF_F_HW_VLAN_RX)
|
|
if (features & NETIF_F_HW_VLAN_RX)
|
|
features |= NETIF_F_HW_VLAN_TX;
|
|
features |= NETIF_F_HW_VLAN_TX;
|
|
@@ -1898,7 +1907,6 @@ static const struct net_device_ops igb_netdev_ops = {
|
|
/**
|
|
/**
|
|
* igb_set_fw_version - Configure version string for ethtool
|
|
* igb_set_fw_version - Configure version string for ethtool
|
|
* @adapter: adapter struct
|
|
* @adapter: adapter struct
|
|
- *
|
|
|
|
**/
|
|
**/
|
|
void igb_set_fw_version(struct igb_adapter *adapter)
|
|
void igb_set_fw_version(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -1934,10 +1942,10 @@ void igb_set_fw_version(struct igb_adapter *adapter)
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
-/* igb_init_i2c - Init I2C interface
|
|
|
|
|
|
+/**
|
|
|
|
+ * igb_init_i2c - Init I2C interface
|
|
* @adapter: pointer to adapter structure
|
|
* @adapter: pointer to adapter structure
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+ **/
|
|
static s32 igb_init_i2c(struct igb_adapter *adapter)
|
|
static s32 igb_init_i2c(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
s32 status = E1000_SUCCESS;
|
|
s32 status = E1000_SUCCESS;
|
|
@@ -1962,15 +1970,15 @@ static s32 igb_init_i2c(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_probe - Device Initialization Routine
|
|
|
|
- * @pdev: PCI device information struct
|
|
|
|
- * @ent: entry in igb_pci_tbl
|
|
|
|
|
|
+ * igb_probe - Device Initialization Routine
|
|
|
|
+ * @pdev: PCI device information struct
|
|
|
|
+ * @ent: entry in igb_pci_tbl
|
|
*
|
|
*
|
|
- * Returns 0 on success, negative on failure
|
|
|
|
|
|
+ * Returns 0 on success, negative on failure
|
|
*
|
|
*
|
|
- * igb_probe initializes an adapter identified by a pci_dev structure.
|
|
|
|
- * The OS initialization, configuring of the adapter private structure,
|
|
|
|
- * and a hardware reset occur.
|
|
|
|
|
|
+ * igb_probe initializes an adapter identified by a pci_dev structure.
|
|
|
|
+ * The OS initialization, configuring of the adapter private structure,
|
|
|
|
+ * and a hardware reset occur.
|
|
**/
|
|
**/
|
|
static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
{
|
|
{
|
|
@@ -2007,18 +2015,19 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
} else {
|
|
} else {
|
|
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
|
|
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
|
|
if (err) {
|
|
if (err) {
|
|
- err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
|
|
|
|
|
|
+ err = dma_set_coherent_mask(&pdev->dev,
|
|
|
|
+ DMA_BIT_MASK(32));
|
|
if (err) {
|
|
if (err) {
|
|
- dev_err(&pdev->dev, "No usable DMA "
|
|
|
|
- "configuration, aborting\n");
|
|
|
|
|
|
+ dev_err(&pdev->dev,
|
|
|
|
+ "No usable DMA configuration, aborting\n");
|
|
goto err_dma;
|
|
goto err_dma;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
err = pci_request_selected_regions(pdev, pci_select_bars(pdev,
|
|
err = pci_request_selected_regions(pdev, pci_select_bars(pdev,
|
|
- IORESOURCE_MEM),
|
|
|
|
- igb_driver_name);
|
|
|
|
|
|
+ IORESOURCE_MEM),
|
|
|
|
+ igb_driver_name);
|
|
if (err)
|
|
if (err)
|
|
goto err_pci_reg;
|
|
goto err_pci_reg;
|
|
|
|
|
|
@@ -2096,8 +2105,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
dev_info(&pdev->dev,
|
|
dev_info(&pdev->dev,
|
|
"PHY reset is blocked due to SOL/IDER session.\n");
|
|
"PHY reset is blocked due to SOL/IDER session.\n");
|
|
|
|
|
|
- /*
|
|
|
|
- * features is initialized to 0 in allocation, it might have bits
|
|
|
|
|
|
+ /* features is initialized to 0 in allocation, it might have bits
|
|
* set by igb_sw_init so we should use an or instead of an
|
|
* set by igb_sw_init so we should use an or instead of an
|
|
* assignment.
|
|
* assignment.
|
|
*/
|
|
*/
|
|
@@ -2141,11 +2149,11 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
adapter->en_mng_pt = igb_enable_mng_pass_thru(hw);
|
|
adapter->en_mng_pt = igb_enable_mng_pass_thru(hw);
|
|
|
|
|
|
/* before reading the NVM, reset the controller to put the device in a
|
|
/* before reading the NVM, reset the controller to put the device in a
|
|
- * known good starting state */
|
|
|
|
|
|
+ * known good starting state
|
|
|
|
+ */
|
|
hw->mac.ops.reset_hw(hw);
|
|
hw->mac.ops.reset_hw(hw);
|
|
|
|
|
|
- /*
|
|
|
|
- * make sure the NVM is good , i211 parts have special NVM that
|
|
|
|
|
|
+ /* make sure the NVM is good , i211 parts have special NVM that
|
|
* doesn't contain a checksum
|
|
* doesn't contain a checksum
|
|
*/
|
|
*/
|
|
if (hw->mac.type != e1000_i211) {
|
|
if (hw->mac.type != e1000_i211) {
|
|
@@ -2172,9 +2180,9 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
igb_set_fw_version(adapter);
|
|
igb_set_fw_version(adapter);
|
|
|
|
|
|
setup_timer(&adapter->watchdog_timer, igb_watchdog,
|
|
setup_timer(&adapter->watchdog_timer, igb_watchdog,
|
|
- (unsigned long) adapter);
|
|
|
|
|
|
+ (unsigned long) adapter);
|
|
setup_timer(&adapter->phy_info_timer, igb_update_phy_info,
|
|
setup_timer(&adapter->phy_info_timer, igb_update_phy_info,
|
|
- (unsigned long) adapter);
|
|
|
|
|
|
+ (unsigned long) adapter);
|
|
|
|
|
|
INIT_WORK(&adapter->reset_task, igb_reset_task);
|
|
INIT_WORK(&adapter->reset_task, igb_reset_task);
|
|
INIT_WORK(&adapter->watchdog_task, igb_watchdog_task);
|
|
INIT_WORK(&adapter->watchdog_task, igb_watchdog_task);
|
|
@@ -2196,8 +2204,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
/* Check the NVM for wake support on non-port A ports */
|
|
/* Check the NVM for wake support on non-port A ports */
|
|
if (hw->mac.type >= e1000_82580)
|
|
if (hw->mac.type >= e1000_82580)
|
|
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A +
|
|
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A +
|
|
- NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1,
|
|
|
|
- &eeprom_data);
|
|
|
|
|
|
+ NVM_82580_LAN_FUNC_OFFSET(hw->bus.func), 1,
|
|
|
|
+ &eeprom_data);
|
|
else if (hw->bus.func == 1)
|
|
else if (hw->bus.func == 1)
|
|
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
|
|
hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
|
|
|
|
|
|
@@ -2206,7 +2214,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
|
|
|
|
/* now that we have the eeprom settings, apply the special cases where
|
|
/* now that we have the eeprom settings, apply the special cases where
|
|
* the eeprom may be wrong or the board simply won't support wake on
|
|
* the eeprom may be wrong or the board simply won't support wake on
|
|
- * lan on a particular port */
|
|
|
|
|
|
+ * lan on a particular port
|
|
|
|
+ */
|
|
switch (pdev->device) {
|
|
switch (pdev->device) {
|
|
case E1000_DEV_ID_82575GB_QUAD_COPPER:
|
|
case E1000_DEV_ID_82575GB_QUAD_COPPER:
|
|
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
|
|
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
|
|
@@ -2215,7 +2224,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
case E1000_DEV_ID_82576_FIBER:
|
|
case E1000_DEV_ID_82576_FIBER:
|
|
case E1000_DEV_ID_82576_SERDES:
|
|
case E1000_DEV_ID_82576_SERDES:
|
|
/* Wake events only supported on port A for dual fiber
|
|
/* Wake events only supported on port A for dual fiber
|
|
- * regardless of eeprom setting */
|
|
|
|
|
|
+ * regardless of eeprom setting
|
|
|
|
+ */
|
|
if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1)
|
|
if (rd32(E1000_STATUS) & E1000_STATUS_FUNC_1)
|
|
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
|
|
adapter->flags &= ~IGB_FLAG_WOL_SUPPORTED;
|
|
break;
|
|
break;
|
|
@@ -2285,8 +2295,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
if (hw->mac.type == e1000_i350 && hw->bus.func == 0) {
|
|
if (hw->mac.type == e1000_i350 && hw->bus.func == 0) {
|
|
u16 ets_word;
|
|
u16 ets_word;
|
|
|
|
|
|
- /*
|
|
|
|
- * Read the NVM to determine if this i350 device supports an
|
|
|
|
|
|
+ /* Read the NVM to determine if this i350 device supports an
|
|
* external thermal sensor.
|
|
* external thermal sensor.
|
|
*/
|
|
*/
|
|
hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_word);
|
|
hw->nvm.ops.read(hw, NVM_ETS_CFG, 1, &ets_word);
|
|
@@ -2310,7 +2319,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
netdev->name,
|
|
netdev->name,
|
|
((hw->bus.speed == e1000_bus_speed_2500) ? "2.5Gb/s" :
|
|
((hw->bus.speed == e1000_bus_speed_2500) ? "2.5Gb/s" :
|
|
(hw->bus.speed == e1000_bus_speed_5000) ? "5.0Gb/s" :
|
|
(hw->bus.speed == e1000_bus_speed_5000) ? "5.0Gb/s" :
|
|
- "unknown"),
|
|
|
|
|
|
+ "unknown"),
|
|
((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" :
|
|
((hw->bus.width == e1000_bus_width_pcie_x4) ? "Width x4" :
|
|
(hw->bus.width == e1000_bus_width_pcie_x2) ? "Width x2" :
|
|
(hw->bus.width == e1000_bus_width_pcie_x2) ? "Width x2" :
|
|
(hw->bus.width == e1000_bus_width_pcie_x1) ? "Width x1" :
|
|
(hw->bus.width == e1000_bus_width_pcie_x1) ? "Width x1" :
|
|
@@ -2355,7 +2364,7 @@ err_ioremap:
|
|
free_netdev(netdev);
|
|
free_netdev(netdev);
|
|
err_alloc_etherdev:
|
|
err_alloc_etherdev:
|
|
pci_release_selected_regions(pdev,
|
|
pci_release_selected_regions(pdev,
|
|
- pci_select_bars(pdev, IORESOURCE_MEM));
|
|
|
|
|
|
+ pci_select_bars(pdev, IORESOURCE_MEM));
|
|
err_pci_reg:
|
|
err_pci_reg:
|
|
err_dma:
|
|
err_dma:
|
|
pci_disable_device(pdev);
|
|
pci_disable_device(pdev);
|
|
@@ -2455,26 +2464,24 @@ out:
|
|
}
|
|
}
|
|
|
|
|
|
#endif
|
|
#endif
|
|
-/*
|
|
|
|
|
|
+/**
|
|
* igb_remove_i2c - Cleanup I2C interface
|
|
* igb_remove_i2c - Cleanup I2C interface
|
|
* @adapter: pointer to adapter structure
|
|
* @adapter: pointer to adapter structure
|
|
- *
|
|
|
|
- */
|
|
|
|
|
|
+ **/
|
|
static void igb_remove_i2c(struct igb_adapter *adapter)
|
|
static void igb_remove_i2c(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
-
|
|
|
|
/* free the adapter bus structure */
|
|
/* free the adapter bus structure */
|
|
i2c_del_adapter(&adapter->i2c_adap);
|
|
i2c_del_adapter(&adapter->i2c_adap);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_remove - Device Removal Routine
|
|
|
|
- * @pdev: PCI device information struct
|
|
|
|
|
|
+ * igb_remove - Device Removal Routine
|
|
|
|
+ * @pdev: PCI device information struct
|
|
*
|
|
*
|
|
- * igb_remove is called by the PCI subsystem to alert the driver
|
|
|
|
- * that it should release a PCI device. The could be caused by a
|
|
|
|
- * Hot-Plug event, or because the driver is going to be removed from
|
|
|
|
- * memory.
|
|
|
|
|
|
+ * igb_remove is called by the PCI subsystem to alert the driver
|
|
|
|
+ * that it should release a PCI device. The could be caused by a
|
|
|
|
+ * Hot-Plug event, or because the driver is going to be removed from
|
|
|
|
+ * memory.
|
|
**/
|
|
**/
|
|
static void igb_remove(struct pci_dev *pdev)
|
|
static void igb_remove(struct pci_dev *pdev)
|
|
{
|
|
{
|
|
@@ -2488,8 +2495,7 @@ static void igb_remove(struct pci_dev *pdev)
|
|
#endif
|
|
#endif
|
|
igb_remove_i2c(adapter);
|
|
igb_remove_i2c(adapter);
|
|
igb_ptp_stop(adapter);
|
|
igb_ptp_stop(adapter);
|
|
- /*
|
|
|
|
- * The watchdog timer may be rescheduled, so explicitly
|
|
|
|
|
|
+ /* The watchdog timer may be rescheduled, so explicitly
|
|
* disable watchdog from being rescheduled.
|
|
* disable watchdog from being rescheduled.
|
|
*/
|
|
*/
|
|
set_bit(__IGB_DOWN, &adapter->state);
|
|
set_bit(__IGB_DOWN, &adapter->state);
|
|
@@ -2509,7 +2515,8 @@ static void igb_remove(struct pci_dev *pdev)
|
|
#endif
|
|
#endif
|
|
|
|
|
|
/* Release control of h/w to f/w. If f/w is AMT enabled, this
|
|
/* Release control of h/w to f/w. If f/w is AMT enabled, this
|
|
- * would have already happened in close and is redundant. */
|
|
|
|
|
|
+ * would have already happened in close and is redundant.
|
|
|
|
+ */
|
|
igb_release_hw_control(adapter);
|
|
igb_release_hw_control(adapter);
|
|
|
|
|
|
unregister_netdev(netdev);
|
|
unregister_netdev(netdev);
|
|
@@ -2524,7 +2531,7 @@ static void igb_remove(struct pci_dev *pdev)
|
|
if (hw->flash_address)
|
|
if (hw->flash_address)
|
|
iounmap(hw->flash_address);
|
|
iounmap(hw->flash_address);
|
|
pci_release_selected_regions(pdev,
|
|
pci_release_selected_regions(pdev,
|
|
- pci_select_bars(pdev, IORESOURCE_MEM));
|
|
|
|
|
|
+ pci_select_bars(pdev, IORESOURCE_MEM));
|
|
|
|
|
|
kfree(adapter->shadow_vfta);
|
|
kfree(adapter->shadow_vfta);
|
|
free_netdev(netdev);
|
|
free_netdev(netdev);
|
|
@@ -2535,13 +2542,13 @@ static void igb_remove(struct pci_dev *pdev)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_probe_vfs - Initialize vf data storage and add VFs to pci config space
|
|
|
|
- * @adapter: board private structure to initialize
|
|
|
|
|
|
+ * igb_probe_vfs - Initialize vf data storage and add VFs to pci config space
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
*
|
|
*
|
|
- * This function initializes the vf specific data storage and then attempts to
|
|
|
|
- * allocate the VFs. The reason for ordering it this way is because it is much
|
|
|
|
- * mor expensive time wise to disable SR-IOV than it is to allocate and free
|
|
|
|
- * the memory for the VFs.
|
|
|
|
|
|
+ * This function initializes the vf specific data storage and then attempts to
|
|
|
|
+ * allocate the VFs. The reason for ordering it this way is because it is much
|
|
|
|
+ * mor expensive time wise to disable SR-IOV than it is to allocate and free
|
|
|
|
+ * the memory for the VFs.
|
|
**/
|
|
**/
|
|
static void igb_probe_vfs(struct igb_adapter *adapter)
|
|
static void igb_probe_vfs(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -2601,8 +2608,7 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter)
|
|
/* Device supports enough interrupts without queue pairing. */
|
|
/* Device supports enough interrupts without queue pairing. */
|
|
break;
|
|
break;
|
|
case e1000_82576:
|
|
case e1000_82576:
|
|
- /*
|
|
|
|
- * If VFs are going to be allocated with RSS queues then we
|
|
|
|
|
|
+ /* If VFs are going to be allocated with RSS queues then we
|
|
* should pair the queues in order to conserve interrupts due
|
|
* should pair the queues in order to conserve interrupts due
|
|
* to limited supply.
|
|
* to limited supply.
|
|
*/
|
|
*/
|
|
@@ -2614,8 +2620,7 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter)
|
|
case e1000_i350:
|
|
case e1000_i350:
|
|
case e1000_i210:
|
|
case e1000_i210:
|
|
default:
|
|
default:
|
|
- /*
|
|
|
|
- * If rss_queues > half of max_rss_queues, pair the queues in
|
|
|
|
|
|
+ /* If rss_queues > half of max_rss_queues, pair the queues in
|
|
* order to conserve interrupts due to limited supply.
|
|
* order to conserve interrupts due to limited supply.
|
|
*/
|
|
*/
|
|
if (adapter->rss_queues > (max_rss_queues / 2))
|
|
if (adapter->rss_queues > (max_rss_queues / 2))
|
|
@@ -2625,12 +2630,12 @@ static void igb_init_queue_configuration(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_sw_init - Initialize general software structures (struct igb_adapter)
|
|
|
|
- * @adapter: board private structure to initialize
|
|
|
|
|
|
+ * igb_sw_init - Initialize general software structures (struct igb_adapter)
|
|
|
|
+ * @adapter: board private structure to initialize
|
|
*
|
|
*
|
|
- * igb_sw_init initializes the Adapter private data structure.
|
|
|
|
- * Fields are initialized based on PCI device information and
|
|
|
|
- * OS network device settings (MTU size).
|
|
|
|
|
|
+ * igb_sw_init initializes the Adapter private data structure.
|
|
|
|
+ * Fields are initialized based on PCI device information and
|
|
|
|
+ * OS network device settings (MTU size).
|
|
**/
|
|
**/
|
|
static int igb_sw_init(struct igb_adapter *adapter)
|
|
static int igb_sw_init(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -2700,16 +2705,16 @@ static int igb_sw_init(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_open - Called when a network interface is made active
|
|
|
|
- * @netdev: network interface device structure
|
|
|
|
|
|
+ * igb_open - Called when a network interface is made active
|
|
|
|
+ * @netdev: network interface device structure
|
|
*
|
|
*
|
|
- * Returns 0 on success, negative value on failure
|
|
|
|
|
|
+ * Returns 0 on success, negative value on failure
|
|
*
|
|
*
|
|
- * The open entry point is called when a network interface is made
|
|
|
|
- * active by the system (IFF_UP). At this point all resources needed
|
|
|
|
- * for transmit and receive operations are allocated, the interrupt
|
|
|
|
- * handler is registered with the OS, the watchdog timer is started,
|
|
|
|
- * and the stack is notified that the interface is ready.
|
|
|
|
|
|
+ * The open entry point is called when a network interface is made
|
|
|
|
+ * active by the system (IFF_UP). At this point all resources needed
|
|
|
|
+ * for transmit and receive operations are allocated, the interrupt
|
|
|
|
+ * handler is registered with the OS, the watchdog timer is started,
|
|
|
|
+ * and the stack is notified that the interface is ready.
|
|
**/
|
|
**/
|
|
static int __igb_open(struct net_device *netdev, bool resuming)
|
|
static int __igb_open(struct net_device *netdev, bool resuming)
|
|
{
|
|
{
|
|
@@ -2745,7 +2750,8 @@ static int __igb_open(struct net_device *netdev, bool resuming)
|
|
/* before we allocate an interrupt, we must be ready to handle it.
|
|
/* before we allocate an interrupt, we must be ready to handle it.
|
|
* Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
|
|
* Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
|
|
* as soon as we call pci_request_irq, so we have to setup our
|
|
* as soon as we call pci_request_irq, so we have to setup our
|
|
- * clean_rx handler before we do so. */
|
|
|
|
|
|
+ * clean_rx handler before we do so.
|
|
|
|
+ */
|
|
igb_configure(adapter);
|
|
igb_configure(adapter);
|
|
|
|
|
|
err = igb_request_irq(adapter);
|
|
err = igb_request_irq(adapter);
|
|
@@ -2814,15 +2820,15 @@ static int igb_open(struct net_device *netdev)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_close - Disables a network interface
|
|
|
|
- * @netdev: network interface device structure
|
|
|
|
|
|
+ * igb_close - Disables a network interface
|
|
|
|
+ * @netdev: network interface device structure
|
|
*
|
|
*
|
|
- * Returns 0, this is not allowed to fail
|
|
|
|
|
|
+ * Returns 0, this is not allowed to fail
|
|
*
|
|
*
|
|
- * The close entry point is called when an interface is de-activated
|
|
|
|
- * by the OS. The hardware is still under the driver's control, but
|
|
|
|
- * needs to be disabled. A global MAC reset is issued to stop the
|
|
|
|
- * hardware, and all transmit and receive resources are freed.
|
|
|
|
|
|
+ * The close entry point is called when an interface is de-activated
|
|
|
|
+ * by the OS. The hardware is still under the driver's control, but
|
|
|
|
+ * needs to be disabled. A global MAC reset is issued to stop the
|
|
|
|
+ * hardware, and all transmit and receive resources are freed.
|
|
**/
|
|
**/
|
|
static int __igb_close(struct net_device *netdev, bool suspending)
|
|
static int __igb_close(struct net_device *netdev, bool suspending)
|
|
{
|
|
{
|
|
@@ -2851,10 +2857,10 @@ static int igb_close(struct net_device *netdev)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_setup_tx_resources - allocate Tx resources (Descriptors)
|
|
|
|
- * @tx_ring: tx descriptor ring (for a specific queue) to setup
|
|
|
|
|
|
+ * igb_setup_tx_resources - allocate Tx resources (Descriptors)
|
|
|
|
+ * @tx_ring: tx descriptor ring (for a specific queue) to setup
|
|
*
|
|
*
|
|
- * Return 0 on success, negative on failure
|
|
|
|
|
|
+ * Return 0 on success, negative on failure
|
|
**/
|
|
**/
|
|
int igb_setup_tx_resources(struct igb_ring *tx_ring)
|
|
int igb_setup_tx_resources(struct igb_ring *tx_ring)
|
|
{
|
|
{
|
|
@@ -2889,11 +2895,11 @@ err:
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_setup_all_tx_resources - wrapper to allocate Tx resources
|
|
|
|
- * (Descriptors) for all queues
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_setup_all_tx_resources - wrapper to allocate Tx resources
|
|
|
|
+ * (Descriptors) for all queues
|
|
|
|
+ * @adapter: board private structure
|
|
*
|
|
*
|
|
- * Return 0 on success, negative on failure
|
|
|
|
|
|
+ * Return 0 on success, negative on failure
|
|
**/
|
|
**/
|
|
static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
|
|
static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -2915,8 +2921,8 @@ static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_setup_tctl - configure the transmit control registers
|
|
|
|
- * @adapter: Board private structure
|
|
|
|
|
|
+ * igb_setup_tctl - configure the transmit control registers
|
|
|
|
+ * @adapter: Board private structure
|
|
**/
|
|
**/
|
|
void igb_setup_tctl(struct igb_adapter *adapter)
|
|
void igb_setup_tctl(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -2941,11 +2947,11 @@ void igb_setup_tctl(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_configure_tx_ring - Configure transmit ring after Reset
|
|
|
|
- * @adapter: board private structure
|
|
|
|
- * @ring: tx ring to configure
|
|
|
|
|
|
+ * igb_configure_tx_ring - Configure transmit ring after Reset
|
|
|
|
+ * @adapter: board private structure
|
|
|
|
+ * @ring: tx ring to configure
|
|
*
|
|
*
|
|
- * Configure a transmit ring after a reset.
|
|
|
|
|
|
+ * Configure a transmit ring after a reset.
|
|
**/
|
|
**/
|
|
void igb_configure_tx_ring(struct igb_adapter *adapter,
|
|
void igb_configure_tx_ring(struct igb_adapter *adapter,
|
|
struct igb_ring *ring)
|
|
struct igb_ring *ring)
|
|
@@ -2961,9 +2967,9 @@ void igb_configure_tx_ring(struct igb_adapter *adapter,
|
|
mdelay(10);
|
|
mdelay(10);
|
|
|
|
|
|
wr32(E1000_TDLEN(reg_idx),
|
|
wr32(E1000_TDLEN(reg_idx),
|
|
- ring->count * sizeof(union e1000_adv_tx_desc));
|
|
|
|
|
|
+ ring->count * sizeof(union e1000_adv_tx_desc));
|
|
wr32(E1000_TDBAL(reg_idx),
|
|
wr32(E1000_TDBAL(reg_idx),
|
|
- tdba & 0x00000000ffffffffULL);
|
|
|
|
|
|
+ tdba & 0x00000000ffffffffULL);
|
|
wr32(E1000_TDBAH(reg_idx), tdba >> 32);
|
|
wr32(E1000_TDBAH(reg_idx), tdba >> 32);
|
|
|
|
|
|
ring->tail = hw->hw_addr + E1000_TDT(reg_idx);
|
|
ring->tail = hw->hw_addr + E1000_TDT(reg_idx);
|
|
@@ -2979,10 +2985,10 @@ void igb_configure_tx_ring(struct igb_adapter *adapter,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_configure_tx - Configure transmit Unit after Reset
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_configure_tx - Configure transmit Unit after Reset
|
|
|
|
+ * @adapter: board private structure
|
|
*
|
|
*
|
|
- * Configure the Tx unit of the MAC after a reset.
|
|
|
|
|
|
+ * Configure the Tx unit of the MAC after a reset.
|
|
**/
|
|
**/
|
|
static void igb_configure_tx(struct igb_adapter *adapter)
|
|
static void igb_configure_tx(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -2993,10 +2999,10 @@ static void igb_configure_tx(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_setup_rx_resources - allocate Rx resources (Descriptors)
|
|
|
|
- * @rx_ring: rx descriptor ring (for a specific queue) to setup
|
|
|
|
|
|
+ * igb_setup_rx_resources - allocate Rx resources (Descriptors)
|
|
|
|
+ * @rx_ring: Rx descriptor ring (for a specific queue) to setup
|
|
*
|
|
*
|
|
- * Returns 0 on success, negative on failure
|
|
|
|
|
|
+ * Returns 0 on success, negative on failure
|
|
**/
|
|
**/
|
|
int igb_setup_rx_resources(struct igb_ring *rx_ring)
|
|
int igb_setup_rx_resources(struct igb_ring *rx_ring)
|
|
{
|
|
{
|
|
@@ -3032,11 +3038,11 @@ err:
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_setup_all_rx_resources - wrapper to allocate Rx resources
|
|
|
|
- * (Descriptors) for all queues
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_setup_all_rx_resources - wrapper to allocate Rx resources
|
|
|
|
+ * (Descriptors) for all queues
|
|
|
|
+ * @adapter: board private structure
|
|
*
|
|
*
|
|
- * Return 0 on success, negative on failure
|
|
|
|
|
|
+ * Return 0 on success, negative on failure
|
|
**/
|
|
**/
|
|
static int igb_setup_all_rx_resources(struct igb_adapter *adapter)
|
|
static int igb_setup_all_rx_resources(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3058,8 +3064,8 @@ static int igb_setup_all_rx_resources(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_setup_mrqc - configure the multiple receive queue control registers
|
|
|
|
- * @adapter: Board private structure
|
|
|
|
|
|
+ * igb_setup_mrqc - configure the multiple receive queue control registers
|
|
|
|
+ * @adapter: Board private structure
|
|
**/
|
|
**/
|
|
static void igb_setup_mrqc(struct igb_adapter *adapter)
|
|
static void igb_setup_mrqc(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3092,8 +3098,7 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- * Populate the indirection table 4 entries at a time. To do this
|
|
|
|
|
|
+ /* Populate the indirection table 4 entries at a time. To do this
|
|
* we are generating the results for n and n+2 and then interleaving
|
|
* we are generating the results for n and n+2 and then interleaving
|
|
* those with the results with n+1 and n+3.
|
|
* those with the results with n+1 and n+3.
|
|
*/
|
|
*/
|
|
@@ -3109,8 +3114,7 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
|
|
wr32(E1000_RETA(j), reta);
|
|
wr32(E1000_RETA(j), reta);
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- * Disable raw packet checksumming so that RSS hash is placed in
|
|
|
|
|
|
+ /* Disable raw packet checksumming so that RSS hash is placed in
|
|
* descriptor on writeback. No need to enable TCP/UDP/IP checksum
|
|
* descriptor on writeback. No need to enable TCP/UDP/IP checksum
|
|
* offloads as they are enabled by default
|
|
* offloads as they are enabled by default
|
|
*/
|
|
*/
|
|
@@ -3140,7 +3144,8 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
|
|
|
|
|
|
/* If VMDq is enabled then we set the appropriate mode for that, else
|
|
/* If VMDq is enabled then we set the appropriate mode for that, else
|
|
* we default to RSS so that an RSS hash is calculated per packet even
|
|
* we default to RSS so that an RSS hash is calculated per packet even
|
|
- * if we are only using one queue */
|
|
|
|
|
|
+ * if we are only using one queue
|
|
|
|
+ */
|
|
if (adapter->vfs_allocated_count) {
|
|
if (adapter->vfs_allocated_count) {
|
|
if (hw->mac.type > e1000_82575) {
|
|
if (hw->mac.type > e1000_82575) {
|
|
/* Set the default pool for the PF's first queue */
|
|
/* Set the default pool for the PF's first queue */
|
|
@@ -3165,8 +3170,8 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_setup_rctl - configure the receive control registers
|
|
|
|
- * @adapter: Board private structure
|
|
|
|
|
|
+ * igb_setup_rctl - configure the receive control registers
|
|
|
|
+ * @adapter: Board private structure
|
|
**/
|
|
**/
|
|
void igb_setup_rctl(struct igb_adapter *adapter)
|
|
void igb_setup_rctl(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3181,8 +3186,7 @@ void igb_setup_rctl(struct igb_adapter *adapter)
|
|
rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_RDMTS_HALF |
|
|
rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_RDMTS_HALF |
|
|
(hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
|
|
(hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
|
|
|
|
|
|
- /*
|
|
|
|
- * enable stripping of CRC. It's unlikely this will break BMC
|
|
|
|
|
|
+ /* enable stripping of CRC. It's unlikely this will break BMC
|
|
* redirection as it did with e1000. Newer features require
|
|
* redirection as it did with e1000. Newer features require
|
|
* that the HW strips the CRC.
|
|
* that the HW strips the CRC.
|
|
*/
|
|
*/
|
|
@@ -3209,7 +3213,8 @@ void igb_setup_rctl(struct igb_adapter *adapter)
|
|
/* This is useful for sniffing bad packets. */
|
|
/* This is useful for sniffing bad packets. */
|
|
if (adapter->netdev->features & NETIF_F_RXALL) {
|
|
if (adapter->netdev->features & NETIF_F_RXALL) {
|
|
/* UPE and MPE will be handled by normal PROMISC logic
|
|
/* UPE and MPE will be handled by normal PROMISC logic
|
|
- * in e1000e_set_rx_mode */
|
|
|
|
|
|
+ * in e1000e_set_rx_mode
|
|
|
|
+ */
|
|
rctl |= (E1000_RCTL_SBP | /* Receive bad packets */
|
|
rctl |= (E1000_RCTL_SBP | /* Receive bad packets */
|
|
E1000_RCTL_BAM | /* RX All Bcast Pkts */
|
|
E1000_RCTL_BAM | /* RX All Bcast Pkts */
|
|
E1000_RCTL_PMCF); /* RX All MAC Ctrl Pkts */
|
|
E1000_RCTL_PMCF); /* RX All MAC Ctrl Pkts */
|
|
@@ -3232,7 +3237,8 @@ static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size,
|
|
u32 vmolr;
|
|
u32 vmolr;
|
|
|
|
|
|
/* if it isn't the PF check to see if VFs are enabled and
|
|
/* if it isn't the PF check to see if VFs are enabled and
|
|
- * increase the size to support vlan tags */
|
|
|
|
|
|
+ * increase the size to support vlan tags
|
|
|
|
+ */
|
|
if (vfn < adapter->vfs_allocated_count &&
|
|
if (vfn < adapter->vfs_allocated_count &&
|
|
adapter->vf_data[vfn].vlans_enabled)
|
|
adapter->vf_data[vfn].vlans_enabled)
|
|
size += VLAN_TAG_SIZE;
|
|
size += VLAN_TAG_SIZE;
|
|
@@ -3246,10 +3252,10 @@ static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_rlpml_set - set maximum receive packet size
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_rlpml_set - set maximum receive packet size
|
|
|
|
+ * @adapter: board private structure
|
|
*
|
|
*
|
|
- * Configure maximum receivable packet size.
|
|
|
|
|
|
+ * Configure maximum receivable packet size.
|
|
**/
|
|
**/
|
|
static void igb_rlpml_set(struct igb_adapter *adapter)
|
|
static void igb_rlpml_set(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3259,8 +3265,7 @@ static void igb_rlpml_set(struct igb_adapter *adapter)
|
|
|
|
|
|
if (pf_id) {
|
|
if (pf_id) {
|
|
igb_set_vf_rlpml(adapter, max_frame_size, pf_id);
|
|
igb_set_vf_rlpml(adapter, max_frame_size, pf_id);
|
|
- /*
|
|
|
|
- * If we're in VMDQ or SR-IOV mode, then set global RLPML
|
|
|
|
|
|
+ /* If we're in VMDQ or SR-IOV mode, then set global RLPML
|
|
* to our max jumbo frame size, in case we need to enable
|
|
* to our max jumbo frame size, in case we need to enable
|
|
* jumbo frames on one of the rings later.
|
|
* jumbo frames on one of the rings later.
|
|
* This will not pass over-length frames into the default
|
|
* This will not pass over-length frames into the default
|
|
@@ -3278,17 +3283,16 @@ static inline void igb_set_vmolr(struct igb_adapter *adapter,
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
u32 vmolr;
|
|
u32 vmolr;
|
|
|
|
|
|
- /*
|
|
|
|
- * This register exists only on 82576 and newer so if we are older then
|
|
|
|
|
|
+ /* This register exists only on 82576 and newer so if we are older then
|
|
* we should exit and do nothing
|
|
* we should exit and do nothing
|
|
*/
|
|
*/
|
|
if (hw->mac.type < e1000_82576)
|
|
if (hw->mac.type < e1000_82576)
|
|
return;
|
|
return;
|
|
|
|
|
|
vmolr = rd32(E1000_VMOLR(vfn));
|
|
vmolr = rd32(E1000_VMOLR(vfn));
|
|
- vmolr |= E1000_VMOLR_STRVLAN; /* Strip vlan tags */
|
|
|
|
|
|
+ vmolr |= E1000_VMOLR_STRVLAN; /* Strip vlan tags */
|
|
if (aupe)
|
|
if (aupe)
|
|
- vmolr |= E1000_VMOLR_AUPE; /* Accept untagged packets */
|
|
|
|
|
|
+ vmolr |= E1000_VMOLR_AUPE; /* Accept untagged packets */
|
|
else
|
|
else
|
|
vmolr &= ~(E1000_VMOLR_AUPE); /* Tagged packets ONLY */
|
|
vmolr &= ~(E1000_VMOLR_AUPE); /* Tagged packets ONLY */
|
|
|
|
|
|
@@ -3297,25 +3301,24 @@ static inline void igb_set_vmolr(struct igb_adapter *adapter,
|
|
|
|
|
|
if (adapter->rss_queues > 1 && vfn == adapter->vfs_allocated_count)
|
|
if (adapter->rss_queues > 1 && vfn == adapter->vfs_allocated_count)
|
|
vmolr |= E1000_VMOLR_RSSE; /* enable RSS */
|
|
vmolr |= E1000_VMOLR_RSSE; /* enable RSS */
|
|
- /*
|
|
|
|
- * for VMDq only allow the VFs and pool 0 to accept broadcast and
|
|
|
|
|
|
+ /* for VMDq only allow the VFs and pool 0 to accept broadcast and
|
|
* multicast packets
|
|
* multicast packets
|
|
*/
|
|
*/
|
|
if (vfn <= adapter->vfs_allocated_count)
|
|
if (vfn <= adapter->vfs_allocated_count)
|
|
- vmolr |= E1000_VMOLR_BAM; /* Accept broadcast */
|
|
|
|
|
|
+ vmolr |= E1000_VMOLR_BAM; /* Accept broadcast */
|
|
|
|
|
|
wr32(E1000_VMOLR(vfn), vmolr);
|
|
wr32(E1000_VMOLR(vfn), vmolr);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_configure_rx_ring - Configure a receive ring after Reset
|
|
|
|
- * @adapter: board private structure
|
|
|
|
- * @ring: receive ring to be configured
|
|
|
|
|
|
+ * igb_configure_rx_ring - Configure a receive ring after Reset
|
|
|
|
+ * @adapter: board private structure
|
|
|
|
+ * @ring: receive ring to be configured
|
|
*
|
|
*
|
|
- * Configure the Rx unit of the MAC after a reset.
|
|
|
|
|
|
+ * Configure the Rx unit of the MAC after a reset.
|
|
**/
|
|
**/
|
|
void igb_configure_rx_ring(struct igb_adapter *adapter,
|
|
void igb_configure_rx_ring(struct igb_adapter *adapter,
|
|
- struct igb_ring *ring)
|
|
|
|
|
|
+ struct igb_ring *ring)
|
|
{
|
|
{
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
u64 rdba = ring->dma;
|
|
u64 rdba = ring->dma;
|
|
@@ -3330,7 +3333,7 @@ void igb_configure_rx_ring(struct igb_adapter *adapter,
|
|
rdba & 0x00000000ffffffffULL);
|
|
rdba & 0x00000000ffffffffULL);
|
|
wr32(E1000_RDBAH(reg_idx), rdba >> 32);
|
|
wr32(E1000_RDBAH(reg_idx), rdba >> 32);
|
|
wr32(E1000_RDLEN(reg_idx),
|
|
wr32(E1000_RDLEN(reg_idx),
|
|
- ring->count * sizeof(union e1000_adv_rx_desc));
|
|
|
|
|
|
+ ring->count * sizeof(union e1000_adv_rx_desc));
|
|
|
|
|
|
/* initialize head and tail */
|
|
/* initialize head and tail */
|
|
ring->tail = hw->hw_addr + E1000_RDT(reg_idx);
|
|
ring->tail = hw->hw_addr + E1000_RDT(reg_idx);
|
|
@@ -3376,10 +3379,10 @@ static void igb_set_rx_buffer_len(struct igb_adapter *adapter,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_configure_rx - Configure receive Unit after Reset
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_configure_rx - Configure receive Unit after Reset
|
|
|
|
+ * @adapter: board private structure
|
|
*
|
|
*
|
|
- * Configure the Rx unit of the MAC after a reset.
|
|
|
|
|
|
+ * Configure the Rx unit of the MAC after a reset.
|
|
**/
|
|
**/
|
|
static void igb_configure_rx(struct igb_adapter *adapter)
|
|
static void igb_configure_rx(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3390,10 +3393,11 @@ static void igb_configure_rx(struct igb_adapter *adapter)
|
|
|
|
|
|
/* set the correct pool for the PF default MAC address in entry 0 */
|
|
/* set the correct pool for the PF default MAC address in entry 0 */
|
|
igb_rar_set_qsel(adapter, adapter->hw.mac.addr, 0,
|
|
igb_rar_set_qsel(adapter, adapter->hw.mac.addr, 0,
|
|
- adapter->vfs_allocated_count);
|
|
|
|
|
|
+ adapter->vfs_allocated_count);
|
|
|
|
|
|
/* Setup the HW Rx Head and Tail Descriptor Pointers and
|
|
/* Setup the HW Rx Head and Tail Descriptor Pointers and
|
|
- * the Base and Length of the Rx Descriptor Ring */
|
|
|
|
|
|
+ * the Base and Length of the Rx Descriptor Ring
|
|
|
|
+ */
|
|
for (i = 0; i < adapter->num_rx_queues; i++) {
|
|
for (i = 0; i < adapter->num_rx_queues; i++) {
|
|
struct igb_ring *rx_ring = adapter->rx_ring[i];
|
|
struct igb_ring *rx_ring = adapter->rx_ring[i];
|
|
igb_set_rx_buffer_len(adapter, rx_ring);
|
|
igb_set_rx_buffer_len(adapter, rx_ring);
|
|
@@ -3402,10 +3406,10 @@ static void igb_configure_rx(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_free_tx_resources - Free Tx Resources per Queue
|
|
|
|
- * @tx_ring: Tx descriptor ring for a specific queue
|
|
|
|
|
|
+ * igb_free_tx_resources - Free Tx Resources per Queue
|
|
|
|
+ * @tx_ring: Tx descriptor ring for a specific queue
|
|
*
|
|
*
|
|
- * Free all transmit software resources
|
|
|
|
|
|
+ * Free all transmit software resources
|
|
**/
|
|
**/
|
|
void igb_free_tx_resources(struct igb_ring *tx_ring)
|
|
void igb_free_tx_resources(struct igb_ring *tx_ring)
|
|
{
|
|
{
|
|
@@ -3425,10 +3429,10 @@ void igb_free_tx_resources(struct igb_ring *tx_ring)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_free_all_tx_resources - Free Tx Resources for All Queues
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_free_all_tx_resources - Free Tx Resources for All Queues
|
|
|
|
+ * @adapter: board private structure
|
|
*
|
|
*
|
|
- * Free all transmit software resources
|
|
|
|
|
|
+ * Free all transmit software resources
|
|
**/
|
|
**/
|
|
static void igb_free_all_tx_resources(struct igb_adapter *adapter)
|
|
static void igb_free_all_tx_resources(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3461,8 +3465,8 @@ void igb_unmap_and_free_tx_resource(struct igb_ring *ring,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_clean_tx_ring - Free Tx Buffers
|
|
|
|
- * @tx_ring: ring to be cleaned
|
|
|
|
|
|
+ * igb_clean_tx_ring - Free Tx Buffers
|
|
|
|
+ * @tx_ring: ring to be cleaned
|
|
**/
|
|
**/
|
|
static void igb_clean_tx_ring(struct igb_ring *tx_ring)
|
|
static void igb_clean_tx_ring(struct igb_ring *tx_ring)
|
|
{
|
|
{
|
|
@@ -3492,8 +3496,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_clean_all_tx_rings - Free Tx Buffers for all queues
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_clean_all_tx_rings - Free Tx Buffers for all queues
|
|
|
|
+ * @adapter: board private structure
|
|
**/
|
|
**/
|
|
static void igb_clean_all_tx_rings(struct igb_adapter *adapter)
|
|
static void igb_clean_all_tx_rings(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3504,10 +3508,10 @@ static void igb_clean_all_tx_rings(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_free_rx_resources - Free Rx Resources
|
|
|
|
- * @rx_ring: ring to clean the resources from
|
|
|
|
|
|
+ * igb_free_rx_resources - Free Rx Resources
|
|
|
|
+ * @rx_ring: ring to clean the resources from
|
|
*
|
|
*
|
|
- * Free all receive software resources
|
|
|
|
|
|
+ * Free all receive software resources
|
|
**/
|
|
**/
|
|
void igb_free_rx_resources(struct igb_ring *rx_ring)
|
|
void igb_free_rx_resources(struct igb_ring *rx_ring)
|
|
{
|
|
{
|
|
@@ -3527,10 +3531,10 @@ void igb_free_rx_resources(struct igb_ring *rx_ring)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_free_all_rx_resources - Free Rx Resources for All Queues
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_free_all_rx_resources - Free Rx Resources for All Queues
|
|
|
|
+ * @adapter: board private structure
|
|
*
|
|
*
|
|
- * Free all receive software resources
|
|
|
|
|
|
+ * Free all receive software resources
|
|
**/
|
|
**/
|
|
static void igb_free_all_rx_resources(struct igb_adapter *adapter)
|
|
static void igb_free_all_rx_resources(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3541,8 +3545,8 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_clean_rx_ring - Free Rx Buffers per Queue
|
|
|
|
- * @rx_ring: ring to free buffers from
|
|
|
|
|
|
+ * igb_clean_rx_ring - Free Rx Buffers per Queue
|
|
|
|
+ * @rx_ring: ring to free buffers from
|
|
**/
|
|
**/
|
|
static void igb_clean_rx_ring(struct igb_ring *rx_ring)
|
|
static void igb_clean_rx_ring(struct igb_ring *rx_ring)
|
|
{
|
|
{
|
|
@@ -3584,8 +3588,8 @@ static void igb_clean_rx_ring(struct igb_ring *rx_ring)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_clean_all_rx_rings - Free Rx Buffers for all queues
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_clean_all_rx_rings - Free Rx Buffers for all queues
|
|
|
|
+ * @adapter: board private structure
|
|
**/
|
|
**/
|
|
static void igb_clean_all_rx_rings(struct igb_adapter *adapter)
|
|
static void igb_clean_all_rx_rings(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3596,11 +3600,11 @@ static void igb_clean_all_rx_rings(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_set_mac - Change the Ethernet Address of the NIC
|
|
|
|
- * @netdev: network interface device structure
|
|
|
|
- * @p: pointer to an address structure
|
|
|
|
|
|
+ * igb_set_mac - Change the Ethernet Address of the NIC
|
|
|
|
+ * @netdev: network interface device structure
|
|
|
|
+ * @p: pointer to an address structure
|
|
*
|
|
*
|
|
- * Returns 0 on success, negative on failure
|
|
|
|
|
|
+ * Returns 0 on success, negative on failure
|
|
**/
|
|
**/
|
|
static int igb_set_mac(struct net_device *netdev, void *p)
|
|
static int igb_set_mac(struct net_device *netdev, void *p)
|
|
{
|
|
{
|
|
@@ -3616,19 +3620,19 @@ static int igb_set_mac(struct net_device *netdev, void *p)
|
|
|
|
|
|
/* set the correct pool for the new PF MAC address in entry 0 */
|
|
/* set the correct pool for the new PF MAC address in entry 0 */
|
|
igb_rar_set_qsel(adapter, hw->mac.addr, 0,
|
|
igb_rar_set_qsel(adapter, hw->mac.addr, 0,
|
|
- adapter->vfs_allocated_count);
|
|
|
|
|
|
+ adapter->vfs_allocated_count);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_write_mc_addr_list - write multicast addresses to MTA
|
|
|
|
- * @netdev: network interface device structure
|
|
|
|
|
|
+ * igb_write_mc_addr_list - write multicast addresses to MTA
|
|
|
|
+ * @netdev: network interface device structure
|
|
*
|
|
*
|
|
- * Writes multicast address list to the MTA hash table.
|
|
|
|
- * Returns: -ENOMEM on failure
|
|
|
|
- * 0 on no addresses written
|
|
|
|
- * X on writing X addresses to MTA
|
|
|
|
|
|
+ * Writes multicast address list to the MTA hash table.
|
|
|
|
+ * Returns: -ENOMEM on failure
|
|
|
|
+ * 0 on no addresses written
|
|
|
|
+ * X on writing X addresses to MTA
|
|
**/
|
|
**/
|
|
static int igb_write_mc_addr_list(struct net_device *netdev)
|
|
static int igb_write_mc_addr_list(struct net_device *netdev)
|
|
{
|
|
{
|
|
@@ -3661,13 +3665,13 @@ static int igb_write_mc_addr_list(struct net_device *netdev)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_write_uc_addr_list - write unicast addresses to RAR table
|
|
|
|
- * @netdev: network interface device structure
|
|
|
|
|
|
+ * igb_write_uc_addr_list - write unicast addresses to RAR table
|
|
|
|
+ * @netdev: network interface device structure
|
|
*
|
|
*
|
|
- * Writes unicast address list to the RAR table.
|
|
|
|
- * Returns: -ENOMEM on failure/insufficient address space
|
|
|
|
- * 0 on no addresses written
|
|
|
|
- * X on writing X addresses to the RAR table
|
|
|
|
|
|
+ * Writes unicast address list to the RAR table.
|
|
|
|
+ * Returns: -ENOMEM on failure/insufficient address space
|
|
|
|
+ * 0 on no addresses written
|
|
|
|
+ * X on writing X addresses to the RAR table
|
|
**/
|
|
**/
|
|
static int igb_write_uc_addr_list(struct net_device *netdev)
|
|
static int igb_write_uc_addr_list(struct net_device *netdev)
|
|
{
|
|
{
|
|
@@ -3688,8 +3692,8 @@ static int igb_write_uc_addr_list(struct net_device *netdev)
|
|
if (!rar_entries)
|
|
if (!rar_entries)
|
|
break;
|
|
break;
|
|
igb_rar_set_qsel(adapter, ha->addr,
|
|
igb_rar_set_qsel(adapter, ha->addr,
|
|
- rar_entries--,
|
|
|
|
- vfn);
|
|
|
|
|
|
+ rar_entries--,
|
|
|
|
+ vfn);
|
|
count++;
|
|
count++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -3704,13 +3708,13 @@ static int igb_write_uc_addr_list(struct net_device *netdev)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_set_rx_mode - Secondary Unicast, Multicast and Promiscuous mode set
|
|
|
|
- * @netdev: network interface device structure
|
|
|
|
|
|
+ * igb_set_rx_mode - Secondary Unicast, Multicast and Promiscuous mode set
|
|
|
|
+ * @netdev: network interface device structure
|
|
*
|
|
*
|
|
- * The set_rx_mode entry point is called whenever the unicast or multicast
|
|
|
|
- * address lists or the network interface flags are updated. This routine is
|
|
|
|
- * responsible for configuring the hardware for proper unicast, multicast,
|
|
|
|
- * promiscuous mode, and all-multi behavior.
|
|
|
|
|
|
+ * The set_rx_mode entry point is called whenever the unicast or multicast
|
|
|
|
+ * address lists or the network interface flags are updated. This routine is
|
|
|
|
+ * responsible for configuring the hardware for proper unicast, multicast,
|
|
|
|
+ * promiscuous mode, and all-multi behavior.
|
|
**/
|
|
**/
|
|
static void igb_set_rx_mode(struct net_device *netdev)
|
|
static void igb_set_rx_mode(struct net_device *netdev)
|
|
{
|
|
{
|
|
@@ -3734,8 +3738,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
|
|
rctl |= E1000_RCTL_MPE;
|
|
rctl |= E1000_RCTL_MPE;
|
|
vmolr |= E1000_VMOLR_MPME;
|
|
vmolr |= E1000_VMOLR_MPME;
|
|
} else {
|
|
} else {
|
|
- /*
|
|
|
|
- * Write addresses to the MTA, if the attempt fails
|
|
|
|
|
|
+ /* Write addresses to the MTA, if the attempt fails
|
|
* then we should just turn on promiscuous mode so
|
|
* then we should just turn on promiscuous mode so
|
|
* that we can at least receive multicast traffic
|
|
* that we can at least receive multicast traffic
|
|
*/
|
|
*/
|
|
@@ -3747,8 +3750,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
|
|
vmolr |= E1000_VMOLR_ROMPE;
|
|
vmolr |= E1000_VMOLR_ROMPE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- /*
|
|
|
|
- * Write addresses to available RAR registers, if there is not
|
|
|
|
|
|
+ /* Write addresses to available RAR registers, if there is not
|
|
* sufficient space to store all the addresses then enable
|
|
* sufficient space to store all the addresses then enable
|
|
* unicast promiscuous mode
|
|
* unicast promiscuous mode
|
|
*/
|
|
*/
|
|
@@ -3761,8 +3763,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
|
|
}
|
|
}
|
|
wr32(E1000_RCTL, rctl);
|
|
wr32(E1000_RCTL, rctl);
|
|
|
|
|
|
- /*
|
|
|
|
- * In order to support SR-IOV and eventually VMDq it is necessary to set
|
|
|
|
|
|
+ /* In order to support SR-IOV and eventually VMDq it is necessary to set
|
|
* the VMOLR to enable the appropriate modes. Without this workaround
|
|
* the VMOLR to enable the appropriate modes. Without this workaround
|
|
* we will have issues with VLAN tag stripping not being done for frames
|
|
* we will have issues with VLAN tag stripping not being done for frames
|
|
* that are only arriving because we are the default pool
|
|
* that are only arriving because we are the default pool
|
|
@@ -3771,7 +3772,7 @@ static void igb_set_rx_mode(struct net_device *netdev)
|
|
return;
|
|
return;
|
|
|
|
|
|
vmolr |= rd32(E1000_VMOLR(vfn)) &
|
|
vmolr |= rd32(E1000_VMOLR(vfn)) &
|
|
- ~(E1000_VMOLR_ROPE | E1000_VMOLR_MPME | E1000_VMOLR_ROMPE);
|
|
|
|
|
|
+ ~(E1000_VMOLR_ROPE | E1000_VMOLR_MPME | E1000_VMOLR_ROMPE);
|
|
wr32(E1000_VMOLR(vfn), vmolr);
|
|
wr32(E1000_VMOLR(vfn), vmolr);
|
|
igb_restore_vf_multicasts(adapter);
|
|
igb_restore_vf_multicasts(adapter);
|
|
}
|
|
}
|
|
@@ -3816,7 +3817,8 @@ static void igb_spoof_check(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/* Need to wait a few seconds after link up to get diagnostic information from
|
|
/* Need to wait a few seconds after link up to get diagnostic information from
|
|
- * the phy */
|
|
|
|
|
|
+ * the phy
|
|
|
|
+ */
|
|
static void igb_update_phy_info(unsigned long data)
|
|
static void igb_update_phy_info(unsigned long data)
|
|
{
|
|
{
|
|
struct igb_adapter *adapter = (struct igb_adapter *) data;
|
|
struct igb_adapter *adapter = (struct igb_adapter *) data;
|
|
@@ -3824,8 +3826,8 @@ static void igb_update_phy_info(unsigned long data)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_has_link - check shared code for link and determine up/down
|
|
|
|
- * @adapter: pointer to driver private info
|
|
|
|
|
|
+ * igb_has_link - check shared code for link and determine up/down
|
|
|
|
+ * @adapter: pointer to driver private info
|
|
**/
|
|
**/
|
|
bool igb_has_link(struct igb_adapter *adapter)
|
|
bool igb_has_link(struct igb_adapter *adapter)
|
|
{
|
|
{
|
|
@@ -3878,8 +3880,8 @@ static bool igb_thermal_sensor_event(struct e1000_hw *hw, u32 event)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_watchdog - Timer Call-back
|
|
|
|
- * @data: pointer to adapter cast into an unsigned long
|
|
|
|
|
|
+ * igb_watchdog - Timer Call-back
|
|
|
|
+ * @data: pointer to adapter cast into an unsigned long
|
|
**/
|
|
**/
|
|
static void igb_watchdog(unsigned long data)
|
|
static void igb_watchdog(unsigned long data)
|
|
{
|
|
{
|
|
@@ -3891,8 +3893,8 @@ static void igb_watchdog(unsigned long data)
|
|
static void igb_watchdog_task(struct work_struct *work)
|
|
static void igb_watchdog_task(struct work_struct *work)
|
|
{
|
|
{
|
|
struct igb_adapter *adapter = container_of(work,
|
|
struct igb_adapter *adapter = container_of(work,
|
|
- struct igb_adapter,
|
|
|
|
- watchdog_task);
|
|
|
|
|
|
+ struct igb_adapter,
|
|
|
|
+ watchdog_task);
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
struct net_device *netdev = adapter->netdev;
|
|
struct net_device *netdev = adapter->netdev;
|
|
u32 link;
|
|
u32 link;
|
|
@@ -3906,8 +3908,8 @@ static void igb_watchdog_task(struct work_struct *work)
|
|
if (!netif_carrier_ok(netdev)) {
|
|
if (!netif_carrier_ok(netdev)) {
|
|
u32 ctrl;
|
|
u32 ctrl;
|
|
hw->mac.ops.get_speed_and_duplex(hw,
|
|
hw->mac.ops.get_speed_and_duplex(hw,
|
|
- &adapter->link_speed,
|
|
|
|
- &adapter->link_duplex);
|
|
|
|
|
|
+ &adapter->link_speed,
|
|
|
|
+ &adapter->link_duplex);
|
|
|
|
|
|
ctrl = rd32(E1000_CTRL);
|
|
ctrl = rd32(E1000_CTRL);
|
|
/* Links status message must follow this format */
|
|
/* Links status message must follow this format */
|
|
@@ -3990,7 +3992,8 @@ static void igb_watchdog_task(struct work_struct *work)
|
|
/* We've lost link, so the controller stops DMA,
|
|
/* We've lost link, so the controller stops DMA,
|
|
* but we've got queued Tx work that's never going
|
|
* but we've got queued Tx work that's never going
|
|
* to get done, so reset controller to flush Tx.
|
|
* to get done, so reset controller to flush Tx.
|
|
- * (Do the reset outside of interrupt context). */
|
|
|
|
|
|
+ * (Do the reset outside of interrupt context).
|
|
|
|
+ */
|
|
if (igb_desc_unused(tx_ring) + 1 < tx_ring->count) {
|
|
if (igb_desc_unused(tx_ring) + 1 < tx_ring->count) {
|
|
adapter->tx_timeout_count++;
|
|
adapter->tx_timeout_count++;
|
|
schedule_work(&adapter->reset_task);
|
|
schedule_work(&adapter->reset_task);
|
|
@@ -4003,7 +4006,7 @@ static void igb_watchdog_task(struct work_struct *work)
|
|
set_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);
|
|
set_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);
|
|
}
|
|
}
|
|
|
|
|
|
- /* Cause software interrupt to ensure rx ring is cleaned */
|
|
|
|
|
|
+ /* Cause software interrupt to ensure Rx ring is cleaned */
|
|
if (adapter->msix_entries) {
|
|
if (adapter->msix_entries) {
|
|
u32 eics = 0;
|
|
u32 eics = 0;
|
|
for (i = 0; i < adapter->num_q_vectors; i++)
|
|
for (i = 0; i < adapter->num_q_vectors; i++)
|
|
@@ -4030,20 +4033,20 @@ enum latency_range {
|
|
};
|
|
};
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_update_ring_itr - update the dynamic ITR value based on packet size
|
|
|
|
|
|
+ * igb_update_ring_itr - update the dynamic ITR value based on packet size
|
|
|
|
+ * @q_vector: pointer to q_vector
|
|
*
|
|
*
|
|
- * Stores a new ITR value based on strictly on packet size. This
|
|
|
|
- * algorithm is less sophisticated than that used in igb_update_itr,
|
|
|
|
- * due to the difficulty of synchronizing statistics across multiple
|
|
|
|
- * receive rings. The divisors and thresholds used by this function
|
|
|
|
- * were determined based on theoretical maximum wire speed and testing
|
|
|
|
- * data, in order to minimize response time while increasing bulk
|
|
|
|
- * throughput.
|
|
|
|
- * This functionality is controlled by the InterruptThrottleRate module
|
|
|
|
- * parameter (see igb_param.c)
|
|
|
|
- * NOTE: This function is called only when operating in a multiqueue
|
|
|
|
- * receive environment.
|
|
|
|
- * @q_vector: pointer to q_vector
|
|
|
|
|
|
+ * Stores a new ITR value based on strictly on packet size. This
|
|
|
|
+ * algorithm is less sophisticated than that used in igb_update_itr,
|
|
|
|
+ * due to the difficulty of synchronizing statistics across multiple
|
|
|
|
+ * receive rings. The divisors and thresholds used by this function
|
|
|
|
+ * were determined based on theoretical maximum wire speed and testing
|
|
|
|
+ * data, in order to minimize response time while increasing bulk
|
|
|
|
+ * throughput.
|
|
|
|
+ * This functionality is controlled by the InterruptThrottleRate module
|
|
|
|
+ * parameter (see igb_param.c)
|
|
|
|
+ * NOTE: This function is called only when operating in a multiqueue
|
|
|
|
+ * receive environment.
|
|
**/
|
|
**/
|
|
static void igb_update_ring_itr(struct igb_q_vector *q_vector)
|
|
static void igb_update_ring_itr(struct igb_q_vector *q_vector)
|
|
{
|
|
{
|
|
@@ -4104,20 +4107,21 @@ clear_counts:
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_update_itr - update the dynamic ITR value based on statistics
|
|
|
|
- * Stores a new ITR value based on packets and byte
|
|
|
|
- * counts during the last interrupt. The advantage of per interrupt
|
|
|
|
- * computation is faster updates and more accurate ITR for the current
|
|
|
|
- * traffic pattern. Constants in this function were computed
|
|
|
|
- * based on theoretical maximum wire speed and thresholds were set based
|
|
|
|
- * on testing data as well as attempting to minimize response time
|
|
|
|
- * while increasing bulk throughput.
|
|
|
|
- * this functionality is controlled by the InterruptThrottleRate module
|
|
|
|
- * parameter (see igb_param.c)
|
|
|
|
- * NOTE: These calculations are only valid when operating in a single-
|
|
|
|
- * queue environment.
|
|
|
|
- * @q_vector: pointer to q_vector
|
|
|
|
- * @ring_container: ring info to update the itr for
|
|
|
|
|
|
+ * igb_update_itr - update the dynamic ITR value based on statistics
|
|
|
|
+ * @q_vector: pointer to q_vector
|
|
|
|
+ * @ring_container: ring info to update the itr for
|
|
|
|
+ *
|
|
|
|
+ * Stores a new ITR value based on packets and byte
|
|
|
|
+ * counts during the last interrupt. The advantage of per interrupt
|
|
|
|
+ * computation is faster updates and more accurate ITR for the current
|
|
|
|
+ * traffic pattern. Constants in this function were computed
|
|
|
|
+ * based on theoretical maximum wire speed and thresholds were set based
|
|
|
|
+ * on testing data as well as attempting to minimize response time
|
|
|
|
+ * while increasing bulk throughput.
|
|
|
|
+ * this functionality is controlled by the InterruptThrottleRate module
|
|
|
|
+ * parameter (see igb_param.c)
|
|
|
|
+ * NOTE: These calculations are only valid when operating in a single-
|
|
|
|
+ * queue environment.
|
|
**/
|
|
**/
|
|
static void igb_update_itr(struct igb_q_vector *q_vector,
|
|
static void igb_update_itr(struct igb_q_vector *q_vector,
|
|
struct igb_ring_container *ring_container)
|
|
struct igb_ring_container *ring_container)
|
|
@@ -4215,12 +4219,12 @@ set_itr_now:
|
|
if (new_itr != q_vector->itr_val) {
|
|
if (new_itr != q_vector->itr_val) {
|
|
/* this attempts to bias the interrupt rate towards Bulk
|
|
/* this attempts to bias the interrupt rate towards Bulk
|
|
* by adding intermediate steps when interrupt rate is
|
|
* by adding intermediate steps when interrupt rate is
|
|
- * increasing */
|
|
|
|
|
|
+ * increasing
|
|
|
|
+ */
|
|
new_itr = new_itr > q_vector->itr_val ?
|
|
new_itr = new_itr > q_vector->itr_val ?
|
|
- max((new_itr * q_vector->itr_val) /
|
|
|
|
- (new_itr + (q_vector->itr_val >> 2)),
|
|
|
|
- new_itr) :
|
|
|
|
- new_itr;
|
|
|
|
|
|
+ max((new_itr * q_vector->itr_val) /
|
|
|
|
+ (new_itr + (q_vector->itr_val >> 2)),
|
|
|
|
+ new_itr) : new_itr;
|
|
/* Don't write the value here; it resets the adapter's
|
|
/* Don't write the value here; it resets the adapter's
|
|
* internal timer, and causes us to delay far longer than
|
|
* internal timer, and causes us to delay far longer than
|
|
* we should between interrupts. Instead, we write the ITR
|
|
* we should between interrupts. Instead, we write the ITR
|
|
@@ -4347,8 +4351,8 @@ static void igb_tx_csum(struct igb_ring *tx_ring, struct igb_tx_buffer *first)
|
|
default:
|
|
default:
|
|
if (unlikely(net_ratelimit())) {
|
|
if (unlikely(net_ratelimit())) {
|
|
dev_warn(tx_ring->dev,
|
|
dev_warn(tx_ring->dev,
|
|
- "partial checksum but proto=%x!\n",
|
|
|
|
- first->protocol);
|
|
|
|
|
|
+ "partial checksum but proto=%x!\n",
|
|
|
|
+ first->protocol);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -4371,8 +4375,8 @@ static void igb_tx_csum(struct igb_ring *tx_ring, struct igb_tx_buffer *first)
|
|
default:
|
|
default:
|
|
if (unlikely(net_ratelimit())) {
|
|
if (unlikely(net_ratelimit())) {
|
|
dev_warn(tx_ring->dev,
|
|
dev_warn(tx_ring->dev,
|
|
- "partial checksum but l4 proto=%x!\n",
|
|
|
|
- l4_hdr);
|
|
|
|
|
|
+ "partial checksum but l4 proto=%x!\n",
|
|
|
|
+ l4_hdr);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -4524,8 +4528,7 @@ static void igb_tx_map(struct igb_ring *tx_ring,
|
|
/* set the timestamp */
|
|
/* set the timestamp */
|
|
first->time_stamp = jiffies;
|
|
first->time_stamp = jiffies;
|
|
|
|
|
|
- /*
|
|
|
|
- * Force memory writes to complete before letting h/w know there
|
|
|
|
|
|
+ /* Force memory writes to complete before letting h/w know there
|
|
* are new descriptors to fetch. (Only applicable for weak-ordered
|
|
* are new descriptors to fetch. (Only applicable for weak-ordered
|
|
* memory model archs, such as IA-64).
|
|
* memory model archs, such as IA-64).
|
|
*
|
|
*
|
|
@@ -4546,7 +4549,8 @@ static void igb_tx_map(struct igb_ring *tx_ring,
|
|
writel(i, tx_ring->tail);
|
|
writel(i, tx_ring->tail);
|
|
|
|
|
|
/* we need this if more than one processor can write to our tail
|
|
/* we need this if more than one processor can write to our tail
|
|
- * at a time, it syncronizes IO on IA64/Altix systems */
|
|
|
|
|
|
+ * at a time, it synchronizes IO on IA64/Altix systems
|
|
|
|
+ */
|
|
mmiowb();
|
|
mmiowb();
|
|
|
|
|
|
return;
|
|
return;
|
|
@@ -4576,11 +4580,13 @@ static int __igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size)
|
|
|
|
|
|
/* Herbert's original patch had:
|
|
/* Herbert's original patch had:
|
|
* smp_mb__after_netif_stop_queue();
|
|
* smp_mb__after_netif_stop_queue();
|
|
- * but since that doesn't exist yet, just open code it. */
|
|
|
|
|
|
+ * but since that doesn't exist yet, just open code it.
|
|
|
|
+ */
|
|
smp_mb();
|
|
smp_mb();
|
|
|
|
|
|
/* We need to check again in a case another CPU has just
|
|
/* We need to check again in a case another CPU has just
|
|
- * made room available. */
|
|
|
|
|
|
+ * made room available.
|
|
|
|
+ */
|
|
if (igb_desc_unused(tx_ring) < size)
|
|
if (igb_desc_unused(tx_ring) < size)
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
|
|
|
|
@@ -4706,8 +4712,7 @@ static netdev_tx_t igb_xmit_frame(struct sk_buff *skb,
|
|
return NETDEV_TX_OK;
|
|
return NETDEV_TX_OK;
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- * The minimum packet size with TCTL.PSP set is 17 so pad the skb
|
|
|
|
|
|
+ /* The minimum packet size with TCTL.PSP set is 17 so pad the skb
|
|
* in order to meet this minimum size requirement.
|
|
* in order to meet this minimum size requirement.
|
|
*/
|
|
*/
|
|
if (unlikely(skb->len < 17)) {
|
|
if (unlikely(skb->len < 17)) {
|
|
@@ -4721,8 +4726,8 @@ static netdev_tx_t igb_xmit_frame(struct sk_buff *skb,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_tx_timeout - Respond to a Tx Hang
|
|
|
|
- * @netdev: network interface device structure
|
|
|
|
|
|
+ * igb_tx_timeout - Respond to a Tx Hang
|
|
|
|
+ * @netdev: network interface device structure
|
|
**/
|
|
**/
|
|
static void igb_tx_timeout(struct net_device *netdev)
|
|
static void igb_tx_timeout(struct net_device *netdev)
|
|
{
|
|
{
|
|
@@ -4751,13 +4756,12 @@ static void igb_reset_task(struct work_struct *work)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_get_stats64 - Get System Network Statistics
|
|
|
|
- * @netdev: network interface device structure
|
|
|
|
- * @stats: rtnl_link_stats64 pointer
|
|
|
|
- *
|
|
|
|
|
|
+ * igb_get_stats64 - Get System Network Statistics
|
|
|
|
+ * @netdev: network interface device structure
|
|
|
|
+ * @stats: rtnl_link_stats64 pointer
|
|
**/
|
|
**/
|
|
static struct rtnl_link_stats64 *igb_get_stats64(struct net_device *netdev,
|
|
static struct rtnl_link_stats64 *igb_get_stats64(struct net_device *netdev,
|
|
- struct rtnl_link_stats64 *stats)
|
|
|
|
|
|
+ struct rtnl_link_stats64 *stats)
|
|
{
|
|
{
|
|
struct igb_adapter *adapter = netdev_priv(netdev);
|
|
struct igb_adapter *adapter = netdev_priv(netdev);
|
|
|
|
|
|
@@ -4770,11 +4774,11 @@ static struct rtnl_link_stats64 *igb_get_stats64(struct net_device *netdev,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_change_mtu - Change the Maximum Transfer Unit
|
|
|
|
- * @netdev: network interface device structure
|
|
|
|
- * @new_mtu: new value for maximum frame size
|
|
|
|
|
|
+ * igb_change_mtu - Change the Maximum Transfer Unit
|
|
|
|
+ * @netdev: network interface device structure
|
|
|
|
+ * @new_mtu: new value for maximum frame size
|
|
*
|
|
*
|
|
- * Returns 0 on success, negative on failure
|
|
|
|
|
|
+ * Returns 0 on success, negative on failure
|
|
**/
|
|
**/
|
|
static int igb_change_mtu(struct net_device *netdev, int new_mtu)
|
|
static int igb_change_mtu(struct net_device *netdev, int new_mtu)
|
|
{
|
|
{
|
|
@@ -4817,10 +4821,9 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_update_stats - Update the board statistics counters
|
|
|
|
- * @adapter: board private structure
|
|
|
|
|
|
+ * igb_update_stats - Update the board statistics counters
|
|
|
|
+ * @adapter: board private structure
|
|
**/
|
|
**/
|
|
-
|
|
|
|
void igb_update_stats(struct igb_adapter *adapter,
|
|
void igb_update_stats(struct igb_adapter *adapter,
|
|
struct rtnl_link_stats64 *net_stats)
|
|
struct rtnl_link_stats64 *net_stats)
|
|
{
|
|
{
|
|
@@ -4835,8 +4838,7 @@ void igb_update_stats(struct igb_adapter *adapter,
|
|
|
|
|
|
#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
|
|
#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
|
|
|
|
|
|
- /*
|
|
|
|
- * Prevent stats update while adapter is being reset, or if the pci
|
|
|
|
|
|
+ /* Prevent stats update while adapter is being reset, or if the pci
|
|
* connection is down.
|
|
* connection is down.
|
|
*/
|
|
*/
|
|
if (adapter->link_speed == 0)
|
|
if (adapter->link_speed == 0)
|
|
@@ -4970,7 +4972,8 @@ void igb_update_stats(struct igb_adapter *adapter,
|
|
/* Rx Errors */
|
|
/* Rx Errors */
|
|
|
|
|
|
/* RLEC on some newer hardware can be incorrect so build
|
|
/* RLEC on some newer hardware can be incorrect so build
|
|
- * our own version based on RUC and ROC */
|
|
|
|
|
|
+ * our own version based on RUC and ROC
|
|
|
|
+ */
|
|
net_stats->rx_errors = adapter->stats.rxerrc +
|
|
net_stats->rx_errors = adapter->stats.rxerrc +
|
|
adapter->stats.crcerrs + adapter->stats.algnerrc +
|
|
adapter->stats.crcerrs + adapter->stats.algnerrc +
|
|
adapter->stats.ruc + adapter->stats.roc +
|
|
adapter->stats.ruc + adapter->stats.roc +
|
|
@@ -5029,7 +5032,8 @@ static irqreturn_t igb_msix_other(int irq, void *data)
|
|
adapter->stats.doosync++;
|
|
adapter->stats.doosync++;
|
|
/* The DMA Out of Sync is also indication of a spoof event
|
|
/* The DMA Out of Sync is also indication of a spoof event
|
|
* in IOV mode. Check the Wrong VM Behavior register to
|
|
* in IOV mode. Check the Wrong VM Behavior register to
|
|
- * see if it is really a spoof event. */
|
|
|
|
|
|
+ * see if it is really a spoof event.
|
|
|
|
+ */
|
|
igb_check_wvbr(adapter);
|
|
igb_check_wvbr(adapter);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -5103,8 +5107,7 @@ static void igb_update_tx_dca(struct igb_adapter *adapter,
|
|
if (hw->mac.type != e1000_82575)
|
|
if (hw->mac.type != e1000_82575)
|
|
txctrl <<= E1000_DCA_TXCTRL_CPUID_SHIFT;
|
|
txctrl <<= E1000_DCA_TXCTRL_CPUID_SHIFT;
|
|
|
|
|
|
- /*
|
|
|
|
- * We can enable relaxed ordering for reads, but not writes when
|
|
|
|
|
|
+ /* We can enable relaxed ordering for reads, but not writes when
|
|
* DCA is enabled. This is due to a known issue in some chipsets
|
|
* DCA is enabled. This is due to a known issue in some chipsets
|
|
* which will cause the DCA tag to be cleared.
|
|
* which will cause the DCA tag to be cleared.
|
|
*/
|
|
*/
|
|
@@ -5125,8 +5128,7 @@ static void igb_update_rx_dca(struct igb_adapter *adapter,
|
|
if (hw->mac.type != e1000_82575)
|
|
if (hw->mac.type != e1000_82575)
|
|
rxctrl <<= E1000_DCA_RXCTRL_CPUID_SHIFT;
|
|
rxctrl <<= E1000_DCA_RXCTRL_CPUID_SHIFT;
|
|
|
|
|
|
- /*
|
|
|
|
- * We can enable relaxed ordering for reads, but not writes when
|
|
|
|
|
|
+ /* We can enable relaxed ordering for reads, but not writes when
|
|
* DCA is enabled. This is due to a known issue in some chipsets
|
|
* DCA is enabled. This is due to a known issue in some chipsets
|
|
* which will cause the DCA tag to be cleared.
|
|
* which will cause the DCA tag to be cleared.
|
|
*/
|
|
*/
|
|
@@ -5195,7 +5197,8 @@ static int __igb_notify_dca(struct device *dev, void *data)
|
|
case DCA_PROVIDER_REMOVE:
|
|
case DCA_PROVIDER_REMOVE:
|
|
if (adapter->flags & IGB_FLAG_DCA_ENABLED) {
|
|
if (adapter->flags & IGB_FLAG_DCA_ENABLED) {
|
|
/* without this a class_device is left
|
|
/* without this a class_device is left
|
|
- * hanging around in the sysfs model */
|
|
|
|
|
|
+ * hanging around in the sysfs model
|
|
|
|
+ */
|
|
dca_remove_requester(dev);
|
|
dca_remove_requester(dev);
|
|
dev_info(&pdev->dev, "DCA disabled\n");
|
|
dev_info(&pdev->dev, "DCA disabled\n");
|
|
adapter->flags &= ~IGB_FLAG_DCA_ENABLED;
|
|
adapter->flags &= ~IGB_FLAG_DCA_ENABLED;
|
|
@@ -5208,12 +5211,12 @@ static int __igb_notify_dca(struct device *dev, void *data)
|
|
}
|
|
}
|
|
|
|
|
|
static int igb_notify_dca(struct notifier_block *nb, unsigned long event,
|
|
static int igb_notify_dca(struct notifier_block *nb, unsigned long event,
|
|
- void *p)
|
|
|
|
|
|
+ void *p)
|
|
{
|
|
{
|
|
int ret_val;
|
|
int ret_val;
|
|
|
|
|
|
ret_val = driver_for_each_device(&igb_driver.driver, NULL, &event,
|
|
ret_val = driver_for_each_device(&igb_driver.driver, NULL, &event,
|
|
- __igb_notify_dca);
|
|
|
|
|
|
+ __igb_notify_dca);
|
|
|
|
|
|
return ret_val ? NOTIFY_BAD : NOTIFY_DONE;
|
|
return ret_val ? NOTIFY_BAD : NOTIFY_DONE;
|
|
}
|
|
}
|
|
@@ -5285,7 +5288,7 @@ static int igb_set_vf_promisc(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
|
|
struct vf_data_storage *vf_data = &adapter->vf_data[vf];
|
|
struct vf_data_storage *vf_data = &adapter->vf_data[vf];
|
|
|
|
|
|
vf_data->flags &= ~(IGB_VF_FLAG_UNI_PROMISC |
|
|
vf_data->flags &= ~(IGB_VF_FLAG_UNI_PROMISC |
|
|
- IGB_VF_FLAG_MULTI_PROMISC);
|
|
|
|
|
|
+ IGB_VF_FLAG_MULTI_PROMISC);
|
|
vmolr &= ~(E1000_VMOLR_ROPE | E1000_VMOLR_ROMPE | E1000_VMOLR_MPME);
|
|
vmolr &= ~(E1000_VMOLR_ROPE | E1000_VMOLR_ROMPE | E1000_VMOLR_MPME);
|
|
|
|
|
|
if (*msgbuf & E1000_VF_SET_PROMISC_MULTICAST) {
|
|
if (*msgbuf & E1000_VF_SET_PROMISC_MULTICAST) {
|
|
@@ -5293,8 +5296,7 @@ static int igb_set_vf_promisc(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
|
|
vf_data->flags |= IGB_VF_FLAG_MULTI_PROMISC;
|
|
vf_data->flags |= IGB_VF_FLAG_MULTI_PROMISC;
|
|
*msgbuf &= ~E1000_VF_SET_PROMISC_MULTICAST;
|
|
*msgbuf &= ~E1000_VF_SET_PROMISC_MULTICAST;
|
|
} else {
|
|
} else {
|
|
- /*
|
|
|
|
- * if we have hashes and we are clearing a multicast promisc
|
|
|
|
|
|
+ /* if we have hashes and we are clearing a multicast promisc
|
|
* flag we need to write the hashes to the MTA as this step
|
|
* flag we need to write the hashes to the MTA as this step
|
|
* was previously skipped
|
|
* was previously skipped
|
|
*/
|
|
*/
|
|
@@ -5315,7 +5317,6 @@ static int igb_set_vf_promisc(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static int igb_set_vf_multicasts(struct igb_adapter *adapter,
|
|
static int igb_set_vf_multicasts(struct igb_adapter *adapter,
|
|
@@ -5522,22 +5523,20 @@ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
|
|
"Setting VLAN %d, QOS 0x%x on VF %d\n", vlan, qos, vf);
|
|
"Setting VLAN %d, QOS 0x%x on VF %d\n", vlan, qos, vf);
|
|
if (test_bit(__IGB_DOWN, &adapter->state)) {
|
|
if (test_bit(__IGB_DOWN, &adapter->state)) {
|
|
dev_warn(&adapter->pdev->dev,
|
|
dev_warn(&adapter->pdev->dev,
|
|
- "The VF VLAN has been set,"
|
|
|
|
- " but the PF device is not up.\n");
|
|
|
|
|
|
+ "The VF VLAN has been set, but the PF device is not up.\n");
|
|
dev_warn(&adapter->pdev->dev,
|
|
dev_warn(&adapter->pdev->dev,
|
|
- "Bring the PF device up before"
|
|
|
|
- " attempting to use the VF device.\n");
|
|
|
|
|
|
+ "Bring the PF device up before attempting to use the VF device.\n");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
igb_vlvf_set(adapter, adapter->vf_data[vf].pf_vlan,
|
|
igb_vlvf_set(adapter, adapter->vf_data[vf].pf_vlan,
|
|
- false, vf);
|
|
|
|
|
|
+ false, vf);
|
|
igb_set_vmvir(adapter, vlan, vf);
|
|
igb_set_vmvir(adapter, vlan, vf);
|
|
igb_set_vmolr(adapter, vf, true);
|
|
igb_set_vmolr(adapter, vf, true);
|
|
adapter->vf_data[vf].pf_vlan = 0;
|
|
adapter->vf_data[vf].pf_vlan = 0;
|
|
adapter->vf_data[vf].pf_qos = 0;
|
|
adapter->vf_data[vf].pf_qos = 0;
|
|
- }
|
|
|
|
|
|
+ }
|
|
out:
|
|
out:
|
|
- return err;
|
|
|
|
|
|
+ return err;
|
|
}
|
|
}
|
|
|
|
|
|
static int igb_set_vf_vlan(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
|
|
static int igb_set_vf_vlan(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
|
|
@@ -5615,8 +5614,7 @@ static void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
|
|
|
|
|
|
static int igb_set_vf_mac_addr(struct igb_adapter *adapter, u32 *msg, int vf)
|
|
static int igb_set_vf_mac_addr(struct igb_adapter *adapter, u32 *msg, int vf)
|
|
{
|
|
{
|
|
- /*
|
|
|
|
- * The VF MAC Address is stored in a packed array of bytes
|
|
|
|
|
|
+ /* The VF MAC Address is stored in a packed array of bytes
|
|
* starting at the second 32 bit word of the msg array
|
|
* starting at the second 32 bit word of the msg array
|
|
*/
|
|
*/
|
|
unsigned char *addr = (char *)&msg[1];
|
|
unsigned char *addr = (char *)&msg[1];
|
|
@@ -5665,11 +5663,9 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
|
|
if (msgbuf[0] & (E1000_VT_MSGTYPE_ACK | E1000_VT_MSGTYPE_NACK))
|
|
if (msgbuf[0] & (E1000_VT_MSGTYPE_ACK | E1000_VT_MSGTYPE_NACK))
|
|
return;
|
|
return;
|
|
|
|
|
|
- /*
|
|
|
|
- * until the vf completes a reset it should not be
|
|
|
|
|
|
+ /* until the vf completes a reset it should not be
|
|
* allowed to start any configuration.
|
|
* allowed to start any configuration.
|
|
*/
|
|
*/
|
|
-
|
|
|
|
if (msgbuf[0] == E1000_VF_RESET) {
|
|
if (msgbuf[0] == E1000_VF_RESET) {
|
|
igb_vf_reset_msg(adapter, vf);
|
|
igb_vf_reset_msg(adapter, vf);
|
|
return;
|
|
return;
|
|
@@ -5689,9 +5685,8 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
|
|
retval = igb_set_vf_mac_addr(adapter, msgbuf, vf);
|
|
retval = igb_set_vf_mac_addr(adapter, msgbuf, vf);
|
|
else
|
|
else
|
|
dev_warn(&pdev->dev,
|
|
dev_warn(&pdev->dev,
|
|
- "VF %d attempted to override administratively "
|
|
|
|
- "set MAC address\nReload the VF driver to "
|
|
|
|
- "resume operations\n", vf);
|
|
|
|
|
|
+ "VF %d attempted to override administratively set MAC address\nReload the VF driver to resume operations\n",
|
|
|
|
+ vf);
|
|
break;
|
|
break;
|
|
case E1000_VF_SET_PROMISC:
|
|
case E1000_VF_SET_PROMISC:
|
|
retval = igb_set_vf_promisc(adapter, msgbuf, vf);
|
|
retval = igb_set_vf_promisc(adapter, msgbuf, vf);
|
|
@@ -5706,9 +5701,8 @@ static void igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
|
|
retval = -1;
|
|
retval = -1;
|
|
if (vf_data->pf_vlan)
|
|
if (vf_data->pf_vlan)
|
|
dev_warn(&pdev->dev,
|
|
dev_warn(&pdev->dev,
|
|
- "VF %d attempted to override administratively "
|
|
|
|
- "set VLAN tag\nReload the VF driver to "
|
|
|
|
- "resume operations\n", vf);
|
|
|
|
|
|
+ "VF %d attempted to override administratively set VLAN tag\nReload the VF driver to resume operations\n",
|
|
|
|
+ vf);
|
|
else
|
|
else
|
|
retval = igb_set_vf_vlan(adapter, msgbuf, vf);
|
|
retval = igb_set_vf_vlan(adapter, msgbuf, vf);
|
|
break;
|
|
break;
|
|
@@ -5777,9 +5771,9 @@ static void igb_set_uta(struct igb_adapter *adapter)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_intr_msi - Interrupt Handler
|
|
|
|
- * @irq: interrupt number
|
|
|
|
- * @data: pointer to a network interface device structure
|
|
|
|
|
|
+ * igb_intr_msi - Interrupt Handler
|
|
|
|
+ * @irq: interrupt number
|
|
|
|
+ * @data: pointer to a network interface device structure
|
|
**/
|
|
**/
|
|
static irqreturn_t igb_intr_msi(int irq, void *data)
|
|
static irqreturn_t igb_intr_msi(int irq, void *data)
|
|
{
|
|
{
|
|
@@ -5822,9 +5816,9 @@ static irqreturn_t igb_intr_msi(int irq, void *data)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_intr - Legacy Interrupt Handler
|
|
|
|
- * @irq: interrupt number
|
|
|
|
- * @data: pointer to a network interface device structure
|
|
|
|
|
|
+ * igb_intr - Legacy Interrupt Handler
|
|
|
|
+ * @irq: interrupt number
|
|
|
|
+ * @data: pointer to a network interface device structure
|
|
**/
|
|
**/
|
|
static irqreturn_t igb_intr(int irq, void *data)
|
|
static irqreturn_t igb_intr(int irq, void *data)
|
|
{
|
|
{
|
|
@@ -5832,11 +5826,13 @@ static irqreturn_t igb_intr(int irq, void *data)
|
|
struct igb_q_vector *q_vector = adapter->q_vector[0];
|
|
struct igb_q_vector *q_vector = adapter->q_vector[0];
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
/* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No
|
|
/* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No
|
|
- * need for the IMC write */
|
|
|
|
|
|
+ * need for the IMC write
|
|
|
|
+ */
|
|
u32 icr = rd32(E1000_ICR);
|
|
u32 icr = rd32(E1000_ICR);
|
|
|
|
|
|
/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
|
|
/* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
|
|
- * not set, then the adapter didn't send an interrupt */
|
|
|
|
|
|
+ * not set, then the adapter didn't send an interrupt
|
|
|
|
+ */
|
|
if (!(icr & E1000_ICR_INT_ASSERTED))
|
|
if (!(icr & E1000_ICR_INT_ASSERTED))
|
|
return IRQ_NONE;
|
|
return IRQ_NONE;
|
|
|
|
|
|
@@ -5895,15 +5891,15 @@ static void igb_ring_irq_enable(struct igb_q_vector *q_vector)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_poll - NAPI Rx polling callback
|
|
|
|
- * @napi: napi polling structure
|
|
|
|
- * @budget: count of how many packets we should handle
|
|
|
|
|
|
+ * igb_poll - NAPI Rx polling callback
|
|
|
|
+ * @napi: napi polling structure
|
|
|
|
+ * @budget: count of how many packets we should handle
|
|
**/
|
|
**/
|
|
static int igb_poll(struct napi_struct *napi, int budget)
|
|
static int igb_poll(struct napi_struct *napi, int budget)
|
|
{
|
|
{
|
|
struct igb_q_vector *q_vector = container_of(napi,
|
|
struct igb_q_vector *q_vector = container_of(napi,
|
|
- struct igb_q_vector,
|
|
|
|
- napi);
|
|
|
|
|
|
+ struct igb_q_vector,
|
|
|
|
+ napi);
|
|
bool clean_complete = true;
|
|
bool clean_complete = true;
|
|
|
|
|
|
#ifdef CONFIG_IGB_DCA
|
|
#ifdef CONFIG_IGB_DCA
|
|
@@ -5928,10 +5924,10 @@ static int igb_poll(struct napi_struct *napi, int budget)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_clean_tx_irq - Reclaim resources after transmit completes
|
|
|
|
- * @q_vector: pointer to q_vector containing needed info
|
|
|
|
|
|
+ * igb_clean_tx_irq - Reclaim resources after transmit completes
|
|
|
|
+ * @q_vector: pointer to q_vector containing needed info
|
|
*
|
|
*
|
|
- * returns true if ring is completely cleaned
|
|
|
|
|
|
+ * returns true if ring is completely cleaned
|
|
**/
|
|
**/
|
|
static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
|
|
static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
|
|
{
|
|
{
|
|
@@ -6037,7 +6033,8 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
|
|
|
|
/* Detect a transmit hang in hardware, this serializes the
|
|
/* Detect a transmit hang in hardware, this serializes the
|
|
- * check with the clearing of time_stamp and movement of i */
|
|
|
|
|
|
+ * check with the clearing of time_stamp and movement of i
|
|
|
|
+ */
|
|
clear_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);
|
|
clear_bit(IGB_RING_FLAG_TX_DETECT_HANG, &tx_ring->flags);
|
|
if (tx_buffer->next_to_watch &&
|
|
if (tx_buffer->next_to_watch &&
|
|
time_after(jiffies, tx_buffer->time_stamp +
|
|
time_after(jiffies, tx_buffer->time_stamp +
|
|
@@ -6076,8 +6073,8 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
|
|
|
|
|
|
#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
|
|
#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
|
|
if (unlikely(total_packets &&
|
|
if (unlikely(total_packets &&
|
|
- netif_carrier_ok(tx_ring->netdev) &&
|
|
|
|
- igb_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD)) {
|
|
|
|
|
|
+ netif_carrier_ok(tx_ring->netdev) &&
|
|
|
|
+ igb_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD)) {
|
|
/* Make sure that anybody stopping the queue after this
|
|
/* Make sure that anybody stopping the queue after this
|
|
* sees the new next_to_clean.
|
|
* sees the new next_to_clean.
|
|
*/
|
|
*/
|
|
@@ -6098,11 +6095,11 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_reuse_rx_page - page flip buffer and store it back on the ring
|
|
|
|
- * @rx_ring: rx descriptor ring to store buffers on
|
|
|
|
- * @old_buff: donor buffer to have page reused
|
|
|
|
|
|
+ * igb_reuse_rx_page - page flip buffer and store it back on the ring
|
|
|
|
+ * @rx_ring: rx descriptor ring to store buffers on
|
|
|
|
+ * @old_buff: donor buffer to have page reused
|
|
*
|
|
*
|
|
- * Synchronizes page for reuse by the adapter
|
|
|
|
|
|
+ * Synchronizes page for reuse by the adapter
|
|
**/
|
|
**/
|
|
static void igb_reuse_rx_page(struct igb_ring *rx_ring,
|
|
static void igb_reuse_rx_page(struct igb_ring *rx_ring,
|
|
struct igb_rx_buffer *old_buff)
|
|
struct igb_rx_buffer *old_buff)
|
|
@@ -6162,19 +6159,19 @@ static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_add_rx_frag - Add contents of Rx buffer to sk_buff
|
|
|
|
- * @rx_ring: rx descriptor ring to transact packets on
|
|
|
|
- * @rx_buffer: buffer containing page to add
|
|
|
|
- * @rx_desc: descriptor containing length of buffer written by hardware
|
|
|
|
- * @skb: sk_buff to place the data into
|
|
|
|
|
|
+ * igb_add_rx_frag - Add contents of Rx buffer to sk_buff
|
|
|
|
+ * @rx_ring: rx descriptor ring to transact packets on
|
|
|
|
+ * @rx_buffer: buffer containing page to add
|
|
|
|
+ * @rx_desc: descriptor containing length of buffer written by hardware
|
|
|
|
+ * @skb: sk_buff to place the data into
|
|
*
|
|
*
|
|
- * This function will add the data contained in rx_buffer->page to the skb.
|
|
|
|
- * This is done either through a direct copy if the data in the buffer is
|
|
|
|
- * less than the skb header size, otherwise it will just attach the page as
|
|
|
|
- * a frag to the skb.
|
|
|
|
|
|
+ * This function will add the data contained in rx_buffer->page to the skb.
|
|
|
|
+ * This is done either through a direct copy if the data in the buffer is
|
|
|
|
+ * less than the skb header size, otherwise it will just attach the page as
|
|
|
|
+ * a frag to the skb.
|
|
*
|
|
*
|
|
- * The function will then update the page offset if necessary and return
|
|
|
|
- * true if the buffer can be reused by the adapter.
|
|
|
|
|
|
+ * The function will then update the page offset if necessary and return
|
|
|
|
+ * true if the buffer can be reused by the adapter.
|
|
**/
|
|
**/
|
|
static bool igb_add_rx_frag(struct igb_ring *rx_ring,
|
|
static bool igb_add_rx_frag(struct igb_ring *rx_ring,
|
|
struct igb_rx_buffer *rx_buffer,
|
|
struct igb_rx_buffer *rx_buffer,
|
|
@@ -6317,8 +6314,7 @@ static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring,
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- * we will be copying header into skb->data in
|
|
|
|
|
|
+ /* we will be copying header into skb->data in
|
|
* pskb_may_pull so it is in our interest to prefetch
|
|
* pskb_may_pull so it is in our interest to prefetch
|
|
* it now to avoid a possible cache miss
|
|
* it now to avoid a possible cache miss
|
|
*/
|
|
*/
|
|
@@ -6366,8 +6362,7 @@ static inline void igb_rx_checksum(struct igb_ring *ring,
|
|
if (igb_test_staterr(rx_desc,
|
|
if (igb_test_staterr(rx_desc,
|
|
E1000_RXDEXT_STATERR_TCPE |
|
|
E1000_RXDEXT_STATERR_TCPE |
|
|
E1000_RXDEXT_STATERR_IPE)) {
|
|
E1000_RXDEXT_STATERR_IPE)) {
|
|
- /*
|
|
|
|
- * work around errata with sctp packets where the TCPE aka
|
|
|
|
|
|
+ /* work around errata with sctp packets where the TCPE aka
|
|
* L4E bit is set incorrectly on 64 byte (60 byte w/o crc)
|
|
* L4E bit is set incorrectly on 64 byte (60 byte w/o crc)
|
|
* packets, (aka let the stack check the crc32c)
|
|
* packets, (aka let the stack check the crc32c)
|
|
*/
|
|
*/
|
|
@@ -6398,15 +6393,15 @@ static inline void igb_rx_hash(struct igb_ring *ring,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_is_non_eop - process handling of non-EOP buffers
|
|
|
|
- * @rx_ring: Rx ring being processed
|
|
|
|
- * @rx_desc: Rx descriptor for current buffer
|
|
|
|
- * @skb: current socket buffer containing buffer in progress
|
|
|
|
|
|
+ * igb_is_non_eop - process handling of non-EOP buffers
|
|
|
|
+ * @rx_ring: Rx ring being processed
|
|
|
|
+ * @rx_desc: Rx descriptor for current buffer
|
|
|
|
+ * @skb: current socket buffer containing buffer in progress
|
|
*
|
|
*
|
|
- * This function updates next to clean. If the buffer is an EOP buffer
|
|
|
|
- * this function exits returning false, otherwise it will place the
|
|
|
|
- * sk_buff in the next buffer to be chained and return true indicating
|
|
|
|
- * that this is in fact a non-EOP buffer.
|
|
|
|
|
|
+ * This function updates next to clean. If the buffer is an EOP buffer
|
|
|
|
+ * this function exits returning false, otherwise it will place the
|
|
|
|
+ * sk_buff in the next buffer to be chained and return true indicating
|
|
|
|
+ * that this is in fact a non-EOP buffer.
|
|
**/
|
|
**/
|
|
static bool igb_is_non_eop(struct igb_ring *rx_ring,
|
|
static bool igb_is_non_eop(struct igb_ring *rx_ring,
|
|
union e1000_adv_rx_desc *rx_desc)
|
|
union e1000_adv_rx_desc *rx_desc)
|
|
@@ -6426,15 +6421,15 @@ static bool igb_is_non_eop(struct igb_ring *rx_ring,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_get_headlen - determine size of header for LRO/GRO
|
|
|
|
- * @data: pointer to the start of the headers
|
|
|
|
- * @max_len: total length of section to find headers in
|
|
|
|
|
|
+ * igb_get_headlen - determine size of header for LRO/GRO
|
|
|
|
+ * @data: pointer to the start of the headers
|
|
|
|
+ * @max_len: total length of section to find headers in
|
|
*
|
|
*
|
|
- * This function is meant to determine the length of headers that will
|
|
|
|
- * be recognized by hardware for LRO, and GRO offloads. The main
|
|
|
|
- * motivation of doing this is to only perform one pull for IPv4 TCP
|
|
|
|
- * packets so that we can do basic things like calculating the gso_size
|
|
|
|
- * based on the average data per packet.
|
|
|
|
|
|
+ * This function is meant to determine the length of headers that will
|
|
|
|
+ * be recognized by hardware for LRO, and GRO offloads. The main
|
|
|
|
+ * motivation of doing this is to only perform one pull for IPv4 TCP
|
|
|
|
+ * packets so that we can do basic things like calculating the gso_size
|
|
|
|
+ * based on the average data per packet.
|
|
**/
|
|
**/
|
|
static unsigned int igb_get_headlen(unsigned char *data,
|
|
static unsigned int igb_get_headlen(unsigned char *data,
|
|
unsigned int max_len)
|
|
unsigned int max_len)
|
|
@@ -6521,8 +6516,7 @@ static unsigned int igb_get_headlen(unsigned char *data,
|
|
hdr.network += sizeof(struct udphdr);
|
|
hdr.network += sizeof(struct udphdr);
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- * If everything has gone correctly hdr.network should be the
|
|
|
|
|
|
+ /* If everything has gone correctly hdr.network should be the
|
|
* data section of the packet and will be the end of the header.
|
|
* data section of the packet and will be the end of the header.
|
|
* If not then it probably represents the end of the last recognized
|
|
* If not then it probably represents the end of the last recognized
|
|
* header.
|
|
* header.
|
|
@@ -6534,17 +6528,17 @@ static unsigned int igb_get_headlen(unsigned char *data,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_pull_tail - igb specific version of skb_pull_tail
|
|
|
|
- * @rx_ring: rx descriptor ring packet is being transacted on
|
|
|
|
- * @rx_desc: pointer to the EOP Rx descriptor
|
|
|
|
- * @skb: pointer to current skb being adjusted
|
|
|
|
|
|
+ * igb_pull_tail - igb specific version of skb_pull_tail
|
|
|
|
+ * @rx_ring: rx descriptor ring packet is being transacted on
|
|
|
|
+ * @rx_desc: pointer to the EOP Rx descriptor
|
|
|
|
+ * @skb: pointer to current skb being adjusted
|
|
*
|
|
*
|
|
- * This function is an igb specific version of __pskb_pull_tail. The
|
|
|
|
- * main difference between this version and the original function is that
|
|
|
|
- * this function can make several assumptions about the state of things
|
|
|
|
- * that allow for significant optimizations versus the standard function.
|
|
|
|
- * As a result we can do things like drop a frag and maintain an accurate
|
|
|
|
- * truesize for the skb.
|
|
|
|
|
|
+ * This function is an igb specific version of __pskb_pull_tail. The
|
|
|
|
+ * main difference between this version and the original function is that
|
|
|
|
+ * this function can make several assumptions about the state of things
|
|
|
|
+ * that allow for significant optimizations versus the standard function.
|
|
|
|
+ * As a result we can do things like drop a frag and maintain an accurate
|
|
|
|
+ * truesize for the skb.
|
|
*/
|
|
*/
|
|
static void igb_pull_tail(struct igb_ring *rx_ring,
|
|
static void igb_pull_tail(struct igb_ring *rx_ring,
|
|
union e1000_adv_rx_desc *rx_desc,
|
|
union e1000_adv_rx_desc *rx_desc,
|
|
@@ -6554,8 +6548,7 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
|
|
unsigned char *va;
|
|
unsigned char *va;
|
|
unsigned int pull_len;
|
|
unsigned int pull_len;
|
|
|
|
|
|
- /*
|
|
|
|
- * it is valid to use page_address instead of kmap since we are
|
|
|
|
|
|
+ /* it is valid to use page_address instead of kmap since we are
|
|
* working with pages allocated out of the lomem pool per
|
|
* working with pages allocated out of the lomem pool per
|
|
* alloc_page(GFP_ATOMIC)
|
|
* alloc_page(GFP_ATOMIC)
|
|
*/
|
|
*/
|
|
@@ -6575,8 +6568,7 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
|
|
va += IGB_TS_HDR_LEN;
|
|
va += IGB_TS_HDR_LEN;
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- * we need the header to contain the greater of either ETH_HLEN or
|
|
|
|
|
|
+ /* we need the header to contain the greater of either ETH_HLEN or
|
|
* 60 bytes if the skb->len is less than 60 for skb_pad.
|
|
* 60 bytes if the skb->len is less than 60 for skb_pad.
|
|
*/
|
|
*/
|
|
pull_len = igb_get_headlen(va, IGB_RX_HDR_LEN);
|
|
pull_len = igb_get_headlen(va, IGB_RX_HDR_LEN);
|
|
@@ -6592,24 +6584,23 @@ static void igb_pull_tail(struct igb_ring *rx_ring,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_cleanup_headers - Correct corrupted or empty headers
|
|
|
|
- * @rx_ring: rx descriptor ring packet is being transacted on
|
|
|
|
- * @rx_desc: pointer to the EOP Rx descriptor
|
|
|
|
- * @skb: pointer to current skb being fixed
|
|
|
|
|
|
+ * igb_cleanup_headers - Correct corrupted or empty headers
|
|
|
|
+ * @rx_ring: rx descriptor ring packet is being transacted on
|
|
|
|
+ * @rx_desc: pointer to the EOP Rx descriptor
|
|
|
|
+ * @skb: pointer to current skb being fixed
|
|
*
|
|
*
|
|
- * Address the case where we are pulling data in on pages only
|
|
|
|
- * and as such no data is present in the skb header.
|
|
|
|
|
|
+ * Address the case where we are pulling data in on pages only
|
|
|
|
+ * and as such no data is present in the skb header.
|
|
*
|
|
*
|
|
- * In addition if skb is not at least 60 bytes we need to pad it so that
|
|
|
|
- * it is large enough to qualify as a valid Ethernet frame.
|
|
|
|
|
|
+ * In addition if skb is not at least 60 bytes we need to pad it so that
|
|
|
|
+ * it is large enough to qualify as a valid Ethernet frame.
|
|
*
|
|
*
|
|
- * Returns true if an error was encountered and skb was freed.
|
|
|
|
|
|
+ * Returns true if an error was encountered and skb was freed.
|
|
**/
|
|
**/
|
|
static bool igb_cleanup_headers(struct igb_ring *rx_ring,
|
|
static bool igb_cleanup_headers(struct igb_ring *rx_ring,
|
|
union e1000_adv_rx_desc *rx_desc,
|
|
union e1000_adv_rx_desc *rx_desc,
|
|
struct sk_buff *skb)
|
|
struct sk_buff *skb)
|
|
{
|
|
{
|
|
-
|
|
|
|
if (unlikely((igb_test_staterr(rx_desc,
|
|
if (unlikely((igb_test_staterr(rx_desc,
|
|
E1000_RXDEXT_ERR_FRAME_ERR_MASK)))) {
|
|
E1000_RXDEXT_ERR_FRAME_ERR_MASK)))) {
|
|
struct net_device *netdev = rx_ring->netdev;
|
|
struct net_device *netdev = rx_ring->netdev;
|
|
@@ -6636,14 +6627,14 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_process_skb_fields - Populate skb header fields from Rx descriptor
|
|
|
|
- * @rx_ring: rx descriptor ring packet is being transacted on
|
|
|
|
- * @rx_desc: pointer to the EOP Rx descriptor
|
|
|
|
- * @skb: pointer to current skb being populated
|
|
|
|
|
|
+ * igb_process_skb_fields - Populate skb header fields from Rx descriptor
|
|
|
|
+ * @rx_ring: rx descriptor ring packet is being transacted on
|
|
|
|
+ * @rx_desc: pointer to the EOP Rx descriptor
|
|
|
|
+ * @skb: pointer to current skb being populated
|
|
*
|
|
*
|
|
- * This function checks the ring, descriptor, and packet information in
|
|
|
|
- * order to populate the hash, checksum, VLAN, timestamp, protocol, and
|
|
|
|
- * other fields within the skb.
|
|
|
|
|
|
+ * This function checks the ring, descriptor, and packet information in
|
|
|
|
+ * order to populate the hash, checksum, VLAN, timestamp, protocol, and
|
|
|
|
+ * other fields within the skb.
|
|
**/
|
|
**/
|
|
static void igb_process_skb_fields(struct igb_ring *rx_ring,
|
|
static void igb_process_skb_fields(struct igb_ring *rx_ring,
|
|
union e1000_adv_rx_desc *rx_desc,
|
|
union e1000_adv_rx_desc *rx_desc,
|
|
@@ -6774,8 +6765,7 @@ static bool igb_alloc_mapped_page(struct igb_ring *rx_ring,
|
|
/* map page for use */
|
|
/* map page for use */
|
|
dma = dma_map_page(rx_ring->dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE);
|
|
dma = dma_map_page(rx_ring->dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE);
|
|
|
|
|
|
- /*
|
|
|
|
- * if mapping failed free memory back to system since
|
|
|
|
|
|
+ /* if mapping failed free memory back to system since
|
|
* there isn't much point in holding memory we can't use
|
|
* there isn't much point in holding memory we can't use
|
|
*/
|
|
*/
|
|
if (dma_mapping_error(rx_ring->dev, dma)) {
|
|
if (dma_mapping_error(rx_ring->dev, dma)) {
|
|
@@ -6801,8 +6791,8 @@ static inline unsigned int igb_rx_offset(struct igb_ring *rx_ring)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_alloc_rx_buffers - Replace used receive buffers; packet split
|
|
|
|
- * @adapter: address of board private structure
|
|
|
|
|
|
+ * igb_alloc_rx_buffers - Replace used receive buffers; packet split
|
|
|
|
+ * @adapter: address of board private structure
|
|
**/
|
|
**/
|
|
void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count)
|
|
void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count)
|
|
{
|
|
{
|
|
@@ -6822,8 +6812,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count)
|
|
if (!igb_alloc_mapped_page(rx_ring, bi))
|
|
if (!igb_alloc_mapped_page(rx_ring, bi))
|
|
break;
|
|
break;
|
|
|
|
|
|
- /*
|
|
|
|
- * Refresh the desc even if buffer_addrs didn't change
|
|
|
|
|
|
+ /* Refresh the desc even if buffer_addrs didn't change
|
|
* because each write-back erases this info.
|
|
* because each write-back erases this info.
|
|
*/
|
|
*/
|
|
rx_desc->read.pkt_addr = cpu_to_le64(bi->dma +
|
|
rx_desc->read.pkt_addr = cpu_to_le64(bi->dma +
|
|
@@ -6854,8 +6843,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count)
|
|
/* update next to alloc since we have filled the ring */
|
|
/* update next to alloc since we have filled the ring */
|
|
rx_ring->next_to_alloc = i;
|
|
rx_ring->next_to_alloc = i;
|
|
|
|
|
|
- /*
|
|
|
|
- * Force memory writes to complete before letting h/w
|
|
|
|
|
|
+ /* Force memory writes to complete before letting h/w
|
|
* know there are new descriptors to fetch. (Only
|
|
* know there are new descriptors to fetch. (Only
|
|
* applicable for weak-ordered memory model archs,
|
|
* applicable for weak-ordered memory model archs,
|
|
* such as IA-64).
|
|
* such as IA-64).
|
|
@@ -7016,7 +7004,8 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx)
|
|
mac->autoneg = 0;
|
|
mac->autoneg = 0;
|
|
|
|
|
|
/* Make sure dplx is at most 1 bit and lsb of speed is not set
|
|
/* Make sure dplx is at most 1 bit and lsb of speed is not set
|
|
- * for the switch() below to work */
|
|
|
|
|
|
+ * for the switch() below to work
|
|
|
|
+ */
|
|
if ((spd & 1) || (dplx & ~1))
|
|
if ((spd & 1) || (dplx & ~1))
|
|
goto err_inval;
|
|
goto err_inval;
|
|
|
|
|
|
@@ -7131,7 +7120,8 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake,
|
|
igb_power_up_link(adapter);
|
|
igb_power_up_link(adapter);
|
|
|
|
|
|
/* Release control of h/w to f/w. If f/w is AMT enabled, this
|
|
/* Release control of h/w to f/w. If f/w is AMT enabled, this
|
|
- * would have already happened in close and is redundant. */
|
|
|
|
|
|
+ * would have already happened in close and is redundant.
|
|
|
|
+ */
|
|
igb_release_hw_control(adapter);
|
|
igb_release_hw_control(adapter);
|
|
|
|
|
|
pci_disable_device(pdev);
|
|
pci_disable_device(pdev);
|
|
@@ -7193,7 +7183,8 @@ static int igb_resume(struct device *dev)
|
|
igb_reset(adapter);
|
|
igb_reset(adapter);
|
|
|
|
|
|
/* let the f/w know that the h/w is now under the control of the
|
|
/* let the f/w know that the h/w is now under the control of the
|
|
- * driver. */
|
|
|
|
|
|
+ * driver.
|
|
|
|
+ */
|
|
igb_get_hw_control(adapter);
|
|
igb_get_hw_control(adapter);
|
|
|
|
|
|
wr32(E1000_WUS, ~0);
|
|
wr32(E1000_WUS, ~0);
|
|
@@ -7329,8 +7320,7 @@ static int igb_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_NET_POLL_CONTROLLER
|
|
#ifdef CONFIG_NET_POLL_CONTROLLER
|
|
-/*
|
|
|
|
- * Polling 'interrupt' - used by things like netconsole to send skbs
|
|
|
|
|
|
+/* Polling 'interrupt' - used by things like netconsole to send skbs
|
|
* without having to re-enable interrupts. It's not called while
|
|
* without having to re-enable interrupts. It's not called while
|
|
* the interrupt routine is executing.
|
|
* the interrupt routine is executing.
|
|
*/
|
|
*/
|
|
@@ -7353,13 +7343,13 @@ static void igb_netpoll(struct net_device *netdev)
|
|
#endif /* CONFIG_NET_POLL_CONTROLLER */
|
|
#endif /* CONFIG_NET_POLL_CONTROLLER */
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_io_error_detected - called when PCI error is detected
|
|
|
|
- * @pdev: Pointer to PCI device
|
|
|
|
- * @state: The current pci connection state
|
|
|
|
|
|
+ * igb_io_error_detected - called when PCI error is detected
|
|
|
|
+ * @pdev: Pointer to PCI device
|
|
|
|
+ * @state: The current pci connection state
|
|
*
|
|
*
|
|
- * This function is called after a PCI bus error affecting
|
|
|
|
- * this device has been detected.
|
|
|
|
- */
|
|
|
|
|
|
+ * This function is called after a PCI bus error affecting
|
|
|
|
+ * this device has been detected.
|
|
|
|
+ **/
|
|
static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
|
|
static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
|
|
pci_channel_state_t state)
|
|
pci_channel_state_t state)
|
|
{
|
|
{
|
|
@@ -7380,12 +7370,12 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_io_slot_reset - called after the pci bus has been reset.
|
|
|
|
- * @pdev: Pointer to PCI device
|
|
|
|
|
|
+ * igb_io_slot_reset - called after the pci bus has been reset.
|
|
|
|
+ * @pdev: Pointer to PCI device
|
|
*
|
|
*
|
|
- * Restart the card from scratch, as if from a cold-boot. Implementation
|
|
|
|
- * resembles the first-half of the igb_resume routine.
|
|
|
|
- */
|
|
|
|
|
|
+ * Restart the card from scratch, as if from a cold-boot. Implementation
|
|
|
|
+ * resembles the first-half of the igb_resume routine.
|
|
|
|
+ **/
|
|
static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
|
|
static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
|
|
{
|
|
{
|
|
struct net_device *netdev = pci_get_drvdata(pdev);
|
|
struct net_device *netdev = pci_get_drvdata(pdev);
|
|
@@ -7413,8 +7403,9 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
|
|
|
|
|
|
err = pci_cleanup_aer_uncorrect_error_status(pdev);
|
|
err = pci_cleanup_aer_uncorrect_error_status(pdev);
|
|
if (err) {
|
|
if (err) {
|
|
- dev_err(&pdev->dev, "pci_cleanup_aer_uncorrect_error_status "
|
|
|
|
- "failed 0x%0x\n", err);
|
|
|
|
|
|
+ dev_err(&pdev->dev,
|
|
|
|
+ "pci_cleanup_aer_uncorrect_error_status failed 0x%0x\n",
|
|
|
|
+ err);
|
|
/* non-fatal, continue */
|
|
/* non-fatal, continue */
|
|
}
|
|
}
|
|
|
|
|
|
@@ -7422,12 +7413,12 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * igb_io_resume - called when traffic can start flowing again.
|
|
|
|
- * @pdev: Pointer to PCI device
|
|
|
|
|
|
+ * igb_io_resume - called when traffic can start flowing again.
|
|
|
|
+ * @pdev: Pointer to PCI device
|
|
*
|
|
*
|
|
- * This callback is called when the error recovery driver tells us that
|
|
|
|
- * its OK to resume normal operation. Implementation resembles the
|
|
|
|
- * second-half of the igb_resume routine.
|
|
|
|
|
|
+ * This callback is called when the error recovery driver tells us that
|
|
|
|
+ * its OK to resume normal operation. Implementation resembles the
|
|
|
|
+ * second-half of the igb_resume routine.
|
|
*/
|
|
*/
|
|
static void igb_io_resume(struct pci_dev *pdev)
|
|
static void igb_io_resume(struct pci_dev *pdev)
|
|
{
|
|
{
|
|
@@ -7444,12 +7435,13 @@ static void igb_io_resume(struct pci_dev *pdev)
|
|
netif_device_attach(netdev);
|
|
netif_device_attach(netdev);
|
|
|
|
|
|
/* let the f/w know that the h/w is now under the control of the
|
|
/* let the f/w know that the h/w is now under the control of the
|
|
- * driver. */
|
|
|
|
|
|
+ * driver.
|
|
|
|
+ */
|
|
igb_get_hw_control(adapter);
|
|
igb_get_hw_control(adapter);
|
|
}
|
|
}
|
|
|
|
|
|
static void igb_rar_set_qsel(struct igb_adapter *adapter, u8 *addr, u32 index,
|
|
static void igb_rar_set_qsel(struct igb_adapter *adapter, u8 *addr, u32 index,
|
|
- u8 qsel)
|
|
|
|
|
|
+ u8 qsel)
|
|
{
|
|
{
|
|
u32 rar_low, rar_high;
|
|
u32 rar_low, rar_high;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
@@ -7458,7 +7450,7 @@ static void igb_rar_set_qsel(struct igb_adapter *adapter, u8 *addr, u32 index,
|
|
* from network order (big endian) to little endian
|
|
* from network order (big endian) to little endian
|
|
*/
|
|
*/
|
|
rar_low = ((u32) addr[0] | ((u32) addr[1] << 8) |
|
|
rar_low = ((u32) addr[0] | ((u32) addr[1] << 8) |
|
|
- ((u32) addr[2] << 16) | ((u32) addr[3] << 24));
|
|
|
|
|
|
+ ((u32) addr[2] << 16) | ((u32) addr[3] << 24));
|
|
rar_high = ((u32) addr[4] | ((u32) addr[5] << 8));
|
|
rar_high = ((u32) addr[4] | ((u32) addr[5] << 8));
|
|
|
|
|
|
/* Indicate to hardware the Address is Valid. */
|
|
/* Indicate to hardware the Address is Valid. */
|
|
@@ -7476,11 +7468,12 @@ static void igb_rar_set_qsel(struct igb_adapter *adapter, u8 *addr, u32 index,
|
|
}
|
|
}
|
|
|
|
|
|
static int igb_set_vf_mac(struct igb_adapter *adapter,
|
|
static int igb_set_vf_mac(struct igb_adapter *adapter,
|
|
- int vf, unsigned char *mac_addr)
|
|
|
|
|
|
+ int vf, unsigned char *mac_addr)
|
|
{
|
|
{
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
/* VF MAC addresses start at end of receive addresses and moves
|
|
/* VF MAC addresses start at end of receive addresses and moves
|
|
- * torwards the first, as a result a collision should not be possible */
|
|
|
|
|
|
+ * towards the first, as a result a collision should not be possible
|
|
|
|
+ */
|
|
int rar_entry = hw->mac.rar_entry_count - (vf + 1);
|
|
int rar_entry = hw->mac.rar_entry_count - (vf + 1);
|
|
|
|
|
|
memcpy(adapter->vf_data[vf].vf_mac_addresses, mac_addr, ETH_ALEN);
|
|
memcpy(adapter->vf_data[vf].vf_mac_addresses, mac_addr, ETH_ALEN);
|
|
@@ -7497,13 +7490,13 @@ static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
adapter->vf_data[vf].flags |= IGB_VF_FLAG_PF_SET_MAC;
|
|
adapter->vf_data[vf].flags |= IGB_VF_FLAG_PF_SET_MAC;
|
|
dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf);
|
|
dev_info(&adapter->pdev->dev, "setting MAC %pM on VF %d\n", mac, vf);
|
|
- dev_info(&adapter->pdev->dev, "Reload the VF driver to make this"
|
|
|
|
- " change effective.");
|
|
|
|
|
|
+ dev_info(&adapter->pdev->dev,
|
|
|
|
+ "Reload the VF driver to make this change effective.");
|
|
if (test_bit(__IGB_DOWN, &adapter->state)) {
|
|
if (test_bit(__IGB_DOWN, &adapter->state)) {
|
|
- dev_warn(&adapter->pdev->dev, "The VF MAC address has been set,"
|
|
|
|
- " but the PF device is not up.\n");
|
|
|
|
- dev_warn(&adapter->pdev->dev, "Bring the PF device up before"
|
|
|
|
- " attempting to use the VF device.\n");
|
|
|
|
|
|
+ dev_warn(&adapter->pdev->dev,
|
|
|
|
+ "The VF MAC address has been set, but the PF device is not up.\n");
|
|
|
|
+ dev_warn(&adapter->pdev->dev,
|
|
|
|
+ "Bring the PF device up before attempting to use the VF device.\n");
|
|
}
|
|
}
|
|
return igb_set_vf_mac(adapter, vf, mac);
|
|
return igb_set_vf_mac(adapter, vf, mac);
|
|
}
|
|
}
|
|
@@ -7530,19 +7523,19 @@ static void igb_set_vf_rate_limit(struct e1000_hw *hw, int vf, int tx_rate,
|
|
/* Calculate the rate factor values to set */
|
|
/* Calculate the rate factor values to set */
|
|
rf_int = link_speed / tx_rate;
|
|
rf_int = link_speed / tx_rate;
|
|
rf_dec = (link_speed - (rf_int * tx_rate));
|
|
rf_dec = (link_speed - (rf_int * tx_rate));
|
|
- rf_dec = (rf_dec * (1<<E1000_RTTBCNRC_RF_INT_SHIFT)) / tx_rate;
|
|
|
|
|
|
+ rf_dec = (rf_dec * (1 << E1000_RTTBCNRC_RF_INT_SHIFT)) /
|
|
|
|
+ tx_rate;
|
|
|
|
|
|
bcnrc_val = E1000_RTTBCNRC_RS_ENA;
|
|
bcnrc_val = E1000_RTTBCNRC_RS_ENA;
|
|
- bcnrc_val |= ((rf_int<<E1000_RTTBCNRC_RF_INT_SHIFT) &
|
|
|
|
- E1000_RTTBCNRC_RF_INT_MASK);
|
|
|
|
|
|
+ bcnrc_val |= ((rf_int << E1000_RTTBCNRC_RF_INT_SHIFT) &
|
|
|
|
+ E1000_RTTBCNRC_RF_INT_MASK);
|
|
bcnrc_val |= (rf_dec & E1000_RTTBCNRC_RF_DEC_MASK);
|
|
bcnrc_val |= (rf_dec & E1000_RTTBCNRC_RF_DEC_MASK);
|
|
} else {
|
|
} else {
|
|
bcnrc_val = 0;
|
|
bcnrc_val = 0;
|
|
}
|
|
}
|
|
|
|
|
|
wr32(E1000_RTTDQSEL, vf); /* vf X uses queue X */
|
|
wr32(E1000_RTTDQSEL, vf); /* vf X uses queue X */
|
|
- /*
|
|
|
|
- * Set global transmit compensation time to the MMW_SIZE in RTTBCNRM
|
|
|
|
|
|
+ /* Set global transmit compensation time to the MMW_SIZE in RTTBCNRM
|
|
* register. MMW_SIZE=0x014 if 9728-byte jumbo is supported.
|
|
* register. MMW_SIZE=0x014 if 9728-byte jumbo is supported.
|
|
*/
|
|
*/
|
|
wr32(E1000_RTTBCNRM, 0x14);
|
|
wr32(E1000_RTTBCNRM, 0x14);
|
|
@@ -7564,8 +7557,7 @@ static void igb_check_vf_rate_limit(struct igb_adapter *adapter)
|
|
reset_rate = true;
|
|
reset_rate = true;
|
|
adapter->vf_rate_link_speed = 0;
|
|
adapter->vf_rate_link_speed = 0;
|
|
dev_info(&adapter->pdev->dev,
|
|
dev_info(&adapter->pdev->dev,
|
|
- "Link speed has been changed. VF Transmit "
|
|
|
|
- "rate is disabled\n");
|
|
|
|
|
|
+ "Link speed has been changed. VF Transmit rate is disabled\n");
|
|
}
|
|
}
|
|
|
|
|
|
for (i = 0; i < adapter->vfs_allocated_count; i++) {
|
|
for (i = 0; i < adapter->vfs_allocated_count; i++) {
|
|
@@ -7573,8 +7565,8 @@ static void igb_check_vf_rate_limit(struct igb_adapter *adapter)
|
|
adapter->vf_data[i].tx_rate = 0;
|
|
adapter->vf_data[i].tx_rate = 0;
|
|
|
|
|
|
igb_set_vf_rate_limit(&adapter->hw, i,
|
|
igb_set_vf_rate_limit(&adapter->hw, i,
|
|
- adapter->vf_data[i].tx_rate,
|
|
|
|
- actual_link_speed);
|
|
|
|
|
|
+ adapter->vf_data[i].tx_rate,
|
|
|
|
+ actual_link_speed);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -7645,7 +7637,7 @@ static void igb_vmm_control(struct igb_adapter *adapter)
|
|
igb_vmdq_set_loopback_pf(hw, true);
|
|
igb_vmdq_set_loopback_pf(hw, true);
|
|
igb_vmdq_set_replication_pf(hw, true);
|
|
igb_vmdq_set_replication_pf(hw, true);
|
|
igb_vmdq_set_anti_spoofing_pf(hw, true,
|
|
igb_vmdq_set_anti_spoofing_pf(hw, true,
|
|
- adapter->vfs_allocated_count);
|
|
|
|
|
|
+ adapter->vfs_allocated_count);
|
|
} else {
|
|
} else {
|
|
igb_vmdq_set_loopback_pf(hw, false);
|
|
igb_vmdq_set_loopback_pf(hw, false);
|
|
igb_vmdq_set_replication_pf(hw, false);
|
|
igb_vmdq_set_replication_pf(hw, false);
|
|
@@ -7665,8 +7657,7 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
|
|
/* force threshold to 0. */
|
|
/* force threshold to 0. */
|
|
wr32(E1000_DMCTXTH, 0);
|
|
wr32(E1000_DMCTXTH, 0);
|
|
|
|
|
|
- /*
|
|
|
|
- * DMA Coalescing high water mark needs to be greater
|
|
|
|
|
|
+ /* DMA Coalescing high water mark needs to be greater
|
|
* than the Rx threshold. Set hwm to PBA - max frame
|
|
* than the Rx threshold. Set hwm to PBA - max frame
|
|
* size in 16B units, capping it at PBA - 6KB.
|
|
* size in 16B units, capping it at PBA - 6KB.
|
|
*/
|
|
*/
|
|
@@ -7679,8 +7670,7 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
|
|
& E1000_FCRTC_RTH_COAL_MASK);
|
|
& E1000_FCRTC_RTH_COAL_MASK);
|
|
wr32(E1000_FCRTC, reg);
|
|
wr32(E1000_FCRTC, reg);
|
|
|
|
|
|
- /*
|
|
|
|
- * Set the DMA Coalescing Rx threshold to PBA - 2 * max
|
|
|
|
|
|
+ /* Set the DMA Coalescing Rx threshold to PBA - 2 * max
|
|
* frame size, capping it at PBA - 10KB.
|
|
* frame size, capping it at PBA - 10KB.
|
|
*/
|
|
*/
|
|
dmac_thr = pba - adapter->max_frame_size / 512;
|
|
dmac_thr = pba - adapter->max_frame_size / 512;
|
|
@@ -7701,8 +7691,7 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
|
|
reg &= ~E1000_DMACR_DC_BMC2OSW_EN;
|
|
reg &= ~E1000_DMACR_DC_BMC2OSW_EN;
|
|
wr32(E1000_DMACR, reg);
|
|
wr32(E1000_DMACR, reg);
|
|
|
|
|
|
- /*
|
|
|
|
- * no lower threshold to disable
|
|
|
|
|
|
+ /* no lower threshold to disable
|
|
* coalescing(smart fifb)-UTRESH=0
|
|
* coalescing(smart fifb)-UTRESH=0
|
|
*/
|
|
*/
|
|
wr32(E1000_DMCRTRH, 0);
|
|
wr32(E1000_DMCRTRH, 0);
|
|
@@ -7711,15 +7700,13 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
|
|
|
|
|
|
wr32(E1000_DMCTLX, reg);
|
|
wr32(E1000_DMCTLX, reg);
|
|
|
|
|
|
- /*
|
|
|
|
- * free space in tx packet buffer to wake from
|
|
|
|
|
|
+ /* free space in tx packet buffer to wake from
|
|
* DMA coal
|
|
* DMA coal
|
|
*/
|
|
*/
|
|
wr32(E1000_DMCTXTH, (IGB_MIN_TXPBSIZE -
|
|
wr32(E1000_DMCTXTH, (IGB_MIN_TXPBSIZE -
|
|
(IGB_TX_BUF_4096 + adapter->max_frame_size)) >> 6);
|
|
(IGB_TX_BUF_4096 + adapter->max_frame_size)) >> 6);
|
|
|
|
|
|
- /*
|
|
|
|
- * make low power state decision controlled
|
|
|
|
|
|
+ /* make low power state decision controlled
|
|
* by DMA coal
|
|
* by DMA coal
|
|
*/
|
|
*/
|
|
reg = rd32(E1000_PCIEMISC);
|
|
reg = rd32(E1000_PCIEMISC);
|
|
@@ -7733,7 +7720,8 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-/* igb_read_i2c_byte - Reads 8 bit word over I2C
|
|
|
|
|
|
+/**
|
|
|
|
+ * igb_read_i2c_byte - Reads 8 bit word over I2C
|
|
* @hw: pointer to hardware structure
|
|
* @hw: pointer to hardware structure
|
|
* @byte_offset: byte offset to read
|
|
* @byte_offset: byte offset to read
|
|
* @dev_addr: device address
|
|
* @dev_addr: device address
|
|
@@ -7741,9 +7729,9 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
|
|
*
|
|
*
|
|
* Performs byte read operation over I2C interface at
|
|
* Performs byte read operation over I2C interface at
|
|
* a specified device address.
|
|
* a specified device address.
|
|
- */
|
|
|
|
|
|
+ **/
|
|
s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
|
|
s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
|
|
- u8 dev_addr, u8 *data)
|
|
|
|
|
|
+ u8 dev_addr, u8 *data)
|
|
{
|
|
{
|
|
struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw);
|
|
struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw);
|
|
struct i2c_client *this_client = adapter->i2c_client;
|
|
struct i2c_client *this_client = adapter->i2c_client;
|
|
@@ -7770,7 +7758,8 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-/* igb_write_i2c_byte - Writes 8 bit word over I2C
|
|
|
|
|
|
+/**
|
|
|
|
+ * igb_write_i2c_byte - Writes 8 bit word over I2C
|
|
* @hw: pointer to hardware structure
|
|
* @hw: pointer to hardware structure
|
|
* @byte_offset: byte offset to write
|
|
* @byte_offset: byte offset to write
|
|
* @dev_addr: device address
|
|
* @dev_addr: device address
|
|
@@ -7778,9 +7767,9 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
|
|
*
|
|
*
|
|
* Performs byte write operation over I2C interface at
|
|
* Performs byte write operation over I2C interface at
|
|
* a specified device address.
|
|
* a specified device address.
|
|
- */
|
|
|
|
|
|
+ **/
|
|
s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
|
|
s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
|
|
- u8 dev_addr, u8 data)
|
|
|
|
|
|
+ u8 dev_addr, u8 data)
|
|
{
|
|
{
|
|
struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw);
|
|
struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw);
|
|
struct i2c_client *this_client = adapter->i2c_client;
|
|
struct i2c_client *this_client = adapter->i2c_client;
|