Lines Matching refs:tx_ring

11 nfp_nfdk_tx_ring_reset(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring)  in nfp_nfdk_tx_ring_reset()  argument
16 while (!tx_ring->is_xdp && tx_ring->rd_p != tx_ring->wr_p) { in nfp_nfdk_tx_ring_reset()
23 rd_idx = D_IDX(tx_ring, tx_ring->rd_p); in nfp_nfdk_tx_ring_reset()
24 txbuf = &tx_ring->ktxbufs[rd_idx]; in nfp_nfdk_tx_ring_reset()
28 n_descs = D_BLOCK_CPL(tx_ring->rd_p); in nfp_nfdk_tx_ring_reset()
57 tx_ring->rd_p += n_descs; in nfp_nfdk_tx_ring_reset()
60 memset(tx_ring->txds, 0, tx_ring->size); in nfp_nfdk_tx_ring_reset()
61 tx_ring->data_pending = 0; in nfp_nfdk_tx_ring_reset()
62 tx_ring->wr_p = 0; in nfp_nfdk_tx_ring_reset()
63 tx_ring->rd_p = 0; in nfp_nfdk_tx_ring_reset()
64 tx_ring->qcp_rd_p = 0; in nfp_nfdk_tx_ring_reset()
65 tx_ring->wr_ptr_add = 0; in nfp_nfdk_tx_ring_reset()
67 if (tx_ring->is_xdp || !dp->netdev) in nfp_nfdk_tx_ring_reset()
70 nd_q = netdev_get_tx_queue(dp->netdev, tx_ring->idx); in nfp_nfdk_tx_ring_reset()
74 static void nfp_nfdk_tx_ring_free(struct nfp_net_tx_ring *tx_ring) in nfp_nfdk_tx_ring_free() argument
76 struct nfp_net_r_vector *r_vec = tx_ring->r_vec; in nfp_nfdk_tx_ring_free()
79 kvfree(tx_ring->ktxbufs); in nfp_nfdk_tx_ring_free()
81 if (tx_ring->ktxds) in nfp_nfdk_tx_ring_free()
82 dma_free_coherent(dp->dev, tx_ring->size, in nfp_nfdk_tx_ring_free()
83 tx_ring->ktxds, tx_ring->dma); in nfp_nfdk_tx_ring_free()
85 tx_ring->cnt = 0; in nfp_nfdk_tx_ring_free()
86 tx_ring->txbufs = NULL; in nfp_nfdk_tx_ring_free()
87 tx_ring->txds = NULL; in nfp_nfdk_tx_ring_free()
88 tx_ring->dma = 0; in nfp_nfdk_tx_ring_free()
89 tx_ring->size = 0; in nfp_nfdk_tx_ring_free()
93 nfp_nfdk_tx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring) in nfp_nfdk_tx_ring_alloc() argument
95 struct nfp_net_r_vector *r_vec = tx_ring->r_vec; in nfp_nfdk_tx_ring_alloc()
97 tx_ring->cnt = dp->txd_cnt * NFDK_TX_DESC_PER_SIMPLE_PKT; in nfp_nfdk_tx_ring_alloc()
98 tx_ring->size = array_size(tx_ring->cnt, sizeof(*tx_ring->ktxds)); in nfp_nfdk_tx_ring_alloc()
99 tx_ring->ktxds = dma_alloc_coherent(dp->dev, tx_ring->size, in nfp_nfdk_tx_ring_alloc()
100 &tx_ring->dma, in nfp_nfdk_tx_ring_alloc()
102 if (!tx_ring->ktxds) { in nfp_nfdk_tx_ring_alloc()
104 tx_ring->cnt); in nfp_nfdk_tx_ring_alloc()
108 tx_ring->ktxbufs = kvcalloc(tx_ring->cnt, sizeof(*tx_ring->ktxbufs), in nfp_nfdk_tx_ring_alloc()
110 if (!tx_ring->ktxbufs) in nfp_nfdk_tx_ring_alloc()
113 if (!tx_ring->is_xdp && dp->netdev) in nfp_nfdk_tx_ring_alloc()
115 tx_ring->idx); in nfp_nfdk_tx_ring_alloc()
120 nfp_nfdk_tx_ring_free(tx_ring); in nfp_nfdk_tx_ring_alloc()
126 struct nfp_net_tx_ring *tx_ring) in nfp_nfdk_tx_ring_bufs_free() argument
132 struct nfp_net_tx_ring *tx_ring) in nfp_nfdk_tx_ring_bufs_alloc() argument
140 struct nfp_net_tx_ring *tx_ring, in nfp_nfdk_print_tx_descs() argument
144 u32 txd_cnt = tx_ring->cnt; in nfp_nfdk_print_tx_descs()
148 txd = &tx_ring->ktxds[i]; in nfp_nfdk_print_tx_descs()
151 txd->vals[0], txd->vals[1], tx_ring->ktxbufs[i].raw); in nfp_nfdk_print_tx_descs()
153 if (i == tx_ring->rd_p % txd_cnt) in nfp_nfdk_print_tx_descs()
155 if (i == tx_ring->wr_p % txd_cnt) in nfp_nfdk_print_tx_descs()