Lines Matching refs:bpf
31 nfp_map_ptr_record(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog, in nfp_map_ptr_record() argument
38 record = rhashtable_lookup_fast(&bpf->maps_neutral, &map->id, in nfp_map_ptr_record()
61 err = rhashtable_insert_fast(&bpf->maps_neutral, &record->l, in nfp_map_ptr_record()
78 nfp_map_ptrs_forget(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog) in nfp_map_ptrs_forget() argument
89 WARN_ON(rhashtable_remove_fast(&bpf->maps_neutral, in nfp_map_ptrs_forget()
111 nfp_map_ptrs_record(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog, in nfp_map_ptrs_record() argument
136 err = nfp_map_ptr_record(bpf, nfp_prog, in nfp_map_ptrs_record()
139 nfp_map_ptrs_forget(bpf, nfp_prog); in nfp_map_ptrs_record()
203 nfp_prog->bpf = bpf_offload_dev_priv(prog->aux->offload->offdev); in nfp_bpf_verifier_prep()
244 return nfp_map_ptrs_record(nfp_prog->bpf, nfp_prog, prog); in nfp_bpf_translate()
252 nfp_map_ptrs_forget(nfp_prog->bpf, nfp_prog); in nfp_bpf_destroy()
332 nfp_bpf_map_alloc(struct nfp_app_bpf *bpf, struct bpf_offloaded_map *offmap) in nfp_bpf_map_alloc() argument
338 if (!bpf->maps.types) in nfp_bpf_map_alloc()
347 if (!(bpf->maps.types & 1 << offmap->map.map_type)) { in nfp_bpf_map_alloc()
351 if (bpf->maps.max_maps == bpf->maps_in_use) { in nfp_bpf_map_alloc()
355 if (bpf->maps.max_elems - bpf->map_elems_in_use < in nfp_bpf_map_alloc()
359 bpf->maps.max_elems - bpf->map_elems_in_use); in nfp_bpf_map_alloc()
364 round_up(offmap->map.value_size, 8) > bpf->maps.max_elem_sz) { in nfp_bpf_map_alloc()
368 bpf->maps.max_elem_sz); in nfp_bpf_map_alloc()
371 if (offmap->map.key_size > bpf->maps.max_key_sz) { in nfp_bpf_map_alloc()
373 offmap->map.key_size, bpf->maps.max_key_sz); in nfp_bpf_map_alloc()
376 if (offmap->map.value_size > bpf->maps.max_val_sz) { in nfp_bpf_map_alloc()
378 offmap->map.value_size, bpf->maps.max_val_sz); in nfp_bpf_map_alloc()
391 nfp_map->bpf = bpf; in nfp_bpf_map_alloc()
394 res = nfp_bpf_ctrl_alloc_map(bpf, &offmap->map); in nfp_bpf_map_alloc()
402 bpf->maps_in_use++; in nfp_bpf_map_alloc()
403 bpf->map_elems_in_use += offmap->map.max_entries; in nfp_bpf_map_alloc()
404 list_add_tail(&nfp_map->l, &bpf->map_list); in nfp_bpf_map_alloc()
410 nfp_bpf_map_free(struct nfp_app_bpf *bpf, struct bpf_offloaded_map *offmap) in nfp_bpf_map_free() argument
414 nfp_bpf_ctrl_free_map(bpf, nfp_map); in nfp_bpf_map_free()
418 bpf->map_elems_in_use -= offmap->map.max_entries; in nfp_bpf_map_free()
419 bpf->maps_in_use--; in nfp_bpf_map_free()
425 int nfp_ndo_bpf(struct nfp_app *app, struct nfp_net *nn, struct netdev_bpf *bpf) in nfp_ndo_bpf() argument
427 switch (bpf->command) { in nfp_ndo_bpf()
429 return nfp_bpf_map_alloc(app->priv, bpf->offmap); in nfp_ndo_bpf()
431 return nfp_bpf_map_free(app->priv, bpf->offmap); in nfp_ndo_bpf()
445 int nfp_bpf_event_output(struct nfp_app_bpf *bpf, const void *data, in nfp_bpf_event_output() argument
467 record = rhashtable_lookup(&bpf->maps_neutral, &map_id, in nfp_bpf_event_output()
471 cmsg_warn(bpf, "perf event: map id %lld (0x%llx) not recognized, dropping event\n", in nfp_bpf_event_output()