net/vmxnet3: ignore empty segments in reception
authorDidier Pallard <didier.pallard@6wind.com>
Wed, 28 Mar 2018 15:43:48 +0000 (17:43 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 27 Apr 2018 16:34:41 +0000 (17:34 +0100)
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 <didier.pallard@6wind.com>
Acked-by: Yong Wang <yongwang@vmware.com>
drivers/net/vmxnet3/vmxnet3_rxtx.c

index 02840fe..60a3322 100644 (file)
@@ -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;