From 595d08d10506c5193062d37612fc5629435d2db5 Mon Sep 17 00:00:00 2001 From: Didier Pallard Date: Wed, 28 Mar 2018 17:43:48 +0200 Subject: [PATCH] net/vmxnet3: ignore empty segments in reception When several TCP fragments are contained in a packet that is only one mbuf segment long, vmxnet3 receives an empty segment following first one, that contains offload information. In current version, this segment is propagated as is to upper application. Remove those empty segments directly when receiving buffers, they may generate unneeded extra processing in the upper application. Signed-off-by: Didier Pallard Acked-by: Yong Wang --- drivers/net/vmxnet3/vmxnet3_rxtx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 02840fe033..60a33223a6 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -925,18 +925,23 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) } rxq->start_seg = rxm; + rxq->last_seg = rxm; vmxnet3_rx_offload(hw, rcd, rxm, 1); } else { struct rte_mbuf *start = rxq->start_seg; RTE_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY); - start->pkt_len += rxm->data_len; - start->nb_segs++; + if (rxm->data_len) { + start->pkt_len += rxm->data_len; + start->nb_segs++; - rxq->last_seg->next = rxm; + rxq->last_seg->next = rxm; + rxq->last_seg = rxm; + } else { + rte_pktmbuf_free_seg(rxm); + } } - rxq->last_seg = rxm; if (rcd->eop) { struct rte_mbuf *start = rxq->start_seg; -- 2.20.1