@@ -228,6 +228,9 @@ static int verify_xsk_metadata(struct xsk *xsk)
if (!ASSERT_EQ(meta->rx_vlan_proto, VLAN_PID, "rx_vlan_proto"))
return -1;
+ if (!ASSERT_EQ(meta->rx_csum_status, XDP_CHECKSUM_MAGIC, "rx_csum_status"))
+ return -1;
+
xsk_ring_cons__release(&xsk->rx, 1);
refill_rx(xsk, comp_addr);
@@ -26,6 +26,9 @@ extern int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, __u32 *hash,
extern int bpf_xdp_metadata_rx_vlan_tag(const struct xdp_md *ctx,
__be16 *vlan_proto,
__u16 *vlan_tci) __ksym;
+extern int bpf_xdp_metadata_rx_csum(const struct xdp_md *ctx,
+ enum xdp_csum_status *csum_status,
+ __wsum *csum) __ksym;
SEC("xdp")
int rx(struct xdp_md *ctx)
@@ -63,6 +66,14 @@ int rx(struct xdp_md *ctx)
bpf_xdp_metadata_rx_vlan_tag(ctx, &meta->rx_vlan_proto,
&meta->rx_vlan_tci);
+ /* This is supposed to fail on veth, so tell userspace
+ * everything is OK by passing a magic status.
+ */
+ ret = bpf_xdp_metadata_rx_csum(ctx, &meta->rx_csum_status,
+ &meta->rx_csum);
+ if (ret)
+ meta->rx_csum_status = XDP_CHECKSUM_MAGIC;
+
return bpf_redirect_map(&xsk, ctx->rx_queue_index, XDP_PASS);
}