6666#define EFX_TXQ_TYPE_OFFLOAD 1 /* flag */
6767#define EFX_TXQ_TYPE_HIGHPRI 2 /* flag */
6868#define EFX_TXQ_TYPES 4
69- #define EFX_MAX_TX_QUEUES (EFX_TXQ_TYPES * EFX_MAX_CHANNELS)
69+ #define EFX_MAX_TXQ_PER_CHANNEL 4
70+ #define EFX_MAX_TX_QUEUES (EFX_MAX_TXQ_PER_CHANNEL * EFX_MAX_CHANNELS)
7071
7172/* Maximum possible MTU the driver supports */
7273#define EFX_MAX_MTU (9 * 1024)
@@ -190,6 +191,7 @@ struct efx_tx_buffer {
190191 * @queue: DMA queue number
191192 * @label: Label for TX completion events.
192193 * Is our index within @channel->tx_queue array.
194+ * @type: configuration type of this TX queue. A bitmask of %EFX_TXQ_TYPE_* flags.
193195 * @tso_version: Version of TSO in use for this queue.
194196 * @channel: The associated channel
195197 * @core_txq: The networking core TX queue structure
@@ -254,6 +256,7 @@ struct efx_tx_queue {
254256 struct efx_nic * efx ____cacheline_aligned_in_smp ;
255257 unsigned int queue ;
256258 unsigned int label ;
259+ unsigned int type ;
257260 unsigned int tso_version ;
258261 struct efx_channel * channel ;
259262 struct netdev_queue * core_txq ;
@@ -479,6 +482,7 @@ enum efx_sync_events_state {
479482 * @rx_list: list of SKBs from current RX, awaiting processing
480483 * @rx_queue: RX queue for this channel
481484 * @tx_queue: TX queues for this channel
485+ * @tx_queue_by_type: pointers into @tx_queue, or %NULL, indexed by txq type
482486 * @sync_events_state: Current state of sync events on this channel
483487 * @sync_timestamp_major: Major part of the last ptp sync event
484488 * @sync_timestamp_minor: Minor part of the last ptp sync event
@@ -540,7 +544,8 @@ struct efx_channel {
540544 struct list_head * rx_list ;
541545
542546 struct efx_rx_queue rx_queue ;
543- struct efx_tx_queue tx_queue [EFX_TXQ_TYPES ];
547+ struct efx_tx_queue tx_queue [EFX_MAX_TXQ_PER_CHANNEL ];
548+ struct efx_tx_queue * tx_queue_by_type [EFX_TXQ_TYPES ];
544549
545550 enum efx_sync_events_state sync_events_state ;
546551 u32 sync_timestamp_major ;
@@ -1200,7 +1205,7 @@ struct efx_udp_tunnel {
12001205 * a pointer to the &struct efx_msi_context for the channel.
12011206 * @irq_handle_legacy: Handle legacy interrupt. The @dev_id argument
12021207 * is a pointer to the &struct efx_nic.
1203- * @tx_probe: Allocate resources for TX queue
1208+ * @tx_probe: Allocate resources for TX queue (and select TXQ type)
12041209 * @tx_init: Initialise TX queue on the NIC
12051210 * @tx_remove: Free resources for TX queue
12061211 * @tx_write: Write TX descriptors and doorbell
@@ -1495,14 +1500,6 @@ efx_get_tx_channel(struct efx_nic *efx, unsigned int index)
14951500 return efx -> channel [efx -> tx_channel_offset + index ];
14961501}
14971502
1498- static inline struct efx_tx_queue *
1499- efx_get_tx_queue (struct efx_nic * efx , unsigned index , unsigned type )
1500- {
1501- EFX_WARN_ON_ONCE_PARANOID (index >= efx -> n_tx_channels ||
1502- type >= efx -> tx_queues_per_channel );
1503- return & efx -> channel [efx -> tx_channel_offset + index ]-> tx_queue [type ];
1504- }
1505-
15061503static inline struct efx_channel *
15071504efx_get_xdp_channel (struct efx_nic * efx , unsigned int index )
15081505{
@@ -1529,10 +1526,18 @@ static inline unsigned int efx_channel_num_tx_queues(struct efx_channel *channel
15291526}
15301527
15311528static inline struct efx_tx_queue *
1532- efx_channel_get_tx_queue (struct efx_channel * channel , unsigned type )
1529+ efx_channel_get_tx_queue (struct efx_channel * channel , unsigned int type )
15331530{
1534- EFX_WARN_ON_ONCE_PARANOID (type >= efx_channel_num_tx_queues (channel ));
1535- return & channel -> tx_queue [type ];
1531+ EFX_WARN_ON_ONCE_PARANOID (type >= EFX_TXQ_TYPES );
1532+ return channel -> tx_queue_by_type [type ];
1533+ }
1534+
1535+ static inline struct efx_tx_queue *
1536+ efx_get_tx_queue (struct efx_nic * efx , unsigned int index , unsigned int type )
1537+ {
1538+ struct efx_channel * channel = efx_get_tx_channel (efx , index );
1539+
1540+ return efx_channel_get_tx_queue (channel , type );
15361541}
15371542
15381543/* Iterate over all TX queues belonging to a channel */
0 commit comments