ring: return free space when enqueuing
[dpdk.git] / examples / performance-thread / l3fwd-thread / main.c
index 6845e28..b4c0df1 100644 (file)
@@ -909,7 +909,7 @@ static inline uint8_t
 get_ipv6_dst_port(void *ipv6_hdr,  uint8_t portid,
                lookup6_struct_t *ipv6_l3fwd_lookup_struct)
 {
-       uint8_t next_hop;
+       uint32_t next_hop;
 
        return (uint8_t) ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct,
                        ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ?
@@ -1396,15 +1396,14 @@ rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype)
 static inline __attribute__((always_inline)) uint16_t
 get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint8_t portid)
 {
-       uint32_t next_hop_ipv4;
-       uint8_t next_hop_ipv6;
+       uint32_t next_hop;
        struct ipv6_hdr *ipv6_hdr;
        struct ether_hdr *eth_hdr;
 
        if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) {
                return (uint16_t) ((rte_lpm_lookup(
                                RTE_PER_LCORE(lcore_conf)->ipv4_lookup_struct, dst_ipv4,
-                               &next_hop_ipv4) == 0) ? next_hop_ipv4 : portid);
+                               &next_hop) == 0) ? next_hop : portid);
 
        } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) {
 
@@ -1413,8 +1412,8 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint8_t portid)
 
                return (uint16_t) ((rte_lpm6_lookup(
                                RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct,
-                               ipv6_hdr->dst_addr, &next_hop_ipv6) == 0) ? next_hop_ipv6 :
-                                               portid);
+                               ipv6_hdr->dst_addr, &next_hop) == 0) ?
+                               next_hop : portid);
 
        }
 
@@ -2214,7 +2213,7 @@ lthread_rx(void *dummy)
                                ret = rte_ring_sp_enqueue_burst(
                                                rx_conf->ring[worker_id],
                                                (void **) pkts_burst,
-                                               nb_rx);
+                                               nb_rx, NULL);
 
                                new_len = old_len + ret;
 
@@ -2454,7 +2453,7 @@ pthread_rx(void *dummy)
                        SET_CPU_BUSY(rx_conf, CPU_PROCESS);
                        worker_id = (worker_id + 1) % rx_conf->n_ring;
                        n = rte_ring_sp_enqueue_burst(rx_conf->ring[worker_id],
-                                       (void **)pkts_burst, nb_rx);
+                                       (void **)pkts_burst, nb_rx, NULL);
 
                        if (unlikely(n != nb_rx)) {
                                uint32_t k;