Commit 0484e0db authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

sfc: Move shared members of struct falcon_nic_data into struct efx_nic

These will also be used with Siena NICs.
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 59cf09cc
...@@ -35,19 +35,12 @@ ...@@ -35,19 +35,12 @@
/** /**
* struct falcon_nic_data - Falcon NIC state * struct falcon_nic_data - Falcon NIC state
* @next_buffer_table: First available buffer table id
* @pci_dev2: The secondary PCI device if present * @pci_dev2: The secondary PCI device if present
* @i2c_data: Operations and state for I2C bit-bashing algorithm * @i2c_data: Operations and state for I2C bit-bashing algorithm
* @int_error_count: Number of internal errors seen recently
* @int_error_expire: Time at which error count will be expired
*/ */
struct falcon_nic_data { struct falcon_nic_data {
unsigned next_buffer_table;
struct pci_dev *pci_dev2; struct pci_dev *pci_dev2;
struct i2c_algo_bit_data i2c_data; struct i2c_algo_bit_data i2c_data;
unsigned int_error_count;
unsigned long int_error_expire;
}; };
/************************************************************************** /**************************************************************************
...@@ -304,8 +297,6 @@ static int falcon_alloc_special_buffer(struct efx_nic *efx, ...@@ -304,8 +297,6 @@ static int falcon_alloc_special_buffer(struct efx_nic *efx,
struct efx_special_buffer *buffer, struct efx_special_buffer *buffer,
unsigned int len) unsigned int len)
{ {
struct falcon_nic_data *nic_data = efx->nic_data;
len = ALIGN(len, FALCON_BUF_SIZE); len = ALIGN(len, FALCON_BUF_SIZE);
buffer->addr = pci_alloc_consistent(efx->pci_dev, len, buffer->addr = pci_alloc_consistent(efx->pci_dev, len,
...@@ -320,8 +311,8 @@ static int falcon_alloc_special_buffer(struct efx_nic *efx, ...@@ -320,8 +311,8 @@ static int falcon_alloc_special_buffer(struct efx_nic *efx,
memset(buffer->addr, 0xff, len); memset(buffer->addr, 0xff, len);
/* Select new buffer ID */ /* Select new buffer ID */
buffer->index = nic_data->next_buffer_table; buffer->index = efx->next_buffer_table;
nic_data->next_buffer_table += buffer->entries; efx->next_buffer_table += buffer->entries;
EFX_LOG(efx, "allocating special buffers %d-%d at %llx+%x " EFX_LOG(efx, "allocating special buffers %d-%d at %llx+%x "
"(virt %p phys %llx)\n", buffer->index, "(virt %p phys %llx)\n", buffer->index,
...@@ -1411,13 +1402,13 @@ static irqreturn_t falcon_fatal_interrupt(struct efx_nic *efx) ...@@ -1411,13 +1402,13 @@ static irqreturn_t falcon_fatal_interrupt(struct efx_nic *efx)
falcon_disable_interrupts(efx); falcon_disable_interrupts(efx);
/* Count errors and reset or disable the NIC accordingly */ /* Count errors and reset or disable the NIC accordingly */
if (nic_data->int_error_count == 0 || if (efx->int_error_count == 0 ||
time_after(jiffies, nic_data->int_error_expire)) { time_after(jiffies, efx->int_error_expire)) {
nic_data->int_error_count = 0; efx->int_error_count = 0;
nic_data->int_error_expire = efx->int_error_expire =
jiffies + FALCON_INT_ERROR_EXPIRE * HZ; jiffies + FALCON_INT_ERROR_EXPIRE * HZ;
} }
if (++nic_data->int_error_count < FALCON_MAX_INT_ERRORS) { if (++efx->int_error_count < FALCON_MAX_INT_ERRORS) {
EFX_ERR(efx, "SYSTEM ERROR - reset scheduled\n"); EFX_ERR(efx, "SYSTEM ERROR - reset scheduled\n");
efx_schedule_reset(efx, RESET_TYPE_INT_ERROR); efx_schedule_reset(efx, RESET_TYPE_INT_ERROR);
} else { } else {
......
...@@ -688,10 +688,13 @@ union efx_multicast_hash { ...@@ -688,10 +688,13 @@ union efx_multicast_hash {
* @tx_queue: TX DMA queues * @tx_queue: TX DMA queues
* @rx_queue: RX DMA queues * @rx_queue: RX DMA queues
* @channel: Channels * @channel: Channels
* @next_buffer_table: First available buffer table id
* @n_rx_queues: Number of RX queues * @n_rx_queues: Number of RX queues
* @n_channels: Number of channels in use * @n_channels: Number of channels in use
* @rx_buffer_len: RX buffer length * @rx_buffer_len: RX buffer length
* @rx_buffer_order: Order (log2) of number of pages for each RX buffer * @rx_buffer_order: Order (log2) of number of pages for each RX buffer
* @int_error_count: Number of internal errors seen recently
* @int_error_expire: Time at which error count will be expired
* @irq_status: Interrupt status buffer * @irq_status: Interrupt status buffer
* @last_irq_cpu: Last CPU to handle interrupt. * @last_irq_cpu: Last CPU to handle interrupt.
* This register is written with the SMP processor ID whenever an * This register is written with the SMP processor ID whenever an
...@@ -775,11 +778,15 @@ struct efx_nic { ...@@ -775,11 +778,15 @@ struct efx_nic {
struct efx_rx_queue rx_queue[EFX_MAX_RX_QUEUES]; struct efx_rx_queue rx_queue[EFX_MAX_RX_QUEUES];
struct efx_channel channel[EFX_MAX_CHANNELS]; struct efx_channel channel[EFX_MAX_CHANNELS];
unsigned next_buffer_table;
int n_rx_queues; int n_rx_queues;
int n_channels; int n_channels;
unsigned int rx_buffer_len; unsigned int rx_buffer_len;
unsigned int rx_buffer_order; unsigned int rx_buffer_order;
unsigned int_error_count;
unsigned long int_error_expire;
struct efx_buffer irq_status; struct efx_buffer irq_status;
volatile signed int last_irq_cpu; volatile signed int last_irq_cpu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment