]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xsk: move xsk_tx_metadata_request() to xdp_sock_drv.h
authorStanislav Fomichev <sdf.kernel@gmail.com>
Mon, 27 Jul 2026 16:19:58 +0000 (09:19 -0700)
committerJakub Kicinski <kuba@kernel.org>
Mon, 3 Aug 2026 23:43:54 +0000 (16:43 -0700)
xsk_tx_metadata_request() must validate metadata with
xsk_buff_valid_tx_metadata(), which is defined in xdp_sock_drv.h. Move the
helper there before adding that dependency. All callers already include
the destination header, so this has no functional effect.

Fixes: ca4419f15abd ("xsk: Add launch time hardware offload support to XDP Tx metadata")
Cc: Cen Zhang (Microsoft) <blbllhy@gmail.com>
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260727161959.885642-6-sdf@fomichev.me
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/xdp_sock.h
include/net/xdp_sock_drv.h

index 2b2eb9b9d580e41079a1d8f64193e99f5cb3711e..6e70b320b399f8edf881ee586f5fe43ed31cd79a 100644 (file)
@@ -153,43 +153,6 @@ static inline void xsk_tx_metadata_to_compl(struct xsk_tx_metadata *meta,
        compl->tx_timestamp = &meta->completion.tx_timestamp;
 }
 
-/**
- *  xsk_tx_metadata_request - Evaluate AF_XDP TX metadata at submission
- *  and call appropriate xsk_tx_metadata_ops operation.
- *  @pmeta: pointer to pointer to AF_XDP metadata area
- *  @ops: pointer to struct xsk_tx_metadata_ops
- *  @priv: pointer to driver-private aread
- *
- *  This function should be called by the networking device when
- *  it prepares AF_XDP egress packet.
- */
-static inline void xsk_tx_metadata_request(struct xsk_tx_metadata **pmeta,
-                                          const struct xsk_tx_metadata_ops *ops,
-                                          void *priv)
-{
-       const struct xsk_tx_metadata *meta = *pmeta;
-
-       if (!meta)
-               return;
-
-       if (ops->tmo_request_launch_time)
-               if (meta->flags & XDP_TXMD_FLAGS_LAUNCH_TIME)
-                       ops->tmo_request_launch_time(meta->request.launch_time,
-                                                    priv);
-
-       if (ops->tmo_request_timestamp)
-               if (meta->flags & XDP_TXMD_FLAGS_TIMESTAMP)
-                       ops->tmo_request_timestamp(priv);
-
-       if (ops->tmo_request_checksum)
-               if (meta->flags & XDP_TXMD_FLAGS_CHECKSUM)
-                       ops->tmo_request_checksum(meta->request.csum_start,
-                                                 meta->request.csum_offset, priv);
-
-       if (!(meta->flags & XDP_TXMD_FLAGS_TIMESTAMP))
-               *pmeta = NULL;
-}
-
 /**
  *  xsk_tx_metadata_complete - Evaluate AF_XDP TX metadata at completion
  *  and call appropriate xsk_tx_metadata_ops operation.
@@ -239,12 +202,6 @@ static inline void xsk_tx_metadata_to_compl(struct xsk_tx_metadata *meta,
 {
 }
 
-static inline void xsk_tx_metadata_request(struct xsk_tx_metadata **pmeta,
-                                          const struct xsk_tx_metadata_ops *ops,
-                                          void *priv)
-{
-}
-
 static inline void xsk_tx_metadata_complete(struct xsk_tx_metadata_compl *compl,
                                            const struct xsk_tx_metadata_ops *ops,
                                            void *priv)
index 68a78760135721190daa74ce8d764d74bc138fd8..f87c4215673edb589761f087bb741252f015e2db 100644 (file)
@@ -271,6 +271,43 @@ xsk_buff_valid_tx_metadata(const struct xsk_buff_pool *pool,
        return !(*flags & ~XDP_TXMD_FLAGS_VALID);
 }
 
+/**
+ *  xsk_tx_metadata_request - Evaluate AF_XDP TX metadata at submission
+ *  and call appropriate xsk_tx_metadata_ops operation.
+ *  @pmeta: pointer to pointer to AF_XDP metadata area
+ *  @ops: pointer to struct xsk_tx_metadata_ops
+ *  @priv: pointer to driver-private aread
+ *
+ *  This function should be called by the networking device when
+ *  it prepares AF_XDP egress packet.
+ */
+static inline void xsk_tx_metadata_request(struct xsk_tx_metadata **pmeta,
+                                          const struct xsk_tx_metadata_ops *ops,
+                                          void *priv)
+{
+       const struct xsk_tx_metadata *meta = *pmeta;
+
+       if (!meta)
+               return;
+
+       if (ops->tmo_request_launch_time)
+               if (meta->flags & XDP_TXMD_FLAGS_LAUNCH_TIME)
+                       ops->tmo_request_launch_time(meta->request.launch_time,
+                                                    priv);
+
+       if (ops->tmo_request_timestamp)
+               if (meta->flags & XDP_TXMD_FLAGS_TIMESTAMP)
+                       ops->tmo_request_timestamp(priv);
+
+       if (ops->tmo_request_checksum)
+               if (meta->flags & XDP_TXMD_FLAGS_CHECKSUM)
+                       ops->tmo_request_checksum(meta->request.csum_start,
+                                                 meta->request.csum_offset, priv);
+
+       if (!(meta->flags & XDP_TXMD_FLAGS_TIMESTAMP))
+               *pmeta = NULL;
+}
+
 static inline struct xsk_tx_metadata *
 __xsk_buff_get_metadata(const struct xsk_buff_pool *pool, void *data)
 {
@@ -483,6 +520,12 @@ xsk_buff_valid_tx_metadata(const struct xsk_buff_pool *pool,
        return false;
 }
 
+static inline void xsk_tx_metadata_request(struct xsk_tx_metadata **pmeta,
+                                          const struct xsk_tx_metadata_ops *ops,
+                                          void *priv)
+{
+}
+
 static inline struct xsk_tx_metadata *
 __xsk_buff_get_metadata(const struct xsk_buff_pool *pool, void *data)
 {