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++; > }