Adding support for TCP_NOTSENT_LOWAT sockoption
(https://lwn.net/Articles/560082/) in tcpbpf
v1->v2:
- addressing yhs@ comments. explicitly defining TCP_NOTSENT_LOWAT in
selftests if it is not defined in the system
Signed-off-by: Nikita V. Shirokov
---
include/uapi/linux/bp
Adding support for TCP_NOTSENT_LOWAT sockoption
(https://lwn.net/Articles/560082/) in tcpbpf
Signed-off-by: Nikita V. Shirokov
---
include/uapi/linux/bpf.h | 2 +-
net/core/filter.c | 4
tools/testing/selftests/bpf/progs
uot; tag
v1->v2:
- adding netdev to cc
Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf")
Signed-off-by: Nikita V. Shirokov
---
tools/lib/bpf/libbpf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index f5eb60379c8d..d5b830
off-by: Nikita V. Shirokov
---
tools/lib/bpf/libbpf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index f5eb60379c8d..d5b830d60601 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -838,6 +838,8 @@ stat
UNSPEC and also changing
requirments for version's section to be present in object file.
now it would reflect what we have today in kernel
(only KPROBE prog type requires for version to be explicitly set).
v1 -> v2:
- RFC tag has been dropped
Signed-off-by: Nikita V. Shirokov
---
too
i'm really doubtfull that anyone
is using this for kprobe type of programs (instead of, say, bcc or
other tracing frameworks)
other possible solutions (for discussion, would require more machinery):
add another function like bpf_object__open w/ default to unspec
Signed-off-by: Nikita V. Shi
ixing typo in patch description
- initializing inner_map_fd to -1 by default
v1->v2:
- addressing nits
- removing const identifier from fd in new helper
- starting to check return val for bpf_map_update_elem
Nikita V. Shirokov (2):
bpf: adding support for map in map in libbpf
bpf: adding test
adding test/example of bpf_map__set_inner_map_fd usage
Signed-off-by: Nikita V. Shirokov
Acked-by: Yonghong Song
---
tools/testing/selftests/bpf/Makefile | 3 +-
tools/testing/selftests/bpf/test_map_in_map.c | 49 +++
tools/testing/selftests/bpf/test_maps.c | 90
rototype
3) find (by name) map-in-map which you want to load and update w/
descriptor of inner map w/ a new helper from this patch
4) load bpf program w/ bpf_object__load
Signed-off-by: Nikita V. Shirokov
Acked-by: Yonghong Song
---
tools/lib/bpf/lib
adding test/example of bpf_map__add_inner_map_fd usage
Signed-off-by: Nikita V. Shirokov
Acked-by: Yonghong Song
---
tools/testing/selftests/bpf/Makefile| 3 +-
tools/testing/selftests/bpf/test_mapinmap.c | 49 +
tools/testing/selftests/bpf/test_maps.c | 82
om fd in new helper
- starting to check return val for bpf_map_update_elem
Nikita V. Shirokov (2):
bpf: adding support for map in map in libbpf
bpf: adding tests for mapinmap helpber in libbpf
tools/lib/bpf/libbpf.c | 33 +---
tools/lib/bpf/libbpf.h
rototype
3) find (by name) map-in-map which you want to load and update w/
descriptor of inner map w/ a new helper from this patch
4) load bpf program w/ bpf_object__load
Signed-off-by: Nikita V. Shirokov
Acked-by: Yonghong Song
---
tools/lib/bpf/libbpf.c | 33 +++--
2->v3:
- fixing typo in patch description
- initializing inner_map_fd to -1 by default
v1->v2:
- addressing nits
- removing const identifier from fd in new helper
- starting to check return val for bpf_map_update_elem
Nikita V. Shirokov (2):
bpf: adding support for map in map in libbpf
adding test/example of bpf_map__add_inner_map_fd usage
Signed-off-by: Nikita V. Shirokov
Acked-by: Yonghong Song
---
tools/testing/selftests/bpf/Makefile| 3 +-
tools/testing/selftests/bpf/test_mapinmap.c | 49 +
tools/testing/selftests/bpf/test_maps.c | 82
rototype
3) find (by name) map-in-map which you want to load and update w/
descriptor of inner map w/ a new helper from this patch
4) load bpf program w/ bpf_object__load
inner_map_fd is ignored by any other maps aside from (hash|array) of
maps
Signed-off-by: Nikita V. Shirokov
Acked-by: Yon
adding test/example of bpf_map__add_inner_map_fd usage
Signed-off-by: Nikita V. Shirokov
---
tools/testing/selftests/bpf/Makefile| 3 +-
tools/testing/selftests/bpf/test_mapinmap.c | 49 +
tools/testing/selftests/bpf/test_maps.c | 82 +
3
rototype
3) find (by name) map-in-map which you want to load and update w/
descriptor of inner map w/ a new helper from this patch
4) load bpf program w/ bpf_object__load
inner_map_fd is ignored by any other maps asidef from (hash|array) of
maps
Signed-off-by: Nikita V. Shirokov
---
tools/lib/bp
1->v2:
- addressing nits
- removing const identifier from fd in new helper
- starting to check return val for bpf_map_update_elem
Nikita V. Shirokov (2):
bpf: adding support for map in map in libbpf
bpf: adding tests for mapinmap helpber in libbpf
tools/lib/bpf/libbpf.c
O Mon, Nov 19, 2018 at 05:18:46PM -0800, Y Song wrote:
> On Mon, Nov 19, 2018 at 4:13 PM Nikita V. Shirokov
> wrote:
> >
> > adding test/example of bpf_map__add_inner_map_fd usage
> >
> > Signed-off-by: Nikita V. Shirokov
> > ---
> > tools/
On Mon, Nov 19, 2018 at 05:12:43PM -0800, Y Song wrote:
> On Mon, Nov 19, 2018 at 4:13 PM Nikita V. Shirokov
> wrote:
> >
> > idea is pretty simple. for specified map (pointed by struct bpf_map)
> > we would provide descriptor of already loaded map, which is going to be
rototype
3) find (by name) map-in-map which you want to load and update w/
descriptor of inner map w/ a new helper from this patch
4) load bpf program w/ bpf_object__load
inner_map_fd is ignored by any other maps asidef from (hash|array) of
maps
Signed-off-by: Nikita V. Shirokov
---
tools/lib/bp
in this patch series i'm adding a helper for libbpf which would allow
it to load map-in-map(BPF_MAP_TYPE_ARRAY_OF_MAPS and
BPF_MAP_TYPE_HASH_OF_MAPS).
first patch contains new helper + explains proposed workflow
second patch contains tests which also could be used as example of
usage
Nik
adding test/example of bpf_map__add_inner_map_fd usage
Signed-off-by: Nikita V. Shirokov
---
tools/testing/selftests/bpf/Makefile| 3 +-
tools/testing/selftests/bpf/test_mapinmap.c | 53
tools/testing/selftests/bpf/test_maps.c | 76
adding selftest for feature, introduced in
commit 9452048c79404 ("bpf: add TCP_SAVE_SYN/TCP_SAVED_SYN options for
bpf_(set|get)sockopt")
Signed-off-by: Nikita V. Shirokov
---
.../testing/selftests/bpf/test_tcpbpf_kern.c | 38 +--
.../testing/selftests/bpf/test_tcp
ce program point of view
v2->v3:
- make patch series public
v1->v2:
- adding proper SPDX license
Nikita V. Shirokov (2):
new options for bpf_(set|get)sockopt
new sample bpf prog
net/core/filter.c | 25 +++--
samples/bpf/Makefile |
adding support for two new bpf's get/set sockopts: TCP_SAVE_SYN (set)
and TCP_SAVED_SYN (get). this would allow for bpf program to build
logic based on data from ingress SYN packet
Signed-off-by: Nikita V. Shirokov
---
net/core/filter.c | 25 +
1 file change
sample program which shows TCP_SAVE_SYN/TCP_SAVED_SYN usage example:
bpf's program which is doing TOS/TCLASS reflection (server would reply
with a same TOS/TCLASS as client)
Signed-off-by: Nikita V. Shirokov
---
samples/bpf/Makefile | 1 +
samples/bpf/tcp_tos_reflect_kern.c
On Tue, Aug 21, 2018 at 08:58:15AM -0700, Alexander Duyck wrote:
> On Mon, Aug 20, 2018 at 12:32 PM Nikita V. Shirokov
> wrote:
> >
> > we are getting such errors:
> >
> > [ 408.737313] ixgbe :03:00.0 eth0: Detected Tx Unit Hang (XDP)
> >
is Up 10 Gbps, Flow Control:
RX/TX
while running XDP prog on ixgbe nic.
right now i'm seing this on bpfnext kernel
(latest commit from Wed Aug 15 15:04:25 2018 -0700 ;
9a76aba02a37718242d7cdc294f0a3901928aa57)
looks like this is the same issue as reported by Brenden in
https://www.spinics.net/lists/netdev/msg439438.html
--
Nikita V. Shirokov
used) size. this diff is fixing
this.
Fixes: 198d83bb3 (" bpf: make generic xdp compatible w/
bpf_xdp_adjust_tail")
Signed-off-by: Nikita V. Shirokov
---
Notes:
original tests missed this because it looks like tap interface
ignores incorrect ethernet FCS (all tests were done in
ted by 12 bytes.
Fixes:6870de435b90 ("bpf: make virtio compatible w/ bpf_xdp_adjust_tail")
Reported-by: David Ahern
Signed-off-by: Nikita V. Shirokov
---
Notes:
unfortunately it looks like that xdp_tx is still broken because
fix by Jason (introduced in "XDP_TX for vi
On Sun, Apr 22, 2018 at 04:47:48PM -0600, David Ahern wrote:
> This commit breaks my FIB forwarding program:
>
> commit 6870de435b90c083ae0f3f7f341287976ef56f03
> Author: Nikita V. Shirokov
> Date: Tue Apr 17 21:42:20 2018 -0700
>
> bpf: make virtio compatible w
On Wed, Apr 18, 2018 at 02:48:18PM +0200, Jesper Dangaard Brouer wrote:
> On Tue, 17 Apr 2018 21:29:42 -0700
> "Nikita V. Shirokov" wrote:
>
> > w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
> > well (only "decrease"
On Wed, Apr 18, 2018 at 02:37:40PM +0200, Daniel Borkmann wrote:
> On 04/18/2018 06:29 AM, Nikita V. Shirokov wrote:
> > In this patch series i'm add new bpf helper which allow to manupulate
> > xdp's data_end pointer. right now only "shrinking" (reduce pack
after introduction of bpf_xdp_adjust_tail helper packet length
could be changed not only if xdp->data pointer has been changed
but xdp->data_end as well. making bpf_prog_test_run aware of this
possibility
Signed-off-by: Nikita V. Shirokov
---
net/bpf/test_run.c | 3 ++-
1 file chan
ting skb's tail pointer
Acked-by: Alexei Starovoitov
Signed-off-by: Nikita V. Shirokov
---
net/core/dev.c | 10 +-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 969462ebb296..11c789231a03 100644
--- a/net/core/dev.c
+++ b/net/core
h
unconditionally
Acked-by: Alexei Starovoitov
Signed-off-by: Nikita V. Shirokov
---
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
b/drivers/net/ethernet/cavium/thun
h of the packet if it was passed to the TCP/IP stack
(in case if after xdp's prog run data_end pointer was adjusted)
Reviewed-by: Jason Wang
Signed-off-by: Nikita V. Shirokov
---
drivers/net/tun.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/driver
Acked-by: Alexei Starovoitov
Signed-off-by: Nikita V. Shirokov
---
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
index 1389ab5e0
Acked-by: Alexei Starovoitov
Acked-by: Jakub Kicinski
Signed-off-by: Nikita V. Shirokov
---
drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
b/drivers/net/ethernet/netron
adding bpf's sample program which is using bpf_xdp_adjust_tail helper
by generating ICMPv4 "packet to big" message if ingress packet's size is
bigger then 600 bytes
Signed-off-by: Nikita V. Shirokov
---
samples/bpf/Makefile | 4 +
samples/bpf/xd
Adding new bpf helper which would allow us to manipulate
xdp's data_end pointer, and allow us to reduce packet's size
indended use case: to generate ICMP messages from XDP context,
where such message would contain truncated original packet.
Signed-off-by: Nikita V. Shirokov
---
in
e applicable
* some reshuffling in patches order (tests now in the end)
Nikita V. Shirokov (11):
bpf: making bpf_prog_test run aware of possible data_end ptr change
bpf: adding tests for bpf_xdp_adjust_tail
bpf: adding bpf_xdp_adjust_tail helper
bpf: make generic xdp compatible w/ bpf_xdp_adj
(the same way as it's already being done in mlx5)
Acked-by: Alexei Starovoitov
Acked-by: Tariq Toukan
Signed-off-by: Nikita V. Shirokov
---
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx
adding selftests for bpf_xdp_adjust_tail helper. in this synthetic test
we are testing that 1) if data_end < data helper will return EINVAL
2) for normal use case packet's length would be reduced.
Signed-off-by: Nikita V. Shirokov
---
tools/include/uapi/linux/bpf.h
h of the packet if it was passed to the TCP/IP stack
Reviewed-by: Jason Wang
Signed-off-by: Nikita V. Shirokov
---
drivers/net/virtio_net.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 01694e26f03e..779a4f79
Adding new bpf helper which would allow us to manipulate
xdp's data_end pointer, and allow us to reduce packet's size
indended use case: to generate ICMP messages from XDP context,
where such message would contain truncated original packet.
---
include/uapi/linux/bpf.h | 10 +-
net/core/fi
w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
well (only "decrease" of pointer's location is going to be supported).
changing of this pointer will change packet's size.
for nfp driver we will just calculate packet's length unconditionally
Acked-by: Alexei Starovoitov
Ac
w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
well (only "decrease" of pointer's location is going to be supported).
changing of this pointer will change packet's size.
for mlx4 driver we will just calculate packet's length unconditionally
(the same way as it's already be
w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
well (only "decrease" of pointer's location is going to be supported).
changing of this pointer will change packet's size.
for tun driver we need to adjust XDP_PASS handling by recalculating
length of the packet if it was pass
w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
well (only "decrease" of pointer's location is going to be supported).
changing of this pointer will change packet's size.
for virtio driver we need to adjust XDP_PASS handling by recalculating
length of the packet if it was p
w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
well (only "decrease" of pointer's location is going to be supported).
changing of this pointer will change packet's size.
for cavium's thunder driver we will just calculate packet's length
unconditionally
Acked-by: Alexei St
after introduction of bpf_xdp_adjust_tail helper packet length
could be changed not only if xdp->data pointer has been changed
but xdp->data_end as well. making bpf_prog_test_run aware of this
possibility
---
net/bpf/test_run.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/
adding selftests for bpf_xdp_adjust_tail helper. in this synthetic test
we are testing that 1) if data_end < data helper will return EINVAL
2) for normal use case packet's length would be reduced.
---
tools/include/uapi/linux/bpf.h | 10 +++-
tools/testing/selftests/bpf/Makefil
adding bpf's sample program which is using bpf_xdp_adjust_tail helper
by generating ICMPv4 "packet to big" message if ingress packet's size is
bigger then 600 bytes
---
samples/bpf/Makefile | 4 +
samples/bpf/xdp_adjust_tail_kern.c| 152 ++
w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
well (only "decrease" of pointer's location is going to be supported).
changing of this pointer will change packet's size.
for bnxt driver we will just calculate packet's length unconditionally
Acked-by: Alexei Starovoitov
-
w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
well (only "decrease" of pointer's location is going to be supported).
changing of this pointer will change packet's size.
for generic XDP we need to reflect this packet's length change by
adjusting skb's tail pointer
Acked-b
ad pointer was adjusted, but if tail's one as well.
v1->v2:
* fixed kbuild warning
* made offset eq 0 invalid for xdp_bpf_adjust_tail
* splitted bpf_prog_test_run fix and selftests in sep commits
* added SPDX licence where applicable
* some reshuffling in patches order (test
h of the packet if it was passed to the TCP/IP stack
Signed-off-by: Nikita V. Shirokov
---
drivers/net/virtio_net.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 7b187ec7411e..115d85f7360a 100644
--- a/drive
h of the packet if it was passed to the TCP/IP stack
(in case if after xdp's prog run data_end pointer was adjusted)
Signed-off-by: Nikita V. Shirokov
---
drivers/net/tun.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 28583aa0c
w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
well (only "decrease" of pointer's location is going to be supported).
changing of this pointer will change packet's size.
for nfp driver we will just calculate packet's length unconditio
d recalculate packet's length if only data_end pointer was
changed
Signed-off-by: Nikita V. Shirokov
---
net/bpf/test_run.c | 3 ++-
tools/include/uapi/linux/bpf.h | 11 -
tools/testing/selftests/bpf/Makefile | 2 +-
tools/tes
(the same way as it's already being done in mlx5)
Signed-off-by: Nikita V. Shirokov
---
drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
inde
ing skb's tail pointer
Signed-off-by: Nikita V. Shirokov
---
net/core/dev.c | 10 +-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 969462ebb296..11c789231a03 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3996,9 +3996,9 @@ s
en head pointer was adjusted, but if tail's one as well.
Nikita V. Shirokov (10):
[bpf]: adding bpf_xdp_adjust_tail helper
[bpf]: adding tests for bpf_xdp_adjust_tail
[bpf]: add bpf_xdp_adjust_tail sample prog
[bpf]: make generic xdp compatible w/ bpf_xdp_adjust_tail
[bpf]: make ml
w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
well (only "decrease" of pointer's location is going to be supported).
changing of this pointer will change packet's size.
for bnxt driver we will just calculate packet's length unconditio
ngth
unconditionally
Signed-off-by: Nikita V. Shirokov
---
drivers/net/ethernet/cavium/thunder/nicvf_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index 707db3304396..71
Adding new bpf helper which would allow us to manipulate
xdp's data_end pointer, and allow us to reduce packet's size
indended use case: to generate ICMP messages from XDP context,
where such message would contain truncated original packet.
Signed-off-by: Nikita V. Shirokov
---
in
adding bpf's sample program which is using bpf_xdp_adjust_tail helper
by generating ICMPv4 "packet to big" message if ingress packet's size is
bigger then 600 bytes
Signed-off-by: Nikita V. Shirokov
---
samples/bpf/Makefile | 4 +
samples/bpf/xd
bpf: Add sock_ops R/W access to ipv4 tos
Sample usage for tos:
bpf_getsockopt(skops, SOL_IP, IP_TOS, &v, sizeof(v))
where skops is a pointer to the ctx (struct bpf_sock_ops).
Signed-off-by: Nikita V. Shirokov
---
net/core/filter.c | 35 ++
nt skb leakage)
Signed-off-by: Nikita V. Shirokov
---
net/ipv6/ip6_tunnel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 3d3092a..db84f52 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -904,7 +904,7 @
commit 8d79266bc48c ("ip6_tunnel: add collect_md mode to IPv6 tunnels")
introduced new exit point in ipxip6_rcv. however rcu_read_unlock is
missing there. this diff is fixing this
Signed-off-by: Nikita V. Shirokov
---
net/ipv6/ip6_tunnel.c | 4 +++-
1 file changed, 3 insertions(+),
72 matches
Mail list logo