DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/17] net/fm10k: update base code.
@ 2017-03-03  3:17 Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 01/17] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
                   ` (18 more replies)
  0 siblings, 19 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

The patch set update to latest fm10k base code, there is no
significent features be added, but include couple enhancement
like clean up the logic for tlv attr parse, improve VF multi-bit 
VLAN handle etc, also with some code/comment clean as well.

Qi Zhang (17):
  net/fm10k/base: add a flag to indicate VF trust mode
  net/fm10k/base: reset multicaset mode when deleting lport
  net/fm10k/base: expose macros needed by DPDK
  net/fm10k/base: add error code
  net/fm10k/base: clean up the logic
  net/fm10k/base: add new item to lport msg attr
  net/fm10k/base: use 8 bit notation instead of 10bit notation
  net/fm10k/base: use different name for override bit
  net/fm10k/base: update comment regarding reserved bits check
  net/fm10k/base: improve VF's multi-bit VLAN update requests
  net/fm10k/base: enable lport map request
  net/fm10k/base: add macros for global interrupt
  net/fm10k/base: don't stop reset
  net/fm10k/base: add marcro for geneve tunnel
  net/fm10k/base: improve re-map queues handle
  net/fm10k/base: replace marcos
  net/fm10k/base: equest reset when mbx->state changes

 drivers/net/fm10k/base/fm10k_common.c |  11 ++-
 drivers/net/fm10k/base/fm10k_mbx.c    |  10 ++-
 drivers/net/fm10k/base/fm10k_mbx.h    |   2 +
 drivers/net/fm10k/base/fm10k_osdep.h  |  17 -----
 drivers/net/fm10k/base/fm10k_pf.c     | 140 ++++++++++++++++++++--------------
 drivers/net/fm10k/base/fm10k_pf.h     |   2 +
 drivers/net/fm10k/base/fm10k_tlv.c    |  16 ++--
 drivers/net/fm10k/base/fm10k_type.h   |  71 +++++++++++++++--
 drivers/net/fm10k/base/fm10k_vf.c     |  24 +++---
 9 files changed, 189 insertions(+), 104 deletions(-)

-- 
2.9.3

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

* [dpdk-dev] [PATCH 01/17] net/fm10k/base: add a flag to indicate VF trust mode
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 02/17] net/fm10k/base: reset multicaset mode when deleting lport Qi Zhang
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Adds boolean flag in fm10k_vf_info to support configuring
a VF to be trusted.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 3fc8f13..fe3e498 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -676,6 +676,9 @@ struct fm10k_vf_info {
 	u8			vf_flags;	/* flags indicating what modes
 						 * are supported for the port
 						 */
+#ifndef NO_FM10K_VF_TRUSTED_MODE
+	bool			trusted;	/* VF trust mode */
+#endif
 };
 
 #define FM10K_VF_FLAG_ALLMULTI_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_ALLMULTI))
-- 
2.9.3

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

* [dpdk-dev] [PATCH 02/17] net/fm10k/base: reset multicaset mode when deleting lport
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 01/17] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-05 11:41   ` Ferruh Yigit
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 03/17] net/fm10k/base: expose macros needed by DPDK Qi Zhang
                   ` (16 subsequent siblings)
  18 siblings, 1 reply; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Deleting lport when multicast mod is configured to
FM10K_XCAST_MODE_ALLMULTI or FM10K_XCAST_MODE_PROMISC will
result in generating orphaned multicast-group entries in the
switch manager.
Before deleting the lport, reset multicast mode to
FM10K_XCAST_MODE_NONE to flush out these multicast-group
entries.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 105babf..9730119 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -536,6 +536,10 @@ STATIC s32 fm10k_update_lport_state_pf(struct fm10k_hw *hw, u16 glort,
 	if (!fm10k_glort_valid_pf(hw, glort))
 		return FM10K_ERR_PARAM;
 
+	/* reset multicast mode if deleting lport */
+	if (!enable)
+		fm10k_update_xcast_mode_pf(hw, glort, FM10K_XCAST_MODE_NONE);
+
 	/* construct the lport message from the 2 pieces of data we have */
 	lport_msg = ((u32)count << 16) | glort;
 
-- 
2.9.3

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

* [dpdk-dev] [PATCH 03/17] net/fm10k/base: expose macros needed by DPDK
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 01/17] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 02/17] net/fm10k/base: reset multicaset mode when deleting lport Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-05 11:41   ` Ferruh Yigit
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 04/17] net/fm10k/base: add error code Qi Zhang
                   ` (15 subsequent siblings)
  18 siblings, 1 reply; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Some defines were previously wrapped to strip them from opensource driver
builds, but these are required by DPDK.  Change the wrapping of these so 
that the DPDK gets them as long as DPDK_SUPPORT is correctly added as a 
strip flag, while we can remove the reduandant ones in fm10k_osdep.h.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_osdep.h | 17 ------------
 drivers/net/fm10k/base/fm10k_type.h  | 50 ++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 17 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index f07b678..199ebd8 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -163,23 +163,6 @@ typedef int        bool;
 #define FM10K_RXD_PKTTYPE_MASK		0x03F0
 #define FM10K_RXD_PKTTYPE_SHIFT		4
 
-enum fm10k_rdesc_pkt_type {
-	/* L3 type */
-	FM10K_PKTTYPE_OTHER	= 0x00,
-	FM10K_PKTTYPE_IPV4	= 0x01,
-	FM10K_PKTTYPE_IPV4_EX	= 0x02,
-	FM10K_PKTTYPE_IPV6	= 0x03,
-	FM10K_PKTTYPE_IPV6_EX	= 0x04,
-
-	/* L4 type */
-	FM10K_PKTTYPE_TCP	= 0x08,
-	FM10K_PKTTYPE_UDP	= 0x10,
-	FM10K_PKTTYPE_GRE	= 0x18,
-	FM10K_PKTTYPE_VXLAN	= 0x20,
-	FM10K_PKTTYPE_NVGRE	= 0x28,
-	FM10K_PKTTYPE_GENEVE	= 0x30
-};
-
 #define FM10K_RXD_STATUS_IPCS		0x0008 /* Indicates IPv4 csum */
 #define FM10K_RXD_STATUS_HBO		0x0400 /* header buffer overrun */
 
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index fe3e498..8ddfd49 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -40,6 +40,9 @@ struct fm10k_hw;
 #include "fm10k_osdep.h"
 #include "fm10k_mbx.h"
 
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_INTEL_VENDOR_ID		0x8086
+#endif
 #define FM10K_DEV_ID_PF			0x15A4
 #define FM10K_DEV_ID_VF			0x15A5
 #ifdef BOULDER_RAPIDS_HW
@@ -125,11 +128,19 @@ struct fm10k_hw;
 
 /* Interrupt control registers */
 #define FM10K_EICR		0x0006
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_EICR_PCA_FAULT			0x00000001
+#define FM10K_EICR_THI_FAULT			0x00000004
+#define FM10K_EICR_FUM_FAULT			0x00000020
+#endif
 #define FM10K_EICR_FAULT_MASK			0x0000003F
 #define FM10K_EICR_MAILBOX			0x00000040
 #define FM10K_EICR_SWITCHREADY			0x00000080
 #define FM10K_EICR_SWITCHNOTREADY		0x00000100
 #define FM10K_EICR_SWITCHINTERRUPT		0x00000200
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_EICR_SRAMERROR			0x00000400
+#endif
 #define FM10K_EICR_VFLR				0x00000800
 #define FM10K_EICR_MAXHOLDTIME			0x00001000
 #define FM10K_EIMR		0x0007
@@ -211,6 +222,9 @@ struct fm10k_hw;
 #define FM10K_DMA_CTRL_RX_ENABLE		0x00000010
 #define FM10K_DMA_CTRL_RX_ACTIVE		0x00000080
 #define FM10K_DMA_CTRL_RX_DESC_SIZE		0x00000100
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_DMA_CTRL_MINMSS_SHIFT		9
+#endif
 #define FM10K_DMA_CTRL_MINMSS_64		0x00008000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN3	0x04800000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN2	0x04000000
@@ -283,6 +297,9 @@ struct fm10k_hw;
 #define FM10K_RXDCTL_WRITE_BACK_MIN_DELAY	0x00000001
 #define FM10K_RXDCTL_DROP_ON_EMPTY		0x00000200
 #define FM10K_RXINT(_n)		((0x40 * (_n)) + 0x4008)
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_RXINT_TIMER_SHIFT			8
+#endif
 #define FM10K_SRRCTL(_n)	((0x40 * (_n)) + 0x4009)
 #define FM10K_SRRCTL_BSIZEPKT_SHIFT		8 /* shift _right_ */
 #define FM10K_SRRCTL_LOOPBACK_SUPPRESS		0x40000000
@@ -336,6 +353,9 @@ struct fm10k_hw;
 #define FM10K_TXQCTL_VID_MASK			0x0FFF0000
 #define FM10K_TXQCTL_UNLIMITED_BW		0x10000000
 #define FM10K_TXINT(_n)		((0x40 * (_n)) + 0x8008)
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_TXINT_TIMER_SHIFT			8
+#endif
 
 /* Tx Statistics */
 #define FM10K_QPTC(_n)		((0x40 * (_n)) + 0x8009)
@@ -374,6 +394,9 @@ struct fm10k_hw;
 /* Switch manager interrupt registers */
 #define FM10K_IP		0x13000
 #define FM10K_IP_NOTINRESET			0x00000100
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_SRAM_IP		0x13003
+#endif
 
 /* VLAN registers */
 #define FM10K_VLAN_TABLE(_n, _m)	((0x80 * (_n)) + (_m) + 0x14000)
@@ -815,6 +838,30 @@ enum fm10k_rdesc_rss_type {
 	/* Reserved 0x9 - 0xF */
 };
 
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_RXD_PKTTYPE_MASK		0x03F0
+#endif
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_RXD_PKTTYPE_SHIFT		4
+#endif
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+enum fm10k_rdesc_pkt_type {
+	/* L3 type */
+	FM10K_PKTTYPE_OTHER	= 0x00,
+	FM10K_PKTTYPE_IPV4	= 0x01,
+	FM10K_PKTTYPE_IPV4_EX	= 0x02,
+	FM10K_PKTTYPE_IPV6	= 0x03,
+	FM10K_PKTTYPE_IPV6_EX	= 0x04,
+
+	/* L4 type */
+	FM10K_PKTTYPE_TCP	= 0x08,
+	FM10K_PKTTYPE_UDP	= 0x10,
+	FM10K_PKTTYPE_GRE	= 0x18,
+	FM10K_PKTTYPE_VXLAN	= 0x20,
+	FM10K_PKTTYPE_NVGRE	= 0x28,
+	FM10K_PKTTYPE_GENEVE	= 0x30
+};
+#endif
 
 #define FM10K_RXD_HDR_INFO_XC_MASK	0x0006
 enum fm10k_rxdesc_xc {
@@ -826,6 +873,9 @@ enum fm10k_rxdesc_xc {
 
 #define FM10K_RXD_STATUS_DD		0x0001 /* Descriptor done */
 #define FM10K_RXD_STATUS_EOP		0x0002 /* End of packet */
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_RXD_STATUS_IPCS		0x0008 /* Indicates IPv4 csum */
+#endif
 #define FM10K_RXD_STATUS_L4CS		0x0010 /* Indicates an L4 csum */
 #define FM10K_RXD_STATUS_L4CS2		0x0040 /* Inner header L4 csum */
 #define FM10K_RXD_STATUS_L4E2		0x0800 /* Inner header L4 csum err */
-- 
2.9.3

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

* [dpdk-dev] [PATCH 04/17] net/fm10k/base: add error code
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (2 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 03/17] net/fm10k/base: expose macros needed by DPDK Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 05/17] net/fm10k/base: clean up the logic Qi Zhang
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Add API error code for when PEP is not scheduled.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index c84b1bc..ca125c2 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -91,6 +91,8 @@ enum fm10k_pf_tlv_attr_id_v1 {
 #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT	16
 #define FM10K_MSG_UPDATE_PVID_PVID_SIZE		16
 
+#define FM10K_MSG_ERR_PEP_NOT_SCHEDULED	280
+
 /* The following data structures are overlayed directly onto TLV mailbox
  * messages, and must not break 4 byte alignment. Ensure the structures line
  * up correctly as per their TLV definition.
-- 
2.9.3

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

* [dpdk-dev] [PATCH 05/17] net/fm10k/base: clean up the logic
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (3 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 04/17] net/fm10k/base: add error code Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 06/17] net/fm10k/base: add new item to lport msg attr Qi Zhang
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Clean up the logic in fm10k_tlv_attr_parse, we
should not reply on that FM10K_NOT_IMPLEMENTED is
greater than zero, as this can easily cause confusion.
The patch also correct a minor document error.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_tlv.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c
index e6150c1..0328ede 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.c
+++ b/drivers/net/fm10k/base/fm10k_tlv.c
@@ -520,7 +520,8 @@ STATIC s32 fm10k_tlv_attr_validate(u32 *attr,
  *  up into an array of pointers stored in results.  The function will
  *  return FM10K_ERR_PARAM on any input or message error,
  *  FM10K_NOT_IMPLEMENTED for any attribute that is outside of the array
- *  and 0 on success.
+ *  and 0 on success. Any attributes not found in tlv_attr will be silently
+ *  ignored.
  **/
 static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
 				const struct fm10k_tlv_attr *tlv_attr)
@@ -559,14 +560,15 @@ static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
 	while (offset < len) {
 		attr_id = *attr & FM10K_TLV_ID_MASK;
 
-		if (attr_id < FM10K_TLV_RESULTS_MAX)
-			err = fm10k_tlv_attr_validate(attr, tlv_attr);
-		else
-			err = FM10K_NOT_IMPLEMENTED;
+		if (attr_id >= FM10K_TLV_RESULTS_MAX)
+			return FM10K_NOT_IMPLEMENTED;
 
-		if (err < 0)
+		err = fm10k_tlv_attr_validate(attr, tlv_attr);
+		if (err == FM10K_NOT_IMPLEMENTED)
+			; /* silently ignore non-implemented attributes */
+		else if (err)
 			return err;
-		if (!err)
+		else
 			results[attr_id] = attr;
 
 		/* update offset */
-- 
2.9.3

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

* [dpdk-dev] [PATCH 06/17] net/fm10k/base: add new item to lport msg attr
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (4 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 05/17] net/fm10k/base: clean up the logic Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 07/17] net/fm10k/base: use 8 bit notation instead of 10bit notation Qi Zhang
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Add FM10K_PF_ATTR_ID_ERR, since it is possible for the switch manager 
to send out an error message indicating status of the LPORT_MAP due to 
zero allocated bandwidth.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 9730119..1dcea2b 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1705,6 +1705,8 @@ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)
 
 /* This structure defines the attibutes to be parsed below */
 const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[] = {
+	FM10K_TLV_ATTR_LE_STRUCT(FM10K_PF_ATTR_ID_ERR,
+				 sizeof(struct fm10k_swapi_error)),
 	FM10K_TLV_ATTR_U32(FM10K_PF_ATTR_ID_LPORT_MAP),
 	FM10K_TLV_ATTR_LAST
 };
-- 
2.9.3

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

* [dpdk-dev] [PATCH 07/17] net/fm10k/base: use 8 bit notation instead of 10bit notation
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (5 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 06/17] net/fm10k/base: add new item to lport msg attr Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-05 11:42   ` Ferruh Yigit
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 08/17] net/fm10k/base: use different name for override bit Qi Zhang
                   ` (11 subsequent siblings)
  18 siblings, 1 reply; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

The diagram represents bit layout of the multi-bit VLAN update
message format. Re-draw the numbers using base 8, and mark the
bit values every 8 bits at the top. This should make it more
easy to grasp the table quickly.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 1dcea2b..856cb8a 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -255,8 +255,8 @@ STATIC s32 fm10k_update_vlan_pf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)
 
 	/* VLAN multi-bit write:
 	 * The multi-bit write has several parts to it.
-	 *    3			  2		      1			  0
-	 *  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+	 *               24              16               8               0
+	 *  7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 * | RSVD0 |         Length        |C|RSVD0|        VLAN ID        |
 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-- 
2.9.3

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

* [dpdk-dev] [PATCH 08/17] net/fm10k/base: use different name for override bit
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (6 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 07/17] net/fm10k/base: use 8 bit notation instead of 10bit notation Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 09/17] net/fm10k/base: update comment regarding reserved bits check Qi Zhang
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Use a new #define FM10K_VLAN_OVERRIDE even though we're using
the exact same bit. The reason for this is clarity in the code,
otherwise you can read FM10K_VLAN_CLEAR and think it should be
removed. Also add a comment explaining why the FM10K_VLAN_OVERRIDE
bit is set.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 12 ++++++------
 drivers/net/fm10k/base/fm10k_type.h |  1 +
 drivers/net/fm10k/base/fm10k_vf.c   |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 856cb8a..878d46e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -912,13 +912,13 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	vf_q_idx = fm10k_vf_queue_index(hw, vf_idx);
 	qmap_idx = qmap_stride * vf_idx;
 
-	/* MAP Tx queue back to 0 temporarily, and disable it */
-	FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), 0);
-	FM10K_WRITE_REG(hw, FM10K_TXDCTL(vf_q_idx), 0);
-
-	/* determine correct default VLAN ID */
+	/* Determine correct default VLAN ID. The FM10K_VLAN_OVERRIDE bit is
+	 * used here to indicate to the VF that it will not have privilege to
+	 * write VLAN_TABLE. All policy is enforced on the PF but this allows
+	 * the VF to correctly report errors to userspace rqeuests.
+	 */
 	if (vf_info->pf_vid)
-		vf_vid = vf_info->pf_vid | FM10K_VLAN_CLEAR;
+		vf_vid = vf_info->pf_vid | FM10K_VLAN_OVERRIDE;
 	else
 		vf_vid = vf_info->sw_vid;
 
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 8ddfd49..515be26 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -407,6 +407,7 @@ struct fm10k_hw;
 #define FM10K_VLAN_TABLE_VSI_MAX		64
 #define FM10K_VLAN_LENGTH_SHIFT			16
 #define FM10K_VLAN_CLEAR			BIT(15)
+#define FM10K_VLAN_OVERRIDE			FM10K_VLAN_CLEAR
 #define FM10K_VLAN_ALL \
 	((FM10K_VLAN_TABLE_VID_MAX - 1) << FM10K_VLAN_LENGTH_SHIFT)
 
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index efbdbd1..533dfeb 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -268,7 +268,7 @@ s32 fm10k_msg_mac_vlan_vf(struct fm10k_hw *hw, u32 **results,
 
 	memcpy(hw->mac.perm_addr, perm_addr, ETH_ALEN);
 	hw->mac.default_vid = vid & (FM10K_VLAN_TABLE_VID_MAX - 1);
-	hw->mac.vlan_override = !!(vid & FM10K_VLAN_CLEAR);
+	hw->mac.vlan_override = !!(vid & FM10K_VLAN_OVERRIDE);
 
 	return FM10K_SUCCESS;
 }
-- 
2.9.3

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

* [dpdk-dev] [PATCH 09/17] net/fm10k/base: update comment regarding reserved bits check
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (7 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 08/17] net/fm10k/base: use different name for override bit Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 10/17] net/fm10k/base: improve VF's multi-bit VLAN update requests Qi Zhang
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

The original comment may be read incorrectly as referring to checking
the *entire* length is zero. However, it merely checks only the reserved
bits of both length and reserved in a small amount of code. Update the
comment to indicate this is a clever trick and clearly spell out that it
only checks the reserve bits.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 533dfeb..dd3d318 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -225,7 +225,7 @@ STATIC s32 fm10k_update_vlan_vf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)
 	if (vsi)
 		return FM10K_ERR_PARAM;
 
-	/* verify upper 4 bits of vid and length are 0 */
+	/* clever trick to verify reserved bits in both vid and length */
 	if ((vid << 16 | vid) >> 28)
 		return FM10K_ERR_PARAM;
 
-- 
2.9.3

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

* [dpdk-dev] [PATCH 10/17] net/fm10k/base: improve VF's multi-bit VLAN update requests
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (8 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 09/17] net/fm10k/base: update comment regarding reserved bits check Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-05 11:42   ` Ferruh Yigit
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 11/17] net/fm10k/base: enable lport map request Qi Zhang
                   ` (8 subsequent siblings)
  18 siblings, 1 reply; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

The VF uses a multi-bit update request to clear unused VLANs whenever it
resets. However, an accident in a previous refector broke multi-bit
updates for VFs, due to misreading a comment in fm10k_vf.c and
attempting to reduce code duplication. The problem occurs because
a multi-bit request has a non-zero length, and the PF would simply drop
any request with the upper 16 bits set. In addition, a multi-bit vlan
update does not have a concept for "VLAN 0" as the single bit update
does.

A previous revision of this patch resolved the issue by simply removing
the upper 16 bit check and the iov_select_vid checks. However, this would
remove the checks for default VID and for ensuring no other VLANs can be
enabled except pf_vid when it has been set. To resolve that issue, this
revision uses the iov_select_vid when we have a single-bit update, and
denies any multi-bit update when the VLAN was administratively set by
the PF. This should be ok since the PF properly updates VLAN_TABLE when
it assigns the PF vid. This ensures that requests to add or "remove" the
PF vid work as expected, but a rogue VF could not use the multi-bit
update as a loophole to attempt receiving traffic on other VLANs.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 878d46e..4c075b6 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1271,18 +1271,32 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		if (err)
 			return err;
 
-		/* verify upper 16 bits are zero */
-		if (vid >> 16)
-			return FM10K_ERR_PARAM;
-
 		set = !(vid & FM10K_VLAN_CLEAR);
 		vid &= ~FM10K_VLAN_CLEAR;
 
-		err = fm10k_iov_select_vid(vf_info, (u16)vid);
-		if (err < 0)
-			return err;
+		/* if the length field has been set, this is a multi-bit
+		 * update request. For multi-bit requests, simply disallow
+		 * them when the pf_vid has been set. In this case, the PF
+		 * should have already cleared the VLAN_TABLE, and if we
+		 * allowed them, it could allow a rogue VF to receive traffic
+		 * on a VLAN it was not assigned. In the single-bit case, we
+		 * need to modify requests for VLAN 0 to use the default PF or
+		 * SW vid when assigned.
+		 */
 
-		vid = err;
+		if (vid >> 16) {
+			/* prevent multi-bit requests when PF has
+			 * administratively set the VLAN for this VF
+			 */
+			if (vf_info->pf_vid)
+				return FM10K_ERR_PARAM;
+		} else {
+			err = fm10k_iov_select_vid(vf_info, (u16)vid);
+			if (err < 0)
+				return err;
+
+			vid = err;
+		}
 
 		/* update VSI info for VF in regards to VLAN table */
 		err = hw->mac.ops.update_vlan(hw, vid, vf_info->vsi, set);
-- 
2.9.3

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

* [dpdk-dev] [PATCH 11/17] net/fm10k/base: enable lport map request
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (9 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 10/17] net/fm10k/base: improve VF's multi-bit VLAN update requests Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 12/17] net/fm10k/base: add macros for global interrupt Qi Zhang
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

If the fm10k interface is brought up, but the switch manager software is
not running, the driver will continuously request the lport map every
few seconds in the base driver watchdog routine. Eventually after
several minutes the switch mailbox Tx fifo will fill up and the mailbox
will timeout, resulting in a reset. This reset will appear as if for no
reason, and occurs regularly every few minutes until the switch manager
software is loaded.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_common.c |  8 ++++++--
 drivers/net/fm10k/base/fm10k_pf.c     | 17 ++++-------------
 drivers/net/fm10k/base/fm10k_type.h   |  1 +
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_common.c b/drivers/net/fm10k/base/fm10k_common.c
index a90d2f0..7acc1ba 100644
--- a/drivers/net/fm10k/base/fm10k_common.c
+++ b/drivers/net/fm10k/base/fm10k_common.c
@@ -542,7 +542,7 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready)
 		goto out;
 
 	/* if we somehow dropped the Tx enable we should reset */
-	if (hw->mac.tx_ready && !(txdctl & FM10K_TXDCTL_ENABLE)) {
+	if (mac->tx_ready && !(txdctl & FM10K_TXDCTL_ENABLE)) {
 		ret_val = FM10K_ERR_RESET_REQUESTED;
 		goto out;
 	}
@@ -558,8 +558,12 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready)
 		goto out;
 
 	/* interface cannot receive traffic without logical ports */
-	if (mac->dglort_map == FM10K_DGLORTMAP_NONE)
+	if (mac->dglort_map == FM10K_DGLORTMAP_NONE) {
+		if (mac->ops.request_lport_map)
+			ret_val = mac->ops.request_lport_map(hw);
+
 		goto out;
+	}
 
 	/* if we passed all the tests above then the switch is ready and we no
 	 * longer need to check for link
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 4c075b6..bbc483d 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1688,13 +1688,12 @@ STATIC s32 fm10k_request_lport_map_pf(struct fm10k_hw *hw)
  *  @hw: pointer to hardware structure
  *  @switch_ready: pointer to boolean value that will record switch state
  *
- *  This funciton will check the DMA_CTRL2 register and mailbox in order
+ *  This function will check the DMA_CTRL2 register and mailbox in order
  *  to determine if the switch is ready for the PF to begin requesting
  *  addresses and mapping traffic to the local interface.
  **/
 STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)
 {
-	s32 ret_val = FM10K_SUCCESS;
 	u32 dma_ctrl2;
 
 	DEBUGFUNC("fm10k_get_host_state_pf");
@@ -1702,19 +1701,10 @@ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)
 	/* verify the switch is ready for interaction */
 	dma_ctrl2 = FM10K_READ_REG(hw, FM10K_DMA_CTRL2);
 	if (!(dma_ctrl2 & FM10K_DMA_CTRL2_SWITCH_READY))
-		goto out;
+		return FM10K_SUCCESS;
 
 	/* retrieve generic host state info */
-	ret_val = fm10k_get_host_state_generic(hw, switch_ready);
-	if (ret_val)
-		goto out;
-
-	/* interface cannot receive traffic without logical ports */
-	if (hw->mac.dglort_map == FM10K_DGLORTMAP_NONE)
-		ret_val = fm10k_request_lport_map_pf(hw);
-
-out:
-	return ret_val;
+	return fm10k_get_host_state_generic(hw, switch_ready);
 }
 
 /* This structure defines the attibutes to be parsed below */
@@ -2102,6 +2092,7 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
 	mac->ops.set_dma_mask = &fm10k_set_dma_mask_pf;
 	mac->ops.get_fault = &fm10k_get_fault_pf;
 	mac->ops.get_host_state = &fm10k_get_host_state_pf;
+	mac->ops.request_lport_map = &fm10k_request_lport_map_pf;
 	mac->ops.adjust_systime = &fm10k_adjust_systime_pf;
 	mac->ops.notify_offset = &fm10k_notify_offset_pf;
 	mac->ops.read_systime = &fm10k_read_systime_pf;
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 515be26..b74cebf 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -611,6 +611,7 @@ struct fm10k_mac_ops {
 	s32 (*stop_hw)(struct fm10k_hw *);
 	s32 (*get_bus_info)(struct fm10k_hw *);
 	s32 (*get_host_state)(struct fm10k_hw *, bool *);
+	s32 (*request_lport_map)(struct fm10k_hw *);
 #ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	bool (*is_slot_appropriate)(struct fm10k_hw *);
 #endif
-- 
2.9.3

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

* [dpdk-dev] [PATCH 12/17] net/fm10k/base: add macros for global interrupt
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (10 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 11/17] net/fm10k/base: enable lport map request Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 13/17] net/fm10k/base: don't stop reset Qi Zhang
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Add two macros for global interrupt.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.h b/drivers/net/fm10k/base/fm10k_mbx.h
index edc57df..2fac012 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.h
+++ b/drivers/net/fm10k/base/fm10k_mbx.h
@@ -54,6 +54,8 @@ struct fm10k_mbx_info;
 #define FM10K_MBX_ACK_INTERRUPT			0x00000010
 #define FM10K_MBX_INTERRUPT_ENABLE		0x00000020
 #define FM10K_MBX_INTERRUPT_DISABLE		0x00000040
+#define FM10K_MBX_GLOBAL_REQ_INTERRUPT		0x00000200
+#define FM10K_MBX_GLOBAL_ACK_INTERRUPT		0x00000400
 #define FM10K_MBICR(_n)		((_n) + 0x18840)
 #define FM10K_GMBX		0x18842
 
-- 
2.9.3

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

* [dpdk-dev] [PATCH 13/17] net/fm10k/base: don't stop reset
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (11 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 12/17] net/fm10k/base: add macros for global interrupt Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 14/17] net/fm10k/base: add macro for geneve tunnel offload Qi Zhang
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Don't report FM10K_ERR_REQUESTS_PENDING when we fail to disable queues
within the timeout. This can occur due to a hardware Tx hang, or when
the switch ethernet fabric is resetting while we are transmitting
traffic. It can sometimes take up to 500ms before the Tx DMA engine
gives up. Instead, just skip the DMA engine check and perform
a data-path reset anyways. Add a statistic counter to keep track of the
number of resets occurring while we have pending DMA on the rings.

In order to prevent having to assign err = FM10K_SUCCESS, re-order the
last few items of the reset_hw_pf function so that we don't perform
"return err" at the end.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 19 +++++++++----------
 drivers/net/fm10k/base/fm10k_type.h |  1 +
 drivers/net/fm10k/base/fm10k_vf.c   | 12 +++++++-----
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index bbc483d..bce2913 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -66,21 +66,21 @@ STATIC s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)
 
 	/* shut down all rings */
 	err = fm10k_disable_queues_generic(hw, FM10K_MAX_QUEUES);
-	if (err)
+	if (err == FM10K_ERR_REQUESTS_PENDING) {
+		hw->mac.reset_while_pending++;
+		goto force_reset;
+	} else if (err) {
 		return err;
+	}
 
 	/* Verify that DMA is no longer active */
 	reg = FM10K_READ_REG(hw, FM10K_DMA_CTRL);
 	if (reg & (FM10K_DMA_CTRL_TX_ACTIVE | FM10K_DMA_CTRL_RX_ACTIVE))
 		return FM10K_ERR_DMA_PENDING;
 
-	/* verify the switch is ready for reset */
-	reg = FM10K_READ_REG(hw, FM10K_DMA_CTRL2);
-	if (!(reg & FM10K_DMA_CTRL2_SWITCH_READY))
-		goto out;
-
+force_reset:
 	/* Inititate data path reset */
-	reg |= FM10K_DMA_CTRL_DATAPATH_RESET;
+	reg = FM10K_DMA_CTRL_DATAPATH_RESET;
 	FM10K_WRITE_REG(hw, FM10K_DMA_CTRL, reg);
 
 	/* Flush write and allow 100us for reset to complete */
@@ -90,10 +90,9 @@ STATIC s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)
 	/* Verify we made it out of reset */
 	reg = FM10K_READ_REG(hw, FM10K_IP);
 	if (!(reg & FM10K_IP_NOTINRESET))
-		err = FM10K_ERR_RESET_FAILED;
+		return FM10K_ERR_RESET_FAILED;
 
-out:
-	return err;
+	return FM10K_SUCCESS;
 }
 
 /**
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index b74cebf..d43e40c 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -654,6 +654,7 @@ struct fm10k_mac_info {
 	bool tx_ready;
 	u32 dglort_map;
 	u8 itr_scale;
+	u64 reset_while_pending;
 };
 
 struct fm10k_swapi_table_info {
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index dd3d318..71bacd0 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -49,7 +49,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 
 	/* we need to disable the queues before taking further steps */
 	err = fm10k_stop_hw_generic(hw);
-	if (err)
+	if (err && err != FM10K_ERR_REQUESTS_PENDING)
 		return err;
 
 	/* If permanent address is set then we need to restore it */
@@ -82,7 +82,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 		FM10K_WRITE_REG(hw, FM10K_TDLEN(i), tdlen);
 	}
 
-	return FM10K_SUCCESS;
+	return err;
 }
 
 /**
@@ -100,7 +100,9 @@ STATIC s32 fm10k_reset_hw_vf(struct fm10k_hw *hw)
 
 	/* shut down queues we own and reset DMA configuration */
 	err = fm10k_stop_hw_vf(hw);
-	if (err)
+	if (err == FM10K_ERR_REQUESTS_PENDING)
+		hw->mac.reset_while_pending++;
+	else if (err)
 		return err;
 
 	/* Inititate VF reset */
@@ -113,9 +115,9 @@ STATIC s32 fm10k_reset_hw_vf(struct fm10k_hw *hw)
 	/* Clear reset bit and verify it was cleared */
 	FM10K_WRITE_REG(hw, FM10K_VFCTRL, 0);
 	if (FM10K_READ_REG(hw, FM10K_VFCTRL) & FM10K_VFCTRL_RST)
-		err = FM10K_ERR_RESET_FAILED;
+		return FM10K_ERR_RESET_FAILED;
 
-	return err;
+	return FM10K_SUCCESS;
 }
 
 /**
-- 
2.9.3

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

* [dpdk-dev] [PATCH 14/17] net/fm10k/base: add macro for geneve tunnel offload
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (12 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 13/17] net/fm10k/base: don't stop reset Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 15/17] net/fm10k/base: improve re-map queues handle Qi Zhang
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

add necessary macro to support geneve tunnel offload.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index d43e40c..931633d 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -194,6 +194,7 @@ struct fm10k_hw;
 #define FM10K_DGLORTDEC_INNERRSS_ENABLE		0x08000000
 #define FM10K_TUNNEL_CFG	0x0040
 #define FM10K_TUNNEL_CFG_NVGRE_SHIFT		16
+#define FM10K_TUNNEL_CFG_GENEVE	0x0041
 #define FM10K_SWPRI_MAP(_n)	((_n) + 0x0050)
 #define FM10K_SWPRI_MAX		16
 #define FM10K_RSSRK(_n, _m)	(((_n) * 0x10) + (_m) + 0x0800)
-- 
2.9.3

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

* [dpdk-dev] [PATCH 15/17] net/fm10k/base: improve re-map queues handle
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (13 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 14/17] net/fm10k/base: add macro for geneve tunnel offload Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 16/17] net/fm10k/base: replace macros Qi Zhang
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Avoid potential FUM fault errors on a VF when updating MAC address
and VLAN information. Only use the register flow when the mailbox is
disconnected, by checking if the enqueue_tx returns
FM10K_MBX_ERR_NO_MBX. If the mailbox message can be sent, there is no
reason to bother with the register writes which are only intended to
be used during VF driver initialization.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_common.c |  3 +++
 drivers/net/fm10k/base/fm10k_pf.c     | 42 ++++++++++++++++++++++++-----------
 2 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_common.c b/drivers/net/fm10k/base/fm10k_common.c
index 7acc1ba..29f35d7 100644
--- a/drivers/net/fm10k/base/fm10k_common.c
+++ b/drivers/net/fm10k/base/fm10k_common.c
@@ -230,6 +230,9 @@ s32 fm10k_disable_queues_generic(struct fm10k_hw *hw, u16 q_cnt)
 	/* clear tx_ready to prevent any false hits for reset */
 	hw->mac.tx_ready = false;
 
+	if (FM10K_REMOVED(hw->hw_addr))
+		return FM10K_SUCCESS;
+
 	/* clear the enable bit for all rings */
 	for (i = 0; i < q_cnt; i++) {
 		reg = FM10K_READ_REG(hw, FM10K_TXDCTL(i));
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index bce2913..5b1098e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -926,9 +926,35 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	fm10k_tlv_attr_put_mac_vlan(msg, FM10K_MAC_VLAN_MSG_DEFAULT_MAC,
 				    vf_info->mac, vf_vid);
 
-	/* load onto outgoing mailbox, ignore any errors on enqueue */
-	if (vf_info->mbx.ops.enqueue_tx)
-		vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);
+	/* Configure Queue control register with new VLAN ID. The TXQCTL
+	 * register is RO from the VF, so the PF must do this even in the
+	 * case of notifying the VF of a new VID via the mailbox.
+	 */
+	txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &
+		 FM10K_TXQCTL_VID_MASK;
+	txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
+		  FM10K_TXQCTL_VF | vf_idx;
+
+	for (i = 0; i < queues_per_pool; i++)
+		FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
+
+	/* try loading a message onto outgoing mailbox first */
+	if (vf_info->mbx.ops.enqueue_tx) {
+		err = vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);
+		if (err != FM10K_MBX_ERR_NO_MBX)
+			return err;
+		err = FM10K_SUCCESS;
+	}
+
+	/* If we aren't connected to a mailbox, this is most likely because
+	 * the VF driver is not running. It should thus be safe to re-map
+	 * queues and use the registers to pass the MAC address so that the VF
+	 * driver gets correct information during its initialization.
+	 */
+
+	/* MAP Tx queue back to 0 temporarily, and disable it */
+	FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), 0);
+	FM10K_WRITE_REG(hw, FM10K_TXDCTL(vf_q_idx), 0);
 
 	/* verify ring has disabled before modifying base address registers */
 	txdctl = FM10K_READ_REG(hw, FM10K_TXDCTL(vf_q_idx));
@@ -967,16 +993,6 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 						   FM10K_TDLEN_ITR_SCALE_SHIFT);
 
 err_out:
-	/* configure Queue control register */
-	txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &
-		 FM10K_TXQCTL_VID_MASK;
-	txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
-		  FM10K_TXQCTL_VF | vf_idx;
-
-	/* assign VLAN ID */
-	for (i = 0; i < queues_per_pool; i++)
-		FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
-
 	/* restore the queue back to VF ownership */
 	FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);
 	return err;
-- 
2.9.3

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

* [dpdk-dev] [PATCH 16/17] net/fm10k/base: replace macros
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (14 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 15/17] net/fm10k/base: improve re-map queues handle Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 17/17] net/fm10k/base: equest reset when mbx->state changes Qi Zhang
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Other shared code bases are planning on using
IS_MULTICAST_ETHER_ADDR and friends without leaving the driver
name in the macro.
Remove reference to FM10K here so that we can re-use the specific
compat flags from Linux.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 10 +++++-----
 drivers/net/fm10k/base/fm10k_type.h | 14 +++++++-------
 drivers/net/fm10k/base/fm10k_vf.c   |  8 ++++----
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 5b1098e..db5f491 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -411,7 +411,7 @@ STATIC s32 fm10k_update_uc_addr_pf(struct fm10k_hw *hw, u16 glort,
 	DEBUGFUNC("fm10k_update_uc_addr_pf");
 
 	/* verify MAC address is valid */
-	if (!FM10K_IS_VALID_ETHER_ADDR(mac))
+	if (!IS_VALID_ETHER_ADDR(mac))
 		return FM10K_ERR_PARAM;
 
 	return fm10k_update_xc_addr_pf(hw, glort, mac, vid, add, flags);
@@ -434,7 +434,7 @@ STATIC s32 fm10k_update_mc_addr_pf(struct fm10k_hw *hw, u16 glort,
 	DEBUGFUNC("fm10k_update_mc_addr_pf");
 
 	/* verify multicast address is valid */
-	if (!FM10K_IS_MULTICAST_ETHER_ADDR(mac))
+	if (!IS_MULTICAST_ETHER_ADDR(mac))
 		return FM10K_ERR_PARAM;
 
 	return fm10k_update_xc_addr_pf(hw, glort, mac, vid, add, 0);
@@ -970,7 +970,7 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	}
 
 	/* Update base address registers to contain MAC address */
-	if (FM10K_IS_VALID_ETHER_ADDR(vf_info->mac)) {
+	if (IS_VALID_ETHER_ADDR(vf_info->mac)) {
 		tdbal = (((u32)vf_info->mac[3]) << 24) |
 			(((u32)vf_info->mac[4]) << 16) |
 			(((u32)vf_info->mac[5]) << 8);
@@ -1100,7 +1100,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 	FM10K_WRITE_REG(hw, FM10K_MRQC(vf_info->vsi), 0);
 
 	/* Update base address registers to contain MAC address */
-	if (FM10K_IS_VALID_ETHER_ADDR(vf_info->mac)) {
+	if (IS_VALID_ETHER_ADDR(vf_info->mac)) {
 		tdbal = (((u32)vf_info->mac[3]) << 24) |
 			(((u32)vf_info->mac[4]) << 16) |
 			(((u32)vf_info->mac[5]) << 8);
@@ -1326,7 +1326,7 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 			return err;
 
 		/* block attempts to set MAC for a locked device */
-		if (FM10K_IS_VALID_ETHER_ADDR(vf_info->mac) &&
+		if (IS_VALID_ETHER_ADDR(vf_info->mac) &&
 		    memcmp(mac, vf_info->mac, ETH_ALEN))
 			return FM10K_ERR_PARAM;
 
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 931633d..1ae1644 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -447,20 +447,20 @@ struct fm10k_hw;
 #define ETH_ALEN	6
 #endif /* ETH_ALEN */
 
-#ifndef FM10K_IS_ZERO_ETHER_ADDR
+#ifndef IS_ZERO_ETHER_ADDR
 /* make certain address is not 0 */
-#define FM10K_IS_ZERO_ETHER_ADDR(addr) \
+#define IS_ZERO_ETHER_ADDR(addr) \
 (!((addr)[0] | (addr)[1] | (addr)[2] | (addr)[3] | (addr)[4] | (addr)[5]))
 #endif
 
-#ifndef FM10K_IS_MULTICAST_ETHER_ADDR
-#define FM10K_IS_MULTICAST_ETHER_ADDR(addr) ((addr)[0] & 0x1)
+#ifndef IS_MULTICAST_ETHER_ADDR
+#define IS_MULTICAST_ETHER_ADDR(addr) ((addr)[0] & 0x1)
 #endif
 
-#ifndef FM10K_IS_VALID_ETHER_ADDR
+#ifndef IS_VALID_ETHER_ADDR
 /* make certain address is not multicast or 0 */
-#define FM10K_IS_VALID_ETHER_ADDR(addr) \
-(!FM10K_IS_MULTICAST_ETHER_ADDR(addr) && !FM10K_IS_ZERO_ETHER_ADDR(addr))
+#define IS_VALID_ETHER_ADDR(addr) \
+(!IS_MULTICAST_ETHER_ADDR(addr) && !IS_ZERO_ETHER_ADDR(addr))
 #endif
 
 enum fm10k_int_source {
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 71bacd0..bd44977 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -53,7 +53,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 		return err;
 
 	/* If permanent address is set then we need to restore it */
-	if (FM10K_IS_VALID_ETHER_ADDR(perm_addr)) {
+	if (IS_VALID_ETHER_ADDR(perm_addr)) {
 		bal = (((u32)perm_addr[3]) << 24) |
 		      (((u32)perm_addr[4]) << 16) |
 		      (((u32)perm_addr[5]) << 8);
@@ -341,11 +341,11 @@ STATIC s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, u16 glort,
 		return FM10K_ERR_PARAM;
 
 	/* verify MAC address is valid */
-	if (!FM10K_IS_VALID_ETHER_ADDR(mac))
+	if (!IS_VALID_ETHER_ADDR(mac))
 		return FM10K_ERR_PARAM;
 
 	/* verify we are not locked down on the MAC address */
-	if (FM10K_IS_VALID_ETHER_ADDR(hw->mac.perm_addr) &&
+	if (IS_VALID_ETHER_ADDR(hw->mac.perm_addr) &&
 	    memcmp(hw->mac.perm_addr, mac, ETH_ALEN))
 		return FM10K_ERR_PARAM;
 
@@ -387,7 +387,7 @@ STATIC s32 fm10k_update_mc_addr_vf(struct fm10k_hw *hw, u16 glort,
 		return FM10K_ERR_PARAM;
 
 	/* verify multicast address is valid */
-	if (!FM10K_IS_MULTICAST_ETHER_ADDR(mac))
+	if (!IS_MULTICAST_ETHER_ADDR(mac))
 		return FM10K_ERR_PARAM;
 
 	/* add bit to notify us if this is a set or clear operation */
-- 
2.9.3

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

* [dpdk-dev] [PATCH 17/17] net/fm10k/base: equest reset when mbx->state changes
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (15 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 16/17] net/fm10k/base: replace macros Qi Zhang
@ 2017-03-03  3:17 ` Qi Zhang
  2017-03-05 11:42   ` Ferruh Yigit
  2017-03-05 11:41 ` [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Ferruh Yigit
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
  18 siblings, 1 reply; 45+ messages in thread
From: Qi Zhang @ 2017-03-03  3:17 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Multiple IES API resets can cause a race condition where the mailbox
interrupt request bits can be cleared before being handled. This can
leave certain mailbox messages from the PF to be untreated and the PF
will enter in some inactive state. If this situation occurs, the IES API
will initiate a mailbox version reset which, then, trigger a mailbox
state change. Once this mailbox transition occurs (from OPEN to CONNECT
state), a request for reset will be returned.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 2e70434..16ab98d 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -2066,9 +2066,10 @@ STATIC void fm10k_sm_mbx_create_reply(struct fm10k_hw *hw,
  *  function can also be used to respond to an error as the connection
  *  resetting would also be a means of dealing with errors.
  **/
-STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
-				       struct fm10k_mbx_info *mbx)
+STATIC s32 fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
+				      struct fm10k_mbx_info *mbx)
 {
+	s32 err = FM10K_SUCCESS;
 	const enum fm10k_mbx_state state = mbx->state;
 
 	switch (state) {
@@ -2081,6 +2082,7 @@ STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
 	case FM10K_STATE_OPEN:
 		/* flush any incomplete work */
 		fm10k_sm_mbx_connect_reset(mbx);
+		err = FM10K_ERR_RESET_REQUESTED;
 		break;
 	case FM10K_STATE_CONNECT:
 		/* Update remote value to match local value */
@@ -2090,6 +2092,8 @@ STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
 	}
 
 	fm10k_sm_mbx_create_reply(hw, mbx, mbx->tail);
+
+	return err;
 }
 
 /**
@@ -2172,7 +2176,7 @@ STATIC s32 fm10k_sm_mbx_process(struct fm10k_hw *hw,
 
 	switch (FM10K_MSG_HDR_FIELD_GET(mbx->mbx_hdr, SM_VER)) {
 	case 0:
-		fm10k_sm_mbx_process_reset(hw, mbx);
+		err = fm10k_sm_mbx_process_reset(hw, mbx);
 		break;
 	case FM10K_SM_MBX_VERSION:
 		err = fm10k_sm_mbx_process_version_1(hw, mbx);
-- 
2.9.3

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

* Re: [dpdk-dev] [PATCH 00/17] net/fm10k: update base code.
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (16 preceding siblings ...)
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 17/17] net/fm10k/base: equest reset when mbx->state changes Qi Zhang
@ 2017-03-05 11:41 ` Ferruh Yigit
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
  18 siblings, 0 replies; 45+ messages in thread
From: Ferruh Yigit @ 2017-03-05 11:41 UTC (permalink / raw)
  To: Qi Zhang, jing.d.chen; +Cc: helin.zhang, dev

On 3/3/2017 3:17 AM, Qi Zhang wrote:
> The patch set update to latest fm10k base code, there is no
> significent features be added, but include couple enhancement
> like clean up the logic for tlv attr parse, improve VF multi-bit 
> VLAN handle etc, also with some code/comment clean as well.
> 
> Qi Zhang (17):
>   net/fm10k/base: add a flag to indicate VF trust mode
>   net/fm10k/base: reset multicaset mode when deleting lport
>   net/fm10k/base: expose macros needed by DPDK
>   net/fm10k/base: add error code
>   net/fm10k/base: clean up the logic
>   net/fm10k/base: add new item to lport msg attr
>   net/fm10k/base: use 8 bit notation instead of 10bit notation
>   net/fm10k/base: use different name for override bit
>   net/fm10k/base: update comment regarding reserved bits check
>   net/fm10k/base: improve VF's multi-bit VLAN update requests
>   net/fm10k/base: enable lport map request
>   net/fm10k/base: add macros for global interrupt
>   net/fm10k/base: don't stop reset
>   net/fm10k/base: add marcro for geneve tunnel
>   net/fm10k/base: improve re-map queues handle
>   net/fm10k/base: replace marcos
>   net/fm10k/base: equest reset when mbx->state changes

Hi Qi,

Is there a base code version to record for fm10k, as done in some other
drivers?

Thanks,
ferruh

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

* Re: [dpdk-dev] [PATCH 03/17] net/fm10k/base: expose macros needed by DPDK
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 03/17] net/fm10k/base: expose macros needed by DPDK Qi Zhang
@ 2017-03-05 11:41   ` Ferruh Yigit
  0 siblings, 0 replies; 45+ messages in thread
From: Ferruh Yigit @ 2017-03-05 11:41 UTC (permalink / raw)
  To: Qi Zhang, jing.d.chen; +Cc: helin.zhang, dev

On 3/3/2017 3:17 AM, Qi Zhang wrote:
> Some defines were previously wrapped to strip them from opensource driver
> builds, but these are required by DPDK.  Change the wrapping of these so 
> that the DPDK gets them as long as DPDK_SUPPORT is correctly added as a 
> strip flag, while we can remove the reduandant ones in fm10k_osdep.h.

s/reduandant/redundant

> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>

<...>

> diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
> index fe3e498..8ddfd49 100644
> --- a/drivers/net/fm10k/base/fm10k_type.h
> +++ b/drivers/net/fm10k/base/fm10k_type.h
> @@ -40,6 +40,9 @@ struct fm10k_hw;
>  #include "fm10k_osdep.h"
>  #include "fm10k_mbx.h"
>  
> +#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)

>From commit log what I understand is, released code is coming from a
shared code by some #ifdefs stripped based on a strip flag configuration.

If that is the case, these #ifdefs should not be released code, they
should be stripped but only #defines should remain, is this correct?

> +#define FM10K_INTEL_VENDOR_ID		0x8086
> +#endif
>  #define FM10K_DEV_ID_PF			0x15A4
>  #define FM10K_DEV_ID_VF			0x15A5
>  #ifdef BOULDER_RAPIDS_HW
<...>

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

* Re: [dpdk-dev] [PATCH 02/17] net/fm10k/base: reset multicaset mode when deleting lport
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 02/17] net/fm10k/base: reset multicaset mode when deleting lport Qi Zhang
@ 2017-03-05 11:41   ` Ferruh Yigit
  0 siblings, 0 replies; 45+ messages in thread
From: Ferruh Yigit @ 2017-03-05 11:41 UTC (permalink / raw)
  To: Qi Zhang, jing.d.chen; +Cc: helin.zhang, dev

On 3/3/2017 3:17 AM, Qi Zhang wrote:

patch title: s/multicaset/multicast

> Deleting lport when multicast mod is configured to
> FM10K_XCAST_MODE_ALLMULTI or FM10K_XCAST_MODE_PROMISC will
> result in generating orphaned multicast-group entries in the
> switch manager.
> Before deleting the lport, reset multicast mode to
> FM10K_XCAST_MODE_NONE to flush out these multicast-group
> entries.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
<...>

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

* Re: [dpdk-dev] [PATCH 07/17] net/fm10k/base: use 8 bit notation instead of 10bit notation
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 07/17] net/fm10k/base: use 8 bit notation instead of 10bit notation Qi Zhang
@ 2017-03-05 11:42   ` Ferruh Yigit
  0 siblings, 0 replies; 45+ messages in thread
From: Ferruh Yigit @ 2017-03-05 11:42 UTC (permalink / raw)
  To: Qi Zhang, jing.d.chen; +Cc: helin.zhang, dev

On 3/3/2017 3:17 AM, Qi Zhang wrote:
> The diagram represents bit layout of the multi-bit VLAN update
> message format. Re-draw the numbers using base 8, and mark the
> bit values every 8 bits at the top. This should make it more
> easy to grasp the table quickly.

Can you please somehow mention in the patch title that this is a comment
update.

> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
<...>

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

* Re: [dpdk-dev] [PATCH 10/17] net/fm10k/base: improve VF's multi-bit VLAN update requests
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 10/17] net/fm10k/base: improve VF's multi-bit VLAN update requests Qi Zhang
@ 2017-03-05 11:42   ` Ferruh Yigit
  0 siblings, 0 replies; 45+ messages in thread
From: Ferruh Yigit @ 2017-03-05 11:42 UTC (permalink / raw)
  To: Qi Zhang, jing.d.chen; +Cc: helin.zhang, dev

On 3/3/2017 3:17 AM, Qi Zhang wrote:
> The VF uses a multi-bit update request to clear unused VLANs whenever it
> resets. However, an accident in a previous refector broke multi-bit

s/refector/refactor

> updates for VFs, due to misreading a comment in fm10k_vf.c and
> attempting to reduce code duplication. The problem occurs because
> a multi-bit request has a non-zero length, and the PF would simply drop
> any request with the upper 16 bits set. In addition, a multi-bit vlan
> update does not have a concept for "VLAN 0" as the single bit update
> does.
> 
> A previous revision of this patch resolved the issue by simply removing
> the upper 16 bit check and the iov_select_vid checks. However, this would
> remove the checks for default VID and for ensuring no other VLANs can be
> enabled except pf_vid when it has been set. To resolve that issue, this
> revision uses the iov_select_vid when we have a single-bit update, and
> denies any multi-bit update when the VLAN was administratively set by
> the PF. This should be ok since the PF properly updates VLAN_TABLE when
> it assigns the PF vid. This ensures that requests to add or "remove" the
> PF vid work as expected, but a rogue VF could not use the multi-bit
> update as a loophole to attempt receiving traffic on other VLANs.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>

<...>

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

* Re: [dpdk-dev] [PATCH 17/17] net/fm10k/base: equest reset when mbx->state changes
  2017-03-03  3:17 ` [dpdk-dev] [PATCH 17/17] net/fm10k/base: equest reset when mbx->state changes Qi Zhang
@ 2017-03-05 11:42   ` Ferruh Yigit
  0 siblings, 0 replies; 45+ messages in thread
From: Ferruh Yigit @ 2017-03-05 11:42 UTC (permalink / raw)
  To: Qi Zhang, jing.d.chen; +Cc: helin.zhang, dev

On 3/3/2017 3:17 AM, Qi Zhang wrote:

patch title: s/equest/request

> Multiple IES API resets can cause a race condition where the mailbox
> interrupt request bits can be cleared before being handled. This can
> leave certain mailbox messages from the PF to be untreated and the PF
> will enter in some inactive state. If this situation occurs, the IES API
> will initiate a mailbox version reset which, then, trigger a mailbox
> state change. Once this mailbox transition occurs (from OPEN to CONNECT
> state), a request for reset will be returned.
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
<...>

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

* [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code.
  2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
                   ` (17 preceding siblings ...)
  2017-03-05 11:41 ` [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Ferruh Yigit
@ 2017-03-08  6:18 ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 01/18] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
                     ` (18 more replies)
  18 siblings, 19 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

The patch set update to latest fm10k base code, there is no
significent features be added, but include couple enhancement
like clean up the logic for tlv attr parse, improve VF multi-bit 
VLAN handle etc, also with some code/comment clean as well.

v2: 
  - add base code information
  - correct couple typo errors in commit log.

Qi Zhang (17):
  net/fm10k/base: add a flag to indicate VF trust mode
  net/fm10k/base: reset multicast mode when deleting lport
  net/fm10k/base: expose macros needed by DPDK
  net/fm10k/base: add error code
  net/fm10k/base: clean up the logic
  net/fm10k/base: add new item to lport msg attr
  net/fm10k/base: update comment
  net/fm10k/base: use different name for override bit
  net/fm10k/base: update comment regarding reserved bits check
  net/fm10k/base: improve VF's multi-bit VLAN update requests
  net/fm10k/base: enable lport map request
  net/fm10k/base: add macros for global interrupt
  net/fm10k/base: don't stop reset
  net/fm10k/base: add marcro for geneve tunnel
  net/fm10k/base: improve re-map queues handle
  net/fm10k/base: replace marcos
  net/fm10k/base: request reset when mbx->state changes
  net/fm10k/base: add base code driver information

 drivers/net/fm10k/base/fm10k_common.c |  11 ++-
 drivers/net/fm10k/base/fm10k_mbx.c    |  10 ++-
 drivers/net/fm10k/base/fm10k_mbx.h    |   2 +
 drivers/net/fm10k/base/fm10k_osdep.h  |  17 -----
 drivers/net/fm10k/base/fm10k_pf.c     | 140 ++++++++++++++++++++--------------
 drivers/net/fm10k/base/fm10k_pf.h     |   2 +
 drivers/net/fm10k/base/fm10k_tlv.c    |  16 ++--
 drivers/net/fm10k/base/fm10k_type.h   |  71 +++++++++++++++--
 drivers/net/fm10k/base/fm10k_vf.c     |  24 +++---
 9 files changed, 189 insertions(+), 104 deletions(-)

-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 01/18] net/fm10k/base: add a flag to indicate VF trust mode
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 02/18] net/fm10k/base: reset multicast mode when deleting lport Qi Zhang
                     ` (17 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Adds boolean flag in fm10k_vf_info to support configuring
a VF to be trusted.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 3fc8f13..fe3e498 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -676,6 +676,9 @@ struct fm10k_vf_info {
 	u8			vf_flags;	/* flags indicating what modes
 						 * are supported for the port
 						 */
+#ifndef NO_FM10K_VF_TRUSTED_MODE
+	bool			trusted;	/* VF trust mode */
+#endif
 };
 
 #define FM10K_VF_FLAG_ALLMULTI_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_ALLMULTI))
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 02/18] net/fm10k/base: reset multicast mode when deleting lport
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 01/18] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 03/18] net/fm10k/base: expose macros needed by DPDK Qi Zhang
                     ` (16 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Deleting lport when multicast mod is configured to
FM10K_XCAST_MODE_ALLMULTI or FM10K_XCAST_MODE_PROMISC will
result in generating orphaned multicast-group entries in the
switch manager.
Before deleting the lport, reset multicast mode to
FM10K_XCAST_MODE_NONE to flush out these multicast-group
entries.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 105babf..9730119 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -536,6 +536,10 @@ STATIC s32 fm10k_update_lport_state_pf(struct fm10k_hw *hw, u16 glort,
 	if (!fm10k_glort_valid_pf(hw, glort))
 		return FM10K_ERR_PARAM;
 
+	/* reset multicast mode if deleting lport */
+	if (!enable)
+		fm10k_update_xcast_mode_pf(hw, glort, FM10K_XCAST_MODE_NONE);
+
 	/* construct the lport message from the 2 pieces of data we have */
 	lport_msg = ((u32)count << 16) | glort;
 
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 03/18] net/fm10k/base: expose macros needed by DPDK
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 01/18] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 02/18] net/fm10k/base: reset multicast mode when deleting lport Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 04/18] net/fm10k/base: add error code Qi Zhang
                     ` (15 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Add back macros that DPDK required and remove the redundant ones
in fm10k_osdep.h.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_osdep.h | 17 ------------
 drivers/net/fm10k/base/fm10k_type.h  | 50 ++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 17 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index f07b678..199ebd8 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -163,23 +163,6 @@ typedef int        bool;
 #define FM10K_RXD_PKTTYPE_MASK		0x03F0
 #define FM10K_RXD_PKTTYPE_SHIFT		4
 
-enum fm10k_rdesc_pkt_type {
-	/* L3 type */
-	FM10K_PKTTYPE_OTHER	= 0x00,
-	FM10K_PKTTYPE_IPV4	= 0x01,
-	FM10K_PKTTYPE_IPV4_EX	= 0x02,
-	FM10K_PKTTYPE_IPV6	= 0x03,
-	FM10K_PKTTYPE_IPV6_EX	= 0x04,
-
-	/* L4 type */
-	FM10K_PKTTYPE_TCP	= 0x08,
-	FM10K_PKTTYPE_UDP	= 0x10,
-	FM10K_PKTTYPE_GRE	= 0x18,
-	FM10K_PKTTYPE_VXLAN	= 0x20,
-	FM10K_PKTTYPE_NVGRE	= 0x28,
-	FM10K_PKTTYPE_GENEVE	= 0x30
-};
-
 #define FM10K_RXD_STATUS_IPCS		0x0008 /* Indicates IPv4 csum */
 #define FM10K_RXD_STATUS_HBO		0x0400 /* header buffer overrun */
 
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index fe3e498..8ddfd49 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -40,6 +40,9 @@ struct fm10k_hw;
 #include "fm10k_osdep.h"
 #include "fm10k_mbx.h"
 
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_INTEL_VENDOR_ID		0x8086
+#endif
 #define FM10K_DEV_ID_PF			0x15A4
 #define FM10K_DEV_ID_VF			0x15A5
 #ifdef BOULDER_RAPIDS_HW
@@ -125,11 +128,19 @@ struct fm10k_hw;
 
 /* Interrupt control registers */
 #define FM10K_EICR		0x0006
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_EICR_PCA_FAULT			0x00000001
+#define FM10K_EICR_THI_FAULT			0x00000004
+#define FM10K_EICR_FUM_FAULT			0x00000020
+#endif
 #define FM10K_EICR_FAULT_MASK			0x0000003F
 #define FM10K_EICR_MAILBOX			0x00000040
 #define FM10K_EICR_SWITCHREADY			0x00000080
 #define FM10K_EICR_SWITCHNOTREADY		0x00000100
 #define FM10K_EICR_SWITCHINTERRUPT		0x00000200
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_EICR_SRAMERROR			0x00000400
+#endif
 #define FM10K_EICR_VFLR				0x00000800
 #define FM10K_EICR_MAXHOLDTIME			0x00001000
 #define FM10K_EIMR		0x0007
@@ -211,6 +222,9 @@ struct fm10k_hw;
 #define FM10K_DMA_CTRL_RX_ENABLE		0x00000010
 #define FM10K_DMA_CTRL_RX_ACTIVE		0x00000080
 #define FM10K_DMA_CTRL_RX_DESC_SIZE		0x00000100
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_DMA_CTRL_MINMSS_SHIFT		9
+#endif
 #define FM10K_DMA_CTRL_MINMSS_64		0x00008000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN3	0x04800000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN2	0x04000000
@@ -283,6 +297,9 @@ struct fm10k_hw;
 #define FM10K_RXDCTL_WRITE_BACK_MIN_DELAY	0x00000001
 #define FM10K_RXDCTL_DROP_ON_EMPTY		0x00000200
 #define FM10K_RXINT(_n)		((0x40 * (_n)) + 0x4008)
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_RXINT_TIMER_SHIFT			8
+#endif
 #define FM10K_SRRCTL(_n)	((0x40 * (_n)) + 0x4009)
 #define FM10K_SRRCTL_BSIZEPKT_SHIFT		8 /* shift _right_ */
 #define FM10K_SRRCTL_LOOPBACK_SUPPRESS		0x40000000
@@ -336,6 +353,9 @@ struct fm10k_hw;
 #define FM10K_TXQCTL_VID_MASK			0x0FFF0000
 #define FM10K_TXQCTL_UNLIMITED_BW		0x10000000
 #define FM10K_TXINT(_n)		((0x40 * (_n)) + 0x8008)
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_TXINT_TIMER_SHIFT			8
+#endif
 
 /* Tx Statistics */
 #define FM10K_QPTC(_n)		((0x40 * (_n)) + 0x8009)
@@ -374,6 +394,9 @@ struct fm10k_hw;
 /* Switch manager interrupt registers */
 #define FM10K_IP		0x13000
 #define FM10K_IP_NOTINRESET			0x00000100
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_SRAM_IP		0x13003
+#endif
 
 /* VLAN registers */
 #define FM10K_VLAN_TABLE(_n, _m)	((0x80 * (_n)) + (_m) + 0x14000)
@@ -815,6 +838,30 @@ enum fm10k_rdesc_rss_type {
 	/* Reserved 0x9 - 0xF */
 };
 
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_RXD_PKTTYPE_MASK		0x03F0
+#endif
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_RXD_PKTTYPE_SHIFT		4
+#endif
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+enum fm10k_rdesc_pkt_type {
+	/* L3 type */
+	FM10K_PKTTYPE_OTHER	= 0x00,
+	FM10K_PKTTYPE_IPV4	= 0x01,
+	FM10K_PKTTYPE_IPV4_EX	= 0x02,
+	FM10K_PKTTYPE_IPV6	= 0x03,
+	FM10K_PKTTYPE_IPV6_EX	= 0x04,
+
+	/* L4 type */
+	FM10K_PKTTYPE_TCP	= 0x08,
+	FM10K_PKTTYPE_UDP	= 0x10,
+	FM10K_PKTTYPE_GRE	= 0x18,
+	FM10K_PKTTYPE_VXLAN	= 0x20,
+	FM10K_PKTTYPE_NVGRE	= 0x28,
+	FM10K_PKTTYPE_GENEVE	= 0x30
+};
+#endif
 
 #define FM10K_RXD_HDR_INFO_XC_MASK	0x0006
 enum fm10k_rxdesc_xc {
@@ -826,6 +873,9 @@ enum fm10k_rxdesc_xc {
 
 #define FM10K_RXD_STATUS_DD		0x0001 /* Descriptor done */
 #define FM10K_RXD_STATUS_EOP		0x0002 /* End of packet */
+#if !defined(EXTERNAL_RELEASE) || defined(DPDK_SUPPORT)
+#define FM10K_RXD_STATUS_IPCS		0x0008 /* Indicates IPv4 csum */
+#endif
 #define FM10K_RXD_STATUS_L4CS		0x0010 /* Indicates an L4 csum */
 #define FM10K_RXD_STATUS_L4CS2		0x0040 /* Inner header L4 csum */
 #define FM10K_RXD_STATUS_L4E2		0x0800 /* Inner header L4 csum err */
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 04/18] net/fm10k/base: add error code
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (2 preceding siblings ...)
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 03/18] net/fm10k/base: expose macros needed by DPDK Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 05/18] net/fm10k/base: clean up the logic Qi Zhang
                     ` (14 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Add API error code for when PEP is not scheduled.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index c84b1bc..ca125c2 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -91,6 +91,8 @@ enum fm10k_pf_tlv_attr_id_v1 {
 #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT	16
 #define FM10K_MSG_UPDATE_PVID_PVID_SIZE		16
 
+#define FM10K_MSG_ERR_PEP_NOT_SCHEDULED	280
+
 /* The following data structures are overlayed directly onto TLV mailbox
  * messages, and must not break 4 byte alignment. Ensure the structures line
  * up correctly as per their TLV definition.
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 05/18] net/fm10k/base: clean up the logic
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (3 preceding siblings ...)
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 04/18] net/fm10k/base: add error code Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 06/18] net/fm10k/base: add new item to lport msg attr Qi Zhang
                     ` (13 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Clean up the logic in fm10k_tlv_attr_parse, we
should not reply on that FM10K_NOT_IMPLEMENTED is
greater than zero, as this can easily cause confusion.
The patch also correct a minor document error.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_tlv.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c
index e6150c1..0328ede 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.c
+++ b/drivers/net/fm10k/base/fm10k_tlv.c
@@ -520,7 +520,8 @@ STATIC s32 fm10k_tlv_attr_validate(u32 *attr,
  *  up into an array of pointers stored in results.  The function will
  *  return FM10K_ERR_PARAM on any input or message error,
  *  FM10K_NOT_IMPLEMENTED for any attribute that is outside of the array
- *  and 0 on success.
+ *  and 0 on success. Any attributes not found in tlv_attr will be silently
+ *  ignored.
  **/
 static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
 				const struct fm10k_tlv_attr *tlv_attr)
@@ -559,14 +560,15 @@ static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
 	while (offset < len) {
 		attr_id = *attr & FM10K_TLV_ID_MASK;
 
-		if (attr_id < FM10K_TLV_RESULTS_MAX)
-			err = fm10k_tlv_attr_validate(attr, tlv_attr);
-		else
-			err = FM10K_NOT_IMPLEMENTED;
+		if (attr_id >= FM10K_TLV_RESULTS_MAX)
+			return FM10K_NOT_IMPLEMENTED;
 
-		if (err < 0)
+		err = fm10k_tlv_attr_validate(attr, tlv_attr);
+		if (err == FM10K_NOT_IMPLEMENTED)
+			; /* silently ignore non-implemented attributes */
+		else if (err)
 			return err;
-		if (!err)
+		else
 			results[attr_id] = attr;
 
 		/* update offset */
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 06/18] net/fm10k/base: add new item to lport msg attr
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (4 preceding siblings ...)
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 05/18] net/fm10k/base: clean up the logic Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 07/18] net/fm10k/base: update comment Qi Zhang
                     ` (12 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Add FM10K_PF_ATTR_ID_ERR, since it is possible for the switch manager
to send out an error message indicating status of the LPORT_MAP due to
zero allocated bandwidth.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 9730119..1dcea2b 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1705,6 +1705,8 @@ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)
 
 /* This structure defines the attibutes to be parsed below */
 const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[] = {
+	FM10K_TLV_ATTR_LE_STRUCT(FM10K_PF_ATTR_ID_ERR,
+				 sizeof(struct fm10k_swapi_error)),
 	FM10K_TLV_ATTR_U32(FM10K_PF_ATTR_ID_LPORT_MAP),
 	FM10K_TLV_ATTR_LAST
 };
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 07/18] net/fm10k/base: update comment
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (5 preceding siblings ...)
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 06/18] net/fm10k/base: add new item to lport msg attr Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 08/18] net/fm10k/base: use different name for override bit Qi Zhang
                     ` (11 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

The diagram represents bit layout of the multi-bit VLAN update
message format. Re-draw the numbers using base 8, and mark the
bit values every 8 bits at the top. This should make it more
easy to grasp the table quickly.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 1dcea2b..856cb8a 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -255,8 +255,8 @@ STATIC s32 fm10k_update_vlan_pf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)
 
 	/* VLAN multi-bit write:
 	 * The multi-bit write has several parts to it.
-	 *    3			  2		      1			  0
-	 *  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+	 *               24              16               8               0
+	 *  7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 	 * | RSVD0 |         Length        |C|RSVD0|        VLAN ID        |
 	 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 08/18] net/fm10k/base: use different name for override bit
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (6 preceding siblings ...)
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 07/18] net/fm10k/base: update comment Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 09/18] net/fm10k/base: update comment regarding reserved bits check Qi Zhang
                     ` (10 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Use a new #define FM10K_VLAN_OVERRIDE even though we're using
the exact same bit. The reason for this is clarity in the code,
otherwise you can read FM10K_VLAN_CLEAR and think it should be
removed. Also add a comment explaining why the FM10K_VLAN_OVERRIDE
bit is set.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 12 ++++++------
 drivers/net/fm10k/base/fm10k_type.h |  1 +
 drivers/net/fm10k/base/fm10k_vf.c   |  2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 856cb8a..878d46e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -912,13 +912,13 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	vf_q_idx = fm10k_vf_queue_index(hw, vf_idx);
 	qmap_idx = qmap_stride * vf_idx;
 
-	/* MAP Tx queue back to 0 temporarily, and disable it */
-	FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), 0);
-	FM10K_WRITE_REG(hw, FM10K_TXDCTL(vf_q_idx), 0);
-
-	/* determine correct default VLAN ID */
+	/* Determine correct default VLAN ID. The FM10K_VLAN_OVERRIDE bit is
+	 * used here to indicate to the VF that it will not have privilege to
+	 * write VLAN_TABLE. All policy is enforced on the PF but this allows
+	 * the VF to correctly report errors to userspace rqeuests.
+	 */
 	if (vf_info->pf_vid)
-		vf_vid = vf_info->pf_vid | FM10K_VLAN_CLEAR;
+		vf_vid = vf_info->pf_vid | FM10K_VLAN_OVERRIDE;
 	else
 		vf_vid = vf_info->sw_vid;
 
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 8ddfd49..515be26 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -407,6 +407,7 @@ struct fm10k_hw;
 #define FM10K_VLAN_TABLE_VSI_MAX		64
 #define FM10K_VLAN_LENGTH_SHIFT			16
 #define FM10K_VLAN_CLEAR			BIT(15)
+#define FM10K_VLAN_OVERRIDE			FM10K_VLAN_CLEAR
 #define FM10K_VLAN_ALL \
 	((FM10K_VLAN_TABLE_VID_MAX - 1) << FM10K_VLAN_LENGTH_SHIFT)
 
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index efbdbd1..533dfeb 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -268,7 +268,7 @@ s32 fm10k_msg_mac_vlan_vf(struct fm10k_hw *hw, u32 **results,
 
 	memcpy(hw->mac.perm_addr, perm_addr, ETH_ALEN);
 	hw->mac.default_vid = vid & (FM10K_VLAN_TABLE_VID_MAX - 1);
-	hw->mac.vlan_override = !!(vid & FM10K_VLAN_CLEAR);
+	hw->mac.vlan_override = !!(vid & FM10K_VLAN_OVERRIDE);
 
 	return FM10K_SUCCESS;
 }
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 09/18] net/fm10k/base: update comment regarding reserved bits check
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (7 preceding siblings ...)
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 08/18] net/fm10k/base: use different name for override bit Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 10/18] net/fm10k/base: improve VF's multi-bit VLAN update requests Qi Zhang
                     ` (9 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

The original comment may be read incorrectly as referring to checking
the *entire* length is zero. However, it merely checks only the reserved
bits of both length and reserved in a small amount of code. Update the
comment to indicate this is a clever trick and clearly spell out that it
only checks the reserve bits.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 533dfeb..dd3d318 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -225,7 +225,7 @@ STATIC s32 fm10k_update_vlan_vf(struct fm10k_hw *hw, u32 vid, u8 vsi, bool set)
 	if (vsi)
 		return FM10K_ERR_PARAM;
 
-	/* verify upper 4 bits of vid and length are 0 */
+	/* clever trick to verify reserved bits in both vid and length */
 	if ((vid << 16 | vid) >> 28)
 		return FM10K_ERR_PARAM;
 
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 10/18] net/fm10k/base: improve VF's multi-bit VLAN update requests
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (8 preceding siblings ...)
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 09/18] net/fm10k/base: update comment regarding reserved bits check Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 11/18] net/fm10k/base: enable lport map request Qi Zhang
                     ` (8 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

The VF uses a multi-bit update request to clear unused VLANs whenever it
resets. However, an accident in a previous refactor broke multi-bit
updates for VFs, due to misreading a comment in fm10k_vf.c and
attempting to reduce code duplication. The problem occurs because
a multi-bit request has a non-zero length, and the PF would simply drop
any request with the upper 16 bits set. In addition, a multi-bit vlan
update does not have a concept for "VLAN 0" as the single bit update
does.

A previous revision of this patch resolved the issue by simply removing
the upper 16 bit check and the iov_select_vid checks. However, this would
remove the checks for default VID and for ensuring no other VLANs can be
enabled except pf_vid when it has been set. To resolve that issue, this
revision uses the iov_select_vid when we have a single-bit update, and
denies any multi-bit update when the VLAN was administratively set by
the PF. This should be ok since the PF properly updates VLAN_TABLE when
it assigns the PF vid. This ensures that requests to add or "remove" the
PF vid work as expected, but a rogue VF could not use the multi-bit
update as a loophole to attempt receiving traffic on other VLANs.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 878d46e..4c075b6 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1271,18 +1271,32 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		if (err)
 			return err;
 
-		/* verify upper 16 bits are zero */
-		if (vid >> 16)
-			return FM10K_ERR_PARAM;
-
 		set = !(vid & FM10K_VLAN_CLEAR);
 		vid &= ~FM10K_VLAN_CLEAR;
 
-		err = fm10k_iov_select_vid(vf_info, (u16)vid);
-		if (err < 0)
-			return err;
+		/* if the length field has been set, this is a multi-bit
+		 * update request. For multi-bit requests, simply disallow
+		 * them when the pf_vid has been set. In this case, the PF
+		 * should have already cleared the VLAN_TABLE, and if we
+		 * allowed them, it could allow a rogue VF to receive traffic
+		 * on a VLAN it was not assigned. In the single-bit case, we
+		 * need to modify requests for VLAN 0 to use the default PF or
+		 * SW vid when assigned.
+		 */
 
-		vid = err;
+		if (vid >> 16) {
+			/* prevent multi-bit requests when PF has
+			 * administratively set the VLAN for this VF
+			 */
+			if (vf_info->pf_vid)
+				return FM10K_ERR_PARAM;
+		} else {
+			err = fm10k_iov_select_vid(vf_info, (u16)vid);
+			if (err < 0)
+				return err;
+
+			vid = err;
+		}
 
 		/* update VSI info for VF in regards to VLAN table */
 		err = hw->mac.ops.update_vlan(hw, vid, vf_info->vsi, set);
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 11/18] net/fm10k/base: enable lport map request
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (9 preceding siblings ...)
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 10/18] net/fm10k/base: improve VF's multi-bit VLAN update requests Qi Zhang
@ 2017-03-08  6:18   ` Qi Zhang
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 12/18] net/fm10k/base: add macros for global interrupt Qi Zhang
                     ` (7 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:18 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

If the fm10k interface is brought up, but the switch manager software is
not running, the driver will continuously request the lport map every
few seconds in the base driver watchdog routine. Eventually after
several minutes the switch mailbox Tx fifo will fill up and the mailbox
will timeout, resulting in a reset. This reset will appear as if for no
reason, and occurs regularly every few minutes until the switch manager
software is loaded.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_common.c |  8 ++++++--
 drivers/net/fm10k/base/fm10k_pf.c     | 17 ++++-------------
 drivers/net/fm10k/base/fm10k_type.h   |  1 +
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_common.c b/drivers/net/fm10k/base/fm10k_common.c
index a90d2f0..7acc1ba 100644
--- a/drivers/net/fm10k/base/fm10k_common.c
+++ b/drivers/net/fm10k/base/fm10k_common.c
@@ -542,7 +542,7 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready)
 		goto out;
 
 	/* if we somehow dropped the Tx enable we should reset */
-	if (hw->mac.tx_ready && !(txdctl & FM10K_TXDCTL_ENABLE)) {
+	if (mac->tx_ready && !(txdctl & FM10K_TXDCTL_ENABLE)) {
 		ret_val = FM10K_ERR_RESET_REQUESTED;
 		goto out;
 	}
@@ -558,8 +558,12 @@ s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready)
 		goto out;
 
 	/* interface cannot receive traffic without logical ports */
-	if (mac->dglort_map == FM10K_DGLORTMAP_NONE)
+	if (mac->dglort_map == FM10K_DGLORTMAP_NONE) {
+		if (mac->ops.request_lport_map)
+			ret_val = mac->ops.request_lport_map(hw);
+
 		goto out;
+	}
 
 	/* if we passed all the tests above then the switch is ready and we no
 	 * longer need to check for link
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 4c075b6..bbc483d 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1688,13 +1688,12 @@ STATIC s32 fm10k_request_lport_map_pf(struct fm10k_hw *hw)
  *  @hw: pointer to hardware structure
  *  @switch_ready: pointer to boolean value that will record switch state
  *
- *  This funciton will check the DMA_CTRL2 register and mailbox in order
+ *  This function will check the DMA_CTRL2 register and mailbox in order
  *  to determine if the switch is ready for the PF to begin requesting
  *  addresses and mapping traffic to the local interface.
  **/
 STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)
 {
-	s32 ret_val = FM10K_SUCCESS;
 	u32 dma_ctrl2;
 
 	DEBUGFUNC("fm10k_get_host_state_pf");
@@ -1702,19 +1701,10 @@ STATIC s32 fm10k_get_host_state_pf(struct fm10k_hw *hw, bool *switch_ready)
 	/* verify the switch is ready for interaction */
 	dma_ctrl2 = FM10K_READ_REG(hw, FM10K_DMA_CTRL2);
 	if (!(dma_ctrl2 & FM10K_DMA_CTRL2_SWITCH_READY))
-		goto out;
+		return FM10K_SUCCESS;
 
 	/* retrieve generic host state info */
-	ret_val = fm10k_get_host_state_generic(hw, switch_ready);
-	if (ret_val)
-		goto out;
-
-	/* interface cannot receive traffic without logical ports */
-	if (hw->mac.dglort_map == FM10K_DGLORTMAP_NONE)
-		ret_val = fm10k_request_lport_map_pf(hw);
-
-out:
-	return ret_val;
+	return fm10k_get_host_state_generic(hw, switch_ready);
 }
 
 /* This structure defines the attibutes to be parsed below */
@@ -2102,6 +2092,7 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
 	mac->ops.set_dma_mask = &fm10k_set_dma_mask_pf;
 	mac->ops.get_fault = &fm10k_get_fault_pf;
 	mac->ops.get_host_state = &fm10k_get_host_state_pf;
+	mac->ops.request_lport_map = &fm10k_request_lport_map_pf;
 	mac->ops.adjust_systime = &fm10k_adjust_systime_pf;
 	mac->ops.notify_offset = &fm10k_notify_offset_pf;
 	mac->ops.read_systime = &fm10k_read_systime_pf;
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 515be26..b74cebf 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -611,6 +611,7 @@ struct fm10k_mac_ops {
 	s32 (*stop_hw)(struct fm10k_hw *);
 	s32 (*get_bus_info)(struct fm10k_hw *);
 	s32 (*get_host_state)(struct fm10k_hw *, bool *);
+	s32 (*request_lport_map)(struct fm10k_hw *);
 #ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	bool (*is_slot_appropriate)(struct fm10k_hw *);
 #endif
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 12/18] net/fm10k/base: add macros for global interrupt
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (10 preceding siblings ...)
  2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 11/18] net/fm10k/base: enable lport map request Qi Zhang
@ 2017-03-08  6:19   ` Qi Zhang
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 13/18] net/fm10k/base: don't stop reset Qi Zhang
                     ` (6 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:19 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Add two macros for global interrupt.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.h b/drivers/net/fm10k/base/fm10k_mbx.h
index edc57df..2fac012 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.h
+++ b/drivers/net/fm10k/base/fm10k_mbx.h
@@ -54,6 +54,8 @@ struct fm10k_mbx_info;
 #define FM10K_MBX_ACK_INTERRUPT			0x00000010
 #define FM10K_MBX_INTERRUPT_ENABLE		0x00000020
 #define FM10K_MBX_INTERRUPT_DISABLE		0x00000040
+#define FM10K_MBX_GLOBAL_REQ_INTERRUPT		0x00000200
+#define FM10K_MBX_GLOBAL_ACK_INTERRUPT		0x00000400
 #define FM10K_MBICR(_n)		((_n) + 0x18840)
 #define FM10K_GMBX		0x18842
 
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 13/18] net/fm10k/base: don't stop reset
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (11 preceding siblings ...)
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 12/18] net/fm10k/base: add macros for global interrupt Qi Zhang
@ 2017-03-08  6:19   ` Qi Zhang
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 14/18] net/fm10k/base: add macro for geneve tunnel offload Qi Zhang
                     ` (5 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:19 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Don't report FM10K_ERR_REQUESTS_PENDING when we fail to disable queues
within the timeout. This can occur due to a hardware Tx hang, or when
the switch ethernet fabric is resetting while we are transmitting
traffic. It can sometimes take up to 500ms before the Tx DMA engine
gives up. Instead, just skip the DMA engine check and perform
a data-path reset anyways. Add a statistic counter to keep track of the
number of resets occurring while we have pending DMA on the rings.

In order to prevent having to assign err = FM10K_SUCCESS, re-order the
last few items of the reset_hw_pf function so that we don't perform
"return err" at the end.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 19 +++++++++----------
 drivers/net/fm10k/base/fm10k_type.h |  1 +
 drivers/net/fm10k/base/fm10k_vf.c   | 12 +++++++-----
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index bbc483d..bce2913 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -66,21 +66,21 @@ STATIC s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)
 
 	/* shut down all rings */
 	err = fm10k_disable_queues_generic(hw, FM10K_MAX_QUEUES);
-	if (err)
+	if (err == FM10K_ERR_REQUESTS_PENDING) {
+		hw->mac.reset_while_pending++;
+		goto force_reset;
+	} else if (err) {
 		return err;
+	}
 
 	/* Verify that DMA is no longer active */
 	reg = FM10K_READ_REG(hw, FM10K_DMA_CTRL);
 	if (reg & (FM10K_DMA_CTRL_TX_ACTIVE | FM10K_DMA_CTRL_RX_ACTIVE))
 		return FM10K_ERR_DMA_PENDING;
 
-	/* verify the switch is ready for reset */
-	reg = FM10K_READ_REG(hw, FM10K_DMA_CTRL2);
-	if (!(reg & FM10K_DMA_CTRL2_SWITCH_READY))
-		goto out;
-
+force_reset:
 	/* Inititate data path reset */
-	reg |= FM10K_DMA_CTRL_DATAPATH_RESET;
+	reg = FM10K_DMA_CTRL_DATAPATH_RESET;
 	FM10K_WRITE_REG(hw, FM10K_DMA_CTRL, reg);
 
 	/* Flush write and allow 100us for reset to complete */
@@ -90,10 +90,9 @@ STATIC s32 fm10k_reset_hw_pf(struct fm10k_hw *hw)
 	/* Verify we made it out of reset */
 	reg = FM10K_READ_REG(hw, FM10K_IP);
 	if (!(reg & FM10K_IP_NOTINRESET))
-		err = FM10K_ERR_RESET_FAILED;
+		return FM10K_ERR_RESET_FAILED;
 
-out:
-	return err;
+	return FM10K_SUCCESS;
 }
 
 /**
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index b74cebf..d43e40c 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -654,6 +654,7 @@ struct fm10k_mac_info {
 	bool tx_ready;
 	u32 dglort_map;
 	u8 itr_scale;
+	u64 reset_while_pending;
 };
 
 struct fm10k_swapi_table_info {
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index dd3d318..71bacd0 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -49,7 +49,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 
 	/* we need to disable the queues before taking further steps */
 	err = fm10k_stop_hw_generic(hw);
-	if (err)
+	if (err && err != FM10K_ERR_REQUESTS_PENDING)
 		return err;
 
 	/* If permanent address is set then we need to restore it */
@@ -82,7 +82,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 		FM10K_WRITE_REG(hw, FM10K_TDLEN(i), tdlen);
 	}
 
-	return FM10K_SUCCESS;
+	return err;
 }
 
 /**
@@ -100,7 +100,9 @@ STATIC s32 fm10k_reset_hw_vf(struct fm10k_hw *hw)
 
 	/* shut down queues we own and reset DMA configuration */
 	err = fm10k_stop_hw_vf(hw);
-	if (err)
+	if (err == FM10K_ERR_REQUESTS_PENDING)
+		hw->mac.reset_while_pending++;
+	else if (err)
 		return err;
 
 	/* Inititate VF reset */
@@ -113,9 +115,9 @@ STATIC s32 fm10k_reset_hw_vf(struct fm10k_hw *hw)
 	/* Clear reset bit and verify it was cleared */
 	FM10K_WRITE_REG(hw, FM10K_VFCTRL, 0);
 	if (FM10K_READ_REG(hw, FM10K_VFCTRL) & FM10K_VFCTRL_RST)
-		err = FM10K_ERR_RESET_FAILED;
+		return FM10K_ERR_RESET_FAILED;
 
-	return err;
+	return FM10K_SUCCESS;
 }
 
 /**
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 14/18] net/fm10k/base: add macro for geneve tunnel offload
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (12 preceding siblings ...)
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 13/18] net/fm10k/base: don't stop reset Qi Zhang
@ 2017-03-08  6:19   ` Qi Zhang
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 15/18] net/fm10k/base: improve re-map queues handle Qi Zhang
                     ` (4 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:19 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

add necessary macro to support geneve tunnel offload.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index d43e40c..931633d 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -194,6 +194,7 @@ struct fm10k_hw;
 #define FM10K_DGLORTDEC_INNERRSS_ENABLE		0x08000000
 #define FM10K_TUNNEL_CFG	0x0040
 #define FM10K_TUNNEL_CFG_NVGRE_SHIFT		16
+#define FM10K_TUNNEL_CFG_GENEVE	0x0041
 #define FM10K_SWPRI_MAP(_n)	((_n) + 0x0050)
 #define FM10K_SWPRI_MAX		16
 #define FM10K_RSSRK(_n, _m)	(((_n) * 0x10) + (_m) + 0x0800)
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 15/18] net/fm10k/base: improve re-map queues handle
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (13 preceding siblings ...)
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 14/18] net/fm10k/base: add macro for geneve tunnel offload Qi Zhang
@ 2017-03-08  6:19   ` Qi Zhang
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 16/18] net/fm10k/base: replace macros Qi Zhang
                     ` (3 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:19 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Avoid potential FUM fault errors on a VF when updating MAC address
and VLAN information. Only use the register flow when the mailbox is
disconnected, by checking if the enqueue_tx returns
FM10K_MBX_ERR_NO_MBX. If the mailbox message can be sent, there is no
reason to bother with the register writes which are only intended to
be used during VF driver initialization.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_common.c |  3 +++
 drivers/net/fm10k/base/fm10k_pf.c     | 42 ++++++++++++++++++++++++-----------
 2 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_common.c b/drivers/net/fm10k/base/fm10k_common.c
index 7acc1ba..29f35d7 100644
--- a/drivers/net/fm10k/base/fm10k_common.c
+++ b/drivers/net/fm10k/base/fm10k_common.c
@@ -230,6 +230,9 @@ s32 fm10k_disable_queues_generic(struct fm10k_hw *hw, u16 q_cnt)
 	/* clear tx_ready to prevent any false hits for reset */
 	hw->mac.tx_ready = false;
 
+	if (FM10K_REMOVED(hw->hw_addr))
+		return FM10K_SUCCESS;
+
 	/* clear the enable bit for all rings */
 	for (i = 0; i < q_cnt; i++) {
 		reg = FM10K_READ_REG(hw, FM10K_TXDCTL(i));
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index bce2913..5b1098e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -926,9 +926,35 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	fm10k_tlv_attr_put_mac_vlan(msg, FM10K_MAC_VLAN_MSG_DEFAULT_MAC,
 				    vf_info->mac, vf_vid);
 
-	/* load onto outgoing mailbox, ignore any errors on enqueue */
-	if (vf_info->mbx.ops.enqueue_tx)
-		vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);
+	/* Configure Queue control register with new VLAN ID. The TXQCTL
+	 * register is RO from the VF, so the PF must do this even in the
+	 * case of notifying the VF of a new VID via the mailbox.
+	 */
+	txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &
+		 FM10K_TXQCTL_VID_MASK;
+	txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
+		  FM10K_TXQCTL_VF | vf_idx;
+
+	for (i = 0; i < queues_per_pool; i++)
+		FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
+
+	/* try loading a message onto outgoing mailbox first */
+	if (vf_info->mbx.ops.enqueue_tx) {
+		err = vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);
+		if (err != FM10K_MBX_ERR_NO_MBX)
+			return err;
+		err = FM10K_SUCCESS;
+	}
+
+	/* If we aren't connected to a mailbox, this is most likely because
+	 * the VF driver is not running. It should thus be safe to re-map
+	 * queues and use the registers to pass the MAC address so that the VF
+	 * driver gets correct information during its initialization.
+	 */
+
+	/* MAP Tx queue back to 0 temporarily, and disable it */
+	FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), 0);
+	FM10K_WRITE_REG(hw, FM10K_TXDCTL(vf_q_idx), 0);
 
 	/* verify ring has disabled before modifying base address registers */
 	txdctl = FM10K_READ_REG(hw, FM10K_TXDCTL(vf_q_idx));
@@ -967,16 +993,6 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 						   FM10K_TDLEN_ITR_SCALE_SHIFT);
 
 err_out:
-	/* configure Queue control register */
-	txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &
-		 FM10K_TXQCTL_VID_MASK;
-	txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
-		  FM10K_TXQCTL_VF | vf_idx;
-
-	/* assign VLAN ID */
-	for (i = 0; i < queues_per_pool; i++)
-		FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
-
 	/* restore the queue back to VF ownership */
 	FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);
 	return err;
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 16/18] net/fm10k/base: replace macros
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (14 preceding siblings ...)
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 15/18] net/fm10k/base: improve re-map queues handle Qi Zhang
@ 2017-03-08  6:19   ` Qi Zhang
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 17/18] net/fm10k/base: request reset when mbx->state changes Qi Zhang
                     ` (2 subsequent siblings)
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:19 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Other shared code bases are planning on using
IS_MULTICAST_ETHER_ADDR and friends without leaving the driver
name in the macro.
Remove reference to FM10K here so that we can re-use the specific
compat flags from Linux.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 10 +++++-----
 drivers/net/fm10k/base/fm10k_type.h | 14 +++++++-------
 drivers/net/fm10k/base/fm10k_vf.c   |  8 ++++----
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 5b1098e..db5f491 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -411,7 +411,7 @@ STATIC s32 fm10k_update_uc_addr_pf(struct fm10k_hw *hw, u16 glort,
 	DEBUGFUNC("fm10k_update_uc_addr_pf");
 
 	/* verify MAC address is valid */
-	if (!FM10K_IS_VALID_ETHER_ADDR(mac))
+	if (!IS_VALID_ETHER_ADDR(mac))
 		return FM10K_ERR_PARAM;
 
 	return fm10k_update_xc_addr_pf(hw, glort, mac, vid, add, flags);
@@ -434,7 +434,7 @@ STATIC s32 fm10k_update_mc_addr_pf(struct fm10k_hw *hw, u16 glort,
 	DEBUGFUNC("fm10k_update_mc_addr_pf");
 
 	/* verify multicast address is valid */
-	if (!FM10K_IS_MULTICAST_ETHER_ADDR(mac))
+	if (!IS_MULTICAST_ETHER_ADDR(mac))
 		return FM10K_ERR_PARAM;
 
 	return fm10k_update_xc_addr_pf(hw, glort, mac, vid, add, 0);
@@ -970,7 +970,7 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	}
 
 	/* Update base address registers to contain MAC address */
-	if (FM10K_IS_VALID_ETHER_ADDR(vf_info->mac)) {
+	if (IS_VALID_ETHER_ADDR(vf_info->mac)) {
 		tdbal = (((u32)vf_info->mac[3]) << 24) |
 			(((u32)vf_info->mac[4]) << 16) |
 			(((u32)vf_info->mac[5]) << 8);
@@ -1100,7 +1100,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 	FM10K_WRITE_REG(hw, FM10K_MRQC(vf_info->vsi), 0);
 
 	/* Update base address registers to contain MAC address */
-	if (FM10K_IS_VALID_ETHER_ADDR(vf_info->mac)) {
+	if (IS_VALID_ETHER_ADDR(vf_info->mac)) {
 		tdbal = (((u32)vf_info->mac[3]) << 24) |
 			(((u32)vf_info->mac[4]) << 16) |
 			(((u32)vf_info->mac[5]) << 8);
@@ -1326,7 +1326,7 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 			return err;
 
 		/* block attempts to set MAC for a locked device */
-		if (FM10K_IS_VALID_ETHER_ADDR(vf_info->mac) &&
+		if (IS_VALID_ETHER_ADDR(vf_info->mac) &&
 		    memcmp(mac, vf_info->mac, ETH_ALEN))
 			return FM10K_ERR_PARAM;
 
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 931633d..1ae1644 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -447,20 +447,20 @@ struct fm10k_hw;
 #define ETH_ALEN	6
 #endif /* ETH_ALEN */
 
-#ifndef FM10K_IS_ZERO_ETHER_ADDR
+#ifndef IS_ZERO_ETHER_ADDR
 /* make certain address is not 0 */
-#define FM10K_IS_ZERO_ETHER_ADDR(addr) \
+#define IS_ZERO_ETHER_ADDR(addr) \
 (!((addr)[0] | (addr)[1] | (addr)[2] | (addr)[3] | (addr)[4] | (addr)[5]))
 #endif
 
-#ifndef FM10K_IS_MULTICAST_ETHER_ADDR
-#define FM10K_IS_MULTICAST_ETHER_ADDR(addr) ((addr)[0] & 0x1)
+#ifndef IS_MULTICAST_ETHER_ADDR
+#define IS_MULTICAST_ETHER_ADDR(addr) ((addr)[0] & 0x1)
 #endif
 
-#ifndef FM10K_IS_VALID_ETHER_ADDR
+#ifndef IS_VALID_ETHER_ADDR
 /* make certain address is not multicast or 0 */
-#define FM10K_IS_VALID_ETHER_ADDR(addr) \
-(!FM10K_IS_MULTICAST_ETHER_ADDR(addr) && !FM10K_IS_ZERO_ETHER_ADDR(addr))
+#define IS_VALID_ETHER_ADDR(addr) \
+(!IS_MULTICAST_ETHER_ADDR(addr) && !IS_ZERO_ETHER_ADDR(addr))
 #endif
 
 enum fm10k_int_source {
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 71bacd0..bd44977 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -53,7 +53,7 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 		return err;
 
 	/* If permanent address is set then we need to restore it */
-	if (FM10K_IS_VALID_ETHER_ADDR(perm_addr)) {
+	if (IS_VALID_ETHER_ADDR(perm_addr)) {
 		bal = (((u32)perm_addr[3]) << 24) |
 		      (((u32)perm_addr[4]) << 16) |
 		      (((u32)perm_addr[5]) << 8);
@@ -341,11 +341,11 @@ STATIC s32 fm10k_update_uc_addr_vf(struct fm10k_hw *hw, u16 glort,
 		return FM10K_ERR_PARAM;
 
 	/* verify MAC address is valid */
-	if (!FM10K_IS_VALID_ETHER_ADDR(mac))
+	if (!IS_VALID_ETHER_ADDR(mac))
 		return FM10K_ERR_PARAM;
 
 	/* verify we are not locked down on the MAC address */
-	if (FM10K_IS_VALID_ETHER_ADDR(hw->mac.perm_addr) &&
+	if (IS_VALID_ETHER_ADDR(hw->mac.perm_addr) &&
 	    memcmp(hw->mac.perm_addr, mac, ETH_ALEN))
 		return FM10K_ERR_PARAM;
 
@@ -387,7 +387,7 @@ STATIC s32 fm10k_update_mc_addr_vf(struct fm10k_hw *hw, u16 glort,
 		return FM10K_ERR_PARAM;
 
 	/* verify multicast address is valid */
-	if (!FM10K_IS_MULTICAST_ETHER_ADDR(mac))
+	if (!IS_MULTICAST_ETHER_ADDR(mac))
 		return FM10K_ERR_PARAM;
 
 	/* add bit to notify us if this is a set or clear operation */
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 17/18] net/fm10k/base: request reset when mbx->state changes
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (15 preceding siblings ...)
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 16/18] net/fm10k/base: replace macros Qi Zhang
@ 2017-03-08  6:19   ` Qi Zhang
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 18/18] net/fm10k/base: add base driver information Qi Zhang
  2017-03-09 11:13   ` [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code Ferruh Yigit
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:19 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Multiple IES API resets can cause a race condition where the mailbox
interrupt request bits can be cleared before being handled. This can
leave certain mailbox messages from the PF to be untreated and the PF
will enter in some inactive state. If this situation occurs, the IES API
will initiate a mailbox version reset which, then, trigger a mailbox
state change. Once this mailbox transition occurs (from OPEN to CONNECT
state), a request for reset will be returned.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 2e70434..16ab98d 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -2066,9 +2066,10 @@ STATIC void fm10k_sm_mbx_create_reply(struct fm10k_hw *hw,
  *  function can also be used to respond to an error as the connection
  *  resetting would also be a means of dealing with errors.
  **/
-STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
-				       struct fm10k_mbx_info *mbx)
+STATIC s32 fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
+				      struct fm10k_mbx_info *mbx)
 {
+	s32 err = FM10K_SUCCESS;
 	const enum fm10k_mbx_state state = mbx->state;
 
 	switch (state) {
@@ -2081,6 +2082,7 @@ STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
 	case FM10K_STATE_OPEN:
 		/* flush any incomplete work */
 		fm10k_sm_mbx_connect_reset(mbx);
+		err = FM10K_ERR_RESET_REQUESTED;
 		break;
 	case FM10K_STATE_CONNECT:
 		/* Update remote value to match local value */
@@ -2090,6 +2092,8 @@ STATIC void fm10k_sm_mbx_process_reset(struct fm10k_hw *hw,
 	}
 
 	fm10k_sm_mbx_create_reply(hw, mbx, mbx->tail);
+
+	return err;
 }
 
 /**
@@ -2172,7 +2176,7 @@ STATIC s32 fm10k_sm_mbx_process(struct fm10k_hw *hw,
 
 	switch (FM10K_MSG_HDR_FIELD_GET(mbx->mbx_hdr, SM_VER)) {
 	case 0:
-		fm10k_sm_mbx_process_reset(hw, mbx);
+		err = fm10k_sm_mbx_process_reset(hw, mbx);
 		break;
 	case FM10K_SM_MBX_VERSION:
 		err = fm10k_sm_mbx_process_version_1(hw, mbx);
-- 
2.9.3

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

* [dpdk-dev] [PATCH v2 18/18] net/fm10k/base: add base driver information
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (16 preceding siblings ...)
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 17/18] net/fm10k/base: request reset when mbx->state changes Qi Zhang
@ 2017-03-08  6:19   ` Qi Zhang
  2017-03-09 11:13   ` [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code Ferruh Yigit
  18 siblings, 0 replies; 45+ messages in thread
From: Qi Zhang @ 2017-03-08  6:19 UTC (permalink / raw)
  To: jing.d.chen; +Cc: helin.zhang, dev, Qi Zhang

Add base driver information in Makefile.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/fm10k/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index afcbd1d..3985c0b 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -84,6 +84,7 @@ VPATH += $(SRCDIR)/base
 
 #
 # all source are stored in SRCS-y
+# base driver is based on the package of cid-fm10k.2017.01.24.tar.gz
 #
 SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_rxtx.c
-- 
2.9.3

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

* Re: [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code.
  2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
                     ` (17 preceding siblings ...)
  2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 18/18] net/fm10k/base: add base driver information Qi Zhang
@ 2017-03-09 11:13   ` Ferruh Yigit
  2017-03-10  3:11     ` Zhang, Qi Z
  18 siblings, 1 reply; 45+ messages in thread
From: Ferruh Yigit @ 2017-03-09 11:13 UTC (permalink / raw)
  To: Qi Zhang, jing.d.chen; +Cc: helin.zhang, dev

On 3/8/2017 6:18 AM, Qi Zhang wrote:
> The patch set update to latest fm10k base code, there is no
> significent features be added, but include couple enhancement
> like clean up the logic for tlv attr parse, improve VF multi-bit 
> VLAN handle etc, also with some code/comment clean as well.
> 
> v2: 
>   - add base code information
>   - correct couple typo errors in commit log.
> 
> Qi Zhang (17):
>   net/fm10k/base: add a flag to indicate VF trust mode
>   net/fm10k/base: reset multicast mode when deleting lport
>   net/fm10k/base: expose macros needed by DPDK
>   net/fm10k/base: add error code
>   net/fm10k/base: clean up the logic
>   net/fm10k/base: add new item to lport msg attr
>   net/fm10k/base: update comment
>   net/fm10k/base: use different name for override bit
>   net/fm10k/base: update comment regarding reserved bits check
>   net/fm10k/base: improve VF's multi-bit VLAN update requests
>   net/fm10k/base: enable lport map request
>   net/fm10k/base: add macros for global interrupt
>   net/fm10k/base: don't stop reset
>   net/fm10k/base: add marcro for geneve tunnel
>   net/fm10k/base: improve re-map queues handle
>   net/fm10k/base: replace marcos
>   net/fm10k/base: request reset when mbx->state changes
>   net/fm10k/base: add base code driver information

Series applied to dpdk-next-net/master, thanks.

defined(DPDK_SUPPORT) removed from patch 3/18, which is useless and
looks like exists by mistake, please double check updated code.

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

* Re: [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code.
  2017-03-09 11:13   ` [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code Ferruh Yigit
@ 2017-03-10  3:11     ` Zhang, Qi Z
  0 siblings, 0 replies; 45+ messages in thread
From: Zhang, Qi Z @ 2017-03-10  3:11 UTC (permalink / raw)
  To: Yigit, Ferruh, Chen, Jing D; +Cc: Zhang, Helin, dev

Hi Ferruh:
	I have checked 3/18 patch, no issue, Thank for the kind help!
Regards
Qi

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Thursday, March 9, 2017 7:13 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Chen, Jing D
> <jing.d.chen@intel.com>
> Cc: Zhang, Helin <helin.zhang@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code.
> 
> On 3/8/2017 6:18 AM, Qi Zhang wrote:
> > The patch set update to latest fm10k base code, there is no
> > significent features be added, but include couple enhancement like
> > clean up the logic for tlv attr parse, improve VF multi-bit VLAN
> > handle etc, also with some code/comment clean as well.
> >
> > v2:
> >   - add base code information
> >   - correct couple typo errors in commit log.
> >
> > Qi Zhang (17):
> >   net/fm10k/base: add a flag to indicate VF trust mode
> >   net/fm10k/base: reset multicast mode when deleting lport
> >   net/fm10k/base: expose macros needed by DPDK
> >   net/fm10k/base: add error code
> >   net/fm10k/base: clean up the logic
> >   net/fm10k/base: add new item to lport msg attr
> >   net/fm10k/base: update comment
> >   net/fm10k/base: use different name for override bit
> >   net/fm10k/base: update comment regarding reserved bits check
> >   net/fm10k/base: improve VF's multi-bit VLAN update requests
> >   net/fm10k/base: enable lport map request
> >   net/fm10k/base: add macros for global interrupt
> >   net/fm10k/base: don't stop reset
> >   net/fm10k/base: add marcro for geneve tunnel
> >   net/fm10k/base: improve re-map queues handle
> >   net/fm10k/base: replace marcos
> >   net/fm10k/base: request reset when mbx->state changes
> >   net/fm10k/base: add base code driver information
> 
> Series applied to dpdk-next-net/master, thanks.
> 
> defined(DPDK_SUPPORT) removed from patch 3/18, which is useless and
> looks like exists by mistake, please double check updated code.

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

end of thread, other threads:[~2017-03-10  3:11 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03  3:17 [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 01/17] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 02/17] net/fm10k/base: reset multicaset mode when deleting lport Qi Zhang
2017-03-05 11:41   ` Ferruh Yigit
2017-03-03  3:17 ` [dpdk-dev] [PATCH 03/17] net/fm10k/base: expose macros needed by DPDK Qi Zhang
2017-03-05 11:41   ` Ferruh Yigit
2017-03-03  3:17 ` [dpdk-dev] [PATCH 04/17] net/fm10k/base: add error code Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 05/17] net/fm10k/base: clean up the logic Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 06/17] net/fm10k/base: add new item to lport msg attr Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 07/17] net/fm10k/base: use 8 bit notation instead of 10bit notation Qi Zhang
2017-03-05 11:42   ` Ferruh Yigit
2017-03-03  3:17 ` [dpdk-dev] [PATCH 08/17] net/fm10k/base: use different name for override bit Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 09/17] net/fm10k/base: update comment regarding reserved bits check Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 10/17] net/fm10k/base: improve VF's multi-bit VLAN update requests Qi Zhang
2017-03-05 11:42   ` Ferruh Yigit
2017-03-03  3:17 ` [dpdk-dev] [PATCH 11/17] net/fm10k/base: enable lport map request Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 12/17] net/fm10k/base: add macros for global interrupt Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 13/17] net/fm10k/base: don't stop reset Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 14/17] net/fm10k/base: add macro for geneve tunnel offload Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 15/17] net/fm10k/base: improve re-map queues handle Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 16/17] net/fm10k/base: replace macros Qi Zhang
2017-03-03  3:17 ` [dpdk-dev] [PATCH 17/17] net/fm10k/base: equest reset when mbx->state changes Qi Zhang
2017-03-05 11:42   ` Ferruh Yigit
2017-03-05 11:41 ` [dpdk-dev] [PATCH 00/17] net/fm10k: update base code Ferruh Yigit
2017-03-08  6:18 ` [dpdk-dev] [PATCH v2 00/18] " Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 01/18] net/fm10k/base: add a flag to indicate VF trust mode Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 02/18] net/fm10k/base: reset multicast mode when deleting lport Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 03/18] net/fm10k/base: expose macros needed by DPDK Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 04/18] net/fm10k/base: add error code Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 05/18] net/fm10k/base: clean up the logic Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 06/18] net/fm10k/base: add new item to lport msg attr Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 07/18] net/fm10k/base: update comment Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 08/18] net/fm10k/base: use different name for override bit Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 09/18] net/fm10k/base: update comment regarding reserved bits check Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 10/18] net/fm10k/base: improve VF's multi-bit VLAN update requests Qi Zhang
2017-03-08  6:18   ` [dpdk-dev] [PATCH v2 11/18] net/fm10k/base: enable lport map request Qi Zhang
2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 12/18] net/fm10k/base: add macros for global interrupt Qi Zhang
2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 13/18] net/fm10k/base: don't stop reset Qi Zhang
2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 14/18] net/fm10k/base: add macro for geneve tunnel offload Qi Zhang
2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 15/18] net/fm10k/base: improve re-map queues handle Qi Zhang
2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 16/18] net/fm10k/base: replace macros Qi Zhang
2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 17/18] net/fm10k/base: request reset when mbx->state changes Qi Zhang
2017-03-08  6:19   ` [dpdk-dev] [PATCH v2 18/18] net/fm10k/base: add base driver information Qi Zhang
2017-03-09 11:13   ` [dpdk-dev] [PATCH v2 00/18] net/fm10k: update base code Ferruh Yigit
2017-03-10  3:11     ` Zhang, Qi Z

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