All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/16] fm10k: update shared code from ND team
@ 2016-01-21 10:35 Wang Xiao W
  2016-01-21 10:35 ` [PATCH 01/16] fm10k/base: cleanup namespace pollution and correct typecast Wang Xiao W
                   ` (15 more replies)
  0 siblings, 16 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

This shared code update patch set has passed the regression test.

Wang Xiao W (16):
  fm10k/base: cleanup namespace pollution and correct typecast
  fm10k/base: use bitshift for itr_scale
  fm10k/base: reset max_queues on init_hw_vf failure
  fm10k/base: document ITR scale workaround in VF TDLEN register
  fm10k/base: fix checkpatch warning
  fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
  fm10k/base: do not use CamelCase
  fm10k/base: use memcpy for mac addr copy
  fm10k/base: allow removal of is_slot_appropriate function
  fm10k/base: consistently use VLAN ID when referencing vid variables
  fm10k/base: fix comment per upstream review changes
  fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned
  fm10k/base: move constants to the right of binary operators
  fm10k/base: minor cleanups
  fm10k: use default mailbox message handler for pf
  fm10k/base: add macro definitions that are needed

 drivers/net/fm10k/base/fm10k_api.c   |   2 +
 drivers/net/fm10k/base/fm10k_api.h   |   2 +
 drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
 drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
 drivers/net/fm10k/base/fm10k_osdep.h |  30 ++++++
 drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
 drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
 drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
 drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
 drivers/net/fm10k/base/fm10k_type.h  | 182 +++++++----------------------------
 drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
 drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
 12 files changed, 220 insertions(+), 298 deletions(-)

-- 
1.9.3

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

* [PATCH 01/16] fm10k/base: cleanup namespace pollution and correct typecast
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 02/16] fm10k/base: use bitshift for itr_scale Wang Xiao W
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Correct typecast in fm10k_update_xc_addr_pf.

Make functions that are only referenced locally static.

And fix the function header comment for fm10k_tlv_attr_nest_stop() while
we're at it.

Wrap fm10k_msg_data fm10k_iov_msg_data_pf[] in the new ifndef
NO_DEFAULT_SRIOV_MSG_HANDLERS so that drivers with custom SR-IOV
message handlers can strip it.

remove unused struct element in struct fm10k_mac_ops.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 10 ++++++----
 drivers/net/fm10k/base/fm10k_pf.h   |  4 ++--
 drivers/net/fm10k/base/fm10k_tlv.c  | 16 ++++++++--------
 drivers/net/fm10k/base/fm10k_tlv.h  |  5 -----
 drivers/net/fm10k/base/fm10k_type.h |  1 -
 drivers/net/fm10k/base/fm10k_vf.c   |  2 --
 6 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 6e6d71e..5b8c039 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -379,8 +379,8 @@ STATIC s32 fm10k_update_xc_addr_pf(struct fm10k_hw *hw, u16 glort,
 						 ((u32)mac[3] << 16) |
 						 ((u32)mac[4] << 8) |
 						 ((u32)mac[5]));
-	mac_update.mac_upper = FM10K_CPU_TO_LE16(((u32)mac[0] << 8) |
-						 ((u32)mac[1]));
+	mac_update.mac_upper = FM10K_CPU_TO_LE16(((u16)mac[0] << 8) |
+					   ((u16)mac[1]));
 	mac_update.vlan = FM10K_CPU_TO_LE16(vid);
 	mac_update.glort = FM10K_CPU_TO_LE16(glort);
 	mac_update.action = add ? 0 : 1;
@@ -1457,6 +1457,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 	return err;
 }
 
+#ifndef NO_DEFAULT_SRIOV_MSG_HANDLERS
 const struct fm10k_msg_data fm10k_iov_msg_data_pf[] = {
 	FM10K_TLV_MSG_TEST_HANDLER(fm10k_tlv_msg_test),
 	FM10K_VF_MSG_MSIX_HANDLER(fm10k_iov_msg_msix_pf),
@@ -1465,6 +1466,7 @@ const struct fm10k_msg_data fm10k_iov_msg_data_pf[] = {
 	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
 };
 
+#endif
 /**
  *  fm10k_update_stats_hw_pf - Updates hardware related statistics of PF
  *  @hw: pointer to hardware structure
@@ -1754,8 +1756,8 @@ const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[] = {
  *
  *  This handler configures the default VLAN for the PF
  **/
-s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
-			     struct fm10k_mbx_info *mbx)
+static s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
+				    struct fm10k_mbx_info *mbx)
 {
 	u16 glort, pvid;
 	u32 pvid_update;
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index 44bd193..92e2962 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -149,8 +149,6 @@ extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
 #define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
 	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_MAP, \
 			  fm10k_lport_map_msg_attr, func)
-s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *, u32 **,
-			     struct fm10k_mbx_info *);
 extern const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[];
 #define FM10K_PF_MSG_UPDATE_PVID_HANDLER(func) \
 	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_UPDATE_PVID, \
@@ -183,7 +181,9 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
 			      struct fm10k_mbx_info *);
 s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
 				 struct fm10k_mbx_info *);
+#ifndef NO_DEFAULT_SRIOV_MSG_HANDLERS
 extern const struct fm10k_msg_data fm10k_iov_msg_data_pf[];
+#endif
 
 s32 fm10k_init_ops_pf(struct fm10k_hw *hw);
 #endif /* _FM10K_PF_H */
diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c
index 1d9d7d8..ade87d1 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.c
+++ b/drivers/net/fm10k/base/fm10k_tlv.c
@@ -63,8 +63,8 @@ s32 fm10k_tlv_msg_init(u32 *msg, u16 msg_id)
  *  the attribute buffer.  It will return success if provided with a valid
  *  pointers.
  **/
-s32 fm10k_tlv_attr_put_null_string(u32 *msg, u16 attr_id,
-				   const unsigned char *string)
+static s32 fm10k_tlv_attr_put_null_string(u32 *msg, u16 attr_id,
+					  const unsigned char *string)
 {
 	u32 attr_data = 0, len = 0;
 	u32 *attr;
@@ -115,7 +115,7 @@ s32 fm10k_tlv_attr_put_null_string(u32 *msg, u16 attr_id,
  *  it in the array pointed by by string.  It will return success if provided
  *  with a valid pointers.
  **/
-s32 fm10k_tlv_attr_get_null_string(u32 *attr, unsigned char *string)
+static s32 fm10k_tlv_attr_get_null_string(u32 *attr, unsigned char *string)
 {
 	u32 len;
 
@@ -386,7 +386,7 @@ s32 fm10k_tlv_attr_get_le_struct(u32 *attr, void *le_struct, u32 len)
  *  function will return NULL on failure, and a pointer to the start
  *  of the nested attributes on success.
  **/
-u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
+static u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
 {
 	u32 *attr;
 
@@ -405,7 +405,7 @@ u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
 }
 
 /**
- *  fm10k_tlv_attr_nest_start - Start a set of nested attributes
+ *  fm10k_tlv_attr_nest_stop - Stop a set of nested attributes
  *  @msg: Pointer to message block
  *
  *  This function closes off an existing set of nested attributes.  The
@@ -413,7 +413,7 @@ u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
  *  the case of a nest within the nest this would be the outer nest pointer.
  *  This function will return success provided all pointers are valid.
  **/
-s32 fm10k_tlv_attr_nest_stop(u32 *msg)
+static s32 fm10k_tlv_attr_nest_stop(u32 *msg)
 {
 	u32 *attr;
 	u32 len;
@@ -522,8 +522,8 @@ STATIC s32 fm10k_tlv_attr_validate(u32 *attr,
  *  FM10K_NOT_IMPLEMENTED for any attribute that is outside of the array
  *  and 0 on success.
  **/
-s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
-			 const struct fm10k_tlv_attr *tlv_attr)
+static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
+				const struct fm10k_tlv_attr *tlv_attr)
 {
 	u32 i, attr_id, offset = 0;
 	s32 err = 0;
diff --git a/drivers/net/fm10k/base/fm10k_tlv.h b/drivers/net/fm10k/base/fm10k_tlv.h
index ad97236..a297bb8 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.h
+++ b/drivers/net/fm10k/base/fm10k_tlv.h
@@ -119,8 +119,6 @@ struct fm10k_msg_data {
 #define FM10K_MSG_HANDLER(id, attr, func) { id, attr, func }
 
 s32 fm10k_tlv_msg_init(u32 *, u16);
-s32 fm10k_tlv_attr_put_null_string(u32 *, u16, const unsigned char *);
-s32 fm10k_tlv_attr_get_null_string(u32 *, unsigned char *);
 s32 fm10k_tlv_attr_put_mac_vlan(u32 *, u16, const u8 *, u16);
 s32 fm10k_tlv_attr_get_mac_vlan(u32 *, u8 *, u16 *);
 s32 fm10k_tlv_attr_put_bool(u32 *, u16);
@@ -160,9 +158,6 @@ s32 fm10k_tlv_attr_get_value(u32 *, void *, u32);
 		fm10k_tlv_attr_get_value(attr, ptr, sizeof(s64))
 s32 fm10k_tlv_attr_put_le_struct(u32 *, u16, const void *, u32);
 s32 fm10k_tlv_attr_get_le_struct(u32 *, void *, u32);
-u32 *fm10k_tlv_attr_nest_start(u32 *, u16);
-s32 fm10k_tlv_attr_nest_stop(u32 *);
-s32 fm10k_tlv_attr_parse(u32 *, u32 **, const struct fm10k_tlv_attr *);
 s32 fm10k_tlv_msg_parse(struct fm10k_hw *, u32 *, struct fm10k_mbx_info *,
 			const struct fm10k_msg_data *);
 s32 fm10k_tlv_msg_error(struct fm10k_hw *hw, u32 **results,
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index df1d276..62fa73f 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -679,7 +679,6 @@ struct fm10k_mac_ops {
 				    struct fm10k_dglort_cfg *);
 	void (*set_dma_mask)(struct fm10k_hw *, u64);
 	s32 (*get_fault)(struct fm10k_hw *, int, struct fm10k_fault *);
-	void (*request_lport_map)(struct fm10k_hw *);
 	s32 (*adjust_systime)(struct fm10k_hw *, s32 ppb);
 	s32 (*notify_offset)(struct fm10k_hw *, u64 offset);
 	u64 (*read_systime)(struct fm10k_hw *);
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index a46b488..7822ab6 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -414,8 +414,6 @@ const struct fm10k_tlv_attr fm10k_lport_state_msg_attr[] = {
 	FM10K_TLV_ATTR_LAST
 };
 
-extern const struct fm10k_tlv_attr fm10k_1588_msg_attr[];
-
 /**
  *  fm10k_msg_lport_state_vf - Message handler for lport_state message from PF
  *  @hw: Pointer to hardware structure
-- 
1.9.3

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

* [PATCH 02/16] fm10k/base: use bitshift for itr_scale
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
  2016-01-21 10:35 ` [PATCH 01/16] fm10k/base: cleanup namespace pollution and correct typecast Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 03/16] fm10k/base: reset max_queues on init_hw_vf failure Wang Xiao W
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Upstream community wishes us to use bitshift instead of a divisor,
because this is faster, and prevents any need for a '0' check. In our
case, this even works out because default Gen3 will be 0.

Because of this, we are also able to remove the check for non-zero value
in the vf code path since that will already be the default Gen3 case.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 6 +++---
 drivers/net/fm10k/base/fm10k_vf.c   | 4 ----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 62fa73f..44187b1 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -352,9 +352,9 @@ struct fm10k_hw;
 #define FM10K_TDLEN(_n)		((0x40 * (_n)) + 0x8002)
 #define FM10K_TDLEN_ITR_SCALE_SHIFT		9
 #define FM10K_TDLEN_ITR_SCALE_MASK		0x00000E00
-#define FM10K_TDLEN_ITR_SCALE_GEN1		4
-#define FM10K_TDLEN_ITR_SCALE_GEN2		2
-#define FM10K_TDLEN_ITR_SCALE_GEN3		1
+#define FM10K_TDLEN_ITR_SCALE_GEN1		2
+#define FM10K_TDLEN_ITR_SCALE_GEN2		1
+#define FM10K_TDLEN_ITR_SCALE_GEN3		0
 #define FM10K_TPH_TXCTRL(_n)	((0x40 * (_n)) + 0x8003)
 #define FM10K_TPH_TXCTRL_DESC_TPHEN		0x00000020
 #define FM10K_TPH_TXCTRL_DESC_RROEN		0x00000200
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 7822ab6..39bc927 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -159,10 +159,6 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 			     FM10K_TDLEN_ITR_SCALE_MASK) >>
 			    FM10K_TDLEN_ITR_SCALE_SHIFT;
 
-	/* ensure a non-zero itr scale */
-	if (!hw->mac.itr_scale)
-		hw->mac.itr_scale = FM10K_TDLEN_ITR_SCALE_GEN3;
-
 	return FM10K_SUCCESS;
 }
 
-- 
1.9.3

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

* [PATCH 03/16] fm10k/base: reset max_queues on init_hw_vf failure
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
  2016-01-21 10:35 ` [PATCH 01/16] fm10k/base: cleanup namespace pollution and correct typecast Wang Xiao W
  2016-01-21 10:35 ` [PATCH 02/16] fm10k/base: use bitshift for itr_scale Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 04/16] fm10k/base: document ITR scale workaround in VF TDLEN register Wang Xiao W
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

VF drivers must detect how many queues are available. Previously, the
driver assumed that each VF has at minimum 1 queue. This assumption is
incorrect, since it is possible that the PF has not yet assigned the
queues to the VF by the time the VF checks. To resolve this, we added a
check first to ensure that the first queue is infact owned by the VF at
init_hw_vf time. However, the code flow did not reset hw->mac.max_queues
to 0. In some cases, such as during reinit flows, we call init_hw_vf
without clearing the previous value of hw->mac.max_queues. Due to this,
when init_hw_vf errors out, if its error code is not properly handled
the VF driver may still believe it has queues which no longer belong to
it. Fix this by clearing the hw->mac.max_queues on exit due to errors.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_vf.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 39bc927..9b10ee4 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -128,8 +128,10 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 
 	/* verify we have at least 1 queue */
 	if (!~FM10K_READ_REG(hw, FM10K_TXQCTL(0)) ||
-	    !~FM10K_READ_REG(hw, FM10K_RXQCTL(0)))
-		return FM10K_ERR_NO_RESOURCES;
+	    !~FM10K_READ_REG(hw, FM10K_RXQCTL(0))) {
+		err = FM10K_ERR_NO_RESOURCES;
+		goto reset_max_queues;
+	}
 
 	/* determine how many queues we have */
 	for (i = 1; tqdloc0 && (i < FM10K_MAX_QUEUES_POOL); i++) {
@@ -147,7 +149,7 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 	/* shut down queues we own and reset DMA configuration */
 	err = fm10k_disable_queues_generic(hw, i);
 	if (err)
-		return err;
+		goto reset_max_queues;
 
 	/* record maximum queue count */
 	hw->mac.max_queues = i;
@@ -160,6 +162,11 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 			    FM10K_TDLEN_ITR_SCALE_SHIFT;
 
 	return FM10K_SUCCESS;
+
+reset_max_queues:
+	hw->mac.max_queues = 0;
+
+	return err;
 }
 
 /**
-- 
1.9.3

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

* [PATCH 04/16] fm10k/base: document ITR scale workaround in VF TDLEN register
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (2 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 03/16] fm10k/base: reset max_queues on init_hw_vf failure Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 05/16] fm10k/base: fix checkpatch warning Wang Xiao W
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Add comments which properly explain the undocumented use of bits in
TDLEN register prior to VF initializing it to the correct value. Note
that the mechanism is entirely software-defined and explain its purpose
to help reduce confusion in the future.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 6 +++++-
 drivers/net/fm10k/base/fm10k_type.h | 9 +++++++++
 drivers/net/fm10k/base/fm10k_vf.c   | 9 +++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 5b8c039..6de679e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -958,7 +958,8 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	FM10K_WRITE_REG(hw, FM10K_TDBAH(vf_q_idx), tdbah);
 
 	/* Provide the VF the ITR scale, using software-defined fields in TDLEN
-	 * to pass the information during VF initialization
+	 * to pass the information during VF initialization. See definition of
+	 * FM10K_TDLEN_ITR_SCALE_SHIFT for more details.
 	 */
 	FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx), hw->mac.itr_scale <<
 						   FM10K_TDLEN_ITR_SCALE_SHIFT);
@@ -1095,6 +1096,9 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 	for (i = queues_per_pool; i--;) {
 		FM10K_WRITE_REG(hw, FM10K_TDBAL(vf_q_idx + i), tdbal);
 		FM10K_WRITE_REG(hw, FM10K_TDBAH(vf_q_idx + i), tdbah);
+		/* See definition of FM10K_TDLEN_ITR_SCALE_SHIFT for an
+		 * explanation of how TDLEN is used.
+		 */
 		FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx + i),
 				hw->mac.itr_scale <<
 				FM10K_TDLEN_ITR_SCALE_SHIFT);
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 44187b1..5db6345 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -350,6 +350,15 @@ struct fm10k_hw;
 #define FM10K_TDBAL(_n)		((0x40 * (_n)) + 0x8000)
 #define FM10K_TDBAH(_n)		((0x40 * (_n)) + 0x8001)
 #define FM10K_TDLEN(_n)		((0x40 * (_n)) + 0x8002)
+/* When fist initialized, VFs need to know the Interrupt Throttle Rate (ITR)
+ * scale which is based on the PCIe speed but the speed information in the PCI
+ * configuration space may not be accurate. The PF already knows the ITR scale
+ * but there is no defined method to pass that information from the PF to the
+ * VF. This is accomplished during VF initialization by temporarily co-opting
+ * the yet-to-be-used TDLEN register to have the PF store the ITR shift for
+ * the VF to retrieve before the VF needs to use the TDLEN register for its
+ * intended purpose, i.e. before the Tx resources are allocated.
+ */
 #define FM10K_TDLEN_ITR_SCALE_SHIFT		9
 #define FM10K_TDLEN_ITR_SCALE_MASK		0x00000E00
 #define FM10K_TDLEN_ITR_SCALE_GEN1		2
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 9b10ee4..43eb081 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -74,6 +74,11 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 		FM10K_WRITE_REG(hw, FM10K_TDBAH(i), bah);
 		FM10K_WRITE_REG(hw, FM10K_RDBAL(i), bal);
 		FM10K_WRITE_REG(hw, FM10K_RDBAH(i), bah);
+		/* Restore ITR scale in software-defined mechanism in TDLEN
+		 * for next VF initialization. See definition of
+		 * FM10K_TDLEN_ITR_SCALE_SHIFT for more details on the use of
+		 * TDLEN here.
+		 */
 		FM10K_WRITE_REG(hw, FM10K_TDLEN(i), tdlen);
 	}
 
@@ -157,6 +162,10 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 	/* fetch default VLAN and ITR scale */
 	hw->mac.default_vid = (FM10K_READ_REG(hw, FM10K_TXQCTL(0)) &
 			       FM10K_TXQCTL_VID_MASK) >> FM10K_TXQCTL_VID_SHIFT;
+	/* Read the ITR scale from TDLEN. See the definition of
+	 * FM10K_TDLEN_ITR_SCALE_SHIFT for more information about how TDLEN is
+	 * used here.
+	 */
 	hw->mac.itr_scale = (FM10K_READ_REG(hw, FM10K_TDLEN(0)) &
 			     FM10K_TDLEN_ITR_SCALE_MASK) >>
 			    FM10K_TDLEN_ITR_SCALE_SHIFT;
-- 
1.9.3

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

* [PATCH 05/16] fm10k/base: fix checkpatch warning
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (3 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 04/16] fm10k/base: document ITR scale workaround in VF TDLEN register Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 06/16] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1 Wang Xiao W
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Cleanup lines over 80 characters.
Cleanup useless else, checkpatch warns that else is not generally
useful after a break or return.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.c |  2 +-
 drivers/net/fm10k/base/fm10k_pf.c  | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 3c9ab3a..7d03704 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -930,7 +930,7 @@ STATIC void fm10k_mbx_create_disconnect_hdr(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_create_fake_disconnect_hdr - Generate a false disconnect mailbox header
+ *  fm10k_mbx_create_fake_disconnect_hdr - Generate a false disconnect mbox hdr
  *  @mbx: pointer to mailbox
  *
  *  This function creates a fake disconnect header for loading into remote
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 6de679e..3ee88b6 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1278,8 +1278,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		err = fm10k_iov_select_vid(vf_info, (u16)vid);
 		if (err < 0)
 			return err;
-		else
-			vid = 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);
@@ -1304,8 +1304,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		err = fm10k_iov_select_vid(vf_info, vlan);
 		if (err < 0)
 			return err;
-		else
-			vlan = (u16)err;
+
+		vlan = (u16)err;
 
 		/* notify switch of request for new unicast address */
 		err = hw->mac.ops.update_uc_addr(hw, vf_info->glort,
@@ -1330,8 +1330,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		err = fm10k_iov_select_vid(vf_info, vlan);
 		if (err < 0)
 			return err;
-		else
-			vlan = (u16)err;
+
+		vlan = (u16)err;
 
 		/* notify switch of request for new multicast address */
 		err = hw->mac.ops.update_mc_addr(hw, vf_info->glort,
@@ -1500,9 +1500,10 @@ STATIC void fm10k_update_hw_stats_pf(struct fm10k_hw *hw,
 		xec = fm10k_read_hw_stats_32b(hw, FM10K_STATS_XEC, &stats->xec);
 		vlan_drop = fm10k_read_hw_stats_32b(hw, FM10K_STATS_VLAN_DROP,
 						    &stats->vlan_drop);
-		loopback_drop = fm10k_read_hw_stats_32b(hw,
-							FM10K_STATS_LOOPBACK_DROP,
-							&stats->loopback_drop);
+		loopback_drop =
+			fm10k_read_hw_stats_32b(hw,
+						FM10K_STATS_LOOPBACK_DROP,
+						&stats->loopback_drop);
 		nodesc_drop = fm10k_read_hw_stats_32b(hw,
 						      FM10K_STATS_NODESC_DROP,
 						      &stats->nodesc_drop);
-- 
1.9.3

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

* [PATCH 06/16] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (4 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 05/16] fm10k/base: fix checkpatch warning Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 07/16] fm10k/base: do not use CamelCase Wang Xiao W
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The upstream Linux kernel community prefers using the BIT macro over
bit-shifting a 1.  Similar to how this is handled in the i40e shared code,
define a macro for OSes that do not already have it and wrap all that in
LINUX_MACROS so that it can be stripped from the Linux driver.

The upstream Linux kernel community prefers avoiding CamelCase in
variables, function names, etc.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 12 ++++++------
 drivers/net/fm10k/base/fm10k_tlv.c  | 24 ++++++++++++------------
 drivers/net/fm10k/base/fm10k_type.h | 18 ++++++++++++------
 3 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 3ee88b6..7d48210 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -576,8 +576,8 @@ STATIC s32 fm10k_configure_dglort_map_pf(struct fm10k_hw *hw,
 		return FM10K_ERR_PARAM;
 
 	/* determine count of VSIs and queues */
-	queue_count = 1 << (dglort->rss_l + dglort->pc_l);
-	vsi_count = 1 << (dglort->vsi_l + dglort->queue_l);
+	queue_count = BIT(dglort->rss_l + dglort->pc_l);
+	vsi_count = BIT(dglort->vsi_l + dglort->queue_l);
 	glort = dglort->glort;
 	q_idx = dglort->queue_b;
 
@@ -593,8 +593,8 @@ STATIC s32 fm10k_configure_dglort_map_pf(struct fm10k_hw *hw,
 	}
 
 	/* determine count of PCs and queues */
-	queue_count = 1 << (dglort->queue_l + dglort->rss_l + dglort->vsi_l);
-	pc_count = 1 << dglort->pc_l;
+	queue_count = BIT(dglort->queue_l + dglort->rss_l + dglort->vsi_l);
+	pc_count = BIT(dglort->pc_l);
 
 	/* configure PC for Tx queues */
 	for (pc = 0; pc < pc_count; pc++) {
@@ -1001,7 +1001,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 		return FM10K_ERR_PARAM;
 
 	/* clear event notification of VF FLR */
-	FM10K_WRITE_REG(hw, FM10K_PFVFLREC(vf_idx / 32), 1 << (vf_idx % 32));
+	FM10K_WRITE_REG(hw, FM10K_PFVFLREC(vf_idx / 32), BIT(vf_idx % 32));
 
 	/* force timeout and then disconnect the mailbox */
 	vf_info->mbx.timeout = 0;
@@ -1417,7 +1417,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 		mode = fm10k_iov_supported_xcast_mode_pf(vf_info, mode);
 
 		/* if mode is not currently enabled, enable it */
-		if (!(FM10K_VF_FLAG_ENABLED(vf_info) & (1 << mode)))
+		if (!(FM10K_VF_FLAG_ENABLED(vf_info) & BIT(mode)))
 			fm10k_update_xcast_mode_pf(hw, vf_info->glort, mode);
 
 		/* swap mode back to a bit flag */
diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c
index ade87d1..e6150c1 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.c
+++ b/drivers/net/fm10k/base/fm10k_tlv.c
@@ -249,7 +249,7 @@ s32 fm10k_tlv_attr_put_value(u32 *msg, u16 attr_id, s64 value, u32 len)
 	attr = &msg[FM10K_TLV_DWORD_LEN(*msg)];
 
 	if (len < 4) {
-		attr[1] = (u32)value & ((0x1ul << (8 * len)) - 1);
+		attr[1] = (u32)value & (BIT(8 * len) - 1);
 	} else {
 		attr[1] = (u32)value;
 		if (len > 4)
@@ -699,29 +699,29 @@ STATIC void fm10k_tlv_msg_test_generate_data(u32 *msg, u32 attr_flags)
 {
 	DEBUGFUNC("fm10k_tlv_msg_test_generate_data");
 
-	if (attr_flags & (1 << FM10K_TEST_MSG_STRING))
+	if (attr_flags & BIT(FM10K_TEST_MSG_STRING))
 		fm10k_tlv_attr_put_null_string(msg, FM10K_TEST_MSG_STRING,
 					       test_str);
-	if (attr_flags & (1 << FM10K_TEST_MSG_MAC_ADDR))
+	if (attr_flags & BIT(FM10K_TEST_MSG_MAC_ADDR))
 		fm10k_tlv_attr_put_mac_vlan(msg, FM10K_TEST_MSG_MAC_ADDR,
 					    test_mac, test_vlan);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U8))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U8))
 		fm10k_tlv_attr_put_u8(msg, FM10K_TEST_MSG_U8,  test_u8);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U16))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U16))
 		fm10k_tlv_attr_put_u16(msg, FM10K_TEST_MSG_U16, test_u16);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U32))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U32))
 		fm10k_tlv_attr_put_u32(msg, FM10K_TEST_MSG_U32, test_u32);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U64))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U64))
 		fm10k_tlv_attr_put_u64(msg, FM10K_TEST_MSG_U64, test_u64);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S8))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S8))
 		fm10k_tlv_attr_put_s8(msg, FM10K_TEST_MSG_S8,  test_s8);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S16))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S16))
 		fm10k_tlv_attr_put_s16(msg, FM10K_TEST_MSG_S16, test_s16);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S32))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S32))
 		fm10k_tlv_attr_put_s32(msg, FM10K_TEST_MSG_S32, test_s32);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S64))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S64))
 		fm10k_tlv_attr_put_s64(msg, FM10K_TEST_MSG_S64, test_s64);
-	if (attr_flags & (1 << FM10K_TEST_MSG_LE_STRUCT))
+	if (attr_flags & BIT(FM10K_TEST_MSG_LE_STRUCT))
 		fm10k_tlv_attr_put_le_struct(msg, FM10K_TEST_MSG_LE_STRUCT,
 					     test_le, 8);
 }
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 5db6345..387d25b 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -50,6 +50,12 @@ struct fm10k_hw;
 #define FM10K_DEV_ID_SDI_FM10420_DA2	0x15D5
 #endif /* ATWOOD_CHANNEL_HW */
 
+#ifndef LINUX_MACROS
+#ifndef BIT
+#define BIT(a) (1UL << (a))
+#endif
+#endif /* LINUX_MACROS */
+
 #define FM10K_MAX_QUEUES		256
 #define FM10K_MAX_QUEUES_PF		128
 #define FM10K_MAX_QUEUES_POOL		16
@@ -465,7 +471,7 @@ struct fm10k_hw;
 #define FM10K_VLAN_TABLE_VID_MAX		4096
 #define FM10K_VLAN_TABLE_VSI_MAX		64
 #define FM10K_VLAN_LENGTH_SHIFT			16
-#define FM10K_VLAN_CLEAR			(1 << 15)
+#define FM10K_VLAN_CLEAR			BIT(15)
 #define FM10K_VLAN_ALL \
 	((FM10K_VLAN_TABLE_VID_MAX - 1) << FM10K_VLAN_LENGTH_SHIFT)
 
@@ -762,10 +768,10 @@ struct fm10k_vf_info {
 						 */
 };
 
-#define FM10K_VF_FLAG_ALLMULTI_CAPABLE	((u8)1 << FM10K_XCAST_MODE_ALLMULTI)
-#define FM10K_VF_FLAG_MULTI_CAPABLE	((u8)1 << FM10K_XCAST_MODE_MULTI)
-#define FM10K_VF_FLAG_PROMISC_CAPABLE	((u8)1 << FM10K_XCAST_MODE_PROMISC)
-#define FM10K_VF_FLAG_NONE_CAPABLE	((u8)1 << FM10K_XCAST_MODE_NONE)
+#define FM10K_VF_FLAG_ALLMULTI_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_ALLMULTI))
+#define FM10K_VF_FLAG_MULTI_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_MULTI))
+#define FM10K_VF_FLAG_PROMISC_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_PROMISC))
+#define FM10K_VF_FLAG_NONE_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_NONE))
 #define FM10K_VF_FLAG_CAPABLE(vf_info)	((vf_info)->vf_flags & (u8)0xF)
 #define FM10K_VF_FLAG_ENABLED(vf_info)	((vf_info)->vf_flags >> 4)
 #define FM10K_VF_FLAG_SET_MODE(mode)	((u8)0x10 << (mode))
@@ -816,7 +822,7 @@ struct fm10k_hw {
 	u16 subsystem_vendor_id;
 	u8 revision_id;
 	u32 flags;
-#define FM10K_HW_FLAG_CLOCK_OWNER	(u32)(1 << 0)
+#define FM10K_HW_FLAG_CLOCK_OWNER	BIT(0)
 };
 
 /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
-- 
1.9.3

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

* [PATCH 07/16] fm10k/base: do not use CamelCase
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (5 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 06/16] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1 Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 08/16] fm10k/base: use memcpy for mac addr copy Wang Xiao W
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The upstream Linux kernel community prefers avoiding CamelCase in
variables, function names, etc.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 14 +++++++-------
 drivers/net/fm10k/fm10k_ethdev.c    | 24 ++++++++++++------------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 387d25b..c9885a1 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -531,13 +531,13 @@ struct fm10k_hw;
 #endif
 
 enum fm10k_int_source {
-	fm10k_int_Mailbox	= 0,
-	fm10k_int_PCIeFault	= 1,
-	fm10k_int_SwitchUpDown	= 2,
-	fm10k_int_SwitchEvent	= 3,
-	fm10k_int_SRAM		= 4,
-	fm10k_int_VFLR		= 5,
-	fm10k_int_MaxHoldTime	= 6,
+	fm10k_int_mailbox		= 0,
+	fm10k_int_pcie_fault		= 1,
+	fm10k_int_switch_up_down	= 2,
+	fm10k_int_switch_event		= 3,
+	fm10k_int_sram			= 4,
+	fm10k_int_vflr			= 5,
+	fm10k_int_max_hold_time		= 6,
 	fm10k_int_sources_max_pf
 };
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index e4aed94..e967628 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2074,12 +2074,12 @@ fm10k_dev_enable_intr_pf(struct rte_eth_dev *dev)
 	/* Bind all local non-queue interrupt to vector 0 */
 	int_map |= 0;
 
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_Mailbox), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_PCIeFault), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchUpDown), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchEvent), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SRAM), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_VFLR), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_mailbox), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_pcie_fault), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_up_down), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_event), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_sram), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_vflr), int_map);
 
 	/* Enable misc causes */
 	FM10K_WRITE_REG(hw, FM10K_EIMR, FM10K_EIMR_ENABLE(PCA_FAULT) |
@@ -2105,12 +2105,12 @@ fm10k_dev_disable_intr_pf(struct rte_eth_dev *dev)
 
 	int_map |= 0;
 
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_Mailbox), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_PCIeFault), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchUpDown), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchEvent), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SRAM), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_VFLR), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_mailbox), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_pcie_fault), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_up_down), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_event), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_sram), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_vflr), int_map);
 
 	/* Disable misc causes */
 	FM10K_WRITE_REG(hw, FM10K_EIMR, FM10K_EIMR_DISABLE(PCA_FAULT) |
-- 
1.9.3

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

* [PATCH 08/16] fm10k/base: use memcpy for mac addr copy
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (6 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 07/16] fm10k/base: do not use CamelCase Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 09/16] fm10k/base: allow removal of is_slot_appropriate function Wang Xiao W
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Use memcpy instead of copying MAC address byte-by-byte.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 7d48210..a1469aa 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -300,7 +300,6 @@ STATIC s32 fm10k_read_mac_addr_pf(struct fm10k_hw *hw)
 {
 	u8 perm_addr[ETH_ALEN];
 	u32 serial_num;
-	int i;
 
 	DEBUGFUNC("fm10k_read_mac_addr_pf");
 
@@ -324,10 +323,8 @@ STATIC s32 fm10k_read_mac_addr_pf(struct fm10k_hw *hw)
 	perm_addr[4] = (u8)(serial_num >> 8);
 	perm_addr[5] = (u8)(serial_num);
 
-	for (i = 0; i < ETH_ALEN; i++) {
-		hw->mac.perm_addr[i] = perm_addr[i];
-		hw->mac.addr[i] = perm_addr[i];
-	}
+	memcpy(hw->mac.perm_addr, perm_addr, ETH_ALEN);
+	memcpy(hw->mac.addr, perm_addr, ETH_ALEN);
 
 	return FM10K_SUCCESS;
 }
-- 
1.9.3

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

* [PATCH 09/16] fm10k/base: allow removal of is_slot_appropriate function
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (7 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 08/16] fm10k/base: use memcpy for mac addr copy Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 10/16] fm10k/base: consistently use VLAN ID when referencing vid variables Wang Xiao W
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The Linux Kernel provides the OS a call "pcie_get_minimum_link" which
can crawl the PCIe tree and determine the actual minimum link speed of a
device which is a more general check than provided by
is_slot_appropriate. Thus, the upstream driver does not use or want the
is_slot_appropriate function call. Add a NO_IS_SLOT_APPROPRIATE_CHECK
definition which can be defined during strip process to remove the code.
If left undefined (the default) then the code will all be active and no
driver changes should be necessary.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_api.c  | 2 ++
 drivers/net/fm10k/base/fm10k_api.h  | 2 ++
 drivers/net/fm10k/base/fm10k_pf.c   | 4 ++++
 drivers/net/fm10k/base/fm10k_type.h | 2 ++
 drivers/net/fm10k/base/fm10k_vf.c   | 4 ++++
 5 files changed, 14 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_api.c b/drivers/net/fm10k/base/fm10k_api.c
index eb5bdaa..c49d20d 100644
--- a/drivers/net/fm10k/base/fm10k_api.c
+++ b/drivers/net/fm10k/base/fm10k_api.c
@@ -181,6 +181,7 @@ s32 fm10k_get_bus_info(struct fm10k_hw *hw)
 			       FM10K_NOT_IMPLEMENTED);
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -195,6 +196,7 @@ bool fm10k_is_slot_appropriate(struct fm10k_hw *hw)
 	return true;
 }
 
+#endif
 /**
  *  fm10k_update_vlan - Clear VLAN ID to VLAN filter table
  *  @hw: pointer to hardware structure
diff --git a/drivers/net/fm10k/base/fm10k_api.h b/drivers/net/fm10k/base/fm10k_api.h
index 113aef5..2ab3149 100644
--- a/drivers/net/fm10k/base/fm10k_api.h
+++ b/drivers/net/fm10k/base/fm10k_api.h
@@ -44,7 +44,9 @@ s32 fm10k_stop_hw(struct fm10k_hw *hw);
 s32 fm10k_start_hw(struct fm10k_hw *hw);
 s32 fm10k_init_shared_code(struct fm10k_hw *hw);
 s32 fm10k_get_bus_info(struct fm10k_hw *hw);
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 bool fm10k_is_slot_appropriate(struct fm10k_hw *hw);
+#endif
 s32 fm10k_update_vlan(struct fm10k_hw *hw, u32 vid, u8 idx, bool set);
 s32 fm10k_read_mac_addr(struct fm10k_hw *hw);
 void fm10k_update_hw_stats(struct fm10k_hw *hw, struct fm10k_hw_stats *stats);
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index a1469aa..f5cbda4 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -216,6 +216,7 @@ STATIC s32 fm10k_init_hw_pf(struct fm10k_hw *hw)
 	return FM10K_SUCCESS;
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate_pf - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -231,6 +232,7 @@ STATIC bool fm10k_is_slot_appropriate_pf(struct fm10k_hw *hw)
 	       (hw->bus.width == hw->bus_caps.width);
 }
 
+#endif
 /**
  *  fm10k_update_vlan_pf - Update status of VLAN ID in VLAN filter table
  *  @hw: pointer to hardware structure
@@ -2064,7 +2066,9 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
 	mac->ops.init_hw = &fm10k_init_hw_pf;
 	mac->ops.start_hw = &fm10k_start_hw_generic;
 	mac->ops.stop_hw = &fm10k_stop_hw_generic;
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	mac->ops.is_slot_appropriate = &fm10k_is_slot_appropriate_pf;
+#endif
 	mac->ops.update_vlan = &fm10k_update_vlan_pf;
 	mac->ops.read_mac_addr = &fm10k_read_mac_addr_pf;
 	mac->ops.update_uc_addr = &fm10k_update_uc_addr_pf;
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index c9885a1..ba0a184 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -679,7 +679,9 @@ 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 *);
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	bool (*is_slot_appropriate)(struct fm10k_hw *);
+#endif
 	s32 (*update_vlan)(struct fm10k_hw *, u32, u8, bool);
 	s32 (*read_mac_addr)(struct fm10k_hw *);
 	s32 (*update_uc_addr)(struct fm10k_hw *, u16, const u8 *,
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 43eb081..efbdbd1 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -178,6 +178,7 @@ reset_max_queues:
 	return err;
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate_vf - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -194,6 +195,7 @@ STATIC bool fm10k_is_slot_appropriate_vf(struct fm10k_hw *hw)
 	return TRUE;
 }
 
+#endif
 /* This structure defines the attibutes to be parsed below */
 const struct fm10k_tlv_attr fm10k_mac_vlan_msg_attr[] = {
 	FM10K_TLV_ATTR_U32(FM10K_MAC_VLAN_MSG_VLAN),
@@ -648,7 +650,9 @@ s32 fm10k_init_ops_vf(struct fm10k_hw *hw)
 	mac->ops.init_hw = &fm10k_init_hw_vf;
 	mac->ops.start_hw = &fm10k_start_hw_generic;
 	mac->ops.stop_hw = &fm10k_stop_hw_vf;
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	mac->ops.is_slot_appropriate = &fm10k_is_slot_appropriate_vf;
+#endif
 	mac->ops.update_vlan = &fm10k_update_vlan_vf;
 	mac->ops.read_mac_addr = &fm10k_read_mac_addr_vf;
 	mac->ops.update_uc_addr = &fm10k_update_uc_addr_vf;
-- 
1.9.3

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

* [PATCH 10/16] fm10k/base: consistently use VLAN ID when referencing vid variables
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (8 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 09/16] fm10k/base: allow removal of is_slot_appropriate function Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 11/16] fm10k/base: fix comment per upstream review changes Wang Xiao W
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The vid variable name is shorthand for VLAN ID, so we should use this in
comments explaining what is happening.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index f5cbda4..716d7f1 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -970,7 +970,7 @@ err_out:
 	txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
 		  FM10K_TXQCTL_VF | vf_idx;
 
-	/* assign VID */
+	/* assign VLAN ID */
 	for (i = 0; i < queues_per_pool; i++)
 		FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
 
@@ -1215,12 +1215,12 @@ s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *hw, u32 **results,
 }
 
 /**
- * fm10k_iov_select_vid - Select correct default vid
+ * fm10k_iov_select_vid - Select correct default VLAN ID
  * @hw: Pointer to hardware structure
- * @vid: vid to correct
+ * @vid: VLAN ID to correct
  *
- * Will report an error if vid is out of range. For vid = 0, it will return
- * either the pf_vid or sw_vid depending on which one is set.
+ * Will report an error if the VLAN ID is out of range. For VID = 0, it will
+ * return either the pf_vid or sw_vid depending on which one is set.
  */
 STATIC s32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid)
 {
@@ -1783,7 +1783,7 @@ static s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
 	if (!fm10k_glort_valid_pf(hw, glort))
 		return FM10K_ERR_PARAM;
 
-	/* verify VID is valid */
+	/* verify VLAN ID is valid */
 	if (pvid >= FM10K_VLAN_TABLE_VID_MAX)
 		return FM10K_ERR_PARAM;
 
-- 
1.9.3

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

* [PATCH 11/16] fm10k/base: fix comment per upstream review changes
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (9 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 10/16] fm10k/base: consistently use VLAN ID when referencing vid variables Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 12/16] fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned Wang Xiao W
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The comment here was changed during review of upstream patch, and the
new wording is slightly more clear. Re-write the comment in SHARED code
based on this new wording.

Fix a number of mailbox comment issues with function header comments,
lower-case acronyms (i.e. FIFO, TLV), incorrect function names in DEBUGFUNC(),
duplicate comments and a stubbed-out header comment for fm10k_sm_mbx_init.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.c | 61 ++++++++++++++++++++++----------------
 drivers/net/fm10k/base/fm10k_mbx.h |  4 +--
 drivers/net/fm10k/base/fm10k_pf.c  | 12 ++++----
 drivers/net/fm10k/base/fm10k_tlv.h |  4 +--
 4 files changed, 46 insertions(+), 35 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 7d03704..2e70434 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -70,7 +70,7 @@ STATIC u16 fm10k_fifo_unused(struct fm10k_mbx_fifo *fifo)
 }
 
 /**
- *  fm10k_fifo_empty - Test to verify if fifo is empty
+ *  fm10k_fifo_empty - Test to verify if FIFO is empty
  *  @fifo: pointer to FIFO
  *
  *  This function returns true if the FIFO is empty, else false
@@ -85,7 +85,7 @@ STATIC bool fm10k_fifo_empty(struct fm10k_mbx_fifo *fifo)
  *  @fifo: pointer to FIFO
  *  @offset: offset to add to head
  *
- *  This function returns the indices into the fifo based on head + offset
+ *  This function returns the indices into the FIFO based on head + offset
  **/
 STATIC u16 fm10k_fifo_head_offset(struct fm10k_mbx_fifo *fifo, u16 offset)
 {
@@ -97,7 +97,7 @@ STATIC u16 fm10k_fifo_head_offset(struct fm10k_mbx_fifo *fifo, u16 offset)
  *  @fifo: pointer to FIFO
  *  @offset: offset to add to tail
  *
- *  This function returns the indices into the fifo based on tail + offset
+ *  This function returns the indices into the FIFO based on tail + offset
  **/
 STATIC u16 fm10k_fifo_tail_offset(struct fm10k_mbx_fifo *fifo, u16 offset)
 {
@@ -173,7 +173,7 @@ STATIC u16 fm10k_mbx_index_len(struct fm10k_mbx_info *mbx, u16 head, u16 tail)
 /**
  *  fm10k_mbx_tail_add - Determine new tail value with added offset
  *  @mbx: pointer to mailbox
- *  @offset: length to add to head offset
+ *  @offset: length to add to tail offset
  *
  *  This function takes the local tail index and recomputes it for
  *  a given length added as an offset.
@@ -189,7 +189,7 @@ STATIC u16 fm10k_mbx_tail_add(struct fm10k_mbx_info *mbx, u16 offset)
 /**
  *  fm10k_mbx_tail_sub - Determine new tail value with subtracted offset
  *  @mbx: pointer to mailbox
- *  @offset: length to add to head offset
+ *  @offset: length to add to tail offset
  *
  *  This function takes the local tail index and recomputes it for
  *  a given length added as an offset.
@@ -253,7 +253,7 @@ STATIC u16 fm10k_mbx_pushed_tail_len(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_fifo_write_copy - pulls data off of msg and places it in fifo
+ *  fm10k_fifo_write_copy - pulls data off of msg and places it in FIFO
  *  @fifo: pointer to FIFO
  *  @msg: message array to populate
  *  @tail_offset: additional offset to add to tail pointer
@@ -331,7 +331,7 @@ STATIC u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
 	u16 total_len = 0, msg_len;
 	u32 *msg;
 
-	DEBUGFUNC("fm10k_mbx_validate_msg");
+	DEBUGFUNC("fm10k_mbx_validate_msg_size");
 
 	/* length should include previous amounts pushed */
 	len += mbx->pushed;
@@ -353,6 +353,7 @@ STATIC u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
 
 /**
  *  fm10k_mbx_write_copy - pulls data off of Tx FIFO and places it in mbmem
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will take a section of the Tx FIFO and copy it into the
@@ -734,7 +735,7 @@ STATIC bool fm10k_mbx_tx_complete(struct fm10k_mbx_info *mbx)
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
- *  This function dequeues messages and hands them off to the tlv parser.
+ *  This function dequeues messages and hands them off to the TLV parser.
  *  It will return the number of messages processed when called.
  **/
 STATIC u16 fm10k_mbx_dequeue_rx(struct fm10k_hw *hw,
@@ -951,7 +952,7 @@ STATIC void fm10k_mbx_create_fake_disconnect_hdr(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_create_error_msg - Generate a error message
+ *  fm10k_mbx_create_error_msg - Generate an error message
  *  @mbx: pointer to mailbox
  *  @err: local error encountered
  *
@@ -984,7 +985,6 @@ STATIC void fm10k_mbx_create_error_msg(struct fm10k_mbx_info *mbx, s32 err)
 /**
  *  fm10k_mbx_validate_msg_hdr - Validate common fields in the message header
  *  @mbx: pointer to mailbox
- *  @msg: message array to read
  *
  *  This function will parse up the fields in the mailbox header and return
  *  an error if the header contains any of a number of invalid configurations
@@ -1050,11 +1050,12 @@ STATIC s32 fm10k_mbx_validate_msg_hdr(struct fm10k_mbx_info *mbx)
 
 /**
  *  fm10k_mbx_create_reply - Generate reply based on state and remote head
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *  @head: acknowledgement number
  *
  *  This function will generate an outgoing message based on the current
- *  mailbox state and the remote fifo head.  It will return the length
+ *  mailbox state and the remote FIFO head.  It will return the length
  *  of the outgoing message excluding header on success, and a negative value
  *  on error.
  **/
@@ -1130,7 +1131,7 @@ STATIC void fm10k_mbx_reset_work(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_update_max_size - Update the max_size and drop large messages
+ *  fm10k_mbx_update_max_size - Update the max_size and drop any large messages
  *  @mbx: pointer to mailbox
  *  @size: new value for max_size
  *
@@ -1144,7 +1145,7 @@ STATIC void fm10k_mbx_update_max_size(struct fm10k_mbx_info *mbx, u16 size)
 {
 	u16 len;
 
-	DEBUGFUNC("fm10k_mbx_update_max_size_hdr");
+	DEBUGFUNC("fm10k_mbx_update_max_size");
 
 	mbx->max_size = size;
 
@@ -1182,8 +1183,8 @@ STATIC void fm10k_mbx_connect_reset(struct fm10k_mbx_info *mbx)
 
 /**
  *  fm10k_mbx_process_connect - Process connect header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
- *  @msg: message array to process
  *
  *  This function will read an incoming connect header and reply with the
  *  appropriate message.  It will return a value indicating the number of
@@ -1229,6 +1230,7 @@ STATIC s32 fm10k_mbx_process_connect(struct fm10k_hw *hw,
 
 /**
  *  fm10k_mbx_process_data - Process data header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will read an incoming data header and reply with the
@@ -1272,6 +1274,7 @@ STATIC s32 fm10k_mbx_process_data(struct fm10k_hw *hw,
 
 /**
  *  fm10k_mbx_process_disconnect - Process disconnect header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will read an incoming disconnect header and reply with the
@@ -1324,6 +1327,7 @@ STATIC s32 fm10k_mbx_process_disconnect(struct fm10k_hw *hw,
 
 /**
  *  fm10k_mbx_process_error - Process error header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will read an incoming error header and reply with the
@@ -1501,6 +1505,7 @@ STATIC s32 fm10k_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 
 	fm10k_mbx_reset_work(mbx);
 
+	/* initialize header of remote mailbox */
 	fm10k_mbx_create_fake_disconnect_hdr(mbx);
 	FM10K_WRITE_MBX(hw, mbx->mbmem_reg ^ mbx->mbmem_len, mbx->mbx_hdr);
 
@@ -1602,7 +1607,7 @@ STATIC s32 fm10k_mbx_register_handlers(struct fm10k_mbx_info *mbx,
  *  @id: ID reference for PF as it supports up to 64 PF/VF mailboxes
  *
  *  This function initializes the mailbox for use.  It will split the
- *  buffer provided an use that th populate both the Tx and Rx FIFO by
+ *  buffer provided and use that to populate both the Tx and Rx FIFO by
  *  evenly splitting it.  In order to allow for easy masking of head/tail
  *  the value reported in size must be a power of 2 and is reported in
  *  DWORDs, not bytes.  Any invalid values will cause the mailbox to return
@@ -1681,7 +1686,7 @@ s32 fm10k_pfvf_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
  *  fm10k_sm_mbx_create_data_hdr - Generate a mailbox header for local FIFO
  *  @mbx: pointer to mailbox
  *
- *  This function returns a connection mailbox header
+ *  This function returns a data mailbox header
  **/
 STATIC void fm10k_sm_mbx_create_data_hdr(struct fm10k_mbx_info *mbx)
 {
@@ -1748,7 +1753,7 @@ STATIC void fm10k_sm_mbx_connect_reset(struct fm10k_mbx_info *mbx)
  **/
 STATIC s32 fm10k_sm_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 {
-	DEBUGFUNC("fm10k_mbx_connect");
+	DEBUGFUNC("fm10k_sm_mbx_connect");
 
 	/* we cannot connect an uninitialized mailbox */
 	if (!mbx->rx.buffer)
@@ -1776,8 +1781,6 @@ STATIC s32 fm10k_sm_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 	fm10k_sm_mbx_create_connect_hdr(mbx, 0);
 	fm10k_mbx_write(hw, mbx);
 
-	/* enable interrupt and notify other party of new message */
-
 	return FM10K_SUCCESS;
 }
 
@@ -1823,7 +1826,7 @@ STATIC void fm10k_sm_mbx_disconnect(struct fm10k_hw *hw,
 }
 
 /**
- *  fm10k_mbx_validate_fifo_hdr - Validate fields in the remote FIFO header
+ *  fm10k_sm_mbx_validate_fifo_hdr - Validate fields in the remote FIFO header
  *  @mbx: pointer to mailbox
  *
  *  This function will parse up the fields in the mailbox header and return
@@ -1835,7 +1838,7 @@ STATIC s32 fm10k_sm_mbx_validate_fifo_hdr(struct fm10k_mbx_info *mbx)
 	const u32 *hdr = &mbx->mbx_hdr;
 	u16 tail, head, ver;
 
-	DEBUGFUNC("fm10k_mbx_validate_msg_hdr");
+	DEBUGFUNC("fm10k_sm_mbx_validate_fifo_hdr");
 
 	tail = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_TAIL);
 	ver = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_VER);
@@ -1903,7 +1906,7 @@ STATIC void fm10k_sm_mbx_process_error(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_sm_mbx_create_error_message - Process an error in FIFO hdr
+ *  fm10k_sm_mbx_create_error_msg - Process an error in FIFO header
  *  @mbx: pointer to mailbox
  *  @err: local error encountered
  *
@@ -1933,6 +1936,7 @@ STATIC void fm10k_sm_mbx_create_error_msg(struct fm10k_mbx_info *mbx, s32 err)
  *  fm10k_sm_mbx_receive - Take message from Rx mailbox FIFO and put it in Rx
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
+ *  @tail: tail index of message
  *
  *  This function will dequeue one message from the Rx switch manager mailbox
  *  FIFO and place it in the Rx mailbox FIFO for processing by software.
@@ -1974,6 +1978,7 @@ STATIC s32 fm10k_sm_mbx_receive(struct fm10k_hw *hw,
  *  fm10k_sm_mbx_transmit - Take message from Tx and put it in Tx mailbox FIFO
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
+ *  @head: head index of message
  *
  *  This function will dequeue one message from the Tx mailbox FIFO and place
  *  it in the Tx switch manager mailbox FIFO for processing by hardware.
@@ -2015,11 +2020,12 @@ STATIC void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,
 
 /**
  *  fm10k_sm_mbx_create_reply - Generate reply based on state and remote head
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *  @head: acknowledgement number
  *
  *  This function will generate an outgoing message based on the current
- *  mailbox state and the remote fifo head.  It will return the length
+ *  mailbox state and the remote FIFO head.  It will return the length
  *  of the outgoing message excluding header on success, and a negative value
  *  on error.
  **/
@@ -2131,7 +2137,7 @@ send_reply:
 }
 
 /**
- *  fm10k_sm_mbx_process - Process mailbox switch mailbox interrupt
+ *  fm10k_sm_mbx_process - Process switch manager mailbox interrupt
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
@@ -2189,7 +2195,12 @@ fifo_err:
  *  @mbx: pointer to mailbox
  *  @msg_data: handlers for mailbox events
  *
- *  This function for now is used to stub out the PF/SM mailbox
+ *  This function initializes the PF/SM mailbox for use.  It will split the
+ *  buffer provided and use that to populate both the Tx and Rx FIFO by
+ *  evenly splitting it.  In order to allow for easy masking of head/tail
+ *  the value reported in size must be a power of 2 and is reported in
+ *  DWORDs, not bytes.  Any invalid values will cause the mailbox to return
+ *  error.
  **/
 s32 fm10k_sm_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
 		      const struct fm10k_msg_data *msg_data)
diff --git a/drivers/net/fm10k/base/fm10k_mbx.h b/drivers/net/fm10k/base/fm10k_mbx.h
index 4b22f0e..e642c2f 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.h
+++ b/drivers/net/fm10k/base/fm10k_mbx.h
@@ -144,11 +144,11 @@ enum fm10k_mbx_state {
  *		The maximum message size is provided during connect to avoid
  *		jamming the mailbox with messages that do not fit.
  * Err_no: Error number - Applies only to error headers
- *		The error number provides a indication of the type of error
+ *		The error number provides an indication of the type of error
  *		experienced.
  */
 
-/* macros for retriving and setting header values */
+/* macros for retrieving and setting header values */
 #define FM10K_MSG_HDR_MASK(name) \
 	((0x1u << FM10K_MSG_##name##_SIZE) - 1)
 #define FM10K_MSG_HDR_FIELD_SET(value, name) \
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 716d7f1..456fe64 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1105,7 +1105,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 		FM10K_WRITE_REG(hw, FM10K_RQMAP(qmap_idx + i), vf_q_idx + i);
 	}
 
-	/* repeat the first ring for all of the remaining VF rings */
+	/* repeat the first ring for all the remaining VF rings */
 	for (i = queues_per_pool; i < qmap_stride; i++) {
 		FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx + i), vf_q_idx);
 		FM10K_WRITE_REG(hw, FM10K_RQMAP(qmap_idx + i), vf_q_idx);
@@ -1246,9 +1246,9 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 			      struct fm10k_mbx_info *mbx)
 {
 	struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx;
-	int err = FM10K_SUCCESS;
 	u8 mac[ETH_ALEN];
 	u32 *result;
+	int err = FM10K_SUCCESS;
 	bool set;
 	u16 vlan;
 	u32 vid;
@@ -1427,10 +1427,10 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 			err = fm10k_update_lport_state_pf(hw, vf_info->glort,
 							  1, false);
 
-		/* need to clear VF_FLAG_ENABLED in order to ensure that we
-		 * actually re-enable the lport state below. Note that this
-		 * has no impact if VF is already disabled, as the flags are
-		 * already zeroed.
+		/* we need to clear VF_FLAG_ENABLED flags in order to ensure
+		 * that we actually re-enable the LPORT state below. Note that
+		 * this has no impact if the VF is already disabled, as the
+		 * flags are already cleared.
 		 */
 		if (!err)
 			vf_info->vf_flags = FM10K_VF_FLAG_CAPABLE(vf_info);
diff --git a/drivers/net/fm10k/base/fm10k_tlv.h b/drivers/net/fm10k/base/fm10k_tlv.h
index a297bb8..8f85fce 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.h
+++ b/drivers/net/fm10k/base/fm10k_tlv.h
@@ -51,9 +51,9 @@ struct fm10k_msg_data;
  * mailbox size we will provide a message with the above header and it
  * will be segmented and transported to the mailbox to the other side where
  * it is reassembled.  It contains the following fields:
- * Len: Length of the message in bytes excluding the message header
+ * Length: Length of the message in bytes excluding the message header
  * Flags: TBD
- * Rule: These will be the message/argument types we pass
+ * Type/ID: These will be the message/argument types we pass
  */
 /* message data header */
 #define FM10K_TLV_ID_SHIFT		0
-- 
1.9.3

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

* [PATCH 12/16] fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (10 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 11/16] fm10k/base: fix comment per upstream review changes Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 13/16] fm10k/base: move constants to the right of binary operators Wang Xiao W
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Per comments from an upstream patch, and looking at how TLV LE_STRUCT
code works, we actually want these structures to be 4byte aligned, not
1byte aligned. In practice, 1byte alignment has worked so far because
all our structures end up being a multiple of 4. But if a future TLV
structure were added that had a u8 or similar sticking on the end things
would break. Fix this by using 4byte alignment which will prevent the
TLV LE_STRUCT code from breaking. Update the comment explaining that we
need 4byte alignment of our structures.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index 92e2962..ee8527a 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -91,14 +91,14 @@ enum fm10k_pf_tlv_attr_id_v1 {
 #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT	16
 #define FM10K_MSG_UPDATE_PVID_PVID_SIZE		16
 
-/* The following data structures are overlayed specifically to TLV mailbox
- * messages, and must not have gaps between their values. They must line up
- * correctly to the TLV definition.
+/* 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.
  */
 #ifdef C99
-#pragma pack(push, 1)
+#pragma pack(push, 4)
 #else
-#pragma pack(1)
+#pragma pack(4)
 #endif /* C99 */
 
 struct fm10k_mac_update {
-- 
1.9.3

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

* [PATCH 13/16] fm10k/base: move constants to the right of binary operators
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (11 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 12/16] fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:35 ` [PATCH 14/16] fm10k/base: minor cleanups Wang Xiao W
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The upstream Linux kernel community prefers constants are to the right of
binary operators.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 456fe64..105babf 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -759,8 +759,8 @@ STATIC s32 fm10k_iov_assign_resources_pf(struct fm10k_hw *hw, u16 num_vfs,
 					FM10K_RXDCTL_WRITE_BACK_MIN_DELAY |
 					FM10K_RXDCTL_DROP_ON_EMPTY);
 			FM10K_WRITE_REG(hw, FM10K_RXQCTL(vf_q_idx),
-					FM10K_RXQCTL_VF |
-					(i << FM10K_RXQCTL_VF_SHIFT));
+					(i << FM10K_RXQCTL_VF_SHIFT) |
+					FM10K_RXQCTL_VF);
 
 			/* map queue pair to VF */
 			FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);
@@ -1035,7 +1035,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 	txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) |
 		 (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
 		 FM10K_TXQCTL_VF | vf_idx;
-	rxqctl = FM10K_RXQCTL_VF | (vf_idx << FM10K_RXQCTL_VF_SHIFT);
+	rxqctl = (vf_idx << FM10K_RXQCTL_VF_SHIFT) | FM10K_RXQCTL_VF;
 
 	/* stop further DMA and reset queue ownership back to VF */
 	for (i = vf_q_idx; i < (queues_per_pool + vf_q_idx); i++) {
-- 
1.9.3

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

* [PATCH 14/16] fm10k/base: minor cleanups
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (12 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 13/16] fm10k/base: move constants to the right of binary operators Wang Xiao W
@ 2016-01-21 10:35 ` Wang Xiao W
  2016-01-21 10:36 ` [PATCH 15/16] fm10k: use default mailbox message handler for pf Wang Xiao W
  2016-01-21 10:36 ` [PATCH 16/16] fm10k/base: add macro definitions that are needed Wang Xiao W
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:35 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Some cleanups to better reflect the code that was actually pushed out to
the upstream Linux community.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.h  |   7 --
 drivers/net/fm10k/base/fm10k_pf.h   |   4 --
 drivers/net/fm10k/base/fm10k_type.h | 132 ------------------------------------
 3 files changed, 143 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.h b/drivers/net/fm10k/base/fm10k_mbx.h
index e642c2f..edc57df 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.h
+++ b/drivers/net/fm10k/base/fm10k_mbx.h
@@ -48,7 +48,6 @@ struct fm10k_mbx_info;
 /* XOR provides means of switching from Tx to Rx FIFO */
 #define FM10K_MBMEM_PF_XOR	(FM10K_MBMEM_SM(0) ^ FM10K_MBMEM_PF(0))
 #define FM10K_MBX(_n)		((_n) + 0x18800)
-#define FM10K_MBX_OWNER				0x00000001
 #define FM10K_MBX_REQ				0x00000002
 #define FM10K_MBX_ACK				0x00000004
 #define FM10K_MBX_REQ_INTERRUPT			0x00000008
@@ -213,7 +212,6 @@ enum fm10k_msg_type {
 /* version number for switch manager mailboxes */
 #define FM10K_SM_MBX_VERSION		1
 #define FM10K_SM_MBX_FIFO_LEN		(FM10K_MBMEM_PF_XOR - 1)
-#define FM10K_SM_MBX_FIFO_HDR_LEN	1
 
 /* offsets shared between all SM FIFO headers */
 #define FM10K_MSG_SM_TAIL_SHIFT			0
@@ -233,18 +231,13 @@ enum fm10k_msg_type {
  */
 #define FM10K_MBX_ERR(_n) ((_n) - 512)
 #define FM10K_MBX_ERR_NO_MBX		FM10K_MBX_ERR(0x01)
-#define FM10K_MBX_ERR_NO_MSG		FM10K_MBX_ERR(0x02)
 #define FM10K_MBX_ERR_NO_SPACE		FM10K_MBX_ERR(0x03)
-#define FM10K_MBX_ERR_LOCK		FM10K_MBX_ERR(0x04)
 #define FM10K_MBX_ERR_TAIL		FM10K_MBX_ERR(0x05)
 #define FM10K_MBX_ERR_HEAD		FM10K_MBX_ERR(0x06)
-#define FM10K_MBX_ERR_DST		FM10K_MBX_ERR(0x07)
 #define FM10K_MBX_ERR_SRC		FM10K_MBX_ERR(0x08)
 #define FM10K_MBX_ERR_TYPE		FM10K_MBX_ERR(0x09)
-#define FM10K_MBX_ERR_LEN		FM10K_MBX_ERR(0x0A)
 #define FM10K_MBX_ERR_SIZE		FM10K_MBX_ERR(0x0B)
 #define FM10K_MBX_ERR_BUSY		FM10K_MBX_ERR(0x0C)
-#define FM10K_MBX_ERR_VALUE		FM10K_MBX_ERR(0x0D)
 #define FM10K_MBX_ERR_RSVD0		FM10K_MBX_ERR(0x0E)
 #define FM10K_MBX_ERR_CRC		FM10K_MBX_ERR(0x0F)
 
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index ee8527a..c84b1bc 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -140,10 +140,6 @@ struct fm10k_swapi_1588_clock_owner {
 #pragma pack()
 #endif /* C99 */
 
-#define FM10K_PF_MSG_LPORT_CREATE_HANDLER(func) \
-	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_CREATE, NULL, func)
-#define FM10K_PF_MSG_LPORT_DELETE_HANDLER(func) \
-	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_DELETE, NULL, func)
 s32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
 extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
 #define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index ba0a184..3fc8f13 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -40,7 +40,6 @@ struct fm10k_hw;
 #include "fm10k_osdep.h"
 #include "fm10k_mbx.h"
 
-#define FM10K_INTEL_VENDOR_ID		0x8086
 #define FM10K_DEV_ID_PF			0x15A4
 #define FM10K_DEV_ID_VF			0x15A5
 #ifdef BOULDER_RAPIDS_HW
@@ -121,28 +120,16 @@ struct fm10k_hw;
 #define FM10K_CTRL_BAR4_ALLOWED			0x00000004
 
 #define FM10K_CTRL_EXT		0x0001
-#define FM10K_CTRL_EXT_NS_DIS			0x00000001
-#define FM10K_CTRL_EXT_RO_DIS			0x00000002
-#define FM10K_CTRL_EXT_SWITCH_LOOPBACK		0x00000004
-#define FM10K_EXVET		0x0002
-#define FM10K_EXVET_ETHERTYPE_MASK		0x000000FF
-#define FM10K_EXVET_TAG_SIZE_SHIFT		16
-#define FM10K_EXVET_AFTER_VLAN			0x00040000
 #define FM10K_GCR		0x0003
-#define FM10K_FACTPS		0x0004
 #define FM10K_GCR_EXT		0x0005
 
 /* Interrupt control registers */
 #define FM10K_EICR		0x0006
-#define FM10K_EICR_PCA_FAULT			0x00000001
-#define FM10K_EICR_THI_FAULT			0x00000004
-#define FM10K_EICR_FUM_FAULT			0x00000020
 #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
-#define FM10K_EICR_SRAMERROR			0x00000400
 #define FM10K_EICR_VFLR				0x00000800
 #define FM10K_EICR_MAXHOLDTIME			0x00001000
 #define FM10K_EIMR		0x0007
@@ -196,7 +183,6 @@ 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)
@@ -217,38 +203,23 @@ struct fm10k_hw;
 #define FM10K_TC_RATE_INTERVAL_4US_GEN1		0x00020000
 #define FM10K_TC_RATE_INTERVAL_4US_GEN2		0x00040000
 #define FM10K_TC_RATE_INTERVAL_4US_GEN3		0x00080000
-#define FM10K_TC_RATE_STATUS	0x20C0
-#define FM10K_PAUSE		0x20C2
 
 /* DMA control registers */
 #define FM10K_DMA_CTRL		0x20C3
 #define FM10K_DMA_CTRL_TX_ENABLE		0x00000001
-#define FM10K_DMA_CTRL_TX_HOST_PENDING		0x00000002
-#define FM10K_DMA_CTRL_TX_DATA			0x00000004
 #define FM10K_DMA_CTRL_TX_ACTIVE		0x00000008
 #define FM10K_DMA_CTRL_RX_ENABLE		0x00000010
-#define FM10K_DMA_CTRL_RX_HOST_PENDING		0x00000020
-#define FM10K_DMA_CTRL_RX_DATA			0x00000040
 #define FM10K_DMA_CTRL_RX_ACTIVE		0x00000080
 #define FM10K_DMA_CTRL_RX_DESC_SIZE		0x00000100
-#define FM10K_DMA_CTRL_MINMSS_SHIFT		9
 #define FM10K_DMA_CTRL_MINMSS_64		0x00008000
-#define FM10K_DMA_CTRL_MAX_HOLD_TIME_SHIFT	23
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN3	0x04800000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN2	0x04000000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN1	0x03800000
 #define FM10K_DMA_CTRL_DATAPATH_RESET		0x20000000
-#define FM10K_DMA_CTRL_MAXNUMOFQ_MASK		0xC0000000
 #define FM10K_DMA_CTRL_32_DESC			0x00000000
-#define FM10K_DMA_CTRL_64_DESC			0x40000000
-#define FM10K_DMA_CTRL_128_DESC			0x80000000
 
 #define FM10K_DMA_CTRL2		0x20C4
-#define FM10K_DMA_CTRL2_TX_FRAME_SPACING_SHIFT	5
 #define FM10K_DMA_CTRL2_SWITCH_READY		0x00002000
-#define FM10K_DMA_CTRL2_RX_DESC_READ_PRIO_SHIFT	14
-#define FM10K_DMA_CTRL2_TX_DESC_READ_PRIO_SHIFT	17
-#define FM10K_DMA_CTRL2_TX_DATA_READ_PRIO_SHIFT	20
 
 /* TSO flags configuration
  * First packet contains all flags except for fin and psh
@@ -261,7 +232,6 @@ struct fm10k_hw;
 #define FM10K_DTXTCPFLGH	0x20C6
 
 #define FM10K_TPH_CTRL		0x20C7
-#define FM10K_TPH_CTRL_DISABLE_READ_HINT	0x00000080
 #define FM10K_MRQC(_n)		((_n) + 0x2100)
 #define FM10K_MRQC_TCP_IPV4			0x00000001
 #define FM10K_MRQC_IPV4				0x00000002
@@ -273,7 +243,6 @@ struct fm10k_hw;
 #define FM10K_TQMAP(_n)		((_n) + 0x2800)
 #define FM10K_TQMAP_TABLE_SIZE			2048
 #define FM10K_RQMAP(_n)		((_n) + 0x3000)
-#define FM10K_RQMAP_TABLE_SIZE			2048
 
 /* Hardware Statistics */
 #define FM10K_STATS_TIMEOUT		0x3800
@@ -286,16 +255,11 @@ struct fm10k_hw;
 #define FM10K_STATS_NODESC_DROP		0x3807
 
 /* Timesync registers */
-#define FM10K_RRTIME_CFG	0x3808
-#define FM10K_RRTIME_LIMIT(_n)	((_n) + 0x380C)
-#define FM10K_RRTIME_COUNT(_n)	((_n) + 0x3810)
 #define FM10K_SYSTIME		0x3814
-#define FM10K_SYSTIME0		0x3816
 #define FM10K_SYSTIME_CFG	0x3818
 #define FM10K_SYSTIME_CFG_STEP_MASK		0x0000000F
 
 /* PCIe state registers */
-#define FM10K_PFVFBME(_n)	((_n) + 0x381A)
 #define FM10K_PHYADDR		0x381C
 
 /* Rx ring registers */
@@ -304,8 +268,6 @@ struct fm10k_hw;
 #define FM10K_RDLEN(_n)		((0x40 * (_n)) + 0x4002)
 #define FM10K_TPH_RXCTRL(_n)	((0x40 * (_n)) + 0x4003)
 #define FM10K_TPH_RXCTRL_DESC_TPHEN		0x00000020
-#define FM10K_TPH_RXCTRL_HDR_TPHEN		0x00000040
-#define FM10K_TPH_RXCTRL_DATA_TPHEN		0x00000080
 #define FM10K_TPH_RXCTRL_DESC_RROEN		0x00000200
 #define FM10K_TPH_RXCTRL_DATA_WROEN		0x00002000
 #define FM10K_TPH_RXCTRL_HDR_WROEN		0x00008000
@@ -319,27 +281,10 @@ struct fm10k_hw;
 #define FM10K_RXQCTL_ID_MASK	(FM10K_RXQCTL_PF | FM10K_RXQCTL_VF)
 #define FM10K_RXDCTL(_n)	((0x40 * (_n)) + 0x4007)
 #define FM10K_RXDCTL_WRITE_BACK_MIN_DELAY	0x00000001
-#define FM10K_RXDCTL_WRITE_BACK_IMM		0x00000100
 #define FM10K_RXDCTL_DROP_ON_EMPTY		0x00000200
 #define FM10K_RXINT(_n)		((0x40 * (_n)) + 0x4008)
-#define FM10K_RXINT_TIMER_SHIFT			8
 #define FM10K_SRRCTL(_n)	((0x40 * (_n)) + 0x4009)
 #define FM10K_SRRCTL_BSIZEPKT_SHIFT		8 /* shift _right_ */
-#define FM10K_SRRCTL_BSIZEHDR_SHIFT		2 /* shift _left_ */
-#define FM10K_SRRCTL_BSIZEHDR_MASK		0x00003F00
-#define FM10K_SRRCTL_DESCTYPE_HDR_SPLIT		0x00004000
-#define FM10K_SRRCTL_DESCTYPE_SIZE_SPLIT	0x00008000
-#define FM10K_SRRCTL_PSRTYPE_INNER_TCPHDR	0x00010000
-#define FM10K_SRRCTL_PSRTYPE_INNER_UDPHDR	0x00020000
-#define FM10K_SRRCTL_PSRTYPE_INNER_IPV4HDR	0x00040000
-#define FM10K_SRRCTL_PSRTYPE_INNER_IPV6HDR	0x00080000
-#define FM10K_SRRCTL_PSRTYPE_INNER_L2HDR	0x00100000
-#define FM10K_SRRCTL_PSRTYPE_ENCAPHDR		0x00200000
-#define FM10K_SRRCTL_PSRTYPE_TCPHDR		0x00400000
-#define FM10K_SRRCTL_PSRTYPE_UDPHDR		0x00800000
-#define FM10K_SRRCTL_PSRTYPE_IPV4HDR		0x01000000
-#define FM10K_SRRCTL_PSRTYPE_IPV6HDR		0x02000000
-#define FM10K_SRRCTL_PSRTYPE_L2HDR		0x04000000
 #define FM10K_SRRCTL_LOOPBACK_SUPPRESS		0x40000000
 #define FM10K_SRRCTL_BUFFER_CHAINING_EN		0x80000000
 
@@ -380,7 +325,6 @@ struct fm10k_hw;
 #define FM10K_TXDCTL(_n)	((0x40 * (_n)) + 0x8006)
 #define FM10K_TXDCTL_ENABLE			0x00004000
 #define FM10K_TXDCTL_MAX_TIME_SHIFT		16
-#define FM10K_TXDCTL_PUSH_DESC			0x10000000
 #define FM10K_TXQCTL(_n)	((0x40 * (_n)) + 0x8007)
 #define FM10K_TXQCTL_PF				0x0000003F
 #define FM10K_TXQCTL_VF				0x00000040
@@ -388,13 +332,10 @@ struct fm10k_hw;
 #define FM10K_TXQCTL_PC_SHIFT			7
 #define FM10K_TXQCTL_PC_MASK			0x00000380
 #define FM10K_TXQCTL_TC_SHIFT			10
-#define FM10K_TXQCTL_TC_MASK			0x0000FC00
 #define FM10K_TXQCTL_VID_SHIFT			16
 #define FM10K_TXQCTL_VID_MASK			0x0FFF0000
 #define FM10K_TXQCTL_UNLIMITED_BW		0x10000000
-#define FM10K_TXQCTL_PUSHMODEDIS		0x20000000
 #define FM10K_TXINT(_n)		((0x40 * (_n)) + 0x8008)
-#define FM10K_TXINT_TIMER_SHIFT			8
 
 /* Tx Statistics */
 #define FM10K_QPTC(_n)		((0x40 * (_n)) + 0x8009)
@@ -404,13 +345,7 @@ struct fm10k_hw;
 /* Tx Push registers */
 #define FM10K_TQDLOC(_n)	((0x40 * (_n)) + 0x800C)
 #define FM10K_TQDLOC_BASE_32_DESC		0x08
-#define FM10K_TQDLOC_BASE_64_DESC		0x10
-#define FM10K_TQDLOC_BASE_128_DESC		0x20
 #define FM10K_TQDLOC_SIZE_32_DESC		0x00050000
-#define FM10K_TQDLOC_SIZE_64_DESC		0x00060000
-#define FM10K_TQDLOC_SIZE_128_DESC		0x00070000
-#define FM10K_TQDLOC_SIZE_SHIFT			16
-#define FM10K_TX_DCACHE(_n, _m)	((0x400 * (_n)) + (0x4 * (_m)) + 0x40000)
 
 /* Tx GLORT registers */
 #define FM10K_TX_SGLORT(_n)	((0x40 * (_n)) + 0x800D)
@@ -418,50 +353,27 @@ struct fm10k_hw;
 #define FM10K_PFVTCTL_FTAG_DESC_ENABLE		0x00000001
 
 /* Interrupt moderation and control registers */
-#define FM10K_PBACL(_n)		((_n) + 0x10000)
 #define FM10K_INT_MAP(_n)	((_n) + 0x10080)
 #define FM10K_INT_MAP_TIMER0			0x00000000
 #define FM10K_INT_MAP_TIMER1			0x00000100
 #define FM10K_INT_MAP_IMMEDIATE			0x00000200
 #define FM10K_INT_MAP_DISABLE			0x00000300
-#define FM10K_MSIX_VECTOR_ADDR_LO(_n)	((0x4 * (_n)) + 0x11000)
-#define FM10K_MSIX_VECTOR_ADDR_HI(_n)	((0x4 * (_n)) + 0x11001)
-#define FM10K_MSIX_VECTOR_DATA(_n)	((0x4 * (_n)) + 0x11002)
 #define FM10K_MSIX_VECTOR_MASK(_n)	((0x4 * (_n)) + 0x11003)
 #define FM10K_INT_CTRL		0x12000
 #define FM10K_INT_CTRL_ENABLEMODERATOR		0x00000400
 #define FM10K_ITR(_n)		((_n) + 0x12400)
 #define FM10K_ITR_INTERVAL1_SHIFT		12
-#define FM10K_ITR_TIMER0_EXPIRED		0x01000000
-#define FM10K_ITR_TIMER1_EXPIRED		0x02000000
-#define FM10K_ITR_PENDING0			0x04000000
-#define FM10K_ITR_PENDING1			0x08000000
 #define FM10K_ITR_PENDING2			0x10000000
 #define FM10K_ITR_AUTOMASK			0x20000000
 #define FM10K_ITR_MASK_SET			0x40000000
 #define FM10K_ITR_MASK_CLEAR			0x80000000
 #define FM10K_ITR2(_n)		((0x2 * (_n)) + 0x12800)
-#define FM10K_ITR2_LP(_n)	((0x2 * (_n)) + 0x12801)
 #define FM10K_ITR_REG_COUNT			768
 #define FM10K_ITR_REG_COUNT_PF			256
 
 /* Switch manager interrupt registers */
 #define FM10K_IP		0x13000
-#define FM10K_IP_HOT_RESET			0x00000001
-#define FM10K_IP_DEVICE_STATE_CHANGE		0x00000002
-#define FM10K_IP_MAILBOX			0x00000004
-#define FM10K_IP_VPD_REQUEST			0x00000008
-#define FM10K_IP_SRAMERROR			0x00000010
-#define FM10K_IP_PFLR				0x00000020
-#define FM10K_IP_DATAPATHRESET			0x00000040
-#define FM10K_IP_OUTOFRESET			0x00000080
 #define FM10K_IP_NOTINRESET			0x00000100
-#define FM10K_IP_TIMEOUT			0x00000200
-#define FM10K_IP_VFLR				0x00000400
-#define FM10K_IM		0x13001
-#define FM10K_IB		0x13002
-#define FM10K_SRAM_IP		0x13003
-#define FM10K_SRAM_IM		0x13004
 
 /* VLAN registers */
 #define FM10K_VLAN_TABLE(_n, _m)	((0x80 * (_n)) + (_m) + 0x14000)
@@ -499,12 +411,8 @@ struct fm10k_hw;
 #define FM10K_VFINT_MAP		0x00030
 #define FM10K_VFSYSTIME		0x00040
 #define FM10K_VFITR(_n)		((_n) + 0x00060)
-#define FM10K_VFPBACL(_n)	((_n) + 0x00008)
 
 /* Registers contained in BAR 4 for Switch management */
-#define FM10K_SW_SYSTIME_CFG	0x0224C
-#define FM10K_SW_SYSTIME_CFG_STEP_SHIFT		4
-#define FM10K_SW_SYSTIME_CFG_ADJUST_MASK	0xFF000000
 #define FM10K_SW_SYSTIME_ADJUST	0x0224D
 #define FM10K_SW_SYSTIME_ADJUST_MASK		0x3FFFFFFF
 #define FM10K_SW_SYSTIME_ADJUST_DIR_POSITIVE	0x80000000
@@ -777,8 +685,6 @@ struct fm10k_vf_info {
 #define FM10K_VF_FLAG_CAPABLE(vf_info)	((vf_info)->vf_flags & (u8)0xF)
 #define FM10K_VF_FLAG_ENABLED(vf_info)	((vf_info)->vf_flags >> 4)
 #define FM10K_VF_FLAG_SET_MODE(mode)	((u8)0x10 << (mode))
-#define FM10K_VF_FLAG_ENABLED_MODE_SHIFT	4
-#define FM10K_VF_FLAG_SET_MODE_MASK	((u8)0xF0)
 #define FM10K_VF_FLAG_SET_MODE_NONE \
 	FM10K_VF_FLAG_SET_MODE(FM10K_XCAST_MODE_NONE)
 #define FM10K_VF_FLAG_MULTI_ENABLED \
@@ -849,13 +755,11 @@ struct fm10k_tx_desc_cache {
 #define FM10K_TXD_FLAG_INT	0x01
 #define FM10K_TXD_FLAG_TIME	0x02
 #define FM10K_TXD_FLAG_CSUM	0x04
-#define FM10K_TXD_FLAG_CSUM2	0x08
 #define FM10K_TXD_FLAG_FTAG	0x10
 #define FM10K_TXD_FLAG_RS	0x20
 #define FM10K_TXD_FLAG_LAST	0x40
 #define FM10K_TXD_FLAG_DONE	0x80
 
-#define FM10K_TXD_VLAN_PRI_SHIFT	12
 
 /* These macros are meant to enable optimal placement of the RS and INT
  * bits.  It will point us to the last descriptor in the cache for either the
@@ -864,8 +768,6 @@ struct fm10k_tx_desc_cache {
  * in the FIFO to prevent an unnecessary write.
  */
 #define FM10K_TXD_WB_FIFO_SIZE	4
-#define FM10K_TXD_WB_IDX(idx) \
-	(((idx) - 1) | (FM10K_TXD_WB_FIFO_SIZE - 1))
 
 /* Receive Descriptor - 32B */
 union fm10k_rx_desc {
@@ -910,29 +812,6 @@ enum fm10k_rdesc_rss_type {
 	/* Reserved 0x9 - 0xF */
 };
 
-#define FM10K_RXD_PKTTYPE_MASK		0x03F0
-#define FM10K_RXD_PKTTYPE_MASK_L3	0x0070
-#define FM10K_RXD_PKTTYPE_MASK_L4	0x0380
-#define FM10K_RXD_PKTTYPE_SHIFT		4
-#define FM10K_RXD_PKTTYPE_INNER_MASK_L3	0x1C00
-#define FM10K_RXD_PKTTYPE_INNER_MASK_L4	0xE000
-#define FM10K_RXD_PKTTYPE_INNER_SHIFT	10
-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_HDR_INFO_XC_MASK	0x0006
 enum fm10k_rxdesc_xc {
@@ -941,20 +820,11 @@ enum fm10k_rxdesc_xc {
 	FM10K_XC_BROADCAST	= 0x6
 };
 
-#define FM10K_RXD_HDR_INFO_LEN_SHIFT	5
-#define FM10K_RXD_HDR_INFO_SPH		0x8000
 
 #define FM10K_RXD_STATUS_DD		0x0001 /* Descriptor done */
 #define FM10K_RXD_STATUS_EOP		0x0002 /* End of packet */
-#define FM10K_RXD_STATUS_VEXT		0x0004 /* A VLAN tag is present */
-#define FM10K_RXD_STATUS_IPCS		0x0008 /* Indicates IPv4 csum */
 #define FM10K_RXD_STATUS_L4CS		0x0010 /* Indicates an L4 csum */
-#define FM10K_RXD_STATUS_IPCS2		0x0020 /* Inner header IPv4 csum */
 #define FM10K_RXD_STATUS_L4CS2		0x0040 /* Inner header L4 csum */
-#define FM10K_RXD_STATUS_IPFRAG_MASK	0x0180 /* Fragment mask */
-#define FM10K_RXD_STATUS_IPFRAG_CSUM	0x0100 /* Fragment w/ CSUM field */
-#define FM10K_RXD_STATUS_VEXT2		0x0200 /* A custom tag is present */
-#define FM10K_RXD_STATUS_HBO		0x0400 /* header buffer overrun */
 #define FM10K_RXD_STATUS_L4E2		0x0800 /* Inner header L4 csum err */
 #define FM10K_RXD_STATUS_IPE2		0x1000 /* Inner header IPv4 csum err */
 #define FM10K_RXD_STATUS_RXE		0x2000 /* Generic Rx error */
@@ -967,8 +837,6 @@ enum fm10k_rxdesc_xc {
 #define FM10K_RXD_ERR_SWITCH_READY	0x0008 /* Link transition mid-packet */
 #define FM10K_RXD_ERR_TOO_BIG		0x0010 /* Pkt too big for single buf */
 
-#define FM10K_RXD_VLAN_ID_MASK		0x0FFF
-#define FM10K_RXD_VLAN_PRI_SHIFT	FM10K_TXD_VLAN_PRI_SHIFT
 
 struct fm10k_ftag {
 	__be16 swpri_type_user;
-- 
1.9.3

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

* [PATCH 15/16] fm10k: use default mailbox message handler for pf
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (13 preceding siblings ...)
  2016-01-21 10:35 ` [PATCH 14/16] fm10k/base: minor cleanups Wang Xiao W
@ 2016-01-21 10:36 ` Wang Xiao W
  2016-01-22 21:31   ` Bruce Richardson
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
  2016-01-21 10:36 ` [PATCH 16/16] fm10k/base: add macro definitions that are needed Wang Xiao W
  15 siblings, 2 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:36 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The new share code makes fm10k_msg_update_pvid_pf function static, so we can
not refer to it now in fm10k_ethdev.c. The registered pf handler is almost the
same as the default pf handler, removing it has no impact on mailbox.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/fm10k_ethdev.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index e967628..a118cf4 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2367,29 +2367,16 @@ static const struct fm10k_msg_data fm10k_msgdata_vf[] = {
 	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
 };
 
-/* Mailbox message handler in PF */
-static const struct fm10k_msg_data fm10k_msgdata_pf[] = {
-	FM10K_PF_MSG_ERR_HANDLER(XCAST_MODES, fm10k_msg_err_pf),
-	FM10K_PF_MSG_ERR_HANDLER(UPDATE_MAC_FWD_RULE, fm10k_msg_err_pf),
-	FM10K_PF_MSG_LPORT_MAP_HANDLER(fm10k_msg_lport_map_pf),
-	FM10K_PF_MSG_ERR_HANDLER(LPORT_CREATE, fm10k_msg_err_pf),
-	FM10K_PF_MSG_ERR_HANDLER(LPORT_DELETE, fm10k_msg_err_pf),
-	FM10K_PF_MSG_UPDATE_PVID_HANDLER(fm10k_msg_update_pvid_pf),
-	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
-};
-
 static int
 fm10k_setup_mbx_service(struct fm10k_hw *hw)
 {
-	int err;
+	int err = 0;
 
 	/* Initialize mailbox lock */
 	fm10k_mbx_initlock(hw);
 
 	/* Replace default message handler with new ones */
-	if (hw->mac.type == fm10k_mac_pf)
-		err = hw->mbx.ops.register_handlers(&hw->mbx, fm10k_msgdata_pf);
-	else
+	if (hw->mac.type == fm10k_mac_vf)
 		err = hw->mbx.ops.register_handlers(&hw->mbx, fm10k_msgdata_vf);
 
 	if (err) {
-- 
1.9.3

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

* [PATCH 16/16] fm10k/base: add macro definitions that are needed
  2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
                   ` (14 preceding siblings ...)
  2016-01-21 10:36 ` [PATCH 15/16] fm10k: use default mailbox message handler for pf Wang Xiao W
@ 2016-01-21 10:36 ` Wang Xiao W
  15 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-21 10:36 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Some macros such as FM10K_RXINT_TIMER_SHIFT are removed in the share
code drop, but they are needed in dpdk/fm10k. This patch put all these
necessary macros into fm10k_osdep.h

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_osdep.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 6852ef0..869af1b 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -150,6 +150,36 @@ typedef int        bool;
 #define fm10k_read_reg FM10K_READ_REG
 #endif
 
+#define FM10K_INTEL_VENDOR_ID       0x8086
+#define FM10K_DMA_CTRL_MINMSS_SHIFT		9
+#define FM10K_EICR_PCA_FAULT			0x00000001
+#define FM10K_EICR_THI_FAULT			0x00000004
+#define FM10K_EICR_FUM_FAULT			0x00000020
+#define FM10K_EICR_SRAMERROR			0x00000400
+#define FM10K_SRAM_IP		0x13003
+#define FM10K_RXINT_TIMER_SHIFT			8
+#define FM10K_TXINT_TIMER_SHIFT			8
+#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 */
+
 #define FM10K_TSO_MINMSS \
 	(FM10K_DMA_CTRL_MINMSS_64 >> FM10K_DMA_CTRL_MINMSS_SHIFT)
 #define FM10K_TSO_MIN_HEADERLEN			54
-- 
1.9.3

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

* Re: [PATCH 15/16] fm10k: use default mailbox message handler for pf
  2016-01-21 10:36 ` [PATCH 15/16] fm10k: use default mailbox message handler for pf Wang Xiao W
@ 2016-01-22 21:31   ` Bruce Richardson
  2016-01-25  2:31     ` Wang, Xiao W
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
  1 sibling, 1 reply; 69+ messages in thread
From: Bruce Richardson @ 2016-01-22 21:31 UTC (permalink / raw)
  To: Wang Xiao W; +Cc: dev

On Thu, Jan 21, 2016 at 06:36:00PM +0800, Wang Xiao W wrote:
> The new share code makes fm10k_msg_update_pvid_pf function static, so we can
> not refer to it now in fm10k_ethdev.c. The registered pf handler is almost the
> same as the default pf handler, removing it has no impact on mailbox.
> 
> Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>

What patch makes the function static, as we need to ensure that the build is
not broken by having this patch in the wrong place in the patchset?

Also, it seems strange having this patch in the middle of a series of base code
updates - perhaps it should go first, so that all base code update patches can
go one after the other.

/Bruce

> ---
>  drivers/net/fm10k/fm10k_ethdev.c | 17 ++---------------
>  1 file changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
> index e967628..a118cf4 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -2367,29 +2367,16 @@ static const struct fm10k_msg_data fm10k_msgdata_vf[] = {
>  	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
>  };
>  
> -/* Mailbox message handler in PF */
> -static const struct fm10k_msg_data fm10k_msgdata_pf[] = {
> -	FM10K_PF_MSG_ERR_HANDLER(XCAST_MODES, fm10k_msg_err_pf),
> -	FM10K_PF_MSG_ERR_HANDLER(UPDATE_MAC_FWD_RULE, fm10k_msg_err_pf),
> -	FM10K_PF_MSG_LPORT_MAP_HANDLER(fm10k_msg_lport_map_pf),
> -	FM10K_PF_MSG_ERR_HANDLER(LPORT_CREATE, fm10k_msg_err_pf),
> -	FM10K_PF_MSG_ERR_HANDLER(LPORT_DELETE, fm10k_msg_err_pf),
> -	FM10K_PF_MSG_UPDATE_PVID_HANDLER(fm10k_msg_update_pvid_pf),
> -	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
> -};
> -
>  static int
>  fm10k_setup_mbx_service(struct fm10k_hw *hw)
>  {
> -	int err;
> +	int err = 0;
>  
>  	/* Initialize mailbox lock */
>  	fm10k_mbx_initlock(hw);
>  
>  	/* Replace default message handler with new ones */
> -	if (hw->mac.type == fm10k_mac_pf)
> -		err = hw->mbx.ops.register_handlers(&hw->mbx, fm10k_msgdata_pf);
> -	else
> +	if (hw->mac.type == fm10k_mac_vf)
>  		err = hw->mbx.ops.register_handlers(&hw->mbx, fm10k_msgdata_vf);
>  
>  	if (err) {
> -- 
> 1.9.3
> 

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

* Re: [PATCH 15/16] fm10k: use default mailbox message handler for pf
  2016-01-22 21:31   ` Bruce Richardson
@ 2016-01-25  2:31     ` Wang, Xiao W
  2016-01-26 20:16       ` Bruce Richardson
  0 siblings, 1 reply; 69+ messages in thread
From: Wang, Xiao W @ 2016-01-25  2:31 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: dev

Hi Bruce,

> -----Original Message-----
> From: Richardson, Bruce
> Sent: Saturday, January 23, 2016 5:32 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>
> Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 15/16] fm10k: use default mailbox message
> handler for pf
> 
> On Thu, Jan 21, 2016 at 06:36:00PM +0800, Wang Xiao W wrote:
> > The new share code makes fm10k_msg_update_pvid_pf function static, so
> > we can not refer to it now in fm10k_ethdev.c. The registered pf
> > handler is almost the same as the default pf handler, removing it has no
> impact on mailbox.
> >
> > Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
> 
> What patch makes the function static, as we need to ensure that the build is
> not broken by having this patch in the wrong place in the patchset?
> 
> Also, it seems strange having this patch in the middle of a series of base code
> updates - perhaps it should go first, so that all base code update patches can
> go one after the other.
> 
> /Bruce

It's the first patch in the patch set that makes the function static.

The 0015.patch and 0016.patch are two extra fix patches made by myself. The 0015 is for the
"static fm10k_msg_update_pvid_pf " issue, the 0016 adds back a few macro definitions
which are removed in shared code but are needed in dpdk/fm10k, I add these necessary
macros into fm10k/base/fm10k_osdep.h which is controlled by dpdk driver.

I put the two extra (15/16, 16/16) fix patches last, (15/16) is a change for fm10k_ethdev.c,
so I prefix the subject with "fm10k: ", (16/16) is a change for base/fm10k_osdep.h, so I prefix
the subject with "fm10k/base: ".

Best Regards,
Wang, Xiao
> 
> > ---
> >  drivers/net/fm10k/fm10k_ethdev.c | 17 ++---------------
> >  1 file changed, 2 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> > b/drivers/net/fm10k/fm10k_ethdev.c
> > index e967628..a118cf4 100644
> > --- a/drivers/net/fm10k/fm10k_ethdev.c
> > +++ b/drivers/net/fm10k/fm10k_ethdev.c
> > @@ -2367,29 +2367,16 @@ static const struct fm10k_msg_data
> fm10k_msgdata_vf[] = {
> >  	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
> >  };
> >
> > -/* Mailbox message handler in PF */
> > -static const struct fm10k_msg_data fm10k_msgdata_pf[] = {
> > -	FM10K_PF_MSG_ERR_HANDLER(XCAST_MODES,
> fm10k_msg_err_pf),
> > -	FM10K_PF_MSG_ERR_HANDLER(UPDATE_MAC_FWD_RULE,
> fm10k_msg_err_pf),
> > -
> 	FM10K_PF_MSG_LPORT_MAP_HANDLER(fm10k_msg_lport_map_p
> f),
> > -	FM10K_PF_MSG_ERR_HANDLER(LPORT_CREATE,
> fm10k_msg_err_pf),
> > -	FM10K_PF_MSG_ERR_HANDLER(LPORT_DELETE,
> fm10k_msg_err_pf),
> > -
> 	FM10K_PF_MSG_UPDATE_PVID_HANDLER(fm10k_msg_update_pvi
> d_pf),
> > -	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
> > -};
> > -
> >  static int
> >  fm10k_setup_mbx_service(struct fm10k_hw *hw)  {
> > -	int err;
> > +	int err = 0;
> >
> >  	/* Initialize mailbox lock */
> >  	fm10k_mbx_initlock(hw);
> >
> >  	/* Replace default message handler with new ones */
> > -	if (hw->mac.type == fm10k_mac_pf)
> > -		err = hw->mbx.ops.register_handlers(&hw->mbx,
> fm10k_msgdata_pf);
> > -	else
> > +	if (hw->mac.type == fm10k_mac_vf)
> >  		err = hw->mbx.ops.register_handlers(&hw->mbx,
> fm10k_msgdata_vf);
> >
> >  	if (err) {
> > --
> > 1.9.3
> >

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

* Re: [PATCH 15/16] fm10k: use default mailbox message handler for pf
  2016-01-25  2:31     ` Wang, Xiao W
@ 2016-01-26 20:16       ` Bruce Richardson
  2016-01-27  1:57         ` Wang, Xiao W
  0 siblings, 1 reply; 69+ messages in thread
From: Bruce Richardson @ 2016-01-26 20:16 UTC (permalink / raw)
  To: Wang, Xiao W; +Cc: dev

On Mon, Jan 25, 2016 at 02:31:05AM +0000, Wang, Xiao W wrote:
> Hi Bruce,
> 
> > -----Original Message-----
> > From: Richardson, Bruce
> > Sent: Saturday, January 23, 2016 5:32 AM
> > To: Wang, Xiao W <xiao.w.wang@intel.com>
> > Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH 15/16] fm10k: use default mailbox message
> > handler for pf
> > 
> > On Thu, Jan 21, 2016 at 06:36:00PM +0800, Wang Xiao W wrote:
> > > The new share code makes fm10k_msg_update_pvid_pf function static, so
> > > we can not refer to it now in fm10k_ethdev.c. The registered pf
> > > handler is almost the same as the default pf handler, removing it has no
> > impact on mailbox.
> > >
> > > Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
> > 
> > What patch makes the function static, as we need to ensure that the build is
> > not broken by having this patch in the wrong place in the patchset?
> > 
> > Also, it seems strange having this patch in the middle of a series of base code
> > updates - perhaps it should go first, so that all base code update patches can
> > go one after the other.
> > 
> > /Bruce
> 
> It's the first patch in the patch set that makes the function static.

So does this patch not need to go before patch 1, if we can't refer to the function
once patch one is applied?

/Bruce

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

* Re: [PATCH 15/16] fm10k: use default mailbox message handler for pf
  2016-01-26 20:16       ` Bruce Richardson
@ 2016-01-27  1:57         ` Wang, Xiao W
  0 siblings, 0 replies; 69+ messages in thread
From: Wang, Xiao W @ 2016-01-27  1:57 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: dev


> -----Original Message-----
> From: Richardson, Bruce
> Sent: Wednesday, January 27, 2016 4:17 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>
> Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 15/16] fm10k: use default mailbox message
> handler for pf
> 
> On Mon, Jan 25, 2016 at 02:31:05AM +0000, Wang, Xiao W wrote:
> > Hi Bruce,
> >
> > > -----Original Message-----
> > > From: Richardson, Bruce
> > > Sent: Saturday, January 23, 2016 5:32 AM
> > > To: Wang, Xiao W <xiao.w.wang@intel.com>
> > > Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [PATCH 15/16] fm10k: use default mailbox
> > > message handler for pf
> > >
> > > On Thu, Jan 21, 2016 at 06:36:00PM +0800, Wang Xiao W wrote:
> > > > The new share code makes fm10k_msg_update_pvid_pf function static,
> > > > so we can not refer to it now in fm10k_ethdev.c. The registered pf
> > > > handler is almost the same as the default pf handler, removing it
> > > > has no
> > > impact on mailbox.
> > > >
> > > > Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
> > >
> > > What patch makes the function static, as we need to ensure that the
> > > build is not broken by having this patch in the wrong place in the patchset?
> > >
> > > Also, it seems strange having this patch in the middle of a series
> > > of base code updates - perhaps it should go first, so that all base
> > > code update patches can go one after the other.
> > >
> > > /Bruce
> >
> > It's the first patch in the patch set that makes the function static.
> 
> So does this patch not need to go before patch 1, if we can't refer to the
> function once patch one is applied?
> 
> /Bruce

OK, got it, I will revise my patch, thanks a lot for your comment.

Best Regards,
Wang, Xiao

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

* [PATCH v2 00/16] fm10k: update shared code
  2016-01-21 10:36 ` [PATCH 15/16] fm10k: use default mailbox message handler for pf Wang Xiao W
  2016-01-22 21:31   ` Bruce Richardson
@ 2016-01-27  3:50   ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 01/16] fm10k: use default mailbox message handler for pf Wang Xiao W
                       ` (16 more replies)
  1 sibling, 17 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

v2:
* Put the two extra fix patches ahead of the base code patches.

Wang Xiao W (16):
  fm10k: use default mailbox message handler for pf
  fm10k/base: add macro definitions that are needed
  fm10k/base: cleanup namespace pollution and correct typecast
  fm10k/base: use bitshift for itr_scale
  fm10k/base: reset max_queues on init_hw_vf failure
  fm10k/base: document ITR scale workaround in VF TDLEN register
  fm10k/base: fix checkpatch warning
  fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
  fm10k/base: do not use CamelCase
  fm10k/base: use memcpy for mac addr copy
  fm10k/base: allow removal of is_slot_appropriate function
  fm10k/base: consistently use VLAN ID when referencing vid variables
  fm10k/base: fix comment per upstream review changes
  fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned
  fm10k/base: move constants to the right of binary operators
  fm10k/base: minor cleanups

 drivers/net/fm10k/base/fm10k_api.c   |   2 +
 drivers/net/fm10k/base/fm10k_api.h   |   2 +
 drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
 drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
 drivers/net/fm10k/base/fm10k_osdep.h |  30 ++++++
 drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
 drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
 drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
 drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
 drivers/net/fm10k/base/fm10k_type.h  | 182 +++++++----------------------------
 drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
 drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
 12 files changed, 220 insertions(+), 298 deletions(-)

-- 
1.9.3

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

* [PATCH v2 01/16] fm10k: use default mailbox message handler for pf
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-02-16 10:50       ` Bruce Richardson
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 02/16] fm10k/base: add macro definitions that are needed Wang Xiao W
                       ` (15 subsequent siblings)
  16 siblings, 2 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The new share code makes fm10k_msg_update_pvid_pf function static, so we can
not refer to it now in fm10k_ethdev.c. The registered pf handler is almost the
same as the default pf handler, removing it has no impact on mailbox.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/fm10k_ethdev.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index e4aed94..2c38ce9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2367,29 +2367,16 @@ static const struct fm10k_msg_data fm10k_msgdata_vf[] = {
 	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
 };
 
-/* Mailbox message handler in PF */
-static const struct fm10k_msg_data fm10k_msgdata_pf[] = {
-	FM10K_PF_MSG_ERR_HANDLER(XCAST_MODES, fm10k_msg_err_pf),
-	FM10K_PF_MSG_ERR_HANDLER(UPDATE_MAC_FWD_RULE, fm10k_msg_err_pf),
-	FM10K_PF_MSG_LPORT_MAP_HANDLER(fm10k_msg_lport_map_pf),
-	FM10K_PF_MSG_ERR_HANDLER(LPORT_CREATE, fm10k_msg_err_pf),
-	FM10K_PF_MSG_ERR_HANDLER(LPORT_DELETE, fm10k_msg_err_pf),
-	FM10K_PF_MSG_UPDATE_PVID_HANDLER(fm10k_msg_update_pvid_pf),
-	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
-};
-
 static int
 fm10k_setup_mbx_service(struct fm10k_hw *hw)
 {
-	int err;
+	int err = 0;
 
 	/* Initialize mailbox lock */
 	fm10k_mbx_initlock(hw);
 
 	/* Replace default message handler with new ones */
-	if (hw->mac.type == fm10k_mac_pf)
-		err = hw->mbx.ops.register_handlers(&hw->mbx, fm10k_msgdata_pf);
-	else
+	if (hw->mac.type == fm10k_mac_vf)
 		err = hw->mbx.ops.register_handlers(&hw->mbx, fm10k_msgdata_vf);
 
 	if (err) {
-- 
1.9.3

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

* [PATCH v2 02/16] fm10k/base: add macro definitions that are needed
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 01/16] fm10k: use default mailbox message handler for pf Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-02-16 10:52       ` Bruce Richardson
  2016-01-27  3:50     ` [PATCH v2 03/16] fm10k/base: cleanup namespace pollution and correct typecast Wang Xiao W
                       ` (14 subsequent siblings)
  16 siblings, 1 reply; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Some macros such as FM10K_RXINT_TIMER_SHIFT are removed in the share
code drop, but they are needed in dpdk/fm10k. This patch put all these
necessary macros into fm10k_osdep.h

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_osdep.h | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 6852ef0..869af1b 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -150,6 +150,36 @@ typedef int        bool;
 #define fm10k_read_reg FM10K_READ_REG
 #endif
 
+#define FM10K_INTEL_VENDOR_ID       0x8086
+#define FM10K_DMA_CTRL_MINMSS_SHIFT		9
+#define FM10K_EICR_PCA_FAULT			0x00000001
+#define FM10K_EICR_THI_FAULT			0x00000004
+#define FM10K_EICR_FUM_FAULT			0x00000020
+#define FM10K_EICR_SRAMERROR			0x00000400
+#define FM10K_SRAM_IP		0x13003
+#define FM10K_RXINT_TIMER_SHIFT			8
+#define FM10K_TXINT_TIMER_SHIFT			8
+#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 */
+
 #define FM10K_TSO_MINMSS \
 	(FM10K_DMA_CTRL_MINMSS_64 >> FM10K_DMA_CTRL_MINMSS_SHIFT)
 #define FM10K_TSO_MIN_HEADERLEN			54
-- 
1.9.3

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

* [PATCH v2 03/16] fm10k/base: cleanup namespace pollution and correct typecast
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 01/16] fm10k: use default mailbox message handler for pf Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 02/16] fm10k/base: add macro definitions that are needed Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-02-16 10:55       ` Bruce Richardson
  2016-01-27  3:50     ` [PATCH v2 04/16] fm10k/base: use bitshift for itr_scale Wang Xiao W
                       ` (13 subsequent siblings)
  16 siblings, 1 reply; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Correct typecast in fm10k_update_xc_addr_pf.

Make functions that are only referenced locally static.

And fix the function header comment for fm10k_tlv_attr_nest_stop() while
we're at it.

Wrap fm10k_msg_data fm10k_iov_msg_data_pf[] in the new ifndef
NO_DEFAULT_SRIOV_MSG_HANDLERS so that drivers with custom SR-IOV
message handlers can strip it.

remove unused struct element in struct fm10k_mac_ops.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 10 ++++++----
 drivers/net/fm10k/base/fm10k_pf.h   |  4 ++--
 drivers/net/fm10k/base/fm10k_tlv.c  | 16 ++++++++--------
 drivers/net/fm10k/base/fm10k_tlv.h  |  5 -----
 drivers/net/fm10k/base/fm10k_type.h |  1 -
 drivers/net/fm10k/base/fm10k_vf.c   |  2 --
 6 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 6e6d71e..5b8c039 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -379,8 +379,8 @@ STATIC s32 fm10k_update_xc_addr_pf(struct fm10k_hw *hw, u16 glort,
 						 ((u32)mac[3] << 16) |
 						 ((u32)mac[4] << 8) |
 						 ((u32)mac[5]));
-	mac_update.mac_upper = FM10K_CPU_TO_LE16(((u32)mac[0] << 8) |
-						 ((u32)mac[1]));
+	mac_update.mac_upper = FM10K_CPU_TO_LE16(((u16)mac[0] << 8) |
+					   ((u16)mac[1]));
 	mac_update.vlan = FM10K_CPU_TO_LE16(vid);
 	mac_update.glort = FM10K_CPU_TO_LE16(glort);
 	mac_update.action = add ? 0 : 1;
@@ -1457,6 +1457,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 	return err;
 }
 
+#ifndef NO_DEFAULT_SRIOV_MSG_HANDLERS
 const struct fm10k_msg_data fm10k_iov_msg_data_pf[] = {
 	FM10K_TLV_MSG_TEST_HANDLER(fm10k_tlv_msg_test),
 	FM10K_VF_MSG_MSIX_HANDLER(fm10k_iov_msg_msix_pf),
@@ -1465,6 +1466,7 @@ const struct fm10k_msg_data fm10k_iov_msg_data_pf[] = {
 	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
 };
 
+#endif
 /**
  *  fm10k_update_stats_hw_pf - Updates hardware related statistics of PF
  *  @hw: pointer to hardware structure
@@ -1754,8 +1756,8 @@ const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[] = {
  *
  *  This handler configures the default VLAN for the PF
  **/
-s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
-			     struct fm10k_mbx_info *mbx)
+static s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
+				    struct fm10k_mbx_info *mbx)
 {
 	u16 glort, pvid;
 	u32 pvid_update;
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index 44bd193..92e2962 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -149,8 +149,6 @@ extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
 #define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
 	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_MAP, \
 			  fm10k_lport_map_msg_attr, func)
-s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *, u32 **,
-			     struct fm10k_mbx_info *);
 extern const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[];
 #define FM10K_PF_MSG_UPDATE_PVID_HANDLER(func) \
 	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_UPDATE_PVID, \
@@ -183,7 +181,9 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
 			      struct fm10k_mbx_info *);
 s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
 				 struct fm10k_mbx_info *);
+#ifndef NO_DEFAULT_SRIOV_MSG_HANDLERS
 extern const struct fm10k_msg_data fm10k_iov_msg_data_pf[];
+#endif
 
 s32 fm10k_init_ops_pf(struct fm10k_hw *hw);
 #endif /* _FM10K_PF_H */
diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c
index 1d9d7d8..ade87d1 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.c
+++ b/drivers/net/fm10k/base/fm10k_tlv.c
@@ -63,8 +63,8 @@ s32 fm10k_tlv_msg_init(u32 *msg, u16 msg_id)
  *  the attribute buffer.  It will return success if provided with a valid
  *  pointers.
  **/
-s32 fm10k_tlv_attr_put_null_string(u32 *msg, u16 attr_id,
-				   const unsigned char *string)
+static s32 fm10k_tlv_attr_put_null_string(u32 *msg, u16 attr_id,
+					  const unsigned char *string)
 {
 	u32 attr_data = 0, len = 0;
 	u32 *attr;
@@ -115,7 +115,7 @@ s32 fm10k_tlv_attr_put_null_string(u32 *msg, u16 attr_id,
  *  it in the array pointed by by string.  It will return success if provided
  *  with a valid pointers.
  **/
-s32 fm10k_tlv_attr_get_null_string(u32 *attr, unsigned char *string)
+static s32 fm10k_tlv_attr_get_null_string(u32 *attr, unsigned char *string)
 {
 	u32 len;
 
@@ -386,7 +386,7 @@ s32 fm10k_tlv_attr_get_le_struct(u32 *attr, void *le_struct, u32 len)
  *  function will return NULL on failure, and a pointer to the start
  *  of the nested attributes on success.
  **/
-u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
+static u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
 {
 	u32 *attr;
 
@@ -405,7 +405,7 @@ u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
 }
 
 /**
- *  fm10k_tlv_attr_nest_start - Start a set of nested attributes
+ *  fm10k_tlv_attr_nest_stop - Stop a set of nested attributes
  *  @msg: Pointer to message block
  *
  *  This function closes off an existing set of nested attributes.  The
@@ -413,7 +413,7 @@ u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
  *  the case of a nest within the nest this would be the outer nest pointer.
  *  This function will return success provided all pointers are valid.
  **/
-s32 fm10k_tlv_attr_nest_stop(u32 *msg)
+static s32 fm10k_tlv_attr_nest_stop(u32 *msg)
 {
 	u32 *attr;
 	u32 len;
@@ -522,8 +522,8 @@ STATIC s32 fm10k_tlv_attr_validate(u32 *attr,
  *  FM10K_NOT_IMPLEMENTED for any attribute that is outside of the array
  *  and 0 on success.
  **/
-s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
-			 const struct fm10k_tlv_attr *tlv_attr)
+static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
+				const struct fm10k_tlv_attr *tlv_attr)
 {
 	u32 i, attr_id, offset = 0;
 	s32 err = 0;
diff --git a/drivers/net/fm10k/base/fm10k_tlv.h b/drivers/net/fm10k/base/fm10k_tlv.h
index ad97236..a297bb8 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.h
+++ b/drivers/net/fm10k/base/fm10k_tlv.h
@@ -119,8 +119,6 @@ struct fm10k_msg_data {
 #define FM10K_MSG_HANDLER(id, attr, func) { id, attr, func }
 
 s32 fm10k_tlv_msg_init(u32 *, u16);
-s32 fm10k_tlv_attr_put_null_string(u32 *, u16, const unsigned char *);
-s32 fm10k_tlv_attr_get_null_string(u32 *, unsigned char *);
 s32 fm10k_tlv_attr_put_mac_vlan(u32 *, u16, const u8 *, u16);
 s32 fm10k_tlv_attr_get_mac_vlan(u32 *, u8 *, u16 *);
 s32 fm10k_tlv_attr_put_bool(u32 *, u16);
@@ -160,9 +158,6 @@ s32 fm10k_tlv_attr_get_value(u32 *, void *, u32);
 		fm10k_tlv_attr_get_value(attr, ptr, sizeof(s64))
 s32 fm10k_tlv_attr_put_le_struct(u32 *, u16, const void *, u32);
 s32 fm10k_tlv_attr_get_le_struct(u32 *, void *, u32);
-u32 *fm10k_tlv_attr_nest_start(u32 *, u16);
-s32 fm10k_tlv_attr_nest_stop(u32 *);
-s32 fm10k_tlv_attr_parse(u32 *, u32 **, const struct fm10k_tlv_attr *);
 s32 fm10k_tlv_msg_parse(struct fm10k_hw *, u32 *, struct fm10k_mbx_info *,
 			const struct fm10k_msg_data *);
 s32 fm10k_tlv_msg_error(struct fm10k_hw *hw, u32 **results,
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index df1d276..62fa73f 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -679,7 +679,6 @@ struct fm10k_mac_ops {
 				    struct fm10k_dglort_cfg *);
 	void (*set_dma_mask)(struct fm10k_hw *, u64);
 	s32 (*get_fault)(struct fm10k_hw *, int, struct fm10k_fault *);
-	void (*request_lport_map)(struct fm10k_hw *);
 	s32 (*adjust_systime)(struct fm10k_hw *, s32 ppb);
 	s32 (*notify_offset)(struct fm10k_hw *, u64 offset);
 	u64 (*read_systime)(struct fm10k_hw *);
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index a46b488..7822ab6 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -414,8 +414,6 @@ const struct fm10k_tlv_attr fm10k_lport_state_msg_attr[] = {
 	FM10K_TLV_ATTR_LAST
 };
 
-extern const struct fm10k_tlv_attr fm10k_1588_msg_attr[];
-
 /**
  *  fm10k_msg_lport_state_vf - Message handler for lport_state message from PF
  *  @hw: Pointer to hardware structure
-- 
1.9.3

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

* [PATCH v2 04/16] fm10k/base: use bitshift for itr_scale
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (2 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 03/16] fm10k/base: cleanup namespace pollution and correct typecast Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 05/16] fm10k/base: reset max_queues on init_hw_vf failure Wang Xiao W
                       ` (12 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Upstream community wishes us to use bitshift instead of a divisor,
because this is faster, and prevents any need for a '0' check. In our
case, this even works out because default Gen3 will be 0.

Because of this, we are also able to remove the check for non-zero value
in the vf code path since that will already be the default Gen3 case.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 6 +++---
 drivers/net/fm10k/base/fm10k_vf.c   | 4 ----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 62fa73f..44187b1 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -352,9 +352,9 @@ struct fm10k_hw;
 #define FM10K_TDLEN(_n)		((0x40 * (_n)) + 0x8002)
 #define FM10K_TDLEN_ITR_SCALE_SHIFT		9
 #define FM10K_TDLEN_ITR_SCALE_MASK		0x00000E00
-#define FM10K_TDLEN_ITR_SCALE_GEN1		4
-#define FM10K_TDLEN_ITR_SCALE_GEN2		2
-#define FM10K_TDLEN_ITR_SCALE_GEN3		1
+#define FM10K_TDLEN_ITR_SCALE_GEN1		2
+#define FM10K_TDLEN_ITR_SCALE_GEN2		1
+#define FM10K_TDLEN_ITR_SCALE_GEN3		0
 #define FM10K_TPH_TXCTRL(_n)	((0x40 * (_n)) + 0x8003)
 #define FM10K_TPH_TXCTRL_DESC_TPHEN		0x00000020
 #define FM10K_TPH_TXCTRL_DESC_RROEN		0x00000200
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 7822ab6..39bc927 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -159,10 +159,6 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 			     FM10K_TDLEN_ITR_SCALE_MASK) >>
 			    FM10K_TDLEN_ITR_SCALE_SHIFT;
 
-	/* ensure a non-zero itr scale */
-	if (!hw->mac.itr_scale)
-		hw->mac.itr_scale = FM10K_TDLEN_ITR_SCALE_GEN3;
-
 	return FM10K_SUCCESS;
 }
 
-- 
1.9.3

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

* [PATCH v2 05/16] fm10k/base: reset max_queues on init_hw_vf failure
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (3 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 04/16] fm10k/base: use bitshift for itr_scale Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 06/16] fm10k/base: document ITR scale workaround in VF TDLEN register Wang Xiao W
                       ` (11 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

VF drivers must detect how many queues are available. Previously, the
driver assumed that each VF has at minimum 1 queue. This assumption is
incorrect, since it is possible that the PF has not yet assigned the
queues to the VF by the time the VF checks. To resolve this, we added a
check first to ensure that the first queue is infact owned by the VF at
init_hw_vf time. However, the code flow did not reset hw->mac.max_queues
to 0. In some cases, such as during reinit flows, we call init_hw_vf
without clearing the previous value of hw->mac.max_queues. Due to this,
when init_hw_vf errors out, if its error code is not properly handled
the VF driver may still believe it has queues which no longer belong to
it. Fix this by clearing the hw->mac.max_queues on exit due to errors.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_vf.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 39bc927..9b10ee4 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -128,8 +128,10 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 
 	/* verify we have at least 1 queue */
 	if (!~FM10K_READ_REG(hw, FM10K_TXQCTL(0)) ||
-	    !~FM10K_READ_REG(hw, FM10K_RXQCTL(0)))
-		return FM10K_ERR_NO_RESOURCES;
+	    !~FM10K_READ_REG(hw, FM10K_RXQCTL(0))) {
+		err = FM10K_ERR_NO_RESOURCES;
+		goto reset_max_queues;
+	}
 
 	/* determine how many queues we have */
 	for (i = 1; tqdloc0 && (i < FM10K_MAX_QUEUES_POOL); i++) {
@@ -147,7 +149,7 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 	/* shut down queues we own and reset DMA configuration */
 	err = fm10k_disable_queues_generic(hw, i);
 	if (err)
-		return err;
+		goto reset_max_queues;
 
 	/* record maximum queue count */
 	hw->mac.max_queues = i;
@@ -160,6 +162,11 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 			    FM10K_TDLEN_ITR_SCALE_SHIFT;
 
 	return FM10K_SUCCESS;
+
+reset_max_queues:
+	hw->mac.max_queues = 0;
+
+	return err;
 }
 
 /**
-- 
1.9.3

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

* [PATCH v2 06/16] fm10k/base: document ITR scale workaround in VF TDLEN register
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (4 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 05/16] fm10k/base: reset max_queues on init_hw_vf failure Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 07/16] fm10k/base: fix checkpatch warning Wang Xiao W
                       ` (10 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Add comments which properly explain the undocumented use of bits in
TDLEN register prior to VF initializing it to the correct value. Note
that the mechanism is entirely software-defined and explain its purpose
to help reduce confusion in the future.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 6 +++++-
 drivers/net/fm10k/base/fm10k_type.h | 9 +++++++++
 drivers/net/fm10k/base/fm10k_vf.c   | 9 +++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 5b8c039..6de679e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -958,7 +958,8 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	FM10K_WRITE_REG(hw, FM10K_TDBAH(vf_q_idx), tdbah);
 
 	/* Provide the VF the ITR scale, using software-defined fields in TDLEN
-	 * to pass the information during VF initialization
+	 * to pass the information during VF initialization. See definition of
+	 * FM10K_TDLEN_ITR_SCALE_SHIFT for more details.
 	 */
 	FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx), hw->mac.itr_scale <<
 						   FM10K_TDLEN_ITR_SCALE_SHIFT);
@@ -1095,6 +1096,9 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 	for (i = queues_per_pool; i--;) {
 		FM10K_WRITE_REG(hw, FM10K_TDBAL(vf_q_idx + i), tdbal);
 		FM10K_WRITE_REG(hw, FM10K_TDBAH(vf_q_idx + i), tdbah);
+		/* See definition of FM10K_TDLEN_ITR_SCALE_SHIFT for an
+		 * explanation of how TDLEN is used.
+		 */
 		FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx + i),
 				hw->mac.itr_scale <<
 				FM10K_TDLEN_ITR_SCALE_SHIFT);
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 44187b1..5db6345 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -350,6 +350,15 @@ struct fm10k_hw;
 #define FM10K_TDBAL(_n)		((0x40 * (_n)) + 0x8000)
 #define FM10K_TDBAH(_n)		((0x40 * (_n)) + 0x8001)
 #define FM10K_TDLEN(_n)		((0x40 * (_n)) + 0x8002)
+/* When fist initialized, VFs need to know the Interrupt Throttle Rate (ITR)
+ * scale which is based on the PCIe speed but the speed information in the PCI
+ * configuration space may not be accurate. The PF already knows the ITR scale
+ * but there is no defined method to pass that information from the PF to the
+ * VF. This is accomplished during VF initialization by temporarily co-opting
+ * the yet-to-be-used TDLEN register to have the PF store the ITR shift for
+ * the VF to retrieve before the VF needs to use the TDLEN register for its
+ * intended purpose, i.e. before the Tx resources are allocated.
+ */
 #define FM10K_TDLEN_ITR_SCALE_SHIFT		9
 #define FM10K_TDLEN_ITR_SCALE_MASK		0x00000E00
 #define FM10K_TDLEN_ITR_SCALE_GEN1		2
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 9b10ee4..43eb081 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -74,6 +74,11 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 		FM10K_WRITE_REG(hw, FM10K_TDBAH(i), bah);
 		FM10K_WRITE_REG(hw, FM10K_RDBAL(i), bal);
 		FM10K_WRITE_REG(hw, FM10K_RDBAH(i), bah);
+		/* Restore ITR scale in software-defined mechanism in TDLEN
+		 * for next VF initialization. See definition of
+		 * FM10K_TDLEN_ITR_SCALE_SHIFT for more details on the use of
+		 * TDLEN here.
+		 */
 		FM10K_WRITE_REG(hw, FM10K_TDLEN(i), tdlen);
 	}
 
@@ -157,6 +162,10 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 	/* fetch default VLAN and ITR scale */
 	hw->mac.default_vid = (FM10K_READ_REG(hw, FM10K_TXQCTL(0)) &
 			       FM10K_TXQCTL_VID_MASK) >> FM10K_TXQCTL_VID_SHIFT;
+	/* Read the ITR scale from TDLEN. See the definition of
+	 * FM10K_TDLEN_ITR_SCALE_SHIFT for more information about how TDLEN is
+	 * used here.
+	 */
 	hw->mac.itr_scale = (FM10K_READ_REG(hw, FM10K_TDLEN(0)) &
 			     FM10K_TDLEN_ITR_SCALE_MASK) >>
 			    FM10K_TDLEN_ITR_SCALE_SHIFT;
-- 
1.9.3

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

* [PATCH v2 07/16] fm10k/base: fix checkpatch warning
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (5 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 06/16] fm10k/base: document ITR scale workaround in VF TDLEN register Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 08/16] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1 Wang Xiao W
                       ` (9 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Cleanup lines over 80 characters.
Cleanup useless else, checkpatch warns that else is not generally
useful after a break or return.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.c |  2 +-
 drivers/net/fm10k/base/fm10k_pf.c  | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 3c9ab3a..7d03704 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -930,7 +930,7 @@ STATIC void fm10k_mbx_create_disconnect_hdr(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_create_fake_disconnect_hdr - Generate a false disconnect mailbox header
+ *  fm10k_mbx_create_fake_disconnect_hdr - Generate a false disconnect mbox hdr
  *  @mbx: pointer to mailbox
  *
  *  This function creates a fake disconnect header for loading into remote
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 6de679e..3ee88b6 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1278,8 +1278,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		err = fm10k_iov_select_vid(vf_info, (u16)vid);
 		if (err < 0)
 			return err;
-		else
-			vid = 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);
@@ -1304,8 +1304,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		err = fm10k_iov_select_vid(vf_info, vlan);
 		if (err < 0)
 			return err;
-		else
-			vlan = (u16)err;
+
+		vlan = (u16)err;
 
 		/* notify switch of request for new unicast address */
 		err = hw->mac.ops.update_uc_addr(hw, vf_info->glort,
@@ -1330,8 +1330,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		err = fm10k_iov_select_vid(vf_info, vlan);
 		if (err < 0)
 			return err;
-		else
-			vlan = (u16)err;
+
+		vlan = (u16)err;
 
 		/* notify switch of request for new multicast address */
 		err = hw->mac.ops.update_mc_addr(hw, vf_info->glort,
@@ -1500,9 +1500,10 @@ STATIC void fm10k_update_hw_stats_pf(struct fm10k_hw *hw,
 		xec = fm10k_read_hw_stats_32b(hw, FM10K_STATS_XEC, &stats->xec);
 		vlan_drop = fm10k_read_hw_stats_32b(hw, FM10K_STATS_VLAN_DROP,
 						    &stats->vlan_drop);
-		loopback_drop = fm10k_read_hw_stats_32b(hw,
-							FM10K_STATS_LOOPBACK_DROP,
-							&stats->loopback_drop);
+		loopback_drop =
+			fm10k_read_hw_stats_32b(hw,
+						FM10K_STATS_LOOPBACK_DROP,
+						&stats->loopback_drop);
 		nodesc_drop = fm10k_read_hw_stats_32b(hw,
 						      FM10K_STATS_NODESC_DROP,
 						      &stats->nodesc_drop);
-- 
1.9.3

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

* [PATCH v2 08/16] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (6 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 07/16] fm10k/base: fix checkpatch warning Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 09/16] fm10k/base: do not use CamelCase Wang Xiao W
                       ` (8 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The upstream Linux kernel community prefers using the BIT macro over
bit-shifting a 1.  Similar to how this is handled in the i40e shared code,
define a macro for OSes that do not already have it and wrap all that in
LINUX_MACROS so that it can be stripped from the Linux driver.

The upstream Linux kernel community prefers avoiding CamelCase in
variables, function names, etc.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 12 ++++++------
 drivers/net/fm10k/base/fm10k_tlv.c  | 24 ++++++++++++------------
 drivers/net/fm10k/base/fm10k_type.h | 18 ++++++++++++------
 3 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 3ee88b6..7d48210 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -576,8 +576,8 @@ STATIC s32 fm10k_configure_dglort_map_pf(struct fm10k_hw *hw,
 		return FM10K_ERR_PARAM;
 
 	/* determine count of VSIs and queues */
-	queue_count = 1 << (dglort->rss_l + dglort->pc_l);
-	vsi_count = 1 << (dglort->vsi_l + dglort->queue_l);
+	queue_count = BIT(dglort->rss_l + dglort->pc_l);
+	vsi_count = BIT(dglort->vsi_l + dglort->queue_l);
 	glort = dglort->glort;
 	q_idx = dglort->queue_b;
 
@@ -593,8 +593,8 @@ STATIC s32 fm10k_configure_dglort_map_pf(struct fm10k_hw *hw,
 	}
 
 	/* determine count of PCs and queues */
-	queue_count = 1 << (dglort->queue_l + dglort->rss_l + dglort->vsi_l);
-	pc_count = 1 << dglort->pc_l;
+	queue_count = BIT(dglort->queue_l + dglort->rss_l + dglort->vsi_l);
+	pc_count = BIT(dglort->pc_l);
 
 	/* configure PC for Tx queues */
 	for (pc = 0; pc < pc_count; pc++) {
@@ -1001,7 +1001,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 		return FM10K_ERR_PARAM;
 
 	/* clear event notification of VF FLR */
-	FM10K_WRITE_REG(hw, FM10K_PFVFLREC(vf_idx / 32), 1 << (vf_idx % 32));
+	FM10K_WRITE_REG(hw, FM10K_PFVFLREC(vf_idx / 32), BIT(vf_idx % 32));
 
 	/* force timeout and then disconnect the mailbox */
 	vf_info->mbx.timeout = 0;
@@ -1417,7 +1417,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 		mode = fm10k_iov_supported_xcast_mode_pf(vf_info, mode);
 
 		/* if mode is not currently enabled, enable it */
-		if (!(FM10K_VF_FLAG_ENABLED(vf_info) & (1 << mode)))
+		if (!(FM10K_VF_FLAG_ENABLED(vf_info) & BIT(mode)))
 			fm10k_update_xcast_mode_pf(hw, vf_info->glort, mode);
 
 		/* swap mode back to a bit flag */
diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c
index ade87d1..e6150c1 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.c
+++ b/drivers/net/fm10k/base/fm10k_tlv.c
@@ -249,7 +249,7 @@ s32 fm10k_tlv_attr_put_value(u32 *msg, u16 attr_id, s64 value, u32 len)
 	attr = &msg[FM10K_TLV_DWORD_LEN(*msg)];
 
 	if (len < 4) {
-		attr[1] = (u32)value & ((0x1ul << (8 * len)) - 1);
+		attr[1] = (u32)value & (BIT(8 * len) - 1);
 	} else {
 		attr[1] = (u32)value;
 		if (len > 4)
@@ -699,29 +699,29 @@ STATIC void fm10k_tlv_msg_test_generate_data(u32 *msg, u32 attr_flags)
 {
 	DEBUGFUNC("fm10k_tlv_msg_test_generate_data");
 
-	if (attr_flags & (1 << FM10K_TEST_MSG_STRING))
+	if (attr_flags & BIT(FM10K_TEST_MSG_STRING))
 		fm10k_tlv_attr_put_null_string(msg, FM10K_TEST_MSG_STRING,
 					       test_str);
-	if (attr_flags & (1 << FM10K_TEST_MSG_MAC_ADDR))
+	if (attr_flags & BIT(FM10K_TEST_MSG_MAC_ADDR))
 		fm10k_tlv_attr_put_mac_vlan(msg, FM10K_TEST_MSG_MAC_ADDR,
 					    test_mac, test_vlan);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U8))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U8))
 		fm10k_tlv_attr_put_u8(msg, FM10K_TEST_MSG_U8,  test_u8);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U16))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U16))
 		fm10k_tlv_attr_put_u16(msg, FM10K_TEST_MSG_U16, test_u16);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U32))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U32))
 		fm10k_tlv_attr_put_u32(msg, FM10K_TEST_MSG_U32, test_u32);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U64))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U64))
 		fm10k_tlv_attr_put_u64(msg, FM10K_TEST_MSG_U64, test_u64);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S8))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S8))
 		fm10k_tlv_attr_put_s8(msg, FM10K_TEST_MSG_S8,  test_s8);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S16))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S16))
 		fm10k_tlv_attr_put_s16(msg, FM10K_TEST_MSG_S16, test_s16);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S32))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S32))
 		fm10k_tlv_attr_put_s32(msg, FM10K_TEST_MSG_S32, test_s32);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S64))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S64))
 		fm10k_tlv_attr_put_s64(msg, FM10K_TEST_MSG_S64, test_s64);
-	if (attr_flags & (1 << FM10K_TEST_MSG_LE_STRUCT))
+	if (attr_flags & BIT(FM10K_TEST_MSG_LE_STRUCT))
 		fm10k_tlv_attr_put_le_struct(msg, FM10K_TEST_MSG_LE_STRUCT,
 					     test_le, 8);
 }
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 5db6345..387d25b 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -50,6 +50,12 @@ struct fm10k_hw;
 #define FM10K_DEV_ID_SDI_FM10420_DA2	0x15D5
 #endif /* ATWOOD_CHANNEL_HW */
 
+#ifndef LINUX_MACROS
+#ifndef BIT
+#define BIT(a) (1UL << (a))
+#endif
+#endif /* LINUX_MACROS */
+
 #define FM10K_MAX_QUEUES		256
 #define FM10K_MAX_QUEUES_PF		128
 #define FM10K_MAX_QUEUES_POOL		16
@@ -465,7 +471,7 @@ struct fm10k_hw;
 #define FM10K_VLAN_TABLE_VID_MAX		4096
 #define FM10K_VLAN_TABLE_VSI_MAX		64
 #define FM10K_VLAN_LENGTH_SHIFT			16
-#define FM10K_VLAN_CLEAR			(1 << 15)
+#define FM10K_VLAN_CLEAR			BIT(15)
 #define FM10K_VLAN_ALL \
 	((FM10K_VLAN_TABLE_VID_MAX - 1) << FM10K_VLAN_LENGTH_SHIFT)
 
@@ -762,10 +768,10 @@ struct fm10k_vf_info {
 						 */
 };
 
-#define FM10K_VF_FLAG_ALLMULTI_CAPABLE	((u8)1 << FM10K_XCAST_MODE_ALLMULTI)
-#define FM10K_VF_FLAG_MULTI_CAPABLE	((u8)1 << FM10K_XCAST_MODE_MULTI)
-#define FM10K_VF_FLAG_PROMISC_CAPABLE	((u8)1 << FM10K_XCAST_MODE_PROMISC)
-#define FM10K_VF_FLAG_NONE_CAPABLE	((u8)1 << FM10K_XCAST_MODE_NONE)
+#define FM10K_VF_FLAG_ALLMULTI_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_ALLMULTI))
+#define FM10K_VF_FLAG_MULTI_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_MULTI))
+#define FM10K_VF_FLAG_PROMISC_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_PROMISC))
+#define FM10K_VF_FLAG_NONE_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_NONE))
 #define FM10K_VF_FLAG_CAPABLE(vf_info)	((vf_info)->vf_flags & (u8)0xF)
 #define FM10K_VF_FLAG_ENABLED(vf_info)	((vf_info)->vf_flags >> 4)
 #define FM10K_VF_FLAG_SET_MODE(mode)	((u8)0x10 << (mode))
@@ -816,7 +822,7 @@ struct fm10k_hw {
 	u16 subsystem_vendor_id;
 	u8 revision_id;
 	u32 flags;
-#define FM10K_HW_FLAG_CLOCK_OWNER	(u32)(1 << 0)
+#define FM10K_HW_FLAG_CLOCK_OWNER	BIT(0)
 };
 
 /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
-- 
1.9.3

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

* [PATCH v2 09/16] fm10k/base: do not use CamelCase
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (7 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 08/16] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1 Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 10/16] fm10k/base: use memcpy for mac addr copy Wang Xiao W
                       ` (7 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The upstream Linux kernel community prefers avoiding CamelCase in
variables, function names, etc.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 14 +++++++-------
 drivers/net/fm10k/fm10k_ethdev.c    | 24 ++++++++++++------------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 387d25b..c9885a1 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -531,13 +531,13 @@ struct fm10k_hw;
 #endif
 
 enum fm10k_int_source {
-	fm10k_int_Mailbox	= 0,
-	fm10k_int_PCIeFault	= 1,
-	fm10k_int_SwitchUpDown	= 2,
-	fm10k_int_SwitchEvent	= 3,
-	fm10k_int_SRAM		= 4,
-	fm10k_int_VFLR		= 5,
-	fm10k_int_MaxHoldTime	= 6,
+	fm10k_int_mailbox		= 0,
+	fm10k_int_pcie_fault		= 1,
+	fm10k_int_switch_up_down	= 2,
+	fm10k_int_switch_event		= 3,
+	fm10k_int_sram			= 4,
+	fm10k_int_vflr			= 5,
+	fm10k_int_max_hold_time		= 6,
 	fm10k_int_sources_max_pf
 };
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 2c38ce9..a118cf4 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2074,12 +2074,12 @@ fm10k_dev_enable_intr_pf(struct rte_eth_dev *dev)
 	/* Bind all local non-queue interrupt to vector 0 */
 	int_map |= 0;
 
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_Mailbox), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_PCIeFault), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchUpDown), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchEvent), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SRAM), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_VFLR), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_mailbox), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_pcie_fault), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_up_down), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_event), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_sram), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_vflr), int_map);
 
 	/* Enable misc causes */
 	FM10K_WRITE_REG(hw, FM10K_EIMR, FM10K_EIMR_ENABLE(PCA_FAULT) |
@@ -2105,12 +2105,12 @@ fm10k_dev_disable_intr_pf(struct rte_eth_dev *dev)
 
 	int_map |= 0;
 
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_Mailbox), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_PCIeFault), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchUpDown), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchEvent), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SRAM), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_VFLR), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_mailbox), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_pcie_fault), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_up_down), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_event), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_sram), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_vflr), int_map);
 
 	/* Disable misc causes */
 	FM10K_WRITE_REG(hw, FM10K_EIMR, FM10K_EIMR_DISABLE(PCA_FAULT) |
-- 
1.9.3

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

* [PATCH v2 10/16] fm10k/base: use memcpy for mac addr copy
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (8 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 09/16] fm10k/base: do not use CamelCase Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 11/16] fm10k/base: allow removal of is_slot_appropriate function Wang Xiao W
                       ` (6 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Use memcpy instead of copying MAC address byte-by-byte.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 7d48210..a1469aa 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -300,7 +300,6 @@ STATIC s32 fm10k_read_mac_addr_pf(struct fm10k_hw *hw)
 {
 	u8 perm_addr[ETH_ALEN];
 	u32 serial_num;
-	int i;
 
 	DEBUGFUNC("fm10k_read_mac_addr_pf");
 
@@ -324,10 +323,8 @@ STATIC s32 fm10k_read_mac_addr_pf(struct fm10k_hw *hw)
 	perm_addr[4] = (u8)(serial_num >> 8);
 	perm_addr[5] = (u8)(serial_num);
 
-	for (i = 0; i < ETH_ALEN; i++) {
-		hw->mac.perm_addr[i] = perm_addr[i];
-		hw->mac.addr[i] = perm_addr[i];
-	}
+	memcpy(hw->mac.perm_addr, perm_addr, ETH_ALEN);
+	memcpy(hw->mac.addr, perm_addr, ETH_ALEN);
 
 	return FM10K_SUCCESS;
 }
-- 
1.9.3

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

* [PATCH v2 11/16] fm10k/base: allow removal of is_slot_appropriate function
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (9 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 10/16] fm10k/base: use memcpy for mac addr copy Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 12/16] fm10k/base: consistently use VLAN ID when referencing vid variables Wang Xiao W
                       ` (5 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The Linux Kernel provides the OS a call "pcie_get_minimum_link" which
can crawl the PCIe tree and determine the actual minimum link speed of a
device which is a more general check than provided by
is_slot_appropriate. Thus, the upstream driver does not use or want the
is_slot_appropriate function call. Add a NO_IS_SLOT_APPROPRIATE_CHECK
definition which can be defined during strip process to remove the code.
If left undefined (the default) then the code will all be active and no
driver changes should be necessary.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_api.c  | 2 ++
 drivers/net/fm10k/base/fm10k_api.h  | 2 ++
 drivers/net/fm10k/base/fm10k_pf.c   | 4 ++++
 drivers/net/fm10k/base/fm10k_type.h | 2 ++
 drivers/net/fm10k/base/fm10k_vf.c   | 4 ++++
 5 files changed, 14 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_api.c b/drivers/net/fm10k/base/fm10k_api.c
index eb5bdaa..c49d20d 100644
--- a/drivers/net/fm10k/base/fm10k_api.c
+++ b/drivers/net/fm10k/base/fm10k_api.c
@@ -181,6 +181,7 @@ s32 fm10k_get_bus_info(struct fm10k_hw *hw)
 			       FM10K_NOT_IMPLEMENTED);
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -195,6 +196,7 @@ bool fm10k_is_slot_appropriate(struct fm10k_hw *hw)
 	return true;
 }
 
+#endif
 /**
  *  fm10k_update_vlan - Clear VLAN ID to VLAN filter table
  *  @hw: pointer to hardware structure
diff --git a/drivers/net/fm10k/base/fm10k_api.h b/drivers/net/fm10k/base/fm10k_api.h
index 113aef5..2ab3149 100644
--- a/drivers/net/fm10k/base/fm10k_api.h
+++ b/drivers/net/fm10k/base/fm10k_api.h
@@ -44,7 +44,9 @@ s32 fm10k_stop_hw(struct fm10k_hw *hw);
 s32 fm10k_start_hw(struct fm10k_hw *hw);
 s32 fm10k_init_shared_code(struct fm10k_hw *hw);
 s32 fm10k_get_bus_info(struct fm10k_hw *hw);
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 bool fm10k_is_slot_appropriate(struct fm10k_hw *hw);
+#endif
 s32 fm10k_update_vlan(struct fm10k_hw *hw, u32 vid, u8 idx, bool set);
 s32 fm10k_read_mac_addr(struct fm10k_hw *hw);
 void fm10k_update_hw_stats(struct fm10k_hw *hw, struct fm10k_hw_stats *stats);
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index a1469aa..f5cbda4 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -216,6 +216,7 @@ STATIC s32 fm10k_init_hw_pf(struct fm10k_hw *hw)
 	return FM10K_SUCCESS;
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate_pf - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -231,6 +232,7 @@ STATIC bool fm10k_is_slot_appropriate_pf(struct fm10k_hw *hw)
 	       (hw->bus.width == hw->bus_caps.width);
 }
 
+#endif
 /**
  *  fm10k_update_vlan_pf - Update status of VLAN ID in VLAN filter table
  *  @hw: pointer to hardware structure
@@ -2064,7 +2066,9 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
 	mac->ops.init_hw = &fm10k_init_hw_pf;
 	mac->ops.start_hw = &fm10k_start_hw_generic;
 	mac->ops.stop_hw = &fm10k_stop_hw_generic;
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	mac->ops.is_slot_appropriate = &fm10k_is_slot_appropriate_pf;
+#endif
 	mac->ops.update_vlan = &fm10k_update_vlan_pf;
 	mac->ops.read_mac_addr = &fm10k_read_mac_addr_pf;
 	mac->ops.update_uc_addr = &fm10k_update_uc_addr_pf;
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index c9885a1..ba0a184 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -679,7 +679,9 @@ 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 *);
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	bool (*is_slot_appropriate)(struct fm10k_hw *);
+#endif
 	s32 (*update_vlan)(struct fm10k_hw *, u32, u8, bool);
 	s32 (*read_mac_addr)(struct fm10k_hw *);
 	s32 (*update_uc_addr)(struct fm10k_hw *, u16, const u8 *,
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 43eb081..efbdbd1 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -178,6 +178,7 @@ reset_max_queues:
 	return err;
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate_vf - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -194,6 +195,7 @@ STATIC bool fm10k_is_slot_appropriate_vf(struct fm10k_hw *hw)
 	return TRUE;
 }
 
+#endif
 /* This structure defines the attibutes to be parsed below */
 const struct fm10k_tlv_attr fm10k_mac_vlan_msg_attr[] = {
 	FM10K_TLV_ATTR_U32(FM10K_MAC_VLAN_MSG_VLAN),
@@ -648,7 +650,9 @@ s32 fm10k_init_ops_vf(struct fm10k_hw *hw)
 	mac->ops.init_hw = &fm10k_init_hw_vf;
 	mac->ops.start_hw = &fm10k_start_hw_generic;
 	mac->ops.stop_hw = &fm10k_stop_hw_vf;
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	mac->ops.is_slot_appropriate = &fm10k_is_slot_appropriate_vf;
+#endif
 	mac->ops.update_vlan = &fm10k_update_vlan_vf;
 	mac->ops.read_mac_addr = &fm10k_read_mac_addr_vf;
 	mac->ops.update_uc_addr = &fm10k_update_uc_addr_vf;
-- 
1.9.3

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

* [PATCH v2 12/16] fm10k/base: consistently use VLAN ID when referencing vid variables
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (10 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 11/16] fm10k/base: allow removal of is_slot_appropriate function Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 13/16] fm10k/base: fix comment per upstream review changes Wang Xiao W
                       ` (4 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The vid variable name is shorthand for VLAN ID, so we should use this in
comments explaining what is happening.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index f5cbda4..716d7f1 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -970,7 +970,7 @@ err_out:
 	txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
 		  FM10K_TXQCTL_VF | vf_idx;
 
-	/* assign VID */
+	/* assign VLAN ID */
 	for (i = 0; i < queues_per_pool; i++)
 		FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
 
@@ -1215,12 +1215,12 @@ s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *hw, u32 **results,
 }
 
 /**
- * fm10k_iov_select_vid - Select correct default vid
+ * fm10k_iov_select_vid - Select correct default VLAN ID
  * @hw: Pointer to hardware structure
- * @vid: vid to correct
+ * @vid: VLAN ID to correct
  *
- * Will report an error if vid is out of range. For vid = 0, it will return
- * either the pf_vid or sw_vid depending on which one is set.
+ * Will report an error if the VLAN ID is out of range. For VID = 0, it will
+ * return either the pf_vid or sw_vid depending on which one is set.
  */
 STATIC s32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid)
 {
@@ -1783,7 +1783,7 @@ static s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
 	if (!fm10k_glort_valid_pf(hw, glort))
 		return FM10K_ERR_PARAM;
 
-	/* verify VID is valid */
+	/* verify VLAN ID is valid */
 	if (pvid >= FM10K_VLAN_TABLE_VID_MAX)
 		return FM10K_ERR_PARAM;
 
-- 
1.9.3

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

* [PATCH v2 13/16] fm10k/base: fix comment per upstream review changes
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (11 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 12/16] fm10k/base: consistently use VLAN ID when referencing vid variables Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 14/16] fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned Wang Xiao W
                       ` (3 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The comment here was changed during review of upstream patch, and the
new wording is slightly more clear. Re-write the comment in SHARED code
based on this new wording.

Fix a number of mailbox comment issues with function header comments,
lower-case acronyms (i.e. FIFO, TLV), incorrect function names in DEBUGFUNC(),
duplicate comments and a stubbed-out header comment for fm10k_sm_mbx_init.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.c | 61 ++++++++++++++++++++++----------------
 drivers/net/fm10k/base/fm10k_mbx.h |  4 +--
 drivers/net/fm10k/base/fm10k_pf.c  | 12 ++++----
 drivers/net/fm10k/base/fm10k_tlv.h |  4 +--
 4 files changed, 46 insertions(+), 35 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 7d03704..2e70434 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -70,7 +70,7 @@ STATIC u16 fm10k_fifo_unused(struct fm10k_mbx_fifo *fifo)
 }
 
 /**
- *  fm10k_fifo_empty - Test to verify if fifo is empty
+ *  fm10k_fifo_empty - Test to verify if FIFO is empty
  *  @fifo: pointer to FIFO
  *
  *  This function returns true if the FIFO is empty, else false
@@ -85,7 +85,7 @@ STATIC bool fm10k_fifo_empty(struct fm10k_mbx_fifo *fifo)
  *  @fifo: pointer to FIFO
  *  @offset: offset to add to head
  *
- *  This function returns the indices into the fifo based on head + offset
+ *  This function returns the indices into the FIFO based on head + offset
  **/
 STATIC u16 fm10k_fifo_head_offset(struct fm10k_mbx_fifo *fifo, u16 offset)
 {
@@ -97,7 +97,7 @@ STATIC u16 fm10k_fifo_head_offset(struct fm10k_mbx_fifo *fifo, u16 offset)
  *  @fifo: pointer to FIFO
  *  @offset: offset to add to tail
  *
- *  This function returns the indices into the fifo based on tail + offset
+ *  This function returns the indices into the FIFO based on tail + offset
  **/
 STATIC u16 fm10k_fifo_tail_offset(struct fm10k_mbx_fifo *fifo, u16 offset)
 {
@@ -173,7 +173,7 @@ STATIC u16 fm10k_mbx_index_len(struct fm10k_mbx_info *mbx, u16 head, u16 tail)
 /**
  *  fm10k_mbx_tail_add - Determine new tail value with added offset
  *  @mbx: pointer to mailbox
- *  @offset: length to add to head offset
+ *  @offset: length to add to tail offset
  *
  *  This function takes the local tail index and recomputes it for
  *  a given length added as an offset.
@@ -189,7 +189,7 @@ STATIC u16 fm10k_mbx_tail_add(struct fm10k_mbx_info *mbx, u16 offset)
 /**
  *  fm10k_mbx_tail_sub - Determine new tail value with subtracted offset
  *  @mbx: pointer to mailbox
- *  @offset: length to add to head offset
+ *  @offset: length to add to tail offset
  *
  *  This function takes the local tail index and recomputes it for
  *  a given length added as an offset.
@@ -253,7 +253,7 @@ STATIC u16 fm10k_mbx_pushed_tail_len(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_fifo_write_copy - pulls data off of msg and places it in fifo
+ *  fm10k_fifo_write_copy - pulls data off of msg and places it in FIFO
  *  @fifo: pointer to FIFO
  *  @msg: message array to populate
  *  @tail_offset: additional offset to add to tail pointer
@@ -331,7 +331,7 @@ STATIC u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
 	u16 total_len = 0, msg_len;
 	u32 *msg;
 
-	DEBUGFUNC("fm10k_mbx_validate_msg");
+	DEBUGFUNC("fm10k_mbx_validate_msg_size");
 
 	/* length should include previous amounts pushed */
 	len += mbx->pushed;
@@ -353,6 +353,7 @@ STATIC u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
 
 /**
  *  fm10k_mbx_write_copy - pulls data off of Tx FIFO and places it in mbmem
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will take a section of the Tx FIFO and copy it into the
@@ -734,7 +735,7 @@ STATIC bool fm10k_mbx_tx_complete(struct fm10k_mbx_info *mbx)
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
- *  This function dequeues messages and hands them off to the tlv parser.
+ *  This function dequeues messages and hands them off to the TLV parser.
  *  It will return the number of messages processed when called.
  **/
 STATIC u16 fm10k_mbx_dequeue_rx(struct fm10k_hw *hw,
@@ -951,7 +952,7 @@ STATIC void fm10k_mbx_create_fake_disconnect_hdr(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_create_error_msg - Generate a error message
+ *  fm10k_mbx_create_error_msg - Generate an error message
  *  @mbx: pointer to mailbox
  *  @err: local error encountered
  *
@@ -984,7 +985,6 @@ STATIC void fm10k_mbx_create_error_msg(struct fm10k_mbx_info *mbx, s32 err)
 /**
  *  fm10k_mbx_validate_msg_hdr - Validate common fields in the message header
  *  @mbx: pointer to mailbox
- *  @msg: message array to read
  *
  *  This function will parse up the fields in the mailbox header and return
  *  an error if the header contains any of a number of invalid configurations
@@ -1050,11 +1050,12 @@ STATIC s32 fm10k_mbx_validate_msg_hdr(struct fm10k_mbx_info *mbx)
 
 /**
  *  fm10k_mbx_create_reply - Generate reply based on state and remote head
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *  @head: acknowledgement number
  *
  *  This function will generate an outgoing message based on the current
- *  mailbox state and the remote fifo head.  It will return the length
+ *  mailbox state and the remote FIFO head.  It will return the length
  *  of the outgoing message excluding header on success, and a negative value
  *  on error.
  **/
@@ -1130,7 +1131,7 @@ STATIC void fm10k_mbx_reset_work(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_update_max_size - Update the max_size and drop large messages
+ *  fm10k_mbx_update_max_size - Update the max_size and drop any large messages
  *  @mbx: pointer to mailbox
  *  @size: new value for max_size
  *
@@ -1144,7 +1145,7 @@ STATIC void fm10k_mbx_update_max_size(struct fm10k_mbx_info *mbx, u16 size)
 {
 	u16 len;
 
-	DEBUGFUNC("fm10k_mbx_update_max_size_hdr");
+	DEBUGFUNC("fm10k_mbx_update_max_size");
 
 	mbx->max_size = size;
 
@@ -1182,8 +1183,8 @@ STATIC void fm10k_mbx_connect_reset(struct fm10k_mbx_info *mbx)
 
 /**
  *  fm10k_mbx_process_connect - Process connect header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
- *  @msg: message array to process
  *
  *  This function will read an incoming connect header and reply with the
  *  appropriate message.  It will return a value indicating the number of
@@ -1229,6 +1230,7 @@ STATIC s32 fm10k_mbx_process_connect(struct fm10k_hw *hw,
 
 /**
  *  fm10k_mbx_process_data - Process data header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will read an incoming data header and reply with the
@@ -1272,6 +1274,7 @@ STATIC s32 fm10k_mbx_process_data(struct fm10k_hw *hw,
 
 /**
  *  fm10k_mbx_process_disconnect - Process disconnect header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will read an incoming disconnect header and reply with the
@@ -1324,6 +1327,7 @@ STATIC s32 fm10k_mbx_process_disconnect(struct fm10k_hw *hw,
 
 /**
  *  fm10k_mbx_process_error - Process error header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will read an incoming error header and reply with the
@@ -1501,6 +1505,7 @@ STATIC s32 fm10k_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 
 	fm10k_mbx_reset_work(mbx);
 
+	/* initialize header of remote mailbox */
 	fm10k_mbx_create_fake_disconnect_hdr(mbx);
 	FM10K_WRITE_MBX(hw, mbx->mbmem_reg ^ mbx->mbmem_len, mbx->mbx_hdr);
 
@@ -1602,7 +1607,7 @@ STATIC s32 fm10k_mbx_register_handlers(struct fm10k_mbx_info *mbx,
  *  @id: ID reference for PF as it supports up to 64 PF/VF mailboxes
  *
  *  This function initializes the mailbox for use.  It will split the
- *  buffer provided an use that th populate both the Tx and Rx FIFO by
+ *  buffer provided and use that to populate both the Tx and Rx FIFO by
  *  evenly splitting it.  In order to allow for easy masking of head/tail
  *  the value reported in size must be a power of 2 and is reported in
  *  DWORDs, not bytes.  Any invalid values will cause the mailbox to return
@@ -1681,7 +1686,7 @@ s32 fm10k_pfvf_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
  *  fm10k_sm_mbx_create_data_hdr - Generate a mailbox header for local FIFO
  *  @mbx: pointer to mailbox
  *
- *  This function returns a connection mailbox header
+ *  This function returns a data mailbox header
  **/
 STATIC void fm10k_sm_mbx_create_data_hdr(struct fm10k_mbx_info *mbx)
 {
@@ -1748,7 +1753,7 @@ STATIC void fm10k_sm_mbx_connect_reset(struct fm10k_mbx_info *mbx)
  **/
 STATIC s32 fm10k_sm_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 {
-	DEBUGFUNC("fm10k_mbx_connect");
+	DEBUGFUNC("fm10k_sm_mbx_connect");
 
 	/* we cannot connect an uninitialized mailbox */
 	if (!mbx->rx.buffer)
@@ -1776,8 +1781,6 @@ STATIC s32 fm10k_sm_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 	fm10k_sm_mbx_create_connect_hdr(mbx, 0);
 	fm10k_mbx_write(hw, mbx);
 
-	/* enable interrupt and notify other party of new message */
-
 	return FM10K_SUCCESS;
 }
 
@@ -1823,7 +1826,7 @@ STATIC void fm10k_sm_mbx_disconnect(struct fm10k_hw *hw,
 }
 
 /**
- *  fm10k_mbx_validate_fifo_hdr - Validate fields in the remote FIFO header
+ *  fm10k_sm_mbx_validate_fifo_hdr - Validate fields in the remote FIFO header
  *  @mbx: pointer to mailbox
  *
  *  This function will parse up the fields in the mailbox header and return
@@ -1835,7 +1838,7 @@ STATIC s32 fm10k_sm_mbx_validate_fifo_hdr(struct fm10k_mbx_info *mbx)
 	const u32 *hdr = &mbx->mbx_hdr;
 	u16 tail, head, ver;
 
-	DEBUGFUNC("fm10k_mbx_validate_msg_hdr");
+	DEBUGFUNC("fm10k_sm_mbx_validate_fifo_hdr");
 
 	tail = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_TAIL);
 	ver = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_VER);
@@ -1903,7 +1906,7 @@ STATIC void fm10k_sm_mbx_process_error(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_sm_mbx_create_error_message - Process an error in FIFO hdr
+ *  fm10k_sm_mbx_create_error_msg - Process an error in FIFO header
  *  @mbx: pointer to mailbox
  *  @err: local error encountered
  *
@@ -1933,6 +1936,7 @@ STATIC void fm10k_sm_mbx_create_error_msg(struct fm10k_mbx_info *mbx, s32 err)
  *  fm10k_sm_mbx_receive - Take message from Rx mailbox FIFO and put it in Rx
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
+ *  @tail: tail index of message
  *
  *  This function will dequeue one message from the Rx switch manager mailbox
  *  FIFO and place it in the Rx mailbox FIFO for processing by software.
@@ -1974,6 +1978,7 @@ STATIC s32 fm10k_sm_mbx_receive(struct fm10k_hw *hw,
  *  fm10k_sm_mbx_transmit - Take message from Tx and put it in Tx mailbox FIFO
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
+ *  @head: head index of message
  *
  *  This function will dequeue one message from the Tx mailbox FIFO and place
  *  it in the Tx switch manager mailbox FIFO for processing by hardware.
@@ -2015,11 +2020,12 @@ STATIC void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,
 
 /**
  *  fm10k_sm_mbx_create_reply - Generate reply based on state and remote head
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *  @head: acknowledgement number
  *
  *  This function will generate an outgoing message based on the current
- *  mailbox state and the remote fifo head.  It will return the length
+ *  mailbox state and the remote FIFO head.  It will return the length
  *  of the outgoing message excluding header on success, and a negative value
  *  on error.
  **/
@@ -2131,7 +2137,7 @@ send_reply:
 }
 
 /**
- *  fm10k_sm_mbx_process - Process mailbox switch mailbox interrupt
+ *  fm10k_sm_mbx_process - Process switch manager mailbox interrupt
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
@@ -2189,7 +2195,12 @@ fifo_err:
  *  @mbx: pointer to mailbox
  *  @msg_data: handlers for mailbox events
  *
- *  This function for now is used to stub out the PF/SM mailbox
+ *  This function initializes the PF/SM mailbox for use.  It will split the
+ *  buffer provided and use that to populate both the Tx and Rx FIFO by
+ *  evenly splitting it.  In order to allow for easy masking of head/tail
+ *  the value reported in size must be a power of 2 and is reported in
+ *  DWORDs, not bytes.  Any invalid values will cause the mailbox to return
+ *  error.
  **/
 s32 fm10k_sm_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
 		      const struct fm10k_msg_data *msg_data)
diff --git a/drivers/net/fm10k/base/fm10k_mbx.h b/drivers/net/fm10k/base/fm10k_mbx.h
index 4b22f0e..e642c2f 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.h
+++ b/drivers/net/fm10k/base/fm10k_mbx.h
@@ -144,11 +144,11 @@ enum fm10k_mbx_state {
  *		The maximum message size is provided during connect to avoid
  *		jamming the mailbox with messages that do not fit.
  * Err_no: Error number - Applies only to error headers
- *		The error number provides a indication of the type of error
+ *		The error number provides an indication of the type of error
  *		experienced.
  */
 
-/* macros for retriving and setting header values */
+/* macros for retrieving and setting header values */
 #define FM10K_MSG_HDR_MASK(name) \
 	((0x1u << FM10K_MSG_##name##_SIZE) - 1)
 #define FM10K_MSG_HDR_FIELD_SET(value, name) \
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 716d7f1..456fe64 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1105,7 +1105,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 		FM10K_WRITE_REG(hw, FM10K_RQMAP(qmap_idx + i), vf_q_idx + i);
 	}
 
-	/* repeat the first ring for all of the remaining VF rings */
+	/* repeat the first ring for all the remaining VF rings */
 	for (i = queues_per_pool; i < qmap_stride; i++) {
 		FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx + i), vf_q_idx);
 		FM10K_WRITE_REG(hw, FM10K_RQMAP(qmap_idx + i), vf_q_idx);
@@ -1246,9 +1246,9 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 			      struct fm10k_mbx_info *mbx)
 {
 	struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx;
-	int err = FM10K_SUCCESS;
 	u8 mac[ETH_ALEN];
 	u32 *result;
+	int err = FM10K_SUCCESS;
 	bool set;
 	u16 vlan;
 	u32 vid;
@@ -1427,10 +1427,10 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 			err = fm10k_update_lport_state_pf(hw, vf_info->glort,
 							  1, false);
 
-		/* need to clear VF_FLAG_ENABLED in order to ensure that we
-		 * actually re-enable the lport state below. Note that this
-		 * has no impact if VF is already disabled, as the flags are
-		 * already zeroed.
+		/* we need to clear VF_FLAG_ENABLED flags in order to ensure
+		 * that we actually re-enable the LPORT state below. Note that
+		 * this has no impact if the VF is already disabled, as the
+		 * flags are already cleared.
 		 */
 		if (!err)
 			vf_info->vf_flags = FM10K_VF_FLAG_CAPABLE(vf_info);
diff --git a/drivers/net/fm10k/base/fm10k_tlv.h b/drivers/net/fm10k/base/fm10k_tlv.h
index a297bb8..8f85fce 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.h
+++ b/drivers/net/fm10k/base/fm10k_tlv.h
@@ -51,9 +51,9 @@ struct fm10k_msg_data;
  * mailbox size we will provide a message with the above header and it
  * will be segmented and transported to the mailbox to the other side where
  * it is reassembled.  It contains the following fields:
- * Len: Length of the message in bytes excluding the message header
+ * Length: Length of the message in bytes excluding the message header
  * Flags: TBD
- * Rule: These will be the message/argument types we pass
+ * Type/ID: These will be the message/argument types we pass
  */
 /* message data header */
 #define FM10K_TLV_ID_SHIFT		0
-- 
1.9.3

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

* [PATCH v2 14/16] fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (12 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 13/16] fm10k/base: fix comment per upstream review changes Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 15/16] fm10k/base: move constants to the right of binary operators Wang Xiao W
                       ` (2 subsequent siblings)
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Per comments from an upstream patch, and looking at how TLV LE_STRUCT
code works, we actually want these structures to be 4byte aligned, not
1byte aligned. In practice, 1byte alignment has worked so far because
all our structures end up being a multiple of 4. But if a future TLV
structure were added that had a u8 or similar sticking on the end things
would break. Fix this by using 4byte alignment which will prevent the
TLV LE_STRUCT code from breaking. Update the comment explaining that we
need 4byte alignment of our structures.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index 92e2962..ee8527a 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -91,14 +91,14 @@ enum fm10k_pf_tlv_attr_id_v1 {
 #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT	16
 #define FM10K_MSG_UPDATE_PVID_PVID_SIZE		16
 
-/* The following data structures are overlayed specifically to TLV mailbox
- * messages, and must not have gaps between their values. They must line up
- * correctly to the TLV definition.
+/* 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.
  */
 #ifdef C99
-#pragma pack(push, 1)
+#pragma pack(push, 4)
 #else
-#pragma pack(1)
+#pragma pack(4)
 #endif /* C99 */
 
 struct fm10k_mac_update {
-- 
1.9.3

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

* [PATCH v2 15/16] fm10k/base: move constants to the right of binary operators
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (13 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 14/16] fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-01-27  3:50     ` [PATCH v2 16/16] fm10k/base: minor cleanups Wang Xiao W
  2016-02-16  8:11     ` [PATCH v2 00/16] fm10k: update shared code Chen, Jing D
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The upstream Linux kernel community prefers constants are to the right of
binary operators.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 456fe64..105babf 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -759,8 +759,8 @@ STATIC s32 fm10k_iov_assign_resources_pf(struct fm10k_hw *hw, u16 num_vfs,
 					FM10K_RXDCTL_WRITE_BACK_MIN_DELAY |
 					FM10K_RXDCTL_DROP_ON_EMPTY);
 			FM10K_WRITE_REG(hw, FM10K_RXQCTL(vf_q_idx),
-					FM10K_RXQCTL_VF |
-					(i << FM10K_RXQCTL_VF_SHIFT));
+					(i << FM10K_RXQCTL_VF_SHIFT) |
+					FM10K_RXQCTL_VF);
 
 			/* map queue pair to VF */
 			FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);
@@ -1035,7 +1035,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 	txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) |
 		 (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
 		 FM10K_TXQCTL_VF | vf_idx;
-	rxqctl = FM10K_RXQCTL_VF | (vf_idx << FM10K_RXQCTL_VF_SHIFT);
+	rxqctl = (vf_idx << FM10K_RXQCTL_VF_SHIFT) | FM10K_RXQCTL_VF;
 
 	/* stop further DMA and reset queue ownership back to VF */
 	for (i = vf_q_idx; i < (queues_per_pool + vf_q_idx); i++) {
-- 
1.9.3

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

* [PATCH v2 16/16] fm10k/base: minor cleanups
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (14 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 15/16] fm10k/base: move constants to the right of binary operators Wang Xiao W
@ 2016-01-27  3:50     ` Wang Xiao W
  2016-02-16  8:11     ` [PATCH v2 00/16] fm10k: update shared code Chen, Jing D
  16 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-01-27  3:50 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Some cleanups to better reflect the code that was actually pushed out to
the upstream Linux community.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.h  |   7 --
 drivers/net/fm10k/base/fm10k_pf.h   |   4 --
 drivers/net/fm10k/base/fm10k_type.h | 132 ------------------------------------
 3 files changed, 143 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.h b/drivers/net/fm10k/base/fm10k_mbx.h
index e642c2f..edc57df 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.h
+++ b/drivers/net/fm10k/base/fm10k_mbx.h
@@ -48,7 +48,6 @@ struct fm10k_mbx_info;
 /* XOR provides means of switching from Tx to Rx FIFO */
 #define FM10K_MBMEM_PF_XOR	(FM10K_MBMEM_SM(0) ^ FM10K_MBMEM_PF(0))
 #define FM10K_MBX(_n)		((_n) + 0x18800)
-#define FM10K_MBX_OWNER				0x00000001
 #define FM10K_MBX_REQ				0x00000002
 #define FM10K_MBX_ACK				0x00000004
 #define FM10K_MBX_REQ_INTERRUPT			0x00000008
@@ -213,7 +212,6 @@ enum fm10k_msg_type {
 /* version number for switch manager mailboxes */
 #define FM10K_SM_MBX_VERSION		1
 #define FM10K_SM_MBX_FIFO_LEN		(FM10K_MBMEM_PF_XOR - 1)
-#define FM10K_SM_MBX_FIFO_HDR_LEN	1
 
 /* offsets shared between all SM FIFO headers */
 #define FM10K_MSG_SM_TAIL_SHIFT			0
@@ -233,18 +231,13 @@ enum fm10k_msg_type {
  */
 #define FM10K_MBX_ERR(_n) ((_n) - 512)
 #define FM10K_MBX_ERR_NO_MBX		FM10K_MBX_ERR(0x01)
-#define FM10K_MBX_ERR_NO_MSG		FM10K_MBX_ERR(0x02)
 #define FM10K_MBX_ERR_NO_SPACE		FM10K_MBX_ERR(0x03)
-#define FM10K_MBX_ERR_LOCK		FM10K_MBX_ERR(0x04)
 #define FM10K_MBX_ERR_TAIL		FM10K_MBX_ERR(0x05)
 #define FM10K_MBX_ERR_HEAD		FM10K_MBX_ERR(0x06)
-#define FM10K_MBX_ERR_DST		FM10K_MBX_ERR(0x07)
 #define FM10K_MBX_ERR_SRC		FM10K_MBX_ERR(0x08)
 #define FM10K_MBX_ERR_TYPE		FM10K_MBX_ERR(0x09)
-#define FM10K_MBX_ERR_LEN		FM10K_MBX_ERR(0x0A)
 #define FM10K_MBX_ERR_SIZE		FM10K_MBX_ERR(0x0B)
 #define FM10K_MBX_ERR_BUSY		FM10K_MBX_ERR(0x0C)
-#define FM10K_MBX_ERR_VALUE		FM10K_MBX_ERR(0x0D)
 #define FM10K_MBX_ERR_RSVD0		FM10K_MBX_ERR(0x0E)
 #define FM10K_MBX_ERR_CRC		FM10K_MBX_ERR(0x0F)
 
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index ee8527a..c84b1bc 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -140,10 +140,6 @@ struct fm10k_swapi_1588_clock_owner {
 #pragma pack()
 #endif /* C99 */
 
-#define FM10K_PF_MSG_LPORT_CREATE_HANDLER(func) \
-	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_CREATE, NULL, func)
-#define FM10K_PF_MSG_LPORT_DELETE_HANDLER(func) \
-	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_DELETE, NULL, func)
 s32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
 extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
 #define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index ba0a184..3fc8f13 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -40,7 +40,6 @@ struct fm10k_hw;
 #include "fm10k_osdep.h"
 #include "fm10k_mbx.h"
 
-#define FM10K_INTEL_VENDOR_ID		0x8086
 #define FM10K_DEV_ID_PF			0x15A4
 #define FM10K_DEV_ID_VF			0x15A5
 #ifdef BOULDER_RAPIDS_HW
@@ -121,28 +120,16 @@ struct fm10k_hw;
 #define FM10K_CTRL_BAR4_ALLOWED			0x00000004
 
 #define FM10K_CTRL_EXT		0x0001
-#define FM10K_CTRL_EXT_NS_DIS			0x00000001
-#define FM10K_CTRL_EXT_RO_DIS			0x00000002
-#define FM10K_CTRL_EXT_SWITCH_LOOPBACK		0x00000004
-#define FM10K_EXVET		0x0002
-#define FM10K_EXVET_ETHERTYPE_MASK		0x000000FF
-#define FM10K_EXVET_TAG_SIZE_SHIFT		16
-#define FM10K_EXVET_AFTER_VLAN			0x00040000
 #define FM10K_GCR		0x0003
-#define FM10K_FACTPS		0x0004
 #define FM10K_GCR_EXT		0x0005
 
 /* Interrupt control registers */
 #define FM10K_EICR		0x0006
-#define FM10K_EICR_PCA_FAULT			0x00000001
-#define FM10K_EICR_THI_FAULT			0x00000004
-#define FM10K_EICR_FUM_FAULT			0x00000020
 #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
-#define FM10K_EICR_SRAMERROR			0x00000400
 #define FM10K_EICR_VFLR				0x00000800
 #define FM10K_EICR_MAXHOLDTIME			0x00001000
 #define FM10K_EIMR		0x0007
@@ -196,7 +183,6 @@ 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)
@@ -217,38 +203,23 @@ struct fm10k_hw;
 #define FM10K_TC_RATE_INTERVAL_4US_GEN1		0x00020000
 #define FM10K_TC_RATE_INTERVAL_4US_GEN2		0x00040000
 #define FM10K_TC_RATE_INTERVAL_4US_GEN3		0x00080000
-#define FM10K_TC_RATE_STATUS	0x20C0
-#define FM10K_PAUSE		0x20C2
 
 /* DMA control registers */
 #define FM10K_DMA_CTRL		0x20C3
 #define FM10K_DMA_CTRL_TX_ENABLE		0x00000001
-#define FM10K_DMA_CTRL_TX_HOST_PENDING		0x00000002
-#define FM10K_DMA_CTRL_TX_DATA			0x00000004
 #define FM10K_DMA_CTRL_TX_ACTIVE		0x00000008
 #define FM10K_DMA_CTRL_RX_ENABLE		0x00000010
-#define FM10K_DMA_CTRL_RX_HOST_PENDING		0x00000020
-#define FM10K_DMA_CTRL_RX_DATA			0x00000040
 #define FM10K_DMA_CTRL_RX_ACTIVE		0x00000080
 #define FM10K_DMA_CTRL_RX_DESC_SIZE		0x00000100
-#define FM10K_DMA_CTRL_MINMSS_SHIFT		9
 #define FM10K_DMA_CTRL_MINMSS_64		0x00008000
-#define FM10K_DMA_CTRL_MAX_HOLD_TIME_SHIFT	23
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN3	0x04800000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN2	0x04000000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN1	0x03800000
 #define FM10K_DMA_CTRL_DATAPATH_RESET		0x20000000
-#define FM10K_DMA_CTRL_MAXNUMOFQ_MASK		0xC0000000
 #define FM10K_DMA_CTRL_32_DESC			0x00000000
-#define FM10K_DMA_CTRL_64_DESC			0x40000000
-#define FM10K_DMA_CTRL_128_DESC			0x80000000
 
 #define FM10K_DMA_CTRL2		0x20C4
-#define FM10K_DMA_CTRL2_TX_FRAME_SPACING_SHIFT	5
 #define FM10K_DMA_CTRL2_SWITCH_READY		0x00002000
-#define FM10K_DMA_CTRL2_RX_DESC_READ_PRIO_SHIFT	14
-#define FM10K_DMA_CTRL2_TX_DESC_READ_PRIO_SHIFT	17
-#define FM10K_DMA_CTRL2_TX_DATA_READ_PRIO_SHIFT	20
 
 /* TSO flags configuration
  * First packet contains all flags except for fin and psh
@@ -261,7 +232,6 @@ struct fm10k_hw;
 #define FM10K_DTXTCPFLGH	0x20C6
 
 #define FM10K_TPH_CTRL		0x20C7
-#define FM10K_TPH_CTRL_DISABLE_READ_HINT	0x00000080
 #define FM10K_MRQC(_n)		((_n) + 0x2100)
 #define FM10K_MRQC_TCP_IPV4			0x00000001
 #define FM10K_MRQC_IPV4				0x00000002
@@ -273,7 +243,6 @@ struct fm10k_hw;
 #define FM10K_TQMAP(_n)		((_n) + 0x2800)
 #define FM10K_TQMAP_TABLE_SIZE			2048
 #define FM10K_RQMAP(_n)		((_n) + 0x3000)
-#define FM10K_RQMAP_TABLE_SIZE			2048
 
 /* Hardware Statistics */
 #define FM10K_STATS_TIMEOUT		0x3800
@@ -286,16 +255,11 @@ struct fm10k_hw;
 #define FM10K_STATS_NODESC_DROP		0x3807
 
 /* Timesync registers */
-#define FM10K_RRTIME_CFG	0x3808
-#define FM10K_RRTIME_LIMIT(_n)	((_n) + 0x380C)
-#define FM10K_RRTIME_COUNT(_n)	((_n) + 0x3810)
 #define FM10K_SYSTIME		0x3814
-#define FM10K_SYSTIME0		0x3816
 #define FM10K_SYSTIME_CFG	0x3818
 #define FM10K_SYSTIME_CFG_STEP_MASK		0x0000000F
 
 /* PCIe state registers */
-#define FM10K_PFVFBME(_n)	((_n) + 0x381A)
 #define FM10K_PHYADDR		0x381C
 
 /* Rx ring registers */
@@ -304,8 +268,6 @@ struct fm10k_hw;
 #define FM10K_RDLEN(_n)		((0x40 * (_n)) + 0x4002)
 #define FM10K_TPH_RXCTRL(_n)	((0x40 * (_n)) + 0x4003)
 #define FM10K_TPH_RXCTRL_DESC_TPHEN		0x00000020
-#define FM10K_TPH_RXCTRL_HDR_TPHEN		0x00000040
-#define FM10K_TPH_RXCTRL_DATA_TPHEN		0x00000080
 #define FM10K_TPH_RXCTRL_DESC_RROEN		0x00000200
 #define FM10K_TPH_RXCTRL_DATA_WROEN		0x00002000
 #define FM10K_TPH_RXCTRL_HDR_WROEN		0x00008000
@@ -319,27 +281,10 @@ struct fm10k_hw;
 #define FM10K_RXQCTL_ID_MASK	(FM10K_RXQCTL_PF | FM10K_RXQCTL_VF)
 #define FM10K_RXDCTL(_n)	((0x40 * (_n)) + 0x4007)
 #define FM10K_RXDCTL_WRITE_BACK_MIN_DELAY	0x00000001
-#define FM10K_RXDCTL_WRITE_BACK_IMM		0x00000100
 #define FM10K_RXDCTL_DROP_ON_EMPTY		0x00000200
 #define FM10K_RXINT(_n)		((0x40 * (_n)) + 0x4008)
-#define FM10K_RXINT_TIMER_SHIFT			8
 #define FM10K_SRRCTL(_n)	((0x40 * (_n)) + 0x4009)
 #define FM10K_SRRCTL_BSIZEPKT_SHIFT		8 /* shift _right_ */
-#define FM10K_SRRCTL_BSIZEHDR_SHIFT		2 /* shift _left_ */
-#define FM10K_SRRCTL_BSIZEHDR_MASK		0x00003F00
-#define FM10K_SRRCTL_DESCTYPE_HDR_SPLIT		0x00004000
-#define FM10K_SRRCTL_DESCTYPE_SIZE_SPLIT	0x00008000
-#define FM10K_SRRCTL_PSRTYPE_INNER_TCPHDR	0x00010000
-#define FM10K_SRRCTL_PSRTYPE_INNER_UDPHDR	0x00020000
-#define FM10K_SRRCTL_PSRTYPE_INNER_IPV4HDR	0x00040000
-#define FM10K_SRRCTL_PSRTYPE_INNER_IPV6HDR	0x00080000
-#define FM10K_SRRCTL_PSRTYPE_INNER_L2HDR	0x00100000
-#define FM10K_SRRCTL_PSRTYPE_ENCAPHDR		0x00200000
-#define FM10K_SRRCTL_PSRTYPE_TCPHDR		0x00400000
-#define FM10K_SRRCTL_PSRTYPE_UDPHDR		0x00800000
-#define FM10K_SRRCTL_PSRTYPE_IPV4HDR		0x01000000
-#define FM10K_SRRCTL_PSRTYPE_IPV6HDR		0x02000000
-#define FM10K_SRRCTL_PSRTYPE_L2HDR		0x04000000
 #define FM10K_SRRCTL_LOOPBACK_SUPPRESS		0x40000000
 #define FM10K_SRRCTL_BUFFER_CHAINING_EN		0x80000000
 
@@ -380,7 +325,6 @@ struct fm10k_hw;
 #define FM10K_TXDCTL(_n)	((0x40 * (_n)) + 0x8006)
 #define FM10K_TXDCTL_ENABLE			0x00004000
 #define FM10K_TXDCTL_MAX_TIME_SHIFT		16
-#define FM10K_TXDCTL_PUSH_DESC			0x10000000
 #define FM10K_TXQCTL(_n)	((0x40 * (_n)) + 0x8007)
 #define FM10K_TXQCTL_PF				0x0000003F
 #define FM10K_TXQCTL_VF				0x00000040
@@ -388,13 +332,10 @@ struct fm10k_hw;
 #define FM10K_TXQCTL_PC_SHIFT			7
 #define FM10K_TXQCTL_PC_MASK			0x00000380
 #define FM10K_TXQCTL_TC_SHIFT			10
-#define FM10K_TXQCTL_TC_MASK			0x0000FC00
 #define FM10K_TXQCTL_VID_SHIFT			16
 #define FM10K_TXQCTL_VID_MASK			0x0FFF0000
 #define FM10K_TXQCTL_UNLIMITED_BW		0x10000000
-#define FM10K_TXQCTL_PUSHMODEDIS		0x20000000
 #define FM10K_TXINT(_n)		((0x40 * (_n)) + 0x8008)
-#define FM10K_TXINT_TIMER_SHIFT			8
 
 /* Tx Statistics */
 #define FM10K_QPTC(_n)		((0x40 * (_n)) + 0x8009)
@@ -404,13 +345,7 @@ struct fm10k_hw;
 /* Tx Push registers */
 #define FM10K_TQDLOC(_n)	((0x40 * (_n)) + 0x800C)
 #define FM10K_TQDLOC_BASE_32_DESC		0x08
-#define FM10K_TQDLOC_BASE_64_DESC		0x10
-#define FM10K_TQDLOC_BASE_128_DESC		0x20
 #define FM10K_TQDLOC_SIZE_32_DESC		0x00050000
-#define FM10K_TQDLOC_SIZE_64_DESC		0x00060000
-#define FM10K_TQDLOC_SIZE_128_DESC		0x00070000
-#define FM10K_TQDLOC_SIZE_SHIFT			16
-#define FM10K_TX_DCACHE(_n, _m)	((0x400 * (_n)) + (0x4 * (_m)) + 0x40000)
 
 /* Tx GLORT registers */
 #define FM10K_TX_SGLORT(_n)	((0x40 * (_n)) + 0x800D)
@@ -418,50 +353,27 @@ struct fm10k_hw;
 #define FM10K_PFVTCTL_FTAG_DESC_ENABLE		0x00000001
 
 /* Interrupt moderation and control registers */
-#define FM10K_PBACL(_n)		((_n) + 0x10000)
 #define FM10K_INT_MAP(_n)	((_n) + 0x10080)
 #define FM10K_INT_MAP_TIMER0			0x00000000
 #define FM10K_INT_MAP_TIMER1			0x00000100
 #define FM10K_INT_MAP_IMMEDIATE			0x00000200
 #define FM10K_INT_MAP_DISABLE			0x00000300
-#define FM10K_MSIX_VECTOR_ADDR_LO(_n)	((0x4 * (_n)) + 0x11000)
-#define FM10K_MSIX_VECTOR_ADDR_HI(_n)	((0x4 * (_n)) + 0x11001)
-#define FM10K_MSIX_VECTOR_DATA(_n)	((0x4 * (_n)) + 0x11002)
 #define FM10K_MSIX_VECTOR_MASK(_n)	((0x4 * (_n)) + 0x11003)
 #define FM10K_INT_CTRL		0x12000
 #define FM10K_INT_CTRL_ENABLEMODERATOR		0x00000400
 #define FM10K_ITR(_n)		((_n) + 0x12400)
 #define FM10K_ITR_INTERVAL1_SHIFT		12
-#define FM10K_ITR_TIMER0_EXPIRED		0x01000000
-#define FM10K_ITR_TIMER1_EXPIRED		0x02000000
-#define FM10K_ITR_PENDING0			0x04000000
-#define FM10K_ITR_PENDING1			0x08000000
 #define FM10K_ITR_PENDING2			0x10000000
 #define FM10K_ITR_AUTOMASK			0x20000000
 #define FM10K_ITR_MASK_SET			0x40000000
 #define FM10K_ITR_MASK_CLEAR			0x80000000
 #define FM10K_ITR2(_n)		((0x2 * (_n)) + 0x12800)
-#define FM10K_ITR2_LP(_n)	((0x2 * (_n)) + 0x12801)
 #define FM10K_ITR_REG_COUNT			768
 #define FM10K_ITR_REG_COUNT_PF			256
 
 /* Switch manager interrupt registers */
 #define FM10K_IP		0x13000
-#define FM10K_IP_HOT_RESET			0x00000001
-#define FM10K_IP_DEVICE_STATE_CHANGE		0x00000002
-#define FM10K_IP_MAILBOX			0x00000004
-#define FM10K_IP_VPD_REQUEST			0x00000008
-#define FM10K_IP_SRAMERROR			0x00000010
-#define FM10K_IP_PFLR				0x00000020
-#define FM10K_IP_DATAPATHRESET			0x00000040
-#define FM10K_IP_OUTOFRESET			0x00000080
 #define FM10K_IP_NOTINRESET			0x00000100
-#define FM10K_IP_TIMEOUT			0x00000200
-#define FM10K_IP_VFLR				0x00000400
-#define FM10K_IM		0x13001
-#define FM10K_IB		0x13002
-#define FM10K_SRAM_IP		0x13003
-#define FM10K_SRAM_IM		0x13004
 
 /* VLAN registers */
 #define FM10K_VLAN_TABLE(_n, _m)	((0x80 * (_n)) + (_m) + 0x14000)
@@ -499,12 +411,8 @@ struct fm10k_hw;
 #define FM10K_VFINT_MAP		0x00030
 #define FM10K_VFSYSTIME		0x00040
 #define FM10K_VFITR(_n)		((_n) + 0x00060)
-#define FM10K_VFPBACL(_n)	((_n) + 0x00008)
 
 /* Registers contained in BAR 4 for Switch management */
-#define FM10K_SW_SYSTIME_CFG	0x0224C
-#define FM10K_SW_SYSTIME_CFG_STEP_SHIFT		4
-#define FM10K_SW_SYSTIME_CFG_ADJUST_MASK	0xFF000000
 #define FM10K_SW_SYSTIME_ADJUST	0x0224D
 #define FM10K_SW_SYSTIME_ADJUST_MASK		0x3FFFFFFF
 #define FM10K_SW_SYSTIME_ADJUST_DIR_POSITIVE	0x80000000
@@ -777,8 +685,6 @@ struct fm10k_vf_info {
 #define FM10K_VF_FLAG_CAPABLE(vf_info)	((vf_info)->vf_flags & (u8)0xF)
 #define FM10K_VF_FLAG_ENABLED(vf_info)	((vf_info)->vf_flags >> 4)
 #define FM10K_VF_FLAG_SET_MODE(mode)	((u8)0x10 << (mode))
-#define FM10K_VF_FLAG_ENABLED_MODE_SHIFT	4
-#define FM10K_VF_FLAG_SET_MODE_MASK	((u8)0xF0)
 #define FM10K_VF_FLAG_SET_MODE_NONE \
 	FM10K_VF_FLAG_SET_MODE(FM10K_XCAST_MODE_NONE)
 #define FM10K_VF_FLAG_MULTI_ENABLED \
@@ -849,13 +755,11 @@ struct fm10k_tx_desc_cache {
 #define FM10K_TXD_FLAG_INT	0x01
 #define FM10K_TXD_FLAG_TIME	0x02
 #define FM10K_TXD_FLAG_CSUM	0x04
-#define FM10K_TXD_FLAG_CSUM2	0x08
 #define FM10K_TXD_FLAG_FTAG	0x10
 #define FM10K_TXD_FLAG_RS	0x20
 #define FM10K_TXD_FLAG_LAST	0x40
 #define FM10K_TXD_FLAG_DONE	0x80
 
-#define FM10K_TXD_VLAN_PRI_SHIFT	12
 
 /* These macros are meant to enable optimal placement of the RS and INT
  * bits.  It will point us to the last descriptor in the cache for either the
@@ -864,8 +768,6 @@ struct fm10k_tx_desc_cache {
  * in the FIFO to prevent an unnecessary write.
  */
 #define FM10K_TXD_WB_FIFO_SIZE	4
-#define FM10K_TXD_WB_IDX(idx) \
-	(((idx) - 1) | (FM10K_TXD_WB_FIFO_SIZE - 1))
 
 /* Receive Descriptor - 32B */
 union fm10k_rx_desc {
@@ -910,29 +812,6 @@ enum fm10k_rdesc_rss_type {
 	/* Reserved 0x9 - 0xF */
 };
 
-#define FM10K_RXD_PKTTYPE_MASK		0x03F0
-#define FM10K_RXD_PKTTYPE_MASK_L3	0x0070
-#define FM10K_RXD_PKTTYPE_MASK_L4	0x0380
-#define FM10K_RXD_PKTTYPE_SHIFT		4
-#define FM10K_RXD_PKTTYPE_INNER_MASK_L3	0x1C00
-#define FM10K_RXD_PKTTYPE_INNER_MASK_L4	0xE000
-#define FM10K_RXD_PKTTYPE_INNER_SHIFT	10
-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_HDR_INFO_XC_MASK	0x0006
 enum fm10k_rxdesc_xc {
@@ -941,20 +820,11 @@ enum fm10k_rxdesc_xc {
 	FM10K_XC_BROADCAST	= 0x6
 };
 
-#define FM10K_RXD_HDR_INFO_LEN_SHIFT	5
-#define FM10K_RXD_HDR_INFO_SPH		0x8000
 
 #define FM10K_RXD_STATUS_DD		0x0001 /* Descriptor done */
 #define FM10K_RXD_STATUS_EOP		0x0002 /* End of packet */
-#define FM10K_RXD_STATUS_VEXT		0x0004 /* A VLAN tag is present */
-#define FM10K_RXD_STATUS_IPCS		0x0008 /* Indicates IPv4 csum */
 #define FM10K_RXD_STATUS_L4CS		0x0010 /* Indicates an L4 csum */
-#define FM10K_RXD_STATUS_IPCS2		0x0020 /* Inner header IPv4 csum */
 #define FM10K_RXD_STATUS_L4CS2		0x0040 /* Inner header L4 csum */
-#define FM10K_RXD_STATUS_IPFRAG_MASK	0x0180 /* Fragment mask */
-#define FM10K_RXD_STATUS_IPFRAG_CSUM	0x0100 /* Fragment w/ CSUM field */
-#define FM10K_RXD_STATUS_VEXT2		0x0200 /* A custom tag is present */
-#define FM10K_RXD_STATUS_HBO		0x0400 /* header buffer overrun */
 #define FM10K_RXD_STATUS_L4E2		0x0800 /* Inner header L4 csum err */
 #define FM10K_RXD_STATUS_IPE2		0x1000 /* Inner header IPv4 csum err */
 #define FM10K_RXD_STATUS_RXE		0x2000 /* Generic Rx error */
@@ -967,8 +837,6 @@ enum fm10k_rxdesc_xc {
 #define FM10K_RXD_ERR_SWITCH_READY	0x0008 /* Link transition mid-packet */
 #define FM10K_RXD_ERR_TOO_BIG		0x0010 /* Pkt too big for single buf */
 
-#define FM10K_RXD_VLAN_ID_MASK		0x0FFF
-#define FM10K_RXD_VLAN_PRI_SHIFT	FM10K_TXD_VLAN_PRI_SHIFT
 
 struct fm10k_ftag {
 	__be16 swpri_type_user;
-- 
1.9.3

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

* Re: [PATCH v2 00/16] fm10k: update shared code
  2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
                       ` (15 preceding siblings ...)
  2016-01-27  3:50     ` [PATCH v2 16/16] fm10k/base: minor cleanups Wang Xiao W
@ 2016-02-16  8:11     ` Chen, Jing D
  16 siblings, 0 replies; 69+ messages in thread
From: Chen, Jing D @ 2016-02-16  8:11 UTC (permalink / raw)
  To: Wang, Xiao W; +Cc: dev

Hi,

Best Regards,
Mark


> -----Original Message-----
> From: Wang, Xiao W
> Sent: Wednesday, January 27, 2016 11:51 AM
> To: Chen, Jing D
> Cc: dev@dpdk.org; Richardson, Bruce; He, Shaopeng; Wang, Xiao W
> Subject: [PATCH v2 00/16] fm10k: update shared code
> 
> v2:
> * Put the two extra fix patches ahead of the base code patches.
> 
> Wang Xiao W (16):
>   fm10k: use default mailbox message handler for pf
>   fm10k/base: add macro definitions that are needed
>   fm10k/base: cleanup namespace pollution and correct typecast
>   fm10k/base: use bitshift for itr_scale
>   fm10k/base: reset max_queues on init_hw_vf failure
>   fm10k/base: document ITR scale workaround in VF TDLEN register
>   fm10k/base: fix checkpatch warning
>   fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
>   fm10k/base: do not use CamelCase
>   fm10k/base: use memcpy for mac addr copy
>   fm10k/base: allow removal of is_slot_appropriate function
>   fm10k/base: consistently use VLAN ID when referencing vid variables
>   fm10k/base: fix comment per upstream review changes
>   fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned
>   fm10k/base: move constants to the right of binary operators
>   fm10k/base: minor cleanups
> 
>  drivers/net/fm10k/base/fm10k_api.c   |   2 +
>  drivers/net/fm10k/base/fm10k_api.h   |   2 +
>  drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
>  drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
>  drivers/net/fm10k/base/fm10k_osdep.h |  30 ++++++
>  drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
>  drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
>  drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
>  drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
>  drivers/net/fm10k/base/fm10k_type.h  | 182 +++++++--------------------------
> --
>  drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
>  drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
>  12 files changed, 220 insertions(+), 298 deletions(-)
> 
> --
> 1.9.3

Acked-by : Jing Chen <jing.d.chen@intel.com>

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

* Re: [PATCH v2 01/16] fm10k: use default mailbox message handler for pf
  2016-01-27  3:50     ` [PATCH v2 01/16] fm10k: use default mailbox message handler for pf Wang Xiao W
@ 2016-02-16 10:50       ` Bruce Richardson
  2016-02-18 10:25         ` Wang, Xiao W
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
  1 sibling, 1 reply; 69+ messages in thread
From: Bruce Richardson @ 2016-02-16 10:50 UTC (permalink / raw)
  To: Wang Xiao W; +Cc: dev

On Wed, Jan 27, 2016 at 11:50:32AM +0800, Wang Xiao W wrote:
> The new share code makes fm10k_msg_update_pvid_pf function static, so we can
> not refer to it now in fm10k_ethdev.c. The registered pf handler is almost the
> same as the default pf handler, removing it has no impact on mailbox.
> 
> Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>

While the patch itself looks ok, checkpatch gives a warning about the commit
message being too long.

  WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a
  maximum 75 chars per line)
  #6:
  The new share code makes fm10k_msg_update_pvid_pf function static, so we can

  total: 0 errors, 1 warnings, 0 checks, 31 lines checked

Since the next patch breaks compilation, a V3 will be needed, so please fix this
warning in the process. I'd also ask that you run checkpatch on all patches
before submitting and fix any issue raised.

Thanks,
/Bruce

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

* Re: [PATCH v2 02/16] fm10k/base: add macro definitions that are needed
  2016-01-27  3:50     ` [PATCH v2 02/16] fm10k/base: add macro definitions that are needed Wang Xiao W
@ 2016-02-16 10:52       ` Bruce Richardson
  0 siblings, 0 replies; 69+ messages in thread
From: Bruce Richardson @ 2016-02-16 10:52 UTC (permalink / raw)
  To: Wang Xiao W; +Cc: dev

On Wed, Jan 27, 2016 at 11:50:33AM +0800, Wang Xiao W wrote:
> Some macros such as FM10K_RXINT_TIMER_SHIFT are removed in the share
> code drop, but they are needed in dpdk/fm10k. This patch put all these
> necessary macros into fm10k_osdep.h
> 
> Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
> ---
>  drivers/net/fm10k/base/fm10k_osdep.h | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
Compilation fails with this patch applied. Each patch of the set must leave the
repository in a compilable state. Please do a V3 patchset to fix.

Thanks,
/Bruce

  CC fm10k_ethdev.o
In file included from /home/bruce/next-net/dpdk-next-net/drivers/net/fm10k/fm10k.h:43:0,
                   from /home/bruce/next-net/dpdk-next-net/drivers/net/fm10k/fm10k_ethdev.c:41:
/home/bruce/next-net/dpdk-next-net/drivers/net/fm10k/base/fm10k_type.h:904:6: error: nested redefiniti on of ‘enum fm10k_rdesc_pkt_type’
    enum fm10k_rdesc_pkt_type {
          ^
compilation terminated due to -Wfatal-errors.
/home/bruce/next-net/dpdk-next-net/mk/internal/rte.compile-pre.mk:126: recipe for target 'fm10k_ethdev .o' failed
make[5]: *** [fm10k_ethdev.o] Error 1

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

* Re: [PATCH v2 03/16] fm10k/base: cleanup namespace pollution and correct typecast
  2016-01-27  3:50     ` [PATCH v2 03/16] fm10k/base: cleanup namespace pollution and correct typecast Wang Xiao W
@ 2016-02-16 10:55       ` Bruce Richardson
  0 siblings, 0 replies; 69+ messages in thread
From: Bruce Richardson @ 2016-02-16 10:55 UTC (permalink / raw)
  To: Wang Xiao W; +Cc: dev

On Wed, Jan 27, 2016 at 11:50:34AM +0800, Wang Xiao W wrote:
> Correct typecast in fm10k_update_xc_addr_pf.
> 
> Make functions that are only referenced locally static.
> 
> And fix the function header comment for fm10k_tlv_attr_nest_stop() while
> we're at it.
> 
> Wrap fm10k_msg_data fm10k_iov_msg_data_pf[] in the new ifndef
> NO_DEFAULT_SRIOV_MSG_HANDLERS so that drivers with custom SR-IOV
> message handlers can strip it.
> 
> remove unused struct element in struct fm10k_mac_ops.
> 
> Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
> ---

>From the commit message it appears that a lot of things are being crammed into
one patch. Please consider splitting it up, so that each commit just looks at
doing one thing. If there are multiple one-line fixes, it's ok to put them into
a single patch with a generic title like "misc small fixes", but for multi-line
changes, it's best to have one change/fix per patch.

Note also, that for commits fixing problems, a "fixes" line should be included in
the commit message as documented here:
http://dpdk.org/doc/guides/contributing/patches.html#commit-messages-body

Thanks,
/Bruce

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

* Re: [PATCH v2 01/16] fm10k: use default mailbox message handler for pf
  2016-02-16 10:50       ` Bruce Richardson
@ 2016-02-18 10:25         ` Wang, Xiao W
  0 siblings, 0 replies; 69+ messages in thread
From: Wang, Xiao W @ 2016-02-18 10:25 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: dev


> -----Original Message-----
> From: Richardson, Bruce
> Sent: Tuesday, February 16, 2016 6:50 PM
> To: Wang, Xiao W <xiao.w.wang@intel.com>
> Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org; He, Shaopeng
> <shaopeng.he@intel.com>
> Subject: Re: [PATCH v2 01/16] fm10k: use default mailbox message handler for
> pf
> 
> On Wed, Jan 27, 2016 at 11:50:32AM +0800, Wang Xiao W wrote:
> > The new share code makes fm10k_msg_update_pvid_pf function static, so
> > we can not refer to it now in fm10k_ethdev.c. The registered pf
> > handler is almost the same as the default pf handler, removing it has no
> impact on mailbox.
> >
> > Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
> 
> While the patch itself looks ok, checkpatch gives a warning about the commit
> message being too long.
> 
>   WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit
> description (prefer a
>   maximum 75 chars per line)
>   #6:
>   The new share code makes fm10k_msg_update_pvid_pf function static, so we
> can
> 
>   total: 0 errors, 1 warnings, 0 checks, 31 lines checked
> 
> Since the next patch breaks compilation, a V3 will be needed, so please fix this
> warning in the process. I'd also ask that you run checkpatch on all patches
> before submitting and fix any issue raised.

Thanks for the comment, I used an old checkpatch.pl to check the patches, it gave
no warning. I have updated the checkpatch.pl and got the above warning.
I will rework the patch set, thanks again.

> 
> Thanks,
> /Bruce

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

* [PATCH v3 00/18] fm10k: update shared code
  2016-01-27  3:50     ` [PATCH v2 01/16] fm10k: use default mailbox message handler for pf Wang Xiao W
  2016-02-16 10:50       ` Bruce Richardson
@ 2016-02-19 11:06       ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 01/18] fm10k: use default mailbox message handler for PF Wang Xiao W
                           ` (19 more replies)
  1 sibling, 20 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

v3:
* Fixed checkpatch.pl warning about long commit message.
* Fixed the issue of compile failure about part of patches applied.
* Split the misc-small-fixes patch into several patches.

v2:
* Put the two extra fix patches ahead of the base code patches.

This patch set has passed regression test.

Wang Xiao W (18):
  fm10k: use default mailbox message handler for PF
  fm10k/base: correct typecast in fm10k_update_xc_addr_pf
  fm10k/base: cleanup namespace pollution
  fm10k/base: use bitshift for itr_scale
  fm10k/base: reset max_queues on init_hw_vf failure
  fm10k/base: document ITR scale workaround in VF TDLEN register
  fm10k/base: cleanup lines over 80 characters
  fm10k/base: cleanup useless else
  fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
  fm10k/base: do not use CamelCase
  fm10k/base: use memcpy for mac addr copy
  fm10k/base: allow removal of is_slot_appropriate function
  fm10k/base: consistently use VLAN ID when referencing vid variables
  fm10k/base: imporve comment per upstream review changes
  fm10k/base: fix TLV structures alignment
  fm10k/base: move constants to the right of binary operators
  fm10k/base: minor cleanups
  fm10k/base: remove unused struct element

 drivers/net/fm10k/base/fm10k_api.c   |   2 +
 drivers/net/fm10k/base/fm10k_api.h   |   2 +
 drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
 drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
 drivers/net/fm10k/base/fm10k_osdep.h |  32 ++++++
 drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
 drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
 drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
 drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
 drivers/net/fm10k/base/fm10k_type.h  | 182 +++++++----------------------------
 drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
 drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
 12 files changed, 222 insertions(+), 298 deletions(-)

-- 
1.9.3

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

* [PATCH v3 01/18] fm10k: use default mailbox message handler for PF
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 02/18] fm10k/base: correct typecast in fm10k_update_xc_addr_pf Wang Xiao W
                           ` (18 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The new share code makes fm10k_msg_update_pvid_pf function static, so we
can not refer to it now in fm10k_ethdev.c. The registered PF handler is
almost the same as the default PF handler, removing it has no impact on
mailbox.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
---
 drivers/net/fm10k/fm10k_ethdev.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 068a20c..6d929cb 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2501,29 +2501,16 @@ static const struct fm10k_msg_data fm10k_msgdata_vf[] = {
 	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
 };
 
-/* Mailbox message handler in PF */
-static const struct fm10k_msg_data fm10k_msgdata_pf[] = {
-	FM10K_PF_MSG_ERR_HANDLER(XCAST_MODES, fm10k_msg_err_pf),
-	FM10K_PF_MSG_ERR_HANDLER(UPDATE_MAC_FWD_RULE, fm10k_msg_err_pf),
-	FM10K_PF_MSG_LPORT_MAP_HANDLER(fm10k_msg_lport_map_pf),
-	FM10K_PF_MSG_ERR_HANDLER(LPORT_CREATE, fm10k_msg_err_pf),
-	FM10K_PF_MSG_ERR_HANDLER(LPORT_DELETE, fm10k_msg_err_pf),
-	FM10K_PF_MSG_UPDATE_PVID_HANDLER(fm10k_msg_update_pvid_pf),
-	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
-};
-
 static int
 fm10k_setup_mbx_service(struct fm10k_hw *hw)
 {
-	int err;
+	int err = 0;
 
 	/* Initialize mailbox lock */
 	fm10k_mbx_initlock(hw);
 
 	/* Replace default message handler with new ones */
-	if (hw->mac.type == fm10k_mac_pf)
-		err = hw->mbx.ops.register_handlers(&hw->mbx, fm10k_msgdata_pf);
-	else
+	if (hw->mac.type == fm10k_mac_vf)
 		err = hw->mbx.ops.register_handlers(&hw->mbx, fm10k_msgdata_vf);
 
 	if (err) {
-- 
1.9.3

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

* [PATCH v3 02/18] fm10k/base: correct typecast in fm10k_update_xc_addr_pf
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 01/18] fm10k: use default mailbox message handler for PF Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 03/18] fm10k/base: cleanup namespace pollution Wang Xiao W
                           ` (17 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Since the resultant data type of the mac_update.mac_upper field is u16,
it does not make sense to typecast u8 variables to u32 first.

Signed-off-by: Wang Xiao W <xiao.w.wang@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 6e6d71e..4a028f3 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -379,8 +379,8 @@ STATIC s32 fm10k_update_xc_addr_pf(struct fm10k_hw *hw, u16 glort,
 						 ((u32)mac[3] << 16) |
 						 ((u32)mac[4] << 8) |
 						 ((u32)mac[5]));
-	mac_update.mac_upper = FM10K_CPU_TO_LE16(((u32)mac[0] << 8) |
-						 ((u32)mac[1]));
+	mac_update.mac_upper = FM10K_CPU_TO_LE16(((u16)mac[0] << 8) |
+					   ((u16)mac[1]));
 	mac_update.vlan = FM10K_CPU_TO_LE16(vid);
 	mac_update.glort = FM10K_CPU_TO_LE16(glort);
 	mac_update.action = add ? 0 : 1;
-- 
1.9.3

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

* [PATCH v3 03/18] fm10k/base: cleanup namespace pollution
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 01/18] fm10k: use default mailbox message handler for PF Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 02/18] fm10k/base: correct typecast in fm10k_update_xc_addr_pf Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 04/18] fm10k/base: use bitshift for itr_scale Wang Xiao W
                           ` (16 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Make functions that are only referenced locally static.

Wrap fm10k_msg_data fm10k_iov_msg_data_pf[] in the new ifndef
NO_DEFAULT_SRIOV_MSG_HANDLERS so that drivers with custom SR-IOV
message handlers can strip it.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c  |  6 ++++--
 drivers/net/fm10k/base/fm10k_pf.h  |  4 ++--
 drivers/net/fm10k/base/fm10k_tlv.c | 14 +++++++-------
 drivers/net/fm10k/base/fm10k_tlv.h |  5 -----
 drivers/net/fm10k/base/fm10k_vf.c  |  2 --
 5 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 4a028f3..5b8c039 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1457,6 +1457,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 	return err;
 }
 
+#ifndef NO_DEFAULT_SRIOV_MSG_HANDLERS
 const struct fm10k_msg_data fm10k_iov_msg_data_pf[] = {
 	FM10K_TLV_MSG_TEST_HANDLER(fm10k_tlv_msg_test),
 	FM10K_VF_MSG_MSIX_HANDLER(fm10k_iov_msg_msix_pf),
@@ -1465,6 +1466,7 @@ const struct fm10k_msg_data fm10k_iov_msg_data_pf[] = {
 	FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
 };
 
+#endif
 /**
  *  fm10k_update_stats_hw_pf - Updates hardware related statistics of PF
  *  @hw: pointer to hardware structure
@@ -1754,8 +1756,8 @@ const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[] = {
  *
  *  This handler configures the default VLAN for the PF
  **/
-s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
-			     struct fm10k_mbx_info *mbx)
+static s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
+				    struct fm10k_mbx_info *mbx)
 {
 	u16 glort, pvid;
 	u32 pvid_update;
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index 44bd193..92e2962 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -149,8 +149,6 @@ extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
 #define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
 	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_MAP, \
 			  fm10k_lport_map_msg_attr, func)
-s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *, u32 **,
-			     struct fm10k_mbx_info *);
 extern const struct fm10k_tlv_attr fm10k_update_pvid_msg_attr[];
 #define FM10K_PF_MSG_UPDATE_PVID_HANDLER(func) \
 	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_UPDATE_PVID, \
@@ -183,7 +181,9 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
 			      struct fm10k_mbx_info *);
 s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *, u32 **,
 				 struct fm10k_mbx_info *);
+#ifndef NO_DEFAULT_SRIOV_MSG_HANDLERS
 extern const struct fm10k_msg_data fm10k_iov_msg_data_pf[];
+#endif
 
 s32 fm10k_init_ops_pf(struct fm10k_hw *hw);
 #endif /* _FM10K_PF_H */
diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c
index 1d9d7d8..4b5f684 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.c
+++ b/drivers/net/fm10k/base/fm10k_tlv.c
@@ -63,8 +63,8 @@ s32 fm10k_tlv_msg_init(u32 *msg, u16 msg_id)
  *  the attribute buffer.  It will return success if provided with a valid
  *  pointers.
  **/
-s32 fm10k_tlv_attr_put_null_string(u32 *msg, u16 attr_id,
-				   const unsigned char *string)
+static s32 fm10k_tlv_attr_put_null_string(u32 *msg, u16 attr_id,
+					  const unsigned char *string)
 {
 	u32 attr_data = 0, len = 0;
 	u32 *attr;
@@ -115,7 +115,7 @@ s32 fm10k_tlv_attr_put_null_string(u32 *msg, u16 attr_id,
  *  it in the array pointed by by string.  It will return success if provided
  *  with a valid pointers.
  **/
-s32 fm10k_tlv_attr_get_null_string(u32 *attr, unsigned char *string)
+static s32 fm10k_tlv_attr_get_null_string(u32 *attr, unsigned char *string)
 {
 	u32 len;
 
@@ -386,7 +386,7 @@ s32 fm10k_tlv_attr_get_le_struct(u32 *attr, void *le_struct, u32 len)
  *  function will return NULL on failure, and a pointer to the start
  *  of the nested attributes on success.
  **/
-u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
+static u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
 {
 	u32 *attr;
 
@@ -413,7 +413,7 @@ u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
  *  the case of a nest within the nest this would be the outer nest pointer.
  *  This function will return success provided all pointers are valid.
  **/
-s32 fm10k_tlv_attr_nest_stop(u32 *msg)
+static s32 fm10k_tlv_attr_nest_stop(u32 *msg)
 {
 	u32 *attr;
 	u32 len;
@@ -522,8 +522,8 @@ STATIC s32 fm10k_tlv_attr_validate(u32 *attr,
  *  FM10K_NOT_IMPLEMENTED for any attribute that is outside of the array
  *  and 0 on success.
  **/
-s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
-			 const struct fm10k_tlv_attr *tlv_attr)
+static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
+				const struct fm10k_tlv_attr *tlv_attr)
 {
 	u32 i, attr_id, offset = 0;
 	s32 err = 0;
diff --git a/drivers/net/fm10k/base/fm10k_tlv.h b/drivers/net/fm10k/base/fm10k_tlv.h
index ad97236..a297bb8 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.h
+++ b/drivers/net/fm10k/base/fm10k_tlv.h
@@ -119,8 +119,6 @@ struct fm10k_msg_data {
 #define FM10K_MSG_HANDLER(id, attr, func) { id, attr, func }
 
 s32 fm10k_tlv_msg_init(u32 *, u16);
-s32 fm10k_tlv_attr_put_null_string(u32 *, u16, const unsigned char *);
-s32 fm10k_tlv_attr_get_null_string(u32 *, unsigned char *);
 s32 fm10k_tlv_attr_put_mac_vlan(u32 *, u16, const u8 *, u16);
 s32 fm10k_tlv_attr_get_mac_vlan(u32 *, u8 *, u16 *);
 s32 fm10k_tlv_attr_put_bool(u32 *, u16);
@@ -160,9 +158,6 @@ s32 fm10k_tlv_attr_get_value(u32 *, void *, u32);
 		fm10k_tlv_attr_get_value(attr, ptr, sizeof(s64))
 s32 fm10k_tlv_attr_put_le_struct(u32 *, u16, const void *, u32);
 s32 fm10k_tlv_attr_get_le_struct(u32 *, void *, u32);
-u32 *fm10k_tlv_attr_nest_start(u32 *, u16);
-s32 fm10k_tlv_attr_nest_stop(u32 *);
-s32 fm10k_tlv_attr_parse(u32 *, u32 **, const struct fm10k_tlv_attr *);
 s32 fm10k_tlv_msg_parse(struct fm10k_hw *, u32 *, struct fm10k_mbx_info *,
 			const struct fm10k_msg_data *);
 s32 fm10k_tlv_msg_error(struct fm10k_hw *hw, u32 **results,
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index a46b488..7822ab6 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -414,8 +414,6 @@ const struct fm10k_tlv_attr fm10k_lport_state_msg_attr[] = {
 	FM10K_TLV_ATTR_LAST
 };
 
-extern const struct fm10k_tlv_attr fm10k_1588_msg_attr[];
-
 /**
  *  fm10k_msg_lport_state_vf - Message handler for lport_state message from PF
  *  @hw: Pointer to hardware structure
-- 
1.9.3

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

* [PATCH v3 04/18] fm10k/base: use bitshift for itr_scale
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (2 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 03/18] fm10k/base: cleanup namespace pollution Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 05/18] fm10k/base: reset max_queues on init_hw_vf failure Wang Xiao W
                           ` (15 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Upstream community wishes us to use bitshift instead of a divisor,
because this is faster, and prevents any need for a '0' check. In our
case, this even works out because default Gen3 will be 0.

Because of this, we are also able to remove the check for non-zero value
in the VF code path since that will already be the default Gen3 case.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 6 +++---
 drivers/net/fm10k/base/fm10k_vf.c   | 4 ----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index df1d276..4bc0d53 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -352,9 +352,9 @@ struct fm10k_hw;
 #define FM10K_TDLEN(_n)		((0x40 * (_n)) + 0x8002)
 #define FM10K_TDLEN_ITR_SCALE_SHIFT		9
 #define FM10K_TDLEN_ITR_SCALE_MASK		0x00000E00
-#define FM10K_TDLEN_ITR_SCALE_GEN1		4
-#define FM10K_TDLEN_ITR_SCALE_GEN2		2
-#define FM10K_TDLEN_ITR_SCALE_GEN3		1
+#define FM10K_TDLEN_ITR_SCALE_GEN1		2
+#define FM10K_TDLEN_ITR_SCALE_GEN2		1
+#define FM10K_TDLEN_ITR_SCALE_GEN3		0
 #define FM10K_TPH_TXCTRL(_n)	((0x40 * (_n)) + 0x8003)
 #define FM10K_TPH_TXCTRL_DESC_TPHEN		0x00000020
 #define FM10K_TPH_TXCTRL_DESC_RROEN		0x00000200
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 7822ab6..39bc927 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -159,10 +159,6 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 			     FM10K_TDLEN_ITR_SCALE_MASK) >>
 			    FM10K_TDLEN_ITR_SCALE_SHIFT;
 
-	/* ensure a non-zero itr scale */
-	if (!hw->mac.itr_scale)
-		hw->mac.itr_scale = FM10K_TDLEN_ITR_SCALE_GEN3;
-
 	return FM10K_SUCCESS;
 }
 
-- 
1.9.3

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

* [PATCH v3 05/18] fm10k/base: reset max_queues on init_hw_vf failure
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (3 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 04/18] fm10k/base: use bitshift for itr_scale Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 06/18] fm10k/base: document ITR scale workaround in VF TDLEN register Wang Xiao W
                           ` (14 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

VF drivers must detect how many queues are available. Previously, the
driver assumed that each VF has at minimum 1 queue. This assumption is
incorrect, since it is possible that the PF has not yet assigned the
queues to the VF by the time the VF checks. To resolve this, we added a
check first to ensure that the first queue is infact owned by the VF at
init_hw_vf time. However, the code flow did not reset hw->mac.max_queues
to 0. In some cases, such as during reinit flows, we call init_hw_vf
without clearing the previous value of hw->mac.max_queues. Due to this,
when init_hw_vf errors out, if its error code is not properly handled
the VF driver may still believe it has queues which no longer belong to
it. Fix this by clearing the hw->mac.max_queues on exit due to errors.

Fixes: 20dc3445d100 ("fm10k: do not assume VF always has 1 queue")

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_vf.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 39bc927..9b10ee4 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -128,8 +128,10 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 
 	/* verify we have at least 1 queue */
 	if (!~FM10K_READ_REG(hw, FM10K_TXQCTL(0)) ||
-	    !~FM10K_READ_REG(hw, FM10K_RXQCTL(0)))
-		return FM10K_ERR_NO_RESOURCES;
+	    !~FM10K_READ_REG(hw, FM10K_RXQCTL(0))) {
+		err = FM10K_ERR_NO_RESOURCES;
+		goto reset_max_queues;
+	}
 
 	/* determine how many queues we have */
 	for (i = 1; tqdloc0 && (i < FM10K_MAX_QUEUES_POOL); i++) {
@@ -147,7 +149,7 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 	/* shut down queues we own and reset DMA configuration */
 	err = fm10k_disable_queues_generic(hw, i);
 	if (err)
-		return err;
+		goto reset_max_queues;
 
 	/* record maximum queue count */
 	hw->mac.max_queues = i;
@@ -160,6 +162,11 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 			    FM10K_TDLEN_ITR_SCALE_SHIFT;
 
 	return FM10K_SUCCESS;
+
+reset_max_queues:
+	hw->mac.max_queues = 0;
+
+	return err;
 }
 
 /**
-- 
1.9.3

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

* [PATCH v3 06/18] fm10k/base: document ITR scale workaround in VF TDLEN register
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (4 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 05/18] fm10k/base: reset max_queues on init_hw_vf failure Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 07/18] fm10k/base: cleanup lines over 80 characters Wang Xiao W
                           ` (13 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Add comments which properly explain the undocumented use of bits in
TDLEN register prior to VF initializing it to the correct value. Note
that the mechanism is entirely software-defined and explain its purpose
to help reduce confusion in the future.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 6 +++++-
 drivers/net/fm10k/base/fm10k_type.h | 9 +++++++++
 drivers/net/fm10k/base/fm10k_vf.c   | 9 +++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 5b8c039..6de679e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -958,7 +958,8 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	FM10K_WRITE_REG(hw, FM10K_TDBAH(vf_q_idx), tdbah);
 
 	/* Provide the VF the ITR scale, using software-defined fields in TDLEN
-	 * to pass the information during VF initialization
+	 * to pass the information during VF initialization. See definition of
+	 * FM10K_TDLEN_ITR_SCALE_SHIFT for more details.
 	 */
 	FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx), hw->mac.itr_scale <<
 						   FM10K_TDLEN_ITR_SCALE_SHIFT);
@@ -1095,6 +1096,9 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 	for (i = queues_per_pool; i--;) {
 		FM10K_WRITE_REG(hw, FM10K_TDBAL(vf_q_idx + i), tdbal);
 		FM10K_WRITE_REG(hw, FM10K_TDBAH(vf_q_idx + i), tdbah);
+		/* See definition of FM10K_TDLEN_ITR_SCALE_SHIFT for an
+		 * explanation of how TDLEN is used.
+		 */
 		FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx + i),
 				hw->mac.itr_scale <<
 				FM10K_TDLEN_ITR_SCALE_SHIFT);
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 4bc0d53..4ec18fb 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -350,6 +350,15 @@ struct fm10k_hw;
 #define FM10K_TDBAL(_n)		((0x40 * (_n)) + 0x8000)
 #define FM10K_TDBAH(_n)		((0x40 * (_n)) + 0x8001)
 #define FM10K_TDLEN(_n)		((0x40 * (_n)) + 0x8002)
+/* When fist initialized, VFs need to know the Interrupt Throttle Rate (ITR)
+ * scale which is based on the PCIe speed but the speed information in the PCI
+ * configuration space may not be accurate. The PF already knows the ITR scale
+ * but there is no defined method to pass that information from the PF to the
+ * VF. This is accomplished during VF initialization by temporarily co-opting
+ * the yet-to-be-used TDLEN register to have the PF store the ITR shift for
+ * the VF to retrieve before the VF needs to use the TDLEN register for its
+ * intended purpose, i.e. before the Tx resources are allocated.
+ */
 #define FM10K_TDLEN_ITR_SCALE_SHIFT		9
 #define FM10K_TDLEN_ITR_SCALE_MASK		0x00000E00
 #define FM10K_TDLEN_ITR_SCALE_GEN1		2
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 9b10ee4..43eb081 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -74,6 +74,11 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 		FM10K_WRITE_REG(hw, FM10K_TDBAH(i), bah);
 		FM10K_WRITE_REG(hw, FM10K_RDBAL(i), bal);
 		FM10K_WRITE_REG(hw, FM10K_RDBAH(i), bah);
+		/* Restore ITR scale in software-defined mechanism in TDLEN
+		 * for next VF initialization. See definition of
+		 * FM10K_TDLEN_ITR_SCALE_SHIFT for more details on the use of
+		 * TDLEN here.
+		 */
 		FM10K_WRITE_REG(hw, FM10K_TDLEN(i), tdlen);
 	}
 
@@ -157,6 +162,10 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 	/* fetch default VLAN and ITR scale */
 	hw->mac.default_vid = (FM10K_READ_REG(hw, FM10K_TXQCTL(0)) &
 			       FM10K_TXQCTL_VID_MASK) >> FM10K_TXQCTL_VID_SHIFT;
+	/* Read the ITR scale from TDLEN. See the definition of
+	 * FM10K_TDLEN_ITR_SCALE_SHIFT for more information about how TDLEN is
+	 * used here.
+	 */
 	hw->mac.itr_scale = (FM10K_READ_REG(hw, FM10K_TDLEN(0)) &
 			     FM10K_TDLEN_ITR_SCALE_MASK) >>
 			    FM10K_TDLEN_ITR_SCALE_SHIFT;
-- 
1.9.3

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

* [PATCH v3 07/18] fm10k/base: cleanup lines over 80 characters
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (5 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 06/18] fm10k/base: document ITR scale workaround in VF TDLEN register Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 08/18] fm10k/base: cleanup useless else Wang Xiao W
                           ` (12 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

checkpatch warns about lines over 80 characters.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.c | 2 +-
 drivers/net/fm10k/base/fm10k_pf.c  | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 3c9ab3a..7d03704 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -930,7 +930,7 @@ STATIC void fm10k_mbx_create_disconnect_hdr(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_create_fake_disconnect_hdr - Generate a false disconnect mailbox header
+ *  fm10k_mbx_create_fake_disconnect_hdr - Generate a false disconnect mbox hdr
  *  @mbx: pointer to mailbox
  *
  *  This function creates a fake disconnect header for loading into remote
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 6de679e..8ac91d0 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1500,9 +1500,10 @@ STATIC void fm10k_update_hw_stats_pf(struct fm10k_hw *hw,
 		xec = fm10k_read_hw_stats_32b(hw, FM10K_STATS_XEC, &stats->xec);
 		vlan_drop = fm10k_read_hw_stats_32b(hw, FM10K_STATS_VLAN_DROP,
 						    &stats->vlan_drop);
-		loopback_drop = fm10k_read_hw_stats_32b(hw,
-							FM10K_STATS_LOOPBACK_DROP,
-							&stats->loopback_drop);
+		loopback_drop =
+			fm10k_read_hw_stats_32b(hw,
+						FM10K_STATS_LOOPBACK_DROP,
+						&stats->loopback_drop);
 		nodesc_drop = fm10k_read_hw_stats_32b(hw,
 						      FM10K_STATS_NODESC_DROP,
 						      &stats->nodesc_drop);
-- 
1.9.3

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

* [PATCH v3 08/18] fm10k/base: cleanup useless else
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (6 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 07/18] fm10k/base: cleanup lines over 80 characters Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 09/18] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1 Wang Xiao W
                           ` (11 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

checkpatch warns that else is not generally useful after a break or return.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 8ac91d0..3ee88b6 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1278,8 +1278,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		err = fm10k_iov_select_vid(vf_info, (u16)vid);
 		if (err < 0)
 			return err;
-		else
-			vid = 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);
@@ -1304,8 +1304,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		err = fm10k_iov_select_vid(vf_info, vlan);
 		if (err < 0)
 			return err;
-		else
-			vlan = (u16)err;
+
+		vlan = (u16)err;
 
 		/* notify switch of request for new unicast address */
 		err = hw->mac.ops.update_uc_addr(hw, vf_info->glort,
@@ -1330,8 +1330,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		err = fm10k_iov_select_vid(vf_info, vlan);
 		if (err < 0)
 			return err;
-		else
-			vlan = (u16)err;
+
+		vlan = (u16)err;
 
 		/* notify switch of request for new multicast address */
 		err = hw->mac.ops.update_mc_addr(hw, vf_info->glort,
-- 
1.9.3

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

* [PATCH v3 09/18] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (7 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 08/18] fm10k/base: cleanup useless else Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 10/18] fm10k/base: do not use CamelCase Wang Xiao W
                           ` (10 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The upstream Linux kernel community prefers using the BIT macro over
bit-shifting a 1.  Similar to how this is handled in the i40e shared code,
define a macro for OSes that do not already have it and wrap all that in
LINUX_MACROS so that it can be stripped from the Linux driver.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c   | 12 ++++++------
 drivers/net/fm10k/base/fm10k_tlv.c  | 24 ++++++++++++------------
 drivers/net/fm10k/base/fm10k_type.h | 18 ++++++++++++------
 3 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 3ee88b6..7d48210 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -576,8 +576,8 @@ STATIC s32 fm10k_configure_dglort_map_pf(struct fm10k_hw *hw,
 		return FM10K_ERR_PARAM;
 
 	/* determine count of VSIs and queues */
-	queue_count = 1 << (dglort->rss_l + dglort->pc_l);
-	vsi_count = 1 << (dglort->vsi_l + dglort->queue_l);
+	queue_count = BIT(dglort->rss_l + dglort->pc_l);
+	vsi_count = BIT(dglort->vsi_l + dglort->queue_l);
 	glort = dglort->glort;
 	q_idx = dglort->queue_b;
 
@@ -593,8 +593,8 @@ STATIC s32 fm10k_configure_dglort_map_pf(struct fm10k_hw *hw,
 	}
 
 	/* determine count of PCs and queues */
-	queue_count = 1 << (dglort->queue_l + dglort->rss_l + dglort->vsi_l);
-	pc_count = 1 << dglort->pc_l;
+	queue_count = BIT(dglort->queue_l + dglort->rss_l + dglort->vsi_l);
+	pc_count = BIT(dglort->pc_l);
 
 	/* configure PC for Tx queues */
 	for (pc = 0; pc < pc_count; pc++) {
@@ -1001,7 +1001,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 		return FM10K_ERR_PARAM;
 
 	/* clear event notification of VF FLR */
-	FM10K_WRITE_REG(hw, FM10K_PFVFLREC(vf_idx / 32), 1 << (vf_idx % 32));
+	FM10K_WRITE_REG(hw, FM10K_PFVFLREC(vf_idx / 32), BIT(vf_idx % 32));
 
 	/* force timeout and then disconnect the mailbox */
 	vf_info->mbx.timeout = 0;
@@ -1417,7 +1417,7 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 		mode = fm10k_iov_supported_xcast_mode_pf(vf_info, mode);
 
 		/* if mode is not currently enabled, enable it */
-		if (!(FM10K_VF_FLAG_ENABLED(vf_info) & (1 << mode)))
+		if (!(FM10K_VF_FLAG_ENABLED(vf_info) & BIT(mode)))
 			fm10k_update_xcast_mode_pf(hw, vf_info->glort, mode);
 
 		/* swap mode back to a bit flag */
diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c
index 4b5f684..b9000ae 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.c
+++ b/drivers/net/fm10k/base/fm10k_tlv.c
@@ -249,7 +249,7 @@ s32 fm10k_tlv_attr_put_value(u32 *msg, u16 attr_id, s64 value, u32 len)
 	attr = &msg[FM10K_TLV_DWORD_LEN(*msg)];
 
 	if (len < 4) {
-		attr[1] = (u32)value & ((0x1ul << (8 * len)) - 1);
+		attr[1] = (u32)value & (BIT(8 * len) - 1);
 	} else {
 		attr[1] = (u32)value;
 		if (len > 4)
@@ -699,29 +699,29 @@ STATIC void fm10k_tlv_msg_test_generate_data(u32 *msg, u32 attr_flags)
 {
 	DEBUGFUNC("fm10k_tlv_msg_test_generate_data");
 
-	if (attr_flags & (1 << FM10K_TEST_MSG_STRING))
+	if (attr_flags & BIT(FM10K_TEST_MSG_STRING))
 		fm10k_tlv_attr_put_null_string(msg, FM10K_TEST_MSG_STRING,
 					       test_str);
-	if (attr_flags & (1 << FM10K_TEST_MSG_MAC_ADDR))
+	if (attr_flags & BIT(FM10K_TEST_MSG_MAC_ADDR))
 		fm10k_tlv_attr_put_mac_vlan(msg, FM10K_TEST_MSG_MAC_ADDR,
 					    test_mac, test_vlan);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U8))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U8))
 		fm10k_tlv_attr_put_u8(msg, FM10K_TEST_MSG_U8,  test_u8);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U16))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U16))
 		fm10k_tlv_attr_put_u16(msg, FM10K_TEST_MSG_U16, test_u16);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U32))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U32))
 		fm10k_tlv_attr_put_u32(msg, FM10K_TEST_MSG_U32, test_u32);
-	if (attr_flags & (1 << FM10K_TEST_MSG_U64))
+	if (attr_flags & BIT(FM10K_TEST_MSG_U64))
 		fm10k_tlv_attr_put_u64(msg, FM10K_TEST_MSG_U64, test_u64);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S8))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S8))
 		fm10k_tlv_attr_put_s8(msg, FM10K_TEST_MSG_S8,  test_s8);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S16))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S16))
 		fm10k_tlv_attr_put_s16(msg, FM10K_TEST_MSG_S16, test_s16);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S32))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S32))
 		fm10k_tlv_attr_put_s32(msg, FM10K_TEST_MSG_S32, test_s32);
-	if (attr_flags & (1 << FM10K_TEST_MSG_S64))
+	if (attr_flags & BIT(FM10K_TEST_MSG_S64))
 		fm10k_tlv_attr_put_s64(msg, FM10K_TEST_MSG_S64, test_s64);
-	if (attr_flags & (1 << FM10K_TEST_MSG_LE_STRUCT))
+	if (attr_flags & BIT(FM10K_TEST_MSG_LE_STRUCT))
 		fm10k_tlv_attr_put_le_struct(msg, FM10K_TEST_MSG_LE_STRUCT,
 					     test_le, 8);
 }
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 4ec18fb..98dbf6f 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -50,6 +50,12 @@ struct fm10k_hw;
 #define FM10K_DEV_ID_SDI_FM10420_DA2	0x15D5
 #endif /* ATWOOD_CHANNEL_HW */
 
+#ifndef LINUX_MACROS
+#ifndef BIT
+#define BIT(a) (1UL << (a))
+#endif
+#endif /* LINUX_MACROS */
+
 #define FM10K_MAX_QUEUES		256
 #define FM10K_MAX_QUEUES_PF		128
 #define FM10K_MAX_QUEUES_POOL		16
@@ -465,7 +471,7 @@ struct fm10k_hw;
 #define FM10K_VLAN_TABLE_VID_MAX		4096
 #define FM10K_VLAN_TABLE_VSI_MAX		64
 #define FM10K_VLAN_LENGTH_SHIFT			16
-#define FM10K_VLAN_CLEAR			(1 << 15)
+#define FM10K_VLAN_CLEAR			BIT(15)
 #define FM10K_VLAN_ALL \
 	((FM10K_VLAN_TABLE_VID_MAX - 1) << FM10K_VLAN_LENGTH_SHIFT)
 
@@ -763,10 +769,10 @@ struct fm10k_vf_info {
 						 */
 };
 
-#define FM10K_VF_FLAG_ALLMULTI_CAPABLE	((u8)1 << FM10K_XCAST_MODE_ALLMULTI)
-#define FM10K_VF_FLAG_MULTI_CAPABLE	((u8)1 << FM10K_XCAST_MODE_MULTI)
-#define FM10K_VF_FLAG_PROMISC_CAPABLE	((u8)1 << FM10K_XCAST_MODE_PROMISC)
-#define FM10K_VF_FLAG_NONE_CAPABLE	((u8)1 << FM10K_XCAST_MODE_NONE)
+#define FM10K_VF_FLAG_ALLMULTI_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_ALLMULTI))
+#define FM10K_VF_FLAG_MULTI_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_MULTI))
+#define FM10K_VF_FLAG_PROMISC_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_PROMISC))
+#define FM10K_VF_FLAG_NONE_CAPABLE	(u8)(BIT(FM10K_XCAST_MODE_NONE))
 #define FM10K_VF_FLAG_CAPABLE(vf_info)	((vf_info)->vf_flags & (u8)0xF)
 #define FM10K_VF_FLAG_ENABLED(vf_info)	((vf_info)->vf_flags >> 4)
 #define FM10K_VF_FLAG_SET_MODE(mode)	((u8)0x10 << (mode))
@@ -817,7 +823,7 @@ struct fm10k_hw {
 	u16 subsystem_vendor_id;
 	u8 revision_id;
 	u32 flags;
-#define FM10K_HW_FLAG_CLOCK_OWNER	(u32)(1 << 0)
+#define FM10K_HW_FLAG_CLOCK_OWNER	BIT(0)
 };
 
 /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
-- 
1.9.3

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

* [PATCH v3 10/18] fm10k/base: do not use CamelCase
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (8 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 09/18] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1 Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 11/18] fm10k/base: use memcpy for mac addr copy Wang Xiao W
                           ` (9 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The upstream Linux kernel community prefers avoiding CamelCase in
variables, function names, etc.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 14 +++++++-------
 drivers/net/fm10k/fm10k_ethdev.c    | 24 ++++++++++++------------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 98dbf6f..1e84294 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -531,13 +531,13 @@ struct fm10k_hw;
 #endif
 
 enum fm10k_int_source {
-	fm10k_int_Mailbox	= 0,
-	fm10k_int_PCIeFault	= 1,
-	fm10k_int_SwitchUpDown	= 2,
-	fm10k_int_SwitchEvent	= 3,
-	fm10k_int_SRAM		= 4,
-	fm10k_int_VFLR		= 5,
-	fm10k_int_MaxHoldTime	= 6,
+	fm10k_int_mailbox		= 0,
+	fm10k_int_pcie_fault		= 1,
+	fm10k_int_switch_up_down	= 2,
+	fm10k_int_switch_event		= 3,
+	fm10k_int_sram			= 4,
+	fm10k_int_vflr			= 5,
+	fm10k_int_max_hold_time		= 6,
 	fm10k_int_sources_max_pf
 };
 
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 6d929cb..3ac08d0 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2117,12 +2117,12 @@ fm10k_dev_enable_intr_pf(struct rte_eth_dev *dev)
 	/* Bind all local non-queue interrupt to vector 0 */
 	int_map |= FM10K_MISC_VEC_ID;
 
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_Mailbox), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_PCIeFault), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchUpDown), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchEvent), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SRAM), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_VFLR), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_mailbox), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_pcie_fault), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_up_down), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_event), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_sram), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_vflr), int_map);
 
 	/* Enable misc causes */
 	FM10K_WRITE_REG(hw, FM10K_EIMR, FM10K_EIMR_ENABLE(PCA_FAULT) |
@@ -2148,12 +2148,12 @@ fm10k_dev_disable_intr_pf(struct rte_eth_dev *dev)
 
 	int_map |= FM10K_MISC_VEC_ID;
 
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_Mailbox), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_PCIeFault), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchUpDown), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SwitchEvent), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_SRAM), int_map);
-	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_VFLR), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_mailbox), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_pcie_fault), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_up_down), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_switch_event), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_sram), int_map);
+	FM10K_WRITE_REG(hw, FM10K_INT_MAP(fm10k_int_vflr), int_map);
 
 	/* Disable misc causes */
 	FM10K_WRITE_REG(hw, FM10K_EIMR, FM10K_EIMR_DISABLE(PCA_FAULT) |
-- 
1.9.3

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

* [PATCH v3 11/18] fm10k/base: use memcpy for mac addr copy
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (9 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 10/18] fm10k/base: do not use CamelCase Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:06         ` [PATCH v3 12/18] fm10k/base: allow removal of is_slot_appropriate function Wang Xiao W
                           ` (8 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Use memcpy instead of copying MAC address byte-by-byte.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 7d48210..a1469aa 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -300,7 +300,6 @@ STATIC s32 fm10k_read_mac_addr_pf(struct fm10k_hw *hw)
 {
 	u8 perm_addr[ETH_ALEN];
 	u32 serial_num;
-	int i;
 
 	DEBUGFUNC("fm10k_read_mac_addr_pf");
 
@@ -324,10 +323,8 @@ STATIC s32 fm10k_read_mac_addr_pf(struct fm10k_hw *hw)
 	perm_addr[4] = (u8)(serial_num >> 8);
 	perm_addr[5] = (u8)(serial_num);
 
-	for (i = 0; i < ETH_ALEN; i++) {
-		hw->mac.perm_addr[i] = perm_addr[i];
-		hw->mac.addr[i] = perm_addr[i];
-	}
+	memcpy(hw->mac.perm_addr, perm_addr, ETH_ALEN);
+	memcpy(hw->mac.addr, perm_addr, ETH_ALEN);
 
 	return FM10K_SUCCESS;
 }
-- 
1.9.3

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

* [PATCH v3 12/18] fm10k/base: allow removal of is_slot_appropriate function
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (10 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 11/18] fm10k/base: use memcpy for mac addr copy Wang Xiao W
@ 2016-02-19 11:06         ` Wang Xiao W
  2016-02-19 11:07         ` [PATCH v3 13/18] fm10k/base: consistently use VLAN ID when referencing vid variables Wang Xiao W
                           ` (7 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:06 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The Linux Kernel provides the OS a call "pcie_get_minimum_link" which
can crawl the PCIe tree and determine the actual minimum link speed of a
device which is a more general check than provided by
is_slot_appropriate. Thus, the upstream driver does not use or want the
is_slot_appropriate function call. Add a NO_IS_SLOT_APPROPRIATE_CHECK
definition which can be defined during strip process to remove the code.
If left undefined (the default) then the code will all be active and no
driver changes should be necessary.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_api.c  | 2 ++
 drivers/net/fm10k/base/fm10k_api.h  | 2 ++
 drivers/net/fm10k/base/fm10k_pf.c   | 4 ++++
 drivers/net/fm10k/base/fm10k_type.h | 2 ++
 drivers/net/fm10k/base/fm10k_vf.c   | 4 ++++
 5 files changed, 14 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_api.c b/drivers/net/fm10k/base/fm10k_api.c
index eb5bdaa..c49d20d 100644
--- a/drivers/net/fm10k/base/fm10k_api.c
+++ b/drivers/net/fm10k/base/fm10k_api.c
@@ -181,6 +181,7 @@ s32 fm10k_get_bus_info(struct fm10k_hw *hw)
 			       FM10K_NOT_IMPLEMENTED);
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -195,6 +196,7 @@ bool fm10k_is_slot_appropriate(struct fm10k_hw *hw)
 	return true;
 }
 
+#endif
 /**
  *  fm10k_update_vlan - Clear VLAN ID to VLAN filter table
  *  @hw: pointer to hardware structure
diff --git a/drivers/net/fm10k/base/fm10k_api.h b/drivers/net/fm10k/base/fm10k_api.h
index 113aef5..2ab3149 100644
--- a/drivers/net/fm10k/base/fm10k_api.h
+++ b/drivers/net/fm10k/base/fm10k_api.h
@@ -44,7 +44,9 @@ s32 fm10k_stop_hw(struct fm10k_hw *hw);
 s32 fm10k_start_hw(struct fm10k_hw *hw);
 s32 fm10k_init_shared_code(struct fm10k_hw *hw);
 s32 fm10k_get_bus_info(struct fm10k_hw *hw);
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 bool fm10k_is_slot_appropriate(struct fm10k_hw *hw);
+#endif
 s32 fm10k_update_vlan(struct fm10k_hw *hw, u32 vid, u8 idx, bool set);
 s32 fm10k_read_mac_addr(struct fm10k_hw *hw);
 void fm10k_update_hw_stats(struct fm10k_hw *hw, struct fm10k_hw_stats *stats);
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index a1469aa..f5cbda4 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -216,6 +216,7 @@ STATIC s32 fm10k_init_hw_pf(struct fm10k_hw *hw)
 	return FM10K_SUCCESS;
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate_pf - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -231,6 +232,7 @@ STATIC bool fm10k_is_slot_appropriate_pf(struct fm10k_hw *hw)
 	       (hw->bus.width == hw->bus_caps.width);
 }
 
+#endif
 /**
  *  fm10k_update_vlan_pf - Update status of VLAN ID in VLAN filter table
  *  @hw: pointer to hardware structure
@@ -2064,7 +2066,9 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
 	mac->ops.init_hw = &fm10k_init_hw_pf;
 	mac->ops.start_hw = &fm10k_start_hw_generic;
 	mac->ops.stop_hw = &fm10k_stop_hw_generic;
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	mac->ops.is_slot_appropriate = &fm10k_is_slot_appropriate_pf;
+#endif
 	mac->ops.update_vlan = &fm10k_update_vlan_pf;
 	mac->ops.read_mac_addr = &fm10k_read_mac_addr_pf;
 	mac->ops.update_uc_addr = &fm10k_update_uc_addr_pf;
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 1e84294..c4e5450 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -679,7 +679,9 @@ 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 *);
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	bool (*is_slot_appropriate)(struct fm10k_hw *);
+#endif
 	s32 (*update_vlan)(struct fm10k_hw *, u32, u8, bool);
 	s32 (*read_mac_addr)(struct fm10k_hw *);
 	s32 (*update_uc_addr)(struct fm10k_hw *, u16, const u8 *,
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 43eb081..efbdbd1 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -178,6 +178,7 @@ reset_max_queues:
 	return err;
 }
 
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 /**
  *  fm10k_is_slot_appropriate_vf - Indicate appropriate slot for this SKU
  *  @hw: pointer to hardware structure
@@ -194,6 +195,7 @@ STATIC bool fm10k_is_slot_appropriate_vf(struct fm10k_hw *hw)
 	return TRUE;
 }
 
+#endif
 /* This structure defines the attibutes to be parsed below */
 const struct fm10k_tlv_attr fm10k_mac_vlan_msg_attr[] = {
 	FM10K_TLV_ATTR_U32(FM10K_MAC_VLAN_MSG_VLAN),
@@ -648,7 +650,9 @@ s32 fm10k_init_ops_vf(struct fm10k_hw *hw)
 	mac->ops.init_hw = &fm10k_init_hw_vf;
 	mac->ops.start_hw = &fm10k_start_hw_generic;
 	mac->ops.stop_hw = &fm10k_stop_hw_vf;
+#ifndef NO_IS_SLOT_APPROPRIATE_CHECK
 	mac->ops.is_slot_appropriate = &fm10k_is_slot_appropriate_vf;
+#endif
 	mac->ops.update_vlan = &fm10k_update_vlan_vf;
 	mac->ops.read_mac_addr = &fm10k_read_mac_addr_vf;
 	mac->ops.update_uc_addr = &fm10k_update_uc_addr_vf;
-- 
1.9.3

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

* [PATCH v3 13/18] fm10k/base: consistently use VLAN ID when referencing vid variables
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (11 preceding siblings ...)
  2016-02-19 11:06         ` [PATCH v3 12/18] fm10k/base: allow removal of is_slot_appropriate function Wang Xiao W
@ 2016-02-19 11:07         ` Wang Xiao W
  2016-02-19 11:07         ` [PATCH v3 14/18] fm10k/base: imporve comment per upstream review changes Wang Xiao W
                           ` (6 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:07 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The vid variable name is shorthand for VLAN ID, so we should use this in
comments explaining what is happening.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index f5cbda4..716d7f1 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -970,7 +970,7 @@ err_out:
 	txqctl |= (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
 		  FM10K_TXQCTL_VF | vf_idx;
 
-	/* assign VID */
+	/* assign VLAN ID */
 	for (i = 0; i < queues_per_pool; i++)
 		FM10K_WRITE_REG(hw, FM10K_TXQCTL(vf_q_idx + i), txqctl);
 
@@ -1215,12 +1215,12 @@ s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *hw, u32 **results,
 }
 
 /**
- * fm10k_iov_select_vid - Select correct default vid
+ * fm10k_iov_select_vid - Select correct default VLAN ID
  * @hw: Pointer to hardware structure
- * @vid: vid to correct
+ * @vid: VLAN ID to correct
  *
- * Will report an error if vid is out of range. For vid = 0, it will return
- * either the pf_vid or sw_vid depending on which one is set.
+ * Will report an error if the VLAN ID is out of range. For VID = 0, it will
+ * return either the pf_vid or sw_vid depending on which one is set.
  */
 STATIC s32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid)
 {
@@ -1783,7 +1783,7 @@ static s32 fm10k_msg_update_pvid_pf(struct fm10k_hw *hw, u32 **results,
 	if (!fm10k_glort_valid_pf(hw, glort))
 		return FM10K_ERR_PARAM;
 
-	/* verify VID is valid */
+	/* verify VLAN ID is valid */
 	if (pvid >= FM10K_VLAN_TABLE_VID_MAX)
 		return FM10K_ERR_PARAM;
 
-- 
1.9.3

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

* [PATCH v3 14/18] fm10k/base: imporve comment per upstream review changes
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (12 preceding siblings ...)
  2016-02-19 11:07         ` [PATCH v3 13/18] fm10k/base: consistently use VLAN ID when referencing vid variables Wang Xiao W
@ 2016-02-19 11:07         ` Wang Xiao W
  2016-02-19 11:07         ` [PATCH v3 15/18] fm10k/base: fix TLV structures alignment Wang Xiao W
                           ` (5 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:07 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The comment here was changed during review of upstream patch, and the
new wording is slightly more clear. Re-write the comment in SHARED code
based on this new wording.

Fix a number of mailbox comment issues with function header comments,
lower-case acronyms (i.e. FIFO, TLV), incorrect function names in
DEBUGFUNC(), duplicate comments and a stubbed-out header comment for
fm10k_sm_mbx_init.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.c | 61 ++++++++++++++++++++++----------------
 drivers/net/fm10k/base/fm10k_mbx.h |  4 +--
 drivers/net/fm10k/base/fm10k_pf.c  | 12 ++++----
 drivers/net/fm10k/base/fm10k_tlv.c |  2 +-
 drivers/net/fm10k/base/fm10k_tlv.h |  4 +--
 5 files changed, 47 insertions(+), 36 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 7d03704..2e70434 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -70,7 +70,7 @@ STATIC u16 fm10k_fifo_unused(struct fm10k_mbx_fifo *fifo)
 }
 
 /**
- *  fm10k_fifo_empty - Test to verify if fifo is empty
+ *  fm10k_fifo_empty - Test to verify if FIFO is empty
  *  @fifo: pointer to FIFO
  *
  *  This function returns true if the FIFO is empty, else false
@@ -85,7 +85,7 @@ STATIC bool fm10k_fifo_empty(struct fm10k_mbx_fifo *fifo)
  *  @fifo: pointer to FIFO
  *  @offset: offset to add to head
  *
- *  This function returns the indices into the fifo based on head + offset
+ *  This function returns the indices into the FIFO based on head + offset
  **/
 STATIC u16 fm10k_fifo_head_offset(struct fm10k_mbx_fifo *fifo, u16 offset)
 {
@@ -97,7 +97,7 @@ STATIC u16 fm10k_fifo_head_offset(struct fm10k_mbx_fifo *fifo, u16 offset)
  *  @fifo: pointer to FIFO
  *  @offset: offset to add to tail
  *
- *  This function returns the indices into the fifo based on tail + offset
+ *  This function returns the indices into the FIFO based on tail + offset
  **/
 STATIC u16 fm10k_fifo_tail_offset(struct fm10k_mbx_fifo *fifo, u16 offset)
 {
@@ -173,7 +173,7 @@ STATIC u16 fm10k_mbx_index_len(struct fm10k_mbx_info *mbx, u16 head, u16 tail)
 /**
  *  fm10k_mbx_tail_add - Determine new tail value with added offset
  *  @mbx: pointer to mailbox
- *  @offset: length to add to head offset
+ *  @offset: length to add to tail offset
  *
  *  This function takes the local tail index and recomputes it for
  *  a given length added as an offset.
@@ -189,7 +189,7 @@ STATIC u16 fm10k_mbx_tail_add(struct fm10k_mbx_info *mbx, u16 offset)
 /**
  *  fm10k_mbx_tail_sub - Determine new tail value with subtracted offset
  *  @mbx: pointer to mailbox
- *  @offset: length to add to head offset
+ *  @offset: length to add to tail offset
  *
  *  This function takes the local tail index and recomputes it for
  *  a given length added as an offset.
@@ -253,7 +253,7 @@ STATIC u16 fm10k_mbx_pushed_tail_len(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_fifo_write_copy - pulls data off of msg and places it in fifo
+ *  fm10k_fifo_write_copy - pulls data off of msg and places it in FIFO
  *  @fifo: pointer to FIFO
  *  @msg: message array to populate
  *  @tail_offset: additional offset to add to tail pointer
@@ -331,7 +331,7 @@ STATIC u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
 	u16 total_len = 0, msg_len;
 	u32 *msg;
 
-	DEBUGFUNC("fm10k_mbx_validate_msg");
+	DEBUGFUNC("fm10k_mbx_validate_msg_size");
 
 	/* length should include previous amounts pushed */
 	len += mbx->pushed;
@@ -353,6 +353,7 @@ STATIC u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
 
 /**
  *  fm10k_mbx_write_copy - pulls data off of Tx FIFO and places it in mbmem
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will take a section of the Tx FIFO and copy it into the
@@ -734,7 +735,7 @@ STATIC bool fm10k_mbx_tx_complete(struct fm10k_mbx_info *mbx)
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
- *  This function dequeues messages and hands them off to the tlv parser.
+ *  This function dequeues messages and hands them off to the TLV parser.
  *  It will return the number of messages processed when called.
  **/
 STATIC u16 fm10k_mbx_dequeue_rx(struct fm10k_hw *hw,
@@ -951,7 +952,7 @@ STATIC void fm10k_mbx_create_fake_disconnect_hdr(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_create_error_msg - Generate a error message
+ *  fm10k_mbx_create_error_msg - Generate an error message
  *  @mbx: pointer to mailbox
  *  @err: local error encountered
  *
@@ -984,7 +985,6 @@ STATIC void fm10k_mbx_create_error_msg(struct fm10k_mbx_info *mbx, s32 err)
 /**
  *  fm10k_mbx_validate_msg_hdr - Validate common fields in the message header
  *  @mbx: pointer to mailbox
- *  @msg: message array to read
  *
  *  This function will parse up the fields in the mailbox header and return
  *  an error if the header contains any of a number of invalid configurations
@@ -1050,11 +1050,12 @@ STATIC s32 fm10k_mbx_validate_msg_hdr(struct fm10k_mbx_info *mbx)
 
 /**
  *  fm10k_mbx_create_reply - Generate reply based on state and remote head
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *  @head: acknowledgement number
  *
  *  This function will generate an outgoing message based on the current
- *  mailbox state and the remote fifo head.  It will return the length
+ *  mailbox state and the remote FIFO head.  It will return the length
  *  of the outgoing message excluding header on success, and a negative value
  *  on error.
  **/
@@ -1130,7 +1131,7 @@ STATIC void fm10k_mbx_reset_work(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_update_max_size - Update the max_size and drop large messages
+ *  fm10k_mbx_update_max_size - Update the max_size and drop any large messages
  *  @mbx: pointer to mailbox
  *  @size: new value for max_size
  *
@@ -1144,7 +1145,7 @@ STATIC void fm10k_mbx_update_max_size(struct fm10k_mbx_info *mbx, u16 size)
 {
 	u16 len;
 
-	DEBUGFUNC("fm10k_mbx_update_max_size_hdr");
+	DEBUGFUNC("fm10k_mbx_update_max_size");
 
 	mbx->max_size = size;
 
@@ -1182,8 +1183,8 @@ STATIC void fm10k_mbx_connect_reset(struct fm10k_mbx_info *mbx)
 
 /**
  *  fm10k_mbx_process_connect - Process connect header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
- *  @msg: message array to process
  *
  *  This function will read an incoming connect header and reply with the
  *  appropriate message.  It will return a value indicating the number of
@@ -1229,6 +1230,7 @@ STATIC s32 fm10k_mbx_process_connect(struct fm10k_hw *hw,
 
 /**
  *  fm10k_mbx_process_data - Process data header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will read an incoming data header and reply with the
@@ -1272,6 +1274,7 @@ STATIC s32 fm10k_mbx_process_data(struct fm10k_hw *hw,
 
 /**
  *  fm10k_mbx_process_disconnect - Process disconnect header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will read an incoming disconnect header and reply with the
@@ -1324,6 +1327,7 @@ STATIC s32 fm10k_mbx_process_disconnect(struct fm10k_hw *hw,
 
 /**
  *  fm10k_mbx_process_error - Process error header
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
  *  This function will read an incoming error header and reply with the
@@ -1501,6 +1505,7 @@ STATIC s32 fm10k_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 
 	fm10k_mbx_reset_work(mbx);
 
+	/* initialize header of remote mailbox */
 	fm10k_mbx_create_fake_disconnect_hdr(mbx);
 	FM10K_WRITE_MBX(hw, mbx->mbmem_reg ^ mbx->mbmem_len, mbx->mbx_hdr);
 
@@ -1602,7 +1607,7 @@ STATIC s32 fm10k_mbx_register_handlers(struct fm10k_mbx_info *mbx,
  *  @id: ID reference for PF as it supports up to 64 PF/VF mailboxes
  *
  *  This function initializes the mailbox for use.  It will split the
- *  buffer provided an use that th populate both the Tx and Rx FIFO by
+ *  buffer provided and use that to populate both the Tx and Rx FIFO by
  *  evenly splitting it.  In order to allow for easy masking of head/tail
  *  the value reported in size must be a power of 2 and is reported in
  *  DWORDs, not bytes.  Any invalid values will cause the mailbox to return
@@ -1681,7 +1686,7 @@ s32 fm10k_pfvf_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
  *  fm10k_sm_mbx_create_data_hdr - Generate a mailbox header for local FIFO
  *  @mbx: pointer to mailbox
  *
- *  This function returns a connection mailbox header
+ *  This function returns a data mailbox header
  **/
 STATIC void fm10k_sm_mbx_create_data_hdr(struct fm10k_mbx_info *mbx)
 {
@@ -1748,7 +1753,7 @@ STATIC void fm10k_sm_mbx_connect_reset(struct fm10k_mbx_info *mbx)
  **/
 STATIC s32 fm10k_sm_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 {
-	DEBUGFUNC("fm10k_mbx_connect");
+	DEBUGFUNC("fm10k_sm_mbx_connect");
 
 	/* we cannot connect an uninitialized mailbox */
 	if (!mbx->rx.buffer)
@@ -1776,8 +1781,6 @@ STATIC s32 fm10k_sm_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
 	fm10k_sm_mbx_create_connect_hdr(mbx, 0);
 	fm10k_mbx_write(hw, mbx);
 
-	/* enable interrupt and notify other party of new message */
-
 	return FM10K_SUCCESS;
 }
 
@@ -1823,7 +1826,7 @@ STATIC void fm10k_sm_mbx_disconnect(struct fm10k_hw *hw,
 }
 
 /**
- *  fm10k_mbx_validate_fifo_hdr - Validate fields in the remote FIFO header
+ *  fm10k_sm_mbx_validate_fifo_hdr - Validate fields in the remote FIFO header
  *  @mbx: pointer to mailbox
  *
  *  This function will parse up the fields in the mailbox header and return
@@ -1835,7 +1838,7 @@ STATIC s32 fm10k_sm_mbx_validate_fifo_hdr(struct fm10k_mbx_info *mbx)
 	const u32 *hdr = &mbx->mbx_hdr;
 	u16 tail, head, ver;
 
-	DEBUGFUNC("fm10k_mbx_validate_msg_hdr");
+	DEBUGFUNC("fm10k_sm_mbx_validate_fifo_hdr");
 
 	tail = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_TAIL);
 	ver = FM10K_MSG_HDR_FIELD_GET(*hdr, SM_VER);
@@ -1903,7 +1906,7 @@ STATIC void fm10k_sm_mbx_process_error(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_sm_mbx_create_error_message - Process an error in FIFO hdr
+ *  fm10k_sm_mbx_create_error_msg - Process an error in FIFO header
  *  @mbx: pointer to mailbox
  *  @err: local error encountered
  *
@@ -1933,6 +1936,7 @@ STATIC void fm10k_sm_mbx_create_error_msg(struct fm10k_mbx_info *mbx, s32 err)
  *  fm10k_sm_mbx_receive - Take message from Rx mailbox FIFO and put it in Rx
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
+ *  @tail: tail index of message
  *
  *  This function will dequeue one message from the Rx switch manager mailbox
  *  FIFO and place it in the Rx mailbox FIFO for processing by software.
@@ -1974,6 +1978,7 @@ STATIC s32 fm10k_sm_mbx_receive(struct fm10k_hw *hw,
  *  fm10k_sm_mbx_transmit - Take message from Tx and put it in Tx mailbox FIFO
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
+ *  @head: head index of message
  *
  *  This function will dequeue one message from the Tx mailbox FIFO and place
  *  it in the Tx switch manager mailbox FIFO for processing by hardware.
@@ -2015,11 +2020,12 @@ STATIC void fm10k_sm_mbx_transmit(struct fm10k_hw *hw,
 
 /**
  *  fm10k_sm_mbx_create_reply - Generate reply based on state and remote head
+ *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *  @head: acknowledgement number
  *
  *  This function will generate an outgoing message based on the current
- *  mailbox state and the remote fifo head.  It will return the length
+ *  mailbox state and the remote FIFO head.  It will return the length
  *  of the outgoing message excluding header on success, and a negative value
  *  on error.
  **/
@@ -2131,7 +2137,7 @@ send_reply:
 }
 
 /**
- *  fm10k_sm_mbx_process - Process mailbox switch mailbox interrupt
+ *  fm10k_sm_mbx_process - Process switch manager mailbox interrupt
  *  @hw: pointer to hardware structure
  *  @mbx: pointer to mailbox
  *
@@ -2189,7 +2195,12 @@ fifo_err:
  *  @mbx: pointer to mailbox
  *  @msg_data: handlers for mailbox events
  *
- *  This function for now is used to stub out the PF/SM mailbox
+ *  This function initializes the PF/SM mailbox for use.  It will split the
+ *  buffer provided and use that to populate both the Tx and Rx FIFO by
+ *  evenly splitting it.  In order to allow for easy masking of head/tail
+ *  the value reported in size must be a power of 2 and is reported in
+ *  DWORDs, not bytes.  Any invalid values will cause the mailbox to return
+ *  error.
  **/
 s32 fm10k_sm_mbx_init(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx,
 		      const struct fm10k_msg_data *msg_data)
diff --git a/drivers/net/fm10k/base/fm10k_mbx.h b/drivers/net/fm10k/base/fm10k_mbx.h
index 4b22f0e..e642c2f 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.h
+++ b/drivers/net/fm10k/base/fm10k_mbx.h
@@ -144,11 +144,11 @@ enum fm10k_mbx_state {
  *		The maximum message size is provided during connect to avoid
  *		jamming the mailbox with messages that do not fit.
  * Err_no: Error number - Applies only to error headers
- *		The error number provides a indication of the type of error
+ *		The error number provides an indication of the type of error
  *		experienced.
  */
 
-/* macros for retriving and setting header values */
+/* macros for retrieving and setting header values */
 #define FM10K_MSG_HDR_MASK(name) \
 	((0x1u << FM10K_MSG_##name##_SIZE) - 1)
 #define FM10K_MSG_HDR_FIELD_SET(value, name) \
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 716d7f1..456fe64 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1105,7 +1105,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 		FM10K_WRITE_REG(hw, FM10K_RQMAP(qmap_idx + i), vf_q_idx + i);
 	}
 
-	/* repeat the first ring for all of the remaining VF rings */
+	/* repeat the first ring for all the remaining VF rings */
 	for (i = queues_per_pool; i < qmap_stride; i++) {
 		FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx + i), vf_q_idx);
 		FM10K_WRITE_REG(hw, FM10K_RQMAP(qmap_idx + i), vf_q_idx);
@@ -1246,9 +1246,9 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 			      struct fm10k_mbx_info *mbx)
 {
 	struct fm10k_vf_info *vf_info = (struct fm10k_vf_info *)mbx;
-	int err = FM10K_SUCCESS;
 	u8 mac[ETH_ALEN];
 	u32 *result;
+	int err = FM10K_SUCCESS;
 	bool set;
 	u16 vlan;
 	u32 vid;
@@ -1427,10 +1427,10 @@ s32 fm10k_iov_msg_lport_state_pf(struct fm10k_hw *hw, u32 **results,
 			err = fm10k_update_lport_state_pf(hw, vf_info->glort,
 							  1, false);
 
-		/* need to clear VF_FLAG_ENABLED in order to ensure that we
-		 * actually re-enable the lport state below. Note that this
-		 * has no impact if VF is already disabled, as the flags are
-		 * already zeroed.
+		/* we need to clear VF_FLAG_ENABLED flags in order to ensure
+		 * that we actually re-enable the LPORT state below. Note that
+		 * this has no impact if the VF is already disabled, as the
+		 * flags are already cleared.
 		 */
 		if (!err)
 			vf_info->vf_flags = FM10K_VF_FLAG_CAPABLE(vf_info);
diff --git a/drivers/net/fm10k/base/fm10k_tlv.c b/drivers/net/fm10k/base/fm10k_tlv.c
index b9000ae..e6150c1 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.c
+++ b/drivers/net/fm10k/base/fm10k_tlv.c
@@ -405,7 +405,7 @@ static u32 *fm10k_tlv_attr_nest_start(u32 *msg, u16 attr_id)
 }
 
 /**
- *  fm10k_tlv_attr_nest_start - Start a set of nested attributes
+ *  fm10k_tlv_attr_nest_stop - Stop a set of nested attributes
  *  @msg: Pointer to message block
  *
  *  This function closes off an existing set of nested attributes.  The
diff --git a/drivers/net/fm10k/base/fm10k_tlv.h b/drivers/net/fm10k/base/fm10k_tlv.h
index a297bb8..8f85fce 100644
--- a/drivers/net/fm10k/base/fm10k_tlv.h
+++ b/drivers/net/fm10k/base/fm10k_tlv.h
@@ -51,9 +51,9 @@ struct fm10k_msg_data;
  * mailbox size we will provide a message with the above header and it
  * will be segmented and transported to the mailbox to the other side where
  * it is reassembled.  It contains the following fields:
- * Len: Length of the message in bytes excluding the message header
+ * Length: Length of the message in bytes excluding the message header
  * Flags: TBD
- * Rule: These will be the message/argument types we pass
+ * Type/ID: These will be the message/argument types we pass
  */
 /* message data header */
 #define FM10K_TLV_ID_SHIFT		0
-- 
1.9.3

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

* [PATCH v3 15/18] fm10k/base: fix TLV structures alignment
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (13 preceding siblings ...)
  2016-02-19 11:07         ` [PATCH v3 14/18] fm10k/base: imporve comment per upstream review changes Wang Xiao W
@ 2016-02-19 11:07         ` Wang Xiao W
  2016-02-19 11:07         ` [PATCH v3 16/18] fm10k/base: move constants to the right of binary operators Wang Xiao W
                           ` (4 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:07 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Per comments from an upstream patch, and looking at how TLV LE_STRUCT
code works, we actually want these structures to be 4byte aligned, not
1byte aligned. In practice, 1byte alignment has worked so far because
all our structures end up being a multiple of 4. But if a future TLV
structure were added that had a u8 or similar sticking on the end things
would break. Fix this by using 4byte alignment which will prevent the
TLV LE_STRUCT code from breaking. Update the comment explaining that we
need 4byte alignment of our structures.

Fixes: e24fed68236a ("fm10k: pack TLV overlay structures correctly")

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index 92e2962..ee8527a 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -91,14 +91,14 @@ enum fm10k_pf_tlv_attr_id_v1 {
 #define FM10K_MSG_UPDATE_PVID_PVID_SHIFT	16
 #define FM10K_MSG_UPDATE_PVID_PVID_SIZE		16
 
-/* The following data structures are overlayed specifically to TLV mailbox
- * messages, and must not have gaps between their values. They must line up
- * correctly to the TLV definition.
+/* 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.
  */
 #ifdef C99
-#pragma pack(push, 1)
+#pragma pack(push, 4)
 #else
-#pragma pack(1)
+#pragma pack(4)
 #endif /* C99 */
 
 struct fm10k_mac_update {
-- 
1.9.3

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

* [PATCH v3 16/18] fm10k/base: move constants to the right of binary operators
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (14 preceding siblings ...)
  2016-02-19 11:07         ` [PATCH v3 15/18] fm10k/base: fix TLV structures alignment Wang Xiao W
@ 2016-02-19 11:07         ` Wang Xiao W
  2016-02-19 11:07         ` [PATCH v3 17/18] fm10k/base: minor cleanups Wang Xiao W
                           ` (3 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:07 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

The upstream Linux kernel community prefers constants are to the right of
binary operators.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_pf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 456fe64..105babf 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -759,8 +759,8 @@ STATIC s32 fm10k_iov_assign_resources_pf(struct fm10k_hw *hw, u16 num_vfs,
 					FM10K_RXDCTL_WRITE_BACK_MIN_DELAY |
 					FM10K_RXDCTL_DROP_ON_EMPTY);
 			FM10K_WRITE_REG(hw, FM10K_RXQCTL(vf_q_idx),
-					FM10K_RXQCTL_VF |
-					(i << FM10K_RXQCTL_VF_SHIFT));
+					(i << FM10K_RXQCTL_VF_SHIFT) |
+					FM10K_RXQCTL_VF);
 
 			/* map queue pair to VF */
 			FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);
@@ -1035,7 +1035,7 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
 	txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) |
 		 (vf_idx << FM10K_TXQCTL_TC_SHIFT) |
 		 FM10K_TXQCTL_VF | vf_idx;
-	rxqctl = FM10K_RXQCTL_VF | (vf_idx << FM10K_RXQCTL_VF_SHIFT);
+	rxqctl = (vf_idx << FM10K_RXQCTL_VF_SHIFT) | FM10K_RXQCTL_VF;
 
 	/* stop further DMA and reset queue ownership back to VF */
 	for (i = vf_q_idx; i < (queues_per_pool + vf_q_idx); i++) {
-- 
1.9.3

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

* [PATCH v3 17/18] fm10k/base: minor cleanups
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (15 preceding siblings ...)
  2016-02-19 11:07         ` [PATCH v3 16/18] fm10k/base: move constants to the right of binary operators Wang Xiao W
@ 2016-02-19 11:07         ` Wang Xiao W
  2016-02-19 11:07         ` [PATCH v3 18/18] fm10k/base: remove unused struct element Wang Xiao W
                           ` (2 subsequent siblings)
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:07 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Some cleanups to better reflect the code that was actually pushed out to
the upstream Linux community.

Among the above cleanups, a few macros such as FM10K_RXINT_TIMER_SHIFT are
removed, but they are needed in dpdk/fm10k, so we have to put all these
necessary macros into fm10k_osdep.h.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_mbx.h   |   7 --
 drivers/net/fm10k/base/fm10k_osdep.h |  32 +++++++++
 drivers/net/fm10k/base/fm10k_pf.h    |   4 --
 drivers/net/fm10k/base/fm10k_type.h  | 132 -----------------------------------
 4 files changed, 32 insertions(+), 143 deletions(-)

diff --git a/drivers/net/fm10k/base/fm10k_mbx.h b/drivers/net/fm10k/base/fm10k_mbx.h
index e642c2f..edc57df 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.h
+++ b/drivers/net/fm10k/base/fm10k_mbx.h
@@ -48,7 +48,6 @@ struct fm10k_mbx_info;
 /* XOR provides means of switching from Tx to Rx FIFO */
 #define FM10K_MBMEM_PF_XOR	(FM10K_MBMEM_SM(0) ^ FM10K_MBMEM_PF(0))
 #define FM10K_MBX(_n)		((_n) + 0x18800)
-#define FM10K_MBX_OWNER				0x00000001
 #define FM10K_MBX_REQ				0x00000002
 #define FM10K_MBX_ACK				0x00000004
 #define FM10K_MBX_REQ_INTERRUPT			0x00000008
@@ -213,7 +212,6 @@ enum fm10k_msg_type {
 /* version number for switch manager mailboxes */
 #define FM10K_SM_MBX_VERSION		1
 #define FM10K_SM_MBX_FIFO_LEN		(FM10K_MBMEM_PF_XOR - 1)
-#define FM10K_SM_MBX_FIFO_HDR_LEN	1
 
 /* offsets shared between all SM FIFO headers */
 #define FM10K_MSG_SM_TAIL_SHIFT			0
@@ -233,18 +231,13 @@ enum fm10k_msg_type {
  */
 #define FM10K_MBX_ERR(_n) ((_n) - 512)
 #define FM10K_MBX_ERR_NO_MBX		FM10K_MBX_ERR(0x01)
-#define FM10K_MBX_ERR_NO_MSG		FM10K_MBX_ERR(0x02)
 #define FM10K_MBX_ERR_NO_SPACE		FM10K_MBX_ERR(0x03)
-#define FM10K_MBX_ERR_LOCK		FM10K_MBX_ERR(0x04)
 #define FM10K_MBX_ERR_TAIL		FM10K_MBX_ERR(0x05)
 #define FM10K_MBX_ERR_HEAD		FM10K_MBX_ERR(0x06)
-#define FM10K_MBX_ERR_DST		FM10K_MBX_ERR(0x07)
 #define FM10K_MBX_ERR_SRC		FM10K_MBX_ERR(0x08)
 #define FM10K_MBX_ERR_TYPE		FM10K_MBX_ERR(0x09)
-#define FM10K_MBX_ERR_LEN		FM10K_MBX_ERR(0x0A)
 #define FM10K_MBX_ERR_SIZE		FM10K_MBX_ERR(0x0B)
 #define FM10K_MBX_ERR_BUSY		FM10K_MBX_ERR(0x0C)
-#define FM10K_MBX_ERR_VALUE		FM10K_MBX_ERR(0x0D)
 #define FM10K_MBX_ERR_RSVD0		FM10K_MBX_ERR(0x0E)
 #define FM10K_MBX_ERR_CRC		FM10K_MBX_ERR(0x0F)
 
diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 6852ef0..a21daa2 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -150,6 +150,38 @@ typedef int        bool;
 #define fm10k_read_reg FM10K_READ_REG
 #endif
 
+#define FM10K_INTEL_VENDOR_ID       0x8086
+#define FM10K_DMA_CTRL_MINMSS_SHIFT		9
+#define FM10K_EICR_PCA_FAULT			0x00000001
+#define FM10K_EICR_THI_FAULT			0x00000004
+#define FM10K_EICR_FUM_FAULT			0x00000020
+#define FM10K_EICR_SRAMERROR			0x00000400
+#define FM10K_SRAM_IP		0x13003
+#define FM10K_RXINT_TIMER_SHIFT			8
+#define FM10K_TXINT_TIMER_SHIFT			8
+#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 */
+
 #define FM10K_TSO_MINMSS \
 	(FM10K_DMA_CTRL_MINMSS_64 >> FM10K_DMA_CTRL_MINMSS_SHIFT)
 #define FM10K_TSO_MIN_HEADERLEN			54
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index ee8527a..c84b1bc 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -140,10 +140,6 @@ struct fm10k_swapi_1588_clock_owner {
 #pragma pack()
 #endif /* C99 */
 
-#define FM10K_PF_MSG_LPORT_CREATE_HANDLER(func) \
-	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_CREATE, NULL, func)
-#define FM10K_PF_MSG_LPORT_DELETE_HANDLER(func) \
-	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_DELETE, NULL, func)
 s32 fm10k_msg_lport_map_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
 extern const struct fm10k_tlv_attr fm10k_lport_map_msg_attr[];
 #define FM10K_PF_MSG_LPORT_MAP_HANDLER(func) \
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index c4e5450..f807216 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -40,7 +40,6 @@ struct fm10k_hw;
 #include "fm10k_osdep.h"
 #include "fm10k_mbx.h"
 
-#define FM10K_INTEL_VENDOR_ID		0x8086
 #define FM10K_DEV_ID_PF			0x15A4
 #define FM10K_DEV_ID_VF			0x15A5
 #ifdef BOULDER_RAPIDS_HW
@@ -121,28 +120,16 @@ struct fm10k_hw;
 #define FM10K_CTRL_BAR4_ALLOWED			0x00000004
 
 #define FM10K_CTRL_EXT		0x0001
-#define FM10K_CTRL_EXT_NS_DIS			0x00000001
-#define FM10K_CTRL_EXT_RO_DIS			0x00000002
-#define FM10K_CTRL_EXT_SWITCH_LOOPBACK		0x00000004
-#define FM10K_EXVET		0x0002
-#define FM10K_EXVET_ETHERTYPE_MASK		0x000000FF
-#define FM10K_EXVET_TAG_SIZE_SHIFT		16
-#define FM10K_EXVET_AFTER_VLAN			0x00040000
 #define FM10K_GCR		0x0003
-#define FM10K_FACTPS		0x0004
 #define FM10K_GCR_EXT		0x0005
 
 /* Interrupt control registers */
 #define FM10K_EICR		0x0006
-#define FM10K_EICR_PCA_FAULT			0x00000001
-#define FM10K_EICR_THI_FAULT			0x00000004
-#define FM10K_EICR_FUM_FAULT			0x00000020
 #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
-#define FM10K_EICR_SRAMERROR			0x00000400
 #define FM10K_EICR_VFLR				0x00000800
 #define FM10K_EICR_MAXHOLDTIME			0x00001000
 #define FM10K_EIMR		0x0007
@@ -196,7 +183,6 @@ 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)
@@ -217,38 +203,23 @@ struct fm10k_hw;
 #define FM10K_TC_RATE_INTERVAL_4US_GEN1		0x00020000
 #define FM10K_TC_RATE_INTERVAL_4US_GEN2		0x00040000
 #define FM10K_TC_RATE_INTERVAL_4US_GEN3		0x00080000
-#define FM10K_TC_RATE_STATUS	0x20C0
-#define FM10K_PAUSE		0x20C2
 
 /* DMA control registers */
 #define FM10K_DMA_CTRL		0x20C3
 #define FM10K_DMA_CTRL_TX_ENABLE		0x00000001
-#define FM10K_DMA_CTRL_TX_HOST_PENDING		0x00000002
-#define FM10K_DMA_CTRL_TX_DATA			0x00000004
 #define FM10K_DMA_CTRL_TX_ACTIVE		0x00000008
 #define FM10K_DMA_CTRL_RX_ENABLE		0x00000010
-#define FM10K_DMA_CTRL_RX_HOST_PENDING		0x00000020
-#define FM10K_DMA_CTRL_RX_DATA			0x00000040
 #define FM10K_DMA_CTRL_RX_ACTIVE		0x00000080
 #define FM10K_DMA_CTRL_RX_DESC_SIZE		0x00000100
-#define FM10K_DMA_CTRL_MINMSS_SHIFT		9
 #define FM10K_DMA_CTRL_MINMSS_64		0x00008000
-#define FM10K_DMA_CTRL_MAX_HOLD_TIME_SHIFT	23
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN3	0x04800000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN2	0x04000000
 #define FM10K_DMA_CTRL_MAX_HOLD_1US_GEN1	0x03800000
 #define FM10K_DMA_CTRL_DATAPATH_RESET		0x20000000
-#define FM10K_DMA_CTRL_MAXNUMOFQ_MASK		0xC0000000
 #define FM10K_DMA_CTRL_32_DESC			0x00000000
-#define FM10K_DMA_CTRL_64_DESC			0x40000000
-#define FM10K_DMA_CTRL_128_DESC			0x80000000
 
 #define FM10K_DMA_CTRL2		0x20C4
-#define FM10K_DMA_CTRL2_TX_FRAME_SPACING_SHIFT	5
 #define FM10K_DMA_CTRL2_SWITCH_READY		0x00002000
-#define FM10K_DMA_CTRL2_RX_DESC_READ_PRIO_SHIFT	14
-#define FM10K_DMA_CTRL2_TX_DESC_READ_PRIO_SHIFT	17
-#define FM10K_DMA_CTRL2_TX_DATA_READ_PRIO_SHIFT	20
 
 /* TSO flags configuration
  * First packet contains all flags except for fin and psh
@@ -261,7 +232,6 @@ struct fm10k_hw;
 #define FM10K_DTXTCPFLGH	0x20C6
 
 #define FM10K_TPH_CTRL		0x20C7
-#define FM10K_TPH_CTRL_DISABLE_READ_HINT	0x00000080
 #define FM10K_MRQC(_n)		((_n) + 0x2100)
 #define FM10K_MRQC_TCP_IPV4			0x00000001
 #define FM10K_MRQC_IPV4				0x00000002
@@ -273,7 +243,6 @@ struct fm10k_hw;
 #define FM10K_TQMAP(_n)		((_n) + 0x2800)
 #define FM10K_TQMAP_TABLE_SIZE			2048
 #define FM10K_RQMAP(_n)		((_n) + 0x3000)
-#define FM10K_RQMAP_TABLE_SIZE			2048
 
 /* Hardware Statistics */
 #define FM10K_STATS_TIMEOUT		0x3800
@@ -286,16 +255,11 @@ struct fm10k_hw;
 #define FM10K_STATS_NODESC_DROP		0x3807
 
 /* Timesync registers */
-#define FM10K_RRTIME_CFG	0x3808
-#define FM10K_RRTIME_LIMIT(_n)	((_n) + 0x380C)
-#define FM10K_RRTIME_COUNT(_n)	((_n) + 0x3810)
 #define FM10K_SYSTIME		0x3814
-#define FM10K_SYSTIME0		0x3816
 #define FM10K_SYSTIME_CFG	0x3818
 #define FM10K_SYSTIME_CFG_STEP_MASK		0x0000000F
 
 /* PCIe state registers */
-#define FM10K_PFVFBME(_n)	((_n) + 0x381A)
 #define FM10K_PHYADDR		0x381C
 
 /* Rx ring registers */
@@ -304,8 +268,6 @@ struct fm10k_hw;
 #define FM10K_RDLEN(_n)		((0x40 * (_n)) + 0x4002)
 #define FM10K_TPH_RXCTRL(_n)	((0x40 * (_n)) + 0x4003)
 #define FM10K_TPH_RXCTRL_DESC_TPHEN		0x00000020
-#define FM10K_TPH_RXCTRL_HDR_TPHEN		0x00000040
-#define FM10K_TPH_RXCTRL_DATA_TPHEN		0x00000080
 #define FM10K_TPH_RXCTRL_DESC_RROEN		0x00000200
 #define FM10K_TPH_RXCTRL_DATA_WROEN		0x00002000
 #define FM10K_TPH_RXCTRL_HDR_WROEN		0x00008000
@@ -319,27 +281,10 @@ struct fm10k_hw;
 #define FM10K_RXQCTL_ID_MASK	(FM10K_RXQCTL_PF | FM10K_RXQCTL_VF)
 #define FM10K_RXDCTL(_n)	((0x40 * (_n)) + 0x4007)
 #define FM10K_RXDCTL_WRITE_BACK_MIN_DELAY	0x00000001
-#define FM10K_RXDCTL_WRITE_BACK_IMM		0x00000100
 #define FM10K_RXDCTL_DROP_ON_EMPTY		0x00000200
 #define FM10K_RXINT(_n)		((0x40 * (_n)) + 0x4008)
-#define FM10K_RXINT_TIMER_SHIFT			8
 #define FM10K_SRRCTL(_n)	((0x40 * (_n)) + 0x4009)
 #define FM10K_SRRCTL_BSIZEPKT_SHIFT		8 /* shift _right_ */
-#define FM10K_SRRCTL_BSIZEHDR_SHIFT		2 /* shift _left_ */
-#define FM10K_SRRCTL_BSIZEHDR_MASK		0x00003F00
-#define FM10K_SRRCTL_DESCTYPE_HDR_SPLIT		0x00004000
-#define FM10K_SRRCTL_DESCTYPE_SIZE_SPLIT	0x00008000
-#define FM10K_SRRCTL_PSRTYPE_INNER_TCPHDR	0x00010000
-#define FM10K_SRRCTL_PSRTYPE_INNER_UDPHDR	0x00020000
-#define FM10K_SRRCTL_PSRTYPE_INNER_IPV4HDR	0x00040000
-#define FM10K_SRRCTL_PSRTYPE_INNER_IPV6HDR	0x00080000
-#define FM10K_SRRCTL_PSRTYPE_INNER_L2HDR	0x00100000
-#define FM10K_SRRCTL_PSRTYPE_ENCAPHDR		0x00200000
-#define FM10K_SRRCTL_PSRTYPE_TCPHDR		0x00400000
-#define FM10K_SRRCTL_PSRTYPE_UDPHDR		0x00800000
-#define FM10K_SRRCTL_PSRTYPE_IPV4HDR		0x01000000
-#define FM10K_SRRCTL_PSRTYPE_IPV6HDR		0x02000000
-#define FM10K_SRRCTL_PSRTYPE_L2HDR		0x04000000
 #define FM10K_SRRCTL_LOOPBACK_SUPPRESS		0x40000000
 #define FM10K_SRRCTL_BUFFER_CHAINING_EN		0x80000000
 
@@ -380,7 +325,6 @@ struct fm10k_hw;
 #define FM10K_TXDCTL(_n)	((0x40 * (_n)) + 0x8006)
 #define FM10K_TXDCTL_ENABLE			0x00004000
 #define FM10K_TXDCTL_MAX_TIME_SHIFT		16
-#define FM10K_TXDCTL_PUSH_DESC			0x10000000
 #define FM10K_TXQCTL(_n)	((0x40 * (_n)) + 0x8007)
 #define FM10K_TXQCTL_PF				0x0000003F
 #define FM10K_TXQCTL_VF				0x00000040
@@ -388,13 +332,10 @@ struct fm10k_hw;
 #define FM10K_TXQCTL_PC_SHIFT			7
 #define FM10K_TXQCTL_PC_MASK			0x00000380
 #define FM10K_TXQCTL_TC_SHIFT			10
-#define FM10K_TXQCTL_TC_MASK			0x0000FC00
 #define FM10K_TXQCTL_VID_SHIFT			16
 #define FM10K_TXQCTL_VID_MASK			0x0FFF0000
 #define FM10K_TXQCTL_UNLIMITED_BW		0x10000000
-#define FM10K_TXQCTL_PUSHMODEDIS		0x20000000
 #define FM10K_TXINT(_n)		((0x40 * (_n)) + 0x8008)
-#define FM10K_TXINT_TIMER_SHIFT			8
 
 /* Tx Statistics */
 #define FM10K_QPTC(_n)		((0x40 * (_n)) + 0x8009)
@@ -404,13 +345,7 @@ struct fm10k_hw;
 /* Tx Push registers */
 #define FM10K_TQDLOC(_n)	((0x40 * (_n)) + 0x800C)
 #define FM10K_TQDLOC_BASE_32_DESC		0x08
-#define FM10K_TQDLOC_BASE_64_DESC		0x10
-#define FM10K_TQDLOC_BASE_128_DESC		0x20
 #define FM10K_TQDLOC_SIZE_32_DESC		0x00050000
-#define FM10K_TQDLOC_SIZE_64_DESC		0x00060000
-#define FM10K_TQDLOC_SIZE_128_DESC		0x00070000
-#define FM10K_TQDLOC_SIZE_SHIFT			16
-#define FM10K_TX_DCACHE(_n, _m)	((0x400 * (_n)) + (0x4 * (_m)) + 0x40000)
 
 /* Tx GLORT registers */
 #define FM10K_TX_SGLORT(_n)	((0x40 * (_n)) + 0x800D)
@@ -418,50 +353,27 @@ struct fm10k_hw;
 #define FM10K_PFVTCTL_FTAG_DESC_ENABLE		0x00000001
 
 /* Interrupt moderation and control registers */
-#define FM10K_PBACL(_n)		((_n) + 0x10000)
 #define FM10K_INT_MAP(_n)	((_n) + 0x10080)
 #define FM10K_INT_MAP_TIMER0			0x00000000
 #define FM10K_INT_MAP_TIMER1			0x00000100
 #define FM10K_INT_MAP_IMMEDIATE			0x00000200
 #define FM10K_INT_MAP_DISABLE			0x00000300
-#define FM10K_MSIX_VECTOR_ADDR_LO(_n)	((0x4 * (_n)) + 0x11000)
-#define FM10K_MSIX_VECTOR_ADDR_HI(_n)	((0x4 * (_n)) + 0x11001)
-#define FM10K_MSIX_VECTOR_DATA(_n)	((0x4 * (_n)) + 0x11002)
 #define FM10K_MSIX_VECTOR_MASK(_n)	((0x4 * (_n)) + 0x11003)
 #define FM10K_INT_CTRL		0x12000
 #define FM10K_INT_CTRL_ENABLEMODERATOR		0x00000400
 #define FM10K_ITR(_n)		((_n) + 0x12400)
 #define FM10K_ITR_INTERVAL1_SHIFT		12
-#define FM10K_ITR_TIMER0_EXPIRED		0x01000000
-#define FM10K_ITR_TIMER1_EXPIRED		0x02000000
-#define FM10K_ITR_PENDING0			0x04000000
-#define FM10K_ITR_PENDING1			0x08000000
 #define FM10K_ITR_PENDING2			0x10000000
 #define FM10K_ITR_AUTOMASK			0x20000000
 #define FM10K_ITR_MASK_SET			0x40000000
 #define FM10K_ITR_MASK_CLEAR			0x80000000
 #define FM10K_ITR2(_n)		((0x2 * (_n)) + 0x12800)
-#define FM10K_ITR2_LP(_n)	((0x2 * (_n)) + 0x12801)
 #define FM10K_ITR_REG_COUNT			768
 #define FM10K_ITR_REG_COUNT_PF			256
 
 /* Switch manager interrupt registers */
 #define FM10K_IP		0x13000
-#define FM10K_IP_HOT_RESET			0x00000001
-#define FM10K_IP_DEVICE_STATE_CHANGE		0x00000002
-#define FM10K_IP_MAILBOX			0x00000004
-#define FM10K_IP_VPD_REQUEST			0x00000008
-#define FM10K_IP_SRAMERROR			0x00000010
-#define FM10K_IP_PFLR				0x00000020
-#define FM10K_IP_DATAPATHRESET			0x00000040
-#define FM10K_IP_OUTOFRESET			0x00000080
 #define FM10K_IP_NOTINRESET			0x00000100
-#define FM10K_IP_TIMEOUT			0x00000200
-#define FM10K_IP_VFLR				0x00000400
-#define FM10K_IM		0x13001
-#define FM10K_IB		0x13002
-#define FM10K_SRAM_IP		0x13003
-#define FM10K_SRAM_IM		0x13004
 
 /* VLAN registers */
 #define FM10K_VLAN_TABLE(_n, _m)	((0x80 * (_n)) + (_m) + 0x14000)
@@ -499,12 +411,8 @@ struct fm10k_hw;
 #define FM10K_VFINT_MAP		0x00030
 #define FM10K_VFSYSTIME		0x00040
 #define FM10K_VFITR(_n)		((_n) + 0x00060)
-#define FM10K_VFPBACL(_n)	((_n) + 0x00008)
 
 /* Registers contained in BAR 4 for Switch management */
-#define FM10K_SW_SYSTIME_CFG	0x0224C
-#define FM10K_SW_SYSTIME_CFG_STEP_SHIFT		4
-#define FM10K_SW_SYSTIME_CFG_ADJUST_MASK	0xFF000000
 #define FM10K_SW_SYSTIME_ADJUST	0x0224D
 #define FM10K_SW_SYSTIME_ADJUST_MASK		0x3FFFFFFF
 #define FM10K_SW_SYSTIME_ADJUST_DIR_POSITIVE	0x80000000
@@ -778,8 +686,6 @@ struct fm10k_vf_info {
 #define FM10K_VF_FLAG_CAPABLE(vf_info)	((vf_info)->vf_flags & (u8)0xF)
 #define FM10K_VF_FLAG_ENABLED(vf_info)	((vf_info)->vf_flags >> 4)
 #define FM10K_VF_FLAG_SET_MODE(mode)	((u8)0x10 << (mode))
-#define FM10K_VF_FLAG_ENABLED_MODE_SHIFT	4
-#define FM10K_VF_FLAG_SET_MODE_MASK	((u8)0xF0)
 #define FM10K_VF_FLAG_SET_MODE_NONE \
 	FM10K_VF_FLAG_SET_MODE(FM10K_XCAST_MODE_NONE)
 #define FM10K_VF_FLAG_MULTI_ENABLED \
@@ -850,13 +756,11 @@ struct fm10k_tx_desc_cache {
 #define FM10K_TXD_FLAG_INT	0x01
 #define FM10K_TXD_FLAG_TIME	0x02
 #define FM10K_TXD_FLAG_CSUM	0x04
-#define FM10K_TXD_FLAG_CSUM2	0x08
 #define FM10K_TXD_FLAG_FTAG	0x10
 #define FM10K_TXD_FLAG_RS	0x20
 #define FM10K_TXD_FLAG_LAST	0x40
 #define FM10K_TXD_FLAG_DONE	0x80
 
-#define FM10K_TXD_VLAN_PRI_SHIFT	12
 
 /* These macros are meant to enable optimal placement of the RS and INT
  * bits.  It will point us to the last descriptor in the cache for either the
@@ -865,8 +769,6 @@ struct fm10k_tx_desc_cache {
  * in the FIFO to prevent an unnecessary write.
  */
 #define FM10K_TXD_WB_FIFO_SIZE	4
-#define FM10K_TXD_WB_IDX(idx) \
-	(((idx) - 1) | (FM10K_TXD_WB_FIFO_SIZE - 1))
 
 /* Receive Descriptor - 32B */
 union fm10k_rx_desc {
@@ -911,29 +813,6 @@ enum fm10k_rdesc_rss_type {
 	/* Reserved 0x9 - 0xF */
 };
 
-#define FM10K_RXD_PKTTYPE_MASK		0x03F0
-#define FM10K_RXD_PKTTYPE_MASK_L3	0x0070
-#define FM10K_RXD_PKTTYPE_MASK_L4	0x0380
-#define FM10K_RXD_PKTTYPE_SHIFT		4
-#define FM10K_RXD_PKTTYPE_INNER_MASK_L3	0x1C00
-#define FM10K_RXD_PKTTYPE_INNER_MASK_L4	0xE000
-#define FM10K_RXD_PKTTYPE_INNER_SHIFT	10
-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_HDR_INFO_XC_MASK	0x0006
 enum fm10k_rxdesc_xc {
@@ -942,20 +821,11 @@ enum fm10k_rxdesc_xc {
 	FM10K_XC_BROADCAST	= 0x6
 };
 
-#define FM10K_RXD_HDR_INFO_LEN_SHIFT	5
-#define FM10K_RXD_HDR_INFO_SPH		0x8000
 
 #define FM10K_RXD_STATUS_DD		0x0001 /* Descriptor done */
 #define FM10K_RXD_STATUS_EOP		0x0002 /* End of packet */
-#define FM10K_RXD_STATUS_VEXT		0x0004 /* A VLAN tag is present */
-#define FM10K_RXD_STATUS_IPCS		0x0008 /* Indicates IPv4 csum */
 #define FM10K_RXD_STATUS_L4CS		0x0010 /* Indicates an L4 csum */
-#define FM10K_RXD_STATUS_IPCS2		0x0020 /* Inner header IPv4 csum */
 #define FM10K_RXD_STATUS_L4CS2		0x0040 /* Inner header L4 csum */
-#define FM10K_RXD_STATUS_IPFRAG_MASK	0x0180 /* Fragment mask */
-#define FM10K_RXD_STATUS_IPFRAG_CSUM	0x0100 /* Fragment w/ CSUM field */
-#define FM10K_RXD_STATUS_VEXT2		0x0200 /* A custom tag is present */
-#define FM10K_RXD_STATUS_HBO		0x0400 /* header buffer overrun */
 #define FM10K_RXD_STATUS_L4E2		0x0800 /* Inner header L4 csum err */
 #define FM10K_RXD_STATUS_IPE2		0x1000 /* Inner header IPv4 csum err */
 #define FM10K_RXD_STATUS_RXE		0x2000 /* Generic Rx error */
@@ -968,8 +838,6 @@ enum fm10k_rxdesc_xc {
 #define FM10K_RXD_ERR_SWITCH_READY	0x0008 /* Link transition mid-packet */
 #define FM10K_RXD_ERR_TOO_BIG		0x0010 /* Pkt too big for single buf */
 
-#define FM10K_RXD_VLAN_ID_MASK		0x0FFF
-#define FM10K_RXD_VLAN_PRI_SHIFT	FM10K_TXD_VLAN_PRI_SHIFT
 
 struct fm10k_ftag {
 	__be16 swpri_type_user;
-- 
1.9.3

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

* [PATCH v3 18/18] fm10k/base: remove unused struct element
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (16 preceding siblings ...)
  2016-02-19 11:07         ` [PATCH v3 17/18] fm10k/base: minor cleanups Wang Xiao W
@ 2016-02-19 11:07         ` Wang Xiao W
  2016-02-29  2:30         ` [PATCH v3 00/18] fm10k: update shared code Ding, HengX
  2016-03-08 13:24         ` Bruce Richardson
  19 siblings, 0 replies; 69+ messages in thread
From: Wang Xiao W @ 2016-02-19 11:07 UTC (permalink / raw)
  To: jing.d.chen; +Cc: dev

Remove the unused element request_lport_map in struct fm10k_mac_ops.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 drivers/net/fm10k/base/fm10k_type.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index f807216..3fc8f13 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -604,7 +604,6 @@ struct fm10k_mac_ops {
 				    struct fm10k_dglort_cfg *);
 	void (*set_dma_mask)(struct fm10k_hw *, u64);
 	s32 (*get_fault)(struct fm10k_hw *, int, struct fm10k_fault *);
-	void (*request_lport_map)(struct fm10k_hw *);
 	s32 (*adjust_systime)(struct fm10k_hw *, s32 ppb);
 	s32 (*notify_offset)(struct fm10k_hw *, u64 offset);
 	u64 (*read_systime)(struct fm10k_hw *);
-- 
1.9.3

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

* Re: [PATCH v3 00/18] fm10k: update shared code
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (17 preceding siblings ...)
  2016-02-19 11:07         ` [PATCH v3 18/18] fm10k/base: remove unused struct element Wang Xiao W
@ 2016-02-29  2:30         ` Ding, HengX
  2016-03-08 16:27           ` Bruce Richardson
  2016-03-08 13:24         ` Bruce Richardson
  19 siblings, 1 reply; 69+ messages in thread
From: Ding, HengX @ 2016-02-29  2:30 UTC (permalink / raw)
  To: Wang, Xiao W, Chen, Jing D, Ding, HengX; +Cc: dev

Tested-by: Heng Ding <hengx.ding@intel.com>

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wang Xiao W
Sent: Friday, February 19, 2016 7:07 PM
To: Chen, Jing D
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 00/18] fm10k: update shared code

v3:
* Fixed checkpatch.pl warning about long commit message.
* Fixed the issue of compile failure about part of patches applied.
* Split the misc-small-fixes patch into several patches.

v2:
* Put the two extra fix patches ahead of the base code patches.

This patch set has passed regression test.

Wang Xiao W (18):
  fm10k: use default mailbox message handler for PF
  fm10k/base: correct typecast in fm10k_update_xc_addr_pf
  fm10k/base: cleanup namespace pollution
  fm10k/base: use bitshift for itr_scale
  fm10k/base: reset max_queues on init_hw_vf failure
  fm10k/base: document ITR scale workaround in VF TDLEN register
  fm10k/base: cleanup lines over 80 characters
  fm10k/base: cleanup useless else
  fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
  fm10k/base: do not use CamelCase
  fm10k/base: use memcpy for mac addr copy
  fm10k/base: allow removal of is_slot_appropriate function
  fm10k/base: consistently use VLAN ID when referencing vid variables
  fm10k/base: imporve comment per upstream review changes
  fm10k/base: fix TLV structures alignment
  fm10k/base: move constants to the right of binary operators
  fm10k/base: minor cleanups
  fm10k/base: remove unused struct element

 drivers/net/fm10k/base/fm10k_api.c   |   2 +
 drivers/net/fm10k/base/fm10k_api.h   |   2 +
 drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
 drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
 drivers/net/fm10k/base/fm10k_osdep.h |  32 ++++++
 drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
 drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
 drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
 drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
 drivers/net/fm10k/base/fm10k_type.h  | 182 +++++++----------------------------
 drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
 drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
 12 files changed, 222 insertions(+), 298 deletions(-)

-- 
1.9.3

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

* Re: [PATCH v3 00/18] fm10k: update shared code
  2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
                           ` (18 preceding siblings ...)
  2016-02-29  2:30         ` [PATCH v3 00/18] fm10k: update shared code Ding, HengX
@ 2016-03-08 13:24         ` Bruce Richardson
  2016-03-08 14:15           ` Wang, Xiao W
  19 siblings, 1 reply; 69+ messages in thread
From: Bruce Richardson @ 2016-03-08 13:24 UTC (permalink / raw)
  To: Wang Xiao W, Mark Chen; +Cc: dev

On Fri, Feb 19, 2016 at 07:06:47PM +0800, Wang Xiao W wrote:
> v3:
> * Fixed checkpatch.pl warning about long commit message.
> * Fixed the issue of compile failure about part of patches applied.
> * Split the misc-small-fixes patch into several patches.
> 
> v2:
> * Put the two extra fix patches ahead of the base code patches.
> 
> This patch set has passed regression test.
> 
> Wang Xiao W (18):
>   fm10k: use default mailbox message handler for PF
>   fm10k/base: correct typecast in fm10k_update_xc_addr_pf
>   fm10k/base: cleanup namespace pollution
>   fm10k/base: use bitshift for itr_scale
>   fm10k/base: reset max_queues on init_hw_vf failure
>   fm10k/base: document ITR scale workaround in VF TDLEN register
>   fm10k/base: cleanup lines over 80 characters
>   fm10k/base: cleanup useless else
>   fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
>   fm10k/base: do not use CamelCase
>   fm10k/base: use memcpy for mac addr copy
>   fm10k/base: allow removal of is_slot_appropriate function
>   fm10k/base: consistently use VLAN ID when referencing vid variables
>   fm10k/base: imporve comment per upstream review changes
>   fm10k/base: fix TLV structures alignment
>   fm10k/base: move constants to the right of binary operators
>   fm10k/base: minor cleanups
>   fm10k/base: remove unused struct element
> 
>  drivers/net/fm10k/base/fm10k_api.c   |   2 +
>  drivers/net/fm10k/base/fm10k_api.h   |   2 +
>  drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
>  drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
>  drivers/net/fm10k/base/fm10k_osdep.h |  32 ++++++
>  drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
>  drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
>  drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
>  drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
>  drivers/net/fm10k/base/fm10k_type.h  | 182 +++++++----------------------------
>  drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
>  drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
>  12 files changed, 222 insertions(+), 298 deletions(-)
> 
> -- 
> 1.9.3
> 
Hi Mark,

Can we get fm10k maintainer review and/or ack on this patchset please.

Thanks,
/Bruce

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

* Re: [PATCH v3 00/18] fm10k: update shared code
  2016-03-08 13:24         ` Bruce Richardson
@ 2016-03-08 14:15           ` Wang, Xiao W
  2016-03-08 14:25             ` Chen, Jing D
  0 siblings, 1 reply; 69+ messages in thread
From: Wang, Xiao W @ 2016-03-08 14:15 UTC (permalink / raw)
  To: Richardson, Bruce, Chen, Jing D; +Cc: dev



> -----Original Message-----
> From: Richardson, Bruce
> Sent: Tuesday, March 8, 2016 9:24 PM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Chen, Jing D
> <jing.d.chen@intel.com>
> Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org; He, Shaopeng
> <shaopeng.he@intel.com>
> Subject: Re: [PATCH v3 00/18] fm10k: update shared code
> 
> On Fri, Feb 19, 2016 at 07:06:47PM +0800, Wang Xiao W wrote:
> > v3:
> > * Fixed checkpatch.pl warning about long commit message.
> > * Fixed the issue of compile failure about part of patches applied.
> > * Split the misc-small-fixes patch into several patches.
> >
> > v2:
> > * Put the two extra fix patches ahead of the base code patches.
> >
> > This patch set has passed regression test.
> >
> > Wang Xiao W (18):
> >   fm10k: use default mailbox message handler for PF
> >   fm10k/base: correct typecast in fm10k_update_xc_addr_pf
> >   fm10k/base: cleanup namespace pollution
> >   fm10k/base: use bitshift for itr_scale
> >   fm10k/base: reset max_queues on init_hw_vf failure
> >   fm10k/base: document ITR scale workaround in VF TDLEN register
> >   fm10k/base: cleanup lines over 80 characters
> >   fm10k/base: cleanup useless else
> >   fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
> >   fm10k/base: do not use CamelCase
> >   fm10k/base: use memcpy for mac addr copy
> >   fm10k/base: allow removal of is_slot_appropriate function
> >   fm10k/base: consistently use VLAN ID when referencing vid variables
> >   fm10k/base: imporve comment per upstream review changes
> >   fm10k/base: fix TLV structures alignment
> >   fm10k/base: move constants to the right of binary operators
> >   fm10k/base: minor cleanups
> >   fm10k/base: remove unused struct element
> >
> >  drivers/net/fm10k/base/fm10k_api.c   |   2 +
> >  drivers/net/fm10k/base/fm10k_api.h   |   2 +
> >  drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
> >  drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
> >  drivers/net/fm10k/base/fm10k_osdep.h |  32 ++++++
> >  drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
> >  drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
> >  drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
> >  drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
> >  drivers/net/fm10k/base/fm10k_type.h  | 182 +++++++----------------------------
> >  drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
> >  drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
> >  12 files changed, 222 insertions(+), 298 deletions(-)
> >
> > --
> > 1.9.3
> >
> Hi Mark,
> 
> Can we get fm10k maintainer review and/or ack on this patchset please.
> 
> Thanks,
> /Bruce

Hi Bruce,

Mark has reviewed and acked the patch set in v2, and I put the "Acked-by " in the v3 01/18 patch.
It's the same for my FTAG patch.

Best Regards,
Xiao 

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

* Re: [PATCH v3 00/18] fm10k: update shared code
  2016-03-08 14:15           ` Wang, Xiao W
@ 2016-03-08 14:25             ` Chen, Jing D
  2016-03-08 14:32               ` Wang, Xiao W
  2016-03-08 14:53               ` Bruce Richardson
  0 siblings, 2 replies; 69+ messages in thread
From: Chen, Jing D @ 2016-03-08 14:25 UTC (permalink / raw)
  To: Wang, Xiao W, Richardson, Bruce; +Cc: dev

Hi, Xiao

> -----Original Message-----
> From: Wang, Xiao W
> Sent: Tuesday, March 8, 2016 8:15 AM
> To: Richardson, Bruce <bruce.richardson@intel.com>; Chen, Jing D
> <jing.d.chen@intel.com>
> Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org; He, Shaopeng
> <shaopeng.he@intel.com>
> Subject: RE: [PATCH v3 00/18] fm10k: update shared code
> 
> 
> 
> > -----Original Message-----
> > From: Richardson, Bruce
> > Sent: Tuesday, March 8, 2016 9:24 PM
> > To: Wang, Xiao W <xiao.w.wang@intel.com>; Chen, Jing D
> > <jing.d.chen@intel.com>
> > Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org; He, Shaopeng
> > <shaopeng.he@intel.com>
> > Subject: Re: [PATCH v3 00/18] fm10k: update shared code
> >
> > On Fri, Feb 19, 2016 at 07:06:47PM +0800, Wang Xiao W wrote:
> > > v3:
> > > * Fixed checkpatch.pl warning about long commit message.
> > > * Fixed the issue of compile failure about part of patches applied.
> > > * Split the misc-small-fixes patch into several patches.
> > >
> > > v2:
> > > * Put the two extra fix patches ahead of the base code patches.
> > >
> > > This patch set has passed regression test.
> > >
> > > Wang Xiao W (18):
> > >   fm10k: use default mailbox message handler for PF
> > >   fm10k/base: correct typecast in fm10k_update_xc_addr_pf
> > >   fm10k/base: cleanup namespace pollution
> > >   fm10k/base: use bitshift for itr_scale
> > >   fm10k/base: reset max_queues on init_hw_vf failure
> > >   fm10k/base: document ITR scale workaround in VF TDLEN register
> > >   fm10k/base: cleanup lines over 80 characters
> > >   fm10k/base: cleanup useless else
> > >   fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
> > >   fm10k/base: do not use CamelCase
> > >   fm10k/base: use memcpy for mac addr copy
> > >   fm10k/base: allow removal of is_slot_appropriate function
> > >   fm10k/base: consistently use VLAN ID when referencing vid variables
> > >   fm10k/base: imporve comment per upstream review changes
> > >   fm10k/base: fix TLV structures alignment
> > >   fm10k/base: move constants to the right of binary operators
> > >   fm10k/base: minor cleanups
> > >   fm10k/base: remove unused struct element
> > >
> > >  drivers/net/fm10k/base/fm10k_api.c   |   2 +
> > >  drivers/net/fm10k/base/fm10k_api.h   |   2 +
> > >  drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
> > >  drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
> > >  drivers/net/fm10k/base/fm10k_osdep.h |  32 ++++++
> > >  drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
> > >  drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
> > >  drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
> > >  drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
> > >  drivers/net/fm10k/base/fm10k_type.h  | 182 +++++++---------------------
> -------
> > >  drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
> > >  drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
> > >  12 files changed, 222 insertions(+), 298 deletions(-)
> > >
> > > --
> > > 1.9.3
> > >
> > Hi Mark,
> >
> > Can we get fm10k maintainer review and/or ack on this patchset please.
> >
> > Thanks,
> > /Bruce
> 
> Hi Bruce,
> 
> Mark has reviewed and acked the patch set in v2, and I put the "Acked-by "
> in the v3 01/18 patch.
> It's the same for my FTAG patch.
> 

It's better to add acked-by in both patch set and cover letter, this may be more
helpful for maintainers. 

> Best Regards,
> Xiao

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

* Re: [PATCH v3 00/18] fm10k: update shared code
  2016-03-08 14:25             ` Chen, Jing D
@ 2016-03-08 14:32               ` Wang, Xiao W
  2016-03-08 14:53               ` Bruce Richardson
  1 sibling, 0 replies; 69+ messages in thread
From: Wang, Xiao W @ 2016-03-08 14:32 UTC (permalink / raw)
  To: Chen, Jing D, Richardson, Bruce; +Cc: dev

Hi Mark,

> -----Original Message-----
> From: Chen, Jing D
> Sent: Tuesday, March 8, 2016 10:25 PM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>
> Cc: dev@dpdk.org; He, Shaopeng <shaopeng.he@intel.com>
> Subject: RE: [PATCH v3 00/18] fm10k: update shared code
> 
> Hi, Xiao
> 
> > -----Original Message-----
> > From: Wang, Xiao W
> > Sent: Tuesday, March 8, 2016 8:15 AM
> > To: Richardson, Bruce <bruce.richardson@intel.com>; Chen, Jing D
> > <jing.d.chen@intel.com>
> > Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org; He, Shaopeng
> > <shaopeng.he@intel.com>
> > Subject: RE: [PATCH v3 00/18] fm10k: update shared code
> >
> >
> >
> > > -----Original Message-----
> > > From: Richardson, Bruce
> > > Sent: Tuesday, March 8, 2016 9:24 PM
> > > To: Wang, Xiao W <xiao.w.wang@intel.com>; Chen, Jing D
> > > <jing.d.chen@intel.com>
> > > Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org; He, Shaopeng
> > > <shaopeng.he@intel.com>
> > > Subject: Re: [PATCH v3 00/18] fm10k: update shared code
> > >
> > > On Fri, Feb 19, 2016 at 07:06:47PM +0800, Wang Xiao W wrote:
> > > > v3:
> > > > * Fixed checkpatch.pl warning about long commit message.
> > > > * Fixed the issue of compile failure about part of patches applied.
> > > > * Split the misc-small-fixes patch into several patches.
> > > >
> > > > v2:
> > > > * Put the two extra fix patches ahead of the base code patches.
> > > >
> > > > This patch set has passed regression test.
> > > >
> > > > Wang Xiao W (18):
> > > >   fm10k: use default mailbox message handler for PF
> > > >   fm10k/base: correct typecast in fm10k_update_xc_addr_pf
> > > >   fm10k/base: cleanup namespace pollution
> > > >   fm10k/base: use bitshift for itr_scale
> > > >   fm10k/base: reset max_queues on init_hw_vf failure
> > > >   fm10k/base: document ITR scale workaround in VF TDLEN register
> > > >   fm10k/base: cleanup lines over 80 characters
> > > >   fm10k/base: cleanup useless else
> > > >   fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
> > > >   fm10k/base: do not use CamelCase
> > > >   fm10k/base: use memcpy for mac addr copy
> > > >   fm10k/base: allow removal of is_slot_appropriate function
> > > >   fm10k/base: consistently use VLAN ID when referencing vid variables
> > > >   fm10k/base: imporve comment per upstream review changes
> > > >   fm10k/base: fix TLV structures alignment
> > > >   fm10k/base: move constants to the right of binary operators
> > > >   fm10k/base: minor cleanups
> > > >   fm10k/base: remove unused struct element
> > > >
> > > >  drivers/net/fm10k/base/fm10k_api.c   |   2 +
> > > >  drivers/net/fm10k/base/fm10k_api.h   |   2 +
> > > >  drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
> > > >  drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
> > > >  drivers/net/fm10k/base/fm10k_osdep.h |  32 ++++++
> > > >  drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
> > > >  drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
> > > >  drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
> > > >  drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
> > > >  drivers/net/fm10k/base/fm10k_type.h  | 182
> > > > +++++++---------------------
> > -------
> > > >  drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
> > > >  drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
> > > >  12 files changed, 222 insertions(+), 298 deletions(-)
> > > >
> > > > --
> > > > 1.9.3
> > > >
> > > Hi Mark,
> > >
> > > Can we get fm10k maintainer review and/or ack on this patchset please.
> > >
> > > Thanks,
> > > /Bruce
> >
> > Hi Bruce,
> >
> > Mark has reviewed and acked the patch set in v2, and I put the "Acked-by "
> > in the v3 01/18 patch.
> > It's the same for my FTAG patch.
> >
> 
> It's better to add acked-by in both patch set and cover letter, this may be more
> helpful for maintainers.
> 
> > Best Regards,
> > Xiao

OK, I've realized this.

Thanks,
Xiao

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

* Re: [PATCH v3 00/18] fm10k: update shared code
  2016-03-08 14:25             ` Chen, Jing D
  2016-03-08 14:32               ` Wang, Xiao W
@ 2016-03-08 14:53               ` Bruce Richardson
  1 sibling, 0 replies; 69+ messages in thread
From: Bruce Richardson @ 2016-03-08 14:53 UTC (permalink / raw)
  To: Chen, Jing D; +Cc: dev

On Tue, Mar 08, 2016 at 02:25:27PM +0000, Chen, Jing D wrote:
> Hi, Xiao
> 
> > -----Original Message-----
> > From: Wang, Xiao W
> > Sent: Tuesday, March 8, 2016 8:15 AM
> > To: Richardson, Bruce <bruce.richardson@intel.com>; Chen, Jing D
> > <jing.d.chen@intel.com>
> > Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org; He, Shaopeng
> > <shaopeng.he@intel.com>
> > Subject: RE: [PATCH v3 00/18] fm10k: update shared code
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: Richardson, Bruce
> > > Sent: Tuesday, March 8, 2016 9:24 PM
> > > To: Wang, Xiao W <xiao.w.wang@intel.com>; Chen, Jing D
> > > <jing.d.chen@intel.com>
> > > Cc: Chen, Jing D <jing.d.chen@intel.com>; dev@dpdk.org; He, Shaopeng
> > > <shaopeng.he@intel.com>
> > > Subject: Re: [PATCH v3 00/18] fm10k: update shared code
> > >
> > > On Fri, Feb 19, 2016 at 07:06:47PM +0800, Wang Xiao W wrote:
> > > > v3:
> > > > * Fixed checkpatch.pl warning about long commit message.
> > > > * Fixed the issue of compile failure about part of patches applied.
> > > > * Split the misc-small-fixes patch into several patches.
> > > >
> > > > v2:
> > > > * Put the two extra fix patches ahead of the base code patches.
> > > >
> > > > This patch set has passed regression test.
> > > >
> > > > Wang Xiao W (18):
> > > >   fm10k: use default mailbox message handler for PF
> > > >   fm10k/base: correct typecast in fm10k_update_xc_addr_pf
> > > >   fm10k/base: cleanup namespace pollution
> > > >   fm10k/base: use bitshift for itr_scale
> > > >   fm10k/base: reset max_queues on init_hw_vf failure
> > > >   fm10k/base: document ITR scale workaround in VF TDLEN register
> > > >   fm10k/base: cleanup lines over 80 characters
> > > >   fm10k/base: cleanup useless else
> > > >   fm10k/base: use BIT macro instead of open-coded bit-shifting of 1
> > > >   fm10k/base: do not use CamelCase
> > > >   fm10k/base: use memcpy for mac addr copy
> > > >   fm10k/base: allow removal of is_slot_appropriate function
> > > >   fm10k/base: consistently use VLAN ID when referencing vid variables
> > > >   fm10k/base: imporve comment per upstream review changes
> > > >   fm10k/base: fix TLV structures alignment
> > > >   fm10k/base: move constants to the right of binary operators
> > > >   fm10k/base: minor cleanups
> > > >   fm10k/base: remove unused struct element
> > > >
> > > >  drivers/net/fm10k/base/fm10k_api.c   |   2 +
> > > >  drivers/net/fm10k/base/fm10k_api.h   |   2 +
> > > >  drivers/net/fm10k/base/fm10k_mbx.c   |  63 +++++++-----
> > > >  drivers/net/fm10k/base/fm10k_mbx.h   |  11 +--
> > > >  drivers/net/fm10k/base/fm10k_osdep.h |  32 ++++++
> > > >  drivers/net/fm10k/base/fm10k_pf.c    |  88 +++++++++--------
> > > >  drivers/net/fm10k/base/fm10k_pf.h    |  18 ++--
> > > >  drivers/net/fm10k/base/fm10k_tlv.c   |  40 ++++----
> > > >  drivers/net/fm10k/base/fm10k_tlv.h   |   9 +-
> > > >  drivers/net/fm10k/base/fm10k_type.h  | 182 +++++++---------------------
> > -------
> > > >  drivers/net/fm10k/base/fm10k_vf.c    |  32 ++++--
> > > >  drivers/net/fm10k/fm10k_ethdev.c     |  41 +++-----
> > > >  12 files changed, 222 insertions(+), 298 deletions(-)
> > > >
> > > > --
> > > > 1.9.3
> > > >
> > > Hi Mark,
> > >
> > > Can we get fm10k maintainer review and/or ack on this patchset please.
> > >
> > > Thanks,
> > > /Bruce
> > 
> > Hi Bruce,
> > 
> > Mark has reviewed and acked the patch set in v2, and I put the "Acked-by "
> > in the v3 01/18 patch.
> > It's the same for my FTAG patch.
> > 
> 
> It's better to add acked-by in both patch set and cover letter, this may be more
> helpful for maintainers. 
> 
An earlier ack should be reflected by putting the ack on all patches of the set
in later revisions. If it's only on patch 1, that implies that only that one patch
has been acked. If the ack is included in the cover letter only, then it's likely
to be missed, as a series ack is expected as a reply to the cover letter (because
as stated above, subsequent revs should include the ack in each patch itself)

/Bruce

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

* Re: [PATCH v3 00/18] fm10k: update shared code
  2016-02-29  2:30         ` [PATCH v3 00/18] fm10k: update shared code Ding, HengX
@ 2016-03-08 16:27           ` Bruce Richardson
  0 siblings, 0 replies; 69+ messages in thread
From: Bruce Richardson @ 2016-03-08 16:27 UTC (permalink / raw)
  To: Ding, HengX; +Cc: dev

On Mon, Feb 29, 2016 at 02:30:45AM +0000, Ding, HengX wrote:
> Tested-by: Heng Ding <hengx.ding@intel.com>
> 
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wang Xiao W
> Sent: Friday, February 19, 2016 7:07 PM
> To: Chen, Jing D
> Cc: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v3 00/18] fm10k: update shared code
> 
> v3:
> * Fixed checkpatch.pl warning about long commit message.
> * Fixed the issue of compile failure about part of patches applied.
> * Split the misc-small-fixes patch into several patches.
> 
> v2:
> * Put the two extra fix patches ahead of the base code patches.
> 
Applied to dpdk-next-net/rel_16_04

/Bruce

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

end of thread, other threads:[~2016-03-08 16:27 UTC | newest]

Thread overview: 69+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-21 10:35 [PATCH 00/16] fm10k: update shared code from ND team Wang Xiao W
2016-01-21 10:35 ` [PATCH 01/16] fm10k/base: cleanup namespace pollution and correct typecast Wang Xiao W
2016-01-21 10:35 ` [PATCH 02/16] fm10k/base: use bitshift for itr_scale Wang Xiao W
2016-01-21 10:35 ` [PATCH 03/16] fm10k/base: reset max_queues on init_hw_vf failure Wang Xiao W
2016-01-21 10:35 ` [PATCH 04/16] fm10k/base: document ITR scale workaround in VF TDLEN register Wang Xiao W
2016-01-21 10:35 ` [PATCH 05/16] fm10k/base: fix checkpatch warning Wang Xiao W
2016-01-21 10:35 ` [PATCH 06/16] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1 Wang Xiao W
2016-01-21 10:35 ` [PATCH 07/16] fm10k/base: do not use CamelCase Wang Xiao W
2016-01-21 10:35 ` [PATCH 08/16] fm10k/base: use memcpy for mac addr copy Wang Xiao W
2016-01-21 10:35 ` [PATCH 09/16] fm10k/base: allow removal of is_slot_appropriate function Wang Xiao W
2016-01-21 10:35 ` [PATCH 10/16] fm10k/base: consistently use VLAN ID when referencing vid variables Wang Xiao W
2016-01-21 10:35 ` [PATCH 11/16] fm10k/base: fix comment per upstream review changes Wang Xiao W
2016-01-21 10:35 ` [PATCH 12/16] fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned Wang Xiao W
2016-01-21 10:35 ` [PATCH 13/16] fm10k/base: move constants to the right of binary operators Wang Xiao W
2016-01-21 10:35 ` [PATCH 14/16] fm10k/base: minor cleanups Wang Xiao W
2016-01-21 10:36 ` [PATCH 15/16] fm10k: use default mailbox message handler for pf Wang Xiao W
2016-01-22 21:31   ` Bruce Richardson
2016-01-25  2:31     ` Wang, Xiao W
2016-01-26 20:16       ` Bruce Richardson
2016-01-27  1:57         ` Wang, Xiao W
2016-01-27  3:50   ` [PATCH v2 00/16] fm10k: update shared code Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 01/16] fm10k: use default mailbox message handler for pf Wang Xiao W
2016-02-16 10:50       ` Bruce Richardson
2016-02-18 10:25         ` Wang, Xiao W
2016-02-19 11:06       ` [PATCH v3 00/18] fm10k: update shared code Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 01/18] fm10k: use default mailbox message handler for PF Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 02/18] fm10k/base: correct typecast in fm10k_update_xc_addr_pf Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 03/18] fm10k/base: cleanup namespace pollution Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 04/18] fm10k/base: use bitshift for itr_scale Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 05/18] fm10k/base: reset max_queues on init_hw_vf failure Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 06/18] fm10k/base: document ITR scale workaround in VF TDLEN register Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 07/18] fm10k/base: cleanup lines over 80 characters Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 08/18] fm10k/base: cleanup useless else Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 09/18] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1 Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 10/18] fm10k/base: do not use CamelCase Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 11/18] fm10k/base: use memcpy for mac addr copy Wang Xiao W
2016-02-19 11:06         ` [PATCH v3 12/18] fm10k/base: allow removal of is_slot_appropriate function Wang Xiao W
2016-02-19 11:07         ` [PATCH v3 13/18] fm10k/base: consistently use VLAN ID when referencing vid variables Wang Xiao W
2016-02-19 11:07         ` [PATCH v3 14/18] fm10k/base: imporve comment per upstream review changes Wang Xiao W
2016-02-19 11:07         ` [PATCH v3 15/18] fm10k/base: fix TLV structures alignment Wang Xiao W
2016-02-19 11:07         ` [PATCH v3 16/18] fm10k/base: move constants to the right of binary operators Wang Xiao W
2016-02-19 11:07         ` [PATCH v3 17/18] fm10k/base: minor cleanups Wang Xiao W
2016-02-19 11:07         ` [PATCH v3 18/18] fm10k/base: remove unused struct element Wang Xiao W
2016-02-29  2:30         ` [PATCH v3 00/18] fm10k: update shared code Ding, HengX
2016-03-08 16:27           ` Bruce Richardson
2016-03-08 13:24         ` Bruce Richardson
2016-03-08 14:15           ` Wang, Xiao W
2016-03-08 14:25             ` Chen, Jing D
2016-03-08 14:32               ` Wang, Xiao W
2016-03-08 14:53               ` Bruce Richardson
2016-01-27  3:50     ` [PATCH v2 02/16] fm10k/base: add macro definitions that are needed Wang Xiao W
2016-02-16 10:52       ` Bruce Richardson
2016-01-27  3:50     ` [PATCH v2 03/16] fm10k/base: cleanup namespace pollution and correct typecast Wang Xiao W
2016-02-16 10:55       ` Bruce Richardson
2016-01-27  3:50     ` [PATCH v2 04/16] fm10k/base: use bitshift for itr_scale Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 05/16] fm10k/base: reset max_queues on init_hw_vf failure Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 06/16] fm10k/base: document ITR scale workaround in VF TDLEN register Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 07/16] fm10k/base: fix checkpatch warning Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 08/16] fm10k/base: use BIT macro instead of open-coded bit-shifting of 1 Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 09/16] fm10k/base: do not use CamelCase Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 10/16] fm10k/base: use memcpy for mac addr copy Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 11/16] fm10k/base: allow removal of is_slot_appropriate function Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 12/16] fm10k/base: consistently use VLAN ID when referencing vid variables Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 13/16] fm10k/base: fix comment per upstream review changes Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 14/16] fm10k/base: TLV structures must be 4byte aligned, not 1byte aligned Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 15/16] fm10k/base: move constants to the right of binary operators Wang Xiao W
2016-01-27  3:50     ` [PATCH v2 16/16] fm10k/base: minor cleanups Wang Xiao W
2016-02-16  8:11     ` [PATCH v2 00/16] fm10k: update shared code Chen, Jing D
2016-01-21 10:36 ` [PATCH 16/16] fm10k/base: add macro definitions that are needed Wang Xiao W

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