Sweep the Tx completion queue till HWRM_DONE for ring flush is received. * The mbufs will not be freed in this call. * They will be freed during ring free as a part of mem cleanup. */
| 670 | * They will be freed during ring free as a part of mem cleanup. |
| 671 | */ |
| 672 | int bnxt_flush_tx_cmp(struct bnxt_cp_ring_info *cpr) |
| 673 | { |
| 674 | uint32_t raw_cons = cpr->cp_raw_cons; |
| 675 | uint32_t cons; |
| 676 | uint32_t nb_tx_pkts = 0; |
| 677 | struct tx_cmpl *txcmp; |
| 678 | struct cmpl_base *cp_desc_ring = cpr->cp_desc_ring; |
| 679 | struct bnxt_ring *cp_ring_struct = cpr->cp_ring_struct; |
| 680 | uint32_t ring_mask = cp_ring_struct->ring_mask; |
| 681 | uint32_t opaque = 0; |
| 682 | |
| 683 | do { |
| 684 | cons = RING_CMPL(ring_mask, raw_cons); |
| 685 | txcmp = (struct tx_cmpl *)&cp_desc_ring[cons]; |
| 686 | |
| 687 | if (!bnxt_cpr_cmp_valid(txcmp, raw_cons, ring_mask + 1)) |
| 688 | break; |
| 689 | |
| 690 | opaque = rte_cpu_to_le_32(txcmp->opaque); |
| 691 | raw_cons = NEXT_RAW_CMP(raw_cons); |
| 692 | |
| 693 | if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2) |
| 694 | nb_tx_pkts += opaque; |
| 695 | else if (CMP_TYPE(txcmp) == HWRM_CMPL_TYPE_HWRM_DONE) |
| 696 | return 1; |
| 697 | } while (nb_tx_pkts < ring_mask); |
| 698 | |
| 699 | if (nb_tx_pkts) { |
| 700 | cpr->cp_raw_cons = raw_cons; |
| 701 | bnxt_db_cq(cpr); |
| 702 | } |
| 703 | |
| 704 | return 0; |
| 705 | } |
no test coverage detected