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

Function ena_tx_map_mbuf

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

Source from the content-addressed store, hash-verified

2956}
2957
2958static void ena_tx_map_mbuf(struct ena_ring *tx_ring,
2959 struct ena_tx_buffer *tx_info,
2960 struct rte_mbuf *mbuf,
2961 void **push_header,
2962 uint16_t *header_len)
2963{
2964 struct ena_com_buf *ena_buf;
2965 uint16_t delta, seg_len, push_len;
2966
2967 delta = 0;
2968 seg_len = mbuf->data_len;
2969
2970 tx_info->mbuf = mbuf;
2971 ena_buf = tx_info->bufs;
2972
2973 if (tx_ring->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
2974 /*
2975 * Tx header might be (and will be in most cases) smaller than
2976 * tx_max_header_size. But it's not an issue to send more data
2977 * to the device, than actually needed if the mbuf size is
2978 * greater than tx_max_header_size.
2979 */
2980 push_len = RTE_MIN(mbuf->pkt_len, tx_ring->tx_max_header_size);
2981 *header_len = push_len;
2982
2983 if (likely(push_len <= seg_len)) {
2984 /* If the push header is in the single segment, then
2985 * just point it to the 1st mbuf data.
2986 */
2987 *push_header = rte_pktmbuf_mtod(mbuf, uint8_t *);
2988 } else {
2989 /* If the push header lays in the several segments, copy
2990 * it to the intermediate buffer.
2991 */
2992 rte_pktmbuf_read(mbuf, 0, push_len,
2993 tx_ring->push_buf_intermediate_buf);
2994 *push_header = tx_ring->push_buf_intermediate_buf;
2995 delta = push_len - seg_len;
2996 }
2997 } else {
2998 *push_header = NULL;
2999 *header_len = 0;
3000 push_len = 0;
3001 }
3002
3003 /* Process first segment taking into consideration pushed header */
3004 if (seg_len > push_len) {
3005 ena_buf->paddr = mbuf->buf_iova +
3006 mbuf->data_off +
3007 push_len;
3008 ena_buf->len = seg_len - push_len;
3009 ena_buf++;
3010 tx_info->num_of_bufs++;
3011 }
3012
3013 while ((mbuf = mbuf->next) != NULL) {
3014 seg_len = mbuf->data_len;
3015

Callers 1

ena_xmit_mbufFunction · 0.85

Calls 1

rte_pktmbuf_readFunction · 0.85

Tested by

no test coverage detected