aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/net_driver.h
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-02-07 19:11:20 -0500
committerBen Hutchings <bhutchings@solarflare.com>2012-02-15 19:24:46 -0500
commit9f2cb71c2b0ce33c472856c0feec2883fa0d9cd1 (patch)
treee60e2fc6a18ec5cfaf079e9855246a9282742667 /drivers/net/ethernet/sfc/net_driver.h
parent2ae75dac301b0f255f79cd84ac70c619e55d7694 (diff)
sfc: Leave interrupts and event queues enabled whenever we can
When SR-IOV is enabled we may receive FLR (Function-Level Reset) events, associated queue flush events and requests from VF drivers at any time. Therefore we need to keep event queues and interrupts enabled whenever possible. Currently we stop interrupt-driven event processing before flushing RX and TX queues; efx_nic_flush_queues() then polls event queues for flush events and discards any others it finds. Change it to work with the regular event handling functions. Currently efx_start_channel() fills RX queues synchronously when a device is brought up. This could now race with NAPI, so change it to send fill events. This was almost entirely written by Steve Hodgson, formerly shodgson@solarflare.com. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc/net_driver.h')
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h36
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 53864014c2b4..18c4b3c245e2 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -85,13 +85,6 @@ struct efx_special_buffer {
85 int entries; 85 int entries;
86}; 86};
87 87
88enum efx_flush_state {
89 FLUSH_NONE,
90 FLUSH_PENDING,
91 FLUSH_FAILED,
92 FLUSH_DONE,
93};
94
95/** 88/**
96 * struct efx_tx_buffer - An Efx TX buffer 89 * struct efx_tx_buffer - An Efx TX buffer
97 * @skb: The associated socket buffer. 90 * @skb: The associated socket buffer.
@@ -138,7 +131,6 @@ struct efx_tx_buffer {
138 * @txd: The hardware descriptor ring 131 * @txd: The hardware descriptor ring
139 * @ptr_mask: The size of the ring minus 1. 132 * @ptr_mask: The size of the ring minus 1.
140 * @initialised: Has hardware queue been initialised? 133 * @initialised: Has hardware queue been initialised?
141 * @flushed: Used when handling queue flushing
142 * @read_count: Current read pointer. 134 * @read_count: Current read pointer.
143 * This is the number of buffers that have been removed from both rings. 135 * This is the number of buffers that have been removed from both rings.
144 * @old_write_count: The value of @write_count when last checked. 136 * @old_write_count: The value of @write_count when last checked.
@@ -181,7 +173,6 @@ struct efx_tx_queue {
181 struct efx_special_buffer txd; 173 struct efx_special_buffer txd;
182 unsigned int ptr_mask; 174 unsigned int ptr_mask;
183 bool initialised; 175 bool initialised;
184 enum efx_flush_state flushed;
185 176
186 /* Members used mainly on the completion path */ 177 /* Members used mainly on the completion path */
187 unsigned int read_count ____cacheline_aligned_in_smp; 178 unsigned int read_count ____cacheline_aligned_in_smp;
@@ -249,6 +240,9 @@ struct efx_rx_page_state {
249 * @buffer: The software buffer ring 240 * @buffer: The software buffer ring
250 * @rxd: The hardware descriptor ring 241 * @rxd: The hardware descriptor ring
251 * @ptr_mask: The size of the ring minus 1. 242 * @ptr_mask: The size of the ring minus 1.
243 * @enabled: Receive queue enabled indicator.
244 * @flush_pending: Set when a RX flush is pending. Has the same lifetime as
245 * @rxq_flush_pending.
252 * @added_count: Number of buffers added to the receive queue. 246 * @added_count: Number of buffers added to the receive queue.
253 * @notified_count: Number of buffers given to NIC (<= @added_count). 247 * @notified_count: Number of buffers given to NIC (<= @added_count).
254 * @removed_count: Number of buffers removed from the receive queue. 248 * @removed_count: Number of buffers removed from the receive queue.
@@ -263,13 +257,14 @@ struct efx_rx_page_state {
263 * @alloc_page_count: RX allocation strategy counter. 257 * @alloc_page_count: RX allocation strategy counter.
264 * @alloc_skb_count: RX allocation strategy counter. 258 * @alloc_skb_count: RX allocation strategy counter.
265 * @slow_fill: Timer used to defer efx_nic_generate_fill_event(). 259 * @slow_fill: Timer used to defer efx_nic_generate_fill_event().
266 * @flushed: Use when handling queue flushing
267 */ 260 */
268struct efx_rx_queue { 261struct efx_rx_queue {
269 struct efx_nic *efx; 262 struct efx_nic *efx;
270 struct efx_rx_buffer *buffer; 263 struct efx_rx_buffer *buffer;
271 struct efx_special_buffer rxd; 264 struct efx_special_buffer rxd;
272 unsigned int ptr_mask; 265 unsigned int ptr_mask;
266 bool enabled;
267 bool flush_pending;
273 268
274 int added_count; 269 int added_count;
275 int notified_count; 270 int notified_count;
@@ -283,8 +278,6 @@ struct efx_rx_queue {
283 unsigned int alloc_skb_count; 278 unsigned int alloc_skb_count;
284 struct timer_list slow_fill; 279 struct timer_list slow_fill;
285 unsigned int slow_fill_count; 280 unsigned int slow_fill_count;
286
287 enum efx_flush_state flushed;
288}; 281};
289 282
290/** 283/**
@@ -681,6 +674,13 @@ struct efx_filter_state;
681 * @loopback_mode: Loopback status 674 * @loopback_mode: Loopback status
682 * @loopback_modes: Supported loopback mode bitmask 675 * @loopback_modes: Supported loopback mode bitmask
683 * @loopback_selftest: Offline self-test private state 676 * @loopback_selftest: Offline self-test private state
677 * @drain_pending: Count of RX and TX queues that haven't been flushed and drained.
678 * @rxq_flush_pending: Count of number of receive queues that need to be flushed.
679 * Decremented when the efx_flush_rx_queue() is called.
680 * @rxq_flush_outstanding: Count of number of RX flushes started but not yet
681 * completed (either success or failure). Not used when MCDI is used to
682 * flush receive queues.
683 * @flush_wq: wait queue used by efx_nic_flush_queues() to wait for flush completions.
684 * @monitor_work: Hardware monitor workitem 684 * @monitor_work: Hardware monitor workitem
685 * @biu_lock: BIU (bus interface unit) lock 685 * @biu_lock: BIU (bus interface unit) lock
686 * @last_irq_cpu: Last CPU to handle a possible test interrupt. This 686 * @last_irq_cpu: Last CPU to handle a possible test interrupt. This
@@ -778,6 +778,11 @@ struct efx_nic {
778 778
779 struct efx_filter_state *filter_state; 779 struct efx_filter_state *filter_state;
780 780
781 atomic_t drain_pending;
782 atomic_t rxq_flush_pending;
783 atomic_t rxq_flush_outstanding;
784 wait_queue_head_t flush_wq;
785
781 /* The following fields may be written more often */ 786 /* The following fields may be written more often */
782 787
783 struct delayed_work monitor_work ____cacheline_aligned_in_smp; 788 struct delayed_work monitor_work ____cacheline_aligned_in_smp;
@@ -956,13 +961,6 @@ static inline bool efx_tx_queue_used(struct efx_tx_queue *tx_queue)
956 _tx_queue < (_channel)->tx_queue + EFX_TXQ_TYPES; \ 961 _tx_queue < (_channel)->tx_queue + EFX_TXQ_TYPES; \
957 _tx_queue++) 962 _tx_queue++)
958 963
959static inline struct efx_rx_queue *
960efx_get_rx_queue(struct efx_nic *efx, unsigned index)
961{
962 EFX_BUG_ON_PARANOID(index >= efx->n_rx_channels);
963 return &efx->channel[index]->rx_queue;
964}
965
966static inline bool efx_channel_has_rx_queue(struct efx_channel *channel) 964static inline bool efx_channel_has_rx_queue(struct efx_channel *channel)
967{ 965{
968 return channel->channel < channel->efx->n_rx_channels; 966 return channel->channel < channel->efx->n_rx_channels;