DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] i40e: fix for ieee15888 with rte_next_abi
@ 2015-07-29 17:51 John McNamara
  2015-07-31 11:39 ` [dpdk-dev] [PATCH v2] " John McNamara
  0 siblings, 1 reply; 6+ messages in thread
From: John McNamara @ 2015-07-29 17:51 UTC (permalink / raw)
  To: dev

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

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

* [dpdk-dev] [PATCH v2] i40e: fix for ieee15888 with rte_next_abi
  2015-07-29 17:51 [dpdk-dev] [PATCH] i40e: fix for ieee15888 with rte_next_abi John McNamara
@ 2015-07-31 11:39 ` John McNamara
  2015-07-31 12:05   ` Gonzalez Monroy, Sergio
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: John McNamara @ 2015-07-31 11:39 UTC (permalink / raw)
  To: dev

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>
---

v2: Fix for "unused function" warning with clang >= 3.4. Warning:

    i40e_rxtx.c:183:1: error: unused function 'i40e_get_iee15888_flags' 
                       [-Werror,-Wunused-function]

v1: Initial version

 drivers/net/i40e/i40e_rxtx.c | 54 ++++++++++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 25 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 891a221..473fc0e 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -176,6 +176,32 @@ 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.
+ */
+#ifdef RTE_LIBRTE_IEEE1588
+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;
+}
+#endif
+
 #ifdef RTE_NEXT_ABI
 /* For each value it means, datasheet of hardware can tell more details */
 static inline uint32_t
@@ -1285,15 +1311,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 +1565,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 +1734,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

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

* Re: [dpdk-dev] [PATCH v2] i40e: fix for ieee15888 with rte_next_abi
  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  6:27   ` Xu, HuilongX
  2 siblings, 0 replies; 6+ messages in thread
From: Gonzalez Monroy, Sergio @ 2015-07-31 12:05 UTC (permalink / raw)
  To: John McNamara, dev

On 31/07/2015 12:39, John McNamara wrote:
> 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>
> ---
>
> v2: Fix for "unused function" warning with clang >= 3.4. Warning:
>
>      i40e_rxtx.c:183:1: error: unused function 'i40e_get_iee15888_flags'
>                         [-Werror,-Wunused-function]
>
> v1: Initial version
>
>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] i40e: fix for ieee15888 with rte_next_abi
  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
  2 siblings, 1 reply; 6+ messages in thread
From: Lu, Wenzhuo @ 2015-08-03  0:44 UTC (permalink / raw)
  To: Mcnamara, John, dev

Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of John McNamara
> Sent: Friday, July 31, 2015 7:39 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] i40e: fix for ieee15888 with rte_next_abi
> 
> 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>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] i40e: fix for ieee15888 with rte_next_abi
  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  6:27   ` Xu, HuilongX
  2 siblings, 0 replies; 6+ messages in thread
From: Xu, HuilongX @ 2015-08-03  6:27 UTC (permalink / raw)
  To: Mcnamara, John, dev

Tested-by:huilong xu <huilongx.xu@intel.com>
Os: dpdk-fedora20 3.11.10-301.fc20.x86_64
Gcc: 4.8.3 20140911 (Red Hat 4.8.3-7)
NIC: fortville_spirit_single
Package:dpdk.org newest code(commit 921353134fe01606411d3508f3ca798f0a38da73) + patch
Test case :ieee 1588 disable and ieee 1588 enable all passed.
Test steps:
1. enable ieee1588 compile switch
sed -i -e 's/IEEE1588=n$/IEEE1588=y/' config/common_linuxapp
2. compile and install dpdk driver
3. bind dpdk driver and set 2048*2M hugepage
4. start testpmd 
 ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x6 -n 4  -- -i  --txqflags=0
5. exec testpmd cmdline
    a) set fwd ieee1588
    b) start
6. send ieee 1588 package by scapy to testpmd port 0, and used scapy get package testpmd port1
   sendp([Ether(dst="68:05:ca:27:d5:8e",type=0x88f7)/"\x00\x02"], iface="p4p2")
7.  exec test pmd
    Stop
8. check testpmd print
   a) "IEEE1588 PTP V2 SYNC" strings in testpmd print
   b) check tx time > rx time
10.check testpmd fwd a ieee1588 package 
   SCAPY Result:
00:00:00:00:00:00 > 68:05:ca:27:d5:8e (0x88f7) / Raw[PEXPECT]
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of John McNamara
> Sent: Friday, July 31, 2015 7:39 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] i40e: fix for ieee15888 with rte_next_abi
> 
> 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>
> ---
> 
> v2: Fix for "unused function" warning with clang >= 3.4. Warning:
> 
>     i40e_rxtx.c:183:1: error: unused function 'i40e_get_iee15888_flags'
>                        [-Werror,-Wunused-function]
> 
> v1: Initial version
> 
>  drivers/net/i40e/i40e_rxtx.c | 54 ++++++++++++++++++++++++---------------
> -----
>  1 file changed, 29 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 891a221..473fc0e 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -176,6 +176,32 @@ 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.
> + */
> +#ifdef RTE_LIBRTE_IEEE1588
> +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;
> +}
> +#endif
> +
>  #ifdef RTE_NEXT_ABI
>  /* For each value it means, datasheet of hardware can tell more details
> */
>  static inline uint32_t
> @@ -1285,15 +1311,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 +1565,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 +1734,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

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

* Re: [dpdk-dev] [PATCH v2] i40e: fix for ieee15888 with rte_next_abi
  2015-08-03  0:44   ` Lu, Wenzhuo
@ 2015-08-03 12:53     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2015-08-03 12:53 UTC (permalink / raw)
  To: Mcnamara, John; +Cc: dev

> > 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>
> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

Applied, thanks

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

end of thread, other threads:[~2015-08-03 12:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29 17:51 [dpdk-dev] [PATCH] i40e: fix for ieee15888 with rte_next_abi John McNamara
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

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).