From: Alejandro Lucero Date: Wed, 26 Apr 2017 10:27:07 +0000 (+0100) Subject: net/nfp: fix releasing muti-segment mbufs X-Git-Tag: spdx-start~3341 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=aaef1010af2dc14ca2e3b5be554169a486127700;p=dpdk.git net/nfp: fix releasing muti-segment mbufs If segments are used, just mbufs previously linked to head descriptor of a mbuf chain are released. Other Tx descriptor are used for the mbuf chain but they keep their linked mbufs without releasing them. It is not a fatal issue because sooner or later those descriptors will be head descriptors or just used for a single mbuf packet, then those linked mbufs will be released. However, this leads to apps needing bigger mbufs pools and some confusion about memory requirements. Indeed, because larger pools, some performance impact could also be expected due to cache misses. With this patch all Tx descriptors will release linked mbufs inside the xmit function, and rte_pktmbuf_seg_free is used instead of rte_pktmbuf_free. Fixes: 142854c62134 ("nfp: fix freeing multi-mbuf packets") Cc: stable@dpdk.org Signed-off-by: Alejandro Lucero --- diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index eda87a59f5..5c5cba1973 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2096,18 +2096,20 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) */ pkt_size = pkt->pkt_len; - /* Releasing mbuf which was prefetched above */ - if (*lmbuf) - rte_pktmbuf_free(*lmbuf); - /* - * Linking mbuf with descriptor for being released - * next time descriptor is used - */ - *lmbuf = pkt; - while (pkt_size) { /* Copying TSO, VLAN and cksum info */ *txds = txd; + + /* Releasing mbuf used by this descriptor previously*/ + if (*lmbuf) + rte_pktmbuf_free_seg(*lmbuf); + + /* + * Linking mbuf with descriptor for being released + * next time descriptor is used + */ + *lmbuf = pkt; + dma_size = pkt->data_len; dma_addr = rte_mbuf_data_dma_addr(pkt); PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:" @@ -2135,6 +2137,7 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) } /* Referencing next free TX descriptor */ txds = &txq->txds[txq->wr_p]; + lmbuf = &txq->txbufs[txq->wr_p].mbuf; issued_descs++; } i++;