[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0e2c517b-5ada-0fe6-5270-5afaceebe67f@amazon.com>
Date: Tue, 23 Apr 2019 15:53:09 +0300
From: Gal Pressman <galpress@...zon.com>
To: Saeed Mahameed <saeedm@...lanox.com>,
"David S. Miller" <davem@...emloft.net>
CC: <netdev@...r.kernel.org>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Jonathan Lemon <bsd@...com>,
Shay Agroskin <shayag@...lanox.com>,
"Tariq Toukan" <tariqt@...lanox.com>
Subject: Re: [net-next 06/14] net/mlx5e: XDP, Inline small packets into the TX
MPWQE in XDP xmit flow
On 23-Apr-19 01:32, Saeed Mahameed wrote:
> static inline void
> -mlx5e_xdp_mpwqe_add_dseg(struct mlx5e_xdpsq *sq, dma_addr_t dma_addr, u16 dma_len)
> +mlx5e_xdp_mpwqe_add_dseg(struct mlx5e_xdpsq *sq, struct mlx5e_xdp_info *xdpi,
> + struct mlx5e_xdpsq_stats *stats)
Passing stats as a function parameter is weird, why not remove and use sq->stats?
> {
> struct mlx5e_xdp_mpwqe *session = &sq->mpwqe;
> + dma_addr_t dma_addr = xdpi->dma_addr;
> + struct xdp_frame *xdpf = xdpi->xdpf;
> struct mlx5_wqe_data_seg *dseg =
> - (struct mlx5_wqe_data_seg *)session->wqe + session->ds_count++;
> + (struct mlx5_wqe_data_seg *)session->wqe + session->ds_count;
> + u16 dma_len = xdpf->len;
>
> + session->pkt_count++;
> +
> +#define MLX5E_XDP_INLINE_WQE_SZ_THRSD (256 - sizeof(struct mlx5_wqe_inline_seg))
> +
> + if (session->inline_on && dma_len <= MLX5E_XDP_INLINE_WQE_SZ_THRSD) {
> + struct mlx5_wqe_inline_seg *inline_dseg =
> + (struct mlx5_wqe_inline_seg *)dseg;
> + u16 ds_len = sizeof(*inline_dseg) + dma_len;
> + u16 ds_cnt = DIV_ROUND_UP(ds_len, MLX5_SEND_WQE_DS);
> +
> + if (unlikely(session->ds_count + ds_cnt > session->max_ds_count)) {
> + /* Not enough space for inline wqe, send with memory pointer */
> + session->complete = true;
> + goto no_inline;
> + }
> +
> + inline_dseg->byte_count = cpu_to_be32(dma_len | MLX5_INLINE_SEG);
> + memcpy(inline_dseg->data, xdpf->data, dma_len);
> +
> + session->ds_count += ds_cnt;
> + stats->inlnw++;
> + return;
> + }
> +
> +no_inline:
> dseg->addr = cpu_to_be64(dma_addr);
> dseg->byte_count = cpu_to_be32(dma_len);
> dseg->lkey = sq->mkey_be;
> + session->ds_count++;
> }
Powered by blists - more mailing lists