From: Konstantin Ananyev Date: Tue, 28 Jul 2015 11:39:22 +0000 (+0100) Subject: ixgbe: fix scalar scattered Rx with CRC X-Git-Tag: spdx-start~8600 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1b20b07d86872475ecca28af1a00ad9ad45c4c07;p=dpdk.git ixgbe: fix scalar scattered Rx with CRC 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 Acked-by: Wenzhuo Lu --- diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index a046bec261..76cb0ad314 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -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);