[PATCH v5 8/8] net/gve: add support for Rx/Tx
Ferruh Yigit
ferruh.yigit at amd.com
Wed Oct 19 15:47:08 CEST 2022
On 10/10/2022 11:17 AM, Junfeng Guo wrote:
>
> Add Rx/Tx of GQI_QPL queue format and GQI_RDA queue format.
>
> Signed-off-by: Xiaoyun Li <xiaoyun.li at intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo at intel.com>
<...>
> +uint16_t
> +gve_rx_burst(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
> +{
> + volatile struct gve_rx_desc *rxr, *rxd;
> + struct gve_rx_queue *rxq = rx_queue;
> + uint16_t rx_id = rxq->rx_tail;
> + struct rte_mbuf *rxe;
> + uint16_t nb_rx, len;
> + uint64_t addr;
> +
> + rxr = rxq->rx_desc_ring;
> +
> + for (nb_rx = 0; nb_rx < nb_pkts; nb_rx++) {
> + rxd = &rxr[rx_id];
> + if (GVE_SEQNO(rxd->flags_seq) != rxq->expected_seqno)
> + break;
> +
> + if (rxd->flags_seq & GVE_RXF_ERR)
> + continue;
> +
I think above code wrong.
Function returns 'nb_rx', if you continue on error 'nb_rx' kept
increased, so application will receive wrong number of packets.
Also packets assigned as "rx_pkts[nb_rx] = rxe;", this will cause gaps
in the arrays.
You can either break on the error, or keep another variable to store
number of received packets.
> + len = rte_be_to_cpu_16(rxd->len) - GVE_RX_PAD;
> + rxe = rxq->sw_ring[rx_id];
> + rxe->data_off = RTE_PKTMBUF_HEADROOM;
As far as I can see mbufs allocated using 'rte_pktmbuf_alloc()', if so
no need to explicitly set the 'm->data_off'.
More information about the dev
mailing list