netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: David Ahern <dsahern@kernel.org>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org,
	prashantbhole.linux@gmail.com, jasowang@redhat.com,
	brouer@redhat.com, toshiaki.makita1@gmail.com,
	daniel@iogearbox.net, john.fastabend@gmail.com, ast@kernel.org,
	kafai@fb.com, songliubraving@fb.com, yhs@fb.com, andriin@fb.com,
	dsahern@gmail.com, David Ahern <dahern@digitalocean.com>
Subject: Re: [PATCH v3 bpf-next 12/15] bpftool: Add support for XDP egress
Date: Mon, 27 Apr 2020 17:13:34 +0200	[thread overview]
Message-ID: <87368pyna9.fsf@toke.dk> (raw)
In-Reply-To: <20200424201428.89514-13-dsahern@kernel.org>

David Ahern <dsahern@kernel.org> writes:

> From: David Ahern <dahern@digitalocean.com>
>
> Add xdp_egress as a program type since it requires a new attach
> type. This follows suit with other program type + attach type
> combintations and leverages the SEC name in libbpf.
>
> Add NET_ATTACH_TYPE_XDP_EGRESS and update attach_type_strings to
> allow a user to specify 'xdp_egress' as the attach or detach point.
>
> Update do_attach_detach_xdp to set XDP_FLAGS_EGRESS_MODE if egress
> is selected.
>
> Update do_xdp_dump_one to show egress program ids.
>
> Update the documentation and help output.
>
> Signed-off-by: David Ahern <dahern@digitalocean.com>
> ---
>  tools/bpf/bpftool/Documentation/bpftool-net.rst  | 4 +++-
>  tools/bpf/bpftool/Documentation/bpftool-prog.rst | 2 +-
>  tools/bpf/bpftool/bash-completion/bpftool        | 4 ++--
>  tools/bpf/bpftool/net.c                          | 6 +++++-
>  tools/bpf/bpftool/netlink_dumper.c               | 5 +++++
>  tools/bpf/bpftool/prog.c                         | 2 +-
>  6 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/tools/bpf/bpftool/Documentation/bpftool-net.rst b/tools/bpf/bpftool/Documentation/bpftool-net.rst
> index 8651b00b81ea..d7398fb00ec4 100644
> --- a/tools/bpf/bpftool/Documentation/bpftool-net.rst
> +++ b/tools/bpf/bpftool/Documentation/bpftool-net.rst
> @@ -26,7 +26,8 @@ NET COMMANDS
>  |	**bpftool** **net help**
>  |
>  |	*PROG* := { **id** *PROG_ID* | **pinned** *FILE* | **tag** *PROG_TAG* }
> -|	*ATTACH_TYPE* := { **xdp** | **xdpgeneric** | **xdpdrv** | **xdpoffload** }
> +|	*ATTACH_TYPE* :=
> +|       { **xdp** | **xdpgeneric** | **xdpdrv** | **xdpoffload** | **xdp_egress** }
>  
>  DESCRIPTION
>  ===========
> @@ -63,6 +64,7 @@ DESCRIPTION
>                    **xdpgeneric** - Generic XDP. runs at generic XDP hook when packet already enters receive path as skb;
>                    **xdpdrv** - Native XDP. runs earliest point in driver's receive path;
>                    **xdpoffload** - Offload XDP. runs directly on NIC on each packet reception;
> +                  **xdp_egress** - XDP in egress path. runs at core networking level;
>  
>  	**bpftool** **net detach** *ATTACH_TYPE* **dev** *NAME*
>                    Detach bpf program attached to network interface *NAME* with
> diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> index 9f19404f470e..ab0a8846a8e3 100644
> --- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> +++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> @@ -44,7 +44,7 @@ PROG COMMANDS
>  |		**cgroup/connect4** | **cgroup/connect6** | **cgroup/sendmsg4** | **cgroup/sendmsg6** |
>  |		**cgroup/recvmsg4** | **cgroup/recvmsg6** | **cgroup/sysctl** |
>  |		**cgroup/getsockopt** | **cgroup/setsockopt** |
> -|		**struct_ops** | **fentry** | **fexit** | **freplace**
> +|		**struct_ops** | **fentry** | **fexit** | **freplace** | **xdp_egress**
>  |	}
>  |       *ATTACH_TYPE* := {
>  |		**msg_verdict** | **stream_verdict** | **stream_parser** | **flow_dissector**
> diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
> index 45ee99b159e2..ab20696c20c6 100644
> --- a/tools/bpf/bpftool/bash-completion/bpftool
> +++ b/tools/bpf/bpftool/bash-completion/bpftool
> @@ -471,7 +471,7 @@ _bpftool()
>                                  cgroup/post_bind4 cgroup/post_bind6 \
>                                  cgroup/sysctl cgroup/getsockopt \
>                                  cgroup/setsockopt struct_ops \
> -                                fentry fexit freplace" -- \
> +                                fentry fexit freplace xdp_egress" -- \
>                                                     "$cur" ) )
>                              return 0
>                              ;;
> @@ -1003,7 +1003,7 @@ _bpftool()
>              ;;
>          net)
>              local PROG_TYPE='id pinned tag name'
> -            local ATTACH_TYPES='xdp xdpgeneric xdpdrv xdpoffload'
> +            local ATTACH_TYPES='xdp xdpgeneric xdpdrv xdpoffload xdp_egress'
>              case $command in
>                  show|list)
>                      [[ $prev != "$command" ]] && return 0
> diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c
> index c5e3895b7c8b..dbace14e5484 100644
> --- a/tools/bpf/bpftool/net.c
> +++ b/tools/bpf/bpftool/net.c
> @@ -61,6 +61,7 @@ enum net_attach_type {
>  	NET_ATTACH_TYPE_XDP_GENERIC,
>  	NET_ATTACH_TYPE_XDP_DRIVER,
>  	NET_ATTACH_TYPE_XDP_OFFLOAD,
> +	NET_ATTACH_TYPE_XDP_EGRESS,
>  };
>  
>  static const char * const attach_type_strings[] = {
> @@ -68,6 +69,7 @@ static const char * const attach_type_strings[] = {
>  	[NET_ATTACH_TYPE_XDP_GENERIC]	= "xdpgeneric",
>  	[NET_ATTACH_TYPE_XDP_DRIVER]	= "xdpdrv",
>  	[NET_ATTACH_TYPE_XDP_OFFLOAD]	= "xdpoffload",
> +	[NET_ATTACH_TYPE_XDP_EGRESS]	= "xdp_egress",
>  };
>  
>  const size_t net_attach_type_size = ARRAY_SIZE(attach_type_strings);
> @@ -286,6 +288,8 @@ static int do_attach_detach_xdp(int progfd, enum net_attach_type attach_type,
>  		flags |= XDP_FLAGS_DRV_MODE;
>  	if (attach_type == NET_ATTACH_TYPE_XDP_OFFLOAD)
>  		flags |= XDP_FLAGS_HW_MODE;
> +	if (attach_type == NET_ATTACH_TYPE_XDP_EGRESS)
> +		flags |= XDP_FLAGS_EGRESS_MODE;
>  
>  	return bpf_set_link_xdp_fd(ifindex, progfd, flags);
>  }
> @@ -464,7 +468,7 @@ static int do_help(int argc, char **argv)
>  		"       %s %s help\n"
>  		"\n"
>  		"       " HELP_SPEC_PROGRAM "\n"
> -		"       ATTACH_TYPE := { xdp | xdpgeneric | xdpdrv | xdpoffload }\n"
> +		"       ATTACH_TYPE := { xdp | xdpgeneric | xdpdrv | xdpoffload | xdp_egress}\n"

Nit: Missing space before }


  reply	other threads:[~2020-04-27 15:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 20:14 [PATCH v3 bpf-next 00/15] net: Add support for XDP in egress path David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 01/15] net: Refactor convert_to_xdp_frame David Ahern
2020-04-27 16:19   ` John Fastabend
2020-04-24 20:14 ` [PATCH v3 bpf-next 02/15] net: uapi for XDP programs in the egress path David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 03/15] net: Add XDP setup and query commands for Tx programs David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 04/15] net: Add BPF_XDP_EGRESS as a bpf_attach_type David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 05/15] xdp: Add xdp_txq_info to xdp_buff David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 06/15] net: Rename do_xdp_generic to do_xdp_generic_rx David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 07/15] net: rename netif_receive_generic_xdp to do_generic_xdp_core David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 08/15] net: set XDP egress program on netdevice David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 09/15] net: Support xdp in the Tx path for packets as an skb David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 10/15] net: Support xdp in the Tx path for xdp_frames David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 11/15] libbpf: Add egress XDP support David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 12/15] bpftool: Add support for XDP egress David Ahern
2020-04-27 15:13   ` Toke Høiland-Jørgensen [this message]
2020-04-24 20:14 ` [PATCH v3 bpf-next 13/15] selftest: Add test for xdp_egress David Ahern
2020-04-27 17:48   ` John Fastabend
2020-04-27 17:52     ` John Fastabend
2020-04-27 17:58       ` David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 14/15] selftest: Add xdp_egress attach tests David Ahern
2020-04-24 20:14 ` [PATCH v3 bpf-next 15/15] samples/bpf: add XDP egress support to xdp1 David Ahern
2020-04-27 15:21 ` [PATCH v3 bpf-next 00/15] net: Add support for XDP in egress path Toke Høiland-Jørgensen
2020-04-27 18:25 ` John Fastabend
2020-04-27 18:58   ` David Ahern

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=87368pyna9.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=brouer@redhat.com \
    --cc=dahern@digitalocean.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=prashantbhole.linux@gmail.com \
    --cc=songliubraving@fb.com \
    --cc=toshiaki.makita1@gmail.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).