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 2/4] i40e: extend flow diretcor to support l2_payload flow type
Date: Tue, 16 Jun 2015 11:43:45 +0800	[thread overview]
Message-ID: <1434426227-5477-3-git-send-email-jingjing.wu@intel.com> (raw)
In-Reply-To: <1434426227-5477-1-git-send-email-jingjing.wu@intel.com>

This patch extends flow diretcor to support l2_payload flow
type in i40e driver.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_fdir.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 4bf98d0..8b81ca3 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -44,6 +44,7 @@
 #include <rte_log.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
+#include <rte_arp.h>
 #include <rte_ip.h>
 #include <rte_udp.h>
 #include <rte_tcp.h>
@@ -104,7 +105,8 @@
 	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_UDP) | \
 	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_TCP) | \
 	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) | \
-	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER))
+	(1 << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) | \
+	(1 << RTE_ETH_FLOW_L2_PAYLOAD))
 
 #define I40E_FLEX_WORD_MASK(off) (0x80 >> (off))
 
@@ -366,7 +368,9 @@ i40e_init_flx_pld(struct i40e_pf *pf)
 
 	/* initialize the masks */
 	for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
-	     pctype <= I40E_FILTER_PCTYPE_FRAG_IPV6; pctype++) {
+	     pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++) {
+		if (!I40E_VALID_PCTYPE((enum i40e_filter_pctype)pctype))
+			continue;
 		pf->fdir.flex_mask[pctype].word_mask = 0;
 		I40E_WRITE_REG(hw, I40E_PRTQF_FD_FLXINSET(pctype), 0);
 		for (i = 0; i < I40E_FDIR_BITMASK_NUM_WORD; i++) {
@@ -704,6 +708,9 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input,
 	};
 
 	switch (fdir_input->flow_type) {
+	case RTE_ETH_FLOW_L2_PAYLOAD:
+		ether->ether_type = fdir_input->flow.l2_flow.ether_type;
+		break;
 	case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
 	case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
 	case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP:
@@ -866,6 +873,17 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf,
 			  sizeof(struct ipv6_hdr);
 		set_idx = I40E_FLXPLD_L3_IDX;
 		break;
+	case RTE_ETH_FLOW_L2_PAYLOAD:
+		payload = raw_pkt + sizeof(struct ether_hdr);
+		/*
+		 * ARP packet is a special case on which the payload
+		 * starts after the whole ARP header
+		 */
+		if (fdir_input->flow.l2_flow.ether_type ==
+				rte_cpu_to_be_16(ETHER_TYPE_ARP))
+			payload += sizeof(struct arp_hdr);
+		set_idx = I40E_FLXPLD_L2_IDX;
+		break;
 	default:
 		PMD_DRV_LOG(ERR, "unknown flow type %u.", fdir_input->flow_type);
 		return -EINVAL;
@@ -1218,7 +1236,7 @@ i40e_fdir_info_get_flex_mask(struct i40e_pf *pf,
 	uint16_t off_bytes, mask_tmp;
 
 	for (i = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
-	     i <= I40E_FILTER_PCTYPE_FRAG_IPV6;
+	     i <= I40E_FILTER_PCTYPE_L2_PAYLOAD;
 	     i++) {
 		mask =  &pf->fdir.flex_mask[i];
 		if (!I40E_VALID_PCTYPE((enum i40e_filter_pctype)i))
-- 
1.9.3

  parent reply	other threads:[~2015-06-16  3:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11  3:46 [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 1/6] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 2/6] i40e: extend flow diretcor " Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 3/6] ethdev: extend struct to support flow director in VFs Jingjing Wu
2015-06-12 16:45   ` Thomas Monjalon
2015-06-15  7:14     ` Wu, Jingjing
2015-05-11  3:46 ` [dpdk-dev] [PATCH 4/6] i40e: extend flow diretcor to support filtering " Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 5/6] testpmd: extend commands Jingjing Wu
2015-05-11  3:46 ` [dpdk-dev] [PATCH 6/6] doc: extend commands in testpmd Jingjing Wu
2015-06-02  7:33 ` [dpdk-dev] [PATCH 0/6] extend flow director to support L2_paylod type and VF filtering in i40e driver Zhang, Helin
2015-06-16  3:43 ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Jingjing Wu
2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 1/4] ethdev: add struct rte_eth_l2_flow to support l2_payload flow type Jingjing Wu
2015-06-16  3:43   ` Jingjing Wu [this message]
2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 3/4] testpmd: extend commands Jingjing Wu
2015-06-16  3:43   ` [dpdk-dev] [PATCH v2 4/4] doc: extend commands in testpmd Jingjing Wu
2015-06-26  2:26   ` [dpdk-dev] [PATCH v2 0/4] extend flow director to support L2_paylod type Xu, HuilongX
2015-06-26  3:14   ` Zhang, Helin
2015-07-07 21:24     ` Thomas Monjalon

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=1434426227-5477-3-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).