Skip to content

Commit b756be9

Browse files
LorenzoBianconiKernel Patches Daemon
authored andcommitted
net: veth: Add xmo_rx_checksum callback to veth driver
Implement xmo_rx_checksum callback in veth driver to report RX checksum result to the eBPF program bounded to the NIC. Signed-off-by: Lorenzo Bianconi <[email protected]>
1 parent 5244ee0 commit b756be9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/net/veth.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,25 @@ static int veth_xdp_rx_vlan_tag(const struct xdp_md *ctx, __be16 *vlan_proto,
16921692
return err;
16931693
}
16941694

1695+
static int veth_xdp_rx_checksum(const struct xdp_md *ctx,
1696+
enum xdp_checksum *ip_summed,
1697+
u32 *cksum_meta)
1698+
{
1699+
const struct veth_xdp_buff *_ctx = (void *)ctx;
1700+
const struct sk_buff *skb = _ctx->skb;
1701+
1702+
if (!skb)
1703+
return -ENODATA;
1704+
1705+
/* For locally generated packets ip_summed is set to
1706+
* CHECKSUM_PARTIAL.
1707+
*/
1708+
*ip_summed = skb->ip_summed;
1709+
*cksum_meta = 0;
1710+
1711+
return 0;
1712+
}
1713+
16951714
static const struct net_device_ops veth_netdev_ops = {
16961715
.ndo_init = veth_dev_init,
16971716
.ndo_open = veth_open,
@@ -1717,6 +1736,7 @@ static const struct xdp_metadata_ops veth_xdp_metadata_ops = {
17171736
.xmo_rx_timestamp = veth_xdp_rx_timestamp,
17181737
.xmo_rx_hash = veth_xdp_rx_hash,
17191738
.xmo_rx_vlan_tag = veth_xdp_rx_vlan_tag,
1739+
.xmo_rx_checksum = veth_xdp_rx_checksum,
17201740
};
17211741

17221742
#define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HW_CSUM | \

0 commit comments

Comments
 (0)