Lines Matching defs:link
7720 /* Ensure that master link is always the first item in list. */
7778 pr_debug("adjacency: dev_put for %s, because link removed from %s to %s\n",
7908 * netdev_upper_dev_link - Add a link to the upper device
7913 * Adds a link to device which is upper to this one. The caller must hold
7933 * netdev_master_upper_dev_link - Add a master link to the upper device
7940 * Adds a link to device which is upper to this one. In this case, only
7994 * netdev_upper_dev_unlink - Removes a link to upper device
7998 * Removes a link to device which is upper to this one. The caller must hold
9005 struct bpf_link link;
9037 return dev->xdp_state[mode].link;
9043 struct bpf_xdp_link *link = dev_xdp_link(dev, mode);
9045 if (link)
9046 return link->link.prog;
9056 if (dev->xdp_state[i].prog || dev->xdp_state[i].link)
9069 struct bpf_xdp_link *link)
9071 dev->xdp_state[mode].link = link;
9078 dev->xdp_state[mode].link = NULL;
9098 * Given net_device also owns link/prog, we need to bump refcnt here
9118 struct bpf_xdp_link *link;
9136 /* auto-detach link from net device */
9137 link = dev_xdp_link(dev, mode);
9138 if (link)
9139 link->dev = NULL;
9148 struct bpf_xdp_link *link, struct bpf_prog *new_prog,
9159 /* either link or prog attachment, never both */
9160 if (link && (new_prog || old_prog))
9162 /* link supports only XDP mode flags */
9163 if (link && (flags & ~XDP_FLAGS_MODES)) {
9164 NL_SET_ERR_MSG(extack, "Invalid XDP flags for BPF link attachment");
9185 /* can't replace attached link */
9187 NL_SET_ERR_MSG(extack, "Can't replace active BPF XDP link");
9192 /* can't replace attached prog with link */
9193 if (link && cur_prog) {
9194 NL_SET_ERR_MSG(extack, "Can't replace active XDP program with BPF link");
9203 if (link)
9204 new_prog = link->link.prog;
9246 if (link)
9247 dev_xdp_set_link(dev, mode, link);
9258 struct bpf_xdp_link *link)
9260 return dev_xdp_attach(dev, extack, link, NULL, NULL, link->flags);
9265 struct bpf_xdp_link *link)
9272 mode = dev_xdp_mode(dev, link->flags);
9273 if (dev_xdp_link(dev, mode) != link)
9282 static void bpf_xdp_link_release(struct bpf_link *link)
9284 struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
9289 * already NULL, in which case link was already auto-detached
9299 static int bpf_xdp_link_detach(struct bpf_link *link)
9301 bpf_xdp_link_release(link);
9305 static void bpf_xdp_link_dealloc(struct bpf_link *link)
9307 struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
9312 static void bpf_xdp_link_show_fdinfo(const struct bpf_link *link,
9315 struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
9326 static int bpf_xdp_link_fill_link_info(const struct bpf_link *link,
9329 struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
9341 static int bpf_xdp_link_update(struct bpf_link *link, struct bpf_prog *new_prog,
9344 struct bpf_xdp_link *xdp_link = container_of(link, struct bpf_xdp_link, link);
9351 /* link might have been auto-released already, so fail */
9357 if (old_prog && link->prog != old_prog) {
9361 old_prog = link->prog;
9381 old_prog = xchg(&link->prog, new_prog);
9402 struct bpf_xdp_link *link;
9413 link = kzalloc(sizeof(*link), GFP_USER);
9414 if (!link) {
9419 bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog);
9420 link->dev = dev;
9421 link->flags = attr->link_create.flags;
9423 err = bpf_link_prime(&link->link, &link_primer);
9425 kfree(link);
9429 err = dev_xdp_attach_link(dev, NULL, link);
9433 link->dev = NULL;
9439 /* link itself doesn't hold dev's refcnt to not complicate shutdown */