[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200427224633.15627-16-dsahern@kernel.org>
Date: Mon, 27 Apr 2020 16:46:33 -0600
From: David Ahern <dsahern@...nel.org>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org,
prashantbhole.linux@...il.com, jasowang@...hat.com,
brouer@...hat.com, toke@...hat.com, toshiaki.makita1@...il.com,
daniel@...earbox.net, john.fastabend@...il.com, ast@...nel.org,
kafai@...com, songliubraving@...com, yhs@...com, andriin@...com,
dsahern@...il.com, David Ahern <dahern@...italocean.com>
Subject: [PATCH v4 bpf-next 15/15] samples/bpf: add XDP egress support to xdp1
From: David Ahern <dahern@...italocean.com>
xdp1 and xdp2 now accept -E flag to set XDP program in the egress
path.
Signed-off-by: Prashant Bhole <prashantbhole.linux@...il.com>
Signed-off-by: David Ahern <dahern@...italocean.com>
---
samples/bpf/xdp1_user.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c
index c447ad9e3a1d..bb104f4d8c5e 100644
--- a/samples/bpf/xdp1_user.c
+++ b/samples/bpf/xdp1_user.c
@@ -73,7 +73,8 @@ static void usage(const char *prog)
"OPTS:\n"
" -S use skb-mode\n"
" -N enforce native mode\n"
- " -F force loading prog\n",
+ " -F force loading prog\n"
+ " -E egress path program\n",
prog);
}
@@ -85,7 +86,7 @@ int main(int argc, char **argv)
};
struct bpf_prog_info info = {};
__u32 info_len = sizeof(info);
- const char *optstr = "FSN";
+ const char *optstr = "FSNE";
int prog_fd, map_fd, opt;
struct bpf_object *obj;
struct bpf_map *map;
@@ -103,13 +104,17 @@ int main(int argc, char **argv)
case 'F':
xdp_flags &= ~XDP_FLAGS_UPDATE_IF_NOEXIST;
break;
+ case 'E':
+ xdp_flags |= XDP_FLAGS_EGRESS_MODE;
+ prog_load_attr.expected_attach_type = BPF_XDP_EGRESS;
+ break;
default:
usage(basename(argv[0]));
return 1;
}
}
- if (!(xdp_flags & XDP_FLAGS_SKB_MODE))
+ if (!(xdp_flags & (XDP_FLAGS_SKB_MODE | XDP_FLAGS_EGRESS_MODE)))
xdp_flags |= XDP_FLAGS_DRV_MODE;
if (optind == argc) {
--
2.21.1 (Apple Git-122.3)
Powered by blists - more mailing lists