i40e: support for XDP
Subsystems (2)
v7 cover i40e: support for XDP
From: Bj?rn T?pel <[email protected]>
This series adds XDP support for i40e-based NICs.
The first patch wires up ndo_xdp and implements XDP_DROP semantics for all actions. The second patch adds egress support via the XDP_TX action.
Performance numbers (40GbE port, 64B packets) for xdp1 and xdp2 programs, from samples/bpf/:
IOMMU | xdp1 | xdp2
---------------------------+-----------+-----------
iommu=off | 29.7 Mpps | 17.1 Mpps iommu=pt intel_iommu=on | 29.7 Mpps | 11.6 Mpps iommu=on intel_iommu=on | 21.8 Mpps | 3.7 Mpps
Future improvements, not covered by the patches:
* Proper debugfs support.
* i40evf support.
Thanks to Alex, Daniel, John and Scott for all feedback!
v7:
* Proper MTU check for XDP
v6:
* Addressed various cosmetic issues (reverse xmas tree formatting on local variables, preserve function parameter ordering, qvector mapping).
* Placed XDP Tx rings directly after Tx rings. This opened up to various simplications in the code, since we can now treat the XDP Tx rings as an extension of existing Tx ring space. E.g., i40e_set_ringparam now has smaller changeset.
* Ring allocation and setup was simplified (i40e_alloc_rings,
i40e_vsi_alloc_arrays).
v5:
* Aligned the implementation to ixgbe's XDP support: naming, favor xchg instead of RCU semantics
* Support for XDP headroom (piggybacking on Alex' build_skb work)
* Added xdp tracepoints for exception states (as suggested by Daniel)
v4:
* Removed unused i40e_page_is_reserved function
* Prior running the XDP program, set the struct xdp_buff data_hard_start member
v3:
* Rebased patch set on Jeff's dev-queue branch
* MSI-X is no longer a prerequisite for XDP
* RCU locking for the XDP program and XDP_RX support is introduced in the same patch
* Rx bytes is now bumped for XDP
* Removed pointer-to-pointer clunkiness
* Added comments to XDP preconditions in ndo_xdp
* When a non-EOF is received, log once, and drop the frame
v2:
* Fixed kbuild error for PAGE_SIZE >= 8192.
* Renamed i40e_try_flip_rx_page to i40e_can_reuse_rx_page, which is more in line to the other Intel Ethernet drivers (igb/fm10k).
* Validate xdp_adjust_head support in ndo_xdp/XDP_SETUP_PROG.
Bj?rn T?pel (2):
i40e: add XDP support for pass and drop actions
i40e: add support for XDP_TX action
drivers/net/ethernet/intel/i40e/i40e.h | 8 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 42 ++- drivers/net/ethernet/intel/i40e/i40e_main.c | 364 ++++++++++++++++++++----- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 244 ++++++++++++++--- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 12 + 5 files changed, 565 insertions(+), 105 deletions(-)
Signature · 1 line
2.11.0
PATCH v7 1/2 i40e: add XDP support for pass and drop actions
From: Bj?rn T?pel <[email protected]>
This commit adds basic XDP support for i40e derived NICs. All XDP actions will end up in XDP_DROP.
--- drivers/net/ethernet/intel/i40e/i40e.h | 7 ++ drivers/net/ethernet/intel/i40e/i40e_main.c | 87 +++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 130 +++++++++++++++++++++------- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + 4 files changed, 194 insertions(+), 31 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +7 -0
@@ -645,6 +645,8 @@ struct i40e_vsi {u16 max_frame;u16 rx_buf_len; +struct bpf_prog *xdp_prog; +/* List of q_vectors allocated to this VSI */ struct i40e_q_vector **q_vectors;int num_q_vectors;
@@ -972,4 +974,9 @@ i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);i40e_status i40e_set_npar_bw_setting (struct i40e_pf *pf);i40e_status i40e_commit_npar_bw_setting (struct i40e_pf *pf);void i40e_print_link_message (struct i40e_vsi *vsi,bool isup); + +static inline bool i40e_enabled_xdp_vsi (struct i40e_vsi *vsi) +{ +return !!vsi->xdp_prog; +}#endif /* _I40E_H_ */
drivers/net/ethernet/intel/i40e/i40e_main.c +87 -0
117 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_txrx.c +99 -31
236 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -0
@@ -360,6 +360,7 @@ struct i40e_ring {void *desc;/* Descriptor ring memory */ struct device *dev;/* Used for DMA mapping */ struct net_device *netdev;/* netdev ring maps to */ +struct bpf_prog *xdp_prog;union {struct i40e_tx_buffer *tx_bi;struct i40e_rx_buffer *rx_bi;
Signature · 1 line
2.11.0
Bowers
PATCH v7 1/2 i40e: add XDP support for pass and drop actions
Quoted 16 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Bj?rn T?pel
Sent: Tuesday, May 23, 2017 10:56 PM
To: Kirsher, Jeffrey T <[email protected]>; intel-wired- lan at lists.osuosl.org; alexander.duyck at gmail.com
Cc: daniel at iogearbox.net; Topel, Bjorn <[email protected]>; Karlsson, Magnus <[email protected]>
Subject: [Intel-wired-lan] [PATCH v7 1/2] i40e: add XDP support for pass and drop actionsFrom: Bj?rn T?pel <[email protected]>
This commit adds basic XDP support for i40e derived NICs. All XDP actions will end up in
XDP_DROP.
Quoted 8 lines
Signed-off-by Bj?rn T?pel <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 7 ++ drivers/net/ethernet/intel/i40e/i40e_main.c | 87 +++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 130 +++++++++++++++++++++------- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + 4 files changed, 194 insertions(+), 31 deletions(-)
PATCH v7 2/2 i40e: add support for XDP_TX action
In reply to Björn TöpelFrom: Bj?rn T?pel <[email protected]>
This patch adds proper XDP_TX action support. For each Tx ring, an additional XDP Tx ring is allocated and setup. This version does the DMA mapping in the fast-path, which will penalize performance for IOMMU enabled systems. Further, debugfs support is not wired up for the XDP Tx rings.
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 42 +++- drivers/net/ethernet/intel/i40e/i40e_main.c | 277 +++++++++++++++++++------ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 118 ++++++++++- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 11 + 5 files changed, 373 insertions(+), 76 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -629,6 +629,7 @@ struct i40e_vsi {/* These are containers of ring pointers, allocated at run-time */ struct i40e_ring **rx_rings;struct i40e_ring **tx_rings; +struct i40e_ring **xdp_rings;/* XDP Tx rings */ u32 active_filters;u32 promisc_threshold;
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +33 -9
94 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_main.c +215 -62
459 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_txrx.c +113 -5
188 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_txrx.h +11 -0
@@ -396,6 +396,7 @@ struct i40e_ring {u16 flags;#define I40E_TXR_FLAGS_WB_ON_ITR BIT(0)#define I40E_RXR_FLAGS_BUILD_SKB_ENABLED BIT(1) +#define I40E_TXR_FLAGS_XDP BIT(2)/* stats structs */ struct i40e_queue_stats stats;
@@ -438,6 +439,16 @@ static inline void clear_ring_build_skb_enabled(struct i40e_ring *ring) ring->flags &= ~I40E_RXR_FLAGS_BUILD_SKB_ENABLED ; } +static inline bool ring_is_xdp (struct i40e_ring *ring) +{ +return !!(ring->flags &I40E_TXR_FLAGS_XDP ); +} + +static inline void set_ring_xdp (struct i40e_ring *ring) +{ + ring->flags |=I40E_TXR_FLAGS_XDP ; +} +enum i40e_latency_range {I40E_LOWEST_LATENCY =0 ,I40E_LOW_LATENCY =1 ,
Signature · 1 line
2.11.0
Bowers
PATCH v7 2/2 i40e: add support for XDP_TX action
Quoted 18 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf Of Bj?rn T?pel
Sent: Tuesday, May 23, 2017 10:56 PM
To: Kirsher, Jeffrey T <[email protected]>; intel-wired- lan at lists.osuosl.org; alexander.duyck at gmail.com
Cc: daniel at iogearbox.net; Topel, Bjorn <[email protected]>; Karlsson, Magnus <[email protected]>
Subject: [Intel-wired-lan] [PATCH v7 2/2] i40e: add support forXDP_TXactionFrom: Bj?rn T?pel <[email protected]>
This patch adds proper
XDP_TXaction support. For each Tx ring, an additional XDP Tx ring is allocated and setup. This version does the DMA mapping in the fast-path, which will penalize performance for IOMMU enabled systems. Further, debugfs support is not wired up for the XDP Tx rings.Signed-off-by Bj?rn T?pel <[email protected]>
Quoted 8 lines
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 42 +++- drivers/net/ethernet/intel/i40e/i40e_main.c | 277 +++++++++++++++++++------ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 118 ++++++++++- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 11 + 5 files changed, 373 insertions(+), 76 deletions(-)
v7 cover i40e: support for XDP
In reply to Björn TöpelThis series looks good to me.
Quoted 79 lines · Bj?rn T?pel
From: Bj?rn T?pel <[email protected]>
This series adds XDP support for i40e-based NICs.
The first patch wires up
ndo_xdpand implementsXDP_DROPsemantics for all actions. The second patch adds egress support via theXDP_TXaction.Performance numbers (40GbE port, 64B packets) for xdp1 and xdp2 programs, from
samples/bpf/:IOMMU | xdp1 | xdp2
---------------------------+-----------+-----------iommu=off | 29.7 Mpps | 17.1 Mpps iommu=pt intel_iommu=on | 29.7 Mpps | 11.6 Mpps iommu=on intel_iommu=on | 21.8 Mpps | 3.7 MppsFuture improvements, not covered by the patches:
* Proper debugfs support.
* i40evf support.Thanks to Alex, Daniel, John and Scott for all feedback!
v7:
* Proper MTU check for XDPv6:
* Addressed various cosmetic issues (reverse xmas tree formatting on local variables, preserve function parameter ordering, qvector mapping).
* Placed XDP Tx rings directly after Tx rings. This opened up to various simplications in the code, since we can now treat the XDP Tx rings as an extension of existing Tx ring space. E.g.,i40e_set_ringparamnow has smaller changeset.
* Ring allocation and setup was simplified (i40e_alloc_rings,i40e_vsi_alloc_arrays).v5:
* Aligned the implementation to ixgbe's XDP support: naming, favor xchg instead of RCU semantics
* Support for XDP headroom (piggybacking on Alex'build_skbwork)
* Added xdp tracepoints for exception states (as suggested by Daniel)v4:
* Removed unusedi40e_page_is_reservedfunction
* Prior running the XDP program, set the structxdp_buffdata_hard_startmemberv3:
* Rebased patch set on Jeff's dev-queue branch
* MSI-X is no longer a prerequisite for XDP
* RCU locking for the XDP program andXDP_RXsupport is introduced in the same patch
* Rx bytes is now bumped for XDP
* Removed pointer-to-pointer clunkiness
* Added comments to XDP preconditions inndo_xdp
* When a non-EOF is received, log once, and drop the framev2:
* Fixed kbuild error forPAGE_SIZE>= 8192.
* Renamedi40e_try_flip_rx_pagetoi40e_can_reuse_rx_page, which is more in line to the other Intel Ethernet drivers (igb/fm10k).
* Validatexdp_adjust_headsupport in ndo_xdp/XDP_SETUP_PROG.Bj?rn T?pel (2):
i40e: add XDP support for pass and drop actions
i40e: add support forXDP_TXactiondrivers/net/ethernet/intel/i40e/i40e.h | 8 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 42 ++- drivers/net/ethernet/intel/i40e/i40e_main.c | 364 ++++++++++++++++++++----- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 244 ++++++++++++++--- drivers/net/ethernet/intel/i40e/i40e_txrx.h | 12 + 5 files changed, 565 insertions(+), 105 deletions(-)--
2.11.0
v7 cover i40e: support for XDP
Quoted 8 lines · Alexander Duyck
This series looks good to me.
Acked-by Alexander Duyck <[email protected]>Quoted 3 lines · Bj?rn T?pel
From: Bj?rn T?pel <[email protected]>
This series adds XDP support for i40e-based NICs.
Awesome, very nice! Will these land this net-next cycle? :)
Quoted 16 lines
Quoted 16 lines
The first patch wires up
ndo_xdpand implementsXDP_DROPsemantics for all actions. The second patch adds egress support via theXDP_TXaction.Performance numbers (40GbE port, 64B packets) for xdp1 and xdp2 programs, from
samples/bpf/:IOMMU | xdp1 | xdp2
---------------------------+-----------+-----------iommu=off | 29.7 Mpps | 17.1 Mpps iommu=pt intel_iommu=on | 29.7 Mpps | 11.6 Mpps iommu=on intel_iommu=on | 21.8 Mpps | 3.7 MppsFuture improvements, not covered by the patches:
* Proper debugfs support.
* i40evf support.