From: John McNamara <john.mcnamara@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] i40e: fix for ieee15888 with rte_next_abi
Date: Wed, 29 Jul 2015 18:51:30 +0100 [thread overview]
Message-ID: <1438192290-1073-1-git-send-email-john.mcnamara@intel.com> (raw)
Fixes issue where ieee15888 timestamping doesn't work for the i40e
pmd when RTE_ABI_NEXT is enabled.
Also refactors repeated ieee15888 flag checking and setting
code into a function.
Reported-by: Huilong Xu <huilongx.xu@intel.com>
Signed-off-by: John McNamara <john.mcnamara@intel.com>
---
drivers/net/i40e/i40e_rxtx.c | 52 +++++++++++++++++++++++---------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 891a221..c33d030 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -176,6 +176,30 @@ i40e_rxd_error_to_pkt_flags(uint64_t qword)
return flags;
}
+/* Function to check and set the ieee1588 timesync index and get the
+ * appropriate flags.
+ */
+static inline uint64_t
+i40e_get_iee15888_flags(struct rte_mbuf *mb, uint64_t qword)
+{
+ uint64_t pkt_flags = 0;
+ uint16_t tsyn = (qword & (I40E_RXD_QW1_STATUS_TSYNVALID_MASK
+ | I40E_RXD_QW1_STATUS_TSYNINDX_MASK))
+ >> I40E_RX_DESC_STATUS_TSYNINDX_SHIFT;
+
+#ifdef RTE_NEXT_ABI
+ if ((mb->packet_type & RTE_PTYPE_L2_MASK)
+ == RTE_PTYPE_L2_ETHER_TIMESYNC)
+ pkt_flags = PKT_RX_IEEE1588_PTP;
+#endif
+ if (tsyn & 0x04) {
+ pkt_flags |= PKT_RX_IEEE1588_TMST;
+ mb->timesync = tsyn & 0x03;
+ }
+
+ return pkt_flags;
+}
+
#ifdef RTE_NEXT_ABI
/* For each value it means, datasheet of hardware can tell more details */
static inline uint32_t
@@ -1285,15 +1309,7 @@ i40e_rx_scan_hw_ring(struct i40e_rx_queue *rxq)
pkt_flags |= i40e_rxd_build_fdir(&rxdp[j], mb);
#ifdef RTE_LIBRTE_IEEE1588
- uint16_t tsyn = (qword1
- & (I40E_RXD_QW1_STATUS_TSYNVALID_MASK
- | I40E_RXD_QW1_STATUS_TSYNINDX_MASK))
- >> I40E_RX_DESC_STATUS_TSYNINDX_SHIFT;
-
- if (tsyn & 0x04)
- pkt_flags |= PKT_RX_IEEE1588_TMST;
-
- mb->timesync = tsyn & 0x03;
+ pkt_flags |= i40e_get_iee15888_flags(mb, qword1);
#endif
mb->ol_flags |= pkt_flags;
@@ -1547,14 +1563,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
pkt_flags |= i40e_rxd_build_fdir(&rxd, rxm);
#ifdef RTE_LIBRTE_IEEE1588
- uint16_t tsyn = (qword1 & (I40E_RXD_QW1_STATUS_TSYNVALID_MASK
- | I40E_RXD_QW1_STATUS_TSYNINDX_MASK))
- >> I40E_RX_DESC_STATUS_TSYNINDX_SHIFT;
-
- if (tsyn & 0x04)
- pkt_flags |= PKT_RX_IEEE1588_TMST;
-
- rxm->timesync = tsyn & 0x03;
+ pkt_flags |= i40e_get_iee15888_flags(rxm, qword1);
#endif
rxm->ol_flags |= pkt_flags;
@@ -1723,14 +1732,7 @@ i40e_recv_scattered_pkts(void *rx_queue,
pkt_flags |= i40e_rxd_build_fdir(&rxd, rxm);
#ifdef RTE_LIBRTE_IEEE1588
- uint16_t tsyn = (qword1 & (I40E_RXD_QW1_STATUS_TSYNVALID_MASK
- | I40E_RXD_QW1_STATUS_TSYNINDX_MASK))
- >> I40E_RX_DESC_STATUS_TSYNINDX_SHIFT;
-
- if (tsyn & 0x04)
- pkt_flags |= PKT_RX_IEEE1588_TMST;
-
- first_seg->timesync = tsyn & 0x03;
+ pkt_flags |= i40e_get_iee15888_flags(first_seg, qword1);
#endif
first_seg->ol_flags |= pkt_flags;
--
1.8.1.4
next reply other threads:[~2015-07-29 17:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-29 17:51 John McNamara [this message]
2015-07-31 11:39 ` [dpdk-dev] [PATCH v2] " John McNamara
2015-07-31 12:05 ` Gonzalez Monroy, Sergio
2015-08-03 0:44 ` Lu, Wenzhuo
2015-08-03 12:53 ` Thomas Monjalon
2015-08-03 6:27 ` Xu, HuilongX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1438192290-1073-1-git-send-email-john.mcnamara@intel.com \
--to=john.mcnamara@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).