bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Jesper Dangaard Brouer" <brouer@redhat.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>
Subject: Re: [PATCHv6 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map
Date: Fri, 15 Jan 2021 12:17:51 +0800	[thread overview]
Message-ID: <20210115041751.GD1421720@Leo-laptop-t470s> (raw)
In-Reply-To: <4d9b5846-bd08-09b4-53a2-3cb02a9a1eee@fb.com>

Hi Yonghong,
On Thu, Jan 14, 2021 at 01:01:28PM -0800, Yonghong Song wrote:
> > +/* map to stroe egress interface mac address */
> 
> s/stroe/store

Thanks, I will fix it.
> > -	struct bpf_program *prog, *dummy_prog;
> > +	struct bpf_program *prog, *dummy_prog, *devmap_prog;
> > +	int devmap_prog_fd_0 = -1, devmap_prog_fd_1 = -1;
> 
> The default value is -1 here. I remembered there was a discussion
> about the default value here, does default value 0 work here?

I didn't saw the discussion. But 0 should works as in __dev_map_alloc_node
it only gets the prog when fd > 0.

static struct bpf_dtab_netdev *__dev_map_alloc_node(struct net *net,
                                                    struct bpf_dtab *dtab,
                                                    struct bpf_devmap_val *val,
                                                    unsigned int idx)
{
	...
	if (val->bpf_prog.fd > 0) {
		prog = bpf_prog_get_type_dev(val->bpf_prog.fd,
				BPF_PROG_TYPE_XDP, false);
		if (IS_ERR(prog))
			goto err_put_dev;
		if (prog->expected_attach_type != BPF_XDP_DEVMAP)
			goto err_put_prog;
	}
	...
}

> > +	if (xdp_flags & XDP_FLAGS_SKB_MODE) {
> > +		prog = bpf_object__find_program_by_title(obj, "xdp_redirect_general");
> 
> libbpf supports each section having multiple programs, so
> bpf_object__find_program_by_title() is not recommended.
> Could you change to bpf_object__find_program_by_name()?

Thanks for this reminder, I will fix it.

Thanks
Hangbin

  reply	other threads:[~2021-01-15  4:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 12:46 [PATCH bpf-next] samples/bpf: add xdp_redirect_map with xdp_prog support Hangbin Liu
2020-11-10 14:25 ` Jesper Dangaard Brouer
2020-11-10 15:24   ` Maciej Fijalkowski
2020-11-11  1:12   ` Hangbin Liu
2020-11-26  8:43 ` [PATCHv2 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map Hangbin Liu
2020-11-26 10:51   ` Jesper Dangaard Brouer
2020-11-26 14:19     ` Hangbin Liu
2020-11-27  6:31   ` Yonghong Song
2020-11-30  7:51     ` Hangbin Liu
2020-11-30  9:32       ` Jesper Dangaard Brouer
2020-11-30 13:10         ` Hangbin Liu
2020-11-30 15:12           ` Jesper Dangaard Brouer
2020-11-30 16:07             ` Toke Høiland-Jørgensen
2020-12-08  8:18   ` [PATCHv3 " Hangbin Liu
2020-12-08 10:39     ` Jesper Dangaard Brouer
2020-12-08 11:11       ` Hangbin Liu
2020-12-08 12:01     ` [PATCHv4 " Hangbin Liu
2020-12-11  0:15       ` Daniel Borkmann
2020-12-11  2:40       ` [PATCHv5 " Hangbin Liu
2021-01-14 14:27         ` [PATCHv6 " Hangbin Liu
2021-01-14 21:01           ` Yonghong Song
2021-01-15  4:17             ` Hangbin Liu [this message]
2021-01-15  6:24           ` [PATCHv7 " Hangbin Liu
2021-01-15 16:57             ` Yonghong Song
2021-01-18 22:46             ` Daniel Borkmann
2021-01-19  3:12             ` [PATCHv8 " Hangbin Liu
2021-01-19 14:51               ` Jesper Dangaard Brouer
2021-01-20  4:16                 ` Hangbin Liu
2021-01-21 13:06               ` [PATCHv9 " Hangbin Liu
2021-01-21 15:05                 ` Jesper Dangaard Brouer
2021-01-22  2:50                 ` [PATCHv10 " Hangbin Liu
2021-01-22 10:32                   ` Jesper Dangaard Brouer
2021-01-22 23:30                   ` patchwork-bot+netdevbpf

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=20210115041751.GD1421720@Leo-laptop-t470s \
    --to=liuhangbin@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --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).