From mboxrd@z Thu Jan 1 00:00:00 1970 From: Helin Zhang Subject: [PATCH v5 15/18] examples/l3fwd-acl: replace bit mask based packet type with unified packet type Date: Fri, 22 May 2015 16:44:21 +0800 Message-ID: <1432284264-17376-16-git-send-email-helin.zhang@intel.com> References: <1425042696-23162-1-git-send-email-helin.zhang@intel.com> <1432284264-17376-1-git-send-email-helin.zhang@intel.com> To: dev@dpdk.org Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 8EF0AC31A for ; Fri, 22 May 2015 10:45:10 +0200 (CEST) In-Reply-To: <1432284264-17376-1-git-send-email-helin.zhang@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" To unify packet types among all PMDs, bit masks of packet type for 'ol_flags' are replaced by unified packet type. 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. v5 changes: * Re-worded the commit logs. diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index a5d4f25..681b675 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -645,9 +645,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)); @@ -668,8 +666,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; @@ -687,17 +684,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; @@ -745,9 +738,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