linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>,
	David Miller <davem@davemloft.net>,
	Networking <netdev@vger.kernel.org>
Cc: Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Roopa Prabhu <roopa@cumulusnetworks.com>,
	Andrii Nakryiko <andriin@fb.com>
Subject: linux-next: manual merge of the bpf-next tree with the net-next tree
Date: Mon, 3 Aug 2020 13:05:26 +1000	[thread overview]
Message-ID: <20200803130526.5a1519e2@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 4107 bytes --]

Hi all,

Today's linux-next merge of the bpf-next tree got a conflict in:

  net/core/dev.c

between commit:

  829eb208e80d ("rtnetlink: add support for protodown reason")

from the net-next tree and commits:

  7f0a838254bd ("bpf, xdp: Maintain info on attached XDP BPF programs in net_device")
  aa8d3a716b59 ("bpf, xdp: Add bpf_link-based XDP attachment API")

from the bpf-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc net/core/dev.c
index f7ef0f5c5569,c8b911b10187..000000000000
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@@ -8715,54 -8712,75 +8711,100 @@@ int dev_change_proto_down_generic(struc
  }
  EXPORT_SYMBOL(dev_change_proto_down_generic);
  
 +/**
 + *	dev_change_proto_down_reason - proto down reason
 + *
 + *	@dev: device
 + *	@mask: proto down mask
 + *	@value: proto down value
 + */
 +void dev_change_proto_down_reason(struct net_device *dev, unsigned long mask,
 +				  u32 value)
 +{
 +	int b;
 +
 +	if (!mask) {
 +		dev->proto_down_reason = value;
 +	} else {
 +		for_each_set_bit(b, &mask, 32) {
 +			if (value & (1 << b))
 +				dev->proto_down_reason |= BIT(b);
 +			else
 +				dev->proto_down_reason &= ~BIT(b);
 +		}
 +	}
 +}
 +EXPORT_SYMBOL(dev_change_proto_down_reason);
 +
- u32 __dev_xdp_query(struct net_device *dev, bpf_op_t bpf_op,
- 		    enum bpf_netdev_command cmd)
+ struct bpf_xdp_link {
+ 	struct bpf_link link;
+ 	struct net_device *dev; /* protected by rtnl_lock, no refcnt held */
+ 	int flags;
+ };
+ 
+ static enum bpf_xdp_mode dev_xdp_mode(u32 flags)
  {
- 	struct netdev_bpf xdp;
+ 	if (flags & XDP_FLAGS_HW_MODE)
+ 		return XDP_MODE_HW;
+ 	if (flags & XDP_FLAGS_DRV_MODE)
+ 		return XDP_MODE_DRV;
+ 	return XDP_MODE_SKB;
+ }
  
- 	if (!bpf_op)
- 		return 0;
+ static bpf_op_t dev_xdp_bpf_op(struct net_device *dev, enum bpf_xdp_mode mode)
+ {
+ 	switch (mode) {
+ 	case XDP_MODE_SKB:
+ 		return generic_xdp_install;
+ 	case XDP_MODE_DRV:
+ 	case XDP_MODE_HW:
+ 		return dev->netdev_ops->ndo_bpf;
+ 	default:
+ 		return NULL;
+ 	};
+ }
  
- 	memset(&xdp, 0, sizeof(xdp));
- 	xdp.command = cmd;
+ static struct bpf_xdp_link *dev_xdp_link(struct net_device *dev,
+ 					 enum bpf_xdp_mode mode)
+ {
+ 	return dev->xdp_state[mode].link;
+ }
+ 
+ static struct bpf_prog *dev_xdp_prog(struct net_device *dev,
+ 				     enum bpf_xdp_mode mode)
+ {
+ 	struct bpf_xdp_link *link = dev_xdp_link(dev, mode);
+ 
+ 	if (link)
+ 		return link->link.prog;
+ 	return dev->xdp_state[mode].prog;
+ }
+ 
+ u32 dev_xdp_prog_id(struct net_device *dev, enum bpf_xdp_mode mode)
+ {
+ 	struct bpf_prog *prog = dev_xdp_prog(dev, mode);
  
- 	/* Query must always succeed. */
- 	WARN_ON(bpf_op(dev, &xdp) < 0 && cmd == XDP_QUERY_PROG);
+ 	return prog ? prog->aux->id : 0;
+ }
  
- 	return xdp.prog_id;
+ static void dev_xdp_set_link(struct net_device *dev, enum bpf_xdp_mode mode,
+ 			     struct bpf_xdp_link *link)
+ {
+ 	dev->xdp_state[mode].link = link;
+ 	dev->xdp_state[mode].prog = NULL;
  }
  
- static int dev_xdp_install(struct net_device *dev, bpf_op_t bpf_op,
- 			   struct netlink_ext_ack *extack, u32 flags,
- 			   struct bpf_prog *prog)
+ static void dev_xdp_set_prog(struct net_device *dev, enum bpf_xdp_mode mode,
+ 			     struct bpf_prog *prog)
+ {
+ 	dev->xdp_state[mode].link = NULL;
+ 	dev->xdp_state[mode].prog = prog;
+ }
+ 
+ static int dev_xdp_install(struct net_device *dev, enum bpf_xdp_mode mode,
+ 			   bpf_op_t bpf_op, struct netlink_ext_ack *extack,
+ 			   u32 flags, struct bpf_prog *prog)
  {
- 	bool non_hw = !(flags & XDP_FLAGS_HW_MODE);
- 	struct bpf_prog *prev_prog = NULL;
  	struct netdev_bpf xdp;
  	int err;
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2020-08-03  3:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  3:05 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-12-17 23:29 linux-next: manual merge of the bpf-next tree with the net-next tree Stephen Rothwell
2023-12-14 23:56 Stephen Rothwell
2023-11-30 22:47 Stephen Rothwell
2023-04-13 16:12 broonie
2023-04-13 16:31 ` Christian Ehrig
2023-03-19 23:09 Stephen Rothwell
2023-03-20  3:17 ` Bagas Sanjaya
2023-02-19 23:00 Stephen Rothwell
2023-02-20 11:53 ` Alexander Lobakin
2023-02-06 23:19 Stephen Rothwell
2022-05-11  1:10 Stephen Rothwell
2021-01-25  0:12 Stephen Rothwell
2021-01-25 16:09 ` Stanislav Fomichev
2021-01-25 18:03 ` Arjun Roy
2021-02-14 21:12 ` Stephen Rothwell
2021-02-14 21:40   ` Arjun Roy
2021-02-14 23:00     ` Stephen Rothwell
2020-07-21  2:16 Stephen Rothwell
2020-07-21  8:53 ` Lorenzo Bianconi
2020-07-21  2:12 Stephen Rothwell
2019-11-24 23:58 Stephen Rothwell
2019-11-25  1:19 ` Alexei Starovoitov
2019-07-01  4:47 Stephen Rothwell
2018-11-21 23:36 Stephen Rothwell
2018-04-26  0:49 Stephen Rothwell
2018-04-26  7:56 ` Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200803130526.5a1519e2@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).