From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 52A7EB381 for ; Fri, 1 Aug 2014 09:07:06 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 01 Aug 2014 00:03:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,778,1400050800"; d="scan'208";a="552236362" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 01 Aug 2014 00:09:08 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s717979r015039; Fri, 1 Aug 2014 15:09:07 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s71793Uw025070; Fri, 1 Aug 2014 15:09:05 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s71793U3025066; Fri, 1 Aug 2014 15:09:03 +0800 From: Jingjing Wu To: dev@dpdk.org Date: Fri, 1 Aug 2014 15:08:36 +0800 Message-Id: <1406876916-24869-7-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1406876916-24869-1-git-send-email-jingjing.wu@intel.com> References: <1406876916-24869-1-git-send-email-jingjing.wu@intel.com> Subject: [dpdk-dev] [PATCH 6/6] i40e: support FD ID report and match counter for i40e flow director 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, 01 Aug 2014 07:07:07 -0000 support to get the fdir_match counter support to set the FDIR flag and FD_ID reported in mbuf Signed-off-by: jingjing.wu --- lib/librte_pmd_i40e/i40e_ethdev.c | 5 ++++ lib/librte_pmd_i40e/i40e_rxtx.c | 49 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index c4637be..c518375 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -1112,6 +1112,9 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) I40E_GLPRT_PTC9522L(hw->port), pf->offset_loaded, &os->tx_size_big, &ns->tx_size_big); + i40e_stat_update_32(hw, I40E_GLQF_PCNT(pf->fdir.match_counter_index), + pf->offset_loaded, + &os->fd_sb_match, &ns->fd_sb_match); /* GLPRT_MSPDC not supported */ /* GLPRT_XEC not supported */ @@ -1125,6 +1128,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->obytes = ns->eth.tx_bytes; stats->oerrors = ns->eth.tx_errors; stats->imcasts = ns->eth.rx_multicast; + stats->fdirmatch = ns->fd_sb_match; if (pf->main_vsi) i40e_update_vsi_stats(pf->main_vsi); @@ -1190,6 +1194,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) printf("mac_short_packet_dropped: %lu\n", ns->mac_short_packet_dropped); printf("checksum_error: %lu\n", ns->checksum_error); + printf("fdir_match: %lu\n", ns->fd_sb_match); printf("***************** PF stats end ********************\n"); #endif /* RTE_LIBRTE_I40E_DEBUG_DRIVER */ } diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c index ad60d20..759fd75 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.c +++ b/lib/librte_pmd_i40e/i40e_rxtx.c @@ -110,6 +110,10 @@ i40e_rxd_status_to_pkt_flags(uint64_t qword) I40E_RX_DESC_FLTSTAT_RSS_HASH) == I40E_RX_DESC_FLTSTAT_RSS_HASH) ? PKT_RX_RSS_HASH : 0); + /* Check if FDIR Match */ + flags |= (uint16_t)(qword & (1 << I40E_RX_DESC_STATUS_FLM_SHIFT) ? + PKT_RX_FDIR : 0); + return flags; } @@ -626,7 +630,22 @@ i40e_rx_scan_hw_ring(struct i40e_rx_queue *rxq) mb->ol_flags = pkt_flags; if (pkt_flags & PKT_RX_RSS_HASH) mb->pkt.hash.rss = rte_le_to_cpu_32(\ - rxdp->wb.qword0.hi_dword.rss); + rxdp[j].wb.qword0.hi_dword.rss); + if (pkt_flags & PKT_RX_FDIR) { +#ifdef RTE_LIBRTE_I40E_16BYTE_RX_DESC + if (((qword1 >> I40E_RX_DESC_STATUS_FLTSTAT_SHIFT) & + I40E_RX_DESC_FLTSTAT_RSS_HASH) == + I40E_RX_DESC_FLTSTAT_RSV_FD_ID) + mb->pkt.hash.fdir.id = (uint16_t) + rte_le_to_cpu_32(rxdp[j].wb.qword0.hi_dword.fd); +#else + if (((rxdp[j].wb.qword2.ext_status >> + I40E_RX_DESC_EXT_STATUS_FLEXBH_SHIFT) & + 0x03) == 0x01) + mb->pkt.hash.fdir.id = (uint16_t) + rte_le_to_cpu_32(rxdp[j].wb.qword3.hi_dword.fd_id); +#endif + } } for (j = 0; j < I40E_LOOK_AHEAD; j++) @@ -864,6 +883,20 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) if (pkt_flags & PKT_RX_RSS_HASH) rxm->pkt.hash.rss = rte_le_to_cpu_32(rxd.wb.qword0.hi_dword.rss); + if (pkt_flags & PKT_RX_FDIR) { +#ifdef RTE_LIBRTE_I40E_16BYTE_RX_DESC + if (((qword1 >> I40E_RX_DESC_STATUS_FLTSTAT_SHIFT) & + I40E_RX_DESC_FLTSTAT_RSS_HASH) == + I40E_RX_DESC_FLTSTAT_RSV_FD_ID) + rxm->pkt.hash.fdir.id = (uint16_t) + rte_le_to_cpu_32(rxd.wb.qword0.hi_dword.fd); +#else + if (((rxd.wb.qword2.ext_status >> I40E_RX_DESC_EXT_STATUS_FLEXBH_SHIFT) & + 0x03) == 0x01) + rxm->pkt.hash.fdir.id = (uint16_t) + rte_le_to_cpu_32(rxd.wb.qword3.hi_dword.fd_id); +#endif + } rx_pkts[nb_rx++] = rxm; } @@ -1017,6 +1050,20 @@ i40e_recv_scattered_pkts(void *rx_queue, if (pkt_flags & PKT_RX_RSS_HASH) rxm->pkt.hash.rss = rte_le_to_cpu_32(rxd.wb.qword0.hi_dword.rss); + if (pkt_flags & PKT_RX_FDIR) { +#ifdef RTE_LIBRTE_I40E_16BYTE_RX_DESC + if (((qword1 >> I40E_RX_DESC_STATUS_FLTSTAT_SHIFT) & + I40E_RX_DESC_FLTSTAT_RSS_HASH) == + I40E_RX_DESC_FLTSTAT_RSV_FD_ID) + rxm->pkt.hash.fdir.id = (uint16_t) + rte_le_to_cpu_32(rxd.wb.qword0.hi_dword.fd); +#else + if (((rxd.wb.qword2.ext_status >> I40E_RX_DESC_EXT_STATUS_FLEXBH_SHIFT) & + 0x03) == 0x01) + rxm->pkt.hash.fdir.id = (uint16_t) + rte_le_to_cpu_32(rxd.wb.qword3.hi_dword.fd_id); +#endif + } /* Prefetch data of first segment, if configured to do so. */ rte_prefetch0(first_seg->pkt.data); -- 1.8.1.4