ixgbe: fix scalar scattered Rx with CRC
authorKonstantin Ananyev <konstantin.ananyev@intel.com>
Tue, 28 Jul 2015 11:39:22 +0000 (12:39 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 30 Jul 2015 00:15:32 +0000 (02:15 +0200)
For 2.1 release, in attempt to minimize number of RX routines to support,
ixgbe scatter and ixgbe LRO RX routines were merged into one
that can handle both cases.
Though I completely missed the fact, that while LRO could only be used
when HW CRC strip is enabled, scatter RX should work for both cases
(HW CRC strip on/off).
That patch restores missed functionality.

Fixes: 9d8a92628f21 ("ixgbe: remove simple scalar scattered Rx method")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
drivers/net/ixgbe/ixgbe_rxtx.c

index a046bec..76cb0ad 100644 (file)
@@ -1829,6 +1829,25 @@ next_desc:
                ixgbe_fill_cluster_head_buf(first_seg, &rxd, rxq->port_id,
                                            staterr);
 
+               /*
+                * Deal with the case, when HW CRC srip is disabled.
+                * That can't happen when LRO is enabled, but still could
+                * happen for scattered RX mode.
+                */
+               first_seg->pkt_len -= rxq->crc_len;
+               if (unlikely(rxm->data_len <= rxq->crc_len)) {
+                       struct rte_mbuf *lp;
+
+                       for (lp = first_seg; lp->next != rxm; lp = lp->next)
+                               ;
+
+                       first_seg->nb_segs--;
+                       lp->data_len -= rxq->crc_len - rxm->data_len;
+                       lp->next = NULL;
+                       rte_pktmbuf_free_seg(rxm);
+               } else
+                       rxm->data_len -= rxq->crc_len;
+
                /* Prefetch data of first segment, if configured to do so. */
                rte_packet_prefetch((char *)first_seg->buf_addr +
                        first_seg->data_off);