On 10/09/2017 07:59 PM, Jesper Dangaard Brouer wrote:
[...]
+static void *cpu_map_lookup_elem(struct bpf_map *map, void *key)
+{
+ struct bpf_cpu_map_entry *rcpu =
+ __cpu_map_lookup_elem(map, *(u32 *)key);
+
+ return rcpu ? >qsize : NULL;
I still think from my prior
On Mon, 09 Oct 2017 15:31:21 +0200
Daniel Borkmann wrote:
> On 10/06/2017 06:12 PM, Jesper Dangaard Brouer wrote:
> [...]
> > +static struct bpf_map *cpu_map_alloc(union bpf_attr *attr)
> > +{
> > + struct bpf_cpu_map *cmap;
> > + int err = -ENOMEM;
>
> err init here
On 10/09/2017 03:31 PM, Daniel Borkmann wrote:
On 10/06/2017 06:12 PM, Jesper Dangaard Brouer wrote:
[...]
+/* Pre-limit array size based on NR_CPUS, not final CPU check */
+if (cmap->map.max_entries > NR_CPUS)
Nit: needs to be >= NR_CPUS.
Scratch that comment, you bail out on
On 10/06/2017 06:12 PM, Jesper Dangaard Brouer wrote:
[...]
+static struct bpf_map *cpu_map_alloc(union bpf_attr *attr)
+{
+ struct bpf_cpu_map *cmap;
+ int err = -ENOMEM;
err init here is basically not needed since overriden later anyway
w/o being read, but ...
+ u64 cost;
The 'cpumap' is primary used as a backend map for XDP BPF helper
call bpf_redirect_map() and XDP_REDIRECT action, like 'devmap'.
This patch implement the main part of the map. It is not connected to
the XDP redirect system yet, and no SKB allocation are done yet.
The main concern in this patch