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 <helin.zhang at intel.com>
---
 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 e851768..5df2e83 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -648,9 +648,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));
@@ -671,8 +669,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;
@@ -690,17 +687,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;
@@ -748,9 +741,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

Reply via email to