DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function
@ 2015-07-27  8:42 Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 02/16] fm10k: add no-op pointer for VF request_tx_timestamp_mode Wang Xiao W
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

We need a handler function to be able to listen for Tx timestamp mode
responses. Without this, core driver code for PTP can't determine if the
Timestamp mode request was successful. This was overlooked in the
previous commit.

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 | 11 +++++++++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 3545a24..ac9ae5e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1810,6 +1810,12 @@ const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[] = {
 	FM10K_TLV_ATTR_LAST
 };
 
+const struct fm10k_tlv_attr fm10k_tx_timestamp_mode_attr[] = {
+	FM10K_TLV_ATTR_LE_STRUCT(FM10K_PF_ATTR_ID_TIMESTAMP_MODE_RESP,
+				 sizeof(struct fm10k_swapi_tx_timestamp_mode)),
+	FM10K_TLV_ATTR_LAST
+};
+
 /* currently there is no shared 1588 timestamp handler */
 
 /**
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index f6c290a..5a40d5b 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -118,6 +118,12 @@ struct fm10k_swapi_1588_timestamp {
 	__le16 sglort;
 };
 
+struct fm10k_swapi_tx_timestamp_mode {
+	__le16 glort;
+	__le16 maxmode;
+	__le32 status;
+};
+
 #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) \
@@ -139,6 +145,11 @@ extern const struct fm10k_tlv_attr fm10k_err_msg_attr[];
 #define FM10K_PF_MSG_ERR_HANDLER(msg, func) \
 	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_##msg, fm10k_err_msg_attr, func)
 
+extern const struct fm10k_tlv_attr fm10k_tx_timestamp_mode_attr[];
+#define FM10K_PF_MSG_TIMESTAMP_MODE_HANDLER(func) \
+	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_TX_TIMESTAMP_MODE, \
+			  fm10k_tx_timestamp_mode_attr, func)
+
 extern const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[];
 #define FM10K_PF_MSG_1588_TIMESTAMP_HANDLER(func) \
 	FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_1588_TIMESTAMP, \
-- 
1.9.3

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

* [dpdk-dev] [PATCH 02/16] fm10k: add no-op pointer for VF request_tx_timestamp_mode
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 03/16] fm10k: Set PF queues to unlimited bandwidth Wang Xiao W
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

This patch resolves a bug in Linux where we called the
request_tx_timestamp_mode function that is undefined for VF. Implement a
no-op function that simply ensures that the mode is NONE, otherwise it
would fail with ERR_PARAM.

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

diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 2246688..76be9ab 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -546,6 +546,26 @@ STATIC s32 fm10k_configure_dglort_map_vf(struct fm10k_hw *hw,
 }
 
 /**
+ * fm10k_request_tx_timestamp_mode_vf - Request Tx timestamp mode
+ * @hw: pointer to hardware structure
+ * @glort: glort to request Tx timestamps for
+ * @mode: timestamp mode to request
+ *
+ * This function takes the requested timestamp mode and verifies that it was
+ * requested as none since the VF cannot support receipt of Tx timestamps.
+ *
+ * If the mode is non-zero ERR_PARAM, else success
+ **/
+STATIC s32 fm10k_request_tx_timestamp_mode_vf(struct fm10k_hw *hw,
+					      u16 glort,
+					      u8 mode)
+{
+	UNREFERENCED_2PARAMETER(hw, glort);
+
+	return mode ? FM10K_ERR_PARAM : FM10K_SUCCESS;
+}
+
+/**
  *  fm10k_adjust_systime_vf - Adjust systime frequency
  *  @hw: pointer to hardware structure
  *  @ppb: adjustment rate in parts per billion
@@ -633,7 +653,8 @@ s32 fm10k_init_ops_vf(struct fm10k_hw *hw)
 	mac->ops.configure_dglort_map = &fm10k_configure_dglort_map_vf;
 	mac->ops.get_host_state = &fm10k_get_host_state_generic;
 	mac->ops.adjust_systime = &fm10k_adjust_systime_vf;
-	mac->ops.read_systime = &fm10k_read_systime_vf,
+	mac->ops.read_systime = &fm10k_read_systime_vf;
+	mac->ops.request_tx_timestamp_mode = &fm10k_request_tx_timestamp_mode_vf;
 
 	mac->max_msix_vectors = fm10k_get_pcie_msix_count_generic(hw);
 
-- 
1.9.3

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

* [dpdk-dev] [PATCH 03/16] fm10k: Set PF queues to unlimited bandwidth
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 02/16] fm10k: add no-op pointer for VF request_tx_timestamp_mode Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 04/16] fm10k: fix fm10k_mbx_write_copy header comment Wang Xiao W
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

Set PF queues used for VMDq to unlimited bandwidth when virtualization
resources are assigned.

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

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index ac9ae5e..bf331fc 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -716,7 +716,8 @@ STATIC s32 fm10k_iov_assign_resources_pf(struct fm10k_hw *hw, u16 num_vfs,
 	/* loop through unallocated rings assigning them back to PF */
 	for (i = FM10K_MAX_QUEUES_PF; i < vf_q_idx; i++) {
 		FM10K_WRITE_REG(hw, FM10K_TXDCTL(i), 0);
-		FM10K_WRITE_REG(hw, FM10K_TXQCTL(i), FM10K_TXQCTL_PF | vid);
+		FM10K_WRITE_REG(hw, FM10K_TXQCTL(i), FM10K_TXQCTL_PF |
+				FM10K_TXQCTL_UNLIMITED_BW | vid);
 		FM10K_WRITE_REG(hw, FM10K_RXQCTL(i), FM10K_RXQCTL_PF);
 	}
 
-- 
1.9.3

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

* [dpdk-dev] [PATCH 04/16] fm10k: fix fm10k_mbx_write_copy header comment
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 02/16] fm10k: add no-op pointer for VF request_tx_timestamp_mode Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 03/16] fm10k: Set PF queues to unlimited bandwidth Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 05/16] fm10k: Add support for ITR scaling based on PCIe link speed Wang Xiao W
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

The header comment included a miscopy of a C-code line, and also
mis-used Rx FIFO when it clearly meant Tx FIFO.

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

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 2081414..e6cf1c8 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -343,8 +343,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
  *  @mbx: pointer to mailbox
  *
- *  This function will take a section of the Rx FIFO and copy it into the
-		mbx->tail--;
+ *  This function will take a section of the Tx FIFO and copy it into the
  *  mailbox memory.  The offset in mbmem is based on the lower bits of the
  *  tail and len determines the length to copy.
  **/
-- 
1.9.3

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

* [dpdk-dev] [PATCH 05/16] fm10k: Add support for ITR scaling based on PCIe link speed
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (2 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 04/16] fm10k: fix fm10k_mbx_write_copy header comment Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 06/16] fm10k: reset head instead of calling update_max_size Wang Xiao W
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

Red Rock Canyon's interrupt throttle timers are based on the PCIe link
speed. Because of this, the value being programmed into the ITR
registers must be scaled.

For the PF, this is as simple as reading the PCIe link speed and storing
the result. However, in the case of SR-IOV, the VF's interrupt throttle
timers are based on the link speed of the PF. However, the VF is unable
to get the link speed information from its configuration space, so the
PF must inform it of what scale to use.

Rather than passing this scale via mailbox message, we take advantage of
unused bits in the TDLEN register to pass the scale. It is the
responsibility of the PF to program this for the VF while setting up the
VF queues and the responsibility of the VF to get the information
accordingly. This is preferable because it allows the VF to set up the
interrupts properly during initialization and matches how the MAC
address is passed in the TDBAL/TDBAH registers.

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

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index bf331fc..5b66960 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -169,16 +169,21 @@ STATIC s32 fm10k_init_hw_pf(struct fm10k_hw *hw)
 				FM10K_TPH_RXCTRL_HDR_WROEN);
 	}
 
-	/* set max hold interval to align with 1.024 usec in all modes */
+	/* set max hold interval to align with 1.024 usec in all modes and
+	 * store ITR scale
+	 */
 	switch (hw->bus.speed) {
 	case fm10k_bus_speed_2500:
 		dma_ctrl = FM10K_DMA_CTRL_MAX_HOLD_1US_GEN1;
+		hw->mac.itr_scale = FM10K_TDLEN_ITR_SCALE_GEN1;
 		break;
 	case fm10k_bus_speed_5000:
 		dma_ctrl = FM10K_DMA_CTRL_MAX_HOLD_1US_GEN2;
+		hw->mac.itr_scale = FM10K_TDLEN_ITR_SCALE_GEN2;
 		break;
 	case fm10k_bus_speed_8000:
 		dma_ctrl = FM10K_DMA_CTRL_MAX_HOLD_1US_GEN3;
+		hw->mac.itr_scale = FM10K_TDLEN_ITR_SCALE_GEN3;
 		break;
 	default:
 		dma_ctrl = 0;
@@ -947,6 +952,12 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
 	FM10K_WRITE_REG(hw, FM10K_TDBAL(vf_q_idx), tdbal);
 	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
+	 */
+	FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx), hw->mac.itr_scale <<
+						   FM10K_TDLEN_ITR_SCALE_SHIFT);
+
 err_out:
 	/* configure Queue control register */
 	txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) &
@@ -1079,6 +1090,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);
+		FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx + i),
+				hw->mac.itr_scale <<
+				FM10K_TDLEN_ITR_SCALE_SHIFT);
 		FM10K_WRITE_REG(hw, FM10K_TQMAP(qmap_idx + i), vf_q_idx + i);
 		FM10K_WRITE_REG(hw, FM10K_RQMAP(qmap_idx + i), vf_q_idx + i);
 	}
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 534fab4..a0e5f79 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -344,6 +344,11 @@ struct fm10k_hw;
 #define FM10K_TDBAL(_n)		((0x40 * (_n)) + 0x8000)
 #define FM10K_TDBAH(_n)		((0x40 * (_n)) + 0x8001)
 #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_TPH_TXCTRL(_n)	((0x40 * (_n)) + 0x8003)
 #define FM10K_TPH_TXCTRL_DESC_TPHEN		0x00000020
 #define FM10K_TPH_TXCTRL_DESC_RROEN		0x00000200
@@ -680,6 +685,7 @@ struct fm10k_mac_info {
 	bool get_host_state;
 	bool tx_ready;
 	u32 dglort_map;
+	u8 itr_scale;
 };
 
 struct fm10k_swapi_table_info {
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 76be9ab..ce42189 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -143,9 +143,12 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 	/* record maximum queue count */
 	hw->mac.max_queues = i;
 
-	/* fetch default VLAN */
+	/* 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;
+	hw->mac.itr_scale = (FM10K_READ_REG(hw, FM10K_TDLEN(0)) &
+			     FM10K_TDLEN_ITR_SCALE_MASK) >>
+			    FM10K_TDLEN_ITR_SCALE_SHIFT;
 
 	return FM10K_SUCCESS;
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH 06/16] fm10k: reset head instead of calling update_max_size
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (3 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 05/16] fm10k: Add support for ITR scaling based on PCIe link speed Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 07/16] fm10k: mbx_update_max_size does not drop all Wang Xiao W
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

After shutting down the mailbox by force, we then go about resetting max
size to 0, and clearing all messages in the FIFO. However, we should
just reset the head pointer so that the FIFO will become empty, rather than
changing the max size to 0. This helps prevent increment in tx_dropped
counter during mailbox negotiation, which is confusing to viewers of
Linux ethtool statistics output.

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

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index e6cf1c8..12f10f8 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -139,6 +139,18 @@ STATIC u16 fm10k_fifo_head_drop(struct fm10k_mbx_fifo *fifo)
 }
 
 /**
+ *  fm10k_fifo_drop_all - Drop all messages in FIFO
+ *  @fifo: pointer to FIFO
+ *
+ *  This function resets the head pointer to drop all messages in the FIFO,
+ *  and ensure the FIFO is empty.
+ **/
+STATIC void fm10k_fifo_drop_all(struct fm10k_mbx_fifo *fifo)
+{
+	fifo->head = fifo->tail;
+}
+
+/**
  *  fm10k_mbx_index_len - Convert a head/tail index into a length value
  *  @mbx: pointer to mailbox
  *  @head: head index
@@ -1407,9 +1419,11 @@ STATIC void fm10k_mbx_disconnect(struct fm10k_hw *hw,
 		timeout -= FM10K_MBX_POLL_DELAY;
 	} while ((timeout > 0) && (mbx->state != FM10K_STATE_CLOSED));
 
-	/* in case we didn't close just force the mailbox into shutdown */
+	/* in case we didn't close, just force the mailbox into shutdown and
+	 * drop all left over messages in the FIFO.
+	 */
 	fm10k_mbx_connect_reset(mbx);
-	fm10k_mbx_update_max_size(mbx, 0);
+	fm10k_fifo_drop_all(&mbx->tx);
 
 	FM10K_WRITE_MBX(hw, mbx->mbmem_reg, 0);
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH 07/16] fm10k: mbx_update_max_size does not drop all
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (4 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 06/16] fm10k: reset head instead of calling update_max_size Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 08/16] fm10k: ensure VF restores itr_scale on stop_hw Wang Xiao W
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

When we call update_max_size, it does not drop all oversized messages.
This is due to the difficulty in performing this operation, since it is
a FIFO which makes updating anything other than head or tail very
difficult. To fix this, modify validate_msg_size to ensure that we error
out later when trying to transmit the message that could be oversized.
This will generally be a rare condition, as it requires the FIFO to
include a message larger than the max_size negotiated during mailbox
connect. Note that max_size is always smaller than rx.size, so it should
be safe to use here.

Also, update the update_max_size function header comment to clearly
indicate that it does not drop all oversized messages, but only those at
the head of the FIFO.

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

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 12f10f8..0cdd24d 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -344,7 +344,7 @@ STATIC u16 fm10k_mbx_validate_msg_size(struct fm10k_mbx_info *mbx, u16 len)
 	} while (total_len < len);
 
 	/* message extends out of pushed section, but fits in FIFO */
-	if ((len < total_len) && (msg_len <= mbx->rx.size))
+	if ((len < total_len) && (msg_len <= mbx->max_size))
 		return 0;
 
 	/* return length of invalid section */
@@ -1088,12 +1088,15 @@ STATIC void fm10k_mbx_reset_work(struct fm10k_mbx_info *mbx)
 }
 
 /**
- *  fm10k_mbx_update_max_size - Update the max_size and drop any large messages
+ *  fm10k_mbx_update_max_size - Update the max_size and drop large messages
  *  @mbx: pointer to mailbox
  *  @size: new value for max_size
  *
- *  This function will update the max_size value and drop any outgoing messages
- *  from the head of the Tx FIFO that are larger than max_size.
+ *  This function updates the max_size value and drops any outgoing messages
+ *  at the head of the Tx FIFO if they are larger than max_size. It does not
+ *  drop all messages, as this is too difficult to parse and remove them from
+ *  the FIFO. Instead, rely on the checking to ensure that messages larger
+ *  than max_size aren't pushed into the memory buffer.
  **/
 STATIC void fm10k_mbx_update_max_size(struct fm10k_mbx_info *mbx, u16 size)
 {
-- 
1.9.3

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

* [dpdk-dev] [PATCH 08/16] fm10k: ensure VF restores itr_scale on stop_hw
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (5 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 07/16] fm10k: mbx_update_max_size does not drop all Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 09/16] fm10k: ensure itr_scale is set even if we don't know speed Wang Xiao W
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

In a recent change, the ITR scale was given to the VF via TDLEN
registers at driver initialization. This allows the VF to determine what
the ITR scale for PCIe link speed should be. However, a VF unload
followed by a reload incorrectly left this value as 0. Thus, the driver
reloads and uses 0 as the ITR scale instead of the correct value. If the
VF driver blindly trusted this value it could cause a divide by zero
failure.

Fix this by having stop_hw_vf reset the ITR scale as the device goes
down, similar to the way we handle the MAC address.

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

diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index ce42189..7981417 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
 STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 {
 	u8 *perm_addr = hw->mac.perm_addr;
-	u32 bal = 0, bah = 0;
+	u32 bal = 0, bah = 0, tdlen;
 	s32 err;
 	u16 i;
 
@@ -63,6 +63,9 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
 		       ((u32)perm_addr[2]);
 	}
 
+	/* restore default itr_scale for next VF initialization */
+	tdlen = hw->mac.itr_scale << FM10K_TDLEN_ITR_SCALE_SHIFT;
+
 	/* The queues have already been disabled so we just need to
 	 * update their base address registers
 	 */
@@ -71,6 +74,7 @@ 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);
+		FM10K_WRITE_REG(hw, FM10K_TDLEN(i), tdlen);
 	}
 
 	return FM10K_SUCCESS;
-- 
1.9.3

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

* [dpdk-dev] [PATCH 09/16] fm10k: ensure itr_scale is set even if we don't know speed
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (6 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 08/16] fm10k: ensure VF restores itr_scale on stop_hw Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 10/16] fm10k: correct VF multicast update Wang Xiao W
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

To prevent divide-by-zero issues, ensure that we always have an ITR
scale. Default to Gen3 scaling if we don't know the speed. Also ensure
the VF checks the register value and ensures we use Gen3 if we are
provided a zero value.

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

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 5b66960..6bc6907 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -187,6 +187,8 @@ STATIC s32 fm10k_init_hw_pf(struct fm10k_hw *hw)
 		break;
 	default:
 		dma_ctrl = 0;
+		/* just in case, assume Gen3 ITR scale */
+		hw->mac.itr_scale = FM10K_TDLEN_ITR_SCALE_GEN3;
 		break;
 	}
 
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 7981417..ba7c7c1 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -154,6 +154,10 @@ 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	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH 10/16] fm10k: correct VF multicast update
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (7 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 09/16] fm10k: ensure itr_scale is set even if we don't know speed Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 11/16] fm10k: Re-map all possible VF queues after a VFLR Wang Xiao W
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

VFs were being improperly added to the switch's multicast group. The
error stems from the fact that incorrect arguments were passed to the
"update_mc_addr" function. It would seem to be a copy paste error since
the parameters are similar to the "update_uc_addr" function.

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

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 6bc6907..1004018 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -367,6 +367,9 @@ STATIC s32 fm10k_update_xc_addr_pf(struct fm10k_hw *hw, u16 glort,
 
 	DEBUGFUNC("fm10k_update_xc_addr_pf");
 
+	/* clear set bit from VLAN ID */
+	vid &= ~FM10K_VLAN_CLEAR;
+
 	/* if glort or VLAN are not valid return error */
 	if (!fm10k_glort_valid_pf(hw, glort) || vid >= FM10K_VLAN_TABLE_VID_MAX)
 		return FM10K_ERR_PARAM;
@@ -1315,8 +1318,8 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
 		}
 
 		/* notify switch of request for new multicast address */
-		err = hw->mac.ops.update_mc_addr(hw, vf_info->glort, mac,
-						 !(vlan & FM10K_VLAN_CLEAR), 0);
+		err = hw->mac.ops.update_mc_addr(hw, vf_info->glort, mac, vlan,
+						 !(vlan & FM10K_VLAN_CLEAR));
 	}
 
 	return err;
-- 
1.9.3

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

* [dpdk-dev] [PATCH 11/16] fm10k: Re-map all possible VF queues after a VFLR
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (8 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 10/16] fm10k: correct VF multicast update Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 12/16] fm10k: pack TLV overlay structures correctly Wang Xiao W
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

During initialization, the VF counts its rings by walking the TQDLOC
registers. This only works if the TQMAP/RQMAP registers are set to map
the out-of-bound rings to the first one, so the VF driver can detect when
it has run out of queues cleanly. Update the PF to reset the empty
TQMAP/RQMAP registers post-VFLR to prevent innocent VF drivers from
triggering malicious events.

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

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 1004018..eb1adc9 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1102,6 +1102,12 @@ 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 */
+	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);
+	}
+
 	return FM10K_SUCCESS;
 }
 
-- 
1.9.3

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

* [dpdk-dev] [PATCH 12/16] fm10k: pack TLV overlay structures correctly
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (9 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 11/16] fm10k: Re-map all possible VF queues after a VFLR Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 13/16] fm10k: 1558 DIR_NEGATIVE bit is actually DIR_POSITIVE Wang Xiao W
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

This patch adds #pragma pack(push, 1) around some structures which are passed
via TLV messages. These structures must not be left unpacked as GCC and
other compilers are wont to do. Otherwise, we get invalid message
responses from the Switch Manager software since it sends 20 bytes and
we expect 24.

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

diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index 5a40d5b..b7a1758 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -90,6 +90,12 @@ 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.
+ */
+#pragma pack(push, 1)
+
 struct fm10k_mac_update {
 	__le32	mac_lower;
 	__le16	mac_upper;
@@ -124,6 +130,8 @@ struct fm10k_swapi_tx_timestamp_mode {
 	__le32 status;
 };
 
+#pragma pack(pop)
+
 #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) \
-- 
1.9.3

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

* [dpdk-dev] [PATCH 13/16] fm10k: 1558 DIR_NEGATIVE bit is actually DIR_POSITIVE
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (10 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 12/16] fm10k: pack TLV overlay structures correctly Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 14/16] fm10k: remove err_no reference Wang Xiao W
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

The SYSTIME_CFG.Adjust field has a Direction bit to indicate whether the
adjustment is positive or negative. However, we incorrectly read the
documentation and the direction bit should be set 1 when positive, not
when negative.

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

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index eb1adc9..86283fa 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1927,8 +1927,8 @@ STATIC s32 fm10k_adjust_systime_pf(struct fm10k_hw *hw, s32 ppb)
 	if (systime_adjust > FM10K_SW_SYSTIME_ADJUST_MASK)
 		return FM10K_ERR_PARAM;
 
-	if (ppb < 0)
-		systime_adjust |= FM10K_SW_SYSTIME_ADJUST_DIR_NEGATIVE;
+	if (ppb > 0)
+		systime_adjust |= FM10K_SW_SYSTIME_ADJUST_DIR_POSITIVE;
 
 	FM10K_WRITE_SW_REG(hw, FM10K_SW_SYSTIME_ADJUST, (u32)systime_adjust);
 
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index a0e5f79..7966a03 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -486,7 +486,7 @@ struct fm10k_hw;
 #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_NEGATIVE	0x80000000
+#define FM10K_SW_SYSTIME_ADJUST_DIR_POSITIVE	0x80000000
 #define FM10K_SW_SYSTIME_PULSE(_n)	((_n) + 0x02252)
 
 #ifndef ETH_ALEN
-- 
1.9.3

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

* [dpdk-dev] [PATCH 14/16] fm10k: remove err_no reference
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (11 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 13/16] fm10k: 1558 DIR_NEGATIVE bit is actually DIR_POSITIVE Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 15/16] fm10k: fix iov_msg_lport_state_pf re-enable bug Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 16/16] fm10k: add macro definitions about valid ether addr Wang Xiao W
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

The reference to err_no was left around after an old re-factor. We never
use this value again, and the macros called on the function appear to
have no relevant side effect I could see. Discovered via cppcheck
fm10k_mbx.c:1312: (style) Variable 'err_no' is assigned a value that is never used.

This occurred because a previous commit refactored and removed all used
references to err_no.

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

diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 0cdd24d..ad9d81a 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -1292,16 +1292,11 @@ STATIC s32 fm10k_mbx_process_error(struct fm10k_hw *hw,
 				   struct fm10k_mbx_info *mbx)
 {
 	const u32 *hdr = &mbx->mbx_hdr;
-	s32 err_no;
 	u16 head;
 
 	/* we will need to pull all of the fields for verification */
 	head = FM10K_MSG_HDR_FIELD_GET(*hdr, HEAD);
 
-	/* we only have lower 10 bits of error number so add upper bits */
-	err_no = FM10K_MSG_HDR_FIELD_GET(*hdr, ERR_NO);
-	err_no |= ~FM10K_MSG_HDR_MASK(ERR_NO);
-
 	switch (mbx->state) {
 	case FM10K_STATE_OPEN:
 	case FM10K_STATE_DISCONNECT:
-- 
1.9.3

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

* [dpdk-dev] [PATCH 15/16] fm10k: fix iov_msg_lport_state_pf re-enable bug
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (12 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 14/16] fm10k: remove err_no reference Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 16/16] fm10k: add macro definitions about valid ether addr Wang Xiao W
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

When a VF issues an LPORT_STATE request to enable a port which is
already enabled, the PF will first disable the VF. Then it is supposed
to re-enable the VF again with new settings. This is primarily done in
order to ensure that the switch management software properly clears the
previous VF settings. (ie: switch flow rules and so forth). However,
there is a bug in the flow because we check if VF is enabled and don't
re-enable it at the end. The issue is that we disable the VF in order to
clear switch rules, and never follow-up with a re-enable. This results in
a call to enable the VF results in disabling the logical port.

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

diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 86283fa..aa04937 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1418,6 +1418,14 @@ 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.
+		 */
+		if (!err)
+			vf_info->vf_flags = FM10K_VF_FLAG_CAPABLE(vf_info);
+
 		/* when enabling the port we should reset the rate limiters */
 		hw->iov.ops.configure_tc(hw, vf_info->vf_idx, vf_info->rate);
 
-- 
1.9.3

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

* [dpdk-dev] [PATCH 16/16] fm10k: add macro definitions about valid ether addr
  2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
                   ` (13 preceding siblings ...)
  2015-07-27  8:42 ` [dpdk-dev] [PATCH 15/16] fm10k: fix iov_msg_lport_state_pf re-enable bug Wang Xiao W
@ 2015-07-27  8:42 ` Wang Xiao W
  14 siblings, 0 replies; 16+ messages in thread
From: Wang Xiao W @ 2015-07-27  8:42 UTC (permalink / raw)
  To: dev; +Cc: Wang Xiao W

To keep consistency with another repo, I add macro definitions about
FM10K_IS_VALID_ETHER_ADD in fm10k_type.h, though they have already
been defined in fm10k_osdep.h.

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

diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 7966a03..b91b878 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -493,8 +493,21 @@ struct fm10k_hw;
 #define ETH_ALEN	6
 #endif /* ETH_ALEN */
 
-
-
+#ifndef FM10K_IS_ZERO_ETHER_ADDR
+/* make certain address is not 0 */
+#define FM10K_IS_ZERO_ETHER_ADDR(addr) \
+(!((addr)[0] | (addr)[1] | (addr)[2] | (addr)[3] | (addr)[4] | (addr)[5]))
+#endif
+
+#ifndef FM10K_IS_MULTICAST_ETHER_ADDR
+#define FM10K_IS_MULTICAST_ETHER_ADDR(addr) ((addr)[0] & 0x1)
+#endif
+
+#ifndef FM10K_IS_VALID_ETHER_ADDR
+/* make certain address is not multicast or 0 */
+#define FM10K_IS_VALID_ETHER_ADDR(addr) \
+(!FM10K_IS_MULTICAST_ETHER_ADDR(addr) && !FM10K_IS_ZERO_ETHER_ADDR(addr))
+#endif
 
 enum fm10k_int_source {
 	fm10k_int_Mailbox	= 0,
-- 
1.9.3

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

end of thread, other threads:[~2015-07-27  8:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-27  8:42 [dpdk-dev] [PATCH 01/16] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 02/16] fm10k: add no-op pointer for VF request_tx_timestamp_mode Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 03/16] fm10k: Set PF queues to unlimited bandwidth Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 04/16] fm10k: fix fm10k_mbx_write_copy header comment Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 05/16] fm10k: Add support for ITR scaling based on PCIe link speed Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 06/16] fm10k: reset head instead of calling update_max_size Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 07/16] fm10k: mbx_update_max_size does not drop all Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 08/16] fm10k: ensure VF restores itr_scale on stop_hw Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 09/16] fm10k: ensure itr_scale is set even if we don't know speed Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 10/16] fm10k: correct VF multicast update Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 11/16] fm10k: Re-map all possible VF queues after a VFLR Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 12/16] fm10k: pack TLV overlay structures correctly Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 13/16] fm10k: 1558 DIR_NEGATIVE bit is actually DIR_POSITIVE Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 14/16] fm10k: remove err_no reference Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 15/16] fm10k: fix iov_msg_lport_state_pf re-enable bug Wang Xiao W
2015-07-27  8:42 ` [dpdk-dev] [PATCH 16/16] fm10k: add macro definitions about valid ether addr Wang Xiao W

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