* [dpdk-dev] [PATCH 01/28] fm10k: add PF Tx Timestamp mode handler function
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 02/28] fm10k: add no-op pointer for VF request_tx_timestamp_mode Wang Xiao W
` (27 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 02/28] fm10k: add no-op pointer for VF request_tx_timestamp_mode
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 01/28] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 03/28] fm10k: Set PF queues to unlimited bandwidth Wang Xiao W
` (26 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 03/28] fm10k: Set PF queues to unlimited bandwidth
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 01/28] fm10k: add PF Tx Timestamp mode handler function Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 02/28] fm10k: add no-op pointer for VF request_tx_timestamp_mode Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 04/28] fm10k: fix fm10k_mbx_write_copy header comment Wang Xiao W
` (25 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 04/28] fm10k: fix fm10k_mbx_write_copy header comment
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (2 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 03/28] fm10k: Set PF queues to unlimited bandwidth Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 05/28] fm10k: Add support for ITR scaling based on PCIe link speed Wang Xiao W
` (24 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 05/28] fm10k: Add support for ITR scaling based on PCIe link speed
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (3 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 04/28] fm10k: fix fm10k_mbx_write_copy header comment Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 06/28] fm10k: reset head instead of calling update_max_size Wang Xiao W
` (23 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 06/28] fm10k: reset head instead of calling update_max_size
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (4 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 05/28] fm10k: Add support for ITR scaling based on PCIe link speed Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 07/28] fm10k: mbx_update_max_size does not drop all Wang Xiao W
` (22 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 07/28] fm10k: mbx_update_max_size does not drop all
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (5 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 06/28] fm10k: reset head instead of calling update_max_size Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 08/28] fm10k: ensure VF restores itr_scale on stop_hw Wang Xiao W
` (21 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 08/28] fm10k: ensure VF restores itr_scale on stop_hw
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (6 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 07/28] fm10k: mbx_update_max_size does not drop all Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 09/28] fm10k: ensure itr_scale is set even if we don't know speed Wang Xiao W
` (20 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 09/28] fm10k: ensure itr_scale is set even if we don't know speed
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (7 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 08/28] fm10k: ensure VF restores itr_scale on stop_hw Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 10/28] fm10k: correct VF multicast update Wang Xiao W
` (19 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 10/28] fm10k: correct VF multicast update
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (8 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 09/28] fm10k: ensure itr_scale is set even if we don't know speed Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 11/28] fm10k: Re-map all possible VF queues after a VFLR Wang Xiao W
` (18 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 11/28] fm10k: Re-map all possible VF queues after a VFLR
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (9 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 10/28] fm10k: correct VF multicast update Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 12/28] fm10k: pack TLV overlay structures correctly Wang Xiao W
` (17 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 12/28] fm10k: pack TLV overlay structures correctly
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (10 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 11/28] fm10k: Re-map all possible VF queues after a VFLR Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 13/28] fm10k: 1558 DIR_NEGATIVE bit is actually DIR_POSITIVE Wang Xiao W
` (16 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 13/28] fm10k: 1558 DIR_NEGATIVE bit is actually DIR_POSITIVE
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (11 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 12/28] fm10k: pack TLV overlay structures correctly Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 14/28] fm10k: remove err_no reference Wang Xiao W
` (15 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 14/28] fm10k: remove err_no reference
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (12 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 13/28] fm10k: 1558 DIR_NEGATIVE bit is actually DIR_POSITIVE Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 15/28] fm10k: fix iov_msg_lport_state_pf re-enable bug Wang Xiao W
` (14 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 15/28] fm10k: fix iov_msg_lport_state_pf re-enable bug
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (13 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 14/28] fm10k: remove err_no reference Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 16/28] fm10k: add macro definitions about valid ether addr Wang Xiao W
` (13 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 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] 30+ messages in thread
* [dpdk-dev] [PATCH 16/28] fm10k: add macro definitions about valid ether addr
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (14 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 15/28] fm10k: fix iov_msg_lport_state_pf re-enable bug Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 17/28] fm10k: store actual count of DWORDS pulled/pushed from mbmem Wang Xiao W
` (12 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
To keep consistency with ND team, 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] 30+ messages in thread
* [dpdk-dev] [PATCH 17/28] fm10k: store actual count of DWORDS pulled/pushed from mbmem
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (15 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 16/28] fm10k: add macro definitions about valid ether addr Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 18/28] fm10k: fix iov_msg_mac_vlan_pf VID checks Wang Xiao W
` (11 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
A previous bug was uncovered by addition of a debug stat to indicate the
actual number of DWORDS we pulled from the mbmem. It turned out this was
not the same as the tx_dwords counter. While the previous bug fix should
have corrected this in all cases, add some debug stats that count the
number of DWORDs pushed or pulled from the mbmem. Base drivers can use
this in debug builds to help detect this problem in the future.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_mbx.c | 4 ++++
drivers/net/fm10k/base/fm10k_mbx.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index ad9d81a..c6d34eb 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -394,6 +394,8 @@ STATIC void fm10k_mbx_write_copy(struct fm10k_hw *hw,
if (!tail)
tail++;
+ mbx->tx_mbmem_pulled++;
+
/* write message to hardware FIFO */
FM10K_WRITE_MBX(hw, mbmem + tail++, *(head++));
} while (--len && --end);
@@ -480,6 +482,8 @@ STATIC void fm10k_mbx_read_copy(struct fm10k_hw *hw,
if (!head)
head++;
+ mbx->rx_mbmem_pushed++;
+
/* read message from hardware FIFO */
*(tail++) = FM10K_READ_MBX(hw, mbmem + head++);
} while (--len && --end);
diff --git a/drivers/net/fm10k/base/fm10k_mbx.h b/drivers/net/fm10k/base/fm10k_mbx.h
index 6332584..4b22f0e 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.h
+++ b/drivers/net/fm10k/base/fm10k_mbx.h
@@ -313,8 +313,10 @@ struct fm10k_mbx_info {
u64 tx_dropped;
u64 tx_messages;
u64 tx_dwords;
+ u64 tx_mbmem_pulled;
u64 rx_messages;
u64 rx_dwords;
+ u64 rx_mbmem_pushed;
u64 rx_parse_err;
/* Buffer to store messages */
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 18/28] fm10k: fix iov_msg_mac_vlan_pf VID checks
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (16 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 17/28] fm10k: store actual count of DWORDS pulled/pushed from mbmem Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 19/28] fm10k: Fix Solaris build issue Wang Xiao W
` (10 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
The VF will send a message to request multicast addresses with the
default vid. In the current code, if the PF has statically assigned a
VLAN to a VF, then the VF will not get the multicast addresses. Fix up
all of the various vlan messages to use identical checks (since each
check was different). Also use set as a variable, so that it simplifies
our check for whether vlan matches the pf_vid.
The new logic will allow set of a vlan if it is zero, automatically
converting to the default vid. Otherwise it will allow setting the PF
vid, or any VLAN if PF has not statically assigned a VLAN. This is
consistent behavior, and allows VF to request either 0 or the
default_vid without silently failing. Note that we need the check for
zero since VFs might not get the default VID message in time to actually
request non-zero VLANs.
Create a function, fm10k_iov_select_vid which implements the logic for
selecting a default vid. This helps us remove duplicate code and
streamlines location of this logic so that we don't make similar bugs in
the future.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_pf.c | 83 ++++++++++++++++++++++++---------------
1 file changed, 51 insertions(+), 32 deletions(-)
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index aa04937..5506568 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1225,6 +1225,24 @@ s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *hw, u32 **results,
}
/**
+ * fm10k_iov_select_vid - Select correct default vid
+ * @hw: Pointer to hardware structure
+ * @vid: vid 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.
+ */
+STATIC s32 fm10k_iov_select_vid(struct fm10k_vf_info *vf_info, u16 vid)
+{
+ if (!vid)
+ return vf_info->pf_vid ? vf_info->pf_vid : vf_info->sw_vid;
+ else if (vf_info->pf_vid && vid != vf_info->pf_vid)
+ return FM10K_ERR_PARAM;
+ else
+ return vid;
+}
+
+/**
* fm10k_iov_msg_mac_vlan_pf - Message handler for MAC/VLAN request from VF
* @hw: Pointer to hardware structure
* @results: Pointer array to message, results[0] is pointer to message
@@ -1241,6 +1259,7 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
int err = FM10K_SUCCESS;
u8 mac[ETH_ALEN];
u32 *result;
+ bool set;
u16 vlan;
u32 vid;
@@ -1258,19 +1277,21 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
if (err)
return err;
- /* if VLAN ID is 0, set the default VLAN ID instead of 0 */
- if (!vid || (vid == FM10K_VLAN_CLEAR)) {
- if (vf_info->pf_vid)
- vid |= vf_info->pf_vid;
- else
- vid |= vf_info->sw_vid;
- } else if (vid != vf_info->pf_vid) {
+ /* verify upper 16 bits are zero */
+ if (vid >> 16)
return FM10K_ERR_PARAM;
- }
+
+ set = !(vid & FM10K_VLAN_CLEAR);
+ vid &= ~FM10K_VLAN_CLEAR;
+
+ err = fm10k_iov_select_vid(vf_info, (u16)vid);
+ if (err < 0)
+ return err;
+ else
+ vid = err;
/* update VSI info for VF in regards to VLAN table */
- err = hw->mac.ops.update_vlan(hw, vid, vf_info->vsi,
- !(vid & FM10K_VLAN_CLEAR));
+ err = hw->mac.ops.update_vlan(hw, vid, vf_info->vsi, set);
}
if (!err && !!results[FM10K_MAC_VLAN_MSG_MAC]) {
@@ -1286,19 +1307,18 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
memcmp(mac, vf_info->mac, ETH_ALEN))
return FM10K_ERR_PARAM;
- /* if VLAN ID is 0, set the default VLAN ID instead of 0 */
- if (!vlan || (vlan == FM10K_VLAN_CLEAR)) {
- if (vf_info->pf_vid)
- vlan |= vf_info->pf_vid;
- else
- vlan |= vf_info->sw_vid;
- } else if (vf_info->pf_vid) {
- return FM10K_ERR_PARAM;
- }
+ set = !(vlan & FM10K_VLAN_CLEAR);
+ vlan &= ~FM10K_VLAN_CLEAR;
+
+ err = fm10k_iov_select_vid(vf_info, vlan);
+ if (err < 0)
+ return err;
+ else
+ vlan = (u16)err;
/* notify switch of request for new unicast address */
- err = hw->mac.ops.update_uc_addr(hw, vf_info->glort, mac, vlan,
- !(vlan & FM10K_VLAN_CLEAR), 0);
+ err = hw->mac.ops.update_uc_addr(hw, vf_info->glort,
+ mac, vlan, set, 0);
}
if (!err && !!results[FM10K_MAC_VLAN_MSG_MULTICAST]) {
@@ -1313,19 +1333,18 @@ s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *hw, u32 **results,
if (!(vf_info->vf_flags & FM10K_VF_FLAG_MULTI_ENABLED))
return FM10K_ERR_PARAM;
- /* if VLAN ID is 0, set the default VLAN ID instead of 0 */
- if (!vlan || (vlan == FM10K_VLAN_CLEAR)) {
- if (vf_info->pf_vid)
- vlan |= vf_info->pf_vid;
- else
- vlan |= vf_info->sw_vid;
- } else if (vf_info->pf_vid) {
- return FM10K_ERR_PARAM;
- }
+ set = !(vlan & FM10K_VLAN_CLEAR);
+ vlan &= ~FM10K_VLAN_CLEAR;
+
+ err = fm10k_iov_select_vid(vf_info, vlan);
+ if (err < 0)
+ return err;
+ else
+ vlan = (u16)err;
/* notify switch of request for new multicast address */
- err = hw->mac.ops.update_mc_addr(hw, vf_info->glort, mac, vlan,
- !(vlan & FM10K_VLAN_CLEAR));
+ err = hw->mac.ops.update_mc_addr(hw, vf_info->glort,
+ mac, vlan, set);
}
return err;
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 19/28] fm10k: Fix Solaris build issue
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (17 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 18/28] fm10k: fix iov_msg_mac_vlan_pf VID checks Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 20/28] fm10k: fix Tx FIFO clearing for phantom messages Wang Xiao W
` (9 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
Solaris (and other OS's) are not C99 compliant, so they are not able
to use the C99 style #pragma pack() code. Wrap with C99 tag for easy
stripping.
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 b7a1758..af873d1 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -94,7 +94,11 @@ enum fm10k_pf_tlv_attr_id_v1 {
* messages, and must not have gaps between their values. They must line up
* correctly to the TLV definition.
*/
+#ifdef C99
#pragma pack(push, 1)
+#else
+#pragma pack(1)
+#endif /* C99 */
struct fm10k_mac_update {
__le32 mac_lower;
@@ -130,7 +134,11 @@ struct fm10k_swapi_tx_timestamp_mode {
__le32 status;
};
+#ifdef C99
#pragma pack(pop)
+#else
+#pragma pack()
+#endif /* C99 */
#define FM10K_PF_MSG_LPORT_CREATE_HANDLER(func) \
FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_LPORT_CREATE, NULL, func)
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 20/28] fm10k: fix Tx FIFO clearing for phantom messages
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (18 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 19/28] fm10k: Fix Solaris build issue Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 21/28] fm10k: create "correct" header for the remote end on connect Wang Xiao W
` (8 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
The phantom messages were a result of incorrectly forgetting to drop
already transmitted messages. We would reset pulled, and tail_len but
left the head/tail pointers alone.
The correct fix is to loop through pulled and drop messages until we've
dropped at least as many bytes as we pulled (possibly dropping a message
we've only partially transmitted. However, we also have to account for
tail_len variable and the 'ack' value as in mbx_pull_head. This means
that we need to re-read the HEAD field of the mailbox header.
Based on testing, this resolves the phantom messages issue, as well as
correctly keeping messages which have yet to be transmitted at all in
the Tx FIFO. Thus, we will begin re-transmission once we have
re-connected.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_mbx.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index c6d34eb..251a81d 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -142,8 +142,8 @@ 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.
+ * 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)
{
@@ -1079,9 +1079,26 @@ STATIC s32 fm10k_mbx_create_reply(struct fm10k_hw *hw,
**/
STATIC void fm10k_mbx_reset_work(struct fm10k_mbx_info *mbx)
{
+ u16 len, head, ack;
+
/* reset our outgoing max size back to Rx limits */
mbx->max_size = mbx->rx.size - 1;
+ /* update mbx->pulled to account for tail_len and ack */
+ head = FM10K_MSG_HDR_FIELD_GET(mbx->mbx_hdr, HEAD);
+ ack = fm10k_mbx_index_len(mbx, head, mbx->tail);
+ mbx->pulled += mbx->tail_len - ack;
+
+ /* now drop any messages which have started or finished transmitting */
+ while (fm10k_fifo_head_len(&mbx->tx) && mbx->pulled) {
+ len = fm10k_fifo_head_drop(&mbx->tx);
+ mbx->tx_dropped++;
+ if (mbx->pulled >= len)
+ mbx->pulled -= len;
+ else
+ mbx->pulled = 0;
+ }
+
/* just do a quick resysnc to start of message */
mbx->pushed = 0;
mbx->pulled = 0;
@@ -1778,7 +1795,7 @@ STATIC void fm10k_sm_mbx_disconnect(struct fm10k_hw *hw,
mbx->state = FM10K_STATE_CLOSED;
mbx->remote = 0;
fm10k_mbx_reset_work(mbx);
- fm10k_mbx_update_max_size(mbx, 0);
+ fm10k_fifo_drop_all(&mbx->tx);
FM10K_WRITE_REG(hw, mbx->mbmem_reg, 0);
}
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 21/28] fm10k: create "correct" header for the remote end on connect
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (19 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 20/28] fm10k: fix Tx FIFO clearing for phantom messages Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 22/28] fm10k: do not assume VF always has 1 queue Wang Xiao W
` (7 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
When we connect to the mailbox, we insert a fake disconnect header so
that the code does not see an error and thus instantly error every time
we bring up the mailbox. However, we incorrectly record the tail and
head from the local perspective. Since the remote end shouldn't have
anything for us, add a "create_fake_disconnect_hdr" function which
inverts the TAIL and HEAD fields. This enables us to connect without any
errors of either TAIL or HEAD incorrectness, and prevents creating
extraneous error messages. This is necessary now since mbx_reset_work
does not actually clear the Tx FIFO head and tail pointers.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_mbx.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/net/fm10k/base/fm10k_mbx.c b/drivers/net/fm10k/base/fm10k_mbx.c
index 251a81d..3c9ab3a 100644
--- a/drivers/net/fm10k/base/fm10k_mbx.c
+++ b/drivers/net/fm10k/base/fm10k_mbx.c
@@ -930,6 +930,27 @@ STATIC void fm10k_mbx_create_disconnect_hdr(struct fm10k_mbx_info *mbx)
}
/**
+ * fm10k_mbx_create_fake_disconnect_hdr - Generate a false disconnect mailbox header
+ * @mbx: pointer to mailbox
+ *
+ * This function creates a fake disconnect header for loading into remote
+ * mailbox header. The primary purpose is to prevent errors on immediate
+ * start up after mbx->connect.
+ **/
+STATIC void fm10k_mbx_create_fake_disconnect_hdr(struct fm10k_mbx_info *mbx)
+{
+ u32 hdr = FM10K_MSG_HDR_FIELD_SET(FM10K_MSG_DISCONNECT, TYPE) |
+ FM10K_MSG_HDR_FIELD_SET(mbx->head, TAIL) |
+ FM10K_MSG_HDR_FIELD_SET(mbx->tail, HEAD);
+ u16 crc = fm10k_crc_16b(&hdr, mbx->local, 1);
+
+ mbx->mbx_lock |= FM10K_MBX_ACK;
+
+ /* load header to memory to be written */
+ mbx->mbx_hdr = hdr | FM10K_MSG_HDR_FIELD_SET(crc, CRC);
+}
+
+/**
* fm10k_mbx_create_error_msg - Generate a error message
* @mbx: pointer to mailbox
* @err: local error encountered
@@ -1478,8 +1499,9 @@ STATIC s32 fm10k_mbx_connect(struct fm10k_hw *hw, struct fm10k_mbx_info *mbx)
/* Place mbx in ready to connect state */
mbx->state = FM10K_STATE_CONNECT;
- /* initialize header of remote mailbox */
- fm10k_mbx_create_disconnect_hdr(mbx);
+ fm10k_mbx_reset_work(mbx);
+
+ fm10k_mbx_create_fake_disconnect_hdr(mbx);
FM10K_WRITE_MBX(hw, mbx->mbmem_reg ^ mbx->mbmem_len, mbx->mbx_hdr);
/* enable interrupt and notify other party of new message */
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 22/28] fm10k: do not assume VF always has 1 queue
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (20 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 21/28] fm10k: create "correct" header for the remote end on connect Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 23/28] fm10k: Add support for Boulder Rapids and Atwood Channel Wang Xiao W
` (6 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
It is possible that the PF has not yet assigned resources to the VF.
Although rare, this could result in the VF attempting to read queues it
does not own and result in FUM or THI faults in the PF. To prevent this,
check queue 0 before we continue in init_hw_vf.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_vf.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index ba7c7c1..3fba007 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -126,7 +126,12 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
DEBUGFUNC("fm10k_init_hw_vf");
- /* assume we always have at least 1 queue */
+ /* 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;
+
+ /* determine how many queues we have */
for (i = 1; tqdloc0 && (i < FM10K_MAX_QUEUES_POOL); i++) {
/* verify the Descriptor cache offsets are increasing */
tqdloc = ~FM10K_READ_REG(hw, FM10K_TQDLOC(i));
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 23/28] fm10k: Add support for Boulder Rapids and Atwood Channel
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (21 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 22/28] fm10k: do not assume VF always has 1 queue Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 24/28] fm10k: remove report_timestamp PF<->VF message Wang Xiao W
` (5 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
Add the device ID for Boulder Rapids and Atwood Channel to enable
drivers to support those devices.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_api.c | 6 ++++++
drivers/net/fm10k/base/fm10k_type.h | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/net/fm10k/base/fm10k_api.c b/drivers/net/fm10k/base/fm10k_api.c
index c0f555c..a1ab6b1 100644
--- a/drivers/net/fm10k/base/fm10k_api.c
+++ b/drivers/net/fm10k/base/fm10k_api.c
@@ -55,6 +55,12 @@ s32 fm10k_set_mac_type(struct fm10k_hw *hw)
switch (hw->device_id) {
case FM10K_DEV_ID_PF:
+#ifdef BOULDER_RAPIDS_HW
+ case FM10K_DEV_ID_SDI_FM10420_QDA2:
+#endif /* BOULDER_RAPIDS_HW */
+#ifdef ATWOOD_CHANNEL_HW
+ case FM10K_DEV_ID_SDI_FM10420_DA2:
+#endif /* ATWOOD_CHANNEL_HW */
hw->mac.type = fm10k_mac_pf;
break;
case FM10K_DEV_ID_VF:
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index b91b878..dbd53a1 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -43,6 +43,12 @@ struct fm10k_hw;
#define FM10K_INTEL_VENDOR_ID 0x8086
#define FM10K_DEV_ID_PF 0x15A4
#define FM10K_DEV_ID_VF 0x15A5
+#ifdef BOULDER_RAPIDS_HW
+#define FM10K_DEV_ID_SDI_FM10420_QDA2 0x15D0
+#endif /* BOULDER_RAPIDS_HW */
+#ifdef ATWOOD_CHANNEL_HW
+#define FM10K_DEV_ID_SDI_FM10420_DA2 0x15D5
+#endif /* ATWOOD_CHANNEL_HW */
#define FM10K_MAX_QUEUES 256
#define FM10K_MAX_QUEUES_PF 128
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 24/28] fm10k: remove report_timestamp PF<->VF message
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (22 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 23/28] fm10k: Add support for Boulder Rapids and Atwood Channel Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 25/28] fm10k: remove request_tx_timestamp_mode call Wang Xiao W
` (4 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
Remove support for VF transmit timestamps. VFs should not write the
timestamp bit in the Tx descriptor. Only one Tx timestamp can be
realistically handled at once. It is expected that the switch manager
use FFU logic to disable all timestamp requests except for those
originating from a specific virtual port. It is not possible to
correlate this timestamp accurately if more than one occurs out any
given EPL at a time. Since the primary purpose of Tx timestamps is to
implement PTP daemon, which also requires BAR4 access to change the
clock, do not allow VFs to transmit timestamp. Remove the PF<->VF
message for this behavior.
Note, the VF already didn't have ability to request Tx timestamp mode,
so it essentially wasn't allowed to timestamp before anyways under the
old API.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_pf.c | 14 --------------
drivers/net/fm10k/base/fm10k_type.h | 1 -
drivers/net/fm10k/base/fm10k_vf.c | 3 +--
drivers/net/fm10k/base/fm10k_vf.h | 2 +-
4 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 5506568..9741cdd 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1189,19 +1189,6 @@ STATIC void fm10k_iov_update_stats_pf(struct fm10k_hw *hw,
fm10k_update_hw_stats_q(hw, q, idx, qpp);
}
-STATIC s32 fm10k_iov_report_timestamp_pf(struct fm10k_hw *hw,
- struct fm10k_vf_info *vf_info,
- u64 timestamp)
-{
- u32 msg[4];
-
- /* generate port state response to notify VF it is not ready */
- fm10k_tlv_msg_init(msg, FM10K_VF_MSG_ID_1588);
- fm10k_tlv_attr_put_u64(msg, FM10K_1588_MSG_TIMESTAMP, timestamp);
-
- return vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);
-}
-
/**
* fm10k_iov_msg_msix_pf - Message handler for MSI-X request from VF
* @hw: Pointer to hardware structure
@@ -2045,7 +2032,6 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
iov->ops.set_lport = &fm10k_iov_set_lport_pf;
iov->ops.reset_lport = &fm10k_iov_reset_lport_pf;
iov->ops.update_stats = &fm10k_iov_update_stats_pf;
- iov->ops.report_timestamp = &fm10k_iov_report_timestamp_pf;
return fm10k_sm_mbx_init(hw, &hw->mbx, fm10k_msg_data_pf);
}
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index dbd53a1..600ce34 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -782,7 +782,6 @@ struct fm10k_iov_ops {
s32 (*set_lport)(struct fm10k_hw *, struct fm10k_vf_info *, u16, u8);
void (*reset_lport)(struct fm10k_hw *, struct fm10k_vf_info *);
void (*update_stats)(struct fm10k_hw *, struct fm10k_hw_stats_q *, u16);
- s32 (*report_timestamp)(struct fm10k_hw *, struct fm10k_vf_info *, u64);
};
struct fm10k_iov_info {
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 3fba007..87ca336 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -497,11 +497,10 @@ STATIC s32 fm10k_update_xcast_mode_vf(struct fm10k_hw *hw, u16 glort, u8 mode)
}
const struct fm10k_tlv_attr fm10k_1588_msg_attr[] = {
- FM10K_TLV_ATTR_U64(FM10K_1588_MSG_TIMESTAMP),
FM10K_TLV_ATTR_LAST
};
-/* currently there is no shared 1588 timestamp handler */
+/* currently there is no shared 1588 message handler */
/**
* fm10k_update_hw_stats_vf - Updates hardware related statistics of VF
diff --git a/drivers/net/fm10k/base/fm10k_vf.h b/drivers/net/fm10k/base/fm10k_vf.h
index 0438542..333b0d9 100644
--- a/drivers/net/fm10k/base/fm10k_vf.h
+++ b/drivers/net/fm10k/base/fm10k_vf.h
@@ -63,7 +63,7 @@ enum fm10k_tlv_lport_state_attr_id {
};
enum fm10k_tlv_1588_attr_id {
- FM10K_1588_MSG_TIMESTAMP,
+ FM10K_1588_MSG_TIMESTAMP = 0, /* deprecated */
FM10K_1588_MSG_MAX
};
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 25/28] fm10k: remove request_tx_timestamp_mode call
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (23 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 24/28] fm10k: remove report_timestamp PF<->VF message Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 26/28] fm10k: add 1588 clock owner message support Wang Xiao W
` (3 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
No longer support old API of request-response timestamp mode messages.
New API only sends timestamp-response when the switch decides which port
will be given control of timestamps. To simplify review of this code,
completely remove the support and re-add support for the response
message in a future patch.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_pf.c | 50 ++-----------------------------------
drivers/net/fm10k/base/fm10k_pf.h | 13 ----------
drivers/net/fm10k/base/fm10k_type.h | 1 -
drivers/net/fm10k/base/fm10k_vf.c | 21 ----------------
4 files changed, 2 insertions(+), 83 deletions(-)
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 9741cdd..0526077 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1844,59 +1844,14 @@ s32 fm10k_msg_err_pf(struct fm10k_hw *hw, u32 **results,
return FM10K_SUCCESS;
}
+/* currently there is no shared 1588 timestamp handler */
+
const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[] = {
FM10K_TLV_ATTR_LE_STRUCT(FM10K_PF_ATTR_ID_1588_TIMESTAMP,
sizeof(struct fm10k_swapi_1588_timestamp)),
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 */
-
-/**
- * fm10k_request_tx_timestamp_mode_pf - Request a specific Tx timestamping mode
- * @hw: pointer to hardware structure
- * @glort: base resource tag for this request
- * @mode: integer value indicating the requested mode
- *
- * This function will attempt to request a specific timestamp mode for the
- * port so that it can receive Tx timestamp messages.
- **/
-STATIC s32 fm10k_request_tx_timestamp_mode_pf(struct fm10k_hw *hw,
- u16 glort,
- u8 mode)
-{
- struct fm10k_mbx_info *mbx = &hw->mbx;
- u32 msg[3], timestamp_mode;
-
- DEBUGFUNC("fm10k_request_timestamp_mode_pf");
-
- if (mode > FM10K_TIMESTAMP_MODE_PEP_TO_ANY)
- return FM10K_ERR_PARAM;
-
- /* if glort is not valid return error */
- if (!fm10k_glort_valid_pf(hw, glort))
- return FM10K_ERR_PARAM;
-
- /* write timestamp mode as a single u32 value,
- * lower 16 bits: glort
- * upper 16 bits: mode
- */
- timestamp_mode = ((u32)mode << 16) | glort;
-
- /* generate message requesting change to xcast mode */
- fm10k_tlv_msg_init(msg, FM10K_PF_MSG_ID_TX_TIMESTAMP_MODE);
- fm10k_tlv_attr_put_u32(msg, FM10K_PF_ATTR_ID_TIMESTAMP_MODE_REQ, timestamp_mode);
-
- /* load onto outgoing mailbox */
- return mbx->ops.enqueue_tx(hw, mbx, msg);
-}
-
/**
* fm10k_adjust_systime_pf - Adjust systime frequency
* @hw: pointer to hardware structure
@@ -2020,7 +1975,6 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
mac->ops.get_host_state = &fm10k_get_host_state_pf;
mac->ops.adjust_systime = &fm10k_adjust_systime_pf;
mac->ops.read_systime = &fm10k_read_systime_pf;
- mac->ops.request_tx_timestamp_mode = &fm10k_request_tx_timestamp_mode_pf;
mac->max_msix_vectors = fm10k_get_pcie_msix_count_generic(hw);
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index af873d1..dd25c49 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -57,7 +57,6 @@ enum fm10k_pf_tlv_msg_id_v1 {
FM10K_PF_MSG_ID_SET_FLOW_STATE = 0x505,
FM10K_PF_MSG_ID_GET_1588_INFO = 0x506,
FM10K_PF_MSG_ID_1588_TIMESTAMP = 0x701,
- FM10K_PF_MSG_ID_TX_TIMESTAMP_MODE = 0x702,
};
enum fm10k_pf_tlv_attr_id_v1 {
@@ -76,8 +75,6 @@ enum fm10k_pf_tlv_attr_id_v1 {
FM10K_PF_ATTR_ID_PORT = 0x0C,
FM10K_PF_ATTR_ID_UPDATE_PVID = 0x0D,
FM10K_PF_ATTR_ID_1588_TIMESTAMP = 0x10,
- FM10K_PF_ATTR_ID_TIMESTAMP_MODE_REQ = 0x11,
- FM10K_PF_ATTR_ID_TIMESTAMP_MODE_RESP = 0x12,
};
#define FM10K_MSG_LPORT_MAP_GLORT_SHIFT 0
@@ -128,11 +125,6 @@ struct fm10k_swapi_1588_timestamp {
__le16 sglort;
};
-struct fm10k_swapi_tx_timestamp_mode {
- __le16 glort;
- __le16 maxmode;
- __le32 status;
-};
#ifdef C99
#pragma pack(pop)
@@ -161,11 +153,6 @@ 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, \
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 600ce34..7fdf8a4 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -682,7 +682,6 @@ struct fm10k_mac_ops {
void (*request_lport_map)(struct fm10k_hw *);
s32 (*adjust_systime)(struct fm10k_hw *, s32 ppb);
u64 (*read_systime)(struct fm10k_hw *);
- s32 (*request_tx_timestamp_mode)(struct fm10k_hw *, u16, u8);
};
enum fm10k_mac_type {
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 87ca336..295bae4 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -561,26 +561,6 @@ 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
@@ -669,7 +649,6 @@ s32 fm10k_init_ops_vf(struct fm10k_hw *hw)
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.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] 30+ messages in thread
* [dpdk-dev] [PATCH 26/28] fm10k: add 1588 clock owner message support
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (24 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 25/28] fm10k: remove request_tx_timestamp_mode call Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 27/28] fm10k: TRIVIAL fix typo in DEBUGFUNC Wang Xiao W
` (2 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
Add support for tx timestamp mode response message. The switch manager
should send this message whenever the owner changes or when a new port
appears. To simplify logic, treat this as full clock ownership, and call
it the CLOCK_OWNER message. Implement this as a hw->flags field, so that
base driver may use it to disable any functions which modify the clock
including Tx timestamps, frequency adjustments, and offset adjustments.
This ensures only one PEP will be handling these at a time.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_osdep.h | 1 +
drivers/net/fm10k/base/fm10k_pf.c | 47 ++++++++++++++++++++++++++++++++++++
drivers/net/fm10k/base/fm10k_pf.h | 13 ++++++++++
drivers/net/fm10k/base/fm10k_type.h | 2 ++
4 files changed, 63 insertions(+)
diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 53c433c..64f09dc 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -106,6 +106,7 @@ typedef int bool;
#define FM10K_LE32_TO_CPU rte_le_to_cpu_32
#define FM10K_CPU_TO_LE32 rte_cpu_to_le_32
#define FM10K_CPU_TO_LE16 rte_cpu_to_le_16
+#define le16_to_cpu rte_le_to_cpu_16
#define FM10K_RMB rte_rmb
#define FM10K_WMB rte_wmb
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 0526077..396a2e0 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1852,6 +1852,48 @@ const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[] = {
FM10K_TLV_ATTR_LAST
};
+const struct fm10k_tlv_attr fm10k_1588_clock_owner_attr[] = {
+ FM10K_TLV_ATTR_LE_STRUCT(FM10K_PF_ATTR_ID_1588_CLOCK_OWNER,
+ sizeof(struct fm10k_swapi_1588_clock_owner)),
+ FM10K_TLV_ATTR_LAST
+};
+
+/**
+ * fm10k_msg_1588_clock_owner_pf - Message handler for clock ownership from SM
+ * @hw: pointer to hardware structure
+ * @results: pointer to array containing parsed data,
+ * @mbx: Pointer to mailbox information structure
+ *
+ * This handler configures the FM10K_HW_FLAG_CLOCK_OWNER field for the PF
+ */
+s32 fm10k_msg_1588_clock_owner_pf(struct fm10k_hw *hw, u32 **results,
+ struct fm10k_mbx_info *mbx)
+{
+ struct fm10k_swapi_1588_clock_owner msg;
+ u16 glort;
+ s32 err;
+
+ UNREFERENCED_1PARAMETER(mbx);
+ DEBUGFUNC("fm10k_msg_1588_clock_owner");
+
+ err = fm10k_tlv_attr_get_le_struct(
+ results[FM10K_PF_ATTR_ID_1588_CLOCK_OWNER],
+ &msg, sizeof(msg));
+ if (err)
+ return err;
+
+ /* We own the clock iff the glort matches us and the enabled field is
+ * true. Otherwise, the clock must belong to some other port.
+ */
+ glort = le16_to_cpu(msg.glort);
+ if (fm10k_glort_valid_pf(hw, glort) && msg.enabled)
+ hw->flags |= FM10K_HW_FLAG_CLOCK_OWNER;
+ else
+ hw->flags &= ~FM10K_HW_FLAG_CLOCK_OWNER;
+
+ return FM10K_SUCCESS;
+}
+
/**
* fm10k_adjust_systime_pf - Adjust systime frequency
* @hw: pointer to hardware structure
@@ -1871,6 +1913,10 @@ STATIC s32 fm10k_adjust_systime_pf(struct fm10k_hw *hw, s32 ppb)
DEBUGFUNC("fm10k_adjust_systime_vf");
+ /* ensure that we control the clock */
+ if (!(hw->flags & FM10K_HW_FLAG_CLOCK_OWNER))
+ return FM10K_ERR_DEVICE_NOT_SUPPORTED;
+
/* if sw_addr is not set we don't have switch register access */
if (!hw->sw_addr)
return ppb ? FM10K_ERR_PARAM : FM10K_SUCCESS;
@@ -1936,6 +1982,7 @@ static const struct fm10k_msg_data fm10k_msg_data_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_PF_MSG_1588_CLOCK_OWNER_HANDLER(fm10k_msg_1588_clock_owner_pf),
FM10K_TLV_MSG_ERROR_HANDLER(fm10k_tlv_msg_error),
};
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index dd25c49..ae8a737 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -57,6 +57,7 @@ enum fm10k_pf_tlv_msg_id_v1 {
FM10K_PF_MSG_ID_SET_FLOW_STATE = 0x505,
FM10K_PF_MSG_ID_GET_1588_INFO = 0x506,
FM10K_PF_MSG_ID_1588_TIMESTAMP = 0x701,
+ FM10K_PF_MSG_ID_1588_CLOCK_OWNER = 0x702,
};
enum fm10k_pf_tlv_attr_id_v1 {
@@ -75,6 +76,7 @@ enum fm10k_pf_tlv_attr_id_v1 {
FM10K_PF_ATTR_ID_PORT = 0x0C,
FM10K_PF_ATTR_ID_UPDATE_PVID = 0x0D,
FM10K_PF_ATTR_ID_1588_TIMESTAMP = 0x10,
+ FM10K_PF_ATTR_ID_1588_CLOCK_OWNER = 0x12,
};
#define FM10K_MSG_LPORT_MAP_GLORT_SHIFT 0
@@ -125,6 +127,10 @@ struct fm10k_swapi_1588_timestamp {
__le16 sglort;
};
+struct fm10k_swapi_1588_clock_owner {
+ __le16 glort;
+ __le16 enabled;
+};
#ifdef C99
#pragma pack(pop)
@@ -158,6 +164,13 @@ extern const struct fm10k_tlv_attr fm10k_1588_timestamp_msg_attr[];
FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_1588_TIMESTAMP, \
fm10k_1588_timestamp_msg_attr, func)
+s32 fm10k_msg_1588_clock_owner_pf(struct fm10k_hw *, u32 **,
+ struct fm10k_mbx_info *);
+extern const struct fm10k_tlv_attr fm10k_1588_clock_owner_attr[];
+#define FM10K_PF_MSG_1588_CLOCK_OWNER_HANDLER(func) \
+ FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_1588_CLOCK_OWNER, \
+ fm10k_1588_clock_owner_attr, func)
+
s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
struct fm10k_mbx_info *);
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index 7fdf8a4..e0fc08d 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -805,6 +805,8 @@ struct fm10k_hw {
u16 subsystem_device_id;
u16 subsystem_vendor_id;
u8 revision_id;
+ u32 flags;
+#define FM10K_HW_FLAG_CLOCK_OWNER (u32)(1 << 0)
};
/* Number of Transmit and Receive Descriptors must be a multiple of 8 */
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 27/28] fm10k: TRIVIAL fix typo in DEBUGFUNC
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (25 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 26/28] fm10k: add 1588 clock owner message support Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-09-10 4:38 ` [dpdk-dev] [PATCH 28/28] fm10k: add support for MASTER_CLK_OFFSET message Wang Xiao W
2015-10-07 11:40 ` [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Thomas Monjalon
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
The function is specifically for the PF, but the DEBUGFUNC labeled it
with *_vf.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_pf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 396a2e0..3148a90 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1911,7 +1911,7 @@ STATIC s32 fm10k_adjust_systime_pf(struct fm10k_hw *hw, s32 ppb)
{
u64 systime_adjust;
- DEBUGFUNC("fm10k_adjust_systime_vf");
+ DEBUGFUNC("fm10k_adjust_systime_pf");
/* ensure that we control the clock */
if (!(hw->flags & FM10K_HW_FLAG_CLOCK_OWNER))
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* [dpdk-dev] [PATCH 28/28] fm10k: add support for MASTER_CLK_OFFSET message
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (26 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 27/28] fm10k: TRIVIAL fix typo in DEBUGFUNC Wang Xiao W
@ 2015-09-10 4:38 ` Wang Xiao W
2015-10-07 11:40 ` [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Thomas Monjalon
28 siblings, 0 replies; 30+ messages in thread
From: Wang Xiao W @ 2015-09-10 4:38 UTC (permalink / raw)
To: dev; +Cc: Wang Xiao W
Add support for clock offset message from switch manager. Each PEP will
be responsible for notifying its own VFs, and the originating PEP must
notify its own VFs prior or in addition to sending, as it will not
receive a copy of its own message. Base drivers are expected to need
custom implementations so no message handler is provided in shared code.
Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
drivers/net/fm10k/base/fm10k_api.c | 14 ++++++++++
drivers/net/fm10k/base/fm10k_api.h | 1 +
drivers/net/fm10k/base/fm10k_pf.c | 56 +++++++++++++++++++++++++++++++++++++
drivers/net/fm10k/base/fm10k_pf.h | 7 +++++
drivers/net/fm10k/base/fm10k_type.h | 2 ++
drivers/net/fm10k/base/fm10k_vf.c | 3 ++
drivers/net/fm10k/base/fm10k_vf.h | 1 +
7 files changed, 84 insertions(+)
diff --git a/drivers/net/fm10k/base/fm10k_api.c b/drivers/net/fm10k/base/fm10k_api.c
index a1ab6b1..eb5bdaa 100644
--- a/drivers/net/fm10k/base/fm10k_api.c
+++ b/drivers/net/fm10k/base/fm10k_api.c
@@ -345,3 +345,17 @@ s32 fm10k_adjust_systime(struct fm10k_hw *hw, s32 ppb)
return fm10k_call_func(hw, hw->mac.ops.adjust_systime,
(hw, ppb), FM10K_NOT_IMPLEMENTED);
}
+
+/**
+ * fm10k_notify_offset - Notify switch of change in PTP offset
+ * @hw: pointer to hardware structure
+ * @offset: 64bit unsigned offset from hardware SYSTIME value
+ *
+ * This function is meant to notify switch of change in the PTP offset for
+ * the hardware SYSTIME registers.
+ **/
+s32 fm10k_notify_offset(struct fm10k_hw *hw, u64 offset)
+{
+ return fm10k_call_func(hw, hw->mac.ops.notify_offset,
+ (hw, offset), FM10K_NOT_IMPLEMENTED);
+}
diff --git a/drivers/net/fm10k/base/fm10k_api.h b/drivers/net/fm10k/base/fm10k_api.h
index 343d750..113aef5 100644
--- a/drivers/net/fm10k/base/fm10k_api.h
+++ b/drivers/net/fm10k/base/fm10k_api.h
@@ -58,4 +58,5 @@ s32 fm10k_update_uc_addr(struct fm10k_hw *hw, u16 lport,
s32 fm10k_update_mc_addr(struct fm10k_hw *hw, u16 lport,
const u8 *mac, u16 vid, bool add);
s32 fm10k_adjust_systime(struct fm10k_hw *hw, s32 ppb);
+s32 fm10k_notify_offset(struct fm10k_hw *hw, u64 offset);
#endif /* _FM10K_API_H_ */
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 3148a90..6e6d71e 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -1858,6 +1858,33 @@ const struct fm10k_tlv_attr fm10k_1588_clock_owner_attr[] = {
FM10K_TLV_ATTR_LAST
};
+const struct fm10k_tlv_attr fm10k_master_clk_offset_attr[] = {
+ FM10K_TLV_ATTR_U64(FM10K_PF_ATTR_ID_MASTER_CLK_OFFSET),
+ FM10K_TLV_ATTR_LAST
+};
+
+/**
+ * fm10k_iov_notify_offset_pf - Notify VF of change in PTP offset
+ * @hw: pointer to hardware structure
+ * @vf_info: pointer to the vf info structure
+ * @offset: 64bit unsigned offset from hardware SYSTIME
+ *
+ * This function sends a message to a given VF to notify it of PTP offset
+ * changes.
+ **/
+STATIC void fm10k_iov_notify_offset_pf(struct fm10k_hw *hw,
+ struct fm10k_vf_info *vf_info,
+ u64 offset)
+{
+ u32 msg[4];
+
+ fm10k_tlv_msg_init(msg, FM10K_VF_MSG_ID_1588);
+ fm10k_tlv_attr_put_u64(msg, FM10K_1588_MSG_CLK_OFFSET, offset);
+
+ if (vf_info->mbx.ops.enqueue_tx)
+ vf_info->mbx.ops.enqueue_tx(hw, &vf_info->mbx, msg);
+}
+
/**
* fm10k_msg_1588_clock_owner_pf - Message handler for clock ownership from SM
* @hw: pointer to hardware structure
@@ -1951,6 +1978,33 @@ STATIC s32 fm10k_adjust_systime_pf(struct fm10k_hw *hw, s32 ppb)
}
/**
+ * fm10k_notify_offset_pf - Notify switch of change in PTP offset
+ * @hw: pointer to hardware structure
+ * @offset: 64bit unsigned offset of SYSTIME
+ *
+ * This function sends a message to the switch to indicate a change in the
+ * offset of the hardware SYSTIME registers. The switch manager is
+ * responsible for transmitting this message to other hosts.
+ */
+STATIC s32 fm10k_notify_offset_pf(struct fm10k_hw *hw, u64 offset)
+{
+ struct fm10k_mbx_info *mbx = &hw->mbx;
+ u32 msg[4];
+
+ DEBUGFUNC("fm10k_notify_offset_pf");
+
+ /* ensure that we control the clock */
+ if (!(hw->flags & FM10K_HW_FLAG_CLOCK_OWNER))
+ return FM10K_ERR_DEVICE_NOT_SUPPORTED;
+
+ fm10k_tlv_msg_init(msg, FM10K_PF_MSG_ID_MASTER_CLK_OFFSET);
+ fm10k_tlv_attr_put_u64(msg, FM10K_PF_ATTR_ID_MASTER_CLK_OFFSET, offset);
+
+ /* load onto outgoing mailbox */
+ return mbx->ops.enqueue_tx(hw, mbx, msg);
+}
+
+/**
* fm10k_read_systime_pf - Reads value of systime registers
* @hw: pointer to the hardware structure
*
@@ -2021,6 +2075,7 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
mac->ops.get_fault = &fm10k_get_fault_pf;
mac->ops.get_host_state = &fm10k_get_host_state_pf;
mac->ops.adjust_systime = &fm10k_adjust_systime_pf;
+ mac->ops.notify_offset = &fm10k_notify_offset_pf;
mac->ops.read_systime = &fm10k_read_systime_pf;
mac->max_msix_vectors = fm10k_get_pcie_msix_count_generic(hw);
@@ -2033,6 +2088,7 @@ s32 fm10k_init_ops_pf(struct fm10k_hw *hw)
iov->ops.set_lport = &fm10k_iov_set_lport_pf;
iov->ops.reset_lport = &fm10k_iov_reset_lport_pf;
iov->ops.update_stats = &fm10k_iov_update_stats_pf;
+ iov->ops.notify_offset = &fm10k_iov_notify_offset_pf;
return fm10k_sm_mbx_init(hw, &hw->mbx, fm10k_msg_data_pf);
}
diff --git a/drivers/net/fm10k/base/fm10k_pf.h b/drivers/net/fm10k/base/fm10k_pf.h
index ae8a737..44bd193 100644
--- a/drivers/net/fm10k/base/fm10k_pf.h
+++ b/drivers/net/fm10k/base/fm10k_pf.h
@@ -58,6 +58,7 @@ enum fm10k_pf_tlv_msg_id_v1 {
FM10K_PF_MSG_ID_GET_1588_INFO = 0x506,
FM10K_PF_MSG_ID_1588_TIMESTAMP = 0x701,
FM10K_PF_MSG_ID_1588_CLOCK_OWNER = 0x702,
+ FM10K_PF_MSG_ID_MASTER_CLK_OFFSET = 0x703,
};
enum fm10k_pf_tlv_attr_id_v1 {
@@ -77,6 +78,7 @@ enum fm10k_pf_tlv_attr_id_v1 {
FM10K_PF_ATTR_ID_UPDATE_PVID = 0x0D,
FM10K_PF_ATTR_ID_1588_TIMESTAMP = 0x10,
FM10K_PF_ATTR_ID_1588_CLOCK_OWNER = 0x12,
+ FM10K_PF_ATTR_ID_MASTER_CLK_OFFSET = 0x14,
};
#define FM10K_MSG_LPORT_MAP_GLORT_SHIFT 0
@@ -171,6 +173,11 @@ extern const struct fm10k_tlv_attr fm10k_1588_clock_owner_attr[];
FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_1588_CLOCK_OWNER, \
fm10k_1588_clock_owner_attr, func)
+extern const struct fm10k_tlv_attr fm10k_master_clk_offset_attr[];
+#define FM10K_PF_MSG_MASTER_CLK_OFFSET_HANDLER(func) \
+ FM10K_MSG_HANDLER(FM10K_PF_MSG_ID_MASTER_CLK_OFFSET, \
+ fm10k_master_clk_offset_attr, func)
+
s32 fm10k_iov_msg_msix_pf(struct fm10k_hw *, u32 **, struct fm10k_mbx_info *);
s32 fm10k_iov_msg_mac_vlan_pf(struct fm10k_hw *, u32 **,
struct fm10k_mbx_info *);
diff --git a/drivers/net/fm10k/base/fm10k_type.h b/drivers/net/fm10k/base/fm10k_type.h
index e0fc08d..df1d276 100644
--- a/drivers/net/fm10k/base/fm10k_type.h
+++ b/drivers/net/fm10k/base/fm10k_type.h
@@ -681,6 +681,7 @@ struct fm10k_mac_ops {
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 *);
};
@@ -781,6 +782,7 @@ struct fm10k_iov_ops {
s32 (*set_lport)(struct fm10k_hw *, struct fm10k_vf_info *, u16, u8);
void (*reset_lport)(struct fm10k_hw *, struct fm10k_vf_info *);
void (*update_stats)(struct fm10k_hw *, struct fm10k_hw_stats_q *, u16);
+ void (*notify_offset)(struct fm10k_hw *, struct fm10k_vf_info*, u64);
};
struct fm10k_iov_info {
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 295bae4..a46b488 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -414,6 +414,8 @@ 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
@@ -497,6 +499,7 @@ STATIC s32 fm10k_update_xcast_mode_vf(struct fm10k_hw *hw, u16 glort, u8 mode)
}
const struct fm10k_tlv_attr fm10k_1588_msg_attr[] = {
+ FM10K_TLV_ATTR_U64(FM10K_1588_MSG_CLK_OFFSET),
FM10K_TLV_ATTR_LAST
};
diff --git a/drivers/net/fm10k/base/fm10k_vf.h b/drivers/net/fm10k/base/fm10k_vf.h
index 333b0d9..116c56f 100644
--- a/drivers/net/fm10k/base/fm10k_vf.h
+++ b/drivers/net/fm10k/base/fm10k_vf.h
@@ -64,6 +64,7 @@ enum fm10k_tlv_lport_state_attr_id {
enum fm10k_tlv_1588_attr_id {
FM10K_1588_MSG_TIMESTAMP = 0, /* deprecated */
+ FM10K_1588_MSG_CLK_OFFSET,
FM10K_1588_MSG_MAX
};
--
1.9.3
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team
2015-09-10 4:38 [dpdk-dev] [PATCH 00/28] fm10k: update shared code from ND team Wang Xiao W
` (27 preceding siblings ...)
2015-09-10 4:38 ` [dpdk-dev] [PATCH 28/28] fm10k: add support for MASTER_CLK_OFFSET message Wang Xiao W
@ 2015-10-07 11:40 ` Thomas Monjalon
28 siblings, 0 replies; 30+ messages in thread
From: Thomas Monjalon @ 2015-10-07 11:40 UTC (permalink / raw)
To: Wang Xiao W; +Cc: dev
2015-09-10 12:38, Wang Xiao W:
> This set of shared code update patches has been tested.
Applied, thanks.
Some titles were fixed and some patches are squashed or reordered.
Maybe it deserves an entry in the release notes.
(same comment as the recent i40e update)
Jing Chen, as the fm10k maintainer, your role is to check the code, the git
messages *and* the documentation updates, including the release notes.
Thanks for helping
^ permalink raw reply [flat|nested] 30+ messages in thread