aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/backport-5.15/605-v5.18-xdp-introduce-flags-field-in-xdp_buff-xdp_frame.patch
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2022-08-29 08:54:41 +0200
committerDaniel Golle <daniel@makrotopia.org>2022-09-22 23:55:02 +0100
commitc93c5365c0eb78ba8b479a9fe0cc5ec96f773978 (patch)
treeb250435d0f0e8e66c56d0486d1151d4eb1fc827e /target/linux/generic/backport-5.15/605-v5.18-xdp-introduce-flags-field-in-xdp_buff-xdp_frame.patch
parent524f52a471495d2c4e764539e000cb699610de1f (diff)
downloadupstream-c93c5365c0eb78ba8b479a9fe0cc5ec96f773978.tar.gz
upstream-c93c5365c0eb78ba8b479a9fe0cc5ec96f773978.tar.bz2
upstream-c93c5365c0eb78ba8b479a9fe0cc5ec96f773978.zip
kernel: pick patches for MediaTek Ethernet from linux-next
Pick patches with several fixes and improvements, preparation for upcoming WED (TX) [1] as well as basic XDP support [2] with MediaTek's Filogic SoCs to the mtk_eth_soc driver. Also pick follow-up patch fixing Ethernet on MT7621 [3]. Tested on Bananapi BPi-R3 (MT7986), Bananapi BPi-R64 (MT7622), Bananapi BPi-R2 (MT7623), MikroTik RouterBoard M11G (MT7621). [1]: https://patchwork.kernel.org/project/netdevbpf/list/?series=662108&state=* [2]: https://patchwork.kernel.org/project/netdevbpf/list/?series=675368&state=* (the first part of the series adding wed nodes to mt7986a.dtsi was applied to the copy of mt7986a.dtsi in our tree) [3]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=5e69163d3b9931098922b3fc2f8e786af8c1f37e Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux/generic/backport-5.15/605-v5.18-xdp-introduce-flags-field-in-xdp_buff-xdp_frame.patch')
-rw-r--r--target/linux/generic/backport-5.15/605-v5.18-xdp-introduce-flags-field-in-xdp_buff-xdp_frame.patch97
1 files changed, 97 insertions, 0 deletions
diff --git a/target/linux/generic/backport-5.15/605-v5.18-xdp-introduce-flags-field-in-xdp_buff-xdp_frame.patch b/target/linux/generic/backport-5.15/605-v5.18-xdp-introduce-flags-field-in-xdp_buff-xdp_frame.patch
new file mode 100644
index 0000000000..9c5a14c41b
--- /dev/null
+++ b/target/linux/generic/backport-5.15/605-v5.18-xdp-introduce-flags-field-in-xdp_buff-xdp_frame.patch
@@ -0,0 +1,97 @@
+commit 2e88d4ff03013937028f5397268b21e10cf68713
+Author: Lorenzo Bianconi <lorenzo@kernel.org>
+Date: Fri Jan 21 11:09:45 2022 +0100
+
+ xdp: introduce flags field in xdp_buff/xdp_frame
+
+ Introduce flags field in xdp_frame and xdp_buffer data structures
+ to define additional buffer features. At the moment the only
+ supported buffer feature is frags bit (XDP_FLAGS_HAS_FRAGS).
+ frags bit is used to specify if this is a linear buffer
+ (XDP_FLAGS_HAS_FRAGS not set) or a frags frame (XDP_FLAGS_HAS_FRAGS
+ set). In the latter case the driver is expected to initialize the
+ skb_shared_info structure at the end of the first buffer to link together
+ subsequent buffers belonging to the same frame.
+
+ Acked-by: Toke Hoiland-Jorgensen <toke@redhat.com>
+ Acked-by: John Fastabend <john.fastabend@gmail.com>
+ Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
+ Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
+ Link: https://lore.kernel.org/r/e389f14f3a162c0a5bc6a2e1aa8dd01a90be117d.1642758637.git.lorenzo@kernel.org
+ Signed-off-by: Alexei Starovoitov <ast@kernel.org>
+
+--- a/include/net/xdp.h
++++ b/include/net/xdp.h
+@@ -66,6 +66,10 @@ struct xdp_txq_info {
+ struct net_device *dev;
+ };
+
++enum xdp_buff_flags {
++ XDP_FLAGS_HAS_FRAGS = BIT(0), /* non-linear xdp buff */
++};
++
+ struct xdp_buff {
+ void *data;
+ void *data_end;
+@@ -74,13 +78,30 @@ struct xdp_buff {
+ struct xdp_rxq_info *rxq;
+ struct xdp_txq_info *txq;
+ u32 frame_sz; /* frame size to deduce data_hard_end/reserved tailroom*/
++ u32 flags; /* supported values defined in xdp_buff_flags */
+ };
+
++static __always_inline bool xdp_buff_has_frags(struct xdp_buff *xdp)
++{
++ return !!(xdp->flags & XDP_FLAGS_HAS_FRAGS);
++}
++
++static __always_inline void xdp_buff_set_frags_flag(struct xdp_buff *xdp)
++{
++ xdp->flags |= XDP_FLAGS_HAS_FRAGS;
++}
++
++static __always_inline void xdp_buff_clear_frags_flag(struct xdp_buff *xdp)
++{
++ xdp->flags &= ~XDP_FLAGS_HAS_FRAGS;
++}
++
+ static __always_inline void
+ xdp_init_buff(struct xdp_buff *xdp, u32 frame_sz, struct xdp_rxq_info *rxq)
+ {
+ xdp->frame_sz = frame_sz;
+ xdp->rxq = rxq;
++ xdp->flags = 0;
+ }
+
+ static __always_inline void
+@@ -122,8 +143,14 @@ struct xdp_frame {
+ */
+ struct xdp_mem_info mem;
+ struct net_device *dev_rx; /* used by cpumap */
++ u32 flags; /* supported values defined in xdp_buff_flags */
+ };
+
++static __always_inline bool xdp_frame_has_frags(struct xdp_frame *frame)
++{
++ return !!(frame->flags & XDP_FLAGS_HAS_FRAGS);
++}
++
+ #define XDP_BULK_QUEUE_SIZE 16
+ struct xdp_frame_bulk {
+ int count;
+@@ -180,6 +207,7 @@ void xdp_convert_frame_to_buff(struct xd
+ xdp->data_end = frame->data + frame->len;
+ xdp->data_meta = frame->data - frame->metasize;
+ xdp->frame_sz = frame->frame_sz;
++ xdp->flags = frame->flags;
+ }
+
+ static inline
+@@ -206,6 +234,7 @@ int xdp_update_frame_from_buff(struct xd
+ xdp_frame->headroom = headroom - sizeof(*xdp_frame);
+ xdp_frame->metasize = metasize;
+ xdp_frame->frame_sz = xdp->frame_sz;
++ xdp_frame->flags = xdp->flags;
+
+ return 0;
+ }