X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fhns3%2Fhns3_rxtx_vec.h;h=67c75e44ef00c2aca964e456df8ac080997fde1c;hb=7c0a233eef4f458a35cfc2105208f1772be62c9b;hp=c6df36d0177fbe552ce06109c242eeaba9197937;hpb=a3d4f4d291d79e2801397055067d903ef5e4d4aa;p=dpdk.git diff --git a/drivers/net/hns3/hns3_rxtx_vec.h b/drivers/net/hns3/hns3_rxtx_vec.h index c6df36d017..67c75e44ef 100644 --- a/drivers/net/hns3/hns3_rxtx_vec.h +++ b/drivers/net/hns3/hns3_rxtx_vec.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2020 Hisilicon Limited. + * Copyright(c) 2020-2021 HiSilicon Limited. */ #ifndef _HNS3_RXTX_VEC_H_ @@ -9,26 +9,14 @@ #include "hns3_ethdev.h" static inline void -hns3_tx_free_buffers(struct hns3_tx_queue *txq) +hns3_tx_bulk_free_buffers(struct hns3_tx_queue *txq) { struct rte_mbuf **free = txq->free; struct hns3_entry *tx_entry; - struct hns3_desc *tx_desc; struct rte_mbuf *m; int nb_free = 0; int i; - /* - * All mbufs can be released only when the VLD bits of all - * descriptors in a batch are cleared. - */ - tx_desc = &txq->tx_ring[txq->next_to_clean]; - for (i = 0; i < txq->tx_rs_thresh; i++, tx_desc++) { - if (tx_desc->tx.tp_fe_sc_vld_ra_ri & - rte_le_to_cpu_16(BIT(HNS3_TXD_VLD_B))) - return; - } - tx_entry = &txq->sw_ring[txq->next_to_clean]; for (i = 0; i < txq->tx_rs_thresh; i++, tx_entry++) { m = rte_pktmbuf_prefree_seg(tx_entry->mbuf); @@ -55,6 +43,26 @@ hns3_tx_free_buffers(struct hns3_tx_queue *txq) txq->next_to_clean = 0; } +static inline void +hns3_tx_free_buffers(struct hns3_tx_queue *txq) +{ + struct hns3_desc *tx_desc; + int i; + + /* + * All mbufs can be released only when the VLD bits of all + * descriptors in a batch are cleared. + */ + tx_desc = &txq->tx_ring[txq->next_to_clean]; + for (i = 0; i < txq->tx_rs_thresh; i++, tx_desc++) { + if (tx_desc->tx.tp_fe_sc_vld_ra_ri & + rte_le_to_cpu_16(BIT(HNS3_TXD_VLD_B))) + return; + } + + hns3_tx_bulk_free_buffers(txq); +} + static inline uint16_t hns3_rx_reassemble_pkts(struct rte_mbuf **rx_pkts, uint16_t nb_pkts, @@ -63,6 +71,9 @@ hns3_rx_reassemble_pkts(struct rte_mbuf **rx_pkts, uint16_t count, i; uint64_t mask; + if (likely(pkt_err_mask == 0)) + return nb_pkts; + count = 0; for (i = 0; i < nb_pkts; i++) { mask = ((uint64_t)1u) << i;