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

Function ena_xmit_mbuf

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

Source from the content-addressed store, hash-verified

3029}
3030
3031static int ena_xmit_mbuf(struct ena_ring *tx_ring, struct rte_mbuf *mbuf)
3032{
3033 struct ena_tx_buffer *tx_info;
3034 struct ena_com_tx_ctx ena_tx_ctx = { { 0 } };
3035 uint16_t next_to_use;
3036 uint16_t header_len;
3037 uint16_t req_id;
3038 void *push_header;
3039 int nb_hw_desc;
3040 int rc;
3041
3042 /* Checking for space for 2 additional metadata descriptors due to
3043 * possible header split and metadata descriptor
3044 */
3045 if (!ena_com_sq_have_enough_space(tx_ring->ena_com_io_sq,
3046 mbuf->nb_segs + 2)) {
3047 PMD_DRV_LOG(DEBUG, "Not enough space in the tx queue\n");
3048 return ENA_COM_NO_MEM;
3049 }
3050
3051 next_to_use = tx_ring->next_to_use;
3052
3053 req_id = tx_ring->empty_tx_reqs[next_to_use];
3054 tx_info = &tx_ring->tx_buffer_info[req_id];
3055 tx_info->num_of_bufs = 0;
3056 RTE_ASSERT(tx_info->mbuf == NULL);
3057
3058 ena_tx_map_mbuf(tx_ring, tx_info, mbuf, &push_header, &header_len);
3059
3060 ena_tx_ctx.ena_bufs = tx_info->bufs;
3061 ena_tx_ctx.push_header = push_header;
3062 ena_tx_ctx.num_bufs = tx_info->num_of_bufs;
3063 ena_tx_ctx.req_id = req_id;
3064 ena_tx_ctx.header_len = header_len;
3065
3066 /* Set Tx offloads flags, if applicable */
3067 ena_tx_mbuf_prepare(mbuf, &ena_tx_ctx, tx_ring->offloads,
3068 tx_ring->disable_meta_caching);
3069
3070 if (unlikely(ena_com_is_doorbell_needed(tx_ring->ena_com_io_sq,
3071 &ena_tx_ctx))) {
3072 PMD_TX_LOG(DEBUG,
3073 "LLQ Tx max burst size of queue %d achieved, writing doorbell to send burst\n",
3074 tx_ring->id);
3075 ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq);
3076 tx_ring->tx_stats.doorbells++;
3077 tx_ring->pkts_without_db = false;
3078 }
3079
3080 /* prepare the packet's descriptors to dma engine */
3081 rc = ena_com_prepare_tx(tx_ring->ena_com_io_sq, &ena_tx_ctx,
3082 &nb_hw_desc);
3083 if (unlikely(rc)) {
3084 PMD_DRV_LOG(ERR, "Failed to prepare Tx buffers, rc: %d\n", rc);
3085 ++tx_ring->tx_stats.prepare_ctx_err;
3086 ena_trigger_reset(tx_ring->adapter,
3087 ENA_REGS_RESET_DRIVER_INVALID_STATE);
3088 return rc;

Callers 1

eth_ena_xmit_pktsFunction · 0.85

Calls 7

ena_tx_map_mbufFunction · 0.85
ena_tx_mbuf_prepareFunction · 0.85
ena_trigger_resetFunction · 0.85
ena_com_prepare_txFunction · 0.50

Tested by

no test coverage detected