DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 6/7] i40e: support FD ID report and match counter for i40e flow director
Date: Wed, 27 Aug 2014 10:13:53 +0800	[thread overview]
Message-ID: <1409105634-29980-7-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1409105634-29980-1-git-send-email-jingjing.wu@intel.com>

support to get the fdir_match counter
support to set the FDIR flag and FD_ID reported in mbuf
 
Signed-off-by: jingjing.wu <jingjing.wu@intel.com>
Reviewed-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Jing Chen <jing.d.chen@intel.com>
Reviewed-by: Jijiang Liu <jijiang.liu@intel.com>
 
---
 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 10797ba..89b7eb7 100644
--- a/lib/librte_pmd_i40e/i40e_ethdev.c
+++ b/lib/librte_pmd_i40e/i40e_ethdev.c
@@ -1273,6 +1273,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 */
 
@@ -1286,6 +1289,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);
@@ -1351,6 +1355,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 8bfbc8c..954385a 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -107,6 +107,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;
 }
 
@@ -623,7 +627,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++)
@@ -861,6 +880,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;
 	}
@@ -1014,6 +1047,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

  parent reply	other threads:[~2014-08-27  2:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27  2:13 [dpdk-dev] [PATCH v2 0/7] Support flow director programming on fortville Jingjing Wu
2014-08-27  2:13 ` [dpdk-dev] [PATCH v2 1/7] i40e: flow director resource reserve and initialize on i40e Jingjing Wu
2014-08-27 14:17   ` Thomas Monjalon
2014-08-28  2:56     ` Wu, Jingjing
2014-08-27  2:13 ` [dpdk-dev] [PATCH v2 2/7] ethdev: define new ethdev API rx_classification_filter_ctl Jingjing Wu
2014-08-27 14:22   ` Thomas Monjalon
2014-08-28  3:30     ` Wu, Jingjing
2014-08-28 10:55       ` Thomas Monjalon
2014-08-28 11:48         ` Ananyev, Konstantin
2014-08-28 14:07           ` Wu, Jingjing
2014-08-28 13:39         ` Wu, Jingjing
2014-08-28 14:20           ` Thomas Monjalon
2014-08-28 14:31             ` Wu, Jingjing
2014-08-27  2:13 ` [dpdk-dev] [PATCH v2 3/7] i40e: function implement in i40e for flow director filter programming Jingjing Wu
2014-08-27 14:24   ` Thomas Monjalon
2014-08-28  2:57     ` Wu, Jingjing
2014-08-27  2:13 ` [dpdk-dev] [PATCH v2 4/7] i40e: function implement in i40e for flow director flush and info get Jingjing Wu
2014-08-27  2:13 ` [dpdk-dev] [PATCH v2 5/7] fix the Marco conflict Jingjing Wu
2014-08-27 14:27   ` Thomas Monjalon
2014-08-28  3:39     ` Wu, Jingjing
2014-08-28  8:55       ` Thomas Monjalon
2014-08-28 14:37         ` Wu, Jingjing
2014-08-28 14:46           ` Thomas Monjalon
2014-08-27  2:13 ` Jingjing Wu [this message]
2014-08-27  2:13 ` [dpdk-dev] [PATCH v2 7/7]app/testpmd: add commands and config functions for i40e flow director support Jingjing Wu
2014-08-27 14:35   ` Thomas Monjalon
2014-08-27 16:54     ` Venkatesan, Venky
2014-08-28  3:51     ` Wu, Jingjing
2014-08-28  8:50       ` Thomas Monjalon
2014-08-28  9:01         ` Wu, Jingjing
2014-08-28 11:00           ` Thomas Monjalon
2014-08-28 11:30             ` Ananyev, Konstantin
2014-08-28 12:02               ` Thomas Monjalon
2014-09-24  4:52 ` [dpdk-dev] [PATCH v2 0/7] Support flow director programming on fortville Cao, Min

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409105634-29980-7-git-send-email-jingjing.wu@intel.com \
    --to=jingjing.wu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).