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

Function bnxt_rx_descriptor_status_op

dpdk/drivers/net/bnxt/bnxt_ethdev.c:3238–3347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3236}
3237
3238static int
3239bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
3240{
3241 struct bnxt_rx_queue *rxq = rx_queue;
3242 struct bnxt_cp_ring_info *cpr;
3243 struct bnxt_rx_ring_info *rxr;
3244 uint32_t desc, raw_cons, cp_ring_size;
3245 struct bnxt *bp = rxq->bp;
3246 struct rx_pkt_cmpl *rxcmp;
3247 int rc;
3248
3249 rc = is_bnxt_in_error(bp);
3250 if (rc)
3251 return rc;
3252
3253 if (offset >= rxq->nb_rx_desc)
3254 return -EINVAL;
3255
3256 rxr = rxq->rx_ring;
3257 cpr = rxq->cp_ring;
3258 cp_ring_size = cpr->cp_ring_struct->ring_size;
3259
3260 /*
3261 * For the vector receive case, the completion at the requested
3262 * offset can be indexed directly.
3263 */
3264#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
3265 if (bp->flags & BNXT_FLAG_RX_VECTOR_PKT_MODE) {
3266 struct rx_pkt_cmpl *rxcmp;
3267 uint32_t cons;
3268
3269 /* Check status of completion descriptor. */
3270 raw_cons = cpr->cp_raw_cons +
3271 offset * CMP_LEN(CMPL_BASE_TYPE_RX_L2);
3272 cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
3273 rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons];
3274
3275 if (bnxt_cpr_cmp_valid(rxcmp, raw_cons, cp_ring_size))
3276 return RTE_ETH_RX_DESC_DONE;
3277
3278 /* Check whether rx desc has an mbuf attached. */
3279 cons = RING_CMP(rxr->rx_ring_struct, raw_cons / 2);
3280 if (cons >= rxq->rxrearm_start &&
3281 cons < rxq->rxrearm_start + rxq->rxrearm_nb) {
3282 return RTE_ETH_RX_DESC_UNAVAIL;
3283 }
3284
3285 return RTE_ETH_RX_DESC_AVAIL;
3286 }
3287#endif
3288
3289 /*
3290 * For the non-vector receive case, scan the completion ring to
3291 * locate the completion descriptor for the requested offset.
3292 */
3293 raw_cons = cpr->cp_raw_cons;
3294 desc = 0;
3295 while (1) {

Callers

nothing calls this directly

Calls 2

is_bnxt_in_errorFunction · 0.85
bnxt_cpr_cmp_validFunction · 0.85

Tested by

no test coverage detected