aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/net_driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sfc/net_driver.h')
-rw-r--r--drivers/net/sfc/net_driver.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 77b7ce45151..96e22ad3497 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -63,10 +63,12 @@
63/* Checksum generation is a per-queue option in hardware, so each 63/* Checksum generation is a per-queue option in hardware, so each
64 * queue visible to the networking core is backed by two hardware TX 64 * queue visible to the networking core is backed by two hardware TX
65 * queues. */ 65 * queues. */
66#define EFX_MAX_CORE_TX_QUEUES EFX_MAX_CHANNELS 66#define EFX_MAX_TX_TC 2
67#define EFX_TXQ_TYPE_OFFLOAD 1 67#define EFX_MAX_CORE_TX_QUEUES (EFX_MAX_TX_TC * EFX_MAX_CHANNELS)
68#define EFX_TXQ_TYPES 2 68#define EFX_TXQ_TYPE_OFFLOAD 1 /* flag */
69#define EFX_MAX_TX_QUEUES (EFX_TXQ_TYPES * EFX_MAX_CORE_TX_QUEUES) 69#define EFX_TXQ_TYPE_HIGHPRI 2 /* flag */
70#define EFX_TXQ_TYPES 4
71#define EFX_MAX_TX_QUEUES (EFX_TXQ_TYPES * EFX_MAX_CHANNELS)
70 72
71/** 73/**
72 * struct efx_special_buffer - An Efx special buffer 74 * struct efx_special_buffer - An Efx special buffer
@@ -140,6 +142,7 @@ struct efx_tx_buffer {
140 * @buffer: The software buffer ring 142 * @buffer: The software buffer ring
141 * @txd: The hardware descriptor ring 143 * @txd: The hardware descriptor ring
142 * @ptr_mask: The size of the ring minus 1. 144 * @ptr_mask: The size of the ring minus 1.
145 * @initialised: Has hardware queue been initialised?
143 * @flushed: Used when handling queue flushing 146 * @flushed: Used when handling queue flushing
144 * @read_count: Current read pointer. 147 * @read_count: Current read pointer.
145 * This is the number of buffers that have been removed from both rings. 148 * This is the number of buffers that have been removed from both rings.
@@ -182,6 +185,7 @@ struct efx_tx_queue {
182 struct efx_tx_buffer *buffer; 185 struct efx_tx_buffer *buffer;
183 struct efx_special_buffer txd; 186 struct efx_special_buffer txd;
184 unsigned int ptr_mask; 187 unsigned int ptr_mask;
188 bool initialised;
185 enum efx_flush_state flushed; 189 enum efx_flush_state flushed;
186 190
187 /* Members used mainly on the completion path */ 191 /* Members used mainly on the completion path */
@@ -377,7 +381,7 @@ struct efx_channel {
377 bool rx_pkt_csummed; 381 bool rx_pkt_csummed;
378 382
379 struct efx_rx_queue rx_queue; 383 struct efx_rx_queue rx_queue;
380 struct efx_tx_queue tx_queue[2]; 384 struct efx_tx_queue tx_queue[EFX_TXQ_TYPES];
381}; 385};
382 386
383enum efx_led_mode { 387enum efx_led_mode {
@@ -952,15 +956,28 @@ efx_channel_get_tx_queue(struct efx_channel *channel, unsigned type)
952 return &channel->tx_queue[type]; 956 return &channel->tx_queue[type];
953} 957}
954 958
959static inline bool efx_tx_queue_used(struct efx_tx_queue *tx_queue)
960{
961 return !(tx_queue->efx->net_dev->num_tc < 2 &&
962 tx_queue->queue & EFX_TXQ_TYPE_HIGHPRI);
963}
964
955/* Iterate over all TX queues belonging to a channel */ 965/* Iterate over all TX queues belonging to a channel */
956#define efx_for_each_channel_tx_queue(_tx_queue, _channel) \ 966#define efx_for_each_channel_tx_queue(_tx_queue, _channel) \
957 if (!efx_channel_has_tx_queues(_channel)) \ 967 if (!efx_channel_has_tx_queues(_channel)) \
958 ; \ 968 ; \
959 else \ 969 else \
960 for (_tx_queue = (_channel)->tx_queue; \ 970 for (_tx_queue = (_channel)->tx_queue; \
961 _tx_queue < (_channel)->tx_queue + EFX_TXQ_TYPES; \ 971 _tx_queue < (_channel)->tx_queue + EFX_TXQ_TYPES && \
972 efx_tx_queue_used(_tx_queue); \
962 _tx_queue++) 973 _tx_queue++)
963 974
975/* Iterate over all possible TX queues belonging to a channel */
976#define efx_for_each_possible_channel_tx_queue(_tx_queue, _channel) \
977 for (_tx_queue = (_channel)->tx_queue; \
978 _tx_queue < (_channel)->tx_queue + EFX_TXQ_TYPES; \
979 _tx_queue++)
980
964static inline struct efx_rx_queue * 981static inline struct efx_rx_queue *
965efx_get_rx_queue(struct efx_nic *efx, unsigned index) 982efx_get_rx_queue(struct efx_nic *efx, unsigned index)
966{ 983{