netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21
@ 2014-11-22  5:54 Jeff Kirsher
  2014-11-22  5:54 ` [net-next 01/17] i40e: Remove unneeded break statement Jeff Kirsher
                   ` (18 more replies)
  0 siblings, 19 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann, jogreene

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.  Adds support for setting the RSS key as
it is now implemented.

The following are changes since commit 1459143386c5d868c87903b8d433a52cffcf3e66:
  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master

Anjali Singhai Jain (4):
  i40e: Add a virtual channel op to config RSS
  i40e: Define and use i40e_is_vf macro
  i40e: Add new update VSI flow to accommodate FW fix with VSI Loopback
    mode
  i40e: Re enable Main VSI loopback setting in the reset path

Carolyn Wyborny (1):
  i40e: Add description to misc and fd interrupts

Catherine Sullivan (1):
  i40e: Bump i40e version to 1.2.2 and i40evf version to 1.0.6

Jacob Keller (1):
  i40e: don't enable PTP support on more than one PF per port

Kevin Scott (1):
  i40e: Increase reset delay

Mitch Williams (4):
  i40evf: make early init sequence even more robust
  i40evf: refactor ethtool RSS handling
  i40e: implement ethtool RSS config
  i40e: increase ARQ size

Shannon Nelson (5):
  i40e: Remove unneeded break statement
  i40e: remove useless debug noise
  i40e: allow various base numbers in debugfs aq commands
  i40e: fix netdev_stat macro definition
  i40e: get pf_id from HW rather than PCI function

 drivers/net/ethernet/intel/i40e/i40e.h             |   2 +-
 drivers/net/ethernet/intel/i40e/i40e_adminq.c      |   5 +-
 drivers/net/ethernet/intel/i40e/i40e_common.c      |  25 +++--
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c     |   4 +-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     | 111 ++++++++++++++++++++-
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  34 +++++--
 drivers/net/ethernet/intel/i40e/i40e_ptp.c         |  32 ++++--
 drivers/net/ethernet/intel/i40e/i40e_type.h        |   2 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl.h    |   1 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |   4 +-
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |   1 +
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c    |   5 +-
 drivers/net/ethernet/intel/i40evf/i40e_type.h      |   2 +
 drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h  |   1 +
 drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c |  66 +++++++++---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    |  11 +-
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    |  16 +--
 17 files changed, 244 insertions(+), 78 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [net-next 01/17] i40e: Remove unneeded break statement
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
@ 2014-11-22  5:54 ` Jeff Kirsher
  2014-11-22  5:58   ` Jeff Kirsher
  2014-11-22  5:54 ` Jeff Kirsher
                   ` (17 subsequent siblings)
  18 siblings, 1 reply; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Shannon Nelson <shannon.nelson@intel.com>

This case statement is empty and the fall through just breaks out
so remove the break and let it fall through to break out.

Change-ID: I1b5ba9870d5245ca80bfca6e7f5f089e2eb8ccb0
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 3913329..308b4b6 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5450,8 +5450,6 @@ static void i40e_vsi_link_event(struct i40e_vsi *vsi, bool link_up)
 		break;
 
 	case I40E_VSI_SRIOV:
-		break;
-
 	case I40E_VSI_VMDQ2:
 	case I40E_VSI_CTRL:
 	case I40E_VSI_MIRROR:
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 01/17] i40e: Remove unneeded break statement
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
  2014-11-22  5:54 ` [net-next 01/17] i40e: Remove unneeded break statement Jeff Kirsher
@ 2014-11-22  5:54 ` Jeff Kirsher
  2014-11-22  5:54 ` [net-next 02/17] i40e: remove useless debug noise Jeff Kirsher
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Shannon Nelson <shannon.nelson@intel.com>

This case statement is empty and the fall through just breaks out
so remove the break and let it fall through to break out.

Change-ID: I1b5ba9870d5245ca80bfca6e7f5f089e2eb8ccb0
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 3913329..308b4b6 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5450,8 +5450,6 @@ static void i40e_vsi_link_event(struct i40e_vsi *vsi, bool link_up)
 		break;
 
 	case I40E_VSI_SRIOV:
-		break;
-
 	case I40E_VSI_VMDQ2:
 	case I40E_VSI_CTRL:
 	case I40E_VSI_MIRROR:
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 02/17] i40e: remove useless debug noise
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
  2014-11-22  5:54 ` [net-next 01/17] i40e: Remove unneeded break statement Jeff Kirsher
  2014-11-22  5:54 ` Jeff Kirsher
@ 2014-11-22  5:54 ` Jeff Kirsher
  2014-11-22  5:54 ` [net-next 03/17] i40e: allow various base numbers in debugfs aq commands Jeff Kirsher
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Shannon Nelson <shannon.nelson@intel.com>

This message really doesn't give any useful information and ends up
getting printed every service_task loop in the Linux driver, filling the
logfile with noise when AQ tracing is enabled.  This patch simply removes
the noise.

Change-ID: I30ad51e6b03c7ad12a7d9c102def0087db622df3
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c   | 3 ---
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
index 5bb4914..5dc12c4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
@@ -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);
 	if (ntu == ntc) {
 		/* 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;
 		goto clean_arq_element_out;
 	}
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
index d7e446f..ff6305a 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
@@ -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);
 	if (ntu == ntc) {
 		/* 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;
 		goto clean_arq_element_out;
 	}
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 03/17] i40e: allow various base numbers in debugfs aq commands
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (2 preceding siblings ...)
  2014-11-22  5:54 ` [net-next 02/17] i40e: remove useless debug noise Jeff Kirsher
@ 2014-11-22  5:54 ` Jeff Kirsher
  2014-11-24 16:50   ` David Laight
  2014-11-22  5:54 ` [net-next 04/17] i40e: Add description to misc and fd interrupts Jeff Kirsher
                   ` (14 subsequent siblings)
  18 siblings, 1 reply; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Shannon Nelson <shannon.nelson@intel.com>

Use the 'i' rather than the more restrictive 'x' or 'd' in the aq_cmd
arguments.  This makes the user interface much more forgiving and user
friendly.

Change-ID: I5dcd57b9befc047e06b74cf1152a25a3fa9e1309
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index 3a3c237..16ac3f8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -1493,7 +1493,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
 		if (!desc)
 			goto command_write_done;
 		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->opcode, &desc->datalen, &desc->retval,
 			     &desc->cookie_high, &desc->cookie_low,
@@ -1541,7 +1541,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
 		if (!desc)
 			goto command_write_done;
 		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->opcode, &desc->datalen, &desc->retval,
 			     &desc->cookie_high, &desc->cookie_low,
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 04/17] i40e: Add description to misc and fd interrupts
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (3 preceding siblings ...)
  2014-11-22  5:54 ` [net-next 03/17] i40e: allow various base numbers in debugfs aq commands Jeff Kirsher
@ 2014-11-22  5:54 ` Jeff Kirsher
  2014-11-22  5:54 ` [net-next 05/17] i40e: don't enable PTP support on more than one PF per port Jeff Kirsher
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem; +Cc: Carolyn Wyborny, netdev, nhorman, sassmann, jogreene,
	Jeff Kirsher

From: Carolyn Wyborny <carolyn.wyborny@intel.com>

This patch adds additional text description for base pf0 and flow director
generated interrupts.  Without this patch, these interrupts are difficult
to distinguish per port on a multi-function device.

Change-ID: I4662e1b38840757765a3fe63d90219d28e76bfab
Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 308b4b6..47631d6 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4870,9 +4870,11 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
 			goto err_set_queues;
 
 	} else if (vsi->type == I40E_VSI_FDIR) {
-		snprintf(int_name, sizeof(int_name) - 1, "%s-fdir",
-			 dev_driver_string(&pf->pdev->dev));
+		snprintf(int_name, sizeof(int_name) - 1, "%s-%s-fdir",
+			 dev_driver_string(&pf->pdev->dev),
+			 dev_name(&pf->pdev->dev));
 		err = i40e_vsi_request_irq(vsi, int_name);
+
 	} else {
 		err = -EINVAL;
 		goto err_setup_rx;
@@ -9196,9 +9198,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.asq_buf_size = I40E_MAX_AQ_BUF_SIZE;
 	pf->adminq_work_limit = I40E_AQ_WORK_LIMIT;
+
 	snprintf(pf->misc_int_name, sizeof(pf->misc_int_name) - 1,
-		 "%s-pf%d:misc",
-		 dev_driver_string(&pf->pdev->dev), pf->hw.pf_id);
+		 "%s-%s:misc",
+		 dev_driver_string(&pf->pdev->dev), dev_name(&pdev->dev));
 
 	err = i40e_init_shared_code(hw);
 	if (err) {
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 05/17] i40e: don't enable PTP support on more than one PF per port
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (4 preceding siblings ...)
  2014-11-22  5:54 ` [net-next 04/17] i40e: Add description to misc and fd interrupts Jeff Kirsher
@ 2014-11-22  5:54 ` Jeff Kirsher
  2014-11-22  5:54 ` [net-next 06/17] i40e: Add a virtual channel op to config RSS Jeff Kirsher
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jacob Keller <jacob.e.keller@intel.com>

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

It may be possible to partially implement the API for only those
features without side effects. However, this at minimum means non
controlling PFs lose Tx timestamps, frequency atunement, and possibly
SYSTIME adjustment. There may be further impact I did not discover.
Since the API in the kernel expects these features to work, it is
simpler and less dangerous to just disable PTP features on all PFs not
identified as the controlling PF in PRTTSYN_CTL0.PF_ID.

This change also removes the warning printed when hwtstaml IOCTL is
called on the wrong PF. This is actually meaningless now, since only one
PF per port will support it. In addition, the ethtool get_ts_info IOCTL
was updated so that only the controlling port will even indicate support
(so as not to confuse users).

The overall downside is complete loss of functionality on non
controlling PF, vs the possible gain of partial support. The biggest
factor for choosing this approach is simplicity and ensuring that the
main PF will work. There could easily be other portions of the 1588
logic with side effects I am not aware, and the reduced functionality
that might be made available is significantly less useful. In addition,
the API does not allow for proper indication of why particular features
are not supported. These reasons are enough to decide for the simpler
approach to resolving this issue.

Change-ID: If4696bae686fc18aef6552b67dd417213d987c16
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  4 ++++
 drivers/net/ethernet/intel/i40e/i40e_ptp.c     | 32 +++++++++++++++++---------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index b2402851..4053b34 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -1325,6 +1325,10 @@ static int i40e_get_ts_info(struct net_device *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 |
 				SOF_TIMESTAMPING_RX_SOFTWARE |
 				SOF_TIMESTAMPING_SOFTWARE |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
index f9151037..6d1ec92 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
@@ -424,6 +424,9 @@ int i40e_ptp_get_ts_config(struct i40e_pf *pf, struct ifreq *ifr)
 {
 	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)) ?
 		-EFAULT : 0;
 }
@@ -444,22 +447,12 @@ static int i40e_ptp_set_timestamp_mode(struct i40e_pf *pf,
 				       struct hwtstamp_config *config)
 {
 	struct i40e_hw *hw = &pf->hw;
-	u32 pf_id, tsyntype, regval;
+	u32 tsyntype, regval;
 
 	/* Reserved for future extensions. */
 	if (config->flags)
 		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) {
 	case HWTSTAMP_TX_OFF:
 		pf->ptp_tx = false;
@@ -562,6 +555,9 @@ int i40e_ptp_set_ts_config(struct i40e_pf *pf, struct ifreq *ifr)
 	struct hwtstamp_config config;
 	int err;
 
+	if (!(pf->flags & I40E_FLAG_PTP))
+		return -EOPNOTSUPP;
+
 	if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
 		return -EFAULT;
 
@@ -631,8 +627,22 @@ void i40e_ptp_init(struct i40e_pf *pf)
 {
 	struct net_device *netdev = pf->vsi[pf->lan_vsi]->netdev;
 	struct i40e_hw *hw = &pf->hw;
+	u32 pf_id;
 	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
 	 * when the user will enter the PHC device entry points
 	 */
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 06/17] i40e: Add a virtual channel op to config RSS
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (5 preceding siblings ...)
  2014-11-22  5:54 ` [net-next 05/17] i40e: don't enable PTP support on more than one PF per port Jeff Kirsher
@ 2014-11-22  5:54 ` Jeff Kirsher
  2014-11-22  5:54 ` [net-next 07/17] i40e: Define and use i40e_is_vf macro Jeff Kirsher
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem
  Cc: Anjali Singhai Jain, netdev, nhorman, sassmann, jogreene,
	Jeff Kirsher

From: Anjali Singhai Jain <anjali.singhai@intel.com>

Add the Virtual Channel OP event opcode for CONFIG_RSS, so that the
Virtual Channel state machine can properly decipher status change events.

Change-ID: I09939c7aa380147f60c49fd01ef2e27d0dc1c299
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Acked-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl.h   | 1 +
 drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h
index 70951d2..61dd1b18 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl.h
@@ -79,6 +79,7 @@ enum i40e_virtchnl_ops {
 	I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
 	I40E_VIRTCHNL_OP_GET_STATS,
 	I40E_VIRTCHNL_OP_FCOE,
+	I40E_VIRTCHNL_OP_CONFIG_RSS,
 /* PF sends status change events to vfs using
  * the following op.
  */
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h b/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h
index cd18d56..e0c8208 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h
@@ -79,6 +79,7 @@ enum i40e_virtchnl_ops {
 	I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE,
 	I40E_VIRTCHNL_OP_GET_STATS,
 	I40E_VIRTCHNL_OP_FCOE,
+	I40E_VIRTCHNL_OP_CONFIG_RSS,
 /* PF sends status change events to vfs using
  * the following op.
  */
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 07/17] i40e: Define and use i40e_is_vf macro
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (6 preceding siblings ...)
  2014-11-22  5:54 ` [net-next 06/17] i40e: Add a virtual channel op to config RSS Jeff Kirsher
@ 2014-11-22  5:54 ` Jeff Kirsher
  2014-11-22  5:54 ` [net-next 08/17] i40e: fix netdev_stat macro definition Jeff Kirsher
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem
  Cc: Anjali Singhai Jain, netdev, nhorman, sassmann, jogreene,
	Jeff Kirsher

From: Anjali Singhai Jain <anjali.singhai@intel.com>

This patch is useful for future expansion when new VF MAC types get
added. It helps with cleaning up VF driver flow.

Change-ID: Ibe1eeb71262a3a40f24a1c5409436bdc3411da7f
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Acked-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c   | 2 +-
 drivers/net/ethernet/intel/i40e/i40e_type.h     | 2 ++
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c | 2 +-
 drivers/net/ethernet/intel/i40evf/i40e_type.h   | 2 ++
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
index 5dc12c4..35fa09a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
@@ -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)
 {
 	/* 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.head = I40E_VF_ATQH1;
 		hw->aq.asq.len  = I40E_VF_ATQLEN1;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index c852143..3904dd8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -482,6 +482,8 @@ struct i40e_hw {
 	u32 debug_mask;
 };
 
+#define i40e_is_vf(_hw)	((_hw)->mac.type == I40E_MAC_VF)
+
 struct i40e_driver_version {
 	u8 major_version;
 	u8 minor_version;
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
index ff6305a..1698994 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq.c
@@ -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)
 {
 	/* 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.head = I40E_VF_ATQH1;
 		hw->aq.asq.len  = I40E_VF_ATQLEN1;
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index 8fe34fc..77abe17 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -476,6 +476,8 @@ struct i40e_hw {
 	u32 debug_mask;
 };
 
+#define i40e_is_vf(_hw)	((_hw)->mac.type == I40E_MAC_VF)
+
 struct i40e_driver_version {
 	u8 major_version;
 	u8 minor_version;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 08/17] i40e: fix netdev_stat macro definition
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (7 preceding siblings ...)
  2014-11-22  5:54 ` [net-next 07/17] i40e: Define and use i40e_is_vf macro Jeff Kirsher
@ 2014-11-22  5:54 ` Jeff Kirsher
  2014-11-22  5:55 ` [net-next 09/17] i40evf: make early init sequence even more robust Jeff Kirsher
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:54 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Shannon Nelson <shannon.nelson@intel.com>

The old xxx_NETDEV_STAT() macro was defined long before the newer
rtnl_link_stats64 came into being, and just never got updated.  Since we're
using rtnl_link_stats64 in other parts of the driver, we should use it
here as well.  We've just been lucky that the field definitions are the
same sizes.

Change-ID: I19fc71619905700235dcdf0d3c8153aec81d36de
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 4053b34..fcd815d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -40,8 +40,9 @@ struct i40e_stats {
 	.sizeof_stat = FIELD_SIZEOF(_type, _stat), \
 	.stat_offset = offsetof(_type, _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) \
 		I40E_STAT(struct i40e_pf, _name, _stat)
 #define I40E_VSI_STAT(_name, _stat) \
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 09/17] i40evf: make early init sequence even more robust
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (8 preceding siblings ...)
  2014-11-22  5:54 ` [net-next 08/17] i40e: fix netdev_stat macro definition Jeff Kirsher
@ 2014-11-22  5:55 ` Jeff Kirsher
  2014-11-22  5:55 ` [net-next 10/17] i40e: Increase reset delay Jeff Kirsher
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:55 UTC (permalink / raw)
  To: davem; +Cc: Mitch Williams, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Mitch Williams <mitch.a.williams@intel.com>

When multiple VFs attempt to initialize simultaneously, the firmware may
delay or drop messages. Make the init code more adept at handling these
situations by a) reinitializing the admin queue if the firmware fails to
process a request, and b) resending a request if the PF doesn't answer.

Once the request has been sent again, the PF might end up getting both
requests and send the configuration information to the driver twice.
This will cause the VF to complain about receiving an unexpected message
from the PF. Since this is not fatal, reduce the warning level of the
log messages that are generated in response to this event.

Change-ID: I9370a1a2fde2ad3934fa25ccfd0545edfbbb4805
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c     |  9 +++++++--
 drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 16 +++++-----------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 8e01009..62456f8 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -2045,6 +2045,8 @@ static void i40evf_init_task(struct work_struct *work)
 	case __I40EVF_INIT_VERSION_CHECK:
 		if (!i40evf_asq_done(hw)) {
 			dev_err(&pdev->dev, "Admin queue command never completed\n");
+			i40evf_shutdown_adminq(hw);
+			adapter->state = __I40EVF_STARTUP;
 			goto err;
 		}
 
@@ -2078,8 +2080,11 @@ static void i40evf_init_task(struct work_struct *work)
 				goto err;
 		}
 		err = i40evf_get_vf_config(adapter);
-		if (err == I40E_ERR_ADMIN_QUEUE_NO_WORK)
-			goto restart;
+		if (err == I40E_ERR_ADMIN_QUEUE_NO_WORK) {
+			dev_info(&pdev->dev, "Resending VF config request\n");
+			err = i40evf_send_vf_config_msg(adapter);
+			goto err;
+		}
 		if (err) {
 			dev_err(&pdev->dev, "Unable to get VF config (%d)\n",
 				err);
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
index 07c13b0..5fde5a7 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
@@ -715,15 +715,9 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
 		}
 		return;
 	}
-	if (v_opcode != adapter->current_op) {
-		dev_err(&adapter->pdev->dev, "%s: Pending op is %d, received %d\n",
-			__func__, 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_opcode != adapter->current_op)
+		dev_info(&adapter->pdev->dev, "Pending op is %d, received %d\n",
+			 adapter->current_op, v_opcode);
 	if (v_retval) {
 		dev_err(&adapter->pdev->dev, "%s: PF returned error %d to our request %d\n",
 			__func__, v_retval, v_opcode);
@@ -775,8 +769,8 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
 		adapter->aq_pending &= ~(I40EVF_FLAG_AQ_MAP_VECTORS);
 		break;
 	default:
-		dev_warn(&adapter->pdev->dev, "%s: Received unexpected message %d from PF\n",
-			 __func__, v_opcode);
+		dev_info(&adapter->pdev->dev, "Received unexpected message %d from PF\n",
+			 v_opcode);
 		break;
 	} /* switch v_opcode */
 	adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 10/17] i40e: Increase reset delay
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (9 preceding siblings ...)
  2014-11-22  5:55 ` [net-next 09/17] i40evf: make early init sequence even more robust Jeff Kirsher
@ 2014-11-22  5:55 ` Jeff Kirsher
  2014-11-22  5:55 ` [net-next 11/17] i40e: Add new update VSI flow to accommodate FW fix with VSI Loopback mode Jeff Kirsher
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:55 UTC (permalink / raw)
  To: davem; +Cc: Kevin Scott, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Kevin Scott <kevin.c.scott@intel.com>

Increase reset delay to ensure all internal caches are properly flushed
in worst case scenario.

Change-ID: I6f059a9e024fbf9ef1debd32497eed21369957fc
Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Acked-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index b601b3c..ec63bcb 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -791,7 +791,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	100
+#define I40E_PF_RESET_WAIT_COUNT	110
 /**
  * i40e_pf_reset - Reset the PF
  * @hw: pointer to the hardware structure
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 11/17] i40e: Add new update VSI flow to accommodate FW fix with VSI Loopback mode
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (10 preceding siblings ...)
  2014-11-22  5:55 ` [net-next 10/17] i40e: Increase reset delay Jeff Kirsher
@ 2014-11-22  5:55 ` Jeff Kirsher
  2014-11-22  5:55 ` [net-next 12/17] i40e: Re enable Main VSI loopback setting in the reset path Jeff Kirsher
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:55 UTC (permalink / raw)
  To: davem
  Cc: Anjali Singhai Jain, netdev, nhorman, sassmann, jogreene,
	Jeff Kirsher

From: Anjali Singhai Jain <anjali.singhai@intel.com>

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.

Also, we now have to explicitly enable Loopback mode otherwise we fail
VSI creation for VMDq and VF VSIs.

Change-ID: Ib68c3ea4aeb730ac9468f930610de456efbe5b20
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 14 +++++++++++++-
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  4 +---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |  1 +
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 47631d6..99be5d0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7852,6 +7852,10 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)
 		ctxt.uplink_seid = vsi->uplink_seid;
 		ctxt.connection_type = 0x1;     /* regular data port */
 		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);
 		break;
 
@@ -8237,7 +8241,15 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
 		else if ((vsi->flags & I40E_VSI_FLAG_VEB_OWNER) == 0)
 			veb = i40e_veb_setup(pf, 0, vsi->uplink_seid, vsi->seid,
 					     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++) {
 			if (pf->veb[i] && pf->veb[i]->seid == vsi->uplink_seid)
 				veb = pf->veb[i];
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 668d860..5bae895 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -707,7 +707,6 @@ complete_reset:
 	wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_VFACTIVE);
 	i40e_flush(hw);
 }
-#ifdef CONFIG_PCI_IOV
 
 /**
  * i40e_enable_pf_switch_lb
@@ -715,7 +714,7 @@ complete_reset:
  *
  * 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_context ctxt;
@@ -742,7 +741,6 @@ static void i40e_enable_pf_switch_lb(struct i40e_pf *pf)
 			 __func__, vsi->back->hw.aq.asq_last_status);
 	}
 }
-#endif
 
 /**
  * i40e_disable_pf_switch_lb
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
index 0adc61e..9452f52 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
@@ -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_reset(struct i40e_pf *pf);
+void i40e_enable_pf_switch_lb(struct i40e_pf *pf);
 
 #endif /* _I40E_VIRTCHNL_PF_H_ */
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 12/17] i40e: Re enable Main VSI loopback setting in the reset path
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (11 preceding siblings ...)
  2014-11-22  5:55 ` [net-next 11/17] i40e: Add new update VSI flow to accommodate FW fix with VSI Loopback mode Jeff Kirsher
@ 2014-11-22  5:55 ` Jeff Kirsher
  2014-11-22  5:55 ` [net-next 13/17] i40evf: refactor ethtool RSS handling Jeff Kirsher
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:55 UTC (permalink / raw)
  To: davem
  Cc: Anjali Singhai Jain, netdev, nhorman, sassmann, jogreene,
	Jeff Kirsher

From: Anjali Singhai Jain <anjali.singhai@intel.com>

There is an order in which this should happen. It turns out that FW will
not let you change the Loopback setting of the VSI with update VSI prior
to the VEB creation.

Change-ID: I7614ddff8b4c37702930c02f16f8c346aaa64bd1
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 99be5d0..a7090f4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5888,6 +5888,9 @@ static int i40e_reconstitute_veb(struct i40e_veb *veb)
 	if (ret)
 		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 */
 	for (v = 0; v < pf->num_alloc_vsi; v++) {
 		if (!pf->vsi[v] || pf->vsi[v] == ctl_vsi)
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 13/17] i40evf: refactor ethtool RSS handling
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (12 preceding siblings ...)
  2014-11-22  5:55 ` [net-next 12/17] i40e: Re enable Main VSI loopback setting in the reset path Jeff Kirsher
@ 2014-11-22  5:55 ` Jeff Kirsher
  2014-11-23  3:44   ` Ben Hutchings
  2014-11-22  5:55 ` [net-next 14/17] i40e: implement ethtool RSS config Jeff Kirsher
                   ` (4 subsequent siblings)
  18 siblings, 1 reply; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:55 UTC (permalink / raw)
  To: davem; +Cc: Mitch Williams, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Mitch Williams <mitch.a.williams@intel.com>

Add support for setting the RSS key as it is now implemented.

Change-ID: I9290ae3ea99d0e46053540650f95e24a24e453f1
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 66 ++++++++++++++++------
 1 file changed, 50 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
index 69a269b..ed0e4dc 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
@@ -608,6 +608,19 @@ static void i40evf_get_channels(struct net_device *netdev,
 	ch->combined_count = adapter->num_active_queues;
 }
 
+#define I40EVF_HLUT_ARRAY_SIZE ((I40E_VFQF_HLUT_MAX_INDEX + 1) * 4)
+#define I40EVF_HKEY_ARRAY_SIZE ((I40E_VFQF_HKEY_MAX_INDEX * 1) * 4)
+/**
+ * i40evf_get_rxfh_key_size - get the RSS hash key size
+ * @netdev: network interface device structure
+ *
+ * Returns the table size.
+ **/
+static u32 i40evf_get_rxfh_key_size(struct net_device *netdev)
+{
+	return I40EVF_HKEY_ARRAY_SIZE;
+}
+
 /**
  * i40evf_get_rxfh_indir_size - get the rx flow hash indirection table size
  * @netdev: network interface device structure
@@ -616,7 +629,7 @@ static void i40evf_get_channels(struct net_device *netdev,
  **/
 static u32 i40evf_get_rxfh_indir_size(struct net_device *netdev)
 {
-	return (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
+	return I40EVF_HLUT_ARRAY_SIZE;
 }
 
 /**
@@ -631,19 +644,28 @@ static int i40evf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
 {
 	struct i40evf_adapter *adapter = netdev_priv(netdev);
 	struct i40e_hw *hw = &adapter->hw;
-	u32 hlut_val;
+	u32 reg_val;
 	int i, j;
 
 	for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
-		hlut_val = rd32(hw, I40E_VFQF_HLUT(i));
-		indir[j++] = hlut_val & 0xff;
-		indir[j++] = (hlut_val >> 8) & 0xff;
-		indir[j++] = (hlut_val >> 16) & 0xff;
-		indir[j++] = (hlut_val >> 24) & 0xff;
+		reg_val = rd32(hw, I40E_VFQF_HLUT(i));
+		indir[j++] = reg_val & 0xff;
+		indir[j++] = (reg_val >> 8) & 0xff;
+		indir[j++] = (reg_val >> 16) & 0xff;
+		indir[j++] = (reg_val >> 24) & 0xff;
+	}
+
+	if (key) {
+		for (i = 0, j = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) {
+			reg_val = rd32(hw, I40E_VFQF_HKEY(i));
+			key[j++] = (u8)(reg_val & 0xff);
+			key[j++] = (u8)((reg_val >> 8) & 0xff);
+			key[j++] = (u8)((reg_val >> 16) & 0xff);
+			key[j++] = (u8)((reg_val >> 24) & 0xff);
+		}
 	}
 	return 0;
 }
-
 /**
  * i40evf_set_rxfh - set the rx flow hash indirection table
  * @netdev: network interface device structure
@@ -658,17 +680,27 @@ static int i40evf_set_rxfh(struct net_device *netdev, const u32 *indir,
 {
 	struct i40evf_adapter *adapter = netdev_priv(netdev);
 	struct i40e_hw *hw = &adapter->hw;
-	u32 hlut_val;
+	u32 reg_val;
 	int i, j;
 
-	for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
-		hlut_val = indir[j++];
-		hlut_val |= indir[j++] << 8;
-		hlut_val |= indir[j++] << 16;
-		hlut_val |= indir[j++] << 24;
-		wr32(hw, I40E_VFQF_HLUT(i), hlut_val);
+	if (indir) {
+		for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
+			reg_val = indir[j++];
+			reg_val |= indir[j++] << 8;
+			reg_val |= indir[j++] << 16;
+			reg_val |= indir[j++] << 24;
+			wr32(hw, I40E_VFQF_HLUT(i), reg_val);
+		}
+	}
+	if (key) {
+		for (i = 0, j = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) {
+			reg_val = key[j++];
+			reg_val |= key[j++] << 8;
+			reg_val |= key[j++] << 16;
+			reg_val |= key[j++] << 24;
+			wr32(hw, I40E_VFQF_HKEY(i), reg_val);
+		}
 	}
-
 	return 0;
 }
 
@@ -687,10 +719,12 @@ static const struct ethtool_ops i40evf_ethtool_ops = {
 	.set_coalesce		= i40evf_set_coalesce,
 	.get_rxnfc		= i40evf_get_rxnfc,
 	.set_rxnfc		= i40evf_set_rxnfc,
+	.get_rxfh_key_size	= i40evf_get_rxfh_key_size,
 	.get_rxfh_indir_size	= i40evf_get_rxfh_indir_size,
 	.get_rxfh		= i40evf_get_rxfh,
 	.set_rxfh		= i40evf_set_rxfh,
 	.get_channels		= i40evf_get_channels,
+
 };
 
 /**
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 14/17] i40e: implement ethtool RSS config
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (13 preceding siblings ...)
  2014-11-22  5:55 ` [net-next 13/17] i40evf: refactor ethtool RSS handling Jeff Kirsher
@ 2014-11-22  5:55 ` Jeff Kirsher
  2014-11-22 18:22   ` Eric Dumazet
  2014-11-23  3:53   ` Ben Hutchings
  2014-11-22  5:55 ` [net-next 15/17] i40e: increase ARQ size Jeff Kirsher
                   ` (3 subsequent siblings)
  18 siblings, 2 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:55 UTC (permalink / raw)
  To: davem; +Cc: Mitch Williams, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Mitch Williams <mitch.a.williams@intel.com>

Support ethtool methods for getting and setting the RSS look-up table.

Change-ID: I52707fb371fc11fe9fd4c287e08542cde38f79d4
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 104 +++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index fcd815d..f9f68ea 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2237,6 +2237,106 @@ static int i40e_set_channels(struct net_device *dev,
 		return -EINVAL;
 }
 
+#define I40E_HLUT_ARRAY_SIZE ((I40E_PFQF_HLUT_MAX_INDEX + 1) * 4)
+#define I40E_HKEY_ARRAY_SIZE ((I40E_PFQF_HKEY_MAX_INDEX * 1) * 4)
+/**
+ * i40e_get_rxfh_key_size - get the RSS hash key size
+ * @netdev: network interface device structure
+ *
+ * Returns the table size.
+ **/
+static u32 i40e_get_rxfh_key_size(struct net_device *netdev)
+{
+	return I40E_HKEY_ARRAY_SIZE;
+}
+
+/**
+ * i40e_get_rxfh_indir_size - get the rx flow hash indirection table size
+ * @netdev: network interface device structure
+ *
+ * Returns the table size.
+ **/
+static u32 i40e_get_rxfh_indir_size(struct net_device *netdev)
+{
+	return I40E_HLUT_ARRAY_SIZE;
+}
+
+/**
+ * i40e_get_rxfh - get the rx flow hash indirection table
+ * @netdev: network interface device structure
+ * @indir: indirection table
+ * @key: hash key
+ *
+ * Reads the indirection table directly from the hardware. Always returns 0.
+ **/
+static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
+{
+	struct i40e_netdev_priv *np = netdev_priv(netdev);
+	struct i40e_vsi *vsi = np->vsi;
+	struct i40e_pf *pf = vsi->back;
+	struct i40e_hw *hw = &pf->hw;
+	u32 reg_val;
+	int i, j;
+
+	for (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {
+		reg_val = rd32(hw, I40E_PFQF_HLUT(i));
+		indir[j++] = reg_val & 0xff;
+		indir[j++] = (reg_val >> 8) & 0xff;
+		indir[j++] = (reg_val >> 16) & 0xff;
+		indir[j++] = (reg_val >> 24) & 0xff;
+	}
+	if (key) {
+		for (i = 0, j = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) {
+			reg_val = rd32(hw, I40E_PFQF_HKEY(i));
+			key[j++] = (u8)(reg_val & 0xff);
+			key[j++] = (u8)((reg_val >> 8) & 0xff);
+			key[j++] = (u8)((reg_val >> 16) & 0xff);
+			key[j++] = (u8)((reg_val >> 24) & 0xff);
+		}
+	}
+	return 0;
+}
+
+/**
+ * i40e_set_rxfh - set the rx flow hash indirection table
+ * @netdev: network interface device structure
+ * @indir: indirection table
+ * @key: hash key
+ *
+ * Returns -EINVAL if the table specifies an inavlid queue id, otherwise
+ * returns 0 after programming the table.
+ **/
+static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,
+			 const u8 *key)
+{
+	struct i40e_netdev_priv *np = netdev_priv(netdev);
+	struct i40e_vsi *vsi = np->vsi;
+	struct i40e_pf *pf = vsi->back;
+	struct i40e_hw *hw = &pf->hw;
+	u32 reg_val;
+	int i, j;
+
+	if (indir) {
+		for (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {
+			reg_val = indir[j++];
+			reg_val |= indir[j++] << 8;
+			reg_val |= indir[j++] << 16;
+			reg_val |= indir[j++] << 24;
+			wr32(hw, I40E_PFQF_HLUT(i), reg_val);
+		}
+	}
+	if (key) {
+		for (i = 0, j = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) {
+			reg_val = key[j++];
+			reg_val |= key[j++] << 8;
+			reg_val |= key[j++] << 16;
+			reg_val |= key[j++] << 24;
+			wr32(hw, I40E_PFQF_HKEY(i), reg_val);
+		}
+	}
+	return 0;
+}
+
 static const struct ethtool_ops i40e_ethtool_ops = {
 	.get_settings		= i40e_get_settings,
 	.set_settings		= i40e_set_settings,
@@ -2265,6 +2365,10 @@ static const struct ethtool_ops i40e_ethtool_ops = {
 	.get_ethtool_stats	= i40e_get_ethtool_stats,
 	.get_coalesce		= i40e_get_coalesce,
 	.set_coalesce		= i40e_set_coalesce,
+	.get_rxfh_key_size	= i40e_get_rxfh_key_size,
+	.get_rxfh_indir_size	= i40e_get_rxfh_indir_size,
+	.get_rxfh		= i40e_get_rxfh,
+	.set_rxfh		= i40e_set_rxfh,
 	.get_channels		= i40e_get_channels,
 	.set_channels		= i40e_set_channels,
 	.get_ts_info		= i40e_get_ts_info,
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 15/17] i40e: increase ARQ size
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (14 preceding siblings ...)
  2014-11-22  5:55 ` [net-next 14/17] i40e: implement ethtool RSS config Jeff Kirsher
@ 2014-11-22  5:55 ` Jeff Kirsher
  2014-11-22  5:55 ` [net-next 16/17] i40e: get pf_id from HW rather than PCI function Jeff Kirsher
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:55 UTC (permalink / raw)
  To: davem; +Cc: Mitch Williams, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Mitch Williams <mitch.a.williams@intel.com>

The ARQ needs to have at least as many entries as VFs, or the VFs will
get errors from the FW when they send messages to the PF. Since we don't
know how many VFs we'll end up with, just set up 128 descriptors.

Change-ID: I04ae3d1c7faf09110eb782214e9c05aeb62a6c59
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 464342a..fc50f64 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -87,7 +87,7 @@
 #define I40E_MINIMUM_FCOE             1 /* minimum number of QPs for FCoE */
 #endif /* I40E_FCOE */
 #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_MAX_USER_PRIORITY        8
 #define I40E_DEFAULT_MSG_ENABLE       4
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 16/17] i40e: get pf_id from HW rather than PCI function
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (15 preceding siblings ...)
  2014-11-22  5:55 ` [net-next 15/17] i40e: increase ARQ size Jeff Kirsher
@ 2014-11-22  5:55 ` Jeff Kirsher
  2014-11-22  5:55 ` [net-next 17/17] i40e: Bump i40e version to 1.2.2 and i40evf version to 1.0.6 Jeff Kirsher
  2014-11-23 19:22 ` [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 David Miller
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:55 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Shannon Nelson <shannon.nelson@intel.com>

Getting the pf_id from the function number was a good place to start,
but 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.  This works in NPAR mode as well.

Change-ID: I65e3dd6c97594890c2bad566b83cc670b1dae534
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: Greg Rose <gregory.v.rose@intel.com>
Acked-by: Kevin Scott <kevin.c.scott@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_common.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index ec63bcb..3d741ee 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -550,7 +550,7 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[] = {
 i40e_status i40e_init_shared_code(struct i40e_hw *hw)
 {
 	i40e_status status = 0;
-	u32 reg;
+	u32 port, ari, func_rid;
 
 	i40e_set_mac_type(hw);
 
@@ -563,18 +563,17 @@ i40e_status i40e_init_shared_code(struct i40e_hw *hw)
 
 	hw->phy.get_link_info = true;
 
-	/* Determine port number */
-	reg = rd32(hw, I40E_PFGEN_PORTNUM);
-	reg = ((reg & I40E_PFGEN_PORTNUM_PORT_NUM_MASK) >>
-	       I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT);
-	hw->port = (u8)reg;
-
-	/* Determine the PF number based on the PCI fn */
-	reg = rd32(hw, I40E_GLPCI_CAPSUP);
-	if (reg & I40E_GLPCI_CAPSUP_ARI_EN_MASK)
-		hw->pf_id = (u8)((hw->bus.device << 3) | hw->bus.func);
+	/* Determine port number and PF number*/
+	port = (rd32(hw, I40E_PFGEN_PORTNUM) & I40E_PFGEN_PORTNUM_PORT_NUM_MASK)
+					   >> I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT;
+	hw->port = (u8)port;
+	ari = (rd32(hw, I40E_GLPCI_CAPSUP) & I40E_GLPCI_CAPSUP_ARI_EN_MASK) >>
+						 I40E_GLPCI_CAPSUP_ARI_EN_SHIFT;
+	func_rid = rd32(hw, I40E_PF_FUNC_RID);
+	if (ari)
+		hw->pf_id = (u8)(func_rid & 0xff);
 	else
-		hw->pf_id = (u8)hw->bus.func;
+		hw->pf_id = (u8)(func_rid & 0x7);
 
 	status = i40e_init_nvm(hw);
 	return status;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [net-next 17/17] i40e: Bump i40e version to 1.2.2 and i40evf version to 1.0.6
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (16 preceding siblings ...)
  2014-11-22  5:55 ` [net-next 16/17] i40e: get pf_id from HW rather than PCI function Jeff Kirsher
@ 2014-11-22  5:55 ` Jeff Kirsher
  2014-11-23 19:22 ` [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 David Miller
  18 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:55 UTC (permalink / raw)
  To: davem; +Cc: Catherine Sullivan, netdev, nhorman, sassmann, jogreene,
	Jeff Kirsher

From: Catherine Sullivan <catherine.sullivan@intel.com>

Bump version.

Change-ID: I4264e81dcfb57ec46a3ede54b0a6cb25b497d3cb
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c     | 4 ++--
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index a7090f4..59bacc2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -38,8 +38,8 @@ static const char i40e_driver_string[] =
 #define DRV_KERN "-k"
 
 #define DRV_VERSION_MAJOR 1
-#define DRV_VERSION_MINOR 1
-#define DRV_VERSION_BUILD 23
+#define DRV_VERSION_MINOR 2
+#define DRV_VERSION_BUILD 2
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD)    DRV_KERN
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 62456f8..cabaf59 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -36,7 +36,7 @@ char i40evf_driver_name[] = "i40evf";
 static const char i40evf_driver_string[] =
 	"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;
 static const char i40evf_copyright[] =
 	"Copyright (c) 2013 - 2014 Intel Corporation.";
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [net-next 01/17] i40e: Remove unneeded break statement
  2014-11-22  5:54 ` [net-next 01/17] i40e: Remove unneeded break statement Jeff Kirsher
@ 2014-11-22  5:58   ` Jeff Kirsher
  0 siblings, 0 replies; 27+ messages in thread
From: Jeff Kirsher @ 2014-11-22  5:58 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

On Fri, 2014-11-21 at 21:54 -0800, Jeff Kirsher wrote:
> From: Shannon Nelson <shannon.nelson@intel.com>
> 
> This case statement is empty and the fall through just breaks out
> so remove the break and let it fall through to break out.
> 
> Change-ID: I1b5ba9870d5245ca80bfca6e7f5f089e2eb8ccb0
> Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 2 --
>  1 file changed, 2 deletions(-)

Disregard this patch, I fixed a mis-spelled word in the patch, but
forgot to cleanup (ie remove) this patch from the group of patches to be
sent.  I have already sent out the "fixed" patch in the series.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [net-next 14/17] i40e: implement ethtool RSS config
  2014-11-22  5:55 ` [net-next 14/17] i40e: implement ethtool RSS config Jeff Kirsher
@ 2014-11-22 18:22   ` Eric Dumazet
  2014-11-23  3:52     ` Ben Hutchings
  2014-11-23  3:53   ` Ben Hutchings
  1 sibling, 1 reply; 27+ messages in thread
From: Eric Dumazet @ 2014-11-22 18:22 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: davem, Mitch Williams, netdev, nhorman, sassmann, jogreene

On Fri, 2014-11-21 at 21:55 -0800, Jeff Kirsher wrote:
> From: Mitch Williams <mitch.a.williams@intel.com>
> 
> Support ethtool methods for getting and setting the RSS look-up table.
> 
> Change-ID: I52707fb371fc11fe9fd4c287e08542cde38f79d4
> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
> Tested-by: Jim Young <jamesx.m.young@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 104 +++++++++++++++++++++++++
>  1 file changed, 104 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index fcd815d..f9f68ea 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -2237,6 +2237,106 @@ static int i40e_set_channels(struct net_device *dev,
>  		return -EINVAL;
>  }
>  
> +#define I40E_HLUT_ARRAY_SIZE ((I40E_PFQF_HLUT_MAX_INDEX + 1) * 4)
> +#define I40E_HKEY_ARRAY_SIZE ((I40E_PFQF_HKEY_MAX_INDEX * 1) * 4)
> +/**
> + * i40e_get_rxfh_key_size - get the RSS hash key size
> + * @netdev: network interface device structure
> + *
> + * Returns the table size.
> + **/
> +static u32 i40e_get_rxfh_key_size(struct net_device *netdev)
> +{
> +	return I40E_HKEY_ARRAY_SIZE;
> +}
> +
> +/**
> + * i40e_get_rxfh_indir_size - get the rx flow hash indirection table size
> + * @netdev: network interface device structure
> + *
> + * Returns the table size.
> + **/
> +static u32 i40e_get_rxfh_indir_size(struct net_device *netdev)
> +{
> +	return I40E_HLUT_ARRAY_SIZE;
> +}
> +
> +/**
> + * i40e_get_rxfh - get the rx flow hash indirection table
> + * @netdev: network interface device structure
> + * @indir: indirection table
> + * @key: hash key
> + *
> + * Reads the indirection table directly from the hardware. Always returns 0.
> + **/
> +static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
> +{
> +	struct i40e_netdev_priv *np = netdev_priv(netdev);
> +	struct i40e_vsi *vsi = np->vsi;
> +	struct i40e_pf *pf = vsi->back;
> +	struct i40e_hw *hw = &pf->hw;
> +	u32 reg_val;
> +	int i, j;
> +
> +	for (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {
> +		reg_val = rd32(hw, I40E_PFQF_HLUT(i));
> +		indir[j++] = reg_val & 0xff;
> +		indir[j++] = (reg_val >> 8) & 0xff;
> +		indir[j++] = (reg_val >> 16) & 0xff;
> +		indir[j++] = (reg_val >> 24) & 0xff;
> +	}
> +	if (key) {
> +		for (i = 0, j = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) {
> +			reg_val = rd32(hw, I40E_PFQF_HKEY(i));
> +			key[j++] = (u8)(reg_val & 0xff);
> +			key[j++] = (u8)((reg_val >> 8) & 0xff);
> +			key[j++] = (u8)((reg_val >> 16) & 0xff);
> +			key[j++] = (u8)((reg_val >> 24) & 0xff);

Nit:

	put_unaligned_le32(reg_val, key + i * 4);

> +		}
> +	}
> +	return 0;
> +}
> +
> +/**
> + * i40e_set_rxfh - set the rx flow hash indirection table
> + * @netdev: network interface device structure
> + * @indir: indirection table
> + * @key: hash key
> + *
> + * Returns -EINVAL if the table specifies an inavlid queue id, otherwise
> + * returns 0 after programming the table.
> + **/
> +static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,
> +			 const u8 *key)
> +{
> +	struct i40e_netdev_priv *np = netdev_priv(netdev);
> +	struct i40e_vsi *vsi = np->vsi;
> +	struct i40e_pf *pf = vsi->back;
> +	struct i40e_hw *hw = &pf->hw;
> +	u32 reg_val;
> +	int i, j;
> +
> +	if (indir) {
> +		for (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {
> +			reg_val = indir[j++];

Shouldn't you check the indir[X] values are in correct range ?

( seems to be between 0 and [pf->rss_size_max - 1] )

> +			reg_val |= indir[j++] << 8;
> +			reg_val |= indir[j++] << 16;
> +			reg_val |= indir[j++] << 24;
> +			wr32(hw, I40E_PFQF_HLUT(i), reg_val);
> +		}
> +	}
> +	if (key) {
> +		for (i = 0, j = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++) {
> +			reg_val = key[j++];
> +			reg_val |= key[j++] << 8;
> +			reg_val |= key[j++] << 16;
> +			reg_val |= key[j++] << 24;

Nit:
		reg_val = get_unaligned_le32(key + i * 4);

> +			wr32(hw, I40E_PFQF_HKEY(i), reg_val);
> +		}
> +	}

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [net-next 13/17] i40evf: refactor ethtool RSS handling
  2014-11-22  5:55 ` [net-next 13/17] i40evf: refactor ethtool RSS handling Jeff Kirsher
@ 2014-11-23  3:44   ` Ben Hutchings
  0 siblings, 0 replies; 27+ messages in thread
From: Ben Hutchings @ 2014-11-23  3:44 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: davem, Mitch Williams, netdev, nhorman, sassmann, jogreene

[-- Attachment #1: Type: text/plain, Size: 2977 bytes --]

On Fri, 2014-11-21 at 21:55 -0800, Jeff Kirsher wrote:
> From: Mitch Williams <mitch.a.williams@intel.com>
> 
> Add support for setting the RSS key as it is now implemented.
> 
> Change-ID: I9290ae3ea99d0e46053540650f95e24a24e453f1
> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
> Tested-by: Jim Young <jamesx.m.young@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 66 ++++++++++++++++------
>  1 file changed, 50 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
> index 69a269b..ed0e4dc 100644
> --- a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
> @@ -608,6 +608,19 @@ static void i40evf_get_channels(struct net_device *netdev,
>  	ch->combined_count = adapter->num_active_queues;
>  }
>  
> +#define I40EVF_HLUT_ARRAY_SIZE ((I40E_VFQF_HLUT_MAX_INDEX + 1) * 4)
> +#define I40EVF_HKEY_ARRAY_SIZE ((I40E_VFQF_HKEY_MAX_INDEX * 1) * 4)

The '* 1' should be '+ 1' as on the previous line?

[...]
> @@ -631,19 +644,28 @@ static int i40evf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
>  {
>  	struct i40evf_adapter *adapter = netdev_priv(netdev);
>  	struct i40e_hw *hw = &adapter->hw;
> -	u32 hlut_val;
> +	u32 reg_val;
>  	int i, j;
>  	for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
> -		hlut_val = rd32(hw, I40E_VFQF_HLUT(i));
> -		indir[j++] = hlut_val & 0xff;
> -		indir[j++] = (hlut_val >> 8) & 0xff;
> -		indir[j++] = (hlut_val >> 16) & 0xff;
> -		indir[j++] = (hlut_val >> 24) & 0xff;
> +		reg_val = rd32(hw, I40E_VFQF_HLUT(i));
> +		indir[j++] = reg_val & 0xff;
> +		indir[j++] = (reg_val >> 8) & 0xff;
> +		indir[j++] = (reg_val >> 16) & 0xff;
> +		indir[j++] = (reg_val >> 24) & 0xff;
> +	}

You need an 'if (indir)' around that block now.

> +	if (key) {
> +		for (i = 0, j = 0; i <= I40E_VFQF_HKEY_MAX_INDEX; i++) {
> +			reg_val = rd32(hw, I40E_VFQF_HKEY(i));
> +			key[j++] = (u8)(reg_val & 0xff);
> +			key[j++] = (u8)((reg_val >> 8) & 0xff);
> +			key[j++] = (u8)((reg_val >> 16) & 0xff);
> +			key[j++] = (u8)((reg_val >> 24) & 0xff);
> +		}
>  	}
>  	return 0;
>  }
> -

You should keep the blank line between functions.

[...]
> @@ -687,10 +719,12 @@ static const struct ethtool_ops i40evf_ethtool_ops = {
>  	.set_coalesce		= i40evf_set_coalesce,
>  	.get_rxnfc		= i40evf_get_rxnfc,
>  	.set_rxnfc		= i40evf_set_rxnfc,
> +	.get_rxfh_key_size	= i40evf_get_rxfh_key_size,
>  	.get_rxfh_indir_size	= i40evf_get_rxfh_indir_size,
>  	.get_rxfh		= i40evf_get_rxfh,
>  	.set_rxfh		= i40evf_set_rxfh,
>  	.get_channels		= i40evf_get_channels,
> +

But you don't need a blank line here.

Ben.

>  };
>  
>  /**

-- 
Ben Hutchings
Never put off till tomorrow what you can avoid all together.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [net-next 14/17] i40e: implement ethtool RSS config
  2014-11-22 18:22   ` Eric Dumazet
@ 2014-11-23  3:52     ` Ben Hutchings
  0 siblings, 0 replies; 27+ messages in thread
From: Ben Hutchings @ 2014-11-23  3:52 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Jeff Kirsher, davem, Mitch Williams, netdev, nhorman, sassmann,
	jogreene

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

On Sat, 2014-11-22 at 10:22 -0800, Eric Dumazet wrote:
> On Fri, 2014-11-21 at 21:55 -0800, Jeff Kirsher wrote:
[...]
> > +static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,
> > +			 const u8 *key)
> > +{
> > +	struct i40e_netdev_priv *np = netdev_priv(netdev);
> > +	struct i40e_vsi *vsi = np->vsi;
> > +	struct i40e_pf *pf = vsi->back;
> > +	struct i40e_hw *hw = &pf->hw;
> > +	u32 reg_val;
> > +	int i, j;
> > +
> > +	if (indir) {
> > +		for (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {
> > +			reg_val = indir[j++];
> 
> Shouldn't you check the indir[X] values are in correct range ?
> 
> ( seems to be between 0 and [pf->rss_size_max - 1] )
[...]

The caller guarantees to do that.

Ben.

-- 
Ben Hutchings
Never put off till tomorrow what you can avoid all together.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [net-next 14/17] i40e: implement ethtool RSS config
  2014-11-22  5:55 ` [net-next 14/17] i40e: implement ethtool RSS config Jeff Kirsher
  2014-11-22 18:22   ` Eric Dumazet
@ 2014-11-23  3:53   ` Ben Hutchings
  1 sibling, 0 replies; 27+ messages in thread
From: Ben Hutchings @ 2014-11-23  3:53 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: davem, Mitch Williams, netdev, nhorman, sassmann, jogreene

[-- Attachment #1: Type: text/plain, Size: 1801 bytes --]

On Fri, 2014-11-21 at 21:55 -0800, Jeff Kirsher wrote:
> From: Mitch Williams <mitch.a.williams@intel.com>
> 
> Support ethtool methods for getting and setting the RSS look-up table.
> 
> Change-ID: I52707fb371fc11fe9fd4c287e08542cde38f79d4
> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
> Tested-by: Jim Young <jamesx.m.young@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 104 +++++++++++++++++++++++++
>  1 file changed, 104 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index fcd815d..f9f68ea 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -2237,6 +2237,106 @@ static int i40e_set_channels(struct net_device *dev,
>  		return -EINVAL;
>  }
>  
> +#define I40E_HLUT_ARRAY_SIZE ((I40E_PFQF_HLUT_MAX_INDEX + 1) * 4)
> +#define I40E_HKEY_ARRAY_SIZE ((I40E_PFQF_HKEY_MAX_INDEX * 1) * 4)

Same typo as in i40evf.

[...]
> +static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
> +{
> +	struct i40e_netdev_priv *np = netdev_priv(netdev);
> +	struct i40e_vsi *vsi = np->vsi;
> +	struct i40e_pf *pf = vsi->back;
> +	struct i40e_hw *hw = &pf->hw;
> +	u32 reg_val;
> +	int i, j;
> +
> +	for (i = 0, j = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {
> +		reg_val = rd32(hw, I40E_PFQF_HLUT(i));
> +		indir[j++] = reg_val & 0xff;
> +		indir[j++] = (reg_val >> 8) & 0xff;
> +		indir[j++] = (reg_val >> 16) & 0xff;
> +		indir[j++] = (reg_val >> 24) & 0xff;
> +	}
[...]

Same missing condition as in i40evf.

Ben.

-- 
Ben Hutchings
Never put off till tomorrow what you can avoid all together.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21
  2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
                   ` (17 preceding siblings ...)
  2014-11-22  5:55 ` [net-next 17/17] i40e: Bump i40e version to 1.2.2 and i40evf version to 1.0.6 Jeff Kirsher
@ 2014-11-23 19:22 ` David Miller
  18 siblings, 0 replies; 27+ messages in thread
From: David Miller @ 2014-11-23 19:22 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann, jogreene

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 21 Nov 2014 21:54:50 -0800

> This series contains updates to i40e and i40evf.

As Ben mentioned, patches #13 and #14 at a minimum need to add a NULL
check against 'indir' in the ethtool handlers in question.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* RE: [net-next 03/17] i40e: allow various base numbers in debugfs aq commands
  2014-11-22  5:54 ` [net-next 03/17] i40e: allow various base numbers in debugfs aq commands Jeff Kirsher
@ 2014-11-24 16:50   ` David Laight
  2014-11-24 17:26     ` Nelson, Shannon
  0 siblings, 1 reply; 27+ messages in thread
From: David Laight @ 2014-11-24 16:50 UTC (permalink / raw)
  To: 'Jeff Kirsher', davem@davemloft.net
  Cc: Shannon Nelson, netdev@vger.kernel.org, nhorman@redhat.com,
	sassmann@redhat.com, jogreene@redhat.com

From: Jeff Kirsher
> From: Shannon Nelson <shannon.nelson@intel.com>
> 
> Use the 'i' rather than the more restrictive 'x' or 'd' in the aq_cmd
> arguments.  This makes the user interface much more forgiving and user
> friendly.
> 
> Change-ID: I5dcd57b9befc047e06b74cf1152a25a3fa9e1309
> Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> index 3a3c237..16ac3f8 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> @@ -1493,7 +1493,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
>  		if (!desc)
>  			goto command_write_done;
>  		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",

Isn't that an API change?
Anything that used to specify "10" will now get 10 instead of 16.

So if this has been in a release kernel you probably shouldn't change it.

	David

>  			     &desc->flags,
>  			     &desc->opcode, &desc->datalen, &desc->retval,
>  			     &desc->cookie_high, &desc->cookie_low,
> @@ -1541,7 +1541,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
>  		if (!desc)
>  			goto command_write_done;
>  		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->opcode, &desc->datalen, &desc->retval,
>  			     &desc->cookie_high, &desc->cookie_low,
> --
> 1.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* RE: [net-next 03/17] i40e: allow various base numbers in debugfs aq commands
  2014-11-24 16:50   ` David Laight
@ 2014-11-24 17:26     ` Nelson, Shannon
  0 siblings, 0 replies; 27+ messages in thread
From: Nelson, Shannon @ 2014-11-24 17:26 UTC (permalink / raw)
  To: David Laight, Kirsher, Jeffrey T, davem@davemloft.net
  Cc: netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com

> -----Original Message-----
> From: David Laight [mailto:David.Laight@ACULAB.COM]
> Sent: Monday, November 24, 2014 8:51 AM
> To: Kirsher, Jeffrey T; davem@davemloft.net
> Cc: Nelson, Shannon; netdev@vger.kernel.org; nhorman@redhat.com;
> sassmann@redhat.com; jogreene@redhat.com
> Subject: RE: [net-next 03/17] i40e: allow various base numbers in
> debugfs aq commands
> 
> From: Jeff Kirsher
> > From: Shannon Nelson <shannon.nelson@intel.com>
> >
> > Use the 'i' rather than the more restrictive 'x' or 'd' in the aq_cmd
> > arguments.  This makes the user interface much more forgiving and user
> > friendly.
> >
> > Change-ID: I5dcd57b9befc047e06b74cf1152a25a3fa9e1309
> > Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> > ---
> >  drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> > b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> > index 3a3c237..16ac3f8 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
> > @@ -1493,7 +1493,7 @@ static ssize_t i40e_dbg_command_write(struct
> file *filp,
> >  		if (!desc)
> >  			goto command_write_done;
> >  		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",
> 
> Isn't that an API change?
> Anything that used to specify "10" will now get 10 instead of 16.
> 
> So if this has been in a release kernel you probably shouldn't change
> it.
> 
> 	David

Thanks, David, for looking through our code.

If this were in any other part of the kernel, I would agree with you.  However, this is in our debugfs module, which is not intended for general use.  Following the original definition, there is no expectation of a stable ABI - of course, as discussed in http://lwn.net/Articles/309298/ this is a bit of a pipe dream, but the concept does remain.  As it is, we have already removed a couple of commands, and will likely remove more in the near future as more features are exposed in ethtool and other more standard tools.

The other mitigating factors in my mind are that (a) this is still a very new device, only been in customer hands for a short time, and (b) this particular command is painfully obtuse.  Probably not many have figured out that it is there or how to use it, and the input specs were inconsistent (note the %hd at the end of the second sscanf()).  This patch gives the UI more consistency with standard UI concepts for the aspect of least-surprise, eg forces express base-16 and base-8 format, and it gets this fix in before others likely have run into it.

sln

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2014-11-24 17:26 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-22  5:54 [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 Jeff Kirsher
2014-11-22  5:54 ` [net-next 01/17] i40e: Remove unneeded break statement Jeff Kirsher
2014-11-22  5:58   ` Jeff Kirsher
2014-11-22  5:54 ` Jeff Kirsher
2014-11-22  5:54 ` [net-next 02/17] i40e: remove useless debug noise Jeff Kirsher
2014-11-22  5:54 ` [net-next 03/17] i40e: allow various base numbers in debugfs aq commands Jeff Kirsher
2014-11-24 16:50   ` David Laight
2014-11-24 17:26     ` Nelson, Shannon
2014-11-22  5:54 ` [net-next 04/17] i40e: Add description to misc and fd interrupts Jeff Kirsher
2014-11-22  5:54 ` [net-next 05/17] i40e: don't enable PTP support on more than one PF per port Jeff Kirsher
2014-11-22  5:54 ` [net-next 06/17] i40e: Add a virtual channel op to config RSS Jeff Kirsher
2014-11-22  5:54 ` [net-next 07/17] i40e: Define and use i40e_is_vf macro Jeff Kirsher
2014-11-22  5:54 ` [net-next 08/17] i40e: fix netdev_stat macro definition Jeff Kirsher
2014-11-22  5:55 ` [net-next 09/17] i40evf: make early init sequence even more robust Jeff Kirsher
2014-11-22  5:55 ` [net-next 10/17] i40e: Increase reset delay Jeff Kirsher
2014-11-22  5:55 ` [net-next 11/17] i40e: Add new update VSI flow to accommodate FW fix with VSI Loopback mode Jeff Kirsher
2014-11-22  5:55 ` [net-next 12/17] i40e: Re enable Main VSI loopback setting in the reset path Jeff Kirsher
2014-11-22  5:55 ` [net-next 13/17] i40evf: refactor ethtool RSS handling Jeff Kirsher
2014-11-23  3:44   ` Ben Hutchings
2014-11-22  5:55 ` [net-next 14/17] i40e: implement ethtool RSS config Jeff Kirsher
2014-11-22 18:22   ` Eric Dumazet
2014-11-23  3:52     ` Ben Hutchings
2014-11-23  3:53   ` Ben Hutchings
2014-11-22  5:55 ` [net-next 15/17] i40e: increase ARQ size Jeff Kirsher
2014-11-22  5:55 ` [net-next 16/17] i40e: get pf_id from HW rather than PCI function Jeff Kirsher
2014-11-22  5:55 ` [net-next 17/17] i40e: Bump i40e version to 1.2.2 and i40evf version to 1.0.6 Jeff Kirsher
2014-11-23 19:22 ` [net-next 00/17][pull request] Intel Wired LAN Driver Updates 2014-11-21 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).