Blame SOURCES/0230-netdrv-net-mlx5e-Rx-Split-rep-rx-mpwqe-handler-from-.patch

d8f823
From 3c41a6893c6cf8a0874f5cb36edf495b2d352733 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Tue, 19 May 2020 07:48:52 -0400
d8f823
Subject: [PATCH 230/312] [netdrv] net/mlx5e: Rx, Split rep rx mpwqe handler
d8f823
 from nic
d8f823
d8f823
Message-id: <20200519074934.6303-22-ahleihel@redhat.com>
d8f823
Patchwork-id: 310524
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1663246 21/63] net/mlx5e: Rx, Split rep rx mpwqe handler from nic
d8f823
Bugzilla: 1790219 1790218 1663246
d8f823
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
RH-Acked-by: John Linville <linville@redhat.com>
d8f823
RH-Acked-by: Ivan Vecera <ivecera@redhat.com>
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1663246
d8f823
Bugzilla: http://bugzilla.redhat.com/1790219
d8f823
Bugzilla: http://bugzilla.redhat.com/1790218
d8f823
Upstream: v5.7-rc1
d8f823
d8f823
commit dfd9e7500cd4b21b61d65907e02880b20de929aa
d8f823
Author: Paul Blakey <paulb@mellanox.com>
d8f823
Date:   Sun Feb 16 12:01:29 2020 +0200
d8f823
d8f823
    net/mlx5e: Rx, Split rep rx mpwqe handler from nic
d8f823
d8f823
    Copy the current rep mpwqe rx handler which is also used by nic
d8f823
    profile. In the next patch, we will add rep specific logic, just
d8f823
    for the rep profile rx handler.
d8f823
d8f823
    Signed-off-by: Paul Blakey <paulb@mellanox.com>
d8f823
    Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
d8f823
    Reviewed-by: Mark Bloch <markb@mellanox.com>
d8f823
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
d8f823
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c |  4 +-
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.h |  2 +
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c  | 54 ++++++++++++++++++++++++
d8f823
 3 files changed, 58 insertions(+), 2 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
d8f823
index dcf97bd4fa49..1cb47297285e 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
d8f823
@@ -1934,7 +1934,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = {
d8f823
 	.update_rx		= mlx5e_update_rep_rx,
d8f823
 	.update_stats           = mlx5e_update_ndo_stats,
d8f823
 	.rx_handlers.handle_rx_cqe       = mlx5e_handle_rx_cqe_rep,
d8f823
-	.rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq,
d8f823
+	.rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq_rep,
d8f823
 	.max_tc			= 1,
d8f823
 	.rq_groups		= MLX5E_NUM_RQ_GROUPS(REGULAR),
d8f823
 	.stats_grps		= mlx5e_rep_stats_grps,
d8f823
@@ -1954,7 +1954,7 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = {
d8f823
 	.update_stats           = mlx5e_update_ndo_stats,
d8f823
 	.update_carrier	        = mlx5e_update_carrier,
d8f823
 	.rx_handlers.handle_rx_cqe       = mlx5e_handle_rx_cqe_rep,
d8f823
-	.rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq,
d8f823
+	.rx_handlers.handle_rx_cqe_mpwqe = mlx5e_handle_rx_cqe_mpwrq_rep,
d8f823
 	.max_tc			= MLX5E_MAX_NUM_TC,
d8f823
 	.rq_groups		= MLX5E_NUM_RQ_GROUPS(REGULAR),
d8f823
 	.stats_grps		= mlx5e_ul_rep_stats_grps,
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h
d8f823
index 4bc5d5cd071c..9f44293ff153 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.h
d8f823
@@ -191,6 +191,8 @@ int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv);
d8f823
 void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv);
d8f823
 
d8f823
 void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
d8f823
+void mlx5e_handle_rx_cqe_mpwrq_rep(struct mlx5e_rq *rq,
d8f823
+				   struct mlx5_cqe64 *cqe);
d8f823
 
d8f823
 int mlx5e_rep_encap_entry_attach(struct mlx5e_priv *priv,
d8f823
 				 struct mlx5e_encap_entry *e);
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
d8f823
index 1d606e13a336..85c2428c2f3e 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
d8f823
@@ -1233,6 +1233,60 @@ void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
d8f823
 wq_cyc_pop:
d8f823
 	mlx5_wq_cyc_pop(wq);
d8f823
 }
d8f823
+
d8f823
+void mlx5e_handle_rx_cqe_mpwrq_rep(struct mlx5e_rq *rq,
d8f823
+				   struct mlx5_cqe64 *cqe)
d8f823
+{
d8f823
+	u16 cstrides       = mpwrq_get_cqe_consumed_strides(cqe);
d8f823
+	u16 wqe_id         = be16_to_cpu(cqe->wqe_id);
d8f823
+	struct mlx5e_mpw_info *wi = &rq->mpwqe.info[wqe_id];
d8f823
+	u16 stride_ix      = mpwrq_get_cqe_stride_index(cqe);
d8f823
+	u32 wqe_offset     = stride_ix << rq->mpwqe.log_stride_sz;
d8f823
+	u32 head_offset    = wqe_offset & (PAGE_SIZE - 1);
d8f823
+	u32 page_idx       = wqe_offset >> PAGE_SHIFT;
d8f823
+	struct mlx5e_rx_wqe_ll *wqe;
d8f823
+	struct mlx5_wq_ll *wq;
d8f823
+	struct sk_buff *skb;
d8f823
+	u16 cqe_bcnt;
d8f823
+
d8f823
+	wi->consumed_strides += cstrides;
d8f823
+
d8f823
+	if (unlikely(MLX5E_RX_ERR_CQE(cqe))) {
d8f823
+		trigger_report(rq, cqe);
d8f823
+		rq->stats->wqe_err++;
d8f823
+		goto mpwrq_cqe_out;
d8f823
+	}
d8f823
+
d8f823
+	if (unlikely(mpwrq_is_filler_cqe(cqe))) {
d8f823
+		struct mlx5e_rq_stats *stats = rq->stats;
d8f823
+
d8f823
+		stats->mpwqe_filler_cqes++;
d8f823
+		stats->mpwqe_filler_strides += cstrides;
d8f823
+		goto mpwrq_cqe_out;
d8f823
+	}
d8f823
+
d8f823
+	cqe_bcnt = mpwrq_get_cqe_byte_cnt(cqe);
d8f823
+
d8f823
+	skb = INDIRECT_CALL_2(rq->mpwqe.skb_from_cqe_mpwrq,
d8f823
+			      mlx5e_skb_from_cqe_mpwrq_linear,
d8f823
+			      mlx5e_skb_from_cqe_mpwrq_nonlinear,
d8f823
+			      rq, wi, cqe_bcnt, head_offset, page_idx);
d8f823
+	if (!skb)
d8f823
+		goto mpwrq_cqe_out;
d8f823
+
d8f823
+	mlx5e_complete_rx_cqe(rq, cqe, cqe_bcnt, skb);
d8f823
+
d8f823
+	napi_gro_receive(rq->cq.napi, skb);
d8f823
+
d8f823
+mpwrq_cqe_out:
d8f823
+	if (likely(wi->consumed_strides < rq->mpwqe.num_strides))
d8f823
+		return;
d8f823
+
d8f823
+	wq  = &rq->mpwqe.wq;
d8f823
+	wqe = mlx5_wq_ll_get_wqe(wq, wqe_id);
d8f823
+	mlx5e_free_rx_mpwqe(rq, wi, true);
d8f823
+	mlx5_wq_ll_pop(wq, cqe->wqe_id, &wqe->next.next_wqe_index);
d8f823
+}
d8f823
 #endif
d8f823
 
d8f823
 struct sk_buff *
d8f823
-- 
d8f823
2.13.6
d8f823