From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 0B6439A81 for ; Mon, 9 Feb 2015 07:41:23 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 08 Feb 2015 22:41:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,542,1418112000"; d="scan'208";a="674956839" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 08 Feb 2015 22:41:21 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t196fJFU018738; Mon, 9 Feb 2015 14:41:19 +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 t196fHrC013577; Mon, 9 Feb 2015 14:41:19 +0800 Received: (from hzhan75@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t196fH10013573; Mon, 9 Feb 2015 14:41:17 +0800 From: Helin Zhang To: dev@dpdk.org Date: Mon, 9 Feb 2015 14:40:46 +0800 Message-Id: <1423464049-13457-13-git-send-email-helin.zhang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1423464049-13457-1-git-send-email-helin.zhang@intel.com> References: <1422501365-12643-1-git-send-email-helin.zhang@intel.com> <1423464049-13457-1-git-send-email-helin.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 12/15] 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: Mon, 09 Feb 2015 06:41:24 -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(-) v2 changes: * Used redefined packet types and enlarged packet_type field in mbuf. 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.9.3