Blame SOURCES/0005-netdrv-net-mlx5e-Move-the-SW-XSK-code-from-NAPI-poll.patch

d8f823
From edf3630554bc462e0bee93faa5685e8e11a5a936 Mon Sep 17 00:00:00 2001
d8f823
From: Jiri Benc <jbenc@redhat.com>
d8f823
Date: Wed, 22 Apr 2020 18:18:00 -0400
d8f823
Subject: [PATCH 005/312] [netdrv] net/mlx5e: Move the SW XSK code from NAPI
d8f823
 poll to a separate function
d8f823
MIME-Version: 1.0
d8f823
Content-Type: text/plain; charset=UTF-8
d8f823
Content-Transfer-Encoding: 8bit
d8f823
d8f823
Message-id: <6bb2443d30349d894a710f787928942121ac29dc.1587578778.git.jbenc@redhat.com>
d8f823
Patchwork-id: 304519
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 net 09/46] net/mlx5e: Move the SW XSK code from NAPI poll to a separate function
d8f823
Bugzilla: 1819630
d8f823
RH-Acked-by: Hangbin Liu <haliu@redhat.com>
d8f823
RH-Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
d8f823
RH-Acked-by: Ivan Vecera <ivecera@redhat.com>
d8f823
d8f823
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1819630
d8f823
d8f823
commit 871aa189a69f7bbe6254459d17b78e1cce65c9ae
d8f823
Author: Maxim Mikityanskiy <maximmi@mellanox.com>
d8f823
Date:   Wed Aug 14 09:27:22 2019 +0200
d8f823
d8f823
    net/mlx5e: Move the SW XSK code from NAPI poll to a separate function
d8f823
d8f823
    Two XSK tasks are performed during NAPI polling, that are not bound to
d8f823
    hardware interrupts: TXing packets and polling for frames in the Fill
d8f823
    Ring. They are special in a way that the hardware doesn't know about
d8f823
    these tasks, so it doesn't trigger interrupts if there is still some
d8f823
    work to be done, it's our driver's responsibility to ensure NAPI will be
d8f823
    rescheduled if needed.
d8f823
d8f823
    Create a new function to handle these tasks and move the corresponding
d8f823
    code from mlx5e_napi_poll to the new function to improve modularity and
d8f823
    prepare for the changes in the following patch.
d8f823
d8f823
    Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
d8f823
    Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
d8f823
    Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
    Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
d8f823
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
d8f823
d8f823
Signed-off-by: Jiri Benc <jbenc@redhat.com>
d8f823
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 13 +++++++++++--
d8f823
 1 file changed, 11 insertions(+), 2 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
d8f823
index 49b06b256c92..6d16dee38ede 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
d8f823
@@ -81,6 +81,16 @@ void mlx5e_trigger_irq(struct mlx5e_icosq *sq)
d8f823
 	mlx5e_notify_hw(wq, sq->pc, sq->uar_map, &nopwqe->ctrl);
d8f823
 }
d8f823
 
d8f823
+static bool mlx5e_napi_xsk_post(struct mlx5e_xdpsq *xsksq, struct mlx5e_rq *xskrq)
d8f823
+{
d8f823
+	bool busy_xsk = false;
d8f823
+
d8f823
+	busy_xsk |= mlx5e_xsk_tx(xsksq, MLX5E_TX_XSK_POLL_BUDGET);
d8f823
+	busy_xsk |= xskrq->post_wqes(xskrq);
d8f823
+
d8f823
+	return busy_xsk;
d8f823
+}
d8f823
+
d8f823
 int mlx5e_napi_poll(struct napi_struct *napi, int budget)
d8f823
 {
d8f823
 	struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel,
d8f823
@@ -122,8 +132,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
d8f823
 	if (xsk_open) {
d8f823
 		mlx5e_poll_ico_cq(&c->xskicosq.cq);
d8f823
 		busy |= mlx5e_poll_xdpsq_cq(&xsksq->cq);
d8f823
-		busy_xsk |= mlx5e_xsk_tx(xsksq, MLX5E_TX_XSK_POLL_BUDGET);
d8f823
-		busy_xsk |= xskrq->post_wqes(xskrq);
d8f823
+		busy_xsk |= mlx5e_napi_xsk_post(xsksq, xskrq);
d8f823
 	}
d8f823
 
d8f823
 	busy |= busy_xsk;
d8f823
-- 
d8f823
2.13.6
d8f823