aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/net_driver.h
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-02-13 18:45:02 -0500
committerBen Hutchings <bhutchings@solarflare.com>2012-02-15 19:25:10 -0500
commit7f967c011ae9c59fc7e7a017070ef7b22a5a4fbf (patch)
treec3ad2e039a8596ecbf9c7d1dc58bc8a251ecd8d2 /drivers/net/ethernet/sfc/net_driver.h
parenta16e5b246c5b1aff3141ca6ae443307f3241a133 (diff)
sfc: Add support for 'extra' channel types
Abstract some of the channel operations to allow for 'extra' channels that do not have RX or TX queues. - Try to assign a channel to each extra channel type that is enabled for the NIC, but gracefully degrade if we can't allocate sufficient MSI-X vectors - Allow each extra channel type to generate its own channel name - Allow channel types to disable reallocation and reinitialisation of their channels 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.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 3260e7137918..94b0dcab897f 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -54,6 +54,7 @@
54 54
55#define EFX_MAX_CHANNELS 32U 55#define EFX_MAX_CHANNELS 32U
56#define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS 56#define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS
57#define EFX_MAX_EXTRA_CHANNELS 0U
57 58
58/* Checksum generation is a per-queue option in hardware, so each 59/* Checksum generation is a per-queue option in hardware, so each
59 * queue visible to the networking core is backed by two hardware TX 60 * queue visible to the networking core is backed by two hardware TX
@@ -311,6 +312,7 @@ enum efx_rx_alloc_method {
311 * 312 *
312 * @efx: Associated Efx NIC 313 * @efx: Associated Efx NIC
313 * @channel: Channel instance number 314 * @channel: Channel instance number
315 * @type: Channel type definition
314 * @enabled: Channel enabled indicator 316 * @enabled: Channel enabled indicator
315 * @irq: IRQ number (MSI and MSI-X only) 317 * @irq: IRQ number (MSI and MSI-X only)
316 * @irq_moderation: IRQ moderation value (in hardware ticks) 318 * @irq_moderation: IRQ moderation value (in hardware ticks)
@@ -341,6 +343,7 @@ enum efx_rx_alloc_method {
341struct efx_channel { 343struct efx_channel {
342 struct efx_nic *efx; 344 struct efx_nic *efx;
343 int channel; 345 int channel;
346 const struct efx_channel_type *type;
344 bool enabled; 347 bool enabled;
345 int irq; 348 int irq;
346 unsigned int irq_moderation; 349 unsigned int irq_moderation;
@@ -379,6 +382,26 @@ struct efx_channel {
379 struct efx_tx_queue tx_queue[EFX_TXQ_TYPES]; 382 struct efx_tx_queue tx_queue[EFX_TXQ_TYPES];
380}; 383};
381 384
385/**
386 * struct efx_channel_type - distinguishes traffic and extra channels
387 * @handle_no_channel: Handle failure to allocate an extra channel
388 * @pre_probe: Set up extra state prior to initialisation
389 * @post_remove: Tear down extra state after finalisation, if allocated.
390 * May be called on channels that have not been probed.
391 * @get_name: Generate the channel's name (used for its IRQ handler)
392 * @copy: Copy the channel state prior to reallocation. May be %NULL if
393 * reallocation is not supported.
394 * @keep_eventq: Flag for whether event queue should be kept initialised
395 * while the device is stopped
396 */
397struct efx_channel_type {
398 void (*handle_no_channel)(struct efx_nic *);
399 int (*pre_probe)(struct efx_channel *);
400 void (*get_name)(struct efx_channel *, char *buf, size_t len);
401 struct efx_channel *(*copy)(const struct efx_channel *);
402 bool keep_eventq;
403};
404
382enum efx_led_mode { 405enum efx_led_mode {
383 EFX_LED_OFF = 0, 406 EFX_LED_OFF = 0,
384 EFX_LED_ON = 1, 407 EFX_LED_ON = 1,
@@ -631,6 +654,8 @@ struct efx_filter_state;
631 * @rx_queue: RX DMA queues 654 * @rx_queue: RX DMA queues
632 * @channel: Channels 655 * @channel: Channels
633 * @channel_name: Names for channels and their IRQs 656 * @channel_name: Names for channels and their IRQs
657 * @extra_channel_types: Types of extra (non-traffic) channels that
658 * should be allocated for this NIC
634 * @rxq_entries: Size of receive queues requested by user. 659 * @rxq_entries: Size of receive queues requested by user.
635 * @txq_entries: Size of transmit queues requested by user. 660 * @txq_entries: Size of transmit queues requested by user.
636 * @next_buffer_table: First available buffer table id 661 * @next_buffer_table: First available buffer table id
@@ -723,6 +748,8 @@ struct efx_nic {
723 748
724 struct efx_channel *channel[EFX_MAX_CHANNELS]; 749 struct efx_channel *channel[EFX_MAX_CHANNELS];
725 char channel_name[EFX_MAX_CHANNELS][IFNAMSIZ + 6]; 750 char channel_name[EFX_MAX_CHANNELS][IFNAMSIZ + 6];
751 const struct efx_channel_type *
752 extra_channel_type[EFX_MAX_EXTRA_CHANNELS];
726 753
727 unsigned rxq_entries; 754 unsigned rxq_entries;
728 unsigned txq_entries; 755 unsigned txq_entries;
@@ -921,6 +948,13 @@ efx_get_channel(struct efx_nic *efx, unsigned index)
921 _channel = (_channel->channel + 1 < (_efx)->n_channels) ? \ 948 _channel = (_channel->channel + 1 < (_efx)->n_channels) ? \
922 (_efx)->channel[_channel->channel + 1] : NULL) 949 (_efx)->channel[_channel->channel + 1] : NULL)
923 950
951/* Iterate over all used channels in reverse */
952#define efx_for_each_channel_rev(_channel, _efx) \
953 for (_channel = (_efx)->channel[(_efx)->n_channels - 1]; \
954 _channel; \
955 _channel = _channel->channel ? \
956 (_efx)->channel[_channel->channel - 1] : NULL)
957
924static inline struct efx_tx_queue * 958static inline struct efx_tx_queue *
925efx_get_tx_queue(struct efx_nic *efx, unsigned index, unsigned type) 959efx_get_tx_queue(struct efx_nic *efx, unsigned index, unsigned type)
926{ 960{