| 77 | } |
| 78 | |
| 79 | static __rte_always_inline int |
| 80 | ionic_tx_sg(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) |
| 81 | { |
| 82 | struct ionic_queue *q = &txq->qcq.q; |
| 83 | struct ionic_txq_desc *desc, *desc_base = q->base; |
| 84 | struct ionic_txq_sg_desc_v1 *sg_desc, *sg_desc_base = q->sg_base; |
| 85 | struct ionic_txq_sg_elem *elem; |
| 86 | struct ionic_tx_stats *stats = &txq->stats; |
| 87 | struct rte_mbuf *txm_seg; |
| 88 | rte_iova_t data_iova; |
| 89 | void **info; |
| 90 | uint64_t ol_flags = txm->ol_flags; |
| 91 | uint64_t addr, cmd; |
| 92 | uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE; |
| 93 | uint8_t flags = 0; |
| 94 | |
| 95 | desc = &desc_base[q->head_idx]; |
| 96 | sg_desc = &sg_desc_base[q->head_idx]; |
| 97 | info = IONIC_INFO_PTR(q, q->head_idx); |
| 98 | |
| 99 | if ((ol_flags & RTE_MBUF_F_TX_IP_CKSUM) && |
| 100 | (txq->flags & IONIC_QCQ_F_CSUM_L3)) { |
| 101 | opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW; |
| 102 | flags |= IONIC_TXQ_DESC_FLAG_CSUM_L3; |
| 103 | } |
| 104 | |
| 105 | if (((ol_flags & RTE_MBUF_F_TX_TCP_CKSUM) && |
| 106 | (txq->flags & IONIC_QCQ_F_CSUM_TCP)) || |
| 107 | ((ol_flags & RTE_MBUF_F_TX_UDP_CKSUM) && |
| 108 | (txq->flags & IONIC_QCQ_F_CSUM_UDP))) { |
| 109 | opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW; |
| 110 | flags |= IONIC_TXQ_DESC_FLAG_CSUM_L4; |
| 111 | } |
| 112 | |
| 113 | if (opcode == IONIC_TXQ_DESC_OPCODE_CSUM_NONE) |
| 114 | stats->no_csum++; |
| 115 | |
| 116 | if (((ol_flags & RTE_MBUF_F_TX_OUTER_IP_CKSUM) || |
| 117 | (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) && |
| 118 | ((ol_flags & RTE_MBUF_F_TX_OUTER_IPV4) || |
| 119 | (ol_flags & RTE_MBUF_F_TX_OUTER_IPV6))) { |
| 120 | flags |= IONIC_TXQ_DESC_FLAG_ENCAP; |
| 121 | } |
| 122 | |
| 123 | if (ol_flags & RTE_MBUF_F_TX_VLAN) { |
| 124 | flags |= IONIC_TXQ_DESC_FLAG_VLAN; |
| 125 | desc->vlan_tci = rte_cpu_to_le_16(txm->vlan_tci); |
| 126 | } |
| 127 | |
| 128 | addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm)); |
| 129 | |
| 130 | cmd = encode_txq_desc_cmd(opcode, flags, txm->nb_segs - 1, addr); |
| 131 | desc->cmd = rte_cpu_to_le_64(cmd); |
| 132 | desc->len = rte_cpu_to_le_16(txm->data_len); |
| 133 | |
| 134 | info[0] = txm; |
| 135 | |
| 136 | if (txm->nb_segs > 1) { |
no test coverage detected