Skip to content

Commit ecbcd68

Browse files
committed
Merge tag 'mlx5e-updates-2018-07-26' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5e-updates-2018-07-26 (XDP redirect) This series from Tariq adds the support for device-out XDP redirect. Start with a simple RX and XDP cleanups: - Replace call to MPWQE free with dealloc in interface down flow - Do not recycle RX pages in interface down flow - Gather all XDP pre-requisite checks in a single function - Restrict the combination of large MTU and XDP Since now XDP logic is going to be called from TX side as well, generic XDP TX logic is not RX only anymore, for that Tariq creates a new xdp.c file and moves XDP related code into it, and generalizes the code to support XDP TX for XDP redirect, such as the xdp tx sq structures and xdp counters. XDP redirect support: Add implementation for the ndo_xdp_xmit callback. Dedicate a new set of XDP-SQ instances to satisfy the XDP_REDIRECT requests. These instances are totally separated from the existing XDP-SQ objects that satisfy local XDP_TX actions. Performance tests: xdp_redirect_map from ConnectX-5 to ConnectX-5. CPU: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz Packet-rate of 64B packets. Single queue: 7 Mpps. Multi queue: 55 Mpps. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents f61b6db + 8ee4823 commit ecbcd68

10 files changed

Lines changed: 612 additions & 313 deletions

File tree

‎drivers/net/ethernet/mellanox/mlx5/core/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o \
1414
fpga/ipsec.o fpga/tls.o
1515

1616
mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
17-
en_tx.o en_rx.o en_dim.o en_txrx.o en_stats.o vxlan.o \
17+
en_tx.o en_rx.o en_dim.o en_txrx.o en/xdp.o en_stats.o vxlan.o \
1818
en_arfs.o en_fs_ethtool.o en_selftest.o en/port.o
1919

2020
mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o

‎drivers/net/ethernet/mellanox/mlx5/core/en.h‎

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@ struct page_pool;
147147
(DIV_ROUND_UP(MLX5E_UMR_WQE_INLINE_SZ, MLX5_SEND_WQE_BB))
148148
#define MLX5E_ICOSQ_MAX_WQEBBS MLX5E_UMR_WQEBBS
149149

150-
#define MLX5E_XDP_MIN_INLINE (ETH_HLEN + VLAN_HLEN)
151-
#define MLX5E_XDP_TX_DS_COUNT \
152-
((sizeof(struct mlx5e_tx_wqe) / MLX5_SEND_WQE_DS) + 1 /* SG DS */)
153-
154150
#define MLX5E_NUM_MAIN_GROUPS 9
155151

156152
#define MLX5E_MSG_LEVEL NETIF_MSG_LINK
@@ -348,6 +344,7 @@ enum {
348344
MLX5E_SQ_STATE_IPSEC,
349345
MLX5E_SQ_STATE_AM,
350346
MLX5E_SQ_STATE_TLS,
347+
MLX5E_SQ_STATE_REDIRECT,
351348
};
352349

353350
struct mlx5e_sq_wqe_info {
@@ -368,16 +365,14 @@ struct mlx5e_txqsq {
368365

369366
struct mlx5e_cq cq;
370367

371-
/* write@xmit, read@completion */
372-
struct {
373-
struct mlx5e_sq_dma *dma_fifo;
374-
struct mlx5e_tx_wqe_info *wqe_info;
375-
} db;
376-
377368
/* read only */
378369
struct mlx5_wq_cyc wq;
379370
u32 dma_fifo_mask;
380371
struct mlx5e_sq_stats *stats;
372+
struct {
373+
struct mlx5e_sq_dma *dma_fifo;
374+
struct mlx5e_tx_wqe_info *wqe_info;
375+
} db;
381376
void __iomem *uar_map;
382377
struct netdev_queue *txq;
383378
u32 sqn;
@@ -399,30 +394,43 @@ struct mlx5e_txqsq {
399394
} recover;
400395
} ____cacheline_aligned_in_smp;
401396

397+
struct mlx5e_dma_info {
398+
struct page *page;
399+
dma_addr_t addr;
400+
};
401+
402+
struct mlx5e_xdp_info {
403+
struct xdp_frame *xdpf;
404+
dma_addr_t dma_addr;
405+
struct mlx5e_dma_info di;
406+
};
407+
402408
struct mlx5e_xdpsq {
403409
/* data path */
404410

405-
/* dirtied @rx completion */
411+
/* dirtied @completion */
406412
u16 cc;
407-
u16 pc;
413+
bool redirect_flush;
408414

409-
struct mlx5e_cq cq;
415+
/* dirtied @xmit */
416+
u16 pc ____cacheline_aligned_in_smp;
417+
bool doorbell;
410418

411-
/* write@xmit, read@completion */
412-
struct {
413-
struct mlx5e_dma_info *di;
414-
bool doorbell;
415-
bool redirect_flush;
416-
} db;
419+
struct mlx5e_cq cq;
417420

418421
/* read only */
419422
struct mlx5_wq_cyc wq;
423+
struct mlx5e_xdpsq_stats *stats;
424+
struct {
425+
struct mlx5e_xdp_info *xdpi;
426+
} db;
420427
void __iomem *uar_map;
421428
u32 sqn;
422429
struct device *pdev;
423430
__be32 mkey_be;
424431
u8 min_inline_mode;
425432
unsigned long state;
433+
unsigned int hw_mtu;
426434

427435
/* control path */
428436
struct mlx5_wq_ctrl wq_ctrl;
@@ -459,11 +467,6 @@ mlx5e_wqc_has_room_for(struct mlx5_wq_cyc *wq, u16 cc, u16 pc, u16 n)
459467
return (mlx5_wq_cyc_ctr2ix(wq, cc - pc) >= n) || (cc == pc);
460468
}
461469

462-
struct mlx5e_dma_info {
463-
struct page *page;
464-
dma_addr_t addr;
465-
};
466-
467470
struct mlx5e_wqe_frag_info {
468471
struct mlx5e_dma_info *di;
469472
u32 offset;
@@ -566,7 +569,6 @@ struct mlx5e_rq {
566569

567570
/* XDP */
568571
struct bpf_prog *xdp_prog;
569-
unsigned int hw_mtu;
570572
struct mlx5e_xdpsq xdpsq;
571573
DECLARE_BITMAP(flags, 8);
572574
struct page_pool *page_pool;
@@ -595,6 +597,9 @@ struct mlx5e_channel {
595597
__be32 mkey_be;
596598
u8 num_tc;
597599

600+
/* XDP_REDIRECT */
601+
struct mlx5e_xdpsq xdpsq;
602+
598603
/* data path - accessed per napi poll */
599604
struct irq_desc *irq_desc;
600605
struct mlx5e_ch_stats *stats;
@@ -617,6 +622,8 @@ struct mlx5e_channel_stats {
617622
struct mlx5e_ch_stats ch;
618623
struct mlx5e_sq_stats sq[MLX5E_MAX_NUM_TC];
619624
struct mlx5e_rq_stats rq;
625+
struct mlx5e_xdpsq_stats rq_xdpsq;
626+
struct mlx5e_xdpsq_stats xdpsq;
620627
} ____cacheline_aligned_in_smp;
621628

622629
enum mlx5e_traffic_types {
@@ -876,14 +883,13 @@ void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);
876883
int mlx5e_napi_poll(struct napi_struct *napi, int budget);
877884
bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget);
878885
int mlx5e_poll_rx_cq(struct mlx5e_cq *cq, int budget);
879-
bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq);
880886
void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq);
881-
void mlx5e_free_xdpsq_descs(struct mlx5e_xdpsq *sq);
882887

883888
bool mlx5e_check_fragmented_striding_rq_cap(struct mlx5_core_dev *mdev);
884889
bool mlx5e_striding_rq_possible(struct mlx5_core_dev *mdev,
885890
struct mlx5e_params *params);
886891

892+
void mlx5e_page_dma_unmap(struct mlx5e_rq *rq, struct mlx5e_dma_info *dma_info);
887893
void mlx5e_page_release(struct mlx5e_rq *rq, struct mlx5e_dma_info *dma_info,
888894
bool recycle);
889895
void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
@@ -892,7 +898,6 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq);
892898
bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq);
893899
void mlx5e_dealloc_rx_wqe(struct mlx5e_rq *rq, u16 ix);
894900
void mlx5e_dealloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix);
895-
void mlx5e_free_rx_mpwqe(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi);
896901
struct sk_buff *
897902
mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
898903
u16 cqe_bcnt, u32 head_offset, u32 page_idx);

0 commit comments

Comments
 (0)