diff options
author | David S. Miller <davem@davemloft.net> | 2020-07-19 18:28:34 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-19 18:28:34 -0700 |
commit | 930bc4cc359bdf94029ecb867811000dd87a2c3d (patch) | |
tree | f4d091b5276c329c4fb8082a1a9386752d13fcee /include | |
parent | bed1ce78761925785cfccbd73aea2d889f625b68 (diff) | |
parent | c7a3a8cd9d41ee0a32659fc99d98ec83af803b77 (diff) | |
download | linux-930bc4cc359bdf94029ecb867811000dd87a2c3d.tar.bz2 |
Merge branch 'rework-mvneta-napi_poll-loop-for-XDP-multi-buffers'
Lorenzo Bianconi says:
====================
rework mvneta napi_poll loop for XDP multi-buffers
Rework mvneta_rx_swbm routine in order to process all rx descriptors before
building the skb or run the xdp program attached to the interface.
Introduce xdp_get_shared_info_from_{buff,frame} utility routines to get the
skb_shared_info pointer from xdp_buff or xdp_frame.
This is a preliminary series to enable multi-buffers and jumbo frames for XDP
according to [1]
[1] https://github.com/xdp-project/xdp-project/blob/master/areas/core/xdp-multi-buffer01-design.org
Changes since v1:
- rely on skb_frag_* utility routines to access page/offset/len of the xdp multi-buffer
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/xdp.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/net/xdp.h b/include/net/xdp.h index 609f819ed08b..d3005bef812f 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -85,6 +85,12 @@ struct xdp_buff { ((xdp)->data_hard_start + (xdp)->frame_sz - \ SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) +static inline struct skb_shared_info * +xdp_get_shared_info_from_buff(struct xdp_buff *xdp) +{ + return (struct skb_shared_info *)xdp_data_hard_end(xdp); +} + struct xdp_frame { void *data; u16 len; @@ -98,6 +104,15 @@ struct xdp_frame { struct net_device *dev_rx; /* used by cpumap */ }; +static inline struct skb_shared_info * +xdp_get_shared_info_from_frame(struct xdp_frame *frame) +{ + void *data_hard_start = frame->data - frame->headroom - sizeof(*frame); + + return (struct skb_shared_info *)(data_hard_start + frame->frame_sz - + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))); +} + /* Clear kernel pointers in xdp_frame */ static inline void xdp_scrub_frame(struct xdp_frame *frame) { |