Lines Matching refs:cpr

900 				       struct bnxt_cp_ring_info *cpr,
907 &cpr->cp_desc_ring[CP_RING(cp_cons)][CP_IDX(cp_cons)];
920 static void bnxt_reuse_rx_agg_bufs(struct bnxt_cp_ring_info *cpr, u16 idx,
923 struct bnxt_napi *bnapi = cpr->bnapi;
944 agg = bnxt_get_agg(bp, cpr, idx, start + i);
1086 struct bnxt_cp_ring_info *cpr,
1091 struct bnxt_napi *bnapi = cpr->bnapi;
1112 agg = bnxt_get_agg(bp, cpr, idx, i);
1142 bnxt_reuse_rx_agg_bufs(cpr, idx, i, agg_bufs - i, tpa);
1157 struct bnxt_cp_ring_info *cpr,
1164 total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo, idx,
1179 struct bnxt_cp_ring_info *cpr,
1189 total_frag_len = __bnxt_rx_agg_pages(bp, cpr, shinfo,
1199 static int bnxt_agg_bufs_valid(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
1208 &cpr->cp_desc_ring[CP_RING(last)][CP_IDX(last)];
1237 static int bnxt_discard_rx(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
1260 if (!bnxt_agg_bufs_valid(bp, cpr, agg_bufs, &tmp_raw_cons))
1376 static void bnxt_abort_tpa(struct bnxt_cp_ring_info *cpr, u16 idx, u32 agg_bufs)
1379 bnxt_reuse_rx_agg_bufs(cpr, idx, 0, agg_bufs, true);
1590 struct bnxt_cp_ring_info *cpr,
1596 struct bnxt_napi *bnapi = cpr->bnapi;
1608 int rc = bnxt_discard_rx(bp, cpr, raw_cons, tpa_end);
1636 if (!bnxt_agg_bufs_valid(bp, cpr, agg_bufs, raw_cons))
1651 bnxt_abort_tpa(cpr, idx, agg_bufs);
1661 bnxt_abort_tpa(cpr, idx, agg_bufs);
1662 cpr->sw_stats.rx.rx_oom_discards += 1;
1671 bnxt_abort_tpa(cpr, idx, agg_bufs);
1672 cpr->sw_stats.rx.rx_oom_discards += 1;
1687 bnxt_abort_tpa(cpr, idx, agg_bufs);
1688 cpr->sw_stats.rx.rx_oom_discards += 1;
1696 skb = bnxt_rx_agg_pages_skb(bp, cpr, skb, idx, agg_bufs, true);
1699 cpr->sw_stats.rx.rx_oom_discards += 1;
1785 static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
1788 struct bnxt_napi *bnapi = cpr->bnapi;
1808 &cpr->cp_desc_ring[CP_RING(cp_cons)][CP_IDX(cp_cons)];
1820 &cpr->cp_desc_ring[CP_RING(cp_cons)][CP_IDX(cp_cons)];
1839 skb = bnxt_tpa_end(bp, cpr, &tmp_raw_cons,
1857 int rc1 = bnxt_discard_rx(bp, cpr, &tmp_raw_cons, rxcmp);
1877 if (!bnxt_agg_bufs_valid(bp, cpr, agg_bufs, &tmp_raw_cons))
1891 bnxt_reuse_rx_agg_bufs(cpr, cp_cons, 0, agg_bufs,
1914 u32 frag_len = bnxt_rx_agg_pages_xdp(bp, cpr, &xdp,
1918 cpr->sw_stats.rx.rx_oom_discards += 1;
1939 bnxt_reuse_rx_agg_bufs(cpr, cp_cons, 0,
1944 cpr->sw_stats.rx.rx_oom_discards += 1;
1958 cpr->sw_stats.rx.rx_oom_discards += 1;
1966 skb = bnxt_rx_agg_pages_skb(bp, cpr, skb, cp_cons, agg_bufs, false);
1968 cpr->sw_stats.rx.rx_oom_discards += 1;
1977 cpr->sw_stats.rx.rx_oom_discards += 1;
2046 cpr->rx_packets += 1;
2047 cpr->rx_bytes += len;
2063 struct bnxt_cp_ring_info *cpr,
2075 &cpr->cp_desc_ring[CP_RING(cp_cons)][CP_IDX(cp_cons)];
2080 &cpr->cp_desc_ring[CP_RING(cp_cons)][CP_IDX(cp_cons)];
2100 rc = bnxt_rx_pkt(bp, cpr, raw_cons, event);
2102 cpr->sw_stats.rx.rx_netpoll_discards += 1;
2449 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
2450 u32 cons = RING_CMP(cpr->cp_raw_cons);
2452 cpr->event_ctr++;
2453 prefetch(&cpr->cp_desc_ring[CP_RING(cons)][CP_IDX(cons)]);
2458 static inline int bnxt_has_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
2460 u32 raw_cons = cpr->cp_raw_cons;
2464 txcmp = &cpr->cp_desc_ring[CP_RING(cons)][CP_IDX(cons)];
2473 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
2474 u32 cons = RING_CMP(cpr->cp_raw_cons);
2477 prefetch(&cpr->cp_desc_ring[CP_RING(cons)][CP_IDX(cons)]);
2479 if (!bnxt_has_work(bp, cpr)) {
2482 if (!(int_status & (0x10000 << cpr->cp_ring_struct.fw_ring_id)))
2487 BNXT_CP_DB_IRQ_DIS(cpr->cp_db.doorbell);
2497 static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
2500 struct bnxt_napi *bnapi = cpr->bnapi;
2501 u32 raw_cons = cpr->cp_raw_cons;
2508 cpr->has_more_work = 0;
2509 cpr->had_work_done = 1;
2514 txcmp = &cpr->cp_desc_ring[CP_RING(cons)][CP_IDX(cons)];
2530 cpr->has_more_work = 1;
2535 rc = bnxt_rx_pkt(bp, cpr, &raw_cons, &event);
2537 rc = bnxt_force_rx_discard(bp, cpr, &raw_cons,
2561 cpr->has_more_work = 1;
2579 cpr->cp_raw_cons = raw_cons;
2604 static int bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
2607 struct bnxt_napi *bnapi = cpr->bnapi;
2610 rx_pkts = __bnxt_poll_work(bp, cpr, budget);
2616 bnxt_db_cq(bp, &cpr->cp_db, cpr->cp_raw_cons);
2626 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
2631 u32 raw_cons = cpr->cp_raw_cons;
2640 txcmp = &cpr->cp_desc_ring[CP_RING(cp_cons)][CP_IDX(cp_cons)];
2653 &cpr->cp_desc_ring[CP_RING(cp_cons)][CP_IDX(cp_cons)];
2662 rc = bnxt_rx_pkt(bp, cpr, &raw_cons, &event);
2682 cpr->cp_raw_cons = raw_cons;
2683 BNXT_DB_CQ(&cpr->cp_db, cpr->cp_raw_cons);
2691 if (!bnxt_has_work(bp, cpr) && rx_pkts < budget) {
2693 BNXT_DB_CQ_ARM(&cpr->cp_db, cpr->cp_raw_cons);
2702 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
2710 work_done += bnxt_poll_work(bp, cpr, budget - work_done);
2714 BNXT_DB_CQ_ARM(&cpr->cp_db, cpr->cp_raw_cons);
2718 if (!bnxt_has_work(bp, cpr)) {
2720 BNXT_DB_CQ_ARM(&cpr->cp_db, cpr->cp_raw_cons);
2727 dim_update_sample(cpr->event_ctr,
2728 cpr->rx_packets,
2729 cpr->rx_bytes,
2731 net_dim(&cpr->dim, dim_sample);
2738 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
2742 struct bnxt_cp_ring_info *cpr2 = cpr->cp_ring_arr[i];
2747 cpr->has_more_work |= cpr2->has_more_work;
2756 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
2760 struct bnxt_cp_ring_info *cpr2 = cpr->cp_ring_arr[i];
2776 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
2778 u32 raw_cons = cpr->cp_raw_cons;
2788 if (cpr->has_more_work) {
2789 cpr->has_more_work = 0;
2794 nqcmp = &cpr->nq_desc_ring[CP_RING(cons)][CP_IDX(cons)];
2797 if (cpr->has_more_work)
2802 cpr->cp_raw_cons = raw_cons;
2804 BNXT_DB_NQ_ARM_P5(&cpr->cp_db,
2805 cpr->cp_raw_cons);
2822 cpr2 = cpr->cp_ring_arr[idx];
2825 cpr->has_more_work |= cpr2->has_more_work;
2832 if (raw_cons != cpr->cp_raw_cons) {
2833 cpr->cp_raw_cons = raw_cons;
2834 BNXT_DB_NQ_P5(&cpr->cp_db, raw_cons);
2837 cpr_rx = cpr->cp_ring_arr[BNXT_RX_HDL];
2841 dim_update_sample(cpr->event_ctr,
2845 net_dim(&cpr->dim, dim_sample);
3373 static void bnxt_free_cp_arrays(struct bnxt_cp_ring_info *cpr)
3375 struct bnxt_ring_struct *ring = &cpr->cp_ring_struct;
3377 kfree(cpr->cp_desc_ring);
3378 cpr->cp_desc_ring = NULL;
3380 kfree(cpr->cp_desc_mapping);
3381 cpr->cp_desc_mapping = NULL;
3385 static int bnxt_alloc_cp_arrays(struct bnxt_cp_ring_info *cpr, int n)
3387 cpr->cp_desc_ring = kcalloc(n, sizeof(*cpr->cp_desc_ring), GFP_KERNEL);
3388 if (!cpr->cp_desc_ring)
3390 cpr->cp_desc_mapping = kcalloc(n, sizeof(*cpr->cp_desc_mapping),
3392 if (!cpr->cp_desc_mapping)
3438 struct bnxt_cp_ring_info *cpr;
3445 cpr = &bnapi->cp_ring;
3446 ring = &cpr->cp_ring_struct;
3451 struct bnxt_cp_ring_info *cpr2 = cpr->cp_ring_arr[j];
3458 cpr->cp_ring_arr[j] = NULL;
3468 struct bnxt_cp_ring_info *cpr;
3471 cpr = kzalloc(sizeof(*cpr), GFP_KERNEL);
3472 if (!cpr)
3475 rc = bnxt_alloc_cp_arrays(cpr, bp->cp_nr_pages);
3477 bnxt_free_cp_arrays(cpr);
3478 kfree(cpr);
3481 ring = &cpr->cp_ring_struct;
3485 rmem->pg_arr = (void **)cpr->cp_desc_ring;
3486 rmem->dma_arr = cpr->cp_desc_mapping;
3491 bnxt_free_cp_arrays(cpr);
3492 kfree(cpr);
3493 cpr = NULL;
3495 return cpr;
3507 struct bnxt_cp_ring_info *cpr;
3513 cpr = &bnapi->cp_ring;
3514 cpr->bnapi = bnapi;
3515 ring = &cpr->cp_ring_struct;
3533 cpr->cp_ring_arr[BNXT_RX_HDL] = cpr2;
3543 cpr->cp_ring_arr[BNXT_TX_HDL] = cpr2;
3559 struct bnxt_cp_ring_info *cpr;
3567 cpr = &bnapi->cp_ring;
3568 ring = &cpr->cp_ring_struct;
3572 rmem->pg_arr = (void **)cpr->cp_desc_ring;
3573 rmem->dma_arr = cpr->cp_desc_mapping;
3725 struct bnxt_cp_ring_info *cpr = &bp->bnapi[i]->cp_ring;
3726 struct bnxt_ring_struct *ring = &cpr->cp_ring_struct;
3729 cpr->rx_ring_coal.coal_ticks = bp->rx_coal.coal_ticks;
3730 cpr->rx_ring_coal.coal_bufs = bp->rx_coal.coal_bufs;
3732 struct bnxt_cp_ring_info *cpr2 = cpr->cp_ring_arr[j];
4252 struct bnxt_cp_ring_info *cpr;
4260 cpr = &bnapi->cp_ring;
4261 stats = &cpr->stats;
4339 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
4341 bnxt_free_stats_mem(bp, &cpr->stats);
4354 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
4356 cpr->stats.len = size;
4357 rc = bnxt_alloc_stats_mem(bp, &cpr->stats, !i);
4361 cpr->hw_stats_ctx_id = INVALID_STATS_CTX_ID;
4417 struct bnxt_cp_ring_info *cpr;
4424 cpr = &bnapi->cp_ring;
4425 cpr->cp_raw_cons = 0;
4544 struct bnxt_cp_ring_info *cpr =
4547 cpr->cp_ring_struct.ring_mem.flags =
4659 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
4660 struct bnxt_ring_struct *ring = &cpr->cp_ring_struct;
4663 bnxt_db_nq(bp, &cpr->cp_db, cpr->cp_raw_cons);
4670 struct bnxt_cp_ring_info *cpr;
4672 cpr = &bnapi->cp_ring;
4673 return cpr->cp_ring_struct.map_idx;
4700 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
4702 bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons);
5156 struct bnxt_cp_ring_info *cpr;
5158 cpr = bnapi->cp_ring.cp_ring_arr[BNXT_RX_HDL];
5159 return cpr->cp_ring_struct.fw_ring_id;
5169 struct bnxt_cp_ring_info *cpr;
5171 cpr = bnapi->cp_ring.cp_ring_arr[BNXT_TX_HDL];
5172 return cpr->cp_ring_struct.fw_ring_id;
5903 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
5904 struct bnxt_ring_struct *ring = &cpr->cp_ring_struct;
5915 bnxt_set_db(bp, &cpr->cp_db, type, map_idx, ring->fw_ring_id);
5916 bnxt_db_nq(bp, &cpr->cp_db, cpr->cp_raw_cons);
5935 struct bnxt_cp_ring_info *cpr, *cpr2;
5938 cpr = &bnapi->cp_ring;
5939 cpr2 = cpr->cp_ring_arr[BNXT_TX_HDL];
5974 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
5978 cpr2 = cpr->cp_ring_arr[BNXT_RX_HDL];
6121 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
6126 struct bnxt_cp_ring_info *cpr2 = cpr->cp_ring_arr[j];
6138 ring = &cpr->cp_ring_struct;
6751 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
6764 req->ring_id = cpu_to_le16(cpr->cp_ring_struct.fw_ring_id);
6778 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
6787 coal.coal_ticks = cpr->rx_ring_coal.coal_ticks;
6788 coal.coal_bufs = cpr->rx_ring_coal.coal_bufs;
6889 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
6891 if (cpr->hw_stats_ctx_id != INVALID_STATS_CTX_ID) {
6892 req->stat_ctx_id = cpu_to_le32(cpr->hw_stats_ctx_id);
6899 cpr->hw_stats_ctx_id = INVALID_STATS_CTX_ID;
6926 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
6928 req->stats_dma_addr = cpu_to_le64(cpr->stats.hw_stats_map);
6934 cpr->hw_stats_ctx_id = le32_to_cpu(resp->stat_ctx_id);
6936 bp->grp_info[i].fw_stats_ctx = cpr->hw_stats_ctx_id;
8357 struct bnxt_cp_ring_info *cpr;
8360 cpr = &bnapi->cp_ring;
8361 stats = &cpr->stats;
9417 struct bnxt_cp_ring_info *cpr;
9419 cpr = &bnapi->cp_ring;
9421 cpr->sw_stats.tx.tx_resets++;
9423 cpr->sw_stats.rx.rx_resets++;
9426 cancel_work_sync(&cpr->dim.work);
9437 struct bnxt_cp_ring_info *cpr;
9441 cpr = &bnapi->cp_ring;
9447 INIT_WORK(&cpr->dim.work, bnxt_dim_work);
9448 cpr->dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE;
10875 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
10876 u64 *sw = cpr->stats.sw_stats;
10902 cpr->sw_stats.rx.rx_netpoll_discards +
10903 cpr->sw_stats.rx.rx_oom_discards;
10968 struct bnxt_cp_ring_info *cpr)
10970 struct bnxt_sw_stats *sw_stats = &cpr->sw_stats;
10971 u64 *hw_stats = cpr->stats.sw_stats;
11581 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
11585 i, cpr->cp_ring_struct.fw_ring_id, cpr->cp_raw_cons);
11608 struct bnxt_cp_ring_info *cpr;
11616 cpr = &bnapi->cp_ring;
11617 cp_ring_id = cpr->cp_ring_struct.fw_ring_id;
11774 struct bnxt_cp_ring_info *cpr;
11797 cpr = &rxr->bnapi->cp_ring;
11798 cpr->sw_stats.rx.rx_resets++;
11984 struct bnxt_cp_ring_info *cpr;
11991 cpr = &bnapi->cp_ring;
11993 struct bnxt_cp_ring_info *cpr2 = cpr->cp_ring_arr[j];
12008 cpr->sw_stats.cmn.missed_irqs++;