From patchwork Fri Sep 26 06:03:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingjing Wu X-Patchwork-Id: 547 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 610857E2C; Fri, 26 Sep 2014 07:57:50 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B47937E17 for ; Fri, 26 Sep 2014 07:57:46 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 25 Sep 2014 23:04:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="391863680" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 25 Sep 2014 22:58:02 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s8Q642OH029135; Fri, 26 Sep 2014 14:04:02 +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 s8Q640Gk012979; Fri, 26 Sep 2014 14:04:02 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s8Q640QX012975; Fri, 26 Sep 2014 14:04:00 +0800 From: Jingjing Wu To: dev@dpdk.org Date: Fri, 26 Sep 2014 14:03:27 +0800 Message-Id: <1411711418-12881-10-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1411711418-12881-1-git-send-email-jingjing.wu@intel.com> References: <1411711418-12881-1-git-send-email-jingjing.wu@intel.com> Subject: [dpdk-dev] [PATCH v3 09/20] i40e: report flow director match info to mbuf 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" support to set the FDIR flag and report FD_ID in mbuf if match Signed-off-by: Jingjing Wu Acked-by: Chen Jing D(Mark) Acked-by: Helin Zhang --- lib/librte_pmd_i40e/i40e_rxtx.c | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c index 4435367..c067cdd 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.c +++ b/lib/librte_pmd_i40e/i40e_rxtx.c @@ -105,6 +105,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; } @@ -641,6 +645,22 @@ i40e_rx_scan_hw_ring(struct i40e_rx_queue *rxq) if (pkt_flags & PKT_RX_RSS_HASH) mb->hash.rss = rte_le_to_cpu_32(\ rxdp->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->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->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++) @@ -877,6 +897,20 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) if (pkt_flags & PKT_RX_RSS_HASH) rxm->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->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->hash.fdir.id = (uint16_t) + rte_le_to_cpu_32(rxd.wb.qword3.hi_dword.fd_id); +#endif + } rx_pkts[nb_rx++] = rxm; } @@ -1031,6 +1065,20 @@ i40e_recv_scattered_pkts(void *rx_queue, if (pkt_flags & PKT_RX_RSS_HASH) rxm->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->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->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(RTE_PTR_ADD(first_seg->buf_addr,