Lines Matching refs:channel
202 static void efx_remove_channel(struct efx_channel *channel);
206 static void efx_init_napi_channel(struct efx_channel *channel);
208 static void efx_fini_napi_channel(struct efx_channel *channel);
244 static int efx_process_channel(struct efx_channel *channel, int budget) in efx_process_channel() argument
248 if (unlikely(!channel->enabled)) in efx_process_channel()
251 spent = efx_nic_process_eventq(channel, budget); in efx_process_channel()
252 if (spent && efx_channel_has_rx_queue(channel)) { in efx_process_channel()
254 efx_channel_get_rx_queue(channel); in efx_process_channel()
256 efx_rx_flush_packet(channel); in efx_process_channel()
270 struct efx_channel *channel = in efx_poll() local
272 struct efx_nic *efx = channel->efx; in efx_poll()
275 if (!efx_channel_lock_napi(channel)) in efx_poll()
280 channel->channel, raw_smp_processor_id()); in efx_poll()
282 spent = efx_process_channel(channel, budget); in efx_poll()
285 if (efx_channel_has_rx_queue(channel) && in efx_poll()
287 unlikely(++channel->irq_count == 1000)) { in efx_poll()
288 if (unlikely(channel->irq_mod_score < in efx_poll()
290 if (channel->irq_moderation > 1) { in efx_poll()
291 channel->irq_moderation -= 1; in efx_poll()
292 efx->type->push_irq_moderation(channel); in efx_poll()
294 } else if (unlikely(channel->irq_mod_score > in efx_poll()
296 if (channel->irq_moderation < in efx_poll()
298 channel->irq_moderation += 1; in efx_poll()
299 efx->type->push_irq_moderation(channel); in efx_poll()
302 channel->irq_count = 0; in efx_poll()
303 channel->irq_mod_score = 0; in efx_poll()
306 efx_filter_rfs_expire(channel); in efx_poll()
314 efx_nic_eventq_read_ack(channel); in efx_poll()
317 efx_channel_unlock_napi(channel); in efx_poll()
326 static int efx_probe_eventq(struct efx_channel *channel) in efx_probe_eventq() argument
328 struct efx_nic *efx = channel->efx; in efx_probe_eventq()
332 "chan %d create event queue\n", channel->channel); in efx_probe_eventq()
338 channel->eventq_mask = max(entries, EFX_MIN_EVQ_SIZE) - 1; in efx_probe_eventq()
340 return efx_nic_probe_eventq(channel); in efx_probe_eventq()
344 static int efx_init_eventq(struct efx_channel *channel) in efx_init_eventq() argument
346 struct efx_nic *efx = channel->efx; in efx_init_eventq()
349 EFX_WARN_ON_PARANOID(channel->eventq_init); in efx_init_eventq()
352 "chan %d init event queue\n", channel->channel); in efx_init_eventq()
354 rc = efx_nic_init_eventq(channel); in efx_init_eventq()
356 efx->type->push_irq_moderation(channel); in efx_init_eventq()
357 channel->eventq_read_ptr = 0; in efx_init_eventq()
358 channel->eventq_init = true; in efx_init_eventq()
364 void efx_start_eventq(struct efx_channel *channel) in efx_start_eventq() argument
366 netif_dbg(channel->efx, ifup, channel->efx->net_dev, in efx_start_eventq()
367 "chan %d start event queue\n", channel->channel); in efx_start_eventq()
370 channel->enabled = true; in efx_start_eventq()
373 efx_channel_enable(channel); in efx_start_eventq()
374 napi_enable(&channel->napi_str); in efx_start_eventq()
375 efx_nic_eventq_read_ack(channel); in efx_start_eventq()
379 void efx_stop_eventq(struct efx_channel *channel) in efx_stop_eventq() argument
381 if (!channel->enabled) in efx_stop_eventq()
384 napi_disable(&channel->napi_str); in efx_stop_eventq()
385 while (!efx_channel_disable(channel)) in efx_stop_eventq()
387 channel->enabled = false; in efx_stop_eventq()
390 static void efx_fini_eventq(struct efx_channel *channel) in efx_fini_eventq() argument
392 if (!channel->eventq_init) in efx_fini_eventq()
395 netif_dbg(channel->efx, drv, channel->efx->net_dev, in efx_fini_eventq()
396 "chan %d fini event queue\n", channel->channel); in efx_fini_eventq()
398 efx_nic_fini_eventq(channel); in efx_fini_eventq()
399 channel->eventq_init = false; in efx_fini_eventq()
402 static void efx_remove_eventq(struct efx_channel *channel) in efx_remove_eventq() argument
404 netif_dbg(channel->efx, drv, channel->efx->net_dev, in efx_remove_eventq()
405 "chan %d remove event queue\n", channel->channel); in efx_remove_eventq()
407 efx_nic_remove_eventq(channel); in efx_remove_eventq()
420 struct efx_channel *channel; in efx_alloc_channel() local
425 channel = kzalloc(sizeof(*channel), GFP_KERNEL); in efx_alloc_channel()
426 if (!channel) in efx_alloc_channel()
429 channel->efx = efx; in efx_alloc_channel()
430 channel->channel = i; in efx_alloc_channel()
431 channel->type = &efx_default_channel_type; in efx_alloc_channel()
434 tx_queue = &channel->tx_queue[j]; in efx_alloc_channel()
437 tx_queue->channel = channel; in efx_alloc_channel()
440 rx_queue = &channel->rx_queue; in efx_alloc_channel()
445 return channel; in efx_alloc_channel()
454 struct efx_channel *channel; in efx_copy_channel() local
459 channel = kmalloc(sizeof(*channel), GFP_KERNEL); in efx_copy_channel()
460 if (!channel) in efx_copy_channel()
463 *channel = *old_channel; in efx_copy_channel()
465 channel->napi_dev = NULL; in efx_copy_channel()
466 memset(&channel->eventq, 0, sizeof(channel->eventq)); in efx_copy_channel()
469 tx_queue = &channel->tx_queue[j]; in efx_copy_channel()
470 if (tx_queue->channel) in efx_copy_channel()
471 tx_queue->channel = channel; in efx_copy_channel()
476 rx_queue = &channel->rx_queue; in efx_copy_channel()
482 return channel; in efx_copy_channel()
485 static int efx_probe_channel(struct efx_channel *channel) in efx_probe_channel() argument
491 netif_dbg(channel->efx, probe, channel->efx->net_dev, in efx_probe_channel()
492 "creating channel %d\n", channel->channel); in efx_probe_channel()
494 rc = channel->type->pre_probe(channel); in efx_probe_channel()
498 rc = efx_probe_eventq(channel); in efx_probe_channel()
502 efx_for_each_channel_tx_queue(tx_queue, channel) { in efx_probe_channel()
508 efx_for_each_channel_rx_queue(rx_queue, channel) { in efx_probe_channel()
517 efx_remove_channel(channel); in efx_probe_channel()
522 efx_get_channel_name(struct efx_channel *channel, char *buf, size_t len) in efx_get_channel_name() argument
524 struct efx_nic *efx = channel->efx; in efx_get_channel_name()
528 number = channel->channel; in efx_get_channel_name()
531 } else if (channel->channel < efx->tx_channel_offset) { in efx_get_channel_name()
542 struct efx_channel *channel; in efx_set_channel_names() local
544 efx_for_each_channel(channel, efx) in efx_set_channel_names()
545 channel->type->get_name(channel, in efx_set_channel_names()
546 efx->msi_context[channel->channel].name, in efx_set_channel_names()
552 struct efx_channel *channel; in efx_probe_channels() local
563 efx_for_each_channel_rev(channel, efx) { in efx_probe_channels()
564 rc = efx_probe_channel(channel); in efx_probe_channels()
568 channel->channel); in efx_probe_channels()
590 struct efx_channel *channel; in efx_start_datapath() local
646 efx_for_each_channel(channel, efx) { in efx_start_datapath()
647 efx_for_each_channel_tx_queue(tx_queue, channel) { in efx_start_datapath()
652 efx_for_each_channel_rx_queue(rx_queue, channel) { in efx_start_datapath()
655 efx_stop_eventq(channel); in efx_start_datapath()
657 efx_start_eventq(channel); in efx_start_datapath()
660 WARN_ON(channel->rx_pkt_n_frags); in efx_start_datapath()
671 struct efx_channel *channel; in efx_stop_datapath() local
682 efx_for_each_channel(channel, efx) { in efx_stop_datapath()
683 efx_for_each_channel_rx_queue(rx_queue, channel) in efx_stop_datapath()
687 efx_for_each_channel(channel, efx) { in efx_stop_datapath()
694 if (efx_channel_has_rx_queue(channel)) { in efx_stop_datapath()
695 efx_stop_eventq(channel); in efx_stop_datapath()
696 efx_start_eventq(channel); in efx_stop_datapath()
717 efx_for_each_channel(channel, efx) { in efx_stop_datapath()
718 efx_for_each_channel_rx_queue(rx_queue, channel) in efx_stop_datapath()
720 efx_for_each_possible_channel_tx_queue(tx_queue, channel) in efx_stop_datapath()
725 static void efx_remove_channel(struct efx_channel *channel) in efx_remove_channel() argument
730 netif_dbg(channel->efx, drv, channel->efx->net_dev, in efx_remove_channel()
731 "destroy chan %d\n", channel->channel); in efx_remove_channel()
733 efx_for_each_channel_rx_queue(rx_queue, channel) in efx_remove_channel()
735 efx_for_each_possible_channel_tx_queue(tx_queue, channel) in efx_remove_channel()
737 efx_remove_eventq(channel); in efx_remove_channel()
738 channel->type->post_remove(channel); in efx_remove_channel()
743 struct efx_channel *channel; in efx_remove_channels() local
745 efx_for_each_channel(channel, efx) in efx_remove_channels()
746 efx_remove_channel(channel); in efx_remove_channels()
752 struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel; in efx_realloc_channels() local
764 efx_for_each_channel(channel, efx) { in efx_realloc_channels()
768 if (channel->type->copy) in efx_realloc_channels()
771 channel->eventq.index + in efx_realloc_channels()
772 channel->eventq.entries); in efx_realloc_channels()
773 efx_for_each_channel_rx_queue(rx_queue, channel) in efx_realloc_channels()
777 efx_for_each_channel_tx_queue(tx_queue, channel) in efx_realloc_channels()
790 channel = efx->channel[i]; in efx_realloc_channels()
791 if (channel->type->copy) in efx_realloc_channels()
792 channel = channel->type->copy(channel); in efx_realloc_channels()
793 if (!channel) { in efx_realloc_channels()
797 other_channel[i] = channel; in efx_realloc_channels()
806 channel = efx->channel[i]; in efx_realloc_channels()
807 efx->channel[i] = other_channel[i]; in efx_realloc_channels()
808 other_channel[i] = channel; in efx_realloc_channels()
815 channel = efx->channel[i]; in efx_realloc_channels()
816 if (!channel->type->copy) in efx_realloc_channels()
818 rc = efx_probe_channel(channel); in efx_realloc_channels()
821 efx_init_napi_channel(efx->channel[i]); in efx_realloc_channels()
827 channel = other_channel[i]; in efx_realloc_channels()
828 if (channel && channel->type->copy) { in efx_realloc_channels()
829 efx_fini_napi_channel(channel); in efx_realloc_channels()
830 efx_remove_channel(channel); in efx_realloc_channels()
831 kfree(channel); in efx_realloc_channels()
852 channel = efx->channel[i]; in efx_realloc_channels()
853 efx->channel[i] = other_channel[i]; in efx_realloc_channels()
854 other_channel[i] = channel; in efx_realloc_channels()
872 int efx_channel_dummy_op_int(struct efx_channel *channel) in efx_channel_dummy_op_int() argument
877 void efx_channel_dummy_op_void(struct efx_channel *channel) in efx_channel_dummy_op_void() argument
1439 struct efx_channel *channel, *end_channel; in efx_soft_enable_interrupts() local
1447 efx_for_each_channel(channel, efx) { in efx_soft_enable_interrupts()
1448 if (!channel->type->keep_eventq) { in efx_soft_enable_interrupts()
1449 rc = efx_init_eventq(channel); in efx_soft_enable_interrupts()
1453 efx_start_eventq(channel); in efx_soft_enable_interrupts()
1460 end_channel = channel; in efx_soft_enable_interrupts()
1461 efx_for_each_channel(channel, efx) { in efx_soft_enable_interrupts()
1462 if (channel == end_channel) in efx_soft_enable_interrupts()
1464 efx_stop_eventq(channel); in efx_soft_enable_interrupts()
1465 if (!channel->type->keep_eventq) in efx_soft_enable_interrupts()
1466 efx_fini_eventq(channel); in efx_soft_enable_interrupts()
1474 struct efx_channel *channel; in efx_soft_disable_interrupts() local
1487 efx_for_each_channel(channel, efx) { in efx_soft_disable_interrupts()
1488 if (channel->irq) in efx_soft_disable_interrupts()
1489 synchronize_irq(channel->irq); in efx_soft_disable_interrupts()
1491 efx_stop_eventq(channel); in efx_soft_disable_interrupts()
1492 if (!channel->type->keep_eventq) in efx_soft_disable_interrupts()
1493 efx_fini_eventq(channel); in efx_soft_disable_interrupts()
1502 struct efx_channel *channel, *end_channel; in efx_enable_interrupts() local
1514 efx_for_each_channel(channel, efx) { in efx_enable_interrupts()
1515 if (channel->type->keep_eventq) { in efx_enable_interrupts()
1516 rc = efx_init_eventq(channel); in efx_enable_interrupts()
1529 end_channel = channel; in efx_enable_interrupts()
1530 efx_for_each_channel(channel, efx) { in efx_enable_interrupts()
1531 if (channel == end_channel) in efx_enable_interrupts()
1533 if (channel->type->keep_eventq) in efx_enable_interrupts()
1534 efx_fini_eventq(channel); in efx_enable_interrupts()
1544 struct efx_channel *channel; in efx_disable_interrupts() local
1548 efx_for_each_channel(channel, efx) { in efx_disable_interrupts()
1549 if (channel->type->keep_eventq) in efx_disable_interrupts()
1550 efx_fini_eventq(channel); in efx_disable_interrupts()
1558 struct efx_channel *channel; in efx_remove_interrupts() local
1561 efx_for_each_channel(channel, efx) in efx_remove_interrupts()
1562 channel->irq = 0; in efx_remove_interrupts()
1572 struct efx_channel *channel; in efx_set_channels() local
1582 efx_for_each_channel(channel, efx) { in efx_set_channels()
1583 if (channel->channel < efx->n_rx_channels) in efx_set_channels()
1584 channel->rx_queue.core_index = channel->channel; in efx_set_channels()
1586 channel->rx_queue.core_index = -1; in efx_set_channels()
1588 efx_for_each_channel_tx_queue(tx_queue, channel) in efx_set_channels()
1843 struct efx_channel *channel; in efx_init_irq_moderation() local
1867 efx_for_each_channel(channel, efx) { in efx_init_irq_moderation()
1868 if (efx_channel_has_rx_queue(channel)) in efx_init_irq_moderation()
1869 channel->irq_moderation = rx_ticks; in efx_init_irq_moderation()
1870 else if (efx_channel_has_tx_queues(channel)) in efx_init_irq_moderation()
1871 channel->irq_moderation = tx_ticks; in efx_init_irq_moderation()
1897 efx->channel[efx->tx_channel_offset]->irq_moderation * in efx_get_irq_moderation()
1965 static void efx_init_napi_channel(struct efx_channel *channel) in efx_init_napi_channel() argument
1967 struct efx_nic *efx = channel->efx; in efx_init_napi_channel()
1969 channel->napi_dev = efx->net_dev; in efx_init_napi_channel()
1970 netif_napi_add(channel->napi_dev, &channel->napi_str, in efx_init_napi_channel()
1972 napi_hash_add(&channel->napi_str); in efx_init_napi_channel()
1973 efx_channel_init_lock(channel); in efx_init_napi_channel()
1978 struct efx_channel *channel; in efx_init_napi() local
1980 efx_for_each_channel(channel, efx) in efx_init_napi()
1981 efx_init_napi_channel(channel); in efx_init_napi()
1984 static void efx_fini_napi_channel(struct efx_channel *channel) in efx_fini_napi_channel() argument
1986 if (channel->napi_dev) { in efx_fini_napi_channel()
1987 netif_napi_del(&channel->napi_str); in efx_fini_napi_channel()
1988 napi_hash_del(&channel->napi_str); in efx_fini_napi_channel()
1990 channel->napi_dev = NULL; in efx_fini_napi_channel()
1995 struct efx_channel *channel; in efx_fini_napi() local
1997 efx_for_each_channel(channel, efx) in efx_fini_napi()
1998 efx_fini_napi_channel(channel); in efx_fini_napi()
2016 struct efx_channel *channel; in efx_netpoll() local
2018 efx_for_each_channel(channel, efx) in efx_netpoll()
2019 efx_schedule_channel(channel); in efx_netpoll()
2027 struct efx_channel *channel = in efx_busy_poll() local
2029 struct efx_nic *efx = channel->efx; in efx_busy_poll()
2036 if (!efx_channel_lock_poll(channel)) in efx_busy_poll()
2039 old_rx_packets = channel->rx_queue.rx_packets; in efx_busy_poll()
2040 efx_process_channel(channel, budget); in efx_busy_poll()
2042 rx_packets = channel->rx_queue.rx_packets - old_rx_packets; in efx_busy_poll()
2049 efx_channel_unlock_poll(channel); in efx_busy_poll()
2290 struct efx_channel *channel; in efx_register_netdev() local
2331 efx_for_each_channel(channel, efx) { in efx_register_netdev()
2333 efx_for_each_channel_tx_queue(tx_queue, channel) in efx_register_netdev()
2735 efx->channel[i] = efx_alloc_channel(efx, i, NULL); in efx_init_struct()
2736 if (!efx->channel[i]) in efx_init_struct()
2765 kfree(efx->channel[i]); in efx_fini_struct()
2778 struct efx_channel *channel; in efx_update_sw_stats() local
2780 efx_for_each_channel(channel, efx) in efx_update_sw_stats()
2781 n_rx_nodesc_trunc += channel->n_rx_nodesc_trunc; in efx_update_sw_stats()