Lines Matching refs:bpf

18 nfp_bpf_cmsg_alloc(struct nfp_app_bpf *bpf, unsigned int size)  in nfp_bpf_cmsg_alloc()  argument
22 skb = nfp_app_ctrl_msg_alloc(bpf->app, size, GFP_KERNEL); in nfp_bpf_cmsg_alloc()
29 nfp_bpf_cmsg_map_req_size(struct nfp_app_bpf *bpf, unsigned int n) in nfp_bpf_cmsg_map_req_size() argument
34 size += (bpf->cmsg_key_sz + bpf->cmsg_val_sz) * n; in nfp_bpf_cmsg_map_req_size()
40 nfp_bpf_cmsg_map_req_alloc(struct nfp_app_bpf *bpf, unsigned int n) in nfp_bpf_cmsg_map_req_alloc() argument
42 return nfp_bpf_cmsg_alloc(bpf, nfp_bpf_cmsg_map_req_size(bpf, n)); in nfp_bpf_cmsg_map_req_alloc()
46 nfp_bpf_cmsg_map_reply_size(struct nfp_app_bpf *bpf, unsigned int n) in nfp_bpf_cmsg_map_reply_size() argument
51 size += (bpf->cmsg_key_sz + bpf->cmsg_val_sz) * n; in nfp_bpf_cmsg_map_reply_size()
57 nfp_bpf_ctrl_rc_to_errno(struct nfp_app_bpf *bpf, in nfp_bpf_ctrl_rc_to_errno() argument
74 cmsg_warn(bpf, "FW responded with invalid status: %u\n", rc); in nfp_bpf_ctrl_rc_to_errno()
82 nfp_bpf_ctrl_alloc_map(struct nfp_app_bpf *bpf, struct bpf_map *map) in nfp_bpf_ctrl_alloc_map() argument
90 skb = nfp_bpf_cmsg_alloc(bpf, sizeof(*req)); in nfp_bpf_ctrl_alloc_map()
101 skb = nfp_ccm_communicate(&bpf->ccm, skb, NFP_CCM_TYPE_BPF_MAP_ALLOC, in nfp_bpf_ctrl_alloc_map()
107 err = nfp_bpf_ctrl_rc_to_errno(bpf, &reply->reply_hdr); in nfp_bpf_ctrl_alloc_map()
120 void nfp_bpf_ctrl_free_map(struct nfp_app_bpf *bpf, struct nfp_bpf_map *nfp_map) in nfp_bpf_ctrl_free_map() argument
127 skb = nfp_bpf_cmsg_alloc(bpf, sizeof(*req)); in nfp_bpf_ctrl_free_map()
129 cmsg_warn(bpf, "leaking map - failed to allocate msg\n"); in nfp_bpf_ctrl_free_map()
136 skb = nfp_ccm_communicate(&bpf->ccm, skb, NFP_CCM_TYPE_BPF_MAP_FREE, in nfp_bpf_ctrl_free_map()
139 cmsg_warn(bpf, "leaking map - I/O error\n"); in nfp_bpf_ctrl_free_map()
144 err = nfp_bpf_ctrl_rc_to_errno(bpf, &reply->reply_hdr); in nfp_bpf_ctrl_free_map()
146 cmsg_warn(bpf, "leaking map - FW responded with: %d\n", err); in nfp_bpf_ctrl_free_map()
152 nfp_bpf_ctrl_req_key(struct nfp_app_bpf *bpf, struct cmsg_req_map_op *req, in nfp_bpf_ctrl_req_key() argument
155 return &req->data[bpf->cmsg_key_sz * n + bpf->cmsg_val_sz * n]; in nfp_bpf_ctrl_req_key()
159 nfp_bpf_ctrl_req_val(struct nfp_app_bpf *bpf, struct cmsg_req_map_op *req, in nfp_bpf_ctrl_req_val() argument
162 return &req->data[bpf->cmsg_key_sz * (n + 1) + bpf->cmsg_val_sz * n]; in nfp_bpf_ctrl_req_val()
166 nfp_bpf_ctrl_reply_key(struct nfp_app_bpf *bpf, struct cmsg_reply_map_op *reply, in nfp_bpf_ctrl_reply_key() argument
169 return &reply->data[bpf->cmsg_key_sz * n + bpf->cmsg_val_sz * n]; in nfp_bpf_ctrl_reply_key()
173 nfp_bpf_ctrl_reply_val(struct nfp_app_bpf *bpf, struct cmsg_reply_map_op *reply, in nfp_bpf_ctrl_reply_val() argument
176 return &reply->data[bpf->cmsg_key_sz * (n + 1) + bpf->cmsg_val_sz * n]; in nfp_bpf_ctrl_reply_val()
203 struct nfp_app_bpf *bpf = nfp_map->bpf; in nfp_bpf_ctrl_op_cache_get() local
207 n_entries = nfp_bpf_ctrl_op_cache_fill(op) ? bpf->cmsg_cache_cnt : 1; in nfp_bpf_ctrl_op_cache_get()
230 cached_key = nfp_bpf_ctrl_reply_key(bpf, reply, i); in nfp_bpf_ctrl_op_cache_get()
235 memcpy(out_value, nfp_bpf_ctrl_reply_val(bpf, reply, i), in nfp_bpf_ctrl_op_cache_get()
242 nfp_bpf_ctrl_reply_key(bpf, reply, i + 1), in nfp_bpf_ctrl_op_cache_get()
297 struct nfp_app_bpf *bpf = nfp_map->bpf; in nfp_bpf_ctrl_entry_op() local
315 skb = nfp_bpf_cmsg_map_req_alloc(bpf, 1); in nfp_bpf_ctrl_entry_op()
328 memcpy(nfp_bpf_ctrl_req_key(bpf, req, 0), key, map->key_size); in nfp_bpf_ctrl_entry_op()
330 memcpy(nfp_bpf_ctrl_req_val(bpf, req, 0), value, in nfp_bpf_ctrl_entry_op()
333 skb = nfp_ccm_communicate(&bpf->ccm, skb, op, 0); in nfp_bpf_ctrl_entry_op()
340 cmsg_warn(bpf, "cmsg drop - type 0x%02x too short %d!\n", in nfp_bpf_ctrl_entry_op()
348 err = nfp_bpf_ctrl_rc_to_errno(bpf, &reply->reply_hdr); in nfp_bpf_ctrl_entry_op()
358 if (skb->len != nfp_bpf_cmsg_map_reply_size(bpf, reply_entries)) { in nfp_bpf_ctrl_entry_op()
359 cmsg_warn(bpf, "cmsg drop - type 0x%02x too short %d for %d entries!\n", in nfp_bpf_ctrl_entry_op()
367 memcpy(out_key, nfp_bpf_ctrl_reply_key(bpf, reply, 0), in nfp_bpf_ctrl_entry_op()
370 memcpy(out_value, nfp_bpf_ctrl_reply_val(bpf, reply, 0), in nfp_bpf_ctrl_entry_op()
417 unsigned int nfp_bpf_ctrl_cmsg_min_mtu(struct nfp_app_bpf *bpf) in nfp_bpf_ctrl_cmsg_min_mtu() argument
419 return max(nfp_bpf_cmsg_map_req_size(bpf, 1), in nfp_bpf_ctrl_cmsg_min_mtu()
420 nfp_bpf_cmsg_map_reply_size(bpf, 1)); in nfp_bpf_ctrl_cmsg_min_mtu()
423 unsigned int nfp_bpf_ctrl_cmsg_mtu(struct nfp_app_bpf *bpf) in nfp_bpf_ctrl_cmsg_mtu() argument
426 nfp_bpf_cmsg_map_req_size(bpf, NFP_BPF_MAP_CACHE_CNT), in nfp_bpf_ctrl_cmsg_mtu()
427 nfp_bpf_cmsg_map_reply_size(bpf, NFP_BPF_MAP_CACHE_CNT)); in nfp_bpf_ctrl_cmsg_mtu()
430 unsigned int nfp_bpf_ctrl_cmsg_cache_cnt(struct nfp_app_bpf *bpf) in nfp_bpf_ctrl_cmsg_cache_cnt() argument
434 mtu = bpf->app->ctrl->dp.mtu; in nfp_bpf_ctrl_cmsg_cache_cnt()
435 entry_sz = bpf->cmsg_key_sz + bpf->cmsg_val_sz; in nfp_bpf_ctrl_cmsg_cache_cnt()
444 struct nfp_app_bpf *bpf = app->priv; in nfp_bpf_ctrl_msg_rx() local
447 cmsg_warn(bpf, "cmsg drop - too short %d!\n", skb->len); in nfp_bpf_ctrl_msg_rx()
453 if (!nfp_bpf_event_output(bpf, skb->data, skb->len)) in nfp_bpf_ctrl_msg_rx()
460 nfp_ccm_rx(&bpf->ccm, skb); in nfp_bpf_ctrl_msg_rx()
467 struct nfp_app_bpf *bpf = app->priv; in nfp_bpf_ctrl_msg_rx_raw() local
470 cmsg_warn(bpf, "cmsg drop - too short %d!\n", len); in nfp_bpf_ctrl_msg_rx_raw()
475 nfp_bpf_event_output(bpf, data, len); in nfp_bpf_ctrl_msg_rx_raw()
477 cmsg_warn(bpf, "cmsg drop - msg type %d with raw buffer!\n", in nfp_bpf_ctrl_msg_rx_raw()