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

Function ena_tx_mbuf_prepare

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

Source from the content-addressed store, hash-verified

672}
673
674static inline void ena_tx_mbuf_prepare(struct rte_mbuf *mbuf,
675 struct ena_com_tx_ctx *ena_tx_ctx,
676 uint64_t queue_offloads,
677 bool disable_meta_caching)
678{
679 struct ena_com_tx_meta *ena_meta = &ena_tx_ctx->ena_meta;
680
681 if ((mbuf->ol_flags & MBUF_OFFLOADS) &&
682 (queue_offloads & QUEUE_OFFLOADS)) {
683 /* check if TSO is required */
684 if ((mbuf->ol_flags & RTE_MBUF_F_TX_TCP_SEG) &&
685 (queue_offloads & RTE_ETH_TX_OFFLOAD_TCP_TSO)) {
686 ena_tx_ctx->tso_enable = true;
687
688 ena_meta->l4_hdr_len = GET_L4_HDR_LEN(mbuf);
689 }
690
691 /* check if L3 checksum is needed */
692 if ((mbuf->ol_flags & RTE_MBUF_F_TX_IP_CKSUM) &&
693 (queue_offloads & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM))
694 ena_tx_ctx->l3_csum_enable = true;
695
696 if (mbuf->ol_flags & RTE_MBUF_F_TX_IPV6) {
697 ena_tx_ctx->l3_proto = ENA_ETH_IO_L3_PROTO_IPV6;
698 /* For the IPv6 packets, DF always needs to be true. */
699 ena_tx_ctx->df = 1;
700 } else {
701 ena_tx_ctx->l3_proto = ENA_ETH_IO_L3_PROTO_IPV4;
702
703 /* set don't fragment (DF) flag */
704 if (mbuf->packet_type &
705 (RTE_PTYPE_L4_NONFRAG
706 | RTE_PTYPE_INNER_L4_NONFRAG))
707 ena_tx_ctx->df = 1;
708 }
709
710 /* check if L4 checksum is needed */
711 if (((mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_TCP_CKSUM) &&
712 (queue_offloads & RTE_ETH_TX_OFFLOAD_TCP_CKSUM)) {
713 ena_tx_ctx->l4_proto = ENA_ETH_IO_L4_PROTO_TCP;
714 ena_tx_ctx->l4_csum_enable = true;
715 } else if (((mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
716 RTE_MBUF_F_TX_UDP_CKSUM) &&
717 (queue_offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM)) {
718 ena_tx_ctx->l4_proto = ENA_ETH_IO_L4_PROTO_UDP;
719 ena_tx_ctx->l4_csum_enable = true;
720 } else {
721 ena_tx_ctx->l4_proto = ENA_ETH_IO_L4_PROTO_UNKNOWN;
722 ena_tx_ctx->l4_csum_enable = false;
723 }
724
725 ena_meta->mss = mbuf->tso_segsz;
726 ena_meta->l3_hdr_len = mbuf->l3_len;
727 ena_meta->l3_hdr_offset = mbuf->l2_len;
728
729 ena_tx_ctx->meta_valid = true;
730 } else if (disable_meta_caching) {
731 memset(ena_meta, 0, sizeof(*ena_meta));

Callers 1

ena_xmit_mbufFunction · 0.85

Calls 1

memsetFunction · 0.85

Tested by

no test coverage detected