From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 444E45AA4 for ; Thu, 29 Jan 2015 04:16:47 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 28 Jan 2015 19:16:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,484,1418112000"; d="scan'208";a="658401128" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 28 Jan 2015 19:16:44 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t0T3Gf1U027105; Thu, 29 Jan 2015 11:16:41 +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 t0T3Gd3a012775; Thu, 29 Jan 2015 11:16:41 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t0T3Gd3q012771; Thu, 29 Jan 2015 11:16:39 +0800 From: Helin Zhang To: dev@dpdk.org Date: Thu, 29 Jan 2015 11:16:02 +0800 Message-Id: <1422501365-12643-15-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1422501365-12643-1-git-send-email-helin.zhang@intel.com> References: <1421637666-16872-1-git-send-email-helin.zhang@intel.com> <1422501365-12643-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH 14/17] examples/l3fwd-acl: support of unified packet 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: Thu, 29 Jan 2015 03:16:48 -0000 To unify packet types among all PMDs, bit masks and relevant macros of packet type for ol_flags are replaced by unified packet type and relevant macros. Signed-off-by: Helin Zhang --- examples/l3fwd-acl/main.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index f1f7601..af70ccd 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -651,9 +651,7 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, struct ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = pkts_in[index]; - int type = pkt->ol_flags & (PKT_RX_IPV4_HDR | PKT_RX_IPV6_HDR); - - if (type == PKT_RX_IPV4_HDR) { + if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, unsigned char *) + sizeof(struct ether_hdr)); @@ -674,8 +672,7 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, rte_pktmbuf_free(pkt); } - } else if (type == PKT_RX_IPV6_HDR) { - + } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { /* Fill acl structure */ acl->data_ipv6[acl->num_ipv6] = MBUF_IPV6_2PROTO(pkt); acl->m_ipv6[(acl->num_ipv6)++] = pkt; @@ -693,17 +690,13 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, { struct rte_mbuf *pkt = pkts_in[index]; - int type = pkt->ol_flags & (PKT_RX_IPV4_HDR | PKT_RX_IPV6_HDR); - - if (type == PKT_RX_IPV4_HDR) { - + if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { /* Fill acl structure */ acl->data_ipv4[acl->num_ipv4] = MBUF_IPV4_2PROTO(pkt); acl->m_ipv4[(acl->num_ipv4)++] = pkt; - } else if (type == PKT_RX_IPV6_HDR) { - + } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { /* Fill acl structure */ acl->data_ipv6[acl->num_ipv6] = MBUF_IPV6_2PROTO(pkt); acl->m_ipv6[(acl->num_ipv6)++] = pkt; @@ -751,9 +744,9 @@ send_one_packet(struct rte_mbuf *m, uint32_t res) /* in the ACL list, drop it */ #ifdef L3FWDACL_DEBUG if ((res & ACL_DENY_SIGNATURE) != 0) { - if (m->ol_flags & PKT_RX_IPV4_HDR) + if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) dump_acl4_rule(m, res); - else + else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) dump_acl6_rule(m, res); } #endif -- 1.8.1.4