@@ -174,9 +174,7 @@ pkt_burst_5tuple_swap(struct fwd_stream *fs)
inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_rx)) {
fs->fwd_dropped += (nb_rx - nb_tx);
- do {
- rte_pktmbuf_free(pkts_burst[nb_tx]);
- } while (++nb_tx < nb_rx);
+ rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx);
}
return true;
@@ -1195,9 +1195,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_prep)) {
fs->fwd_dropped += (nb_prep - nb_tx);
- do {
- rte_pktmbuf_free(tx_pkts_burst[nb_tx]);
- } while (++nb_tx < nb_prep);
+ rte_pktmbuf_free_bulk(&tx_pkts_burst[nb_tx], nb_prep - nb_tx);
}
return true;
@@ -75,7 +75,6 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
uint16_t nb_dropped;
uint16_t nb_pkt;
uint16_t nb_clones = nb_pkt_flowgen_clones;
- uint16_t i;
uint32_t retry;
uint64_t tx_offloads;
int next_flow = RTE_PER_LCORE(_next_flow);
@@ -86,8 +85,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
inc_rx_burst_stats(fs, nb_rx);
fs->rx_packets += nb_rx;
- for (i = 0; i < nb_rx; i++)
- rte_pktmbuf_free(pkts_burst[i]);
+ rte_pktmbuf_free_bulk(pkts_burst, nb_rx);
mbp = current_fwd_lcore()->mbp;
vlan_tci = ports[fs->tx_port].tx_vlan_id;
@@ -186,9 +184,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
next_flow += nb_flows_flowgen;
fs->fwd_dropped += nb_dropped;
- do {
- rte_pktmbuf_free(pkts_burst[nb_tx]);
- } while (++nb_tx < nb_pkt);
+ rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_pkt - nb_tx);
}
RTE_PER_LCORE(_next_flow) = next_flow;
@@ -500,9 +500,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs)
inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_replies)) {
fs->fwd_dropped += (nb_replies - nb_tx);
- do {
- rte_pktmbuf_free(pkts_burst[nb_tx]);
- } while (++nb_tx < nb_replies);
+ rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_replies - nb_tx);
}
}
@@ -76,9 +76,7 @@ pkt_burst_io_forward(struct fwd_stream *fs)
inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_rx)) {
fs->fwd_dropped += (nb_rx - nb_tx);
- do {
- rte_pktmbuf_free(pkts_burst[nb_tx]);
- } while (++nb_tx < nb_rx);
+ rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx);
}
return true;
@@ -107,9 +107,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_rx)) {
fs->fwd_dropped += (nb_rx - nb_tx);
- do {
- rte_pktmbuf_free(pkts_burst[nb_tx]);
- } while (++nb_tx < nb_rx);
+ rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx);
}
return true;
@@ -86,9 +86,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_rx)) {
fs->fwd_dropped += (nb_rx - nb_tx);
- do {
- rte_pktmbuf_free(pkts_burst[nb_tx]);
- } while (++nb_tx < nb_rx);
+ rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_rx - nb_tx);
}
return true;
@@ -111,11 +111,8 @@ do_retry(uint16_t nb_rx, uint16_t nb_tx, struct rte_mbuf **pkts,
static uint32_t
drop_pkts(struct rte_mbuf **pkts, uint16_t nb_rx, uint16_t nb_tx)
{
- if (nb_tx < nb_rx) {
- do {
- rte_pktmbuf_free(pkts[nb_tx]);
- } while (++nb_tx < nb_rx);
- }
+ if (nb_tx < nb_rx)
+ rte_pktmbuf_free_bulk(&pkts[nb_tx], nb_rx - nb_tx);
return nb_rx - nb_tx;
}
@@ -46,7 +46,6 @@ pkt_burst_receive(struct fwd_stream *fs)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
uint16_t nb_rx;
- uint16_t i;
/*
* Receive a burst of packets.
@@ -58,8 +57,7 @@ pkt_burst_receive(struct fwd_stream *fs)
return false;
fs->rx_packets += nb_rx;
- for (i = 0; i < nb_rx; i++)
- rte_pktmbuf_free(pkts_burst[i]);
+ rte_pktmbuf_free_bulk(pkts_burst, nb_rx);
return true;
}
@@ -53,8 +53,7 @@ forward_sub_burst(struct fwd_stream *src_fs, uint16_t port, uint16_t nb_rx,
} else {
/* Source stream not found, drop all packets. */
src_fs->fwd_dropped += nb_rx;
- while (nb_rx > 0)
- rte_pktmbuf_free(pkts[--nb_rx]);
+ rte_pktmbuf_free_bulk(pkts, nb_rx);
}
}
@@ -2196,7 +2196,6 @@ flush_fwd_rx_queues(void)
portid_t port_id;
queueid_t rxq;
uint16_t nb_rx;
- uint16_t i;
uint8_t j;
uint64_t prev_tsc = 0, diff_tsc, cur_tsc, timer_tsc = 0;
uint64_t timer_period;
@@ -2229,8 +2228,7 @@ flush_fwd_rx_queues(void)
do {
nb_rx = rte_eth_rx_burst(port_id, rxq,
pkts_burst, MAX_PKT_BURST);
- for (i = 0; i < nb_rx; i++)
- rte_pktmbuf_free(pkts_burst[i]);
+ rte_pktmbuf_free_bulk(pkts_burst, nb_rx);
cur_tsc = rte_rdtsc();
diff_tsc = cur_tsc - prev_tsc;
@@ -418,9 +418,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
(unsigned) nb_pkt, (unsigned) nb_tx,
(unsigned) (nb_pkt - nb_tx));
fs->fwd_dropped += (nb_pkt - nb_tx);
- do {
- rte_pktmbuf_free(pkts_burst[nb_tx]);
- } while (++nb_tx < nb_pkt);
+ rte_pktmbuf_free_bulk(&pkts_burst[nb_tx], nb_pkt - nb_tx);
}
return true;