Lines Matching refs:rx

20 static int hfi1_netdev_setup_ctxt(struct hfi1_netdev_rx *rx,  in hfi1_netdev_setup_ctxt()  argument
24 struct hfi1_devdata *dd = rx->dd; in hfi1_netdev_setup_ctxt()
121 static int hfi1_netdev_allot_ctxt(struct hfi1_netdev_rx *rx, in hfi1_netdev_allot_ctxt() argument
125 struct hfi1_devdata *dd = rx->dd; in hfi1_netdev_allot_ctxt()
133 rc = hfi1_netdev_setup_ctxt(rx, *ctxt); in hfi1_netdev_allot_ctxt()
186 static int hfi1_netdev_rxq_init(struct hfi1_netdev_rx *rx) in hfi1_netdev_rxq_init() argument
190 struct hfi1_devdata *dd = rx->dd; in hfi1_netdev_rxq_init()
191 struct net_device *dev = &rx->rx_napi; in hfi1_netdev_rxq_init()
193 rx->num_rx_q = dd->num_netdev_contexts; in hfi1_netdev_rxq_init()
194 rx->rxq = kcalloc_node(rx->num_rx_q, sizeof(*rx->rxq), in hfi1_netdev_rxq_init()
197 if (!rx->rxq) { in hfi1_netdev_rxq_init()
202 for (i = 0; i < rx->num_rx_q; i++) { in hfi1_netdev_rxq_init()
203 struct hfi1_netdev_rxq *rxq = &rx->rxq[i]; in hfi1_netdev_rxq_init()
205 rc = hfi1_netdev_allot_ctxt(rx, &rxq->rcd); in hfi1_netdev_rxq_init()
210 rxq->rx = rx; in hfi1_netdev_rxq_init()
230 struct hfi1_netdev_rxq *rxq = &rx->rxq[i]; in hfi1_netdev_rxq_init()
238 kfree(rx->rxq); in hfi1_netdev_rxq_init()
239 rx->rxq = NULL; in hfi1_netdev_rxq_init()
244 static void hfi1_netdev_rxq_deinit(struct hfi1_netdev_rx *rx) in hfi1_netdev_rxq_deinit() argument
247 struct hfi1_devdata *dd = rx->dd; in hfi1_netdev_rxq_deinit()
249 for (i = 0; i < rx->num_rx_q; i++) { in hfi1_netdev_rxq_deinit()
250 struct hfi1_netdev_rxq *rxq = &rx->rxq[i]; in hfi1_netdev_rxq_deinit()
258 kfree(rx->rxq); in hfi1_netdev_rxq_deinit()
259 rx->rxq = NULL; in hfi1_netdev_rxq_deinit()
260 rx->num_rx_q = 0; in hfi1_netdev_rxq_deinit()
263 static void enable_queues(struct hfi1_netdev_rx *rx) in enable_queues() argument
267 for (i = 0; i < rx->num_rx_q; i++) { in enable_queues()
268 struct hfi1_netdev_rxq *rxq = &rx->rxq[i]; in enable_queues()
270 dd_dev_info(rx->dd, "enabling queue %d on context %d\n", i, in enable_queues()
273 hfi1_rcvctrl(rx->dd, in enable_queues()
279 static void disable_queues(struct hfi1_netdev_rx *rx) in disable_queues() argument
283 msix_netdev_synchronize_irq(rx->dd); in disable_queues()
285 for (i = 0; i < rx->num_rx_q; i++) { in disable_queues()
286 struct hfi1_netdev_rxq *rxq = &rx->rxq[i]; in disable_queues()
288 dd_dev_info(rx->dd, "disabling queue %d on context %d\n", i, in disable_queues()
292 hfi1_rcvctrl(rx->dd, in disable_queues()
309 struct hfi1_netdev_rx *rx = dd->netdev_rx; in hfi1_netdev_rx_init() local
312 if (atomic_fetch_inc(&rx->netdevs)) in hfi1_netdev_rx_init()
316 res = hfi1_netdev_rxq_init(rx); in hfi1_netdev_rx_init()
329 struct hfi1_netdev_rx *rx = dd->netdev_rx; in hfi1_netdev_rx_destroy() local
332 if (atomic_fetch_add_unless(&rx->netdevs, -1, 0) == 1) { in hfi1_netdev_rx_destroy()
334 hfi1_netdev_rxq_deinit(rx); in hfi1_netdev_rx_destroy()
355 struct hfi1_netdev_rx *rx; in hfi1_alloc_rx() local
357 dd_dev_info(dd, "allocating rx size %ld\n", sizeof(*rx)); in hfi1_alloc_rx()
358 rx = kzalloc_node(sizeof(*rx), GFP_KERNEL, dd->node); in hfi1_alloc_rx()
360 if (!rx) in hfi1_alloc_rx()
362 rx->dd = dd; in hfi1_alloc_rx()
363 init_dummy_netdev(&rx->rx_napi); in hfi1_alloc_rx()
365 xa_init(&rx->dev_tbl); in hfi1_alloc_rx()
366 atomic_set(&rx->enabled, 0); in hfi1_alloc_rx()
367 atomic_set(&rx->netdevs, 0); in hfi1_alloc_rx()
368 dd->netdev_rx = rx; in hfi1_alloc_rx()
393 struct hfi1_netdev_rx *rx; in hfi1_netdev_enable_queues() local
398 rx = dd->netdev_rx; in hfi1_netdev_enable_queues()
399 if (atomic_fetch_inc(&rx->enabled)) in hfi1_netdev_enable_queues()
403 enable_queues(rx); in hfi1_netdev_enable_queues()
409 struct hfi1_netdev_rx *rx; in hfi1_netdev_disable_queues() local
414 rx = dd->netdev_rx; in hfi1_netdev_disable_queues()
415 if (atomic_dec_if_positive(&rx->enabled)) in hfi1_netdev_disable_queues()
419 disable_queues(rx); in hfi1_netdev_disable_queues()
435 struct hfi1_netdev_rx *rx = dd->netdev_rx; in hfi1_netdev_add_data() local
437 return xa_insert(&rx->dev_tbl, id, data, GFP_NOWAIT); in hfi1_netdev_add_data()
449 struct hfi1_netdev_rx *rx = dd->netdev_rx; in hfi1_netdev_remove_data() local
451 return xa_erase(&rx->dev_tbl, id); in hfi1_netdev_remove_data()
462 struct hfi1_netdev_rx *rx = dd->netdev_rx; in hfi1_netdev_get_data() local
464 return xa_load(&rx->dev_tbl, id); in hfi1_netdev_get_data()
475 struct hfi1_netdev_rx *rx = dd->netdev_rx; in hfi1_netdev_get_first_data() local
479 ret = xa_find(&rx->dev_tbl, &index, UINT_MAX, XA_PRESENT); in hfi1_netdev_get_first_data()