From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 7EB9BC492 for ; Fri, 31 Jul 2015 13:39:07 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 31 Jul 2015 04:39:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,584,1432623600"; d="scan'208";a="739502698" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 31 Jul 2015 04:39:05 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t6VBd4lc001010; Fri, 31 Jul 2015 12:39:04 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t6VBd4me012973; Fri, 31 Jul 2015 12:39:04 +0100 Received: (from jmcnam2x@localhost) by sivswdev02.ir.intel.com with id t6VBd4KA012969; Fri, 31 Jul 2015 12:39:04 +0100 From: John McNamara To: dev@dpdk.org Date: Fri, 31 Jul 2015 12:39:00 +0100 Message-Id: <1438342740-12938-1-git-send-email-john.mcnamara@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1438192290-1073-1-git-send-email-john.mcnamara@intel.com> References: <1438192290-1073-1-git-send-email-john.mcnamara@intel.com> Subject: [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: Fri, 31 Jul 2015 11:39:08 -0000 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 Signed-off-by: John McNamara --- 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