On Thu, Sep 3, 2020 at 11:01 PM Saeed Mahameed <sae...@nvidia.com> wrote:
>
> From: Maxim Mikityanskiy <maxi...@mellanox.com>
>
> A constant for the number of DS in an empty WQE (i.e. a WQE without data
> segments) is needed in multiple places (normal TX data path, MPWQE in
> XDP), but currently we have a constant for XDP and an inline formula in
> normal TX. This patch introduces a common constant.
>
> Additionally, mlx5e_xdp_mpwqe_session_start is converted to use struct
> assignment, because the code nearby is touched.
>
> Signed-off-by: Maxim Mikityanskiy <maxi...@mellanox.com>
> Signed-off-by: Saeed Mahameed <sae...@nvidia.com>
> ---
>  .../net/ethernet/mellanox/mlx5/core/en/txrx.h |  2 ++
>  .../net/ethernet/mellanox/mlx5/core/en/xdp.c  | 13 +++++++-----
>  .../net/ethernet/mellanox/mlx5/core/en/xdp.h  | 21 +++++++------------
>  .../net/ethernet/mellanox/mlx5/core/en_tx.c   |  2 +-
>  4 files changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h 
> b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
> index d4ee22789ab0..155b89998891 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
> @@ -7,6 +7,8 @@
>  #include "en.h"
>  #include <linux/indirect_call_wrapper.h>
>
> +#define MLX5E_TX_WQE_EMPTY_DS_COUNT (sizeof(struct mlx5e_tx_wqe) / 
> MLX5_SEND_WQE_DS)
> +

Out of curiosity, what is the logic for dividing this struct by 16?

struct mlx5e_tx_wqe {
        struct mlx5_wqe_ctrl_seg ctrl;
        struct mlx5_wqe_eth_seg  eth;
        struct mlx5_wqe_data_seg data[0];
};

>  #define INL_HDR_START_SZ (sizeof(((struct mlx5_wqe_eth_seg 
> *)NULL)->inline_hdr.start))
>
>  enum mlx5e_icosq_wqe_type {
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c 
> b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
> index 7fccd2ea7dc9..81cd9a04bcb0 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
> @@ -196,16 +196,19 @@ static void mlx5e_xdp_mpwqe_session_start(struct 
> mlx5e_xdpsq *sq)
>  {
>         struct mlx5e_xdp_mpwqe *session = &sq->mpwqe;
>         struct mlx5e_xdpsq_stats *stats = sq->stats;
> +       struct mlx5e_tx_wqe *wqe;
>         u16 pi;
>
>         pi = mlx5e_xdpsq_get_next_pi(sq, MLX5E_XDP_MPW_MAX_WQEBBS);
> -       session->wqe = MLX5E_TX_FETCH_WQE(sq, pi);
> -
> +       wqe = MLX5E_TX_FETCH_WQE(sq, pi);
>         net_prefetchw(session->wqe->data);

Is this prefetch still valid? And is the temporary variable wqe still
needed at all?


> -       session->ds_count  = MLX5E_XDP_TX_EMPTY_DS_COUNT;
> -       session->pkt_count = 0;
>
> -       mlx5e_xdp_update_inline_state(sq);
> +       *session = (struct mlx5e_xdp_mpwqe) {
> +               .wqe = wqe,
> +               .ds_count = MLX5E_TX_WQE_EMPTY_DS_COUNT,
> +               .pkt_count = 0,
> +               .inline_on = mlx5e_xdp_get_inline_state(sq, 
> session->inline_on),
> +       };
>
>         stats->mpwqe++;
>  }

Reply via email to