From: James Hershaw <james.hers...@corigine.com> Remove usage of the rte_panic() function from the nfp PMD.
As the ASSERT(x) macro was only used twice in the PMD, it is better remove it altogether and rework the code where it was used as it is a very small change to make. Signed-off-by: James Hershaw <james.hers...@corigine.com> Reviewed-by: Niklas Söderlund <niklas.soderl...@corigine.com> Reviewed-by: Chaoyong He <chaoyong...@corigine.com> --- drivers/net/nfp/flower/nfp_flower.c | 8 +++----- drivers/net/nfp/nfp_logs.h | 2 -- drivers/net/nfp/nfp_rxtx.c | 7 ++----- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index e0e94e0a36..f1424a010d 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -491,7 +491,7 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - int i = 0; + int i; int pkt_size; int dma_size; uint64_t dma_addr; @@ -522,7 +522,7 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, issued_descs = 0; /* Sending packets */ - while ((i < nb_pkts) && free_descs) { + for (i = 0; i < nb_pkts && free_descs > 0; i++) { /* Grabbing the mbuf linked to the current descriptor */ lmbuf = &txq->txbufs[txq->wr_p].mbuf; /* Warming the cache for releasing the mbuf later on */ @@ -561,7 +561,7 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, */ pkt_size = pkt->pkt_len; - while (pkt != NULL) { + while (pkt != NULL && free_descs > 0) { /* Copying TSO, VLAN and cksum info */ *txds = txd; @@ -583,7 +583,6 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, txds->data_len = txd.data_len; txds->dma_addr_hi = (dma_addr >> 32) & 0xff; txds->dma_addr_lo = (dma_addr & 0xffffffff); - ASSERT(free_descs > 0); free_descs--; txq->wr_p++; @@ -607,7 +606,6 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, lmbuf = &txq->txbufs[txq->wr_p].mbuf; issued_descs++; } - i++; } xmit_end: diff --git a/drivers/net/nfp/nfp_logs.h b/drivers/net/nfp/nfp_logs.h index 5da384e53f..b7632ee72c 100644 --- a/drivers/net/nfp/nfp_logs.h +++ b/drivers/net/nfp/nfp_logs.h @@ -24,10 +24,8 @@ extern int nfp_logtype_init; #ifdef RTE_ETHDEV_DEBUG_TX #define PMD_TX_LOG(level, fmt, args...) \ RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args) -#define ASSERT(x) if (!(x)) rte_panic("NFP_NET: x") #else #define PMD_TX_LOG(level, fmt, args...) do { } while (0) -#define ASSERT(x) do { } while (0) #endif extern int nfp_logtype_cpp; diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 5f23128ac9..a5907cc428 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -968,12 +968,11 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk pkt = *tx_pkts; - i = 0; issued_descs = 0; PMD_TX_LOG(DEBUG, "queue: %u. Sending %u packets", txq->qidx, nb_pkts); /* Sending packets */ - while ((i < nb_pkts) && free_descs) { + for (i = 0; i < nb_pkts && free_descs > 0; i++) { memset(&meta_data, 0, sizeof(meta_data)); /* Grabbing the mbuf linked to the current descriptor */ lmbuf = &txq->txbufs[txq->wr_p].mbuf; @@ -1010,7 +1009,7 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk */ pkt_size = pkt->pkt_len; - while (pkt) { + while (pkt != NULL && free_descs > 0) { /* Copying TSO, VLAN and cksum info */ *txds = txd; @@ -1034,7 +1033,6 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk txds->data_len = txd.data_len; txds->dma_addr_hi = (dma_addr >> 32) & 0xff; txds->dma_addr_lo = (dma_addr & 0xffffffff); - ASSERT(free_descs > 0); free_descs--; txq->wr_p++; @@ -1061,7 +1059,6 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk lmbuf = &txq->txbufs[txq->wr_p].mbuf; issued_descs++; } - i++; } xmit_end: -- 2.29.3