* [PATCH] staging: r8188eu: Add queue_index to xdp_rxq_info
@ 2022-06-02 17:36 Varshini Elangovan
2022-06-02 17:54 ` Jakub Kicinski
2022-06-02 20:43 ` Zvi Effron
0 siblings, 2 replies; 3+ messages in thread
From: Varshini Elangovan @ 2022-06-02 17:36 UTC (permalink / raw)
To: ast, daniel, davem, kuba, hawk, john.fastabend, andrii, kafai,
songliubraving, yhs, kpsingh, netdev, bpf, linux-kernel
Cc: Varshini Elangovan
Queue_index from the xdp_rxq_info is populated in cpumap file.
Using the NR_CPUS, results in patch check warning, as recommended,
using the num_possible_cpus() instead of NR_CPUS
Signed-off-by: Varshini Elangovan <varshini.elangovan@gmail.com>
---
kernel/bpf/cpumap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
index 650e5d21f90d..756fd81f474c 100644
--- a/kernel/bpf/cpumap.c
+++ b/kernel/bpf/cpumap.c
@@ -102,8 +102,8 @@ static struct bpf_map *cpu_map_alloc(union bpf_attr *attr)
bpf_map_init_from_attr(&cmap->map, attr);
- /* Pre-limit array size based on NR_CPUS, not final CPU check */
- if (cmap->map.max_entries > NR_CPUS) {
+ /* Pre-limit array size based on num_possible_cpus, not final CPU check */
+ if (cmap->map.max_entries > num_possible_cpus()) {
err = -E2BIG;
goto free_cmap;
}
@@ -227,7 +227,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu,
rxq.dev = xdpf->dev_rx;
rxq.mem = xdpf->mem;
- /* TODO: report queue_index to xdp_rxq_info */
+ rxq.queue_index = ++i;
xdp_convert_frame_to_buff(xdpf, &xdp);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: r8188eu: Add queue_index to xdp_rxq_info
2022-06-02 17:36 [PATCH] staging: r8188eu: Add queue_index to xdp_rxq_info Varshini Elangovan
@ 2022-06-02 17:54 ` Jakub Kicinski
2022-06-02 20:43 ` Zvi Effron
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-06-02 17:54 UTC (permalink / raw)
To: Varshini Elangovan
Cc: ast, daniel, davem, hawk, john.fastabend, andrii, kafai,
songliubraving, yhs, kpsingh, netdev, bpf, linux-kernel
On Thu, 2 Jun 2022 23:06:57 +0530 Varshini Elangovan wrote:
> Subject: [PATCH] staging: r8188eu: Add queue_index to xdp_rxq_info
For a second there I thought we had a wifi driver with XDP support
in staging :/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: r8188eu: Add queue_index to xdp_rxq_info
2022-06-02 17:36 [PATCH] staging: r8188eu: Add queue_index to xdp_rxq_info Varshini Elangovan
2022-06-02 17:54 ` Jakub Kicinski
@ 2022-06-02 20:43 ` Zvi Effron
1 sibling, 0 replies; 3+ messages in thread
From: Zvi Effron @ 2022-06-02 20:43 UTC (permalink / raw)
To: Varshini Elangovan
Cc: ast, daniel, davem, kuba, hawk, john.fastabend, andrii, kafai,
songliubraving, yhs, kpsingh, netdev, bpf, linux-kernel
On Thu, Jun 2, 2022 at 10:37 AM Varshini Elangovan
<varshini.elangovan@gmail.com> wrote:
>
> Queue_index from the xdp_rxq_info is populated in cpumap file.
> Using the NR_CPUS, results in patch check warning, as recommended,
> using the num_possible_cpus() instead of NR_CPUS
>
> Signed-off-by: Varshini Elangovan <varshini.elangovan@gmail.com>
> ---
> kernel/bpf/cpumap.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
> index 650e5d21f90d..756fd81f474c 100644
> --- a/kernel/bpf/cpumap.c
> +++ b/kernel/bpf/cpumap.c
> @@ -102,8 +102,8 @@ static struct bpf_map *cpu_map_alloc(union bpf_attr *attr)
>
> bpf_map_init_from_attr(&cmap->map, attr);
>
> - /* Pre-limit array size based on NR_CPUS, not final CPU check */
> - if (cmap->map.max_entries > NR_CPUS) {
> + /* Pre-limit array size based on num_possible_cpus, not final CPU check */
> + if (cmap->map.max_entries > num_possible_cpus()) {
> err = -E2BIG;
> goto free_cmap;
> }
> @@ -227,7 +227,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu,
>
> rxq.dev = xdpf->dev_rx;
> rxq.mem = xdpf->mem;
> - /* TODO: report queue_index to xdp_rxq_info */
> + rxq.queue_index = ++i;
I don't think this is correct. i is the frame index, not the queue index. There
is (as far as I can tell) no correlation between the two.
Additionally, i is the loop variable, and the ++ operator will change its
value, causing frames to be skipped.
>
> xdp_convert_frame_to_buff(xdpf, &xdp);
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-02 20:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 17:36 [PATCH] staging: r8188eu: Add queue_index to xdp_rxq_info Varshini Elangovan
2022-06-02 17:54 ` Jakub Kicinski
2022-06-02 20:43 ` Zvi Effron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.