Commit ae0bf040 authored by David S. Miller's avatar David S. Miller

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

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2014-12-06

This series contains updates to i40e and i40evf.

Shannon provides several patches to cleanup and fix i40e.  First removes
an unneeded break statement in i40e_vsi_link_event().  Then removes
some debug messages that really do not give any useful information and
ends up getting printed every service_task loop, which fills the logfile
with noise when AQ tracing is enabled.  Updates the aq_cmd arguments to
use %i which is much more forgiving and user friendly than the more
restrictive %x, or %d.  Fixes the netdev_stat macro, where the old
xxx_NETDEV_STAT() macro was defined long before the newer
rtnl_link_stats64 came into being, and just never got updated.
Getting the pf_id from the function number had an issue when
when the PF was setup in passthru mode, the PCI bus/device/function
was virtualized and the number in the VM is different from the number in
the bare metal.  This caused HW configuration issues when the wrong pf_id
was used to set up the HMC and other structures.  The PF_FUNC_RID register
has the real bus/device/function information as configured by the BIOS,
so use that for a better number.

Carolyn adds additional text description for the base pf0 and flow
director generated interrupts, since these interrupts are difficult
to distinguish per port on a multi-function device.

Jacob resolves an issue related to images with multiple PFs per
physical port.  We cannot fully support 1588 PTP features, since only
one port should control (i.e. write) the registers at a time.  Doing
so can cause interference of functionality.

Anjali provides several updates to i40e, first adds the Virtual Channel
OP event opcode for CONFIG_RSS, so that the Virtual Channel state
machine can properly decipher status change events.  Then updates the
driver to add (and use) i40e_is_vf macro for future expansion when new
VF MAC types get added.  Adds new update VSI flow to accommodate a
firmware dix with VSI loopback mode.  All VSIs on a VEB should either
have loopback enabled or disabled, a mixed mode is not supported for a
VEB.  Since our driver supports multiple VSIs per PF that need to talk to
each other make sure to enable Loopback for the PF and FDIR VSI as well.

Mitch provides a couple of i40e and i40evf patches.  First updates
i40evf init code more adept at handling when multiple VFs attempt
to initialize simultaneously.

Joe Perches provides a i40e patch which resolves a compile warning
about about frame size being larger than 2048 bytes by reducing the
stack use by using kmemdup and not using a very large struct on the
stack.

v2:
 - Dropped patch 13 & 14 while Mitch reworks the patches based on
   feedback from Ben Hutchings, probably the tryptophan in the turkey
   is to blame for the delay...
 - Added Joe Perches patch which resolves a compile warning about frame
   size
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 99bc5c92 e6c97234
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
#define I40E_MINIMUM_FCOE 1 /* minimum number of QPs for FCoE */ #define I40E_MINIMUM_FCOE 1 /* minimum number of QPs for FCoE */
#endif /* I40E_FCOE */ #endif /* I40E_FCOE */
#define I40E_MAX_AQ_BUF_SIZE 4096 #define I40E_MAX_AQ_BUF_SIZE 4096
#define I40E_AQ_LEN 32 #define I40E_AQ_LEN 128
#define I40E_AQ_WORK_LIMIT 16 #define I40E_AQ_WORK_LIMIT 16
#define I40E_MAX_USER_PRIORITY 8 #define I40E_MAX_USER_PRIORITY 8
#define I40E_DEFAULT_MSG_ENABLE 4 #define I40E_DEFAULT_MSG_ENABLE 4
......
...@@ -51,7 +51,7 @@ static inline bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc) ...@@ -51,7 +51,7 @@ static inline bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc)
static void i40e_adminq_init_regs(struct i40e_hw *hw) static void i40e_adminq_init_regs(struct i40e_hw *hw)
{ {
/* set head and tail registers in our local struct */ /* set head and tail registers in our local struct */
if (hw->mac.type == I40E_MAC_VF) { if (i40e_is_vf(hw)) {
hw->aq.asq.tail = I40E_VF_ATQT1; hw->aq.asq.tail = I40E_VF_ATQT1;
hw->aq.asq.head = I40E_VF_ATQH1; hw->aq.asq.head = I40E_VF_ATQH1;
hw->aq.asq.len = I40E_VF_ATQLEN1; hw->aq.asq.len = I40E_VF_ATQLEN1;
...@@ -956,9 +956,6 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw, ...@@ -956,9 +956,6 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw,
ntu = (rd32(hw, hw->aq.arq.head) & I40E_PF_ARQH_ARQH_MASK); ntu = (rd32(hw, hw->aq.arq.head) & I40E_PF_ARQH_ARQH_MASK);
if (ntu == ntc) { if (ntu == ntc) {
/* nothing to do - shouldn't need to update ring's values */ /* nothing to do - shouldn't need to update ring's values */
i40e_debug(hw,
I40E_DEBUG_AQ_MESSAGE,
"AQRX: Queue is empty.\n");
ret_code = I40E_ERR_ADMIN_QUEUE_NO_WORK; ret_code = I40E_ERR_ADMIN_QUEUE_NO_WORK;
goto clean_arq_element_out; goto clean_arq_element_out;
} }
......
...@@ -550,7 +550,7 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[] = { ...@@ -550,7 +550,7 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[] = {
i40e_status i40e_init_shared_code(struct i40e_hw *hw) i40e_status i40e_init_shared_code(struct i40e_hw *hw)
{ {
i40e_status status = 0; i40e_status status = 0;
u32 reg; u32 port, ari, func_rid;
i40e_set_mac_type(hw); i40e_set_mac_type(hw);
...@@ -563,18 +563,17 @@ i40e_status i40e_init_shared_code(struct i40e_hw *hw) ...@@ -563,18 +563,17 @@ i40e_status i40e_init_shared_code(struct i40e_hw *hw)
hw->phy.get_link_info = true; hw->phy.get_link_info = true;
/* Determine port number */ /* Determine port number and PF number*/
reg = rd32(hw, I40E_PFGEN_PORTNUM); port = (rd32(hw, I40E_PFGEN_PORTNUM) & I40E_PFGEN_PORTNUM_PORT_NUM_MASK)
reg = ((reg & I40E_PFGEN_PORTNUM_PORT_NUM_MASK) >> >> I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT;
I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT); hw->port = (u8)port;
hw->port = (u8)reg; ari = (rd32(hw, I40E_GLPCI_CAPSUP) & I40E_GLPCI_CAPSUP_ARI_EN_MASK) >>
I40E_GLPCI_CAPSUP_ARI_EN_SHIFT;
/* Determine the PF number based on the PCI fn */ func_rid = rd32(hw, I40E_PF_FUNC_RID);
reg = rd32(hw, I40E_GLPCI_CAPSUP); if (ari)
if (reg & I40E_GLPCI_CAPSUP_ARI_EN_MASK) hw->pf_id = (u8)(func_rid & 0xff);
hw->pf_id = (u8)((hw->bus.device << 3) | hw->bus.func);
else else
hw->pf_id = (u8)hw->bus.func; hw->pf_id = (u8)(func_rid & 0x7);
status = i40e_init_nvm(hw); status = i40e_init_nvm(hw);
return status; return status;
...@@ -791,7 +790,7 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw) ...@@ -791,7 +790,7 @@ static enum i40e_media_type i40e_get_media_type(struct i40e_hw *hw)
} }
#define I40E_PF_RESET_WAIT_COUNT_A0 200 #define I40E_PF_RESET_WAIT_COUNT_A0 200
#define I40E_PF_RESET_WAIT_COUNT 100 #define I40E_PF_RESET_WAIT_COUNT 110
/** /**
* i40e_pf_reset - Reset the PF * i40e_pf_reset - Reset the PF
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
......
...@@ -773,7 +773,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, ...@@ -773,7 +773,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
{ {
struct i40e_tx_desc *txd; struct i40e_tx_desc *txd;
union i40e_rx_desc *rxd; union i40e_rx_desc *rxd;
struct i40e_ring ring; struct i40e_ring *ring;
struct i40e_vsi *vsi; struct i40e_vsi *vsi;
int i; int i;
...@@ -792,29 +792,32 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, ...@@ -792,29 +792,32 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
vsi_seid); vsi_seid);
return; return;
} }
if (is_rx_ring)
ring = *vsi->rx_rings[ring_id]; ring = kmemdup(is_rx_ring
else ? vsi->rx_rings[ring_id] : vsi->tx_rings[ring_id],
ring = *vsi->tx_rings[ring_id]; sizeof(*ring), GFP_KERNEL);
if (!ring)
return;
if (cnt == 2) { if (cnt == 2) {
dev_info(&pf->pdev->dev, "vsi = %02i %s ring = %02i\n", dev_info(&pf->pdev->dev, "vsi = %02i %s ring = %02i\n",
vsi_seid, is_rx_ring ? "rx" : "tx", ring_id); vsi_seid, is_rx_ring ? "rx" : "tx", ring_id);
for (i = 0; i < ring.count; i++) { for (i = 0; i < ring->count; i++) {
if (!is_rx_ring) { if (!is_rx_ring) {
txd = I40E_TX_DESC(&ring, i); txd = I40E_TX_DESC(ring, i);
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
" d[%03i] = 0x%016llx 0x%016llx\n", " d[%03i] = 0x%016llx 0x%016llx\n",
i, txd->buffer_addr, i, txd->buffer_addr,
txd->cmd_type_offset_bsz); txd->cmd_type_offset_bsz);
} else if (sizeof(union i40e_rx_desc) == } else if (sizeof(union i40e_rx_desc) ==
sizeof(union i40e_16byte_rx_desc)) { sizeof(union i40e_16byte_rx_desc)) {
rxd = I40E_RX_DESC(&ring, i); rxd = I40E_RX_DESC(ring, i);
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
" d[%03i] = 0x%016llx 0x%016llx\n", " d[%03i] = 0x%016llx 0x%016llx\n",
i, rxd->read.pkt_addr, i, rxd->read.pkt_addr,
rxd->read.hdr_addr); rxd->read.hdr_addr);
} else { } else {
rxd = I40E_RX_DESC(&ring, i); rxd = I40E_RX_DESC(ring, i);
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
" d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n", " d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n",
i, rxd->read.pkt_addr, i, rxd->read.pkt_addr,
...@@ -823,26 +826,26 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, ...@@ -823,26 +826,26 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
} }
} }
} else if (cnt == 3) { } else if (cnt == 3) {
if (desc_n >= ring.count || desc_n < 0) { if (desc_n >= ring->count || desc_n < 0) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"descriptor %d not found\n", desc_n); "descriptor %d not found\n", desc_n);
return; return;
} }
if (!is_rx_ring) { if (!is_rx_ring) {
txd = I40E_TX_DESC(&ring, desc_n); txd = I40E_TX_DESC(ring, desc_n);
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"vsi = %02i tx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n", "vsi = %02i tx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n",
vsi_seid, ring_id, desc_n, vsi_seid, ring_id, desc_n,
txd->buffer_addr, txd->cmd_type_offset_bsz); txd->buffer_addr, txd->cmd_type_offset_bsz);
} else if (sizeof(union i40e_rx_desc) == } else if (sizeof(union i40e_rx_desc) ==
sizeof(union i40e_16byte_rx_desc)) { sizeof(union i40e_16byte_rx_desc)) {
rxd = I40E_RX_DESC(&ring, desc_n); rxd = I40E_RX_DESC(ring, desc_n);
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n", "vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n",
vsi_seid, ring_id, desc_n, vsi_seid, ring_id, desc_n,
rxd->read.pkt_addr, rxd->read.hdr_addr); rxd->read.pkt_addr, rxd->read.hdr_addr);
} else { } else {
rxd = I40E_RX_DESC(&ring, desc_n); rxd = I40E_RX_DESC(ring, desc_n);
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n", "vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n",
vsi_seid, ring_id, desc_n, vsi_seid, ring_id, desc_n,
...@@ -852,6 +855,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, ...@@ -852,6 +855,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
} else { } else {
dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n"); dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n");
} }
kfree(ring);
} }
/** /**
...@@ -1493,7 +1497,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1493,7 +1497,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
if (!desc) if (!desc)
goto command_write_done; goto command_write_done;
cnt = sscanf(&cmd_buf[11], cnt = sscanf(&cmd_buf[11],
"%hx %hx %hx %hx %x %x %x %x %x %x", "%hi %hi %hi %hi %i %i %i %i %i %i",
&desc->flags, &desc->flags,
&desc->opcode, &desc->datalen, &desc->retval, &desc->opcode, &desc->datalen, &desc->retval,
&desc->cookie_high, &desc->cookie_low, &desc->cookie_high, &desc->cookie_low,
...@@ -1541,7 +1545,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1541,7 +1545,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
if (!desc) if (!desc)
goto command_write_done; goto command_write_done;
cnt = sscanf(&cmd_buf[20], cnt = sscanf(&cmd_buf[20],
"%hx %hx %hx %hx %x %x %x %x %x %x %hd", "%hi %hi %hi %hi %i %i %i %i %i %i %hi",
&desc->flags, &desc->flags,
&desc->opcode, &desc->datalen, &desc->retval, &desc->opcode, &desc->datalen, &desc->retval,
&desc->cookie_high, &desc->cookie_low, &desc->cookie_high, &desc->cookie_low,
......
...@@ -40,8 +40,9 @@ struct i40e_stats { ...@@ -40,8 +40,9 @@ struct i40e_stats {
.sizeof_stat = FIELD_SIZEOF(_type, _stat), \ .sizeof_stat = FIELD_SIZEOF(_type, _stat), \
.stat_offset = offsetof(_type, _stat) \ .stat_offset = offsetof(_type, _stat) \
} }
#define I40E_NETDEV_STAT(_net_stat) \ #define I40E_NETDEV_STAT(_net_stat) \
I40E_STAT(struct net_device_stats, #_net_stat, _net_stat) I40E_STAT(struct rtnl_link_stats64, #_net_stat, _net_stat)
#define I40E_PF_STAT(_name, _stat) \ #define I40E_PF_STAT(_name, _stat) \
I40E_STAT(struct i40e_pf, _name, _stat) I40E_STAT(struct i40e_pf, _name, _stat)
#define I40E_VSI_STAT(_name, _stat) \ #define I40E_VSI_STAT(_name, _stat) \
...@@ -1325,6 +1326,10 @@ static int i40e_get_ts_info(struct net_device *dev, ...@@ -1325,6 +1326,10 @@ static int i40e_get_ts_info(struct net_device *dev,
{ {
struct i40e_pf *pf = i40e_netdev_to_pf(dev); struct i40e_pf *pf = i40e_netdev_to_pf(dev);
/* only report HW timestamping if PTP is enabled */
if (!(pf->flags & I40E_FLAG_PTP))
return ethtool_op_get_ts_info(dev, info);
info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE |
SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE |
SOF_TIMESTAMPING_SOFTWARE | SOF_TIMESTAMPING_SOFTWARE |
......
...@@ -38,8 +38,8 @@ static const char i40e_driver_string[] = ...@@ -38,8 +38,8 @@ static const char i40e_driver_string[] =
#define DRV_KERN "-k" #define DRV_KERN "-k"
#define DRV_VERSION_MAJOR 1 #define DRV_VERSION_MAJOR 1
#define DRV_VERSION_MINOR 1 #define DRV_VERSION_MINOR 2
#define DRV_VERSION_BUILD 23 #define DRV_VERSION_BUILD 2
#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
__stringify(DRV_VERSION_MINOR) "." \ __stringify(DRV_VERSION_MINOR) "." \
__stringify(DRV_VERSION_BUILD) DRV_KERN __stringify(DRV_VERSION_BUILD) DRV_KERN
...@@ -4870,9 +4870,11 @@ int i40e_vsi_open(struct i40e_vsi *vsi) ...@@ -4870,9 +4870,11 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
goto err_set_queues; goto err_set_queues;
} else if (vsi->type == I40E_VSI_FDIR) { } else if (vsi->type == I40E_VSI_FDIR) {
snprintf(int_name, sizeof(int_name) - 1, "%s-fdir", snprintf(int_name, sizeof(int_name) - 1, "%s-%s-fdir",
dev_driver_string(&pf->pdev->dev)); dev_driver_string(&pf->pdev->dev),
dev_name(&pf->pdev->dev));
err = i40e_vsi_request_irq(vsi, int_name); err = i40e_vsi_request_irq(vsi, int_name);
} else { } else {
err = -EINVAL; err = -EINVAL;
goto err_setup_rx; goto err_setup_rx;
...@@ -5450,8 +5452,6 @@ static void i40e_vsi_link_event(struct i40e_vsi *vsi, bool link_up) ...@@ -5450,8 +5452,6 @@ static void i40e_vsi_link_event(struct i40e_vsi *vsi, bool link_up)
break; break;
case I40E_VSI_SRIOV: case I40E_VSI_SRIOV:
break;
case I40E_VSI_VMDQ2: case I40E_VSI_VMDQ2:
case I40E_VSI_CTRL: case I40E_VSI_CTRL:
case I40E_VSI_MIRROR: case I40E_VSI_MIRROR:
...@@ -5888,6 +5888,9 @@ static int i40e_reconstitute_veb(struct i40e_veb *veb) ...@@ -5888,6 +5888,9 @@ static int i40e_reconstitute_veb(struct i40e_veb *veb)
if (ret) if (ret)
goto end_reconstitute; goto end_reconstitute;
/* Enable LB mode for the main VSI now that it is on a VEB */
i40e_enable_pf_switch_lb(pf);
/* create the remaining VSIs attached to this VEB */ /* create the remaining VSIs attached to this VEB */
for (v = 0; v < pf->num_alloc_vsi; v++) { for (v = 0; v < pf->num_alloc_vsi; v++) {
if (!pf->vsi[v] || pf->vsi[v] == ctl_vsi) if (!pf->vsi[v] || pf->vsi[v] == ctl_vsi)
...@@ -7797,6 +7800,10 @@ static int i40e_add_vsi(struct i40e_vsi *vsi) ...@@ -7797,6 +7800,10 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)
ctxt.uplink_seid = vsi->uplink_seid; ctxt.uplink_seid = vsi->uplink_seid;
ctxt.connection_type = 0x1; /* regular data port */ ctxt.connection_type = 0x1; /* regular data port */
ctxt.flags = I40E_AQ_VSI_TYPE_PF; ctxt.flags = I40E_AQ_VSI_TYPE_PF;
ctxt.info.valid_sections |=
cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);
ctxt.info.switch_id =
cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB);
i40e_vsi_setup_queue_map(vsi, &ctxt, enabled_tc, true); i40e_vsi_setup_queue_map(vsi, &ctxt, enabled_tc, true);
break; break;
...@@ -8182,7 +8189,15 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type, ...@@ -8182,7 +8189,15 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
else if ((vsi->flags & I40E_VSI_FLAG_VEB_OWNER) == 0) else if ((vsi->flags & I40E_VSI_FLAG_VEB_OWNER) == 0)
veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid, veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid,
vsi->tc_config.enabled_tc); vsi->tc_config.enabled_tc);
if (veb) {
if (vsi->seid != pf->vsi[pf->lan_vsi]->seid) {
dev_info(&vsi->back->pdev->dev,
"%s: New VSI creation error, uplink seid of LAN VSI expected.\n",
__func__);
return NULL;
}
i40e_enable_pf_switch_lb(pf);
}
for (i = 0; i < I40E_MAX_VEB && !veb; i++) { for (i = 0; i < I40E_MAX_VEB && !veb; i++) {
if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid) if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid)
veb = pf->veb[i]; veb = pf->veb[i];
...@@ -9143,9 +9158,10 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -9143,9 +9158,10 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
hw->aq.arq_buf_size = I40E_MAX_AQ_BUF_SIZE; hw->aq.arq_buf_size = I40E_MAX_AQ_BUF_SIZE;
hw->aq.asq_buf_size = I40E_MAX_AQ_BUF_SIZE; hw->aq.asq_buf_size = I40E_MAX_AQ_BUF_SIZE;
pf->adminq_work_limit = I40E_AQ_WORK_LIMIT; pf->adminq_work_limit = I40E_AQ_WORK_LIMIT;
snprintf(pf->misc_int_name, sizeof(pf->misc_int_name) - 1, snprintf(pf->misc_int_name, sizeof(pf->misc_int_name) - 1,
"%s-pf%d:misc", "%s-%s:misc",
dev_driver_string(&pf->pdev->dev), pf->hw.pf_id); dev_driver_string(&pf->pdev->dev), dev_name(&pdev->dev));
err = i40e_init_shared_code(hw); err = i40e_init_shared_code(hw);
if (err) { if (err) {
......
...@@ -424,6 +424,9 @@ int i40e_ptp_get_ts_config(struct i40e_pf *pf, struct ifreq *ifr) ...@@ -424,6 +424,9 @@ int i40e_ptp_get_ts_config(struct i40e_pf *pf, struct ifreq *ifr)
{ {
struct hwtstamp_config *config = &pf->tstamp_config; struct hwtstamp_config *config = &pf->tstamp_config;
if (!(pf->flags & I40E_FLAG_PTP))
return -EOPNOTSUPP;
return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ? return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
-EFAULT : 0; -EFAULT : 0;
} }
...@@ -444,22 +447,12 @@ static int i40e_ptp_set_timestamp_mode(struct i40e_pf *pf, ...@@ -444,22 +447,12 @@ static int i40e_ptp_set_timestamp_mode(struct i40e_pf *pf,
struct hwtstamp_config *config) struct hwtstamp_config *config)
{ {
struct i40e_hw *hw = &pf->hw; struct i40e_hw *hw = &pf->hw;
u32 pf_id, tsyntype, regval; u32 tsyntype, regval;
/* Reserved for future extensions. */ /* Reserved for future extensions. */
if (config->flags) if (config->flags)
return -EINVAL; return -EINVAL;
/* Confirm that 1588 is supported on this PF. */
pf_id = (rd32(hw, I40E_PRTTSYN_CTL0) & I40E_PRTTSYN_CTL0_PF_ID_MASK) >>
I40E_PRTTSYN_CTL0_PF_ID_SHIFT;
if (hw->pf_id != pf_id) {
dev_err(&pf->pdev->dev,
"PF %d attempted to control timestamp mode on port %d, which is owned by PF %d\n",
hw->pf_id, hw->port, pf_id);
return -EPERM;
}
switch (config->tx_type) { switch (config->tx_type) {
case HWTSTAMP_TX_OFF: case HWTSTAMP_TX_OFF:
pf->ptp_tx = false; pf->ptp_tx = false;
...@@ -562,6 +555,9 @@ int i40e_ptp_set_ts_config(struct i40e_pf *pf, struct ifreq *ifr) ...@@ -562,6 +555,9 @@ int i40e_ptp_set_ts_config(struct i40e_pf *pf, struct ifreq *ifr)
struct hwtstamp_config config; struct hwtstamp_config config;
int err; int err;
if (!(pf->flags & I40E_FLAG_PTP))
return -EOPNOTSUPP;
if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
return -EFAULT; return -EFAULT;
...@@ -631,8 +627,22 @@ void i40e_ptp_init(struct i40e_pf *pf) ...@@ -631,8 +627,22 @@ void i40e_ptp_init(struct i40e_pf *pf)
{ {
struct net_device *netdev = pf->vsi[pf->lan_vsi]->netdev; struct net_device *netdev = pf->vsi[pf->lan_vsi]->netdev;
struct i40e_hw *hw = &pf->hw; struct i40e_hw *hw = &pf->hw;
u32 pf_id;
long err; long err;
/* Only one PF is assigned to control 1588 logic per port. Do not
* enable any support for PFs not assigned via PRTTSYN_CTL0.PF_ID
*/
pf_id = (rd32(hw, I40E_PRTTSYN_CTL0) & I40E_PRTTSYN_CTL0_PF_ID_MASK) >>
I40E_PRTTSYN_CTL0_PF_ID_SHIFT;
if (hw->pf_id != pf_id) {
pf->flags &= ~I40E_FLAG_PTP;
dev_info(&pf->pdev->dev, "%s: PTP not supported on %s\n",
__func__,
netdev->name);
return;
}
/* we have to initialize the lock first, since we can't control /* we have to initialize the lock first, since we can't control
* when the user will enter the PHC device entry points * when the user will enter the PHC device entry points
*/ */
......
...@@ -482,6 +482,8 @@ struct i40e_hw { ...@@ -482,6 +482,8 @@ struct i40e_hw {
u32 debug_mask; u32 debug_mask;
}; };
#define i40e_is_vf(_hw) ((_hw)->mac.type == I40E_MAC_VF)
struct i40e_driver_version { struct i40e_driver_version {
u8 major_version; u8 major_version;
u8 minor_version; u8 minor_version;
......
...@@ -79,6 +79,7 @@ enum i40e_virtchnl_ops { ...@@ -79,6 +79,7 @@ enum i40e_virtchnl_ops {
I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
I40E_VIRTCHNL_OP_GET_STATS, I40E_VIRTCHNL_OP_GET_STATS,
I40E_VIRTCHNL_OP_FCOE, I40E_VIRTCHNL_OP_FCOE,
I40E_VIRTCHNL_OP_CONFIG_RSS,
/* PF sends status change events to vfs using /* PF sends status change events to vfs using
* the following op. * the following op.
*/ */
......
...@@ -707,7 +707,6 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr) ...@@ -707,7 +707,6 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr)
wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_VFACTIVE); wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_VFACTIVE);
i40e_flush(hw); i40e_flush(hw);
} }
#ifdef CONFIG_PCI_IOV
/** /**
* i40e_enable_pf_switch_lb * i40e_enable_pf_switch_lb
...@@ -715,7 +714,7 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr) ...@@ -715,7 +714,7 @@ void i40e_reset_vf(struct i40e_vf *vf, bool flr)
* *
* enable switch loop back or die - no point in a return value * enable switch loop back or die - no point in a return value
**/ **/
static void i40e_enable_pf_switch_lb(struct i40e_pf *pf) void i40e_enable_pf_switch_lb(struct i40e_pf *pf)
{ {
struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
struct i40e_vsi_context ctxt; struct i40e_vsi_context ctxt;
...@@ -742,7 +741,6 @@ static void i40e_enable_pf_switch_lb(struct i40e_pf *pf) ...@@ -742,7 +741,6 @@ static void i40e_enable_pf_switch_lb(struct i40e_pf *pf)
__func__, vsi->back->hw.aq.asq_last_status); __func__, vsi->back->hw.aq.asq_last_status);
} }
} }
#endif
/** /**
* i40e_disable_pf_switch_lb * i40e_disable_pf_switch_lb
......
...@@ -126,5 +126,6 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable); ...@@ -126,5 +126,6 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable);
void i40e_vc_notify_link_state(struct i40e_pf *pf); void i40e_vc_notify_link_state(struct i40e_pf *pf);
void i40e_vc_notify_reset(struct i40e_pf *pf); void i40e_vc_notify_reset(struct i40e_pf *pf);
void i40e_enable_pf_switch_lb(struct i40e_pf *pf);
#endif /* _I40E_VIRTCHNL_PF_H_ */ #endif /* _I40E_VIRTCHNL_PF_H_ */
...@@ -49,7 +49,7 @@ static inline bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc) ...@@ -49,7 +49,7 @@ static inline bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc)
static void i40e_adminq_init_regs(struct i40e_hw *hw) static void i40e_adminq_init_regs(struct i40e_hw *hw)
{ {
/* set head and tail registers in our local struct */ /* set head and tail registers in our local struct */
if (hw->mac.type == I40E_MAC_VF) { if (i40e_is_vf(hw)) {
hw->aq.asq.tail = I40E_VF_ATQT1; hw->aq.asq.tail = I40E_VF_ATQT1;
hw->aq.asq.head = I40E_VF_ATQH1; hw->aq.asq.head = I40E_VF_ATQH1;
hw->aq.asq.len = I40E_VF_ATQLEN1; hw->aq.asq.len = I40E_VF_ATQLEN1;
...@@ -905,9 +905,6 @@ i40e_status i40evf_clean_arq_element(struct i40e_hw *hw, ...@@ -905,9 +905,6 @@ i40e_status i40evf_clean_arq_element(struct i40e_hw *hw,
ntu = (rd32(hw, hw->aq.arq.head) & I40E_PF_ARQH_ARQH_MASK); ntu = (rd32(hw, hw->aq.arq.head) & I40E_PF_ARQH_ARQH_MASK);
if (ntu == ntc) { if (ntu == ntc) {
/* nothing to do - shouldn't need to update ring's values */ /* nothing to do - shouldn't need to update ring's values */
i40e_debug(hw,
I40E_DEBUG_AQ_MESSAGE,
"AQRX: Queue is empty.\n");
ret_code = I40E_ERR_ADMIN_QUEUE_NO_WORK; ret_code = I40E_ERR_ADMIN_QUEUE_NO_WORK;
goto clean_arq_element_out; goto clean_arq_element_out;
} }
......
...@@ -476,6 +476,8 @@ struct i40e_hw { ...@@ -476,6 +476,8 @@ struct i40e_hw {
u32 debug_mask; u32 debug_mask;
}; };
#define i40e_is_vf(_hw) ((_hw)->mac.type == I40E_MAC_VF)
struct i40e_driver_version { struct i40e_driver_version {
u8 major_version; u8 major_version;
u8 minor_version; u8 minor_version;
......
...@@ -79,6 +79,7 @@ enum i40e_virtchnl_ops { ...@@ -79,6 +79,7 @@ enum i40e_virtchnl_ops {
I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE, I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
I40E_VIRTCHNL_OP_GET_STATS, I40E_VIRTCHNL_OP_GET_STATS,
I40E_VIRTCHNL_OP_FCOE, I40E_VIRTCHNL_OP_FCOE,
I40E_VIRTCHNL_OP_CONFIG_RSS,
/* PF sends status change events to vfs using /* PF sends status change events to vfs using
* the following op. * the following op.
*/ */
......
...@@ -36,7 +36,7 @@ char i40evf_driver_name[] = "i40evf"; ...@@ -36,7 +36,7 @@ char i40evf_driver_name[] = "i40evf";
static const char i40evf_driver_string[] = static const char i40evf_driver_string[] =
"Intel(R) XL710/X710 Virtual Function Network Driver"; "Intel(R) XL710/X710 Virtual Function Network Driver";
#define DRV_VERSION "1.0.5" #define DRV_VERSION "1.0.6"
const char i40evf_driver_version[] = DRV_VERSION; const char i40evf_driver_version[] = DRV_VERSION;
static const char i40evf_copyright[] = static const char i40evf_copyright[] =
"Copyright (c) 2013 - 2014 Intel Corporation."; "Copyright (c) 2013 - 2014 Intel Corporation.";
...@@ -2045,6 +2045,8 @@ static void i40evf_init_task(struct work_struct *work) ...@@ -2045,6 +2045,8 @@ static void i40evf_init_task(struct work_struct *work)
case __I40EVF_INIT_VERSION_CHECK: case __I40EVF_INIT_VERSION_CHECK:
if (!i40evf_asq_done(hw)) { if (!i40evf_asq_done(hw)) {
dev_err(&pdev->dev, "Admin queue command never completed\n"); dev_err(&pdev->dev, "Admin queue command never completed\n");
i40evf_shutdown_adminq(hw);
adapter->state = __I40EVF_STARTUP;
goto err; goto err;
} }
...@@ -2078,8 +2080,11 @@ static void i40evf_init_task(struct work_struct *work) ...@@ -2078,8 +2080,11 @@ static void i40evf_init_task(struct work_struct *work)
goto err; goto err;
} }
err = i40evf_get_vf_config(adapter); err = i40evf_get_vf_config(adapter);
if (err == I40E_ERR_ADMIN_QUEUE_NO_WORK) if (err == I40E_ERR_ADMIN_QUEUE_NO_WORK) {
goto restart; dev_info(&pdev->dev, "Resending VF config request\n");
err = i40evf_send_vf_config_msg(adapter);
goto err;
}
if (err) { if (err) {
dev_err(&pdev->dev, "Unable to get VF config (%d)\n", dev_err(&pdev->dev, "Unable to get VF config (%d)\n",
err); err);
......
...@@ -715,15 +715,9 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, ...@@ -715,15 +715,9 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
} }
return; return;
} }
if (v_opcode != adapter->current_op) { if (v_opcode != adapter->current_op)
dev_err(&adapter->pdev->dev, "%s: Pending op is %d, received %d\n", dev_info(&adapter->pdev->dev, "Pending op is %d, received %d\n",
__func__, adapter->current_op, v_opcode); adapter->current_op, v_opcode);
/* We're probably completely screwed at this point, but clear
* the current op and try to carry on....
*/
adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
return;
}
if (v_retval) { if (v_retval) {
dev_err(&adapter->pdev->dev, "%s: PF returned error %d to our request %d\n", dev_err(&adapter->pdev->dev, "%s: PF returned error %d to our request %d\n",
__func__, v_retval, v_opcode); __func__, v_retval, v_opcode);
...@@ -775,8 +769,8 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, ...@@ -775,8 +769,8 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
adapter->aq_pending &= ~(I40EVF_FLAG_AQ_MAP_VECTORS); adapter->aq_pending &= ~(I40EVF_FLAG_AQ_MAP_VECTORS);
break; break;
default: default:
dev_warn(&adapter->pdev->dev, "%s: Received unexpected message %d from PF\n", dev_info(&adapter->pdev->dev, "Received unexpected message %d from PF\n",
__func__, v_opcode); v_opcode);
break; break;
} /* switch v_opcode */ } /* switch v_opcode */
adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN; adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment