nel/bpf/core.c
> index 242a643..7687488 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
> @@ -2108,3 +2108,4 @@ int __weak skb_copy_bits(const struct sk_buff *skb, int
> offset, void *to,
> #include
>
> EXPORT_TRACEPOINT_SYMBOL_GPL(xdp_exception);
> +EXPORT_TRACEPOINT_SYMBOL_GPL(xdp_bulk_tx);
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
ng pointer ring. But the pointer ring is
> > per-rq, so if you have lock contention, this means you must have
> > multiple CPUs servicing the same rq, no?
>
> Yes, it's possible. Not recommended though.
>
I think the general per-cpu TX bulk queue is overkill. There i
e off RPS. But I do see one valid use-case of
combining CPUMAP redirect with RFS (Receive Flow Steering) which is part
of RPS. Yes, I know we/I *also* have to implement generic-XDP-cpumap
support. But for native-XDP CPUMAP redirect, from 1-2 RX-CPUs into
N-remote CPUs via CPUMAP, and then lets RFS send SKBs to where the
application runs, does make sense to me. (I do have an "assignment" to
implement this in eBPF here[2]).
[1]
https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/Documentation/blogposts/xdp25_eval_generic_xdp_tx.rst
[2]
https://github.com/xdp-project/xdp-project/blob/master/areas/cpumap.org#cpumap-implement-dynamic-load-balancer-that-is-ooo-safe
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Thu, 23 May 2019 22:51:34 +0900
Toshiaki Makita wrote:
> On 19/05/23 (木) 22:29:27, Jesper Dangaard Brouer wrote:
> > On Thu, 23 May 2019 20:35:50 +0900
> > Toshiaki Makita wrote:
> >
> >> On 2019/05/23 20:25, Toke Høiland-Jørgensen wrote:
the NAPI-poll?
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
> LIBBPF_API unsigned int bpf_object__kversion(struct bpf_object *obj);
> diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map
> index 673001787cba..6ce61fa0baf3 100644
> --- a/tools/lib/bpf/libbpf.map
> +++ b/tools/lib/bpf/libbpf.map
> @@ -164,3 +164,8 @@ LIBBPF_0.0.3 {
> bpf_map_freeze;
> btf__finalize_data;
> } LIBBPF_0.0.2;
> +
> +LIBBPF_0.0.4 {
> + global:
> + bpf_object__load_xattr;
> +} LIBBPF_0.0.3;
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Fri, 24 May 2019 12:51:14 +0100
Quentin Monnet wrote:
> 2019-05-24 13:22 UTC+0200 ~ Jesper Dangaard Brouer
> > On Fri, 24 May 2019 11:36:47 +0100
> > Quentin Monnet wrote:
> >
> >> libbpf was recently made aware of the log_level attribute for programs,
>
frame per page is used. The packets available in the RX-rings are
actually the same, as the ring sizes are non-XDP=512 vs. XDP=1024.
I believe, the real issue is that TCP use the SKB->truesize (based on frame
size) for different memory pressure and window calculations, which is why it
solv
On Fri, 31 May 2019 18:06:01 + Saeed Mahameed wrote:
> On Fri, 2019-05-31 at 18:18 +0200, Jesper Dangaard Brouer wrote:
[...]
> >
> > To understand why this is happening, you first have to know that the
> > difference is between the two RX-memory modes used by mlx5 fo
3 use-cases were "slow", because the kernel
netstack assumes a L4/socket use-case (full SKB), when less was really
needed.
This is actually another good example of why XDP programs per RX-queue,
will be useful (notice: which is not implemented upstream, yet...).
--
Best regards,
Jesper
fact and start
> > > > introducing SKB helpers for SKB mode and driver helpers for DRV
> > > > mode..
> > >
> > > Any reason why we would want the extra complexity? There is
> > > cls_bpf if someone wants skb features after all..
>
> Donno, SKB mode is earlier in the stack maybe ..
>From a BPF perspective you cannot introduce SKB helpers for SKB mode.
An XDP-prog have bpf prog type XDP (BPF_PROG_TYPE_XDP), and the program
itself is identical regardless of attaching for DRV_MODE or SKB_MODE.
You cannot detect this at attach time, due to tail-calls (which have
painted us into a corner).
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
= BPF_FUNC_redirect_map)
> + if (func_id != BPF_FUNC_redirect_map &&
> + func_id != BPF_FUNC_map_lookup_elem)
> goto error;
> break;
> /* Restrict bpf side of cpumap and xskmap, open when use-cases
>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
as BPF-prog side can modify this... but Daniel already
pointed this out.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
key 4B value 4B max_entries 100 memlock 4096B
p.s. People should look out for Brendan Gregg's upcoming book on BPF
performance tools, from which I learned to use bpftrace :-)
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
d = __xdp_map_lookup_elem(map, ifindex);
> + if (unlikely(!fwd))
> + return XDP_PASS;
> + }
> +
> ri->ifindex = ifindex;
> ri->flags = flags;
> WRITE_ONCE(ri->map, map);
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
if (func_id != BPF_FUNC_redirect_map)
> + if (func_id != BPF_FUNC_redirect_map &&
> + func_id != BPF_FUNC_map_lookup_elem)
> goto error;
> break;
> /* Restrict bpf side of cpumap and xskmap, open when use-cases
>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Thu, 6 Jun 2019 20:04:20 +0900
Toshiaki Makita wrote:
> On 2019/06/05 16:59, Jesper Dangaard Brouer wrote:
> > On Wed, 5 Jun 2019 14:36:12 +0900
> > Toshiaki Makita wrote:
> >
> >> This is introduced for admins to check what is happening on XDP_TX when
>
On Fri, 7 Jun 2019 11:22:00 +0900
Toshiaki Makita wrote:
> On 2019/06/07 4:41, Jesper Dangaard Brouer wrote:
> > On Thu, 6 Jun 2019 20:04:20 +0900
> > Toshiaki Makita wrote:
> >
> >> On 2019/06/05 16:59, Jesper Dangaard Brouer wrote:
> >>> On Wed,
x_hlist)
> + if (dev->idx == key)
> + return dev;
> +
> + return NULL;
> +}
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Thu, 25 Jul 2019 12:32:19 +0200
Toke Høiland-Jørgensen wrote:
> Jesper Dangaard Brouer writes:
>
> > On Mon, 22 Jul 2019 13:52:48 +0200
> > Toke Høiland-Jørgensen wrote:
> >
> >> +static inline struct hlist_head *dev_map
match the
target audience of the XDP-newbies list. This is based on a survey on
the mailing list, where 73% voted for removal from MAINTAINERS file.
Signed-off-by: Jesper Dangaard Brouer
---
MAINTAINERS |1 -
1 file changed, 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9cc156c
inside each map. However, it seems I forgot to remove
> the function definitions stubs, so remove those here.
>
> Signed-off-by: Toke Høiland-Jørgensen
> Acked-by: Yonghong Song
Acked-by: Jesper Dangaard Brouer
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer
Høiland-Jørgensen
> Acked-by: Yonghong Song
Acked-by: Jesper Dangaard Brouer
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
aps
> to be densely packed, so they can be smaller.
>
> Signed-off-by: Toke Høiland-Jørgensen
> Acked-by: Yonghong Song
Acked-by: Jesper Dangaard Brouer
[...]
> +static inline struct hlist_head *dev_map_index_hash(struct bpf_dtab *dtab,
> +
On Fri, 26 Jul 2019 18:06:56 +0200
Toke Høiland-Jørgensen wrote:
> From: Toke Høiland-Jørgensen
>
> This adds the devmap_hash BPF map type to the uapi headers in tools/.
>
> Signed-off-by: Toke Høiland-Jørgensen
> Acked-by: Yonghong Song
Acked-by: Jesper Dangaard Brouer
On Fri, 26 Jul 2019 18:06:57 +0200
Toke Høiland-Jørgensen wrote:
> From: Toke Høiland-Jørgensen
>
> This adds the definition for BPF_MAP_TYPE_DEVMAP_HASH to libbpf_probes.c in
> tools/lib/bpf.
>
> Signed-off-by: Toke Høiland-Jørgensen
> Acked-by: Yonghong Song
Acke
On Fri, 26 Jul 2019 18:06:58 +0200
Toke Høiland-Jørgensen wrote:
> From: Toke Høiland-Jørgensen
>
> This adds selftest and bpftool updates for the devmap_hash map type.
>
> Signed-off-by: Toke Høiland-Jørgensen
Acked-by: Jesper Dangaard Brouer
--
Best regards,
Jesper
find_map_fd_by_name(). To handle TC noname case, I had to
code up this workaround[5], which depend on extracting the name of the
pinned file name.
[5]
https://github.com/xdp-project/xdp-cpumap-tc/blob/master/src/xdp_iphash_to_cpu_user.c#L117-L131
Experience/conclusion: Getting XDP and TC to
X_NET_LOAD_TYPE
> +};
> +
> +static const char * const load_type_strings[] = {
> + [NET_LOAD_TYPE_XDP] = "xdp",
> + [NET_LOAD_TYPE_XDP_GENERIC] = "xdpgeneric",
> + [NET_LOAD_TYPE_XDP_DRIVE] = "xdpdrv",
> + [NET_LOAD_TYPE_XDP_OFFLOAD] =
" HELP_SPEC_PROGRAM "\n"
> + " LOAD_TYPE := { xdp | xdpgeneric | xdpdrv | xdpoffload
> }\n"
> "Note: Only xdp and tc attachments are supported now.\n"
> " For progs attached to cgroups, use \&qu
In-order to test both native-XDP (xdpdrv) and generic-XDP (xdpgeneric)
create two wrapper test scripts, that start the test_xdp_vlan.sh script
with these modes.
Signed-off-by: Jesper Dangaard Brouer
---
tools/testing/selftests/bpf/Makefile |3 ++-
tools/testing/selftests/bpf
elftests/bpf/
sudo ./test_xdp_vlan_mode_generic.sh
sudo ./test_xdp_vlan_mode_native.sh
Link: https://www.spinics.net/lists/xdp-newbies/msg01231.html
Fixes: 458bf2f224f0 ("net: core: support XDP generic on stacked devices.")
Reported by: Brandon Cazander
Signed-off-by: Jesper Dangaard
P.
Fixes: 948d4f214fde ("veth: Add driver XDP")
Fixes: 97396ff0bc2d ("selftests/bpf: add XDP selftests for modifying and
popping VLAN headers")
Signed-off-by: Jesper Dangaard Brouer
---
tools/testing/selftests/bpf/test_xdp_vlan.sh | 42 ++
1 file
on Cazander
Signed-off-by: Jesper Dangaard Brouer
---
net/core/dev.c | 15 ++-
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index fc676b2610e3..b5533795c3c1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4374
Given the increasing number of BPF selftests, it makes sense to
reduce the time to execute these tests. The ping parameters are
adjusted to reduce the time from measures 9 sec to approx 2.8 sec.
Signed-off-by: Jesper Dangaard Brouer
---
tools/testing/selftests/bpf/test_xdp_vlan.sh | 10
On Thu, 1 Aug 2019 17:44:06 -0700
Jakub Kicinski wrote:
> On Thu, 01 Aug 2019 20:00:31 +0200, Jesper Dangaard Brouer wrote:
> > When generic-XDP was moved to a later processing step by commit
> > 458bf2f224f0 ("net: core: support XDP generic on stacked devices.")
> &
evmap. The other
patches are to help users understand the sample.
I have more improvements to xdp_fwd, but those might requires changes
to libbpf. Thus, sending these patches first as they are isolated.
[1] http://vger.kernel.org/lpc-networking2018.html#session-1
---
Jesper Dangaard Brou
es xdp_fwd more practically usable, as this allows for
a mixed environment, where IP-forwarding fallback to network stack, if
the egress device isn't configured to use XDP.
Signed-off-by: Jesper Dangaard Brouer
---
samples/bpf/xdp_fwd_kern.c | 20 ++--
samples/bpf/x
The devmap name 'tx_port' came from a copy-paste from xdp_redirect_map
which only have a single TX port. Change name to xdp_tx_ports
to make it more descriptive.
Signed-off-by: Jesper Dangaard Brouer
---
samples/bpf/xdp_fwd_kern.c |5 +++--
samples/bpf/xdp_fwd_user.c |2 +
v{4,6}.conf.all.forwarding
setting is honored by bpf_fib_lookup.
Reported-by: Anton Protopopov
Signed-off-by: Jesper Dangaard Brouer
---
samples/bpf/xdp_fwd_kern.c | 19 +--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/samples/bpf/xdp_fwd_kern.c b/samples/bpf/xdp_fwd_kern.c
On Wed, 7 Aug 2019 11:04:17 -0700
Y Song wrote:
> On Wed, Aug 7, 2019 at 5:37 AM Jesper Dangaard Brouer
> wrote:
> >
> > This address the TODO in samples/bpf/xdp_fwd_kern.c, which points out
> > that the chosen egress index should be checked for existence in the
>
On Wed, 7 Aug 2019 15:09:09 -0700
Zvi Effron wrote:
> On Wed, Aug 7, 2019 at 6:00 AM Jesper Dangaard Brouer
> wrote:
> >
> > Toke's devmap lookup improvement is first avail in kernel v5.3.
> > Thus, not part of XDP-tutorial yet.
> >
> I probably missed
v{4,6}.conf.all.forwarding
setting is honored by bpf_fib_lookup.
Reported-by: Anton Protopopov
Signed-off-by: Jesper Dangaard Brouer
Reviewed-by: David Ahern
Acked-by: Yonghong Song
---
samples/bpf/xdp_fwd_kern.c | 19 +--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/sample
es xdp_fwd more practically usable, as this allows for
a mixed environment, where IP-forwarding fallback to network stack, if
the egress device isn't configured to use XDP.
Signed-off-by: Jesper Dangaard Brouer
Reviewed-by: David Ahern
---
samples/bpf/xdp_fwd_kern.c | 17 ++
tches first as they are isolated.
[1] http://vger.kernel.org/lpc-networking2018.html#session-1
---
Jesper Dangaard Brouer (3):
samples/bpf: xdp_fwd rename devmap name to be xdp_tx_ports
samples/bpf: make xdp_fwd more practically usable via devmap lookup
samples/bpf: xdp_fwd ex
The devmap name 'tx_port' came from a copy-paste from xdp_redirect_map
which only have a single TX port. Change name to xdp_tx_ports
to make it more descriptive.
Signed-off-by: Jesper Dangaard Brouer
Reviewed-by: David Ahern
Acked-by: Yonghong Song
---
samples/bpf/xdp_fwd_ker
On Thu, 08 Aug 2019 17:46:46 +0200
Jesper Dangaard Brouer wrote:
> @@ -103,8 +112,17 @@ int main(int argc, char **argv)
> return 1;
> }
>
> - if (bpf_prog_load_xattr(&prog_load_attr, &obj, &prog_fd))
> +
might requires changes
to libbpf. Thus, sending these patches first as they are isolated.
[1] http://vger.kernel.org/lpc-networking2018.html#session-1
---
Jesper Dangaard Brouer (3):
samples/bpf: xdp_fwd rename devmap name to be xdp_tx_ports
samples/bpf: make xdp_fwd more practically u
v{4,6}.conf.all.forwarding
setting is honored by bpf_fib_lookup.
Reported-by: Anton Protopopov
Signed-off-by: Jesper Dangaard Brouer
Reviewed-by: David Ahern
Acked-by: Yonghong Song
---
samples/bpf/xdp_fwd_kern.c | 19 +--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/sample
The devmap name 'tx_port' came from a copy-paste from xdp_redirect_map
which only have a single TX port. Change name to xdp_tx_ports
to make it more descriptive.
Signed-off-by: Jesper Dangaard Brouer
Reviewed-by: David Ahern
Acked-by: Yonghong Song
---
samples/bpf/xdp_fwd_ker
es xdp_fwd more practically usable, as this allows for
a mixed environment, where IP-forwarding fallback to network stack, if
the egress device isn't configured to use XDP.
Signed-off-by: Jesper Dangaard Brouer
Reviewed-by: David Ahern
---
samples/bpf/xdp_fwd_kern.c | 17 ++
umber of hash buckets by rounding up max_entries
> > >> to the
> > >> nearest power of two (mirroring the regular hashmap), as suggested by
> > >> Jesper.
> > >
> > > fyi I'm waiting for Jesper to review this new version.
> >
> > Ping Jesper? :)
>
> Toke, the patch set has been merged to net-next.
> https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=d3406913561c322323ec2898cc58f55e79786be7
>
Yes, and I did review this... :-)
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Thu, 14 Jan 2021 00:07:14 +0100
Daniel Borkmann wrote:
> On 1/12/21 6:45 PM, Jesper Dangaard Brouer wrote:
> > This BPF-helper bpf_check_mtu() works for both XDP and TC-BPF programs.
> [...]
> > + * int bpf_check_mtu(void *ctx, u32 ifindex, u32 *mtu_len, s32 len_di
On Tue, 12 Jan 2021 11:23:33 -0800
Andrii Nakryiko wrote:
> On Tue, Jan 12, 2021 at 9:49 AM Jesper Dangaard Brouer
> wrote:
> >
> > This BPF-helper bpf_check_mtu() works for both XDP and TC-BPF programs.
> >
> > The SKB object is complex and the skb->len va
On Thu, 14 Jan 2021 01:03:33 -0800
John Fastabend wrote:
> Jesper Dangaard Brouer wrote:
> > The use-case for dropping the MTU check when TC-BPF does redirect to
> > ingress, is described by Eyal Birger in email[0]. The summary is the
> > ability to increase packet size (e
On Thu, 14 Jan 2021 23:28:57 +0100
Daniel Borkmann wrote:
> On 1/14/21 3:36 PM, Jesper Dangaard Brouer wrote:
> [...]
> >>> +BPF_CALL_5(bpf_skb_check_mtu, struct sk_buff *, skb,
> >>> +u32, ifindex, u32 *, mtu_len, s32, len_diff, u64, f
nfig.
[1] https://github.com/xdp-project/bpf-examples/tree/master/MTU-tests
Signed-off-by: Jesper Dangaard Brouer
Acked-by: John Fastabend
---
net/core/filter.c | 12
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 9ab94e90d6
allow negative len adj
Signed-off-by: Jesper Dangaard Brouer
---
include/uapi/linux/bpf.h | 67
net/core/filter.c | 111
tools/include/uapi/linux/bpf.h | 67
3 files changed, 245 i
lt
Reported-by: kernel test robot
Reported-by: Dan Carpenter
Signed-off-by: Jesper Dangaard Brouer
---
include/uapi/linux/bpf.h | 11 +--
net/core/filter.c | 22 +++---
tools/include/uapi/linux/bpf.h | 11 +--
3 files changed, 33 in
'tot_len' for MTU
check is done like XDP code-path, which checks against FIB-dst MTU.
V10:
- Use same method as XDP for 'tot_len' MTU check
Fixes: 4c79579b44b1 ("bpf: Change bpf_fib_lookup to return lookup status")
Reported-by: Carlo Carraro
Signed-off-b
Adding selftest for BPF-helper bpf_check_mtu(). Making sure
it can be used from both XDP and TC.
V11:
- Addresse nitpicks from Andrii Nakryiko
V10:
- Remove errno non-zero test in CHECK_ATTR()
- Addresse comments from Andrii Nakryiko
Signed-off-by: Jesper Dangaard Brouer
Acked-by: Andrii
://lore.kernel.org/netdev/CAHsH6Gug-hsLGHQ6N0wtixdOa85LDZ3HNRHVd0opR=19qo4...@mail.gmail.com/
V9:
- Make net_device "up" (IFF_UP) check explicit in skb_do_redirect
V4:
- Keep net_device "up" (IFF_UP) check.
- Adjustment to handle bpf_redirect_peer() helper
Signed-off-by: Je
This demonstrate how bpf_check_mtu() helper can easily be used together
with bpf_skb_adjust_room() helper, prior to doing size adjustment, as
delta argument is already setup.
Hint: This specific test can be selected like this:
./test_progs -t cls_redirect
Signed-off-by: Jesper Dangaard Brouer
V9: Remove patch that use skb_set_redirected
V10: Fix selftests and 'tot_len' MTU check like XDP
V11: Fix nitpicks in selftests
V12: Adjustments requested by Daniel
---
Jesper Dangaard Brouer (7):
bpf: Remove MTU check in __bpf_skb_max_len
bpf: fix bpf_fib_lookup helper MTU check fo
t;);
> + goto out;
> + }
> + devmap_prog_fd_1 = bpf_program__fd(devmap_prog);
> + if (devmap_prog_fd_1 < 0) {
> + printf("finding devmap_prog fd failed\n");
> + got
to have a little overhead as
possible, but for me 42 nanosec overhead is close to zero overhead. For
comparison, I just ran a udp_sink[3] test, and it "cost" 625 ns for
delivery of UDP packets into socket (almost 15 times slower).
I guess my point is that with XDP we have already achieve
to use unlikely() here.
I added the unlikely() to preserve the baseline performance when not
having the 2nd prog loaded. But I'm fine with removing that.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
struct xdp_md *ctx)
> +{
> + return xdp_redirect_map(ctx, &tx_port_general);
> +}
> +
> +SEC("xdp_redirect_native")
> +int xdp_redirect_map_native(struct xdp_md *ctx)
> +{
> + return xdp_redirect_map(ctx, &tx_port_native);
> +}
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Wed, 20 Jan 2021 17:19:31 +0100
Maciej Fijalkowski wrote:
> On Wed, Jan 20, 2021 at 04:57:08PM +0100, Jesper Dangaard Brouer wrote:
> > On Wed, 20 Jan 2021 15:15:22 +0200
> > Maxim Mikityanskiy wrote:
> >
> > > On 2021-01-19 17:50, Björn Töpel wrote:
&g
> + tx_per_ev = EFX_MAX_EVQ_SIZE / EFX_TXQ_MAX_ENT(efx);
> n_xdp_tx = num_possible_cpus();
> - n_xdp_ev = DIV_ROUND_UP(n_xdp_tx, EFX_MAX_TXQ_PER_CHANNEL);
> + n_xdp_ev = DIV_ROUND_UP(n_xdp_tx, tx_per_ev);
>
> vec_count = pci_msix_vec_count(efx->pci_dev);
> if (vec_count < 0)
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
ed.
>
> Signed-off-by: Hangbin Liu
> ---
I think we have nitpicked this enough ;-)
Acked-by: Jesper Dangaard Brouer
> v10:
> make xdp_redirect_map() always inline.
>
> v9:
> roll back to just set src mac to egress interface mac on 2nd xdp prog,
> this could avoid p
On Wed, 9 Dec 2020 08:44:33 -0700
David Ahern wrote:
> On 12/9/20 4:52 AM, Jesper Dangaard Brouer wrote:
> > But I have redesigned the ndo_xdp_xmit call to take a bulk of packets
> > (up-to 16) so it should not be a problem to solve this by sharing
> > TX-queue and talking
On Thu, 10 Dec 2020 15:14:18 +0100
Magnus Karlsson wrote:
> On Thu, Dec 10, 2020 at 2:32 PM Jesper Dangaard Brouer
> wrote:
> >
> > On Wed, 9 Dec 2020 08:44:33 -0700
> > David Ahern wrote:
> >
> > > On 12/9/20 4:52 AM, Jesper Dangaard Brouer wro
ht this patch?
Will fix in V9.
There is a very small (performance) overhead, but mostly because
net_device struct layout have placed mtu and hard_header_len on
different cache-lines. (This is something that should be fixed
separately).
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Thu, 3 Dec 2020 00:23:14 +0100
Daniel Borkmann wrote:
> On 11/27/20 7:06 PM, Jesper Dangaard Brouer wrote:
> [...]
> > +static struct net_device *__dev_via_ifindex(struct net_device *dev_curr,
> > + u32 ifindex)
> > +{
> > +
size.
>*/
> -
> + tx_per_ev = EFX_MAX_EVQ_SIZE / EFX_TXQ_MAX_ENT(efx);
> n_xdp_tx = num_possible_cpus();
> - n_xdp_ev = DIV_ROUND_UP(n_xdp_tx, EFX_MAX_TXQ_PER_CHANNEL);
> + n_xdp_ev = DIV_ROUND_UP(n_xdp_tx, tx_per_ev);
>
> vec_count = pci_msix_vec
p->data_meta = meta_valid ? data : data + 1;
>
> This will introduce branch, so for intel drivers we're getting the
> overhead of one add and a branch. I'm still opting for a separate helper.
I should think, as this gets inlined the compiler should be able to
remove the branch. I
xdp.frame_sz = PAGE_SIZE; /* BNXT_RX_PAGE_MODE(bp) when XDP enabled */
> orig_data = xdp.data;
I don't like loosing the comment here. Other developers reading this
code might assume that size is always PAGE_SIZE, which is only the case
when XDP is enabled. Lets save them from making thi
On Tue, 15 Dec 2020 18:49:55 +
Edward Cree wrote:
> On 15/12/2020 09:43, Jesper Dangaard Brouer wrote:
> > On Mon, 14 Dec 2020 17:29:06 -0800
> > Ivan Babrou wrote:
> >
> >> Without this change the driver tries to allocate too many queues,
> >>
hey have two modes (at compile
time) depending on PAGE_SIZE in system. In one of the modes (default
one) you can place init of xdp.frame_sz outside the NAPI loop and init a
single time. In the other mode you cannot, and it becomes dynamic per
packet. Intel review this carefully, please!
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Thu, 3 Dec 2020 00:43:36 +0100
Daniel Borkmann wrote:
> On 11/27/20 7:06 PM, Jesper Dangaard Brouer wrote:
> > The use-case for dropping the MTU check when TC-BPF does redirect to
> > ingress, is described by Eyal Birger in email[0]. The summary is the
> > ability to incr
On Thu, 17 Dec 2020 15:46:55 +0100
Jesper Dangaard Brouer wrote:
> > > diff --git a/net/core/filter.c b/net/core/filter.c
> > > index d6125cfc49c3..4673afe59533 100644
> > > --- a/net/core/filter.c
> > > +++ b/net/core/filter.c
> > > @@ -2083,13 +
V9: Remove patch that use skb_set_redirected
---
Jesper Dangaard Brouer (7):
bpf: Remove MTU check in __bpf_skb_max_len
bpf: fix bpf_fib_lookup helper MTU check for SKB ctx
bpf: bpf_fib_lookup return MTU value as output when looked up
bpf: add BPF-helper for MTU checking
bpf: dro
nfig.
[1] https://github.com/xdp-project/bpf-examples/tree/master/MTU-tests
V3: replace __bpf_skb_max_len() with define and use IPv6 max MTU size.
Signed-off-by: Jesper Dangaard Brouer
---
net/core/filter.c | 12
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/net/cor
lt
Reported-by: kernel test robot
Reported-by: Dan Carpenter
Signed-off-by: Jesper Dangaard Brouer
---
include/uapi/linux/bpf.h | 11 +--
net/core/filter.c | 22 +++---
tools/include/uapi/linux/bpf.h | 11 +--
3 files changed, 33 in
bpf_fib_lookup to return lookup status")
Reported-by: Carlo Carraro
Signed-off-by: Jesper Dangaard Brouer
---
net/core/filter.c | 14 --
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index f8f198252ff2..95c6fdebd0db 100644
--
ex 0 now use current netdev for MTU lookup
- rename helper from bpf_mtu_check to bpf_check_mtu
- fix bug for GSO pkt length (as skb->len is total len)
- remove __bpf_len_adj_positive, simply allow negative len adj
Signed-off-by: Jesper Dangaard Brouer
---
include/uapi/linux/bpf.h
://lore.kernel.org/netdev/CAHsH6Gug-hsLGHQ6N0wtixdOa85LDZ3HNRHVd0opR=19qo4...@mail.gmail.com/
V9:
- Make net_device "up" (IFF_UP) check explicit in skb_do_redirect
V4:
- Keep net_device "up" (IFF_UP) check.
- Adjustment to handle bpf_redirect_peer() helper
Signed-off-by: Je
This demonstrate how bpf_check_mtu() helper can easily be used together
with bpf_skb_adjust_room() helper, prior to doing size adjustment, as
delta argument is already setup.
Hint: This specific test can be selected like this:
./test_progs -t cls_redirect
Signed-off-by: Jesper Dangaard Brouer
Adding selftest for BPF-helper bpf_check_mtu(). Making sure
it can be used from both XDP and TC.
Signed-off-by: Jesper Dangaard Brouer
---
tools/testing/selftests/bpf/prog_tests/check_mtu.c | 204
tools/testing/selftests/bpf/progs/test_check_mtu.c | 196
On Thu, 17 Dec 2020 18:26:50 +0100
Jesper Dangaard Brouer wrote:
> Adding selftest for BPF-helper bpf_check_mtu(). Making sure
> it can be used from both XDP and TC.
>
> Signed-off-by: Jesper Dangaard Brouer
> ---
> tools/testing/selftests/bpf/prog_tests/
_end_pointer(skb) - xdp->data_hard_start;
> + frame_sz += SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
>
> orig_data_end = xdp->data_end;
> orig_data = xdp->data;
> @@ -4641,7 +4641,7 @@ static u32 netif_receive_generic_xdp(struct sk_buff
> *skb,
&
area and populate it with driver info from RX-descriptor.
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Fri, 18 Dec 2020 12:13:45 -0800
Andrii Nakryiko wrote:
> On Thu, Dec 17, 2020 at 9:30 AM Jesper Dangaard Brouer
> wrote:
> >
> > Adding selftest for BPF-helper bpf_check_mtu(). Making sure
> > it can be used from both XDP and TC.
> >
> > S
V9: Remove patch that use skb_set_redirected
V10: Fix selftests and 'tot_len' MTU check like XDP
---
Jesper Dangaard Brouer (7):
bpf: Remove MTU check in __bpf_skb_max_len
bpf: fix bpf_fib_lookup helper MTU check for SKB ctx
bpf: bpf_fib_lookup return MTU value as output when look
nfig.
[1] https://github.com/xdp-project/bpf-examples/tree/master/MTU-tests
V3: replace __bpf_skb_max_len() with define and use IPv6 max MTU size.
Signed-off-by: Jesper Dangaard Brouer
---
net/core/filter.c | 12
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/net/cor
'tot_len' for MTU
check is done like XDP code-path, which checks against FIB-dst MTU.
V10:
- Use same method as XDP for 'tot_len' MTU check
Fixes: 4c79579b44b1 ("bpf: Change bpf_fib_lookup to return lookup status")
Reported-by: Carlo Carraro
Signed-off-b
ex 0 now use current netdev for MTU lookup
- rename helper from bpf_mtu_check to bpf_check_mtu
- fix bug for GSO pkt length (as skb->len is total len)
- remove __bpf_len_adj_positive, simply allow negative len adj
Signed-off-by: Jesper Dangaard Brouer
---
include/uapi/linux/bpf.h
lt
Reported-by: kernel test robot
Reported-by: Dan Carpenter
Signed-off-by: Jesper Dangaard Brouer
---
include/uapi/linux/bpf.h | 11 +--
net/core/filter.c | 22 +++---
tools/include/uapi/linux/bpf.h | 11 +--
3 files changed, 33 in
://lore.kernel.org/netdev/CAHsH6Gug-hsLGHQ6N0wtixdOa85LDZ3HNRHVd0opR=19qo4...@mail.gmail.com/
V9:
- Make net_device "up" (IFF_UP) check explicit in skb_do_redirect
V4:
- Keep net_device "up" (IFF_UP) check.
- Adjustment to handle bpf_redirect_peer() helper
Signed-off-by: Je
1 - 100 of 2426 matches
Mail list logo