All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25
@ 2015-11-25 18:21 Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 01/15] fm10k: use napi_schedule_irqoff() Jeff Kirsher
                   ` (15 more replies)
  0 siblings, 16 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann, jogreene, john.ronciak

This series contains updates to fm10k, i40e and i40evf.

Alex Duyck fixes up fm10k to use napi_schedule_irqoff() instead of
napi_schedule() since the function it is called from runs from hard interrupt
context or with interrupts already disabled in netpoll.

Shannon cleans up i40e and i40evf unused cd_tunneling parameter and any code
comments that refer to it.  Then clean up a few instances of BUG_ON, based
on a Linux diatribe, especially when WARN_ON can be used.

Helin fixed a issue where using ethtool RXNFC command could let receive
flow hash could be set on disabled queues, so resolve by returning the
number of enabled queues before setting RXNFC.

Anjali fixes a MSS issue where the hardware/NVM sets a limit of no less than
256 bytes for MSS, yet the stack can send as low as 76 byte MSS.  Fixed the
issue by lowering the hardware limit to 64 bytes to avoid MDDs from firing
and causing a reset when the MSS is lower than 256.  Added a statistic to
track how many times we forced to do a write back on transmit if the
number of descriptors pending are less than a cache line.

Catherine fixes link status changes, where polling would only change link
status changes in one direction depending on what the last old data saved
off was.  This was due to the watchdog only calling link_event and not
handle_link_event.

Mitch cleans up and enhances error messages related to VF MAC/VLAN filters.

v2: Dropped patch "i40e: Properly cast type for arithmetic" patch
    based on feedback from the community

The following are changes since commit 9458ceab49179b7fd2d5192fd9dcf316ca195dc0:
  net: phy: bcm7xxx: Add entry for Broadcom BCM7435
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue master

Alexander Duyck (1):
  fm10k: use napi_schedule_irqoff()

Anjali Singhai Jain (2):
  i40e: Workaround fix for mss < 256 issue
  i40e/i40evf: Add a stat to track how many times we have to do a force
    WB

Catherine Sullivan (2):
  i40e: Move the saving of old link info from handle_link_event to
    link_event
  i40e: Bump version to 1.4.2

Helin Zhang (4):
  i40e/i40evf: Add comment to #endif
  i40e: return the number of enabled queues for ETHTOOL_GRXRINGS
  i40e: rework the functions to configure RSS with similar parameters
  i40e: create a generic configure rss function

Mitch Williams (2):
  i40e/i40evf: clean up error messages
  i40evf: handle many MAC filters correctly

Shannon Nelson (4):
  i40e/i40evf: remove unused tunnel parameter
  i40e: Change BUG_ON to WARN_ON in service event complete
  i40e: remove BUG_ON from feature string building
  i40e: remove BUG_ON from FCoE setup

 drivers/net/ethernet/intel/fm10k/fm10k_pci.c       |   2 +-
 drivers/net/ethernet/intel/i40e/i40e.h             |   4 +
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h  |   2 +-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |  76 +++---
 drivers/net/ethernet/intel/i40e/i40e_fcoe.c        |   2 -
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 255 ++++++++++++++++-----
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |  15 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.h        |   1 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  21 +-
 .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h    |   2 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c      |  12 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h      |   1 +
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    |  58 ++++-
 13 files changed, 311 insertions(+), 140 deletions(-)

-- 
2.5.0

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

* [net-next v2 01/15] fm10k: use napi_schedule_irqoff()
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 02/15] i40e/i40evf: remove unused tunnel parameter Jeff Kirsher
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Alexander Duyck <aduyck@mirantis.com>

The fm10k_msix_clean_rings function runs from hard interrupt context or
with interrupts already disabled in netpoll.

It can use napi_schedule_irqoff() instead of napi_schedule()

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 74be792..5fbffba 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -846,7 +846,7 @@ static irqreturn_t fm10k_msix_clean_rings(int __always_unused irq, void *data)
 	struct fm10k_q_vector *q_vector = data;
 
 	if (q_vector->rx.count || q_vector->tx.count)
-		napi_schedule(&q_vector->napi);
+		napi_schedule_irqoff(&q_vector->napi);
 
 	return IRQ_HANDLED;
 }
-- 
2.5.0

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

* [net-next v2 02/15] i40e/i40evf: remove unused tunnel parameter
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 01/15] fm10k: use napi_schedule_irqoff() Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 03/15] i40e: Change BUG_ON to WARN_ON in service event complete Jeff Kirsher
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

Code was moved into a separate function some time ago.

Change-ID: Icabbe71ce05cf5d716d3e1152cdd9cd41d11bcb5
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 11 ++++-------
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c |  8 +++-----
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 6649ce4..98680b6 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2186,14 +2186,12 @@ out:
  * @tx_ring:  ptr to the ring to send
  * @skb:      ptr to the skb we're sending
  * @hdr_len:  ptr to the size of the packet header
- * @cd_type_cmd_tso_mss: ptr to u64 object
- * @cd_tunneling: ptr to context descriptor bits
+ * @cd_type_cmd_tso_mss: Quad Word 1
  *
  * Returns 0 if no TSO can happen, 1 if tso is going, or error
  **/
 static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
-		    u8 *hdr_len, u64 *cd_type_cmd_tso_mss,
-		    u32 *cd_tunneling)
+		    u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
 {
 	u32 cd_cmd, cd_tso_len, cd_mss;
 	struct ipv6hdr *ipv6h;
@@ -2246,7 +2244,7 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
  * @tx_ring:  ptr to the ring to send
  * @skb:      ptr to the skb we're sending
  * @tx_flags: the collected send information
- * @cd_type_cmd_tso_mss: ptr to u64 object
+ * @cd_type_cmd_tso_mss: Quad Word 1
  *
  * Returns 0 if no Tx timestamp can happen and 1 if the timestamp will happen
  **/
@@ -2825,8 +2823,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
 	else if (protocol == htons(ETH_P_IPV6))
 		tx_flags |= I40E_TX_FLAGS_IPV6;
 
-	tso = i40e_tso(tx_ring, skb, &hdr_len,
-		       &cd_type_cmd_tso_mss, &cd_tunneling);
+	tso = i40e_tso(tx_ring, skb, &hdr_len, &cd_type_cmd_tso_mss);
 
 	if (tso < 0)
 		goto out_drop;
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index 77968b1..a4eea08 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -1436,13 +1436,12 @@ out:
  * @tx_ring:  ptr to the ring to send
  * @skb:      ptr to the skb we're sending
  * @hdr_len:  ptr to the size of the packet header
- * @cd_tunneling: ptr to context descriptor bits
+ * @cd_type_cmd_tso_mss: Quad Word 1
  *
  * Returns 0 if no TSO can happen, 1 if tso is going, or error
  **/
 static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
-		    u8 *hdr_len, u64 *cd_type_cmd_tso_mss,
-		    u32 *cd_tunneling)
+		    u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
 {
 	u32 cd_cmd, cd_tso_len, cd_mss;
 	struct ipv6hdr *ipv6h;
@@ -1979,8 +1978,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
 	else if (protocol == htons(ETH_P_IPV6))
 		tx_flags |= I40E_TX_FLAGS_IPV6;
 
-	tso = i40e_tso(tx_ring, skb, &hdr_len,
-		       &cd_type_cmd_tso_mss, &cd_tunneling);
+	tso = i40e_tso(tx_ring, skb, &hdr_len, &cd_type_cmd_tso_mss);
 
 	if (tso < 0)
 		goto out_drop;
-- 
2.5.0

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

* [net-next v2 03/15] i40e: Change BUG_ON to WARN_ON in service event complete
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 01/15] fm10k: use napi_schedule_irqoff() Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 02/15] i40e/i40evf: remove unused tunnel parameter Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 04/15] i40e: remove BUG_ON from feature string building Jeff Kirsher
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

There's no need to kill the thread and eventually the kernel in this
case.  In fact, the remainder of the code won't hurt anything anyway,
so just complain that we're here and move along.

Prompted by a recent Linus diatribe.

Change-ID: Iec020d8bcfedffc1cd2553cc6905fd915bb3e670
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index b825f97..7715c54 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -5738,7 +5738,7 @@ static void i40e_handle_lan_overflow_event(struct i40e_pf *pf,
  **/
 static void i40e_service_event_complete(struct i40e_pf *pf)
 {
-	BUG_ON(!test_bit(__I40E_SERVICE_SCHED, &pf->state));
+	WARN_ON(!test_bit(__I40E_SERVICE_SCHED, &pf->state));
 
 	/* flush memory to make sure state is correct before next watchog */
 	smp_mb__before_atomic();
-- 
2.5.0

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

* [net-next v2 04/15] i40e: remove BUG_ON from feature string building
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (2 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 03/15] i40e: Change BUG_ON to WARN_ON in service event complete Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:26   ` Sergei Shtylyov
  2015-11-25 18:21 ` [net-next v2 05/15] i40e: remove BUG_ON from FCoE setup Jeff Kirsher
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

There's really no reason to kill the kernel thread just because of a
little info string. This reworks the code to use snprintf's limiting to
assure that the string is never too long, and WARN_ON to still put out
a warning that we might want to look at the feature list length.

Prompted by a recent Linus diatribe.

Change-ID: If52ba5ca1c2344d8bf454a31bbb805eb5d2c5802
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 34 +++++++++++++++--------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 7715c54..7a4595a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -10111,10 +10111,12 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)
 }
 
 #define INFO_STRING_LEN 255
+#define REMAIN(__x) (INFO_STRING_LEN - (__x))
 static void i40e_print_features(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = &pf->hw;
 	char *buf, *string;
+	int i = 0;
 
 	string = kzalloc(INFO_STRING_LEN, GFP_KERNEL);
 	if (!string) {
@@ -10124,42 +10126,42 @@ static void i40e_print_features(struct i40e_pf *pf)
 
 	buf = string;
 
-	buf += sprintf(string, "Features: PF-id[%d] ", hw->pf_id);
+	i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id);
 #ifdef CONFIG_PCI_IOV
-	buf += sprintf(buf, "VFs: %d ", pf->num_req_vfs);
+	i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf->num_req_vfs);
 #endif
-	buf += sprintf(buf, "VSIs: %d QP: %d RX: %s ",
-		       pf->hw.func_caps.num_vsis,
-		       pf->vsi[pf->lan_vsi]->num_queue_pairs,
-		       pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
+	i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ",
+		      pf->hw.func_caps.num_vsis,
+		      pf->vsi[pf->lan_vsi]->num_queue_pairs,
+		      pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
 
 	if (pf->flags & I40E_FLAG_RSS_ENABLED)
-		buf += sprintf(buf, "RSS ");
+		i += snprintf(&buf[i], REMAIN(i), "RSS ");
 	if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
-		buf += sprintf(buf, "FD_ATR ");
+		i += snprintf(&buf[i], REMAIN(i), "FD_ATR ");
 	if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
-		buf += sprintf(buf, "FD_SB ");
-		buf += sprintf(buf, "NTUPLE ");
+		i += snprintf(&buf[i], REMAIN(i), "FD_SB ");
+		i += snprintf(&buf[i], REMAIN(i), "NTUPLE ");
 	}
 	if (pf->flags & I40E_FLAG_DCB_CAPABLE)
-		buf += sprintf(buf, "DCB ");
+		i += snprintf(&buf[i], REMAIN(i), "DCB ");
 #if IS_ENABLED(CONFIG_VXLAN)
-	buf += sprintf(buf, "VxLAN ");
+	i += snprintf(&buf[i], REMAIN(i), "VxLAN ");
 #endif
 	if (pf->flags & I40E_FLAG_PTP)
-		buf += sprintf(buf, "PTP ");
+		i += snprintf(&buf[i], REMAIN(i), "PTP ");
 #ifdef I40E_FCOE
 	if (pf->flags & I40E_FLAG_FCOE_ENABLED)
-		buf += sprintf(buf, "FCOE ");
+		i += snprintf(&buf[i], REMAIN(i), "FCOE ");
 #endif
 	if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
-		buf += sprintf(buf, "VEB ");
+		i += snprintf(&buf[i], REMAIN(i), "VEPA ");
 	else
 		buf += sprintf(buf, "VEPA ");
 
-	BUG_ON(buf > (string + INFO_STRING_LEN));
 	dev_info(&pf->pdev->dev, "%s\n", string);
 	kfree(string);
+	WARN_ON(i > INFO_STRING_LEN);
 }
 
 /**
-- 
2.5.0

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

* [net-next v2 05/15] i40e: remove BUG_ON from FCoE setup
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (3 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 04/15] i40e: remove BUG_ON from feature string building Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 06/15] i40e: Workaround fix for mss < 256 issue Jeff Kirsher
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

There's no need to kill the kernel thread here. If this condition was
true, the probe() would have died long before we got here. In any case,
we'll get the same result when this code tries to use the VSI pointer
being checked.

Prompted by a recent Linus diatribe.

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

diff --git a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
index fe5d9bf..579a46c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_fcoe.c
@@ -1544,8 +1544,6 @@ void i40e_fcoe_vsi_setup(struct i40e_pf *pf)
 	if (!(pf->flags & I40E_FLAG_FCOE_ENABLED))
 		return;
 
-	BUG_ON(!pf->vsi[pf->lan_vsi]);
-
 	for (i = 0; i < pf->num_alloc_vsi; i++) {
 		vsi = pf->vsi[i];
 		if (vsi && vsi->type == I40E_VSI_FCOE) {
-- 
2.5.0

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

* [net-next v2 06/15] i40e: Workaround fix for mss < 256 issue
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (4 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 05/15] i40e: remove BUG_ON from FCoE setup Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 07/15] i40e/i40evf: Add a stat to track how many times we have to do a force WB Jeff Kirsher
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem
  Cc: Anjali Singhai Jain, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

HW/NVM sets a limit of no less than 256 bytes for MSS. Stack can send as
low as 76 bytes MSS. This patch lowers the HW limit to 64 bytes to avoid
MDDs from firing and causing a reset when the MSS is lower than 256.

Change-ID: I36b500a6bb227d283c3e321a7718e0672b11fab0
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 7a4595a..781a6f4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6685,6 +6685,7 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
 	struct i40e_hw *hw = &pf->hw;
 	u8 set_fc_aq_fail = 0;
 	i40e_status ret;
+	u32 val;
 	u32 v;
 
 	/* Now we wait for GRST to settle out.
@@ -6823,6 +6824,20 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
 		}
 	}
 
+	/* Reconfigure hardware for allowing smaller MSS in the case
+	 * of TSO, so that we avoid the MDD being fired and causing
+	 * a reset in the case of small MSS+TSO.
+	 */
+#define I40E_REG_MSS          0x000E64DC
+#define I40E_REG_MSS_MIN_MASK 0x3FF0000
+#define I40E_64BYTE_MSS       0x400000
+	val = rd32(hw, I40E_REG_MSS);
+	if ((val & I40E_REG_MSS_MIN_MASK) > I40E_64BYTE_MSS) {
+		val &= ~I40E_REG_MSS_MIN_MASK;
+		val |= I40E_64BYTE_MSS;
+		wr32(hw, I40E_REG_MSS, val);
+	}
+
 	if (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) ||
 	    (pf->hw.aq.fw_maj_ver < 4)) {
 		msleep(75);
@@ -10185,6 +10200,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	u16 link_status;
 	int err;
 	u32 len;
+	u32 val;
 	u32 i;
 	u8 set_fc_aq_fail;
 
@@ -10489,6 +10505,17 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 			 i40e_stat_str(&pf->hw, err),
 			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
 
+	/* Reconfigure hardware for allowing smaller MSS in the case
+	 * of TSO, so that we avoid the MDD being fired and causing
+	 * a reset in the case of small MSS+TSO.
+	 */
+	val = rd32(hw, I40E_REG_MSS);
+	if ((val & I40E_REG_MSS_MIN_MASK) > I40E_64BYTE_MSS) {
+		val &= ~I40E_REG_MSS_MIN_MASK;
+		val |= I40E_64BYTE_MSS;
+		wr32(hw, I40E_REG_MSS, val);
+	}
+
 	if (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) ||
 	    (pf->hw.aq.fw_maj_ver < 4)) {
 		msleep(75);
-- 
2.5.0

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

* [net-next v2 07/15] i40e/i40evf: Add a stat to track how many times we have to do a force WB
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (5 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 06/15] i40e: Workaround fix for mss < 256 issue Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 08/15] i40e: Move the saving of old link info from handle_link_event to link_event Jeff Kirsher
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem
  Cc: Anjali Singhai Jain, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

When in NAPI with interrupts disabled, the HW needs to be forced to do a
write back on TX if the number of descriptors pending are less than a
cache line.

This stat helps keep track of how many times we get into this situation.

Change-ID: I76c1bcc7ebccd6bffcc5aa33bfe05f2fa1c9a984
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h         | 1 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 5 ++++-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 4 +++-
 drivers/net/ethernet/intel/i40e/i40e_txrx.h    | 1 +
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c  | 4 +++-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h  | 1 +
 7 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 4dd3e26..ca07a7b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -487,6 +487,7 @@ struct i40e_vsi {
 	u32 tx_restart;
 	u32 tx_busy;
 	u64 tx_linearize;
+	u64 tx_force_wb;
 	u32 rx_buf_failed;
 	u32 rx_page_failed;
 
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 3f385ff..eeb1af4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -88,6 +88,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {
 	I40E_VSI_STAT("tx_broadcast", eth_stats.tx_broadcast),
 	I40E_VSI_STAT("rx_unknown_protocol", eth_stats.rx_unknown_protocol),
 	I40E_VSI_STAT("tx_linearize", tx_linearize),
+	I40E_VSI_STAT("tx_force_wb", tx_force_wb),
 };
 
 /* These PF_STATs might look like duplicates of some NETDEV_STATs,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 781a6f4..0e6abc2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -881,6 +881,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	u64 bytes, packets;
 	unsigned int start;
 	u64 tx_linearize;
+	u64 tx_force_wb;
 	u64 rx_p, rx_b;
 	u64 tx_p, tx_b;
 	u16 q;
@@ -899,7 +900,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	 */
 	rx_b = rx_p = 0;
 	tx_b = tx_p = 0;
-	tx_restart = tx_busy = tx_linearize = 0;
+	tx_restart = tx_busy = tx_linearize = tx_force_wb = 0;
 	rx_page = 0;
 	rx_buf = 0;
 	rcu_read_lock();
@@ -917,6 +918,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 		tx_restart += p->tx_stats.restart_queue;
 		tx_busy += p->tx_stats.tx_busy;
 		tx_linearize += p->tx_stats.tx_linearize;
+		tx_force_wb += p->tx_stats.tx_force_wb;
 
 		/* Rx queue is part of the same block as Tx queue */
 		p = &p[1];
@@ -934,6 +936,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	vsi->tx_restart = tx_restart;
 	vsi->tx_busy = tx_busy;
 	vsi->tx_linearize = tx_linearize;
+	vsi->tx_force_wb = tx_force_wb;
 	vsi->rx_page_failed = rx_page;
 	vsi->rx_buf_failed = rx_buf;
 
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 98680b6..dbd2bca 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1925,8 +1925,10 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
 	/* If work not completed, return budget and polling will return */
 	if (!clean_complete) {
 tx_only:
-		if (arm_wb)
+		if (arm_wb) {
+			q_vector->tx.ring[0].tx_stats.tx_force_wb++;
 			i40e_force_wb(vsi, q_vector);
+		}
 		return budget;
 	}
 
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
index 6779fb7..dccc1eb 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h
@@ -202,6 +202,7 @@ struct i40e_tx_queue_stats {
 	u64 tx_busy;
 	u64 tx_done_old;
 	u64 tx_linearize;
+	u64 tx_force_wb;
 };
 
 struct i40e_rx_queue_stats {
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index a4eea08..8629a9f 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -1363,8 +1363,10 @@ int i40evf_napi_poll(struct napi_struct *napi, int budget)
 	/* If work not completed, return budget and polling will return */
 	if (!clean_complete) {
 tx_only:
-		if (arm_wb)
+		if (arm_wb) {
+			q_vector->tx.ring[0].tx_stats.tx_force_wb++;
 			i40evf_force_wb(vsi, q_vector);
+		}
 		return budget;
 	}
 
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h
index ebc1bf7..997b374 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.h
@@ -201,6 +201,7 @@ struct i40e_tx_queue_stats {
 	u64 tx_busy;
 	u64 tx_done_old;
 	u64 tx_linearize;
+	u64 tx_force_wb;
 };
 
 struct i40e_rx_queue_stats {
-- 
2.5.0

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

* [net-next v2 08/15] i40e: Move the saving of old link info from handle_link_event to link_event
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (6 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 07/15] i40e/i40evf: Add a stat to track how many times we have to do a force WB Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 09/15] i40e/i40evf: Add comment to #endif Jeff Kirsher
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem
  Cc: Catherine Sullivan, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

The watchdog only calls link_event not handle_link_event which means
that we need to save the old information in link_event.

Previously when polling we were comparing current data to the old data
saved the last time we actually received a link event. This means that
the polling would only fix link status changes in one direction
depending on what the last old data saved off was.

Change-ID: Ie590f30fdbcb133d0ddad4e07e3eb1aad58255b3
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 0e6abc2..9c0a381 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6016,6 +6016,9 @@ static void i40e_link_event(struct i40e_pf *pf)
 	i40e_status status;
 	bool new_link, old_link;
 
+	/* save off old link status information */
+	pf->hw.phy.link_info_old = pf->hw.phy.link_info;
+
 	/* set this to force the get_link_status call to refresh state */
 	pf->hw.phy.get_link_info = true;
 
@@ -6150,13 +6153,9 @@ unlock:
 static void i40e_handle_link_event(struct i40e_pf *pf,
 				   struct i40e_arq_event_info *e)
 {
-	struct i40e_hw *hw = &pf->hw;
 	struct i40e_aqc_get_link_status *status =
 		(struct i40e_aqc_get_link_status *)&e->desc.params.raw;
 
-	/* save off old link status information */
-	hw->phy.link_info_old = hw->phy.link_info;
-
 	/* Do a new status request to re-enable LSE reporting
 	 * and load new status information into the hw struct
 	 * This completely ignores any state information
-- 
2.5.0

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

* [net-next v2 09/15] i40e/i40evf: Add comment to #endif
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (7 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 08/15] i40e: Move the saving of old link info from handle_link_event to link_event Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 10/15] i40e/i40evf: clean up error messages Jeff Kirsher
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Helin Zhang, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Helin Zhang <helin.zhang@intel.com>

Add a comment to the #endif to more easily match it with its #if.

Change-ID: I47eb0a60a17dc6d2f01a930e45006d2dc82e044f
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h   | 2 +-
 drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
index 6584b6c..61a4979 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
@@ -2403,4 +2403,4 @@ struct i40e_aqc_debug_modify_internals {
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);
 
-#endif
+#endif /* _I40E_ADMINQ_CMD_H_ */
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h
index fcb9ef3..1c76389 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h
@@ -2311,4 +2311,4 @@ struct i40e_aqc_debug_modify_internals {
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);
 
-#endif
+#endif /* _I40E_ADMINQ_CMD_H_ */
-- 
2.5.0

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

* [net-next v2 10/15] i40e/i40evf: clean up error messages
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (8 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 09/15] i40e/i40evf: Add comment to #endif Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 11/15] i40evf: handle many MAC filters correctly Jeff Kirsher
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Mitch Williams, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

Clean up and enhance error messages related to VF MAC/VLAN filters.
Indicate which VF is having issues, and if possible indicate the MAC
address or VLAN involved.

Also, when an error is returned from the PF driver, print useful
information about what went wrong, for the most likely cases.

Change-ID: Ib3d15eef9e3369a78fd142948671e5fa26d921b8
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 21 +++++++++--------
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    | 26 +++++++++++++++++++---
 2 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 44462b4..9c54ca2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1623,7 +1623,8 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 		if (!f) {
 			dev_err(&pf->pdev->dev,
-				"Unable to add VF MAC filter\n");
+				"Unable to add MAC filter %pM for VF %d\n",
+				 al->list[i].addr, vf->vf_id);
 			ret = I40E_ERR_PARAM;
 			spin_unlock_bh(&vsi->mac_filter_list_lock);
 			goto error_param;
@@ -1633,7 +1634,8 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 	/* program the updated filter list */
 	if (i40e_sync_vsi_filters(vsi, false))
-		dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n");
+		dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters\n",
+			vf->vf_id);
 
 error_param:
 	/* send the response to the VF */
@@ -1669,8 +1671,8 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 	for (i = 0; i < al->num_elements; i++) {
 		if (is_broadcast_ether_addr(al->list[i].addr) ||
 		    is_zero_ether_addr(al->list[i].addr)) {
-			dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n",
-				al->list[i].addr);
+			dev_err(&pf->pdev->dev, "Invalid MAC addr %pM for VF %d\n",
+				al->list[i].addr, vf->vf_id);
 			ret = I40E_ERR_INVALID_MAC_ADDR;
 			goto error_param;
 		}
@@ -1686,7 +1688,8 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 	/* program the updated filter list */
 	if (i40e_sync_vsi_filters(vsi, false))
-		dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n");
+		dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters\n",
+			vf->vf_id);
 
 error_param:
 	/* send the response to the VF */
@@ -1740,8 +1743,8 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 		if (ret)
 			dev_err(&pf->pdev->dev,
-				"Unable to add VF vlan filter %d, error %d\n",
-				vfl->vlan_id[i], ret);
+				"Unable to add VLAN filter %d for VF %d, error %d\n",
+				vfl->vlan_id[i], vf->vf_id, ret);
 	}
 
 error_param:
@@ -1792,8 +1795,8 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 		if (ret)
 			dev_err(&pf->pdev->dev,
-				"Unable to delete VF vlan filter %d, error %d\n",
-				vfl->vlan_id[i], ret);
+				"Unable to delete VLAN filter %d for VF %d, error %d\n",
+				vfl->vlan_id[i], vf->vf_id, ret);
 	}
 
 error_param:
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
index 32e620e..091ef6a 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
@@ -724,9 +724,29 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
 		return;
 	}
 	if (v_retval) {
-		dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n",
-			v_retval, i40evf_stat_str(&adapter->hw, v_retval),
-			v_opcode);
+		switch (v_opcode) {
+		case I40E_VIRTCHNL_OP_ADD_VLAN:
+			dev_err(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n",
+				i40evf_stat_str(&adapter->hw, v_retval));
+			break;
+		case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:
+			dev_err(&adapter->pdev->dev, "Failed to add MAC filter, error %s\n",
+				i40evf_stat_str(&adapter->hw, v_retval));
+			break;
+		case I40E_VIRTCHNL_OP_DEL_VLAN:
+			dev_err(&adapter->pdev->dev, "Failed to delete VLAN filter, error %s\n",
+				i40evf_stat_str(&adapter->hw, v_retval));
+			break;
+		case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:
+			dev_err(&adapter->pdev->dev, "Failed to delete MAC filter, error %s\n",
+				i40evf_stat_str(&adapter->hw, v_retval));
+			break;
+		default:
+			dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n",
+				v_retval,
+				i40evf_stat_str(&adapter->hw, v_retval),
+				v_opcode);
+		}
 	}
 	switch (v_opcode) {
 	case I40E_VIRTCHNL_OP_GET_STATS: {
-- 
2.5.0

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

* [net-next v2 11/15] i40evf: handle many MAC filters correctly
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (9 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 10/15] i40e/i40evf: clean up error messages Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 12/15] i40e: return the number of enabled queues for ETHTOOL_GRXRINGS Jeff Kirsher
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Mitch Williams, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

When a lot (many hundreds) of MAC or VLAN filters are added at one time,
we can overflow the Admin Queue buffer size with all the requests.
Unfortunately, the driver would then calculate the message size
incorrectly, causing it to be rejected by the PF. Furthermore, there was
no mechanism to trigger another request to allow for configuring the
rest of the filters that didn't fit into the first request.

To fix this, recalculate the correct buffer size when we detect the
overflow condition instead of just assuming the max buffer size. Also,
don't clear the request bit in adapter->aq_required when we have an
overflow, so that the rest of the filters can be processed later.

Change-ID: Idd7cbbc5af31315e0dcb1b10e6a02ad9817ce65c
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    | 32 ++++++++++++++++------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
index 091ef6a..46b0516 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
@@ -391,6 +391,7 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
 	struct i40e_virtchnl_ether_addr_list *veal;
 	int len, i = 0, count = 0;
 	struct i40evf_mac_filter *f;
+	bool more = false;
 
 	if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
@@ -415,7 +416,9 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
 		count = (I40EVF_MAX_AQ_BUF_SIZE -
 			 sizeof(struct i40e_virtchnl_ether_addr_list)) /
 			sizeof(struct i40e_virtchnl_ether_addr);
-		len = I40EVF_MAX_AQ_BUF_SIZE;
+		len = sizeof(struct i40e_virtchnl_ether_addr_list) +
+		      (count * sizeof(struct i40e_virtchnl_ether_addr));
+		more = true;
 	}
 
 	veal = kzalloc(len, GFP_ATOMIC);
@@ -431,7 +434,8 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
 			f->add = false;
 		}
 	}
-	adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
+	if (!more)
+		adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
 	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
 			   (u8 *)veal, len);
 	kfree(veal);
@@ -450,6 +454,7 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
 	struct i40e_virtchnl_ether_addr_list *veal;
 	struct i40evf_mac_filter *f, *ftmp;
 	int len, i = 0, count = 0;
+	bool more = false;
 
 	if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
@@ -474,7 +479,9 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
 		count = (I40EVF_MAX_AQ_BUF_SIZE -
 			 sizeof(struct i40e_virtchnl_ether_addr_list)) /
 			sizeof(struct i40e_virtchnl_ether_addr);
-		len = I40EVF_MAX_AQ_BUF_SIZE;
+		len = sizeof(struct i40e_virtchnl_ether_addr_list) +
+		      (count * sizeof(struct i40e_virtchnl_ether_addr));
+		more = true;
 	}
 	veal = kzalloc(len, GFP_ATOMIC);
 	if (!veal)
@@ -490,7 +497,8 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
 			kfree(f);
 		}
 	}
-	adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
+	if (!more)
+		adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
 	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
 			   (u8 *)veal, len);
 	kfree(veal);
@@ -509,6 +517,7 @@ void i40evf_add_vlans(struct i40evf_adapter *adapter)
 	struct i40e_virtchnl_vlan_filter_list *vvfl;
 	int len, i = 0, count = 0;
 	struct i40evf_vlan_filter *f;
+	bool more = false;
 
 	if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
@@ -534,7 +543,9 @@ void i40evf_add_vlans(struct i40evf_adapter *adapter)
 		count = (I40EVF_MAX_AQ_BUF_SIZE -
 			 sizeof(struct i40e_virtchnl_vlan_filter_list)) /
 			sizeof(u16);
-		len = I40EVF_MAX_AQ_BUF_SIZE;
+		len = sizeof(struct i40e_virtchnl_vlan_filter_list) +
+		      (count * sizeof(u16));
+		more = true;
 	}
 	vvfl = kzalloc(len, GFP_ATOMIC);
 	if (!vvfl)
@@ -549,7 +560,8 @@ void i40evf_add_vlans(struct i40evf_adapter *adapter)
 			f->add = false;
 		}
 	}
-	adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
+	if (!more)
+		adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
 	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len);
 	kfree(vvfl);
 }
@@ -567,6 +579,7 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
 	struct i40e_virtchnl_vlan_filter_list *vvfl;
 	struct i40evf_vlan_filter *f, *ftmp;
 	int len, i = 0, count = 0;
+	bool more = false;
 
 	if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
@@ -592,7 +605,9 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
 		count = (I40EVF_MAX_AQ_BUF_SIZE -
 			 sizeof(struct i40e_virtchnl_vlan_filter_list)) /
 			sizeof(u16);
-		len = I40EVF_MAX_AQ_BUF_SIZE;
+		len = sizeof(struct i40e_virtchnl_vlan_filter_list) +
+		      (count * sizeof(u16));
+		more = true;
 	}
 	vvfl = kzalloc(len, GFP_ATOMIC);
 	if (!vvfl)
@@ -608,7 +623,8 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
 			kfree(f);
 		}
 	}
-	adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
+	if (!more)
+		adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
 	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len);
 	kfree(vvfl);
 }
-- 
2.5.0

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

* [net-next v2 12/15] i40e: return the number of enabled queues for ETHTOOL_GRXRINGS
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (10 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 11/15] i40evf: handle many MAC filters correctly Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 13/15] i40e: rework the functions to configure RSS with similar parameters Jeff Kirsher
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Helin Zhang, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Helin Zhang <helin.zhang@intel.com>

This patch fixes a problem where using ethtool rxnfc command could
let RX flow hash be set on disabled queues. This patch fixes the
problem by returning the number of enabled queues before setting
rxnfc.

Change-ID: Idbac86b0b47ddacc8deee7cd257e41de01cbe5c0
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index eeb1af4..a89da8a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2111,7 +2111,7 @@ static int i40e_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
 
 	switch (cmd->cmd) {
 	case ETHTOOL_GRXRINGS:
-		cmd->data = vsi->alloc_queue_pairs;
+		cmd->data = vsi->num_queue_pairs;
 		ret = 0;
 		break;
 	case ETHTOOL_GRXFH:
-- 
2.5.0

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

* [net-next v2 13/15] i40e: rework the functions to configure RSS with similar parameters
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (11 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 12/15] i40e: return the number of enabled queues for ETHTOOL_GRXRINGS Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 14/15] i40e: create a generic configure rss function Jeff Kirsher
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Helin Zhang, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Helin Zhang <helin.zhang@intel.com>

Adjust the RSS configure functions so that there is a generic way to
hook to ethtool hooks.

Change-ID: If446e34fcfaf1bc3320d9d319829a095b5976e67
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h         |  1 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  1 -
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 95 +++++++++++++++++++-------
 3 files changed, 71 insertions(+), 26 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index ca07a7b..f6b747c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -187,6 +187,7 @@ struct i40e_lump_tracking {
 #define I40E_FDIR_BUFFER_HEAD_ROOM_FOR_ATR (I40E_FDIR_BUFFER_HEAD_ROOM * 4)
 
 #define I40E_HKEY_ARRAY_SIZE ((I40E_PFQF_HKEY_MAX_INDEX + 1) * 4)
+#define I40E_HLUT_ARRAY_SIZE ((I40E_PFQF_HLUT_MAX_INDEX + 1) * 4)
 
 enum i40e_fd_stat_idx {
 	I40E_FD_STAT_ATR,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index a89da8a..f26c0d1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2584,7 +2584,6 @@ static int i40e_set_channels(struct net_device *dev,
 		return -EINVAL;
 }
 
-#define I40E_HLUT_ARRAY_SIZE ((I40E_PFQF_HLUT_MAX_INDEX + 1) * 4)
 /**
  * i40e_get_rxfh_key_size - get the RSS hash key size
  * @netdev: network interface device structure
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 9c0a381..9fe6802 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -55,6 +55,8 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit);
 static int i40e_setup_misc_vector(struct i40e_pf *pf);
 static void i40e_determine_queue_usage(struct i40e_pf *pf);
 static int i40e_setup_pf_filter_control(struct i40e_pf *pf);
+static void i40e_fill_rss_lut(struct i40e_pf *pf, u8 *lut,
+			      u16 rss_table_size, u16 rss_size);
 static void i40e_fdir_sb_setup(struct i40e_pf *pf);
 static int i40e_veb_get_bw_info(struct i40e_veb *veb);
 
@@ -7797,7 +7799,8 @@ static int i40e_setup_misc_vector(struct i40e_pf *pf)
  * @vsi: vsi structure
  * @seed: RSS hash seed
  **/
-static int i40e_config_rss_aq(struct i40e_vsi *vsi, const u8 *seed)
+static int i40e_config_rss_aq(struct i40e_vsi *vsi, const u8 *seed,
+			      u8 *lut, u16 lut_size)
 {
 	struct i40e_aqc_get_set_rss_key_data rss_key;
 	struct i40e_pf *pf = vsi->back;
@@ -7850,43 +7853,57 @@ static int i40e_vsi_config_rss(struct i40e_vsi *vsi)
 {
 	u8 seed[I40E_HKEY_ARRAY_SIZE];
 	struct i40e_pf *pf = vsi->back;
+	u8 *lut;
+	int ret;
+
+	if (!(pf->flags & I40E_FLAG_RSS_AQ_CAPABLE))
+		return 0;
+
+	lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
+	if (!lut)
+		return -ENOMEM;
 
+	i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size);
 	netdev_rss_key_fill((void *)seed, I40E_HKEY_ARRAY_SIZE);
 	vsi->rss_size = min_t(int, pf->rss_size, vsi->num_queue_pairs);
+	ret = i40e_config_rss_aq(vsi, seed, lut, vsi->rss_table_size);
+	kfree(lut);
 
-	if (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE)
-		return i40e_config_rss_aq(vsi, seed);
-
-	return 0;
+	return ret;
 }
 
 /**
  * i40e_config_rss_reg - Prepare for RSS if used
- * @pf: board private structure
+ * @vsi: Pointer to vsi structure
  * @seed: RSS hash seed
+ * @lut: Lookup table
+ * @lut_size: Lookup table size
+ *
+ * Returns 0 on success, negative on failure
  **/
-static int i40e_config_rss_reg(struct i40e_pf *pf, const u8 *seed)
+static int i40e_config_rss_reg(struct i40e_vsi *vsi, const u8 *seed,
+			       const u8 *lut, u16 lut_size)
 {
-	struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
+	struct i40e_pf *pf = vsi->back;
 	struct i40e_hw *hw = &pf->hw;
-	u32 *seed_dw = (u32 *)seed;
-	u32 current_queue = 0;
-	u32 lut = 0;
-	int i, j;
+	u8 i;
 
 	/* Fill out hash function seed */
-	for (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++)
-		wr32(hw, I40E_PFQF_HKEY(i), seed_dw[i]);
+	if (seed) {
+		u32 *seed_dw = (u32 *)seed;
 
-	for (i = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++) {
-		lut = 0;
-		for (j = 0; j < 4; j++) {
-			if (current_queue == vsi->rss_size)
-				current_queue = 0;
-			lut |= ((current_queue) << (8 * j));
-			current_queue++;
-		}
-		wr32(&pf->hw, I40E_PFQF_HLUT(i), lut);
+		for (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++)
+			wr32(hw, I40E_PFQF_HKEY(i), seed_dw[i]);
+	}
+
+	if (lut) {
+		u32 *lut_dw = (u32 *)lut;
+
+		if (lut_size != I40E_HLUT_ARRAY_SIZE)
+			return -EINVAL;
+
+		for (i = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++)
+			wr32(hw, I40E_PFQF_HLUT(i), lut_dw[i]);
 	}
 	i40e_flush(hw);
 
@@ -7894,6 +7911,22 @@ static int i40e_config_rss_reg(struct i40e_pf *pf, const u8 *seed)
 }
 
 /**
+ * i40e_fill_rss_lut - Fill the RSS lookup table with default values
+ * @pf: Pointer to board private structure
+ * @lut: Lookup table
+ * @rss_table_size: Lookup table size
+ * @rss_size: Range of queue number for hashing
+ */
+static void i40e_fill_rss_lut(struct i40e_pf *pf, u8 *lut,
+			      u16 rss_table_size, u16 rss_size)
+{
+	u16 i;
+
+	for (i = 0; i < rss_table_size; i++)
+		lut[i] = i % rss_size;
+}
+
+/**
  * i40e_config_rss - Prepare for RSS if used
  * @pf: board private structure
  **/
@@ -7901,9 +7934,11 @@ static int i40e_config_rss(struct i40e_pf *pf)
 {
 	struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
 	u8 seed[I40E_HKEY_ARRAY_SIZE];
+	u8 *lut;
 	struct i40e_hw *hw = &pf->hw;
 	u32 reg_val;
 	u64 hena;
+	int ret;
 
 	netdev_rss_key_fill((void *)seed, I40E_HKEY_ARRAY_SIZE);
 
@@ -7924,10 +7959,20 @@ static int i40e_config_rss(struct i40e_pf *pf)
 			(reg_val & ~I40E_PFQF_CTL_0_HASHLUTSIZE_512);
 	wr32(hw, I40E_PFQF_CTL_0, reg_val);
 
+	lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
+	if (!lut)
+		return -ENOMEM;
+
+	i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size);
+
 	if (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE)
-		return i40e_config_rss_aq(pf->vsi[pf->lan_vsi], seed);
+		ret = i40e_config_rss_aq(vsi, seed, lut, vsi->rss_table_size);
 	else
-		return i40e_config_rss_reg(pf, seed);
+		ret = i40e_config_rss_reg(vsi, seed, lut, vsi->rss_table_size);
+
+	kfree(lut);
+
+	return ret;
 }
 
 /**
-- 
2.5.0

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

* [net-next v2 14/15] i40e: create a generic configure rss function
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (12 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 13/15] i40e: rework the functions to configure RSS with similar parameters Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:21 ` [net-next v2 15/15] i40e: Bump version to 1.4.2 Jeff Kirsher
  2015-11-25 18:58 ` [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 David Miller
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem; +Cc: Helin Zhang, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Helin Zhang <helin.zhang@intel.com>

This patch renames the old pf-specific function in order to clarify
its scope. This patch also creates a more generic configure RSS
function with the old name.

This patch also creates a new more generic function to get RSS
configuration, using the appropriate method.

Change-ID: Ieddca2707b708ef19f1ebccdfd03a0a0cd63d3af
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h         |  2 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 72 ++++++++++------------
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 85 ++++++++++++++++++++++----
 3 files changed, 107 insertions(+), 52 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index f6b747c..89f5323 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -670,6 +670,8 @@ extern const char i40e_driver_name[];
 extern const char i40e_driver_version_str[];
 void i40e_do_reset_safe(struct i40e_pf *pf, u32 reset_flags);
 void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags);
+int i40e_config_rss(struct i40e_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
+int i40e_get_rss(struct i40e_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
 struct i40e_vsi *i40e_find_vsi_from_id(struct i40e_pf *pf, u16 id);
 void i40e_update_stats(struct i40e_vsi *vsi);
 void i40e_update_eth_stats(struct i40e_vsi *vsi);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index f26c0d1..6cb2b34 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2611,10 +2611,9 @@ 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;
+	u8 *lut, *seed = NULL;
+	int ret;
+	u16 i;
 
 	if (hfunc)
 		*hfunc = ETH_RSS_HASH_TOP;
@@ -2622,24 +2621,20 @@ static int i40e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
 	if (!indir)
 		return 0;
 
-	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;
-	}
+	seed = key;
+	lut = kzalloc(I40E_HLUT_ARRAY_SIZE, GFP_KERNEL);
+	if (!lut)
+		return -ENOMEM;
+	ret = i40e_get_rss(vsi, seed, lut, I40E_HLUT_ARRAY_SIZE);
+	if (ret)
+		goto out;
+	for (i = 0; i < I40E_HLUT_ARRAY_SIZE; i++)
+		indir[i] = (u32)(lut[i]);
 
-	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;
+out:
+	kfree(lut);
+
+	return ret;
 }
 
 /**
@@ -2656,10 +2651,10 @@ static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,
 {
 	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;
+	u8 seed_def[I40E_HKEY_ARRAY_SIZE];
+	u8 *lut, *seed = NULL;
+	u16 i;
+	int ret;
 
 	if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
 		return -EOPNOTSUPP;
@@ -2667,24 +2662,19 @@ static int i40e_set_rxfh(struct net_device *netdev, const u32 *indir,
 	if (!indir)
 		return 0;
 
-	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);
-		}
+		memcpy(seed_def, key, I40E_HKEY_ARRAY_SIZE);
+		seed = seed_def;
 	}
-	return 0;
+	lut = kzalloc(I40E_HLUT_ARRAY_SIZE, GFP_KERNEL);
+	if (!lut)
+		return -ENOMEM;
+	for (i = 0; i < I40E_HLUT_ARRAY_SIZE; i++)
+		lut[i] = (u8)(indir[i]);
+	ret = i40e_config_rss(vsi, seed, lut, I40E_HLUT_ARRAY_SIZE);
+	kfree(lut);
+
+	return ret;
 }
 
 /**
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 9fe6802..84b1962 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7873,7 +7873,7 @@ static int i40e_vsi_config_rss(struct i40e_vsi *vsi)
 }
 
 /**
- * i40e_config_rss_reg - Prepare for RSS if used
+ * i40e_config_rss_reg - Configure RSS keys and lut by writing registers
  * @vsi: Pointer to vsi structure
  * @seed: RSS hash seed
  * @lut: Lookup table
@@ -7911,6 +7911,73 @@ static int i40e_config_rss_reg(struct i40e_vsi *vsi, const u8 *seed,
 }
 
 /**
+ * i40e_get_rss_reg - Get the RSS keys and lut by reading registers
+ * @vsi: Pointer to VSI structure
+ * @seed: Buffer to store the keys
+ * @lut: Buffer to store the lookup table entries
+ * @lut_size: Size of buffer to store the lookup table entries
+ *
+ * Returns 0 on success, negative on failure
+ */
+static int i40e_get_rss_reg(struct i40e_vsi *vsi, u8 *seed,
+			    u8 *lut, u16 lut_size)
+{
+	struct i40e_pf *pf = vsi->back;
+	struct i40e_hw *hw = &pf->hw;
+	u16 i;
+
+	if (seed) {
+		u32 *seed_dw = (u32 *)seed;
+
+		for (i = 0; i <= I40E_PFQF_HKEY_MAX_INDEX; i++)
+			seed_dw[i] = rd32(hw, I40E_PFQF_HKEY(i));
+	}
+	if (lut) {
+		u32 *lut_dw = (u32 *)lut;
+
+		if (lut_size != I40E_HLUT_ARRAY_SIZE)
+			return -EINVAL;
+		for (i = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++)
+			lut_dw[i] = rd32(hw, I40E_PFQF_HLUT(i));
+	}
+
+	return 0;
+}
+
+/**
+ * i40e_config_rss - Configure RSS keys and lut
+ * @vsi: Pointer to VSI structure
+ * @seed: RSS hash seed
+ * @lut: Lookup table
+ * @lut_size: Lookup table size
+ *
+ * Returns 0 on success, negative on failure
+ */
+int i40e_config_rss(struct i40e_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)
+{
+	struct i40e_pf *pf = vsi->back;
+
+	if (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE)
+		return i40e_config_rss_aq(vsi, seed, lut, lut_size);
+	else
+		return i40e_config_rss_reg(vsi, seed, lut, lut_size);
+}
+
+/**
+ * i40e_get_rss - Get RSS keys and lut
+ * @vsi: Pointer to VSI structure
+ * @seed: Buffer to store the keys
+ * @lut: Buffer to store the lookup table entries
+ * lut_size: Size of buffer to store the lookup table entries
+ *
+ * Returns 0 on success, negative on failure
+ */
+int i40e_get_rss(struct i40e_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size)
+{
+	return i40e_get_rss_reg(vsi, seed, lut, lut_size);
+}
+
+/**
  * i40e_fill_rss_lut - Fill the RSS lookup table with default values
  * @pf: Pointer to board private structure
  * @lut: Lookup table
@@ -7927,10 +7994,10 @@ static void i40e_fill_rss_lut(struct i40e_pf *pf, u8 *lut,
 }
 
 /**
- * i40e_config_rss - Prepare for RSS if used
+ * i40e_pf_config_rss - Prepare for RSS if used
  * @pf: board private structure
  **/
-static int i40e_config_rss(struct i40e_pf *pf)
+static int i40e_pf_config_rss(struct i40e_pf *pf)
 {
 	struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
 	u8 seed[I40E_HKEY_ARRAY_SIZE];
@@ -7940,8 +8007,6 @@ static int i40e_config_rss(struct i40e_pf *pf)
 	u64 hena;
 	int ret;
 
-	netdev_rss_key_fill((void *)seed, I40E_HKEY_ARRAY_SIZE);
-
 	/* By default we enable TCP/UDP with IPv4/IPv6 ptypes */
 	hena = (u64)rd32(hw, I40E_PFQF_HENA(0)) |
 		((u64)rd32(hw, I40E_PFQF_HENA(1)) << 32);
@@ -7965,10 +8030,8 @@ static int i40e_config_rss(struct i40e_pf *pf)
 
 	i40e_fill_rss_lut(pf, lut, vsi->rss_table_size, vsi->rss_size);
 
-	if (pf->flags & I40E_FLAG_RSS_AQ_CAPABLE)
-		ret = i40e_config_rss_aq(vsi, seed, lut, vsi->rss_table_size);
-	else
-		ret = i40e_config_rss_reg(vsi, seed, lut, vsi->rss_table_size);
+	netdev_rss_key_fill((void *)seed, I40E_HKEY_ARRAY_SIZE);
+	ret = i40e_config_rss(vsi, seed, lut, vsi->rss_table_size);
 
 	kfree(lut);
 
@@ -8000,7 +8063,7 @@ int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count)
 		pf->rss_size = new_rss_size;
 
 		i40e_reset_and_rebuild(pf, true);
-		i40e_config_rss(pf);
+		i40e_pf_config_rss(pf);
 	}
 	dev_info(&pf->pdev->dev, "RSS count:  %d\n", pf->rss_size);
 	return pf->rss_size;
@@ -10009,7 +10072,7 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)
 	 * the hash
 	 */
 	if ((pf->flags & I40E_FLAG_RSS_ENABLED))
-		i40e_config_rss(pf);
+		i40e_pf_config_rss(pf);
 
 	/* fill in link information and enable LSE reporting */
 	i40e_update_link_info(&pf->hw);
-- 
2.5.0

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

* [net-next v2 15/15] i40e: Bump version to 1.4.2
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (13 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 14/15] i40e: create a generic configure rss function Jeff Kirsher
@ 2015-11-25 18:21 ` Jeff Kirsher
  2015-11-25 18:58 ` [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 David Miller
  15 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:21 UTC (permalink / raw)
  To: davem
  Cc: Catherine Sullivan, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

Bump.

Change-ID: I2d1ce93b2ce74e4eef2394c932aef52cba99713f
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 84b1962..4b7d874 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 3
-#define DRV_VERSION_BUILD 46
+#define DRV_VERSION_MINOR 4
+#define DRV_VERSION_BUILD 2
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD)    DRV_KERN
-- 
2.5.0

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

* Re: [net-next v2 04/15] i40e: remove BUG_ON from feature string building
  2015-11-25 18:21 ` [net-next v2 04/15] i40e: remove BUG_ON from feature string building Jeff Kirsher
@ 2015-11-25 18:26   ` Sergei Shtylyov
  2015-11-25 18:35     ` Jeff Kirsher
  0 siblings, 1 reply; 34+ messages in thread
From: Sergei Shtylyov @ 2015-11-25 18:26 UTC (permalink / raw)
  To: Jeff Kirsher, davem; +Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene

Hello.

On 11/25/2015 09:21 PM, Jeff Kirsher wrote:

> From: Shannon Nelson <shannon.nelson@intel.com>
>
> There's really no reason to kill the kernel thread just because of a
> little info string. This reworks the code to use snprintf's limiting to
> assure that the string is never too long, and WARN_ON to still put out
> a warning that we might want to look at the feature list length.
>
> Prompted by a recent Linus diatribe.
>
> Change-ID: If52ba5ca1c2344d8bf454a31bbb805eb5d2c5802
> Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
> Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>   drivers/net/ethernet/intel/i40e/i40e_main.c | 34 +++++++++++++++--------------
>   1 file changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 7715c54..7a4595a 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
[...]
> @@ -10124,42 +10126,42 @@ static void i40e_print_features(struct i40e_pf *pf)
>
>   	buf = string;
>
> -	buf += sprintf(string, "Features: PF-id[%d] ", hw->pf_id);
> +	i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id);
>   #ifdef CONFIG_PCI_IOV
> -	buf += sprintf(buf, "VFs: %d ", pf->num_req_vfs);
> +	i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf->num_req_vfs);
>   #endif
> -	buf += sprintf(buf, "VSIs: %d QP: %d RX: %s ",
> -		       pf->hw.func_caps.num_vsis,
> -		       pf->vsi[pf->lan_vsi]->num_queue_pairs,
> -		       pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
> +	i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ",
> +		      pf->hw.func_caps.num_vsis,
> +		      pf->vsi[pf->lan_vsi]->num_queue_pairs,
> +		      pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
>
>   	if (pf->flags & I40E_FLAG_RSS_ENABLED)
> -		buf += sprintf(buf, "RSS ");
> +		i += snprintf(&buf[i], REMAIN(i), "RSS ");
>   	if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
> -		buf += sprintf(buf, "FD_ATR ");
> +		i += snprintf(&buf[i], REMAIN(i), "FD_ATR ");
>   	if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
> -		buf += sprintf(buf, "FD_SB ");
> -		buf += sprintf(buf, "NTUPLE ");
> +		i += snprintf(&buf[i], REMAIN(i), "FD_SB ");
> +		i += snprintf(&buf[i], REMAIN(i), "NTUPLE ");
>   	}
>   	if (pf->flags & I40E_FLAG_DCB_CAPABLE)
> -		buf += sprintf(buf, "DCB ");
> +		i += snprintf(&buf[i], REMAIN(i), "DCB ");
>   #if IS_ENABLED(CONFIG_VXLAN)
> -	buf += sprintf(buf, "VxLAN ");
> +	i += snprintf(&buf[i], REMAIN(i), "VxLAN ");
>   #endif
>   	if (pf->flags & I40E_FLAG_PTP)
> -		buf += sprintf(buf, "PTP ");
> +		i += snprintf(&buf[i], REMAIN(i), "PTP ");
>   #ifdef I40E_FCOE
>   	if (pf->flags & I40E_FLAG_FCOE_ENABLED)
> -		buf += sprintf(buf, "FCOE ");
> +		i += snprintf(&buf[i], REMAIN(i), "FCOE ");
>   #endif
>   	if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
> -		buf += sprintf(buf, "VEB ");
> +		i += snprintf(&buf[i], REMAIN(i), "VEPA ");

    Not "VEB "?

>   	else
>   		buf += sprintf(buf, "VEPA ");
>
> -	BUG_ON(buf > (string + INFO_STRING_LEN));
>   	dev_info(&pf->pdev->dev, "%s\n", string);
>   	kfree(string);
> +	WARN_ON(i > INFO_STRING_LEN);
>   }
>
>   /**

MBR, Sergei

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

* Re: [net-next v2 04/15] i40e: remove BUG_ON from feature string building
  2015-11-25 18:26   ` Sergei Shtylyov
@ 2015-11-25 18:35     ` Jeff Kirsher
  2015-11-25 19:36       ` Joe Perches
  0 siblings, 1 reply; 34+ messages in thread
From: Jeff Kirsher @ 2015-11-25 18:35 UTC (permalink / raw)
  To: Sergei Shtylyov, davem
  Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene,
	John Ronciak, Carolyn Wyborny

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

On Wed, 2015-11-25 at 21:26 +0300, Sergei Shtylyov wrote:
> On 11/25/2015 09:21 PM, Jeff Kirsher wrote:
> 
> > From: Shannon Nelson <shannon.nelson@intel.com>
> >
> > There's really no reason to kill the kernel thread just because of
> a
> > little info string. This reworks the code to use snprintf's
> limiting to
> > assure that the string is never too long, and WARN_ON to still put
> out
> > a warning that we might want to look at the feature list length.
> >
> > Prompted by a recent Linus diatribe.
> >
> > Change-ID: If52ba5ca1c2344d8bf454a31bbb805eb5d2c5802
> > Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
> > Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> > ---
> >   drivers/net/ethernet/intel/i40e/i40e_main.c | 34 +++++++++++++++-
> -------------
> >   1 file changed, 18 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c
> b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > index 7715c54..7a4595a 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> [...]
> > @@ -10124,42 +10126,42 @@ static void i40e_print_features(struct
> i40e_pf *pf)
> >
> >       buf = string;
> >
> > -     buf += sprintf(string, "Features: PF-id[%d] ", hw->pf_id);
> > +     i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw-
> >pf_id);
> >   #ifdef CONFIG_PCI_IOV
> > -     buf += sprintf(buf, "VFs: %d ", pf->num_req_vfs);
> > +     i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf-
> >num_req_vfs);
> >   #endif
> > -     buf += sprintf(buf, "VSIs: %d QP: %d RX: %s ",
> > -                    pf->hw.func_caps.num_vsis,
> > -                    pf->vsi[pf->lan_vsi]->num_queue_pairs,
> > -                    pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" :
> "1BUF");
> > +     i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ",
> > +                   pf->hw.func_caps.num_vsis,
> > +                   pf->vsi[pf->lan_vsi]->num_queue_pairs,
> > +                   pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" :
> "1BUF");
> >
> >       if (pf->flags & I40E_FLAG_RSS_ENABLED)
> > -             buf += sprintf(buf, "RSS ");
> > +             i += snprintf(&buf[i], REMAIN(i), "RSS ");
> >       if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
> > -             buf += sprintf(buf, "FD_ATR ");
> > +             i += snprintf(&buf[i], REMAIN(i), "FD_ATR ");
> >       if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
> > -             buf += sprintf(buf, "FD_SB ");
> > -             buf += sprintf(buf, "NTUPLE ");
> > +             i += snprintf(&buf[i], REMAIN(i), "FD_SB ");
> > +             i += snprintf(&buf[i], REMAIN(i), "NTUPLE ");
> >       }
> >       if (pf->flags & I40E_FLAG_DCB_CAPABLE)
> > -             buf += sprintf(buf, "DCB ");
> > +             i += snprintf(&buf[i], REMAIN(i), "DCB ");
> >   #if IS_ENABLED(CONFIG_VXLAN)
> > -     buf += sprintf(buf, "VxLAN ");
> > +     i += snprintf(&buf[i], REMAIN(i), "VxLAN ");
> >   #endif
> >       if (pf->flags & I40E_FLAG_PTP)
> > -             buf += sprintf(buf, "PTP ");
> > +             i += snprintf(&buf[i], REMAIN(i), "PTP ");
> >   #ifdef I40E_FCOE
> >       if (pf->flags & I40E_FLAG_FCOE_ENABLED)
> > -             buf += sprintf(buf, "FCOE ");
> > +             i += snprintf(&buf[i], REMAIN(i), "FCOE ");
> >   #endif
> >       if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
> > -             buf += sprintf(buf, "VEB ");
> > +             i += snprintf(&buf[i], REMAIN(i), "VEPA ");
> 
>     Not "VEB "?

Nice catch Sergei, I will wait a till this afternoon to respin the
patch series, just in case there are other changes needed that our
validation did not catch. :-)

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

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

* Re: [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25
  2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
                   ` (14 preceding siblings ...)
  2015-11-25 18:21 ` [net-next v2 15/15] i40e: Bump version to 1.4.2 Jeff Kirsher
@ 2015-11-25 18:58 ` David Miller
  15 siblings, 0 replies; 34+ messages in thread
From: David Miller @ 2015-11-25 18:58 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann, jogreene, john.ronciak

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 25 Nov 2015 10:21:04 -0800

> This series contains updates to fm10k, i40e and i40evf.
 ...
> v2: Dropped patch "i40e: Properly cast type for arithmetic" patch
>     based on feedback from the community
> 
> The following are changes since commit 9458ceab49179b7fd2d5192fd9dcf316ca195dc0:
>   net: phy: bcm7xxx: Add entry for Broadcom BCM7435
> and are available in the git repository at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue master

Pulled, thanks Jeff.

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

* Re: [net-next v2 04/15] i40e: remove BUG_ON from feature string building
  2015-11-25 18:35     ` Jeff Kirsher
@ 2015-11-25 19:36       ` Joe Perches
  2015-12-01 20:48         ` Joe Perches
  0 siblings, 1 reply; 34+ messages in thread
From: Joe Perches @ 2015-11-25 19:36 UTC (permalink / raw)
  To: Jeff Kirsher, Sergei Shtylyov, davem
  Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene,
	John Ronciak, Carolyn Wyborny

On Wed, 2015-11-25 at 10:35 -0800, Jeff Kirsher wrote:
> On Wed, 2015-11-25 at 21:26 +0300, Sergei Shtylyov wrote:
> > On 11/25/2015 09:21 PM, Jeff Kirsher wrote:
> > 
> > > From: Shannon Nelson <shannon.nelson@intel.com>
> > > 
> > > There's really no reason to kill the kernel thread just because of a
> > > little info string. This reworks the code to use snprintf's limiting to
> > > assure that the string is never too long, and WARN_ON to still put out
> > > a warning that we might want to look at the feature list length.
> > > 
> > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
[]
> > >        if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
> > > -             buf += sprintf(buf, "VEB ");
> > > +             i += snprintf(&buf[i], REMAIN(i), "VEPA ");
> > 
> >     Not "VEB "?
> 
> Nice catch Sergei, I will wait a till this afternoon to respin the
> patch series, just in case there are other changes needed that our
> validation did not catch. :-)

trivia:

If you redo these, it'd be nicer not to use " " after each
fixed string, but use " " before each fixed string.

The final output string would be 1 byte shorter overall and
not have an excess " " before the newline.

The declaration of i doesn't need initialization to 0:

	i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", ...

would work.

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

* Re: [net-next v2 04/15] i40e: remove BUG_ON from feature string building
  2015-11-25 19:36       ` Joe Perches
@ 2015-12-01 20:48         ` Joe Perches
  2015-12-02  7:25           ` Jeff Kirsher
  0 siblings, 1 reply; 34+ messages in thread
From: Joe Perches @ 2015-12-01 20:48 UTC (permalink / raw)
  To: Jeff Kirsher, Sergei Shtylyov, davem
  Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene,
	John Ronciak, Carolyn Wyborny

On Wed, 2015-11-25 at 11:36 -0800, Joe Perches wrote:
> On Wed, 2015-11-25 at 10:35 -0800, Jeff Kirsher wrote:
> > On Wed, 2015-11-25 at 21:26 +0300, Sergei Shtylyov wrote:
> > > On 11/25/2015 09:21 PM, Jeff Kirsher wrote:
> > > 
> > > > From: Shannon Nelson <shannon.nelson@intel.com>
> > > > 
> > > > There's really no reason to kill the kernel thread just because
> > > > of a
> > > > little info string. This reworks the code to use snprintf's
> > > > limiting to
> > > > assure that the string is never too long, and WARN_ON to still
> > > > put out
> > > > a warning that we might want to look at the feature list
> > > > length.
> > > > 
> > > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > > > b/drivers/net/ethernet/intel/i40e/i40e_main.c
> []
> > > >        if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
> > > > -             buf += sprintf(buf, "VEB ");
> > > > +             i += snprintf(&buf[i], REMAIN(i), "VEPA ");
> > > 
> > >     Not "VEB "?
> > 
> > Nice catch Sergei, I will wait a till this afternoon to respin the
> > patch series, just in case there are other changes needed that our
> > validation did not catch. :-)
> 
> trivia:
> 
> If you redo these, it'd be nicer not to use " " after each
> fixed string, but use " " before each fixed string.
> 
> The final output string would be 1 byte shorter overall and
> not have an excess " " before the newline.
> 
> The declaration of i doesn't need initialization to 0:
> 
> 	i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", ...
> 
> would work.

Maybe something like this patch (net-next)

Fix I40E_FLAG_VEB_MODE_ENABLED output of VEB

Miscellanea:
o Remove unnecessary string variable
o Add space before not after fixed strings
o Use kmalloc not kzalloc
o Don't initialize i to 0, use result of first snprintf

---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----------------
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 4b7d874..145eeb5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -10240,52 +10240,48 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)
 static void i40e_print_features(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = &pf->hw;
-	char *buf, *string;
-	int i = 0;
+	char *buf;
+	int i;
 
-	string = kzalloc(INFO_STRING_LEN, GFP_KERNEL);
-	if (!string) {
-		dev_err(&pf->pdev->dev, "Features string allocation failed\n");
+	buf = kmalloc(INFO_STRING_LEN, GFP_KERNEL);
+	if (!buf)
 		return;
-	}
-
-	buf = string;
 
-	i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id);
+	i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", hw->pf_id);
 #ifdef CONFIG_PCI_IOV
-	i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf->num_req_vfs);
+	i += snprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs);
 #endif
-	i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ",
+	i += snprintf(&buf[i], REMAIN(i), " VSIs: %d QP: %d RX: %s",
 		      pf->hw.func_caps.num_vsis,
 		      pf->vsi[pf->lan_vsi]->num_queue_pairs,
 		      pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
 
 	if (pf->flags & I40E_FLAG_RSS_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "RSS ");
+		i += snprintf(&buf[i], REMAIN(i), " RSS");
 	if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FD_ATR ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_ATR");
 	if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
-		i += snprintf(&buf[i], REMAIN(i), "FD_SB ");
-		i += snprintf(&buf[i], REMAIN(i), "NTUPLE ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_SB");
+		i += snprintf(&buf[i], REMAIN(i), " NTUPLE");
 	}
 	if (pf->flags & I40E_FLAG_DCB_CAPABLE)
-		i += snprintf(&buf[i], REMAIN(i), "DCB ");
+		i += snprintf(&buf[i], REMAIN(i), " DCB");
 #if IS_ENABLED(CONFIG_VXLAN)
-	i += snprintf(&buf[i], REMAIN(i), "VxLAN ");
+	i += snprintf(&buf[i], REMAIN(i), " VxLAN");
 #endif
 	if (pf->flags & I40E_FLAG_PTP)
-		i += snprintf(&buf[i], REMAIN(i), "PTP ");
+		i += snprintf(&buf[i], REMAIN(i), " PTP");
 #ifdef I40E_FCOE
 	if (pf->flags & I40E_FLAG_FCOE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FCOE ");
+		i += snprintf(&buf[i], REMAIN(i), " FCOE");
 #endif
 	if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEB");
 	else
-		buf += sprintf(buf, "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEPA");
 
-	dev_info(&pf->pdev->dev, "%s\n", string);
-	kfree(string);
+	dev_info(&pf->pdev->dev, "%s\n", buf);
+	kfree(buf);
 	WARN_ON(i > INFO_STRING_LEN);
 }
 

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

* Re: [net-next v2 04/15] i40e: remove BUG_ON from feature string building
  2015-12-01 20:48         ` Joe Perches
@ 2015-12-02  7:25           ` Jeff Kirsher
  2015-12-02  8:38               ` [Intel-wired-lan] " Joe Perches
  0 siblings, 1 reply; 34+ messages in thread
From: Jeff Kirsher @ 2015-12-02  7:25 UTC (permalink / raw)
  To: Joe Perches, Sergei Shtylyov, davem
  Cc: Shannon Nelson, netdev, nhorman, sassmann, jogreene,
	John Ronciak, Carolyn Wyborny

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

On Tue, 2015-12-01 at 12:48 -0800, Joe Perches wrote:
> On Wed, 2015-11-25 at 11:36 -0800, Joe Perches wrote:
> > On Wed, 2015-11-25 at 10:35 -0800, Jeff Kirsher wrote:
> > > On Wed, 2015-11-25 at 21:26 +0300, Sergei Shtylyov wrote:
> > > > On 11/25/2015 09:21 PM, Jeff Kirsher wrote:
> > > > 
> > > > > From: Shannon Nelson <shannon.nelson@intel.com>
> > > > > 
> > > > > There's really no reason to kill the kernel thread just
> because
> > > > > of a
> > > > > little info string. This reworks the code to use snprintf's
> > > > > limiting to
> > > > > assure that the string is never too long, and WARN_ON to
> still
> > > > > put out
> > > > > a warning that we might want to look at the feature list
> > > > > length.
> > > > > 
> > > > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c
> > > > > b/drivers/net/ethernet/intel/i40e/i40e_main.c
> > []
> > > > >        if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
> > > > > -             buf += sprintf(buf, "VEB ");
> > > > > +             i += snprintf(&buf[i], REMAIN(i), "VEPA ");
> > > > 
> > > >     Not "VEB "?
> > > 
> > > Nice catch Sergei, I will wait a till this afternoon to respin
> the
> > > patch series, just in case there are other changes needed that
> our
> > > validation did not catch. :-)
> > 
> > trivia:
> > 
> > If you redo these, it'd be nicer not to use " " after each
> > fixed string, but use " " before each fixed string.
> > 
> > The final output string would be 1 byte shorter overall and
> > not have an excess " " before the newline.
> > 
> > The declaration of i doesn't need initialization to 0:
> > 
> >       i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", ...
> > 
> > would work.
> 
> Maybe something like this patch (net-next)
> 
> Fix I40E_FLAG_VEB_MODE_ENABLED output of VEB
> 
> Miscellanea:
> o Remove unnecessary string variable
> o Add space before not after fixed strings
> o Use kmalloc not kzalloc
> o Don't initialize i to 0, use result of first snprintf
> 
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----
> ------------
>  1 file changed, 19 insertions(+), 23 deletions(-)

Looks fine Joe, can you send to intel-wired-lan@lists.osuosl.org mailin
g list?  That way I can get it added to my queue and the other
developers can properly review the change.

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

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

* [PATCH] i40e: Fix i40e_print_features() VEB mode output
  2015-12-02  7:25           ` Jeff Kirsher
@ 2015-12-02  8:38               ` Joe Perches
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Perches @ 2015-12-02  8:38 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Jeff Kirsher, netdev, Sergei Shtylyov, Shannon Nelson

Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string building")
added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
function i40e_print_features.

Fix it.

Miscellanea:

o Remove unnecessary string variable
o Add space before not after fixed strings
o Use kmalloc not kzalloc
o Don't initialize i to 0, use result of first snprintf

Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----------------
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 4b7d874..145eeb5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -10240,52 +10240,48 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)
 static void i40e_print_features(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = &pf->hw;
-	char *buf, *string;
-	int i = 0;
+	char *buf;
+	int i;
 
-	string = kzalloc(INFO_STRING_LEN, GFP_KERNEL);
-	if (!string) {
-		dev_err(&pf->pdev->dev, "Features string allocation failed\n");
+	buf = kmalloc(INFO_STRING_LEN, GFP_KERNEL);
+	if (!buf)
 		return;
-	}
-
-	buf = string;
 
-	i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id);
+	i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", hw->pf_id);
 #ifdef CONFIG_PCI_IOV
-	i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf->num_req_vfs);
+	i += snprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs);
 #endif
-	i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ",
+	i += snprintf(&buf[i], REMAIN(i), " VSIs: %d QP: %d RX: %s",
 		      pf->hw.func_caps.num_vsis,
 		      pf->vsi[pf->lan_vsi]->num_queue_pairs,
 		      pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
 
 	if (pf->flags & I40E_FLAG_RSS_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "RSS ");
+		i += snprintf(&buf[i], REMAIN(i), " RSS");
 	if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FD_ATR ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_ATR");
 	if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
-		i += snprintf(&buf[i], REMAIN(i), "FD_SB ");
-		i += snprintf(&buf[i], REMAIN(i), "NTUPLE ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_SB");
+		i += snprintf(&buf[i], REMAIN(i), " NTUPLE");
 	}
 	if (pf->flags & I40E_FLAG_DCB_CAPABLE)
-		i += snprintf(&buf[i], REMAIN(i), "DCB ");
+		i += snprintf(&buf[i], REMAIN(i), " DCB");
 #if IS_ENABLED(CONFIG_VXLAN)
-	i += snprintf(&buf[i], REMAIN(i), "VxLAN ");
+	i += snprintf(&buf[i], REMAIN(i), " VxLAN");
 #endif
 	if (pf->flags & I40E_FLAG_PTP)
-		i += snprintf(&buf[i], REMAIN(i), "PTP ");
+		i += snprintf(&buf[i], REMAIN(i), " PTP");
 #ifdef I40E_FCOE
 	if (pf->flags & I40E_FLAG_FCOE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FCOE ");
+		i += snprintf(&buf[i], REMAIN(i), " FCOE");
 #endif
 	if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEB");
 	else
-		buf += sprintf(buf, "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEPA");
 
-	dev_info(&pf->pdev->dev, "%s\n", string);
-	kfree(string);
+	dev_info(&pf->pdev->dev, "%s\n", buf);
+	kfree(buf);
 	WARN_ON(i > INFO_STRING_LEN);
 }
 

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

* [Intel-wired-lan] [PATCH] i40e: Fix i40e_print_features() VEB mode output
@ 2015-12-02  8:38               ` Joe Perches
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Perches @ 2015-12-02  8:38 UTC (permalink / raw)
  To: intel-wired-lan

Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string building")
added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
function i40e_print_features.

Fix it.

Miscellanea:

o Remove unnecessary string variable
o Add space before not after fixed strings
o Use kmalloc not kzalloc
o Don't initialize i to 0, use result of first snprintf

Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Joe Perches <joe@perches.com>
---
?drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----------------
?1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 4b7d874..145eeb5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -10240,52 +10240,48 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)
?static void i40e_print_features(struct i40e_pf *pf)
?{
?	struct i40e_hw *hw = &pf->hw;
-	char *buf, *string;
-	int i = 0;
+	char *buf;
+	int i;
?
-	string = kzalloc(INFO_STRING_LEN, GFP_KERNEL);
-	if (!string) {
-		dev_err(&pf->pdev->dev, "Features string allocation failed\n");
+	buf = kmalloc(INFO_STRING_LEN, GFP_KERNEL);
+	if (!buf)
?		return;
-	}
-
-	buf = string;
?
-	i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id);
+	i = snprintf(buf, INFO_STRING_LEN, "Features: PF-id[%d]", hw->pf_id);
?#ifdef CONFIG_PCI_IOV
-	i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf->num_req_vfs);
+	i += snprintf(&buf[i], REMAIN(i), " VFs: %d", pf->num_req_vfs);
?#endif
-	i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ",
+	i += snprintf(&buf[i], REMAIN(i), " VSIs: %d QP: %d RX: %s",
?		??????pf->hw.func_caps.num_vsis,
?		??????pf->vsi[pf->lan_vsi]->num_queue_pairs,
?		??????pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
?
?	if (pf->flags & I40E_FLAG_RSS_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "RSS ");
+		i += snprintf(&buf[i], REMAIN(i), " RSS");
?	if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FD_ATR ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_ATR");
?	if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
-		i += snprintf(&buf[i], REMAIN(i), "FD_SB ");
-		i += snprintf(&buf[i], REMAIN(i), "NTUPLE ");
+		i += snprintf(&buf[i], REMAIN(i), " FD_SB");
+		i += snprintf(&buf[i], REMAIN(i), " NTUPLE");
?	}
?	if (pf->flags & I40E_FLAG_DCB_CAPABLE)
-		i += snprintf(&buf[i], REMAIN(i), "DCB ");
+		i += snprintf(&buf[i], REMAIN(i), " DCB");
?#if IS_ENABLED(CONFIG_VXLAN)
-	i += snprintf(&buf[i], REMAIN(i), "VxLAN ");
+	i += snprintf(&buf[i], REMAIN(i), " VxLAN");
?#endif
?	if (pf->flags & I40E_FLAG_PTP)
-		i += snprintf(&buf[i], REMAIN(i), "PTP ");
+		i += snprintf(&buf[i], REMAIN(i), " PTP");
?#ifdef I40E_FCOE
?	if (pf->flags & I40E_FLAG_FCOE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "FCOE ");
+		i += snprintf(&buf[i], REMAIN(i), " FCOE");
?#endif
?	if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
-		i += snprintf(&buf[i], REMAIN(i), "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEB");
?	else
-		buf += sprintf(buf, "VEPA ");
+		i += snprintf(&buf[i], REMAIN(i), " VEPA");
?
-	dev_info(&pf->pdev->dev, "%s\n", string);
-	kfree(string);
+	dev_info(&pf->pdev->dev, "%s\n", buf);
+	kfree(buf);
?	WARN_ON(i > INFO_STRING_LEN);
?}
?

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

* Re: [PATCH] i40e: Fix i40e_print_features() VEB mode output
  2015-12-02  8:38               ` [Intel-wired-lan] " Joe Perches
@ 2015-12-02  9:56                 ` Jeff Kirsher
  -1 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-12-02  9:56 UTC (permalink / raw)
  To: Joe Perches, intel-wired-lan; +Cc: netdev, Sergei Shtylyov, Shannon Nelson

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

On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
> Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string
> building")
> added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
> function i40e_print_features.
> 
> Fix it.
> 
> Miscellanea:
> 
> o Remove unnecessary string variable
> o Add space before not after fixed strings
> o Use kmalloc not kzalloc
> o Don't initialize i to 0, use result of first snprintf
> 
> Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Don't you mean Reported-by?  I am not aware of Noticed-by as being a
recognized signature.

> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----
> ------------
>  1 file changed, 19 insertions(+), 23 deletions(-)

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

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

* [Intel-wired-lan] [PATCH] i40e: Fix i40e_print_features() VEB mode output
@ 2015-12-02  9:56                 ` Jeff Kirsher
  0 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-12-02  9:56 UTC (permalink / raw)
  To: intel-wired-lan

On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
> Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string
> building")
> added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
> function i40e_print_features.
> 
> Fix it.
> 
> Miscellanea:
> 
> o Remove unnecessary string variable
> o Add space before not after fixed strings
> o Use kmalloc not kzalloc
> o Don't initialize i to 0, use result of first snprintf
> 
> Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Don't you mean Reported-by? ?I am not aware of Noticed-by as being a
recognized signature.

> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> ?drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----
> ------------
> ?1 file changed, 19 insertions(+), 23 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20151202/7301bf93/attachment-0001.asc>

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

* Re: [PATCH] i40e: Fix i40e_print_features() VEB mode output
  2015-12-02  9:56                 ` [Intel-wired-lan] " Jeff Kirsher
@ 2015-12-02 10:12                   ` Joe Perches
  -1 siblings, 0 replies; 34+ messages in thread
From: Joe Perches @ 2015-12-02 10:12 UTC (permalink / raw)
  To: Jeff Kirsher, intel-wired-lan; +Cc: netdev, Sergei Shtylyov, Shannon Nelson

On Wed, 2015-12-02 at 01:56 -0800, Jeff Kirsher wrote:
> On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
> > Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string
> > building")
> > added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
> > function i40e_print_features.
> > 
> > Fix it.
> > 
> > Miscellanea:
> > 
> > o Remove unnecessary string variable
> > o Add space before not after fixed strings
> > o Use kmalloc not kzalloc
> > o Don't initialize i to 0, use result of first snprintf
> > 
> > Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
> Don't you mean Reported-by?  I am not aware of Noticed-by as being a
> recognized signature.

At least for the get_maintainer script, "<anything>-by:" is a signature

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

* [Intel-wired-lan] [PATCH] i40e: Fix i40e_print_features() VEB mode output
@ 2015-12-02 10:12                   ` Joe Perches
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Perches @ 2015-12-02 10:12 UTC (permalink / raw)
  To: intel-wired-lan

On Wed, 2015-12-02 at 01:56 -0800, Jeff Kirsher wrote:
> On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
> > Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string
> > building")
> > added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
> > function i40e_print_features.
> > 
> > Fix it.
> > 
> > Miscellanea:
> > 
> > o Remove unnecessary string variable
> > o Add space before not after fixed strings
> > o Use kmalloc not kzalloc
> > o Don't initialize i to 0, use result of first snprintf
> > 
> > Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
> Don't you mean Reported-by? ?I am not aware of Noticed-by as being a
> recognized signature.

At least for the get_maintainer script, "<anything>-by:" is a signature



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

* Re: [PATCH] i40e: Fix i40e_print_features() VEB mode output
  2015-12-02 10:12                   ` [Intel-wired-lan] " Joe Perches
@ 2015-12-02 20:48                     ` David Miller
  -1 siblings, 0 replies; 34+ messages in thread
From: David Miller @ 2015-12-02 20:48 UTC (permalink / raw)
  To: joe
  Cc: jeffrey.t.kirsher, intel-wired-lan, netdev, sergei.shtylyov,
	shannon.nelson

From: Joe Perches <joe@perches.com>
Date: Wed, 02 Dec 2015 02:12:29 -0800

> On Wed, 2015-12-02 at 01:56 -0800, Jeff Kirsher wrote:
>> On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
>> > Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string
>> > building")
>> > added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
>> > function i40e_print_features.
>> > 
>> > Fix it.
>> > 
>> > Miscellanea:
>> > 
>> > o Remove unnecessary string variable
>> > o Add space before not after fixed strings
>> > o Use kmalloc not kzalloc
>> > o Don't initialize i to 0, use result of first snprintf
>> > 
>> > Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> 
>> Don't you mean Reported-by?  I am not aware of Noticed-by as being a
>> recognized signature.
> 
> At least for the get_maintainer script, "<anything>-by:" is a signature

Is patchwork using the same regexp?  If not, for the time being don't
user non-standard tags, and furthermore please ask the patchwork folks
to use something similar to getmaintainer.pl

Thanks.

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

* [Intel-wired-lan] [PATCH] i40e: Fix i40e_print_features() VEB mode output
@ 2015-12-02 20:48                     ` David Miller
  0 siblings, 0 replies; 34+ messages in thread
From: David Miller @ 2015-12-02 20:48 UTC (permalink / raw)
  To: intel-wired-lan

From: Joe Perches <joe@perches.com>
Date: Wed, 02 Dec 2015 02:12:29 -0800

> On Wed, 2015-12-02 at 01:56 -0800, Jeff Kirsher wrote:
>> On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
>> > Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string
>> > building")
>> > added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
>> > function i40e_print_features.
>> > 
>> > Fix it.
>> > 
>> > Miscellanea:
>> > 
>> > o Remove unnecessary string variable
>> > o Add space before not after fixed strings
>> > o Use kmalloc not kzalloc
>> > o Don't initialize i to 0, use result of first snprintf
>> > 
>> > Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> 
>> Don't you mean Reported-by? ?I am not aware of Noticed-by as being a
>> recognized signature.
> 
> At least for the get_maintainer script, "<anything>-by:" is a signature

Is patchwork using the same regexp?  If not, for the time being don't
user non-standard tags, and furthermore please ask the patchwork folks
to use something similar to getmaintainer.pl

Thanks.

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

* Re: [PATCH] i40e: Fix i40e_print_features() VEB mode output
  2015-12-02 20:48                     ` [Intel-wired-lan] " David Miller
@ 2015-12-02 21:09                       ` Joe Perches
  -1 siblings, 0 replies; 34+ messages in thread
From: Joe Perches @ 2015-12-02 21:09 UTC (permalink / raw)
  To: David Miller, patchwork
  Cc: jeffrey.t.kirsher, intel-wired-lan, netdev, sergei.shtylyov,
	shannon.nelson, Junio C Hamano

On Wed, 2015-12-02 at 15:48 -0500, David Miller wrote:
> From: Joe Perches <joe@perches.com> 02 Dec 2015 02:12:29 -0800
> > On Wed, 2015-12-02 at 01:56 -0800, Jeff Kirsher wrote:
> >> On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
> >> > Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> 
> >> Don't you mean Reported-by?  I am not aware of Noticed-by as being a
> >> recognized signature. 
> > At least for the get_maintainer script, "-by:" is a signature
> Is patchwork using the same regexp?  If not, for the time being don't
> user non-standard tags, and furthermore please ask the patchwork folks
> to use something similar to getmaintainer.pl

It doesn't seem so.

    response_re = re.compile(
        r'^(Tested|Reviewed|Acked|Signed-off|Nacked|Reported)-by: .*$',
        re.M | re.I)

patchwork also doesn't seem very forgiving of misformatted signatures.
(btw: Junio Hamano seems to prefer calling them trailers)

And patchwork doesn't seem to handle "cc: " markers either.

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

* [Intel-wired-lan] [PATCH] i40e: Fix i40e_print_features() VEB mode output
@ 2015-12-02 21:09                       ` Joe Perches
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Perches @ 2015-12-02 21:09 UTC (permalink / raw)
  To: intel-wired-lan

On Wed, 2015-12-02 at 15:48 -0500, David Miller wrote:
> From: Joe Perches <joe@perches.com> 02 Dec 2015 02:12:29 -0800
> > On Wed, 2015-12-02 at 01:56 -0800, Jeff Kirsher wrote:
> >> On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
> >> > Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>?
> >> Don't you mean Reported-by? ?I am not aware of Noticed-by as being a
> >> recognized signature.?
> > At least for the get_maintainer script, "-by:" is a signature
> Is patchwork using the same regexp?? If not, for the time being don't
> user non-standard tags, and furthermore please ask the patchwork folks
> to use something similar to getmaintainer.pl

It doesn't seem so.

????response_re = re.compile(
????????r'^(Tested|Reviewed|Acked|Signed-off|Nacked|Reported)-by: .*$',
????????re.M | re.I)

patchwork also doesn't seem very forgiving of misformatted signatures.
(btw: Junio Hamano seems to prefer calling them trailers)

And patchwork doesn't seem to handle "cc: " markers either.

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

* Re: [PATCH] i40e: Fix i40e_print_features() VEB mode output
  2015-12-02  8:38               ` [Intel-wired-lan] " Joe Perches
@ 2015-12-03 12:13                 ` Jeff Kirsher
  -1 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-12-03 12:13 UTC (permalink / raw)
  To: Joe Perches, intel-wired-lan; +Cc: netdev, Sergei Shtylyov, Shannon Nelson

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

On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
> Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string
> building")
> added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
> function i40e_print_features.
> 
> Fix it.
> 
> Miscellanea:
> 
> o Remove unnecessary string variable
> o Add space before not after fixed strings
> o Use kmalloc not kzalloc
> o Don't initialize i to 0, use result of first snprintf
> 
> Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----
> ------------
>  1 file changed, 19 insertions(+), 23 deletions(-)

Your patch does not apply cleanly, it appears you used Dave's net-next
tree to generate your patch, versus my next-queue tree (dev-queue
branch) which has a number of i40e patches already applied.

As a one-time only reminder, I have gone ahead and applied your patch
by hand.  I will send your updated patch out here in just a minute.

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

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

* [Intel-wired-lan] [PATCH] i40e: Fix i40e_print_features() VEB mode output
@ 2015-12-03 12:13                 ` Jeff Kirsher
  0 siblings, 0 replies; 34+ messages in thread
From: Jeff Kirsher @ 2015-12-03 12:13 UTC (permalink / raw)
  To: intel-wired-lan

On Wed, 2015-12-02 at 00:38 -0800, Joe Perches wrote:
> Commit 7fd89545f337 ("i40e: remove BUG_ON from feature string
> building")
> added defective output when I40E_FLAG_VEB_MODE_ENABLED was set in
> function i40e_print_features.
> 
> Fix it.
> 
> Miscellanea:
> 
> o Remove unnecessary string variable
> o Add space before not after fixed strings
> o Use kmalloc not kzalloc
> o Don't initialize i to 0, use result of first snprintf
> 
> Noticed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> ?drivers/net/ethernet/intel/i40e/i40e_main.c | 42 +++++++++++++----
> ------------
> ?1 file changed, 19 insertions(+), 23 deletions(-)

Your patch does not apply cleanly, it appears you used Dave's net-next
tree to generate your patch, versus my next-queue tree (dev-queue
branch) which has a number of i40e patches already applied.

As a one-time only reminder, I have gone ahead and applied your patch
by hand. ?I will send your updated patch out here in just a minute.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20151203/a43bd7a2/attachment.asc>

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

end of thread, other threads:[~2015-12-03 12:13 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-25 18:21 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 01/15] fm10k: use napi_schedule_irqoff() Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 02/15] i40e/i40evf: remove unused tunnel parameter Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 03/15] i40e: Change BUG_ON to WARN_ON in service event complete Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 04/15] i40e: remove BUG_ON from feature string building Jeff Kirsher
2015-11-25 18:26   ` Sergei Shtylyov
2015-11-25 18:35     ` Jeff Kirsher
2015-11-25 19:36       ` Joe Perches
2015-12-01 20:48         ` Joe Perches
2015-12-02  7:25           ` Jeff Kirsher
2015-12-02  8:38             ` [PATCH] i40e: Fix i40e_print_features() VEB mode output Joe Perches
2015-12-02  8:38               ` [Intel-wired-lan] " Joe Perches
2015-12-02  9:56               ` Jeff Kirsher
2015-12-02  9:56                 ` [Intel-wired-lan] " Jeff Kirsher
2015-12-02 10:12                 ` Joe Perches
2015-12-02 10:12                   ` [Intel-wired-lan] " Joe Perches
2015-12-02 20:48                   ` David Miller
2015-12-02 20:48                     ` [Intel-wired-lan] " David Miller
2015-12-02 21:09                     ` Joe Perches
2015-12-02 21:09                       ` [Intel-wired-lan] " Joe Perches
2015-12-03 12:13               ` Jeff Kirsher
2015-12-03 12:13                 ` [Intel-wired-lan] " Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 05/15] i40e: remove BUG_ON from FCoE setup Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 06/15] i40e: Workaround fix for mss < 256 issue Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 07/15] i40e/i40evf: Add a stat to track how many times we have to do a force WB Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 08/15] i40e: Move the saving of old link info from handle_link_event to link_event Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 09/15] i40e/i40evf: Add comment to #endif Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 10/15] i40e/i40evf: clean up error messages Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 11/15] i40evf: handle many MAC filters correctly Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 12/15] i40e: return the number of enabled queues for ETHTOOL_GRXRINGS Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 13/15] i40e: rework the functions to configure RSS with similar parameters Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 14/15] i40e: create a generic configure rss function Jeff Kirsher
2015-11-25 18:21 ` [net-next v2 15/15] i40e: Bump version to 1.4.2 Jeff Kirsher
2015-11-25 18:58 ` [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-25 David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.