All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/3] sfc: fix TXQ lookups
@ 2021-04-20 12:24 Edward Cree
  2021-04-20 12:27 ` [PATCH net 1/3] sfc: farch: fix TX queue lookup in TX flush done handling Edward Cree
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Edward Cree @ 2021-04-20 12:24 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, themsley

The TXQ handling changes in 12804793b17c ("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.

Edward Cree (3):
  sfc: farch: fix TX queue lookup in TX flush done handling
  sfc: farch: fix TX queue lookup in TX event handling
  sfc: ef10: fix TX queue lookup in TX event handling

 drivers/net/ethernet/sfc/ef10.c  |  3 +--
 drivers/net/ethernet/sfc/farch.c | 16 ++++++++--------
 2 files changed, 9 insertions(+), 10 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/3] sfc: farch: fix TX queue lookup in TX flush done handling
  2021-04-20 12:24 [PATCH net 0/3] sfc: fix TXQ lookups Edward Cree
@ 2021-04-20 12:27 ` Edward Cree
  2021-04-20 12:28 ` [PATCH net 2/3] sfc: farch: fix TX queue lookup in TX event handling Edward Cree
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Edward Cree @ 2021-04-20 12:27 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, themsley

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 <themsley@voiceflex.com>
Cc: stable@vger.kernel.org
Signed-off-by: Edward Cree <ecree.xilinx@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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/3] sfc: farch: fix TX queue lookup in TX event handling
  2021-04-20 12:24 [PATCH net 0/3] sfc: fix TXQ lookups Edward Cree
  2021-04-20 12:27 ` [PATCH net 1/3] sfc: farch: fix TX queue lookup in TX flush done handling Edward Cree
@ 2021-04-20 12:28 ` Edward Cree
  2021-04-20 12:29 ` [PATCH net 3/3] sfc: ef10: " Edward Cree
  2021-04-21  0:10 ` [PATCH net 0/3] sfc: fix TXQ lookups patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Edward Cree @ 2021-04-20 12:28 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, themsley

We're starting from a TXQ label, not a TXQ type, so
 efx_channel_get_tx_queue() is inappropriate (and could return NULL,
 leading to panics).

Fixes: 12804793b17c ("sfc: decouple TXQ type from label")
Cc: stable@vger.kernel.org
Signed-off-by: Edward Cree <ecree.xilinx@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 f89ebe0073dd..49df02ecee91 100644
--- a/drivers/net/ethernet/sfc/farch.c
+++ b/drivers/net/ethernet/sfc/farch.c
@@ -835,14 +835,14 @@ static void efx_farch_magic_event(struct efx_channel *channel, u32 magic)
 		/* Transmit completion */
 		tx_ev_desc_ptr = EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_DESC_PTR);
 		tx_ev_q_label = EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_Q_LABEL);
-		tx_queue = efx_channel_get_tx_queue(
-			channel, tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
+		tx_queue = channel->tx_queue +
+				(tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
 		efx_xmit_done(tx_queue, tx_ev_desc_ptr);
 	} else if (EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_WQ_FF_FULL)) {
 		/* Rewrite the FIFO write pointer */
 		tx_ev_q_label = EFX_QWORD_FIELD(*event, FSF_AZ_TX_EV_Q_LABEL);
-		tx_queue = efx_channel_get_tx_queue(
-			channel, tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
+		tx_queue = channel->tx_queue +
+				(tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
 
 		netif_tx_lock(efx->net_dev);
 		efx_farch_notify_tx_desc(tx_queue);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 3/3] sfc: ef10: fix TX queue lookup in TX event handling
  2021-04-20 12:24 [PATCH net 0/3] sfc: fix TXQ lookups Edward Cree
  2021-04-20 12:27 ` [PATCH net 1/3] sfc: farch: fix TX queue lookup in TX flush done handling Edward Cree
  2021-04-20 12:28 ` [PATCH net 2/3] sfc: farch: fix TX queue lookup in TX event handling Edward Cree
@ 2021-04-20 12:29 ` Edward Cree
  2021-04-21  0:10 ` [PATCH net 0/3] sfc: fix TXQ lookups patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Edward Cree @ 2021-04-20 12:29 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, themsley

We're starting from a TXQ label, not a TXQ type, so
 efx_channel_get_tx_queue() is inappropriate.  This worked by chance,
 because labels and types currently match on EF10, but we shouldn't
 rely on that.

Fixes: 12804793b17c ("sfc: decouple TXQ type from label")
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
---
 drivers/net/ethernet/sfc/ef10.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index da6886dcac37..4fa72b573c17 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -2928,8 +2928,7 @@ static u32 efx_ef10_extract_event_ts(efx_qword_t *event)
 
 	/* Get the transmit queue */
 	tx_ev_q_label = EFX_QWORD_FIELD(*event, ESF_DZ_TX_QLABEL);
-	tx_queue = efx_channel_get_tx_queue(channel,
-					    tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
+	tx_queue = channel->tx_queue + (tx_ev_q_label % EFX_MAX_TXQ_PER_CHANNEL);
 
 	if (!tx_queue->timestamping) {
 		/* Transmit completion */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/3] sfc: fix TXQ lookups
  2021-04-20 12:24 [PATCH net 0/3] sfc: fix TXQ lookups Edward Cree
                   ` (2 preceding siblings ...)
  2021-04-20 12:29 ` [PATCH net 3/3] sfc: ef10: " Edward Cree
@ 2021-04-21  0:10 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-21  0:10 UTC (permalink / raw)
  To: Edward Cree; +Cc: davem, kuba, netdev, themsley

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Tue, 20 Apr 2021 13:24:54 +0100 you wrote:
> The TXQ handling changes in 12804793b17c ("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.
> 
> [...]

Here is the summary with links:
  - [net,1/3] sfc: farch: fix TX queue lookup in TX flush done handling
    https://git.kernel.org/netdev/net/c/5b1faa92289b
  - [net,2/3] sfc: farch: fix TX queue lookup in TX event handling
    https://git.kernel.org/netdev/net/c/83b09a180741
  - [net,3/3] sfc: ef10: fix TX queue lookup in TX event handling
    https://git.kernel.org/netdev/net/c/172e269edfce

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-21  0:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 12:24 [PATCH net 0/3] sfc: fix TXQ lookups Edward Cree
2021-04-20 12:27 ` [PATCH net 1/3] sfc: farch: fix TX queue lookup in TX flush done handling Edward Cree
2021-04-20 12:28 ` [PATCH net 2/3] sfc: farch: fix TX queue lookup in TX event handling Edward Cree
2021-04-20 12:29 ` [PATCH net 3/3] sfc: ef10: " Edward Cree
2021-04-21  0:10 ` [PATCH net 0/3] sfc: fix TXQ lookups patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.