Sweep the Rx 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. */
| 1382 | * They will be freed during ring free as a part of mem cleanup. |
| 1383 | */ |
| 1384 | int bnxt_flush_rx_cmp(struct bnxt_cp_ring_info *cpr) |
| 1385 | { |
| 1386 | struct bnxt_ring *cp_ring_struct = cpr->cp_ring_struct; |
| 1387 | uint32_t ring_mask = cp_ring_struct->ring_mask; |
| 1388 | uint32_t raw_cons = cpr->cp_raw_cons; |
| 1389 | struct rx_pkt_cmpl *rxcmp; |
| 1390 | uint32_t nb_rx = 0; |
| 1391 | uint32_t cons; |
| 1392 | |
| 1393 | do { |
| 1394 | cons = RING_CMP(cpr->cp_ring_struct, raw_cons); |
| 1395 | rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons]; |
| 1396 | |
| 1397 | if (!bnxt_cpr_cmp_valid(rxcmp, raw_cons, ring_mask + 1)) |
| 1398 | break; |
| 1399 | |
| 1400 | if (CMP_TYPE(rxcmp) == CMPL_BASE_TYPE_HWRM_DONE) |
| 1401 | return 1; |
| 1402 | |
| 1403 | raw_cons = NEXT_RAW_CMP(raw_cons); |
| 1404 | nb_rx++; |
| 1405 | } while (nb_rx < ring_mask); |
| 1406 | |
| 1407 | cpr->cp_raw_cons = raw_cons; |
| 1408 | |
| 1409 | /* Ring the completion queue doorbell. */ |
| 1410 | bnxt_db_cq(cpr); |
| 1411 | |
| 1412 | return 0; |
| 1413 | } |
no test coverage detected