Lines Matching refs:rx
79 static void sparx5_fdma_rx_add_dcb(struct sparx5_rx *rx, in sparx5_fdma_rx_add_dcb() argument
93 rx->last_entry->nextptr = nextptr; in sparx5_fdma_rx_add_dcb()
94 rx->last_entry = dcb; in sparx5_fdma_rx_add_dcb()
113 static void sparx5_fdma_rx_activate(struct sparx5 *sparx5, struct sparx5_rx *rx) in sparx5_fdma_rx_activate() argument
116 spx5_wr(((u64)rx->dma) & GENMASK(31, 0), sparx5, in sparx5_fdma_rx_activate()
117 FDMA_DCB_LLP(rx->channel_id)); in sparx5_fdma_rx_activate()
118 spx5_wr(((u64)rx->dma) >> 32, sparx5, FDMA_DCB_LLP1(rx->channel_id)); in sparx5_fdma_rx_activate()
124 sparx5, FDMA_CH_CFG(rx->channel_id)); in sparx5_fdma_rx_activate()
136 spx5_rmw(BIT(rx->channel_id), in sparx5_fdma_rx_activate()
137 BIT(rx->channel_id) & FDMA_INTR_DB_ENA_INTR_DB_ENA, in sparx5_fdma_rx_activate()
141 spx5_wr(BIT(rx->channel_id), sparx5, FDMA_CH_ACTIVATE); in sparx5_fdma_rx_activate()
144 static void sparx5_fdma_rx_deactivate(struct sparx5 *sparx5, struct sparx5_rx *rx) in sparx5_fdma_rx_deactivate() argument
147 spx5_rmw(0, BIT(rx->channel_id) & FDMA_CH_ACTIVATE_CH_ACTIVATE, in sparx5_fdma_rx_deactivate()
151 spx5_rmw(0, BIT(rx->channel_id) & FDMA_INTR_DB_ENA_INTR_DB_ENA, in sparx5_fdma_rx_deactivate()
187 static void sparx5_fdma_rx_reload(struct sparx5 *sparx5, struct sparx5_rx *rx) in sparx5_fdma_rx_reload() argument
190 spx5_wr(BIT(rx->channel_id), sparx5, FDMA_CH_RELOAD); in sparx5_fdma_rx_reload()
199 static struct sk_buff *sparx5_fdma_rx_alloc_skb(struct sparx5_rx *rx) in sparx5_fdma_rx_alloc_skb() argument
201 return __netdev_alloc_skb(rx->ndev, FDMA_XTR_BUFFER_SIZE, in sparx5_fdma_rx_alloc_skb()
205 static bool sparx5_fdma_rx_get_frame(struct sparx5 *sparx5, struct sparx5_rx *rx) in sparx5_fdma_rx_get_frame() argument
216 db_hw = &rx->dcb_entries[rx->dcb_index].db[rx->db_index]; in sparx5_fdma_rx_get_frame()
219 skb = rx->skb[rx->dcb_index][rx->db_index]; in sparx5_fdma_rx_get_frame()
221 new_skb = sparx5_fdma_rx_alloc_skb(rx); in sparx5_fdma_rx_get_frame()
226 rx->skb[rx->dcb_index][rx->db_index] = new_skb; in sparx5_fdma_rx_get_frame()
251 rx->packets++; in sparx5_fdma_rx_get_frame()
258 struct sparx5_rx *rx = container_of(napi, struct sparx5_rx, napi); in sparx5_fdma_napi_callback() local
259 struct sparx5 *sparx5 = container_of(rx, struct sparx5, rx); in sparx5_fdma_napi_callback()
262 while (counter < weight && sparx5_fdma_rx_get_frame(sparx5, rx)) { in sparx5_fdma_napi_callback()
265 rx->db_index++; in sparx5_fdma_napi_callback()
268 if (rx->db_index != FDMA_RX_DCB_MAX_DBS) in sparx5_fdma_napi_callback()
273 rx->db_index = 0; in sparx5_fdma_napi_callback()
274 old_dcb = &rx->dcb_entries[rx->dcb_index]; in sparx5_fdma_napi_callback()
275 rx->dcb_index++; in sparx5_fdma_napi_callback()
276 rx->dcb_index &= FDMA_DCB_MAX - 1; in sparx5_fdma_napi_callback()
277 sparx5_fdma_rx_add_dcb(rx, old_dcb, in sparx5_fdma_napi_callback()
278 rx->dma + in sparx5_fdma_napi_callback()
280 (unsigned long)rx->dcb_entries)); in sparx5_fdma_napi_callback()
283 napi_complete_done(&rx->napi, counter); in sparx5_fdma_napi_callback()
284 spx5_rmw(BIT(rx->channel_id), in sparx5_fdma_napi_callback()
285 BIT(rx->channel_id) & FDMA_INTR_DB_ENA_INTR_DB_ENA, in sparx5_fdma_napi_callback()
289 sparx5_fdma_rx_reload(sparx5, rx); in sparx5_fdma_napi_callback()
344 struct sparx5_rx *rx = &sparx5->rx; in sparx5_fdma_rx_alloc() local
351 rx->dcb_entries = devm_kzalloc(sparx5->dev, size, GFP_KERNEL); in sparx5_fdma_rx_alloc()
352 if (!rx->dcb_entries) in sparx5_fdma_rx_alloc()
354 rx->dma = virt_to_phys(rx->dcb_entries); in sparx5_fdma_rx_alloc()
355 rx->last_entry = rx->dcb_entries; in sparx5_fdma_rx_alloc()
356 rx->db_index = 0; in sparx5_fdma_rx_alloc()
357 rx->dcb_index = 0; in sparx5_fdma_rx_alloc()
360 dcb = &rx->dcb_entries[idx]; in sparx5_fdma_rx_alloc()
371 skb = sparx5_fdma_rx_alloc_skb(rx); in sparx5_fdma_rx_alloc()
378 rx->skb[idx][jdx] = skb; in sparx5_fdma_rx_alloc()
380 sparx5_fdma_rx_add_dcb(rx, dcb, rx->dma + sizeof(*dcb) * idx); in sparx5_fdma_rx_alloc()
382 netif_napi_add(rx->ndev, &rx->napi, sparx5_fdma_napi_callback, FDMA_WEIGHT); in sparx5_fdma_rx_alloc()
383 napi_enable(&rx->napi); in sparx5_fdma_rx_alloc()
384 sparx5_fdma_rx_activate(sparx5, rx); in sparx5_fdma_rx_alloc()
435 struct sparx5_rx *rx, int channel) in sparx5_fdma_rx_init() argument
439 rx->channel_id = channel; in sparx5_fdma_rx_init()
445 rx->ndev = port->ndev; in sparx5_fdma_rx_init()
468 napi_schedule(&sparx5->rx.napi); in sparx5_fdma_handler()
560 sparx5_fdma_rx_init(sparx5, &sparx5->rx, FDMA_XTR_CHANNEL); in sparx5_fdma_start()
584 napi_disable(&sparx5->rx.napi); in sparx5_fdma_stop()
586 sparx5_fdma_rx_deactivate(sparx5, &sparx5->rx); in sparx5_fdma_stop()