| 137 | } |
| 138 | |
| 139 | static inline void |
| 140 | handle_tx_completion_pkts(struct cn9k_eth_txq *txq, uint8_t mt_safe) |
| 141 | { |
| 142 | #define CNXK_NIX_CQ_ENTRY_SZ 128 |
| 143 | #define CQE_SZ(x) ((x) * CNXK_NIX_CQ_ENTRY_SZ) |
| 144 | |
| 145 | uint16_t tx_pkts = 0, nb_pkts; |
| 146 | const uintptr_t desc = txq->tx_compl.desc_base; |
| 147 | const uint64_t wdata = txq->tx_compl.wdata; |
| 148 | const uint32_t qmask = txq->tx_compl.qmask; |
| 149 | uint32_t head = txq->tx_compl.head; |
| 150 | struct nix_cqe_hdr_s *tx_compl_cq; |
| 151 | struct nix_send_comp_s *tx_compl_s0; |
| 152 | struct rte_mbuf *m_next, *m; |
| 153 | |
| 154 | if (mt_safe) |
| 155 | rte_spinlock_lock(&txq->tx_compl.ext_buf_lock); |
| 156 | |
| 157 | nb_pkts = nix_tx_compl_nb_pkts(txq, wdata, qmask); |
| 158 | while (tx_pkts < nb_pkts) { |
| 159 | rte_prefetch_non_temporal((void *)(desc + |
| 160 | (CQE_SZ((head + 2) & qmask)))); |
| 161 | tx_compl_cq = (struct nix_cqe_hdr_s *) |
| 162 | (desc + CQE_SZ(head)); |
| 163 | tx_compl_s0 = (struct nix_send_comp_s *) |
| 164 | ((uint64_t *)tx_compl_cq + 1); |
| 165 | m = txq->tx_compl.ptr[tx_compl_s0->sqe_id]; |
| 166 | while (m->next != NULL) { |
| 167 | m_next = m->next; |
| 168 | rte_pktmbuf_free_seg(m); |
| 169 | m = m_next; |
| 170 | } |
| 171 | rte_pktmbuf_free_seg(m); |
| 172 | txq->tx_compl.ptr[tx_compl_s0->sqe_id] = NULL; |
| 173 | |
| 174 | head++; |
| 175 | head &= qmask; |
| 176 | tx_pkts++; |
| 177 | } |
| 178 | txq->tx_compl.head = head; |
| 179 | txq->tx_compl.available -= nb_pkts; |
| 180 | |
| 181 | plt_write64((wdata | nb_pkts), txq->tx_compl.cq_door); |
| 182 | |
| 183 | if (mt_safe) |
| 184 | rte_spinlock_unlock(&txq->tx_compl.ext_buf_lock); |
| 185 | } |
| 186 | |
| 187 | |
| 188 | #endif /* __CN9K_ETHDEV_H__ */ |
nothing calls this directly
no test coverage detected