Commit 2ae75dac authored by Ben Hutchings's avatar Ben Hutchings

sfc: Generate RX fill events based on RX queues, not channels

This makes it harder to accidentally send such events to TX-only
channels.
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
parent 4ef594eb
...@@ -66,8 +66,9 @@ ...@@ -66,8 +66,9 @@
#define EFX_CHANNEL_MAGIC_TEST(_channel) \ #define EFX_CHANNEL_MAGIC_TEST(_channel) \
_EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_TEST, (_channel)->channel) _EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_TEST, (_channel)->channel)
#define EFX_CHANNEL_MAGIC_FILL(_channel) \ #define EFX_CHANNEL_MAGIC_FILL(_rx_queue) \
_EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_FILL, (_channel)->channel) _EFX_CHANNEL_MAGIC(_EFX_CHANNEL_MAGIC_FILL, \
efx_rx_queue_index(_rx_queue))
/************************************************************************** /**************************************************************************
* *
...@@ -912,17 +913,20 @@ static void ...@@ -912,17 +913,20 @@ static void
efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event) efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event)
{ {
struct efx_nic *efx = channel->efx; struct efx_nic *efx = channel->efx;
struct efx_rx_queue *rx_queue =
efx_channel_has_rx_queue(channel) ?
efx_channel_get_rx_queue(channel) : NULL;
unsigned magic; unsigned magic;
magic = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC); magic = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC);
if (magic == EFX_CHANNEL_MAGIC_TEST(channel)) if (magic == EFX_CHANNEL_MAGIC_TEST(channel))
; /* ignore */ ; /* ignore */
else if (magic == EFX_CHANNEL_MAGIC_FILL(channel)) else if (rx_queue && magic == EFX_CHANNEL_MAGIC_FILL(rx_queue))
/* The queue must be empty, so we won't receive any rx /* The queue must be empty, so we won't receive any rx
* events, so efx_process_channel() won't refill the * events, so efx_process_channel() won't refill the
* queue. Refill it here */ * queue. Refill it here */
efx_fast_push_rx_descriptors(efx_channel_get_rx_queue(channel)); efx_fast_push_rx_descriptors(rx_queue);
else else
netif_dbg(efx, hw, efx->net_dev, "channel %d received " netif_dbg(efx, hw, efx->net_dev, "channel %d received "
"generated event "EFX_QWORD_FMT"\n", "generated event "EFX_QWORD_FMT"\n",
...@@ -1150,9 +1154,10 @@ void efx_nic_generate_test_event(struct efx_channel *channel) ...@@ -1150,9 +1154,10 @@ void efx_nic_generate_test_event(struct efx_channel *channel)
efx_magic_event(channel, EFX_CHANNEL_MAGIC_TEST(channel)); efx_magic_event(channel, EFX_CHANNEL_MAGIC_TEST(channel));
} }
void efx_nic_generate_fill_event(struct efx_channel *channel) void efx_nic_generate_fill_event(struct efx_rx_queue *rx_queue)
{ {
efx_magic_event(channel, EFX_CHANNEL_MAGIC_FILL(channel)); efx_magic_event(efx_rx_queue_channel(rx_queue),
EFX_CHANNEL_MAGIC_FILL(rx_queue));
} }
/************************************************************************** /**************************************************************************
......
...@@ -195,6 +195,7 @@ extern void efx_nic_init_rx(struct efx_rx_queue *rx_queue); ...@@ -195,6 +195,7 @@ extern void efx_nic_init_rx(struct efx_rx_queue *rx_queue);
extern void efx_nic_fini_rx(struct efx_rx_queue *rx_queue); extern void efx_nic_fini_rx(struct efx_rx_queue *rx_queue);
extern void efx_nic_remove_rx(struct efx_rx_queue *rx_queue); extern void efx_nic_remove_rx(struct efx_rx_queue *rx_queue);
extern void efx_nic_notify_rx_desc(struct efx_rx_queue *rx_queue); extern void efx_nic_notify_rx_desc(struct efx_rx_queue *rx_queue);
extern void efx_nic_generate_fill_event(struct efx_rx_queue *rx_queue);
/* Event data path */ /* Event data path */
extern int efx_nic_probe_eventq(struct efx_channel *channel); extern int efx_nic_probe_eventq(struct efx_channel *channel);
...@@ -216,7 +217,6 @@ extern void falcon_update_stats_xmac(struct efx_nic *efx); ...@@ -216,7 +217,6 @@ extern void falcon_update_stats_xmac(struct efx_nic *efx);
extern int efx_nic_init_interrupt(struct efx_nic *efx); extern int efx_nic_init_interrupt(struct efx_nic *efx);
extern void efx_nic_enable_interrupts(struct efx_nic *efx); extern void efx_nic_enable_interrupts(struct efx_nic *efx);
extern void efx_nic_generate_test_event(struct efx_channel *channel); extern void efx_nic_generate_test_event(struct efx_channel *channel);
extern void efx_nic_generate_fill_event(struct efx_channel *channel);
extern void efx_nic_generate_interrupt(struct efx_nic *efx); extern void efx_nic_generate_interrupt(struct efx_nic *efx);
extern void efx_nic_disable_interrupts(struct efx_nic *efx); extern void efx_nic_disable_interrupts(struct efx_nic *efx);
extern void efx_nic_fini_interrupt(struct efx_nic *efx); extern void efx_nic_fini_interrupt(struct efx_nic *efx);
......
...@@ -405,10 +405,9 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue) ...@@ -405,10 +405,9 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue)
void efx_rx_slow_fill(unsigned long context) void efx_rx_slow_fill(unsigned long context)
{ {
struct efx_rx_queue *rx_queue = (struct efx_rx_queue *)context; struct efx_rx_queue *rx_queue = (struct efx_rx_queue *)context;
struct efx_channel *channel = efx_rx_queue_channel(rx_queue);
/* Post an event to cause NAPI to run and refill the queue */ /* Post an event to cause NAPI to run and refill the queue */
efx_nic_generate_fill_event(channel); efx_nic_generate_fill_event(rx_queue);
++rx_queue->slow_fill_count; ++rx_queue->slow_fill_count;
} }
......
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