diff options
author | Stuart Hodgson <smhodgson@solarflare.com> | 2012-07-16 12:08:33 -0400 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2012-09-07 16:13:38 -0400 |
commit | 79d68b370074044d7a9dd789ee103ffe5ef00bda (patch) | |
tree | e516dcdfd499499fa718ddb6bdf6b7c7210c30fc | |
parent | 220a60a425146b0e37998cc0b3082f0541aad866 (diff) |
sfc: Add explicit RX queue flag to channel
The PTP channel will have its own RX queue even though it's not
a regular traffic channel.
Original work by Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Stuart Hodgson <smhodgson@solarflare.com>
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/net_driver.h | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/sfc/rx.c | 7 |
3 files changed, 16 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index a606db43c5ba..342a1f31e5b8 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -1451,10 +1451,16 @@ static void efx_set_channels(struct efx_nic *efx) | |||
1451 | efx->tx_channel_offset = | 1451 | efx->tx_channel_offset = |
1452 | separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0; | 1452 | separate_tx_channels ? efx->n_channels - efx->n_tx_channels : 0; |
1453 | 1453 | ||
1454 | /* We need to adjust the TX queue numbers if we have separate | 1454 | /* We need to mark which channels really have RX and TX |
1455 | * queues, and adjust the TX queue numbers if we have separate | ||
1455 | * RX-only and TX-only channels. | 1456 | * RX-only and TX-only channels. |
1456 | */ | 1457 | */ |
1457 | efx_for_each_channel(channel, efx) { | 1458 | efx_for_each_channel(channel, efx) { |
1459 | if (channel->channel < efx->n_rx_channels) | ||
1460 | channel->rx_queue.core_index = channel->channel; | ||
1461 | else | ||
1462 | channel->rx_queue.core_index = -1; | ||
1463 | |||
1458 | efx_for_each_channel_tx_queue(tx_queue, channel) | 1464 | efx_for_each_channel_tx_queue(tx_queue, channel) |
1459 | tx_queue->queue -= (efx->tx_channel_offset * | 1465 | tx_queue->queue -= (efx->tx_channel_offset * |
1460 | EFX_TXQ_TYPES); | 1466 | EFX_TXQ_TYPES); |
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h index 7ab1232494ef..24a78a35bddb 100644 --- a/drivers/net/ethernet/sfc/net_driver.h +++ b/drivers/net/ethernet/sfc/net_driver.h | |||
@@ -242,6 +242,8 @@ struct efx_rx_page_state { | |||
242 | /** | 242 | /** |
243 | * struct efx_rx_queue - An Efx RX queue | 243 | * struct efx_rx_queue - An Efx RX queue |
244 | * @efx: The associated Efx NIC | 244 | * @efx: The associated Efx NIC |
245 | * @core_index: Index of network core RX queue. Will be >= 0 iff this | ||
246 | * is associated with a real RX queue. | ||
245 | * @buffer: The software buffer ring | 247 | * @buffer: The software buffer ring |
246 | * @rxd: The hardware descriptor ring | 248 | * @rxd: The hardware descriptor ring |
247 | * @ptr_mask: The size of the ring minus 1. | 249 | * @ptr_mask: The size of the ring minus 1. |
@@ -263,6 +265,7 @@ struct efx_rx_page_state { | |||
263 | */ | 265 | */ |
264 | struct efx_rx_queue { | 266 | struct efx_rx_queue { |
265 | struct efx_nic *efx; | 267 | struct efx_nic *efx; |
268 | int core_index; | ||
266 | struct efx_rx_buffer *buffer; | 269 | struct efx_rx_buffer *buffer; |
267 | struct efx_special_buffer rxd; | 270 | struct efx_special_buffer rxd; |
268 | unsigned int ptr_mask; | 271 | unsigned int ptr_mask; |
@@ -1047,7 +1050,7 @@ static inline bool efx_tx_queue_used(struct efx_tx_queue *tx_queue) | |||
1047 | 1050 | ||
1048 | static inline bool efx_channel_has_rx_queue(struct efx_channel *channel) | 1051 | static inline bool efx_channel_has_rx_queue(struct efx_channel *channel) |
1049 | { | 1052 | { |
1050 | return channel->channel < channel->efx->n_rx_channels; | 1053 | return channel->rx_queue.core_index >= 0; |
1051 | } | 1054 | } |
1052 | 1055 | ||
1053 | static inline struct efx_rx_queue * | 1056 | static inline struct efx_rx_queue * |
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 719319b89d7a..e997f83f14f5 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c | |||
@@ -479,7 +479,7 @@ static void efx_rx_packet_gro(struct efx_channel *channel, | |||
479 | skb->ip_summed = ((rx_buf->flags & EFX_RX_PKT_CSUMMED) ? | 479 | skb->ip_summed = ((rx_buf->flags & EFX_RX_PKT_CSUMMED) ? |
480 | CHECKSUM_UNNECESSARY : CHECKSUM_NONE); | 480 | CHECKSUM_UNNECESSARY : CHECKSUM_NONE); |
481 | 481 | ||
482 | skb_record_rx_queue(skb, channel->channel); | 482 | skb_record_rx_queue(skb, channel->rx_queue.core_index); |
483 | 483 | ||
484 | gro_result = napi_gro_frags(napi); | 484 | gro_result = napi_gro_frags(napi); |
485 | } else { | 485 | } else { |
@@ -571,6 +571,9 @@ static void efx_rx_deliver(struct efx_channel *channel, | |||
571 | /* Set the SKB flags */ | 571 | /* Set the SKB flags */ |
572 | skb_checksum_none_assert(skb); | 572 | skb_checksum_none_assert(skb); |
573 | 573 | ||
574 | /* Record the rx_queue */ | ||
575 | skb_record_rx_queue(skb, channel->rx_queue.core_index); | ||
576 | |||
574 | /* Pass the packet up */ | 577 | /* Pass the packet up */ |
575 | netif_receive_skb(skb); | 578 | netif_receive_skb(skb); |
576 | 579 | ||
@@ -608,7 +611,7 @@ void __efx_rx_packet(struct efx_channel *channel, struct efx_rx_buffer *rx_buf) | |||
608 | * at the ethernet header */ | 611 | * at the ethernet header */ |
609 | skb->protocol = eth_type_trans(skb, efx->net_dev); | 612 | skb->protocol = eth_type_trans(skb, efx->net_dev); |
610 | 613 | ||
611 | skb_record_rx_queue(skb, channel->channel); | 614 | skb_record_rx_queue(skb, channel->rx_queue.core_index); |
612 | } | 615 | } |
613 | 616 | ||
614 | if (unlikely(!(efx->net_dev->features & NETIF_F_RXCSUM))) | 617 | if (unlikely(!(efx->net_dev->features & NETIF_F_RXCSUM))) |