Skip to content

Commit eeddfd8

Browse files
committed
Merge branch 'sfc-txq-lookups'
Edward Cree says: ==================== sfc: fix TXQ lookups The TXQ handling changes in 1280479 ("sfc: decouple TXQ type from label") which were made as part of the support for encap offloads on EF10 caused some breakage on Siena (5000- and 6000-series) NICs, which caused null-dereference kernel panics. This series fixes those issues, and also a similarly incorrect code-path on EF10 which worked by chance. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 4acd476 + 172e269 commit eeddfd8

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

drivers/net/ethernet/sfc/ef10.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,8 +2928,7 @@ efx_ef10_handle_tx_event(struct efx_channel *channel, efx_qword_t *event)
29282928

29292929
/* Get the transmit queue */
29302930
tx_ev_q_label = EFX_QWORD_FIELD(*event, ESF_DZ_TX_QLABEL);
2931-
tx_queue = efx_channel_get_tx_queue(channel,
2932-
tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
2931+
tx_queue = channel->tx_queue + (tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
29332932

29342933
if (!tx_queue->timestamping) {
29352934
/* Transmit completion */

drivers/net/ethernet/sfc/farch.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -835,14 +835,14 @@ efx_farch_handle_tx_event(struct efx_channel *channel, efx_qword_t *event)
835835
/* Transmit completion */
836836
tx_ev_desc_ptr = EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_DESC_PTR);
837837
tx_ev_q_label = EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_Q_LABEL);
838-
tx_queue = efx_channel_get_tx_queue(
839-
channel, tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
838+
tx_queue = channel->tx_queue +
839+
(tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
840840
efx_xmit_done(tx_queue, tx_ev_desc_ptr);
841841
} else if (EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_WQ_FF_FULL)) {
842842
/* Rewrite the FIFO write pointer */
843843
tx_ev_q_label = EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_Q_LABEL);
844-
tx_queue = efx_channel_get_tx_queue(
845-
channel, tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
844+
tx_queue = channel->tx_queue +
845+
(tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
846846

847847
netif_tx_lock(efx->net_dev);
848848
efx_farch_notify_tx_desc(tx_queue);
@@ -1081,16 +1081,16 @@ static void
10811081
efx_farch_handle_tx_flush_done(struct efx_nic *efx, efx_qword_t *event)
10821082
{
10831083
struct efx_tx_queue *tx_queue;
1084+
struct efx_channel *channel;
10841085
int qid;
10851086

10861087
qid = EFX_QWORD_FIELD(*event, FSF_AZ_DRIVER_EV_SUBDATA);
10871088
if (qid < EFX_MAX_TXQ_PER_CHANNEL * (efx->n_tx_channels + efx->n_extra_tx_channels)) {
1088-
tx_queue = efx_get_tx_queue(efx, qid / EFX_MAX_TXQ_PER_CHANNEL,
1089-
qid % EFX_MAX_TXQ_PER_CHANNEL);
1090-
if (atomic_cmpxchg(&tx_queue->flush_outstanding, 1, 0)) {
1089+
channel = efx_get_tx_channel(efx, qid / EFX_MAX_TXQ_PER_CHANNEL);
1090+
tx_queue = channel->tx_queue + (qid % EFX_MAX_TXQ_PER_CHANNEL);
1091+
if (atomic_cmpxchg(&tx_queue->flush_outstanding, 1, 0))
10911092
efx_farch_magic_event(tx_queue->channel,
10921093
EFX_CHANNEL_MAGIC_TX_DRAIN(tx_queue));
1093-
}
10941094
}
10951095
}
10961096

0 commit comments

Comments
 (0)