Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2015-11-23

This series contains updates to ixgbe, ixgbevf, fm10k, i40e and i40evf.

Jacob fixes an issue where VF could attempt to read queues it does not own,
so prevent this we check queue 0 before we continue.

Matthew fixes the MTU for jumbo frames for fm10k.

Julia Lawall cleans up a unneeded NULL test in ixgbe.

Mark cleans up a redundant header inclusion.  Adds KR mode support for
CS4227 chip.  Cleaned up diagnostic code, which is no longer needed, for
the CS4227 chip.

Jean Sacren fixes kernel documentation for ixgbe.

Alex Duyck fixes an fm10k and ixgbe issue in which the polling routine would
increase the budget for receive to at least 1 per queue if multiple queues were
present.  This would result in receive packets being processed when the budget
was 0 which is meant to indicate that no receive can be handled.  Also fixes
an ixgbevf performance issue where netperf test will starve for memory in the
time form one transmit interrupt to the next, so limit lowest interrupt rate
for adaptive interrupt moderation to 12K.  Fixed up ixgbe and ixgbevf to
use napi_schedule_irqoff() where the drivers were run from hard interrupt
context or with interrupts already disabled in netpoll.

Jesse fixes a compiler warning about an unused variable for i40evf.

John Greene fixes an issue with ixgbevf, where if the VF driver is loaded
while the corresponding PH interface is down, the driver assigns a random
MAC address, can be overwritten with the value of hw->mac.perm_addr which
is 0 at that point.  So avoid this case by initializing hw->mac.perm_addr
to the randomly generated address and do not set it unless we receive an
ACK from ixgbe.

Rasmus Villemoes cleans up some confusing code in i40e debugfs code.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2015-11-24 10:08:08 -05:00
commit 57ef5527b8
13 changed files with 111 additions and 153 deletions

View file

@ -33,7 +33,7 @@
#include "fm10k_pf.h"
#include "fm10k_vf.h"
#define FM10K_MAX_JUMBO_FRAME_SIZE 15358 /* Maximum supported size 15K */
#define FM10K_MAX_JUMBO_FRAME_SIZE 15342 /* Maximum supported size 15K */
#define MAX_QUEUES FM10K_MAX_QUEUES_PF

View file

@ -1428,6 +1428,10 @@ static int fm10k_poll(struct napi_struct *napi, int budget)
fm10k_for_each_ring(ring, q_vector->tx)
clean_complete &= fm10k_clean_tx_irq(q_vector, ring);
/* Handle case where we are called by netpoll with a budget of 0 */
if (budget <= 0)
return budget;
/* attempt to distribute budget to each queue fairly, but don't
* allow the budget to go below 1 because we'll exit polling
*/

View file

@ -77,6 +77,7 @@ struct fm10k_hw;
#define FM10K_PCIE_SRIOV_CTRL_VFARI 0x10
#define FM10K_ERR_PARAM -2
#define FM10K_ERR_NO_RESOURCES -3
#define FM10K_ERR_REQUESTS_PENDING -4
#define FM10K_ERR_RESET_REQUESTED -5
#define FM10K_ERR_DMA_PENDING -6

View file

@ -103,7 +103,12 @@ static s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
s32 err;
u16 i;
/* assume we always have at least 1 queue */
/* verify we have at least 1 queue */
if (!~fm10k_read_reg(hw, FM10K_TXQCTL(0)) ||
!~fm10k_read_reg(hw, FM10K_RXQCTL(0)))
return FM10K_ERR_NO_RESOURCES;
/* determine how many queues we have */
for (i = 1; tqdloc0 && (i < FM10K_MAX_QUEUES_POOL); i++) {
/* verify the Descriptor cache offsets are increasing */
tqdloc = ~fm10k_read_reg(hw, FM10K_TQDLOC(i));

View file

@ -103,8 +103,8 @@ static ssize_t i40e_dbg_dump_read(struct file *filp, char __user *buffer,
len = min_t(int, count, (i40e_dbg_dump_data_len - *ppos));
bytes_not_copied = copy_to_user(buffer, &i40e_dbg_dump_buf[*ppos], len);
if (bytes_not_copied < 0)
return bytes_not_copied;
if (bytes_not_copied)
return -EFAULT;
*ppos += len;
return len;
@ -353,8 +353,8 @@ static ssize_t i40e_dbg_command_read(struct file *filp, char __user *buffer,
bytes_not_copied = copy_to_user(buffer, buf, len);
kfree(buf);
if (bytes_not_copied < 0)
return bytes_not_copied;
if (bytes_not_copied)
return -EFAULT;
*ppos = len;
return len;
@ -981,12 +981,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
if (!cmd_buf)
return count;
bytes_not_copied = copy_from_user(cmd_buf, buffer, count);
if (bytes_not_copied < 0) {
if (bytes_not_copied) {
kfree(cmd_buf);
return bytes_not_copied;
return -EFAULT;
}
if (bytes_not_copied > 0)
count -= bytes_not_copied;
cmd_buf[count] = '\0';
cmd_buf_tmp = strchr(cmd_buf, '\n');
@ -2034,8 +2032,8 @@ static ssize_t i40e_dbg_netdev_ops_read(struct file *filp, char __user *buffer,
bytes_not_copied = copy_to_user(buffer, buf, len);
kfree(buf);
if (bytes_not_copied < 0)
return bytes_not_copied;
if (bytes_not_copied)
return -EFAULT;
*ppos = len;
return len;
@ -2068,10 +2066,8 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
memset(i40e_dbg_netdev_ops_buf, 0, sizeof(i40e_dbg_netdev_ops_buf));
bytes_not_copied = copy_from_user(i40e_dbg_netdev_ops_buf,
buffer, count);
if (bytes_not_copied < 0)
return bytes_not_copied;
else if (bytes_not_copied > 0)
count -= bytes_not_copied;
if (bytes_not_copied)
return -EFAULT;
i40e_dbg_netdev_ops_buf[count] = '\0';
buf_tmp = strchr(i40e_dbg_netdev_ops_buf, '\n');

View file

@ -307,10 +307,9 @@ static irqreturn_t i40evf_msix_aq(int irq, void *data)
struct i40e_hw *hw = &adapter->hw;
u32 val;
/* handle non-queue interrupts */
rd32(hw, I40E_VFINT_ICR01);
rd32(hw, I40E_VFINT_ICR0_ENA1);
/* handle non-queue interrupts, these reads clear the registers */
val = rd32(hw, I40E_VFINT_ICR01);
val = rd32(hw, I40E_VFINT_ICR0_ENA1);
val = rd32(hw, I40E_VFINT_DYN_CTL01) |
I40E_VFINT_DYN_CTL01_CLEARPBA_MASK;

View file

@ -620,8 +620,7 @@ static void ixgbe_fcoe_dma_pool_free(struct ixgbe_fcoe *fcoe, unsigned int cpu)
struct ixgbe_fcoe_ddp_pool *ddp_pool;
ddp_pool = per_cpu_ptr(fcoe->ddp_pool, cpu);
if (ddp_pool->pool)
dma_pool_destroy(ddp_pool->pool);
dma_pool_destroy(ddp_pool->pool);
ddp_pool->pool = NULL;
}

View file

@ -65,9 +65,6 @@
#include "ixgbe_common.h"
#include "ixgbe_dcb_82599.h"
#include "ixgbe_sriov.h"
#ifdef CONFIG_IXGBE_VXLAN
#include <net/vxlan.h>
#endif
char ixgbe_driver_name[] = "ixgbe";
static const char ixgbe_driver_string[] =
@ -2757,7 +2754,7 @@ static irqreturn_t ixgbe_msix_clean_rings(int irq, void *data)
/* EIAM disabled interrupts (on this vector) for us */
if (q_vector->rx.ring || q_vector->tx.ring)
napi_schedule(&q_vector->napi);
napi_schedule_irqoff(&q_vector->napi);
return IRQ_HANDLED;
}
@ -2786,7 +2783,8 @@ int ixgbe_poll(struct napi_struct *napi, int budget)
ixgbe_for_each_ring(ring, q_vector->tx)
clean_complete &= !!ixgbe_clean_tx_irq(q_vector, ring);
if (!ixgbe_qv_lock_napi(q_vector))
/* Exit if we are called by netpoll or busy polling is active */
if ((budget <= 0) || !ixgbe_qv_lock_napi(q_vector))
return budget;
/* attempt to distribute budget to each queue fairly, but don't allow
@ -2950,7 +2948,7 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
ixgbe_ptp_check_pps_event(adapter, eicr);
/* would disable interrupts here but EIAM disabled it */
napi_schedule(&q_vector->napi);
napi_schedule_irqoff(&q_vector->napi);
/*
* re-enable link(maybe) and non-queue interrupts, no flush.
@ -3315,8 +3313,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter,
}
/**
* Return a number of entries in the RSS indirection table
*
* ixgbe_rss_indir_tbl_entries - Return RSS indirection table entries
* @adapter: device handle
*
* - 82598/82599/X540: 128
@ -3334,8 +3331,7 @@ u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter)
}
/**
* Write the RETA table to HW
*
* ixgbe_store_reta - Write the RETA table to HW
* @adapter: device handle
*
* Write the RSS redirection table stored in adapter.rss_indir_tbl[] to HW.
@ -3374,8 +3370,7 @@ void ixgbe_store_reta(struct ixgbe_adapter *adapter)
}
/**
* Write the RETA table to HW (for x550 devices in SRIOV mode)
*
* ixgbe_store_vfreta - Write the RETA table to HW (x550 devices in SRIOV mode)
* @adapter: device handle
*
* Write the RSS redirection table stored in adapter.rss_indir_tbl[] to HW.

View file

@ -26,6 +26,8 @@
#include "ixgbe_common.h"
#include "ixgbe_phy.h"
static s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *, ixgbe_link_speed);
static s32 ixgbe_get_invariants_X550_x(struct ixgbe_hw *hw)
{
struct ixgbe_mac_info *mac = &hw->mac;
@ -84,79 +86,6 @@ static s32 ixgbe_write_cs4227(struct ixgbe_hw *hw, u16 reg, u16 value)
value);
}
/**
* ixgbe_check_cs4227_reg - Perform diag on a CS4227 register
* @hw: pointer to hardware structure
* @reg: the register to check
*
* Performs a diagnostic on a register in the CS4227 chip. Returns an error
* if it is not operating correctly.
* This function assumes that the caller has acquired the proper semaphore.
*/
static s32 ixgbe_check_cs4227_reg(struct ixgbe_hw *hw, u16 reg)
{
s32 status;
u32 retry;
u16 reg_val;
reg_val = (IXGBE_CS4227_EDC_MODE_DIAG << 1) | 1;
status = ixgbe_write_cs4227(hw, reg, reg_val);
if (status)
return status;
for (retry = 0; retry < IXGBE_CS4227_RETRIES; retry++) {
msleep(IXGBE_CS4227_CHECK_DELAY);
reg_val = 0xFFFF;
ixgbe_read_cs4227(hw, reg, &reg_val);
if (!reg_val)
break;
}
if (reg_val) {
hw_err(hw, "CS4227 reg 0x%04X failed diagnostic\n", reg);
return status;
}
return 0;
}
/**
* ixgbe_get_cs4227_status - Return CS4227 status
* @hw: pointer to hardware structure
*
* Performs a diagnostic on the CS4227 chip. Returns an error if it is
* not operating correctly.
* This function assumes that the caller has acquired the proper semaphore.
*/
static s32 ixgbe_get_cs4227_status(struct ixgbe_hw *hw)
{
s32 status;
u16 value = 0;
/* Exit if the diagnostic has already been performed. */
status = ixgbe_read_cs4227(hw, IXGBE_CS4227_SCRATCH, &value);
if (status)
return status;
if (value == IXGBE_CS4227_RESET_COMPLETE)
return 0;
/* Check port 0. */
status = ixgbe_check_cs4227_reg(hw, IXGBE_CS4227_LINE_SPARE24_LSB);
if (status)
return status;
status = ixgbe_check_cs4227_reg(hw, IXGBE_CS4227_HOST_SPARE24_LSB);
if (status)
return status;
/* Check port 1. */
status = ixgbe_check_cs4227_reg(hw, IXGBE_CS4227_LINE_SPARE24_LSB +
(1 << 12));
if (status)
return status;
return ixgbe_check_cs4227_reg(hw, IXGBE_CS4227_HOST_SPARE24_LSB +
(1 << 12));
}
/**
* ixgbe_read_pe - Read register from port expander
* @hw: pointer to hardware structure
@ -326,13 +255,6 @@ static void ixgbe_check_cs4227(struct ixgbe_hw *hw)
return;
}
/* Is the CS4227 working correctly? */
status = ixgbe_get_cs4227_status(hw);
if (status) {
hw_err(hw, "CS4227 status failed: %d", status);
goto out;
}
/* Record completion for next time. */
status = ixgbe_write_cs4227(hw, IXGBE_CS4227_SCRATCH,
IXGBE_CS4227_RESET_COMPLETE);
@ -1257,31 +1179,71 @@ ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
if (status)
return status;
/* Configure CS4227 LINE side to 10G SR. */
slice = IXGBE_CS4227_LINE_SPARE22_MSB + (hw->bus.lan_id << 12);
value = IXGBE_CS4227_SPEED_10G;
status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227, slice,
value);
if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
/* Configure CS4227 LINE side to 10G SR. */
slice = IXGBE_CS4227_LINE_SPARE22_MSB + (hw->bus.lan_id << 12);
value = IXGBE_CS4227_SPEED_10G;
status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
slice, value);
if (status)
goto i2c_err;
/* Configure CS4227 for HOST connection rate then type. */
slice = IXGBE_CS4227_HOST_SPARE22_MSB + (hw->bus.lan_id << 12);
value = speed & IXGBE_LINK_SPEED_10GB_FULL ?
IXGBE_CS4227_SPEED_10G : IXGBE_CS4227_SPEED_1G;
status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227, slice,
value);
slice = IXGBE_CS4227_HOST_SPARE24_LSB + (hw->bus.lan_id << 12);
if (setup_linear)
value = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;
else
slice = IXGBE_CS4227_LINE_SPARE24_LSB + (hw->bus.lan_id << 12);
value = (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;
status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227, slice,
value);
status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
slice, value);
if (status)
goto i2c_err;
/* If internal link mode is XFI, then setup XFI internal link. */
if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE))
/* Configure CS4227 for HOST connection rate then type. */
slice = IXGBE_CS4227_HOST_SPARE22_MSB + (hw->bus.lan_id << 12);
value = speed & IXGBE_LINK_SPEED_10GB_FULL ?
IXGBE_CS4227_SPEED_10G : IXGBE_CS4227_SPEED_1G;
status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
slice, value);
if (status)
goto i2c_err;
slice = IXGBE_CS4227_HOST_SPARE24_LSB + (hw->bus.lan_id << 12);
if (setup_linear)
value = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;
else
value = (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;
status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
slice, value);
if (status)
goto i2c_err;
/* Setup XFI internal link. */
status = ixgbe_setup_ixfi_x550em(hw, &speed);
if (status) {
hw_dbg(hw, "setup_ixfi failed with %d\n", status);
return status;
}
} else {
/* Configure internal PHY for KR/KX. */
status = ixgbe_setup_kr_speed_x550em(hw, speed);
if (status) {
hw_dbg(hw, "setup_kr_speed failed with %d\n", status);
return status;
}
/* Configure CS4227 LINE side to proper mode. */
slice = IXGBE_CS4227_LINE_SPARE24_LSB + (hw->bus.lan_id << 12);
if (setup_linear)
value = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;
else
value = (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;
status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
slice, value);
if (status)
goto i2c_err;
}
return 0;
i2c_err:
hw_dbg(hw, "combined i2c access failed with %d\n", status);
return status;
}
@ -1982,12 +1944,9 @@ static s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
* to determine internal PHY mode.
*/
phy->nw_mng_if_sel = IXGBE_READ_REG(hw, IXGBE_NW_MNG_IF_SEL);
/* If internal PHY mode is KR, then initialize KR link */
if (phy->nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE) {
speed = IXGBE_LINK_SPEED_10GB_FULL |
IXGBE_LINK_SPEED_1GB_FULL;
ret_val = ixgbe_setup_kr_speed_x550em(hw, speed);
}
}

View file

@ -774,7 +774,7 @@ static int ixgbevf_set_coalesce(struct net_device *netdev,
adapter->tx_itr_setting = ec->tx_coalesce_usecs;
if (adapter->tx_itr_setting == 1)
tx_itr_param = IXGBE_10K_ITR;
tx_itr_param = IXGBE_12K_ITR;
else
tx_itr_param = adapter->tx_itr_setting;

View file

@ -326,8 +326,7 @@ static inline bool ixgbevf_qv_disable(struct ixgbevf_q_vector *q_vector)
#define IXGBE_MIN_RSC_ITR 24
#define IXGBE_100K_ITR 40
#define IXGBE_20K_ITR 200
#define IXGBE_10K_ITR 400
#define IXGBE_8K_ITR 500
#define IXGBE_12K_ITR 336
/* Helper macros to switch between ints/sec and what the register uses.
* And yes, it's the same math going both ways. The lowest value

View file

@ -1138,7 +1138,7 @@ static void ixgbevf_configure_msix(struct ixgbevf_adapter *adapter)
if (q_vector->tx.ring && !q_vector->rx.ring) {
/* Tx only vector */
if (adapter->tx_itr_setting == 1)
q_vector->itr = IXGBE_10K_ITR;
q_vector->itr = IXGBE_12K_ITR;
else
q_vector->itr = adapter->tx_itr_setting;
} else {
@ -1196,7 +1196,7 @@ static void ixgbevf_update_itr(struct ixgbevf_q_vector *q_vector,
/* simple throttle rate management
* 0-20MB/s lowest (100000 ints/s)
* 20-100MB/s low (20000 ints/s)
* 100-1249MB/s bulk (8000 ints/s)
* 100-1249MB/s bulk (12000 ints/s)
*/
/* what was last interrupt timeslice? */
timepassed_us = q_vector->itr >> 2;
@ -1247,7 +1247,7 @@ static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector)
break;
case bulk_latency:
default:
new_itr = IXGBE_8K_ITR;
new_itr = IXGBE_12K_ITR;
break;
}
@ -1288,7 +1288,7 @@ static irqreturn_t ixgbevf_msix_clean_rings(int irq, void *data)
/* EIAM disabled interrupts (on this vector) for us */
if (q_vector->rx.ring || q_vector->tx.ring)
napi_schedule(&q_vector->napi);
napi_schedule_irqoff(&q_vector->napi);
return IRQ_HANDLED;
}
@ -2260,10 +2260,8 @@ void ixgbevf_reset(struct ixgbevf_adapter *adapter)
}
if (is_valid_ether_addr(adapter->hw.mac.addr)) {
memcpy(netdev->dev_addr, adapter->hw.mac.addr,
netdev->addr_len);
memcpy(netdev->perm_addr, adapter->hw.mac.addr,
netdev->addr_len);
ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);
ether_addr_copy(netdev->perm_addr, adapter->hw.mac.addr);
}
adapter->last_reset = jiffies;
@ -2659,13 +2657,14 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
else if (is_zero_ether_addr(adapter->hw.mac.addr))
dev_info(&pdev->dev,
"MAC address not assigned by administrator.\n");
memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len);
ether_addr_copy(netdev->dev_addr, hw->mac.addr);
}
if (!is_valid_ether_addr(netdev->dev_addr)) {
dev_info(&pdev->dev, "Assigning random MAC address\n");
eth_hw_addr_random(netdev);
memcpy(hw->mac.addr, netdev->dev_addr, netdev->addr_len);
ether_addr_copy(hw->mac.addr, netdev->dev_addr);
ether_addr_copy(hw->mac.perm_addr, netdev->dev_addr);
}
/* Enable dynamic interrupt throttling rates */
@ -3695,8 +3694,8 @@ static int ixgbevf_set_mac(struct net_device *netdev, void *p)
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
memcpy(hw->mac.addr, addr->sa_data, netdev->addr_len);
ether_addr_copy(netdev->dev_addr, addr->sa_data);
ether_addr_copy(hw->mac.addr, addr->sa_data);
spin_lock_bh(&adapter->mbx_lock);

View file

@ -117,7 +117,9 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw)
msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_NACK))
return IXGBE_ERR_INVALID_MAC_ADDR;
ether_addr_copy(hw->mac.perm_addr, addr);
if (msgbuf[0] == (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK))
ether_addr_copy(hw->mac.perm_addr, addr);
hw->mac.mc_filter_type = msgbuf[IXGBE_VF_MC_TYPE_WORD];
return 0;