Commit 0d8c1229 authored by Edward Cree's avatar Edward Cree Committed by Jakub Kicinski

sfc: use efx_channel_tx_[old_]fill_level() in Siena/EF10 TX datapath

Instead of open-coding the calculation with efx_tx_queue_partner(), use
 the functions that iterate over numbers of queues other than 2 with
 efx_for_each_channel_tx_queue().
Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5374d602
...@@ -1681,10 +1681,6 @@ efx_channel_tx_fill_level(struct efx_channel *channel) ...@@ -1681,10 +1681,6 @@ efx_channel_tx_fill_level(struct efx_channel *channel)
struct efx_tx_queue *tx_queue; struct efx_tx_queue *tx_queue;
unsigned int fill_level = 0; unsigned int fill_level = 0;
/* This function is currently only used by EF100, which maybe
* could do something simpler and just compute the fill level
* of the single TXQ that's really in use.
*/
efx_for_each_channel_tx_queue(tx_queue, channel) efx_for_each_channel_tx_queue(tx_queue, channel)
fill_level = max(fill_level, fill_level = max(fill_level,
tx_queue->insert_count - tx_queue->read_count); tx_queue->insert_count - tx_queue->read_count);
......
...@@ -59,13 +59,12 @@ u8 *efx_tx_get_copy_buffer_limited(struct efx_tx_queue *tx_queue, ...@@ -59,13 +59,12 @@ u8 *efx_tx_get_copy_buffer_limited(struct efx_tx_queue *tx_queue,
static void efx_tx_maybe_stop_queue(struct efx_tx_queue *txq1) static void efx_tx_maybe_stop_queue(struct efx_tx_queue *txq1)
{ {
/* We need to consider both queues that the net core sees as one */ /* We need to consider all queues that the net core sees as one */
struct efx_tx_queue *txq2 = efx_tx_queue_partner(txq1);
struct efx_nic *efx = txq1->efx; struct efx_nic *efx = txq1->efx;
struct efx_tx_queue *txq2;
unsigned int fill_level; unsigned int fill_level;
fill_level = max(txq1->insert_count - txq1->old_read_count, fill_level = efx_channel_tx_old_fill_level(txq1->channel);
txq2->insert_count - txq2->old_read_count);
if (likely(fill_level < efx->txq_stop_thresh)) if (likely(fill_level < efx->txq_stop_thresh))
return; return;
...@@ -85,11 +84,10 @@ static void efx_tx_maybe_stop_queue(struct efx_tx_queue *txq1) ...@@ -85,11 +84,10 @@ static void efx_tx_maybe_stop_queue(struct efx_tx_queue *txq1)
*/ */
netif_tx_stop_queue(txq1->core_txq); netif_tx_stop_queue(txq1->core_txq);
smp_mb(); smp_mb();
txq1->old_read_count = READ_ONCE(txq1->read_count); efx_for_each_channel_tx_queue(txq2, txq1->channel)
txq2->old_read_count = READ_ONCE(txq2->read_count); txq2->old_read_count = READ_ONCE(txq2->read_count);
fill_level = max(txq1->insert_count - txq1->old_read_count, fill_level = efx_channel_tx_old_fill_level(txq1->channel);
txq2->insert_count - txq2->old_read_count);
EFX_WARN_ON_ONCE_PARANOID(fill_level >= efx->txq_entries); EFX_WARN_ON_ONCE_PARANOID(fill_level >= efx->txq_entries);
if (likely(fill_level < efx->txq_stop_thresh)) { if (likely(fill_level < efx->txq_stop_thresh)) {
smp_mb(); smp_mb();
......
...@@ -242,7 +242,6 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) ...@@ -242,7 +242,6 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
{ {
unsigned int fill_level, pkts_compl = 0, bytes_compl = 0; unsigned int fill_level, pkts_compl = 0, bytes_compl = 0;
struct efx_nic *efx = tx_queue->efx; struct efx_nic *efx = tx_queue->efx;
struct efx_tx_queue *txq2;
EFX_WARN_ON_ONCE_PARANOID(index > tx_queue->ptr_mask); EFX_WARN_ON_ONCE_PARANOID(index > tx_queue->ptr_mask);
...@@ -261,9 +260,7 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) ...@@ -261,9 +260,7 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) && if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) &&
likely(efx->port_enabled) && likely(efx->port_enabled) &&
likely(netif_device_present(efx->net_dev))) { likely(netif_device_present(efx->net_dev))) {
txq2 = efx_tx_queue_partner(tx_queue); fill_level = efx_channel_tx_fill_level(tx_queue->channel);
fill_level = max(tx_queue->insert_count - tx_queue->read_count,
txq2->insert_count - txq2->read_count);
if (fill_level <= efx->txq_wake_thresh) if (fill_level <= efx->txq_wake_thresh)
netif_tx_wake_queue(tx_queue->core_txq); netif_tx_wake_queue(tx_queue->core_txq);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment