forked from torvalds/linux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net, xdp: move XDP metadata helpers into new xdp_meta.h
<net/xdp.h> gets included indirectly into tons of different files across the kernel. To not make them dependent on the header files needed for the XDP metadata definitions, which will be used only by several driver and XDP core files, and have the metadata code logically separated, create a new header file, <net/xdp_meta.h>, and move several already existing metadata helpers to it. Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
- Loading branch information
Showing
10 changed files
with
37 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* Copyright (C) 2022, Intel Corporation. */ | ||
|
||
#ifndef __LINUX_NET_XDP_META_H__ | ||
#define __LINUX_NET_XDP_META_H__ | ||
|
||
#include <net/xdp.h> | ||
|
||
/* Drivers not supporting XDP metadata can use this helper, which | ||
* rejects any room expansion for metadata as a result. | ||
*/ | ||
static __always_inline void | ||
xdp_set_data_meta_invalid(struct xdp_buff *xdp) | ||
{ | ||
xdp->data_meta = xdp->data + 1; | ||
} | ||
|
||
static __always_inline bool | ||
xdp_data_meta_unsupported(const struct xdp_buff *xdp) | ||
{ | ||
return unlikely(xdp->data_meta > xdp->data); | ||
} | ||
|
||
static inline bool xdp_metalen_invalid(unsigned long metalen) | ||
{ | ||
return (metalen & (sizeof(__u32) - 1)) || (metalen > 32); | ||
} | ||
|
||
#endif /* __LINUX_NET_XDP_META_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters