net/ice: fix scalar Rx path segment

CRC is stripped by the hardware in the scattered Rx path. The last buffer
is invalid if it's packet length is zero.

This patch adds a judgment for the last buffer length to fix this issue,
it would free the mbuf associated to the last one if the last buffer is
empty.

Fixes: 6eac0b7fde ("net/ice: support advance Rx/Tx")
Cc: stable@dpdk.org

Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
Mingjin Ye 2022-11-11 12:04:00 +00:00 committed by Qi Zhang
parent b125c0e721
commit 90ba444205

View File

@ -2113,6 +2113,10 @@ ice_recv_scattered_pkts(void *rx_queue,
} else
rxm->data_len = (uint16_t)(rx_packet_len -
RTE_ETHER_CRC_LEN);
} else if (rx_packet_len == 0) {
rte_pktmbuf_free_seg(rxm);
first_seg->nb_segs--;
last_seg->next = NULL;
}
first_seg->port = rxq->port_id;