ip_frag: fix IPv6 fragment size calculation
[dpdk.git] / lib / librte_eventdev / rte_event_eth_rx_adapter.c
index 8b6e69d..a97d198 100644 (file)
@@ -611,32 +611,33 @@ rxa_calc_wrr_sequence(struct rte_event_eth_rx_adapter *rx_adapter,
 }
 
 static inline void
-rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr,
-       struct ipv6_hdr **ipv6_hdr)
+rxa_mtoip(struct rte_mbuf *m, struct rte_ipv4_hdr **ipv4_hdr,
+       struct rte_ipv6_hdr **ipv6_hdr)
 {
-       struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
-       struct vlan_hdr *vlan_hdr;
+       struct rte_ether_hdr *eth_hdr =
+               rte_pktmbuf_mtod(m, struct rte_ether_hdr *);
+       struct rte_vlan_hdr *vlan_hdr;
 
        *ipv4_hdr = NULL;
        *ipv6_hdr = NULL;
 
        switch (eth_hdr->ether_type) {
-       case RTE_BE16(ETHER_TYPE_IPv4):
-               *ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
+       case RTE_BE16(RTE_ETHER_TYPE_IPV4):
+               *ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
                break;
 
-       case RTE_BE16(ETHER_TYPE_IPv6):
-               *ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1);
+       case RTE_BE16(RTE_ETHER_TYPE_IPV6):
+               *ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1);
                break;
 
-       case RTE_BE16(ETHER_TYPE_VLAN):
-               vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1);
+       case RTE_BE16(RTE_ETHER_TYPE_VLAN):
+               vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1);
                switch (vlan_hdr->eth_proto) {
-               case RTE_BE16(ETHER_TYPE_IPv4):
-                       *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1);
+               case RTE_BE16(RTE_ETHER_TYPE_IPV4):
+                       *ipv4_hdr = (struct rte_ipv4_hdr *)(vlan_hdr + 1);
                        break;
-               case RTE_BE16(ETHER_TYPE_IPv6):
-                       *ipv6_hdr = (struct ipv6_hdr *)(vlan_hdr + 1);
+               case RTE_BE16(RTE_ETHER_TYPE_IPV6):
+                       *ipv6_hdr = (struct rte_ipv6_hdr *)(vlan_hdr + 1);
                        break;
                default:
                        break;
@@ -656,8 +657,8 @@ rxa_do_softrss(struct rte_mbuf *m, const uint8_t *rss_key_be)
        void *tuple;
        struct rte_ipv4_tuple ipv4_tuple;
        struct rte_ipv6_tuple ipv6_tuple;
-       struct ipv4_hdr *ipv4_hdr;
-       struct ipv6_hdr *ipv6_hdr;
+       struct rte_ipv4_hdr *ipv4_hdr;
+       struct rte_ipv6_hdr *ipv6_hdr;
 
        rxa_mtoip(m, &ipv4_hdr, &ipv6_hdr);
 
@@ -872,7 +873,7 @@ rxa_eth_rx(struct rte_event_eth_rx_adapter *rx_adapter,
                        break;
        }
 
-       if (buf->count >= BATCH_SIZE)
+       if (buf->count > 0)
                rxa_flush_event_buffer(rx_adapter);
 
        return nb_rx;