linux/drivers/net/ethernet/sfc/efx_channels.c

// SPDX-License-Identifier: GPL-2.0-only
/****************************************************************************
 * Driver for Solarflare network controllers and boards
 * Copyright 2018 Solarflare Communications Inc.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation, incorporated herein by reference.
 */

#include "net_driver.h"
#include <linux/module.h>
#include <linux/filter.h>
#include "efx_channels.h"
#include "efx.h"
#include "efx_common.h"
#include "tx_common.h"
#include "rx_common.h"
#include "nic.h"
#include "sriov.h"
#include "workarounds.h"

/* This is the first interrupt mode to try out of:
 * 0 => MSI-X
 * 1 => MSI
 * 2 => legacy
 */
unsigned int efx_interrupt_mode =;

/* This is the requested number of CPUs to use for Receive-Side Scaling (RSS),
 * i.e. the number of CPUs among which we may distribute simultaneous
 * interrupt handling.
 *
 * Cards without MSI-X will only target one CPU via legacy or MSI interrupt.
 * The default (0) means to assign an interrupt to each core.
 */
unsigned int rss_cpus;

static unsigned int irq_adapt_low_thresh =;
module_param(irq_adapt_low_thresh, uint, 0644);
MODULE_PARM_DESC();

static unsigned int irq_adapt_high_thresh =;
module_param(irq_adapt_high_thresh, uint, 0644);
MODULE_PARM_DESC();

static const struct efx_channel_type efx_default_channel_type;

/*************
 * INTERRUPTS
 *************/

static unsigned int count_online_cores(struct efx_nic *efx, bool local_node)
{}

static unsigned int efx_wanted_parallelism(struct efx_nic *efx)
{}

static int efx_allocate_msix_channels(struct efx_nic *efx,
				      unsigned int max_channels,
				      unsigned int extra_channels,
				      unsigned int parallelism)
{}

/* Probe the number and type of interrupts we are able to obtain, and
 * the resulting numbers of channels and RX queues.
 */
int efx_probe_interrupts(struct efx_nic *efx)
{}

#if defined(CONFIG_SMP)
void efx_set_interrupt_affinity(struct efx_nic *efx)
{}

void efx_clear_interrupt_affinity(struct efx_nic *efx)
{}
#else
void
efx_set_interrupt_affinity(struct efx_nic *efx __attribute__ ((unused)))
{
}

void
efx_clear_interrupt_affinity(struct efx_nic *efx __attribute__ ((unused)))
{
}
#endif /* CONFIG_SMP */

void efx_remove_interrupts(struct efx_nic *efx)
{}

/***************
 * EVENT QUEUES
 ***************/

/* Create event queue
 * Event queue memory allocations are done only once.  If the channel
 * is reset, the memory buffer will be reused; this guards against
 * errors during channel reset and also simplifies interrupt handling.
 */
int efx_probe_eventq(struct efx_channel *channel)
{}

/* Prepare channel's event queue */
int efx_init_eventq(struct efx_channel *channel)
{}

/* Enable event queue processing and NAPI */
void efx_start_eventq(struct efx_channel *channel)
{}

/* Disable event queue processing and NAPI */
void efx_stop_eventq(struct efx_channel *channel)
{}

void efx_fini_eventq(struct efx_channel *channel)
{}

void efx_remove_eventq(struct efx_channel *channel)
{}

/**************************************************************************
 *
 * Channel handling
 *
 *************************************************************************/

#ifdef CONFIG_RFS_ACCEL
static void efx_filter_rfs_expire(struct work_struct *data)
{}
#endif

/* Allocate and initialise a channel structure. */
static struct efx_channel *efx_alloc_channel(struct efx_nic *efx, int i)
{}

int efx_init_channels(struct efx_nic *efx)
{}

void efx_fini_channels(struct efx_nic *efx)
{}

/* Allocate and initialise a channel structure, copying parameters
 * (but not resources) from an old channel structure.
 */
struct efx_channel *efx_copy_channel(const struct efx_channel *old_channel)
{}

static int efx_probe_channel(struct efx_channel *channel)
{}

static void efx_get_channel_name(struct efx_channel *channel, char *buf,
				 size_t len)
{}

void efx_set_channel_names(struct efx_nic *efx)
{}

int efx_probe_channels(struct efx_nic *efx)
{}

void efx_remove_channel(struct efx_channel *channel)
{}

void efx_remove_channels(struct efx_nic *efx)
{}

static int efx_set_xdp_tx_queue(struct efx_nic *efx, int xdp_queue_number,
				struct efx_tx_queue *tx_queue)
{}

static void efx_set_xdp_channels(struct efx_nic *efx)
{}

int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)
{}

int efx_set_channels(struct efx_nic *efx)
{}

static bool efx_default_channel_want_txqs(struct efx_channel *channel)
{}

/*************
 * START/STOP
 *************/

int efx_soft_enable_interrupts(struct efx_nic *efx)
{}

void efx_soft_disable_interrupts(struct efx_nic *efx)
{}

int efx_enable_interrupts(struct efx_nic *efx)
{}

void efx_disable_interrupts(struct efx_nic *efx)
{}

void efx_start_channels(struct efx_nic *efx)
{}

void efx_stop_channels(struct efx_nic *efx)
{}

/**************************************************************************
 *
 * NAPI interface
 *
 *************************************************************************/

/* Process channel's event queue
 *
 * This function is responsible for processing the event queue of a
 * single channel.  The caller must guarantee that this function will
 * never be concurrently called more than once on the same channel,
 * though different channels may be being processed concurrently.
 */
static int efx_process_channel(struct efx_channel *channel, int budget)
{}

static void efx_update_irq_mod(struct efx_nic *efx, struct efx_channel *channel)
{}

/* NAPI poll handler
 *
 * NAPI guarantees serialisation of polls of the same device, which
 * provides the guarantee required by efx_process_channel().
 */
static int efx_poll(struct napi_struct *napi, int budget)
{}

void efx_init_napi_channel(struct efx_channel *channel)
{}

void efx_init_napi(struct efx_nic *efx)
{}

void efx_fini_napi_channel(struct efx_channel *channel)
{}

void efx_fini_napi(struct efx_nic *efx)
{}

/***************
 * Housekeeping
 ***************/

static int efx_channel_dummy_op_int(struct efx_channel *channel)
{}

void efx_channel_dummy_op_void(struct efx_channel *channel)
{}

static const struct efx_channel_type efx_default_channel_type =;