Skip to content

Commit 5a34443

Browse files
orospivecera
authored andcommitted
veth: Implement VLAN tag XDP hint
JIRA: https://issues.redhat.com/browse/RHEL-31890 Upstream commit(s): commit fca7837 Author: Larysa Zaremba <larysa.zaremba@intel.com> Date: Tue Dec 5 22:08:41 2023 +0100 veth: Implement VLAN tag XDP hint In order to test VLAN tag hint in hardware-independent selftests, implement newly added hint in veth driver. Acked-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> Link: https://lore.kernel.org/r/20231205210847.28460-13-larysa.zaremba@intel.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Petr Oros <poros@redhat.com>
1 parent ed77f2d commit 5a34443

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/net/veth.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,24 @@ static int veth_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash,
16831683
return 0;
16841684
}
16851685

1686+
static int veth_xdp_rx_vlan_tag(const struct xdp_md *ctx, __be16 *vlan_proto,
1687+
u16 *vlan_tci)
1688+
{
1689+
const struct veth_xdp_buff *_ctx = (void *)ctx;
1690+
const struct sk_buff *skb = _ctx->skb;
1691+
int err;
1692+
1693+
if (!skb)
1694+
return -ENODATA;
1695+
1696+
err = __vlan_hwaccel_get_tag(skb, vlan_tci);
1697+
if (err)
1698+
return err;
1699+
1700+
*vlan_proto = skb->vlan_proto;
1701+
return err;
1702+
}
1703+
16861704
static const struct net_device_ops veth_netdev_ops = {
16871705
.ndo_init = veth_dev_init,
16881706
.ndo_open = veth_open,
@@ -1707,6 +1725,7 @@ static const struct net_device_ops veth_netdev_ops = {
17071725
static const struct xdp_metadata_ops veth_xdp_metadata_ops = {
17081726
.xmo_rx_timestamp = veth_xdp_rx_timestamp,
17091727
.xmo_rx_hash = veth_xdp_rx_hash,
1728+
.xmo_rx_vlan_tag = veth_xdp_rx_vlan_tag,
17101729
};
17111730

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

0 commit comments

Comments
 (0)