MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ena_rx_mbuf

Function ena_rx_mbuf

dpdk/drivers/net/ena/ena_ethdev.c:2593–2685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2591}
2592
2593static struct rte_mbuf *ena_rx_mbuf(struct ena_ring *rx_ring,
2594 struct ena_com_rx_buf_info *ena_bufs,
2595 uint32_t descs,
2596 uint16_t *next_to_clean,
2597 uint8_t offset)
2598{
2599 struct rte_mbuf *mbuf;
2600 struct rte_mbuf *mbuf_head;
2601 struct ena_rx_buffer *rx_info;
2602 int rc;
2603 uint16_t ntc, len, req_id, buf = 0;
2604
2605 if (unlikely(descs == 0))
2606 return NULL;
2607
2608 ntc = *next_to_clean;
2609
2610 len = ena_bufs[buf].len;
2611 req_id = ena_bufs[buf].req_id;
2612
2613 rx_info = &rx_ring->rx_buffer_info[req_id];
2614
2615 mbuf = rx_info->mbuf;
2616 RTE_ASSERT(mbuf != NULL);
2617
2618 ena_init_rx_mbuf(mbuf, len);
2619
2620 /* Fill the mbuf head with the data specific for 1st segment. */
2621 mbuf_head = mbuf;
2622 mbuf_head->nb_segs = descs;
2623 mbuf_head->port = rx_ring->port_id;
2624 mbuf_head->pkt_len = len;
2625 mbuf_head->data_off += offset;
2626
2627 rx_info->mbuf = NULL;
2628 rx_ring->empty_rx_reqs[ntc] = req_id;
2629 ntc = ENA_IDX_NEXT_MASKED(ntc, rx_ring->size_mask);
2630
2631 while (--descs) {
2632 ++buf;
2633 len = ena_bufs[buf].len;
2634 req_id = ena_bufs[buf].req_id;
2635
2636 rx_info = &rx_ring->rx_buffer_info[req_id];
2637 RTE_ASSERT(rx_info->mbuf != NULL);
2638
2639 if (unlikely(len == 0)) {
2640 /*
2641 * Some devices can pass descriptor with the length 0.
2642 * To avoid confusion, the PMD is simply putting the
2643 * descriptor back, as it was never used. We'll avoid
2644 * mbuf allocation that way.
2645 */
2646 rc = ena_add_single_rx_desc(rx_ring->ena_com_io_sq,
2647 rx_info->mbuf, req_id);
2648 if (unlikely(rc != 0)) {
2649 /* Free the mbuf in case of an error. */
2650 rte_mbuf_raw_free(rx_info->mbuf);

Callers 1

eth_ena_recv_pktsFunction · 0.85

Calls 3

ena_init_rx_mbufFunction · 0.85
ena_add_single_rx_descFunction · 0.85
rte_mbuf_raw_freeFunction · 0.85

Tested by

no test coverage detected