diff options
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/bpf/main.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/bpf/main.h | 18 |
2 files changed, 24 insertions, 1 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.c b/drivers/net/ethernet/netronome/nfp/bpf/main.c index e8cfe300c8c4..c9fd7d417d1a 100644 --- a/drivers/net/ethernet/netronome/nfp/bpf/main.c +++ b/drivers/net/ethernet/netronome/nfp/bpf/main.c | |||
@@ -313,6 +313,8 @@ static int nfp_bpf_init(struct nfp_app *app) | |||
313 | bpf->app = app; | 313 | bpf->app = app; |
314 | app->priv = bpf; | 314 | app->priv = bpf; |
315 | 315 | ||
316 | INIT_LIST_HEAD(&bpf->map_list); | ||
317 | |||
316 | err = nfp_bpf_parse_capabilities(app); | 318 | err = nfp_bpf_parse_capabilities(app); |
317 | if (err) | 319 | if (err) |
318 | goto err_free_bpf; | 320 | goto err_free_bpf; |
@@ -326,7 +328,10 @@ err_free_bpf: | |||
326 | 328 | ||
327 | static void nfp_bpf_clean(struct nfp_app *app) | 329 | static void nfp_bpf_clean(struct nfp_app *app) |
328 | { | 330 | { |
329 | kfree(app->priv); | 331 | struct nfp_app_bpf *bpf = app->priv; |
332 | |||
333 | WARN_ON(!list_empty(&bpf->map_list)); | ||
334 | kfree(bpf); | ||
330 | } | 335 | } |
331 | 336 | ||
332 | const struct nfp_app_type app_bpf = { | 337 | const struct nfp_app_type app_bpf = { |
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.h b/drivers/net/ethernet/netronome/nfp/bpf/main.h index 66381afee2a9..23763b22f8fc 100644 --- a/drivers/net/ethernet/netronome/nfp/bpf/main.h +++ b/drivers/net/ethernet/netronome/nfp/bpf/main.h | |||
@@ -93,6 +93,8 @@ enum pkt_vec { | |||
93 | * struct nfp_app_bpf - bpf app priv structure | 93 | * struct nfp_app_bpf - bpf app priv structure |
94 | * @app: backpointer to the app | 94 | * @app: backpointer to the app |
95 | * | 95 | * |
96 | * @map_list: list of offloaded maps | ||
97 | * | ||
96 | * @adjust_head: adjust head capability | 98 | * @adjust_head: adjust head capability |
97 | * @flags: extra flags for adjust head | 99 | * @flags: extra flags for adjust head |
98 | * @off_min: minimal packet offset within buffer required | 100 | * @off_min: minimal packet offset within buffer required |
@@ -103,6 +105,8 @@ enum pkt_vec { | |||
103 | struct nfp_app_bpf { | 105 | struct nfp_app_bpf { |
104 | struct nfp_app *app; | 106 | struct nfp_app *app; |
105 | 107 | ||
108 | struct list_head map_list; | ||
109 | |||
106 | struct nfp_bpf_cap_adjust_head { | 110 | struct nfp_bpf_cap_adjust_head { |
107 | u32 flags; | 111 | u32 flags; |
108 | int off_min; | 112 | int off_min; |
@@ -112,6 +116,20 @@ struct nfp_app_bpf { | |||
112 | } adjust_head; | 116 | } adjust_head; |
113 | }; | 117 | }; |
114 | 118 | ||
119 | /** | ||
120 | * struct nfp_bpf_map - private per-map data attached to BPF maps for offload | ||
121 | * @offmap: pointer to the offloaded BPF map | ||
122 | * @bpf: back pointer to bpf app private structure | ||
123 | * @tid: table id identifying map on datapath | ||
124 | * @l: link on the nfp_app_bpf->map_list list | ||
125 | */ | ||
126 | struct nfp_bpf_map { | ||
127 | struct bpf_offloaded_map *offmap; | ||
128 | struct nfp_app_bpf *bpf; | ||
129 | u32 tid; | ||
130 | struct list_head l; | ||
131 | }; | ||
132 | |||
115 | struct nfp_prog; | 133 | struct nfp_prog; |
116 | struct nfp_insn_meta; | 134 | struct nfp_insn_meta; |
117 | typedef int (*instr_cb_t)(struct nfp_prog *, struct nfp_insn_meta *); | 135 | typedef int (*instr_cb_t)(struct nfp_prog *, struct nfp_insn_meta *); |