We're starting from a TXQ instance number ('qid'), not a TXQ type, so
 efx_get_tx_queue() is inappropriate (and could return NULL, leading
 to panics).

Fixes: 12804793b17c ("sfc: decouple TXQ type from label")
Reported-by: Trevor Hemsley <thems...@voiceflex.com>
Cc: sta...@vger.kernel.org
Signed-off-by: Edward Cree <ecree.xil...@gmail.com>
---
 drivers/net/ethernet/sfc/farch.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c
index d75cf5ff5686..f89ebe0073dd 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -1081,16 +1081,16 @@ static u16 efx_farch_handle_rx_not_ok(struct 
efx_rx_queue *rx_queue,
 efx_farch_handle_tx_flush_done(struct efx_nic *efx, efx_qword_t *event)
 {
        struct efx_tx_queue *tx_queue;
+       struct efx_channel *channel;
        int qid;
 
        qid = EFX_QWORD_FIELD(*event, FSF_AZ_DRIVER_EV_SUBDATA);
        if (qid < EFX_MAX_TXQ_PER_CHANNEL * (efx->n_tx_channels + 
efx->n_extra_tx_channels)) {
-               tx_queue = efx_get_tx_queue(efx, qid / EFX_MAX_TXQ_PER_CHANNEL,
-                                           qid % EFX_MAX_TXQ_PER_CHANNEL);
-               if (atomic_cmpxchg(&tx_queue->flush_outstanding, 1, 0)) {
+               channel = efx_get_tx_channel(efx, qid / 
EFX_MAX_TXQ_PER_CHANNEL);
+               tx_queue = channel->tx_queue + (qid % EFX_MAX_TXQ_PER_CHANNEL);
+               if (atomic_cmpxchg(&tx_queue->flush_outstanding, 1, 0))
                        efx_farch_magic_event(tx_queue->channel,
                                              
EFX_CHANNEL_MAGIC_TX_DRAIN(tx_queue));
-               }
        }
 }
 
-- 
1.8.3.1

Reply via email to