/linux/Documentation/networking/ |
H A D | napi.rst | 6 NAPI title 9 NAPI is the event handling mechanism used by the Linux networking stack. 10 The name NAPI no longer stands for anything in particular [#]_. 14 The host then schedules a NAPI instance to process the events. 15 The device may also be polled for events via NAPI without receiving 18 NAPI processing usually happens in the software interrupt context, 20 for NAPI processing. 22 All in all NAPI abstracts away from the drivers the context and configuration 28 The two most important elements of NAPI are the struct napi_struct 30 of the NAPI instance while the method is the driver-specific event [all …]
|
/linux/io_uring/ |
H A D | napi.c | 4 #include "napi.h" 37 /* napi approximating usecs, reverse busy_loop_current_time */ in net_to_ktime() 46 /* Non-NAPI IDs can be rejected. */ in __io_napi_add_id() 89 /* Non-NAPI IDs can be rejected. */ in __io_napi_del_id() 212 /* Singular lists use a different napi loop end check function and are in io_napi_blocking_busy_loop() 232 * io_napi_init() - Init napi settings 235 * Init napi settings in the io-uring context. 249 * io_napi_free() - Deallocate napi 252 * Free the napi list and the hash table in the io-uring context. 267 struct io_uring_napi *napi) in io_napi_register_napi() argument [all …]
|
/linux/net/core/ |
H A D | dev.h | 206 * napi_get_defer_hard_irqs - get the NAPI's defer_hard_irqs in napi_set_defer_hard_irqs() 207 * @n: napi struct to get the defer_hard_irqs field from in napi_set_defer_hard_irqs() 209 * Return: the per-NAPI value of the defar_hard_irqs field. 217 * napi_set_defer_hard_irqs - set the defer_hard_irqs for a napi in netdev_set_defer_hard_irqs() 236 struct napi_struct *napi; 240 list_for_each_entry(napi, &netdev->napi_list, dev_list) in napi_get_gro_flush_timeout() 241 napi_set_defer_hard_irqs(napi, defer); in napi_get_gro_flush_timeout() 249 * @n: napi struct to get the gro_flush_timeout from 251 * Return: the per-NAPI value of the gro_flush_timeout field. in napi_set_gro_flush_timeout() 260 * napi_set_gro_flush_timeout - set the gro_flush_timeout for a napi 220 struct napi_struct *napi; netdev_set_defer_hard_irqs() local 266 struct napi_struct *napi; netdev_set_gro_flush_timeout() local 307 xdp_do_check_flushed(struct napi_struct * napi) xdp_do_check_flushed() argument 311 napi_assert_will_not_race(const struct napi_struct * napi) napi_assert_will_not_race() argument [all...] |
H A D | gro_cells.c | 10 struct napi_struct napi; member 40 napi_schedule(&cell->napi); in gro_cells_receive() 51 static int gro_cell_poll(struct napi_struct *napi, int budget) in gro_cell_poll() argument 53 struct gro_cell *cell = container_of(napi, struct gro_cell, napi); in gro_cell_poll() 61 napi_gro_receive(napi, skb); in gro_cell_poll() 66 napi_complete_done(napi, work_done); in gro_cell_poll() 83 set_bit(NAPI_STATE_NO_BUSY_POLL, &cell->napi.state); in gro_cells_init() 85 netif_napi_add(dev, &cell->napi, gro_cell_poll); in gro_cells_init() 86 napi_enable(&cell->napi); in gro_cells_init() 116 napi_disable(&cell->napi); in gro_cells_destroy() [all …]
|
H A D | netdev-genl.c | 162 netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi, in netdev_nl_napi_fill_one() argument 171 if (!napi->dev->up) in netdev_nl_napi_fill_one() 178 if (nla_put_u32(rsp, NETDEV_A_NAPI_ID, napi->napi_id)) in netdev_nl_napi_fill_one() 181 if (nla_put_u32(rsp, NETDEV_A_NAPI_IFINDEX, napi->dev->ifindex)) in netdev_nl_napi_fill_one() 184 if (napi->irq >= 0 && nla_put_u32(rsp, NETDEV_A_NAPI_IRQ, napi->irq)) in netdev_nl_napi_fill_one() 187 if (napi->thread) { in netdev_nl_napi_fill_one() 188 pid = task_pid_nr(napi->thread); in netdev_nl_napi_fill_one() 193 napi_defer_hard_irqs = napi_get_defer_hard_irqs(napi); in netdev_nl_napi_fill_one() 198 irq_suspend_timeout = napi_get_irq_suspend_timeout(napi); in netdev_nl_napi_fill_one() 203 gro_flush_timeout = napi_get_gro_flush_timeout(napi); in netdev_nl_napi_fill_one() [all …]
|
H A D | dev.c | 136 #include <trace/events/napi.h> 463 * (e.g. NAPI context). 778 struct napi_struct *napi; in napi_by_id() local 780 hlist_for_each_entry_rcu(napi, &napi_hash[hash], napi_hash_node) in napi_by_id() 781 if (napi->napi_id == napi_id) in napi_by_id() 782 return napi; in napi_by_id() 791 struct napi_struct *napi; in netdev_napi_by_id() local 793 napi = napi_by_id(napi_id); in netdev_napi_by_id() 794 if (!napi) in netdev_napi_by_id() 797 if (WARN_ON_ONCE(!napi->dev)) in netdev_napi_by_id() [all …]
|
H A D | gro.c | 453 /* Do not adjust napi->gro_hash[].count, caller is adding a new in gro_flush_oldest() 638 static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) in napi_reuse_skb() argument 648 skb->dev = napi->dev; in napi_reuse_skb() 665 napi->skb = skb; in napi_reuse_skb() 668 struct sk_buff *napi_get_frags(struct napi_struct *napi) in napi_get_frags() argument 670 struct sk_buff *skb = napi->skb; in napi_get_frags() 673 skb = napi_alloc_skb(napi, GRO_MAX_HEAD); in napi_get_frags() 675 napi->skb = skb; in napi_get_frags() 676 skb_mark_napi_id(skb, napi); in napi_get_frags() 683 static gro_result_t napi_frags_finish(struct napi_struct *napi, in napi_frags_finish() argument [all …]
|
/linux/include/trace/events/ |
H A D | napi.h | 3 #define TRACE_SYSTEM napi 16 TP_PROTO(struct napi_struct *napi, int work, int budget), 18 TP_ARGS(napi, work, budget), 21 __field( struct napi_struct *, napi) 22 __string( dev_name, napi->dev ? napi->dev->name : NO_DEV) 28 __entry->napi = napi; 34 TP_printk("napi poll on napi struc [all...] |
/linux/drivers/net/ethernet/intel/igc/ |
H A D | igc_xdp.c | 32 napi_disable(&adapter->rx_ring[i]->q_vector->napi); in igc_xdp_set_prog() 47 napi_enable(&adapter->rx_ring[i]->q_vector->napi); in igc_xdp_set_prog() 62 struct napi_struct *napi; in igc_xdp_enable_pool() local 91 /* Rx and Tx rings share the same napi context. */ in igc_xdp_enable_pool() 92 napi = &rx_ring->q_vector->napi; in igc_xdp_enable_pool() 97 napi_disable(napi); in igc_xdp_enable_pool() 104 napi_enable(napi); in igc_xdp_enable_pool() 122 struct napi_struct *napi; in igc_xdp_disable_pool() local 137 /* Rx and Tx rings share the same napi context. */ in igc_xdp_disable_pool() 138 napi = &rx_ring->q_vector->napi; in igc_xdp_disable_pool() [all …]
|
/linux/drivers/net/netdevsim/ |
H A D | netdev.c | 361 skb_mark_napi_id(skb, &rq->napi); in nsim_rcv() 368 static int nsim_poll(struct napi_struct *napi, int budget) in nsim_poll() argument 370 struct nsim_rq *rq = container_of(napi, struct nsim_rq, napi); in nsim_poll() 375 napi_complete_done(napi, done); in nsim_poll() 380 static int nsim_create_page_pool(struct page_pool **p, struct napi_struct *napi) in nsim_create_page_pool() argument 386 .dev = &napi->dev->dev, in nsim_create_page_pool() 387 .napi = napi, in nsim_create_page_pool() 389 .netdev = napi->dev, in nsim_create_page_pool() 410 netif_napi_add_config_locked(dev, &rq->napi, nsim_poll, i); in nsim_init_napi() 416 err = nsim_create_page_pool(&rq->page_pool, &rq->napi); in nsim_init_napi() [all …]
|
/linux/drivers/infiniband/hw/hfi1/ |
H A D | ipoib_rx.c | 22 static struct sk_buff *prepare_frag_skb(struct napi_struct *napi, int size) in prepare_frag_skb() argument 33 return napi_alloc_skb(napi, size); in prepare_frag_skb() 49 struct napi_struct *napi = &rxq->napi; in hfi1_ipoib_prepare_skb() local 55 * napi cache. Otherwise we will try to use napi frag cache. in hfi1_ipoib_prepare_skb() 58 skb = napi_alloc_skb(napi, skb_size); in hfi1_ipoib_prepare_skb() 60 skb = prepare_frag_skb(napi, skb_size); in hfi1_ipoib_prepare_skb()
|
H A D | netdev_rx.c | 211 rxq->rcd->napi = &rxq->napi; in hfi1_netdev_rxq_init() 212 dd_dev_info(dd, "Setting rcv queue %d napi to context %d\n", in hfi1_netdev_rxq_init() 215 * Disable BUSY_POLL on this NAPI as this is not supported in hfi1_netdev_rxq_init() 218 set_bit(NAPI_STATE_NO_BUSY_POLL, &rxq->napi.state); in hfi1_netdev_rxq_init() 219 netif_napi_add(dev, &rxq->napi, hfi1_netdev_rx_napi); in hfi1_netdev_rxq_init() 252 netif_napi_del(&rxq->napi); in hfi1_netdev_rxq_deinit() 272 napi_enable(&rxq->napi); in enable_queues() 291 /* wait for napi if it was scheduled */ in disable_queues() 295 napi_synchronize(&rxq->napi); in disable_queues() 296 napi_disable(&rxq->napi); in disable_queues() [all …]
|
H A D | netdev.h | 18 * @napi: napi object 23 struct napi_struct napi; member 47 * When 0 NAPI will be disabled. 58 /* count of enabled napi polls */ 103 int hfi1_netdev_rx_napi(struct napi_struct *napi, int budget);
|
/linux/drivers/net/wireless/ath/wil6210/ |
H A D | netdev.c | 91 static int wil6210_netdev_poll_rx(struct napi_struct *napi, int budget) in wil6210_netdev_poll_rx() argument 93 struct wil6210_priv *wil = container_of(napi, struct wil6210_priv, in wil6210_netdev_poll_rx() 102 napi_complete_done(napi, done); in wil6210_netdev_poll_rx() 104 wil_dbg_txrx(wil, "NAPI RX complete\n"); in wil6210_netdev_poll_rx() 107 wil_dbg_txrx(wil, "NAPI RX poll(%d) done %d\n", budget, done); in wil6210_netdev_poll_rx() 112 static int wil6210_netdev_poll_rx_edma(struct napi_struct *napi, int budget) in wil6210_netdev_poll_rx_edma() argument 114 struct wil6210_priv *wil = container_of(napi, struct wil6210_priv, in wil6210_netdev_poll_rx_edma() 123 napi_complete_done(napi, done); in wil6210_netdev_poll_rx_edma() 125 wil_dbg_txrx(wil, "NAPI RX complete\n"); in wil6210_netdev_poll_rx_edma() 128 wil_dbg_txrx(wil, "NAPI RX poll(%d) done %d\n", budget, done); in wil6210_netdev_poll_rx_edma() [all …]
|
/linux/include/linux/ |
H A D | netpoll.h | 79 static inline void *netpoll_poll_lock(struct napi_struct *napi) in netpoll_poll_lock() argument 81 struct net_device *dev = napi->dev; in netpoll_poll_lock() 86 while (cmpxchg(&napi->poll_owner, -1, owner) != -1) in netpoll_poll_lock() 89 return napi; in netpoll_poll_lock() 96 struct napi_struct *napi = have; in netpoll_poll_unlock() local 98 if (napi) in netpoll_poll_unlock() 99 smp_store_release(&napi->poll_owner, -1); in netpoll_poll_unlock() 108 static inline void *netpoll_poll_lock(struct napi_struct *napi) in netpoll_poll_lock() argument
|
/linux/drivers/net/ethernet/synopsys/ |
H A D | dwc-xlgmac-net.c | 283 * enabled before using the private data napi structure. in xlgmac_isr() 290 if (napi_schedule_prep(&pdata->napi)) { in xlgmac_isr() 296 __napi_schedule_irqoff(&pdata->napi); in xlgmac_isr() 348 * channel napi structure and not the private data napi structure in xlgmac_dma_isr() 350 if (napi_schedule_prep(&channel->napi)) { in xlgmac_dma_isr() 355 __napi_schedule_irqoff(&channel->napi); in xlgmac_dma_isr() 366 struct napi_struct *napi; in xlgmac_tx_timer() local 368 napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi; in xlgmac_tx_timer() 370 if (napi_schedule_prep(napi)) { in xlgmac_tx_timer() 379 __napi_schedule(napi); in xlgmac_tx_timer() [all …]
|
/linux/drivers/net/ethernet/aquantia/atlantic/ |
H A D | aq_vec.c | 21 struct napi_struct napi; member 28 static int aq_vec_poll(struct napi_struct *napi, int budget) in aq_vec_poll() argument 30 struct aq_vec_s *self = container_of(napi, struct aq_vec_s, napi); in aq_vec_poll() 68 napi, in aq_vec_poll() 93 napi_complete_done(napi, work_done); in aq_vec_poll() 122 netif_napi_add(aq_nic_get_ndev(aq_nic), &self->napi, aq_vec_poll); in aq_vec_alloc() 151 self->napi.napi_id) < 0) { in aq_vec_ring_alloc() 245 napi_enable(&self->napi); in aq_vec_start() 265 napi_disable(&self->napi); in aq_vec_stop() 290 netif_napi_del(&self->napi); in aq_vec_free() [all …]
|
/linux/drivers/net/ethernet/google/gve/ |
H A D | gve_utils.c | 67 struct sk_buff *gve_rx_copy_data(struct net_device *dev, struct napi_struct *napi, in gve_rx_copy_data() argument 72 skb = napi_alloc_skb(napi, len); in gve_rx_copy_data() 83 struct sk_buff *gve_rx_copy(struct net_device *dev, struct napi_struct *napi, in gve_rx_copy() argument 89 return gve_rx_copy_data(dev, napi, va, len); in gve_rx_copy() 113 netif_napi_add_locked(priv->dev, &block->napi, gve_poll); in gve_add_napi() 114 netif_napi_set_irq_locked(&block->napi, block->irq); in gve_add_napi() 121 netif_napi_del_locked(&block->napi); in gve_remove_napi()
|
H A D | gve_rx.c | 450 static struct sk_buff *gve_rx_add_frags(struct napi_struct *napi, in gve_rx_add_frags() argument 460 skb = napi_get_frags(napi); in gve_rx_add_frags() 469 skb = napi_alloc_skb(napi, 0); in gve_rx_add_frags() 520 struct napi_struct *napi, in gve_rx_raw_addressing() argument 524 struct sk_buff *skb = gve_rx_add_frags(napi, page_info, packet_buffer_size, len, ctx); in gve_rx_raw_addressing() 540 u16 len, struct napi_struct *napi) in gve_rx_copy_to_pool() argument 581 skb = gve_rx_add_frags(napi, &alloc_page_info, in gve_rx_copy_to_pool() 597 skb = gve_rx_add_frags(napi, copy_page_info, in gve_rx_copy_to_pool() 626 u16 len, struct napi_struct *napi, in gve_rx_qpl() argument 638 skb = gve_rx_add_frags(napi, page_info, page_info->buf_size, in gve_rx_qpl() [all …]
|
/linux/drivers/net/caif/ |
H A D | caif_virtio.c | 30 /* NAPI schedule quota */ 41 /* struct cfv_napi_contxt - NAPI context info 54 * @rx_napi_complete: Number of NAPI completions (RX) 84 * @napi: Napi context used in cfv_rx_poll() 111 struct napi_struct napi; member 250 static int cfv_rx_poll(struct napi_struct *napi, int quota) in cfv_rx_poll() argument 252 struct cfv_info *cfv = container_of(napi, struct cfv_info, napi); in cfv_rx_poll() 319 napi_complete(napi); in cfv_rx_poll() 321 napi_schedule_prep(napi)) { in cfv_rx_poll() 323 __napi_schedule(napi); in cfv_rx_poll() [all …]
|
/linux/drivers/net/ethernet/meta/fbnic/ |
H A D | fbnic_txrx.c | 583 txq = txring_txq(nv->napi.dev, ring); in fbnic_clean_twq0() 626 netdev_err(nv->napi.dev, in fbnic_clean_tsq() 638 fbn = netdev_priv(nv->napi.dev); in fbnic_clean_tsq() 993 skb->protocol = eth_type_trans(skb, nv->napi.dev); in fbnic_build_skb() 1018 fbn = netdev_priv(nv->napi.dev); in fbnic_rx_tstamp() 1031 struct net_device *netdev = nv->napi.dev; in fbnic_populate_skb_fields() 1109 napi_gro_receive(&nv->napi, skb); in fbnic_clean_rcq() 1180 static int fbnic_poll(struct napi_struct *napi, int budget) in fbnic_poll() argument 1182 struct fbnic_napi_vector *nv = container_of(napi, in fbnic_poll() 1184 napi); in fbnic_poll() [all …]
|
/linux/drivers/net/ethernet/qlogic/qlcnic/ |
H A D | qlcnic_io.c | 959 static int qlcnic_poll(struct napi_struct *napi, int budget) in qlcnic_poll() argument 966 sds_ring = container_of(napi, struct qlcnic_host_sds_ring, napi); in qlcnic_poll() 979 napi_complete_done(&sds_ring->napi, work_done); in qlcnic_poll() 989 static int qlcnic_tx_poll(struct napi_struct *napi, int budget) in qlcnic_tx_poll() argument 995 tx_ring = container_of(napi, struct qlcnic_host_tx_ring, napi); in qlcnic_tx_poll() 1000 napi_complete(&tx_ring->napi); in qlcnic_tx_poll() 1011 static int qlcnic_rx_poll(struct napi_struct *napi, int budget) in qlcnic_rx_poll() argument 1017 sds_ring = container_of(napi, struct qlcnic_host_sds_ring, napi); in qlcnic_rx_poll() 1023 napi_complete_done(&sds_ring->napi, work_done); in qlcnic_rx_poll() 1248 napi_gro_receive(&sds_ring->napi, skb); in qlcnic_process_rcv() [all …]
|
/linux/drivers/net/ethernet/hisilicon/hibmcge/ |
H A D | hbg_txrx.c | 158 static int hbg_napi_tx_recycle(struct napi_struct *napi, int budget) in hbg_napi_tx_recycle() argument 160 struct hbg_ring *ring = container_of(napi, struct hbg_ring, napi); in hbg_napi_tx_recycle() 171 * Per NAPI documentation budget is for Rx. in hbg_napi_tx_recycle() 172 * So We hardcode the amount of work Tx NAPI does to 128. in hbg_napi_tx_recycle() 198 napi_complete_done(napi, packet_done))) in hbg_napi_tx_recycle() 411 static int hbg_napi_rx_poll(struct napi_struct *napi, int budget) in hbg_napi_rx_poll() argument 413 struct hbg_ring *ring = container_of(napi, struct hbg_ring, napi); in hbg_napi_rx_poll() 445 napi_gro_receive(napi, buffer->skb); in hbg_napi_rx_poll() 455 napi_complete_done(napi, packet_done))) in hbg_napi_rx_poll() 469 napi_disable(&ring->napi); in hbg_ring_uninit() [all …]
|
/linux/drivers/staging/octeon/ |
H A D | ethernet-rx.c | 37 struct napi_struct napi; member 43 * @napi_id: Cookie to identify the NAPI instance. 406 * cvm_oct_napi_poll - the NAPI poll function. 407 * @napi: The NAPI instance. 412 static int cvm_oct_napi_poll(struct napi_struct *napi, int budget) in cvm_oct_napi_poll() argument 414 struct oct_rx_group *rx_group = container_of(napi, struct oct_rx_group, in cvm_oct_napi_poll() 415 napi); in cvm_oct_napi_poll() 422 napi_complete_done(napi, rx_count); in cvm_oct_napi_poll() 472 netif_napi_add_weight(dev_for_napi, &oct_rx_group[i].napi, in cvm_oct_rx_initialize() 474 napi_enable(&oct_rx_group[i].napi); in cvm_oct_rx_initialize() [all …]
|
/linux/drivers/net/wireless/mediatek/mt76/ |
H A D | mt792x_dma.c | 66 napi_schedule(&dev->mt76.napi[MT_RXQ_MCU]); in mt792x_irq_tasklet() 69 napi_schedule(&dev->mt76.napi[MT_RXQ_MCU_WA]); in mt792x_irq_tasklet() 72 napi_schedule(&dev->mt76.napi[MT_RXQ_MAIN]); in mt792x_irq_tasklet() 316 int mt792x_poll_tx(struct napi_struct *napi, int budget) in mt792x_poll_tx() argument 320 dev = container_of(napi, struct mt792x_dev, mt76.tx_napi); in mt792x_poll_tx() 323 napi_complete(napi); in mt792x_poll_tx() 329 if (napi_complete(napi)) in mt792x_poll_tx() 338 int mt792x_poll_rx(struct napi_struct *napi, int budget) in mt792x_poll_rx() argument 343 dev = mt76_priv(napi->dev); in mt792x_poll_rx() 346 napi_complete(napi); in mt792x_poll_rx() [all …]
|