Today Windows has a different format for xdp_md than Linux does, which interferes with cross-platform portability and blocks a future feature of supporting in-market offload cards like Netronomes.
typedef struct xdp_md_
{
void* data; ///< Pointer to start of packet data.
void* data_end; ///< Pointer to end of packet data.
uint64_t data_meta; ///< Packet metadata.
uint32_t ingress_ifindex; ///< Ingress interface index.
/* size: 26, cachelines: 1, members: 4 */
/* last cacheline: 26 bytes */
} xdp_md_t;
data, data_end, and data_meta are 32-bit in Linux, but 64 bit in Windows.
In the context of BPF and XDP, data and data_end are not traditional pointers. Instead, they are offsets from the start of the packet data[2]. These offsets are relative to a base address that is not directly accessible in the BPF program[2]. This design choice is part of the security and safety features of BPF, as it prevents arbitrary memory access[2].
When the BPF program runs, it calculates the actual addresses by adding these offsets to the base address[2]. This calculation is done in 64 bits, which is why the effective pointer size in BPF is 64 bits[2].
Proposed solution
data, data_end, and data_meta should be 32-bit fields in the source, which get converted to 64-bits at time of compation to native code (bpf2c or JIT).
Describe the feature you'd like supported
Today Windows has a different format for xdp_md than Linux does, which interferes with cross-platform portability and blocks a future feature of supporting in-market offload cards like Netronomes.
Linux:
Windows:
data, data_end, and data_meta are 32-bit in Linux, but 64 bit in Windows.
In the context of BPF and XDP, data and data_end are not traditional pointers. Instead, they are offsets from the start of the packet data[2]. These offsets are relative to a base address that is not directly accessible in the BPF program[2]. This design choice is part of the security and safety features of BPF, as it prevents arbitrary memory access[2].
When the BPF program runs, it calculates the actual addresses by adding these offsets to the base address[2]. This calculation is done in 64 bits, which is why the effective pointer size in BPF is 64 bits[2].
Proposed solution
data, data_end, and data_meta should be 32-bit fields in the source, which get converted to 64-bits at time of compation to native code (bpf2c or JIT).
Additional context
No response