net/mlx5e: XDP, Slight enhancement for WQE fetch function
authorTariq Toukan <tariqt@mellanox.com>
Sun, 14 Jul 2019 14:50:51 +0000 (17:50 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 1 Aug 2019 19:33:31 +0000 (12:33 -0700)
Instead of passing an output param, let function return the
WQE pointer.
In addition, pass &pi so it gets its value in the function,
and save the redundant assignment that comes after it.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.h

index 8cb98326531f11f7f01999533f86c4d4533d6ff9..1ed5c33e022f5d8fbdeff14ba598fe8a1cef9c05 100644 (file)
@@ -187,14 +187,12 @@ static void mlx5e_xdp_mpwqe_session_start(struct mlx5e_xdpsq *sq)
        if (unlikely(contig_wqebbs < MLX5_SEND_WQE_MAX_WQEBBS))
                mlx5e_fill_xdpsq_frag_edge(sq, wq, pi, contig_wqebbs);
 
-       mlx5e_xdpsq_fetch_wqe(sq, &session->wqe);
+       session->wqe = mlx5e_xdpsq_fetch_wqe(sq, &pi);
 
        prefetchw(session->wqe->data);
        session->ds_count  = MLX5E_XDP_TX_EMPTY_DS_COUNT;
        session->pkt_count = 0;
 
-       pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
-
        mlx5e_xdp_update_inline_state(sq);
 
        stats->mpwqe++;
index e0ed7710f5f15e9b57760dac4708fcd427dfa439..36ac1e3816b9d6856960c114a6f8134d1c1b534b 100644 (file)
@@ -190,14 +190,17 @@ mlx5e_xdp_mpwqe_add_dseg(struct mlx5e_xdpsq *sq,
        session->ds_count++;
 }
 
-static inline void mlx5e_xdpsq_fetch_wqe(struct mlx5e_xdpsq *sq,
-                                        struct mlx5e_tx_wqe **wqe)
+static inline struct mlx5e_tx_wqe *
+mlx5e_xdpsq_fetch_wqe(struct mlx5e_xdpsq *sq, u16 *pi)
 {
        struct mlx5_wq_cyc *wq = &sq->wq;
-       u16 pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
+       struct mlx5e_tx_wqe *wqe;
 
-       *wqe = mlx5_wq_cyc_get_wqe(wq, pi);
-       memset(*wqe, 0, sizeof(**wqe));
+       *pi = mlx5_wq_cyc_ctr2ix(wq, sq->pc);
+       wqe = mlx5_wq_cyc_get_wqe(wq, *pi);
+       memset(wqe, 0, sizeof(*wqe));
+
+       return wqe;
 }
 
 static inline void