From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id D64E92E7B for ; Mon, 3 Aug 2015 08:28:05 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 02 Aug 2015 23:28:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,599,1432623600"; d="scan'208";a="760631282" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by fmsmga001.fm.intel.com with ESMTP; 02 Aug 2015 23:28:04 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by PGSMSX106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 3 Aug 2015 14:27:29 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.18]) by shsmsx102.ccr.corp.intel.com ([169.254.2.126]) with mapi id 14.03.0224.002; Mon, 3 Aug 2015 14:27:28 +0800 From: "Xu, HuilongX" To: "Mcnamara, John" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] i40e: fix for ieee15888 with rte_next_abi Thread-Index: AQHQy4WW9wus+v8qtUesrg9bTwwvnZ350NqA Date: Mon, 3 Aug 2015 06:27:28 +0000 Message-ID: References: <1438192290-1073-1-git-send-email-john.mcnamara@intel.com> <1438342740-12938-1-git-send-email-john.mcnamara@intel.com> In-Reply-To: <1438342740-12938-1-git-send-email-john.mcnamara@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-hashedpuzzle: AJRZ AlBz BTRs BZyb B3ZQ CsWs D51Q FS9x F6VP GnDZ Hp5i H0hz IeIK I2wm J6nK KfWx; 1; ZABlAHYAQABkAHAAZABrAC4AbwByAGcA; Sosha1_v1; 7; {8C5E9A0F-7284-4144-A3C9-04638B1B3B70}; aAB1AGkAbABvAG4AZwB4AC4AeAB1AEAAaQBuAHQAZQBsAC4AYwBvAG0A; Mon, 03 Aug 2015 06:27:26 GMT; UgBFADoAIABbAGQAcABkAGsALQBkAGUAdgBdACAAWwBQAEEAVABDAEgAIAB2ADIAXQAgAGkANAAwAGUAOgAgAGYAaQB4ACAAZgBvAHIAIABpAGUAZQBlADEANQA4ADgAOAAgAHcAaQB0AGgAIAByAHQAZQBfAG4AZQB4AHQAXwBhAGIAaQA= x-cr-puzzleid: {8C5E9A0F-7284-4144-A3C9-04638B1B3B70} x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] i40e: fix for ieee15888 with rte_next_abi X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2015 06:28:06 -0000 Tested-by:huilong xu 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 921353134fe01606411d3508f3ca798f0a38da7= 3) + patch Test case :ieee 1588 disable and ieee 1588 enable all passed. Test steps: 1. enable ieee1588 compile switch sed -i -e 's/IEEE1588=3Dn$/IEEE1588=3Dy/' config/common_linuxapp 2. compile and install dpdk driver 3. bind dpdk driver and set 2048*2M hugepage 4. start testpmd=20 ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x6 -n 4 -- -i --txqflags=3D= 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 pa= ckage testpmd port1 sendp([Ether(dst=3D"68:05:ca:27:d5:8e",type=3D0x88f7)/"\x00\x02"], iface= =3D"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=20 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 >=20 > Fixes issue where ieee15888 timestamping doesn't work for the i40e > pmd when RTE_ABI_NEXT is enabled. >=20 > Also refactors repeated ieee15888 flag checking and setting > code into a function. >=20 > Reported-by: Huilong Xu > Signed-off-by: John McNamara > --- >=20 > v2: Fix for "unused function" warning with clang >=3D 3.4. Warning: >=20 > i40e_rxtx.c:183:1: error: unused function 'i40e_get_iee15888_flags' > [-Werror,-Wunused-function] >=20 > v1: Initial version >=20 > drivers/net/i40e/i40e_rxtx.c | 54 ++++++++++++++++++++++++--------------= - > ----- > 1 file changed, 29 insertions(+), 25 deletions(-) >=20 > 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; > } >=20 > +/* 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 =3D 0; > + uint16_t tsyn =3D (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) > + =3D=3D RTE_PTYPE_L2_ETHER_TIMESYNC) > + pkt_flags =3D PKT_RX_IEEE1588_PTP; > +#endif > + if (tsyn & 0x04) { > + pkt_flags |=3D PKT_RX_IEEE1588_TMST; > + mb->timesync =3D 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 |=3D i40e_rxd_build_fdir(&rxdp[j], mb); >=20 > #ifdef RTE_LIBRTE_IEEE1588 > - uint16_t tsyn =3D (qword1 > - & (I40E_RXD_QW1_STATUS_TSYNVALID_MASK > - | I40E_RXD_QW1_STATUS_TSYNINDX_MASK)) > - >> I40E_RX_DESC_STATUS_TSYNINDX_SHIFT; > - > - if (tsyn & 0x04) > - pkt_flags |=3D PKT_RX_IEEE1588_TMST; > - > - mb->timesync =3D tsyn & 0x03; > + pkt_flags |=3D i40e_get_iee15888_flags(mb, qword1); > #endif > mb->ol_flags |=3D pkt_flags; >=20 > @@ -1547,14 +1565,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf > **rx_pkts, uint16_t nb_pkts) > pkt_flags |=3D i40e_rxd_build_fdir(&rxd, rxm); >=20 > #ifdef RTE_LIBRTE_IEEE1588 > - uint16_t tsyn =3D (qword1 & (I40E_RXD_QW1_STATUS_TSYNVALID_MASK > - | I40E_RXD_QW1_STATUS_TSYNINDX_MASK)) > - >> I40E_RX_DESC_STATUS_TSYNINDX_SHIFT; > - > - if (tsyn & 0x04) > - pkt_flags |=3D PKT_RX_IEEE1588_TMST; > - > - rxm->timesync =3D tsyn & 0x03; > + pkt_flags |=3D i40e_get_iee15888_flags(rxm, qword1); > #endif > rxm->ol_flags |=3D pkt_flags; >=20 > @@ -1723,14 +1734,7 @@ i40e_recv_scattered_pkts(void *rx_queue, > pkt_flags |=3D i40e_rxd_build_fdir(&rxd, rxm); >=20 > #ifdef RTE_LIBRTE_IEEE1588 > - uint16_t tsyn =3D (qword1 & (I40E_RXD_QW1_STATUS_TSYNVALID_MASK > - | I40E_RXD_QW1_STATUS_TSYNINDX_MASK)) > - >> I40E_RX_DESC_STATUS_TSYNINDX_SHIFT; > - > - if (tsyn & 0x04) > - pkt_flags |=3D PKT_RX_IEEE1588_TMST; > - > - first_seg->timesync =3D tsyn & 0x03; > + pkt_flags |=3D i40e_get_iee15888_flags(first_seg, qword1); > #endif > first_seg->ol_flags |=3D pkt_flags; >=20 > -- > 1.8.1.4