From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v2 8/9] examples/l3fwd: add parse-ptype option Date: Fri, 30 Dec 2016 14:39:53 +0800 Message-ID: <20161230063953.GK21789@yliu-dev.sh.intel.com> References: <1482996643-113253-1-git-send-email-jianfeng.tan@intel.com> <1482996643-113253-9-git-send-email-jianfeng.tan@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, stephen@networkplumber.org To: Jianfeng Tan Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 428022B9C for ; Fri, 30 Dec 2016 07:38:13 +0100 (CET) Content-Disposition: inline In-Reply-To: <1482996643-113253-9-git-send-email-jianfeng.tan@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Dec 29, 2016 at 07:30:42AM +0000, Jianfeng Tan wrote: > To support those devices that do not provide packet type info when > receiving packets, add a new option, --parse-ptype, to analyze > packet type in the Rx callback. I think this would be needed for all PMD drivers don't have the PTYPE support. For these, --parse-ptype looks like a mandatory option in the l3fwd example. I didn't find such option given in your test guide though, which is weird. Mistake? Besides that, is there a way to query whether a PMD supports PTYPE or not? If not, we should add a software one by our own. This could be done without introducing yet another option. > > Signed-off-by: Jianfeng Tan > --- > examples/l3fwd-power/main.c | 60 ++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 59 insertions(+), 1 deletion(-) > > diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c > index b65d683..44843ec 100644 > --- a/examples/l3fwd-power/main.c > +++ b/examples/l3fwd-power/main.c > @@ -164,6 +164,8 @@ static uint32_t enabled_port_mask = 0; > static int promiscuous_on = 0; > /* NUMA is enabled by default. */ > static int numa_on = 1; > +static int parse_ptype; /**< Parse packet type using rx callback, and */ > + /**< disabled by default */ > > enum freq_scale_hint_t > { > @@ -607,6 +609,48 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint8_t portid, > #endif > > static inline void > +parse_ptype_one(struct rte_mbuf *m) > +{ > + struct ether_hdr *eth_hdr; > + uint32_t packet_type = RTE_PTYPE_UNKNOWN; > + uint16_t ether_type; > + > + eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); > + ether_type = eth_hdr->ether_type; > + if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) > + packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; > + else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) > + packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; BTW, we have rte_net_get_ptype(). Looks like a better option? --yliu