bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: kbuild-all@01.org, Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	Marek Majkowski <marek@cloudflare.com>,
	Lorenz Bauer <lmb@cloudflare.com>,
	David Miller <davem@davemloft.net>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 3/9] xdp: Support setting and getting device chain map
Date: Thu, 3 Oct 2019 02:07:24 +0800	[thread overview]
Message-ID: <201910030245.Ozf2sARI%lkp@intel.com> (raw)
In-Reply-To: <157002302784.1302756.2073486805381846919.stgit@alrua-x1>

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

Hi "Toke,

I love your patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Toke-H-iland-J-rgensen/xdp-Support-multiple-programs-on-a-single-interface-through-chain-calls/20191003-005238
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   net/core/dev.c: In function 'dev_xdp_uninstall':
>> net/core/dev.c:8187:3: error: implicit declaration of function 'bpf_map_put_with_uref' [-Werror=implicit-function-declaration]
      bpf_map_put_with_uref(chain_map);
      ^~~~~~~~~~~~~~~~~~~~~
   net/core/dev.c: In function 'dev_change_xdp_fd':
>> net/core/dev.c:8286:15: error: implicit declaration of function 'bpf_map_get_with_uref'; did you mean 'bpf_obj_get_user'? [-Werror=implicit-function-declaration]
      chain_map = bpf_map_get_with_uref(chain_map_fd);
                  ^~~~~~~~~~~~~~~~~~~~~
                  bpf_obj_get_user
>> net/core/dev.c:8286:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      chain_map = bpf_map_get_with_uref(chain_map_fd);
                ^
   cc1: some warnings being treated as errors

vim +/bpf_map_put_with_uref +8187 net/core/dev.c

  8177	
  8178	static void dev_xdp_uninstall(struct net_device *dev)
  8179	{
  8180		struct bpf_map *chain_map = NULL;
  8181		struct netdev_bpf xdp;
  8182		bpf_op_t ndo_bpf;
  8183	
  8184		/* Remove chain map */
  8185		rcu_swap_protected(dev->xdp_chain_map, chain_map, 1);
  8186		if(chain_map)
> 8187			bpf_map_put_with_uref(chain_map);
  8188	
  8189		/* Remove generic XDP */
  8190		WARN_ON(dev_xdp_install(dev, generic_xdp_install, NULL, 0, NULL));
  8191	
  8192		/* Remove from the driver */
  8193		ndo_bpf = dev->netdev_ops->ndo_bpf;
  8194		if (!ndo_bpf)
  8195			return;
  8196	
  8197		memset(&xdp, 0, sizeof(xdp));
  8198		xdp.command = XDP_QUERY_PROG;
  8199		WARN_ON(ndo_bpf(dev, &xdp));
  8200		if (xdp.prog_id)
  8201			WARN_ON(dev_xdp_install(dev, ndo_bpf, NULL, xdp.prog_flags,
  8202						NULL));
  8203	
  8204		/* Remove HW offload */
  8205		memset(&xdp, 0, sizeof(xdp));
  8206		xdp.command = XDP_QUERY_PROG_HW;
  8207		if (!ndo_bpf(dev, &xdp) && xdp.prog_id)
  8208			WARN_ON(dev_xdp_install(dev, ndo_bpf, NULL, xdp.prog_flags,
  8209						NULL));
  8210	}
  8211	
  8212	/**
  8213	 *	dev_change_xdp_fd - set or clear a bpf program for a device rx path
  8214	 *	@dev: device
  8215	 *	@extack: netlink extended ack
  8216	 *	@prog_fd: new program fd or negative value to clear
  8217	 *	@chain_map_fd: new chain map fd or negative value to clear
  8218	 *	@flags: xdp-related flags
  8219	 *
  8220	 *	Set or clear a bpf program for a device
  8221	 */
  8222	int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
  8223			      int prog_fd, int chain_map_fd, u32 flags)
  8224	{
  8225		const struct net_device_ops *ops = dev->netdev_ops;
  8226		struct bpf_map *chain_map = NULL;
  8227		enum bpf_netdev_command query;
  8228		struct bpf_prog *prog = NULL;
  8229		bpf_op_t bpf_op, bpf_chk;
  8230		bool offload;
  8231		int err;
  8232	
  8233		ASSERT_RTNL();
  8234	
  8235		offload = flags & XDP_FLAGS_HW_MODE;
  8236		query = offload ? XDP_QUERY_PROG_HW : XDP_QUERY_PROG;
  8237	
  8238		bpf_op = bpf_chk = ops->ndo_bpf;
  8239		if (!bpf_op && (flags & (XDP_FLAGS_DRV_MODE | XDP_FLAGS_HW_MODE))) {
  8240			NL_SET_ERR_MSG(extack, "underlying driver does not support XDP in native mode");
  8241			return -EOPNOTSUPP;
  8242		}
  8243		if (!bpf_op || (flags & XDP_FLAGS_SKB_MODE))
  8244			bpf_op = generic_xdp_install;
  8245		if (bpf_op == bpf_chk)
  8246			bpf_chk = generic_xdp_install;
  8247	
  8248		if (prog_fd >= 0) {
  8249			u32 prog_id;
  8250	
  8251			if (!offload && __dev_xdp_query(dev, bpf_chk, XDP_QUERY_PROG)) {
  8252				NL_SET_ERR_MSG(extack, "native and generic XDP can't be active at the same time");
  8253				return -EEXIST;
  8254			}
  8255	
  8256			prog_id = __dev_xdp_query(dev, bpf_op, query);
  8257			if ((flags & XDP_FLAGS_UPDATE_IF_NOEXIST) && prog_id) {
  8258				NL_SET_ERR_MSG(extack, "XDP program already attached");
  8259				return -EBUSY;
  8260			}
  8261	
  8262			prog = bpf_prog_get_type_dev(prog_fd, BPF_PROG_TYPE_XDP,
  8263						     bpf_op == ops->ndo_bpf);
  8264			if (IS_ERR(prog))
  8265				return PTR_ERR(prog);
  8266	
  8267			if (!offload && bpf_prog_is_dev_bound(prog->aux)) {
  8268				NL_SET_ERR_MSG(extack, "using device-bound program without HW_MODE flag is not supported");
  8269				bpf_prog_put(prog);
  8270				return -EINVAL;
  8271			}
  8272	
  8273			if (prog->aux->id == prog_id) {
  8274				bpf_prog_put(prog);
  8275				return 0;
  8276			}
  8277		} else {
  8278			if (chain_map_fd >= 0)
  8279				return -EINVAL;
  8280	
  8281			if (!__dev_xdp_query(dev, bpf_op, query))
  8282				return 0;
  8283		}
  8284	
  8285		if (chain_map_fd >= 0) {
> 8286			chain_map = bpf_map_get_with_uref(chain_map_fd);
  8287			if (IS_ERR(chain_map))
  8288				return PTR_ERR(chain_map);
  8289	
  8290			if (chain_map->map_type != BPF_MAP_TYPE_XDP_CHAIN) {
  8291				NL_SET_ERR_MSG(extack, "invalid chain map type");
  8292				bpf_map_put_with_uref(chain_map);
  8293				return -EINVAL;
  8294			}
  8295		}
  8296	
  8297		err = dev_xdp_install(dev, bpf_op, extack, flags, prog);
  8298		if (err < 0) {
  8299			if (prog)
  8300				bpf_prog_put(prog);
  8301		} else {
  8302			rcu_swap_protected(dev->xdp_chain_map, chain_map, 1);
  8303		}
  8304	
  8305		if(chain_map)
  8306			bpf_map_put_with_uref(chain_map);
  8307	
  8308		return err;
  8309	}
  8310	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 19101 bytes --]

  parent reply	other threads:[~2019-10-02 18:07 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 13:30 [PATCH bpf-next 0/9] xdp: Support multiple programs on a single interface through chain calls Toke Høiland-Jørgensen
2019-10-02 13:30 ` [PATCH bpf-next 1/9] hashtab: Add new bpf_map_fd_put_value op Toke Høiland-Jørgensen
2019-10-02 13:30 ` [PATCH bpf-next 2/9] xdp: Add new xdp_chain_map type for specifying XDP call sequences Toke Høiland-Jørgensen
2019-10-02 15:50   ` Lorenz Bauer
2019-10-02 18:25     ` Toke Høiland-Jørgensen
2019-10-02 13:30 ` [PATCH bpf-next 3/9] xdp: Support setting and getting device chain map Toke Høiland-Jørgensen
2019-10-02 15:50   ` Lorenz Bauer
2019-10-02 18:32     ` Toke Høiland-Jørgensen
2019-10-02 18:07   ` kbuild test robot [this message]
2019-10-02 18:29   ` kbuild test robot
2019-10-02 13:30 ` [PATCH bpf-next 4/9] xdp: Implement chain call logic to support multiple programs on one interface Toke Høiland-Jørgensen
2019-10-02 17:33   ` kbuild test robot
2019-10-02 17:53   ` kbuild test robot
2019-10-02 13:30 ` [PATCH bpf-next 5/9] tools/include/uapi: Add XDP chain map definitions Toke Høiland-Jørgensen
2019-10-02 13:30 ` [PATCH bpf-next 6/9] tools/libbpf_probes: Add support for xdp_chain map type Toke Høiland-Jørgensen
2019-10-02 13:30 ` [PATCH bpf-next 7/9] bpftool: Add definitions " Toke Høiland-Jørgensen
2019-10-02 13:30 ` [PATCH bpf-next 8/9] libbpf: Add support for setting and getting XDP chain maps Toke Høiland-Jørgensen
2019-10-02 13:30 ` [PATCH bpf-next 9/9] selftests: Add tests for XDP chain calls Toke Høiland-Jørgensen
2019-10-02 15:10 ` [PATCH bpf-next 0/9] xdp: Support multiple programs on a single interface through " Alan Maguire
2019-10-02 15:33   ` Toke Høiland-Jørgensen
2019-10-02 16:34     ` John Fastabend
2019-10-02 18:33       ` Toke Høiland-Jørgensen
2019-10-02 20:34         ` John Fastabend
2019-10-03  7:48           ` Toke Høiland-Jørgensen
2019-10-03 10:09             ` Jesper Dangaard Brouer
2019-10-03 19:45               ` John Fastabend
2019-10-02 16:35 ` Lorenz Bauer
2019-10-02 18:54   ` Toke Høiland-Jørgensen
2019-10-02 16:43 ` John Fastabend
2019-10-02 19:09   ` Toke Høiland-Jørgensen
2019-10-02 19:15   ` Daniel Borkmann
2019-10-02 19:29     ` Toke Høiland-Jørgensen
2019-10-02 19:46     ` Alexei Starovoitov
2019-10-03  7:58       ` Toke Høiland-Jørgensen
2019-10-02 18:38 ` Song Liu
2019-10-02 18:54   ` Song Liu
2019-10-02 19:25     ` Toke Høiland-Jørgensen
2019-10-03  8:53       ` Jesper Dangaard Brouer
2019-10-03 14:03         ` Alexei Starovoitov
2019-10-03 14:33           ` Toke Høiland-Jørgensen
2019-10-03 14:53             ` Edward Cree
2019-10-03 18:49               ` Jesper Dangaard Brouer
2019-10-03 19:35               ` John Fastabend
2019-10-04  8:09                 ` Toke Høiland-Jørgensen
2019-10-04 10:34                   ` Edward Cree
2019-10-04 15:58                     ` Lorenz Bauer
2019-10-07 16:43                       ` Edward Cree
2019-10-07 17:12                         ` Lorenz Bauer
2019-10-07 19:21                           ` Edward Cree
2019-10-07 21:01                         ` Alexei Starovoitov
2019-10-02 19:23   ` Toke Høiland-Jørgensen
2019-10-02 19:49     ` Song Liu
2019-10-03  7:59       ` Toke Høiland-Jørgensen

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=201910030245.Ozf2sARI%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kafai@fb.com \
    --cc=kbuild-all@01.org \
    --cc=lmb@cloudflare.com \
    --cc=marek@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=toke@redhat.com \
    --cc=yhs@fb.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).