|
@@ -4545,7 +4545,7 @@ static int __netif_receive_skb(struct sk_buff *skb)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int generic_xdp_install(struct net_device *dev, struct netdev_xdp *xdp)
|
|
|
|
|
|
+static int generic_xdp_install(struct net_device *dev, struct netdev_bpf *xdp)
|
|
{
|
|
{
|
|
struct bpf_prog *old = rtnl_dereference(dev->xdp_prog);
|
|
struct bpf_prog *old = rtnl_dereference(dev->xdp_prog);
|
|
struct bpf_prog *new = xdp->prog;
|
|
struct bpf_prog *new = xdp->prog;
|
|
@@ -7090,26 +7090,26 @@ int dev_change_proto_down(struct net_device *dev, bool proto_down)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(dev_change_proto_down);
|
|
EXPORT_SYMBOL(dev_change_proto_down);
|
|
|
|
|
|
-u8 __dev_xdp_attached(struct net_device *dev, xdp_op_t xdp_op, u32 *prog_id)
|
|
|
|
|
|
+u8 __dev_xdp_attached(struct net_device *dev, bpf_op_t bpf_op, u32 *prog_id)
|
|
{
|
|
{
|
|
- struct netdev_xdp xdp;
|
|
|
|
|
|
+ struct netdev_bpf xdp;
|
|
|
|
|
|
memset(&xdp, 0, sizeof(xdp));
|
|
memset(&xdp, 0, sizeof(xdp));
|
|
xdp.command = XDP_QUERY_PROG;
|
|
xdp.command = XDP_QUERY_PROG;
|
|
|
|
|
|
/* Query must always succeed. */
|
|
/* Query must always succeed. */
|
|
- WARN_ON(xdp_op(dev, &xdp) < 0);
|
|
|
|
|
|
+ WARN_ON(bpf_op(dev, &xdp) < 0);
|
|
if (prog_id)
|
|
if (prog_id)
|
|
*prog_id = xdp.prog_id;
|
|
*prog_id = xdp.prog_id;
|
|
|
|
|
|
return xdp.prog_attached;
|
|
return xdp.prog_attached;
|
|
}
|
|
}
|
|
|
|
|
|
-static int dev_xdp_install(struct net_device *dev, xdp_op_t xdp_op,
|
|
|
|
|
|
+static int dev_xdp_install(struct net_device *dev, bpf_op_t bpf_op,
|
|
struct netlink_ext_ack *extack, u32 flags,
|
|
struct netlink_ext_ack *extack, u32 flags,
|
|
struct bpf_prog *prog)
|
|
struct bpf_prog *prog)
|
|
{
|
|
{
|
|
- struct netdev_xdp xdp;
|
|
|
|
|
|
+ struct netdev_bpf xdp;
|
|
|
|
|
|
memset(&xdp, 0, sizeof(xdp));
|
|
memset(&xdp, 0, sizeof(xdp));
|
|
if (flags & XDP_FLAGS_HW_MODE)
|
|
if (flags & XDP_FLAGS_HW_MODE)
|
|
@@ -7120,7 +7120,7 @@ static int dev_xdp_install(struct net_device *dev, xdp_op_t xdp_op,
|
|
xdp.flags = flags;
|
|
xdp.flags = flags;
|
|
xdp.prog = prog;
|
|
xdp.prog = prog;
|
|
|
|
|
|
- return xdp_op(dev, &xdp);
|
|
|
|
|
|
+ return bpf_op(dev, &xdp);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -7137,24 +7137,24 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
|
|
{
|
|
{
|
|
const struct net_device_ops *ops = dev->netdev_ops;
|
|
const struct net_device_ops *ops = dev->netdev_ops;
|
|
struct bpf_prog *prog = NULL;
|
|
struct bpf_prog *prog = NULL;
|
|
- xdp_op_t xdp_op, xdp_chk;
|
|
|
|
|
|
+ bpf_op_t bpf_op, bpf_chk;
|
|
int err;
|
|
int err;
|
|
|
|
|
|
ASSERT_RTNL();
|
|
ASSERT_RTNL();
|
|
|
|
|
|
- xdp_op = xdp_chk = ops->ndo_xdp;
|
|
|
|
- if (!xdp_op && (flags & (XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE)))
|
|
|
|
|
|
+ bpf_op = bpf_chk = ops->ndo_bpf;
|
|
|
|
+ if (!bpf_op && (flags & (XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE)))
|
|
return -EOPNOTSUPP;
|
|
return -EOPNOTSUPP;
|
|
- if (!xdp_op || (flags & XDP_FLAGS_SKB_MODE))
|
|
|
|
- xdp_op = generic_xdp_install;
|
|
|
|
- if (xdp_op == xdp_chk)
|
|
|
|
- xdp_chk = generic_xdp_install;
|
|
|
|
|
|
+ if (!bpf_op || (flags & XDP_FLAGS_SKB_MODE))
|
|
|
|
+ bpf_op = generic_xdp_install;
|
|
|
|
+ if (bpf_op == bpf_chk)
|
|
|
|
+ bpf_chk = generic_xdp_install;
|
|
|
|
|
|
if (fd >= 0) {
|
|
if (fd >= 0) {
|
|
- if (xdp_chk && __dev_xdp_attached(dev, xdp_chk, NULL))
|
|
|
|
|
|
+ if (bpf_chk && __dev_xdp_attached(dev, bpf_chk, NULL))
|
|
return -EEXIST;
|
|
return -EEXIST;
|
|
if ((flags & XDP_FLAGS_UPDATE_IF_NOEXIST) &&
|
|
if ((flags & XDP_FLAGS_UPDATE_IF_NOEXIST) &&
|
|
- __dev_xdp_attached(dev, xdp_op, NULL))
|
|
|
|
|
|
+ __dev_xdp_attached(dev, bpf_op, NULL))
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
|
|
|
|
prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_XDP);
|
|
prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_XDP);
|
|
@@ -7162,7 +7162,7 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
|
|
return PTR_ERR(prog);
|
|
return PTR_ERR(prog);
|
|
}
|
|
}
|
|
|
|
|
|
- err = dev_xdp_install(dev, xdp_op, extack, flags, prog);
|
|
|
|
|
|
+ err = dev_xdp_install(dev, bpf_op, extack, flags, prog);
|
|
if (err < 0 && prog)
|
|
if (err < 0 && prog)
|
|
bpf_prog_put(prog);
|
|
bpf_prog_put(prog);
|
|
|
|
|