static int mlx5e_alloc_sq_db(struct mlx5e_sq *sq, int numa) { int wq_sz = mlx5_wq_cyc_get_size(&sq->wq); int df_sz = wq_sz * MLX5_SEND_WQEBB_NUM_DS; sq->skb = kzalloc_node(wq_sz * sizeof(*sq->skb), GFP_KERNEL, numa); sq->dma_fifo = kzalloc_node(df_sz * sizeof(*sq->dma_fifo), GFP_KERNEL, numa); if (!sq->skb || !sq->dma_fifo) { mlx5e_free_sq_db(sq); return -ENOMEM; } sq->dma_fifo_mask = df_sz - 1; return 0; }
static u32 mlx5_wq_cyc_get_byte_size(struct mlx5_wq_cyc *wq) { return mlx5_wq_cyc_get_size(wq) << wq->log_stride; }