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 528EDC3D4 for ; Mon, 11 May 2015 05:47:16 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 10 May 2015 20:47:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,404,1427785200"; d="scan'208";a="723786230" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 10 May 2015 20:47:15 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t4B3lCFi001730; Mon, 11 May 2015 11:47:12 +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 t4B3l8GE004189; Mon, 11 May 2015 11:47:10 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t4B3l8cI004185; Mon, 11 May 2015 11:47:08 +0800 From: Jingjing Wu To: dev@dpdk.org Date: Mon, 11 May 2015 11:46:26 +0800 Message-Id: <1431315990-3067-3-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1431315990-3067-1-git-send-email-jingjing.wu@intel.com> References: <1431315990-3067-1-git-send-email-jingjing.wu@intel.com> Subject: [dpdk-dev] [PATCH 2/6] i40e: extend flow diretcor to support l2_payload flow type 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: Mon, 11 May 2015 03:47:16 -0000 This patch extends flow diretcor to support l2_payload flow type in i40e driver. Signed-off-by: Jingjing Wu --- lib/librte_pmd_i40e/i40e_fdir.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/librte_pmd_i40e/i40e_fdir.c b/lib/librte_pmd_i40e/i40e_fdir.c index 7b68c78..27c2102 100644 --- a/lib/librte_pmd_i40e/i40e_fdir.c +++ b/lib/librte_pmd_i40e/i40e_fdir.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -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