Skip to content

Commit 2252743

Browse files
author
Alexei Starovoitov
committed
Merge branch 'nfp-bpf-updates'
Jakub Kicinski says: ==================== This set adds support for update and delete calls from the datapath, as well as XADD instructions (32 and 64 bit) and pseudo random numbers. The XADD support depends on verifier enforcing alignment which Daniel recently added. XADD uses NFP's atomic engine which requires values to be in big endian, therefore we need to keep track of which parts of the values are used as atomics and byte swap them accordingly. Pseudo random numbers are generated using NFP's HW pseudo random number generator. Jiong tackles initial implementation of packet cache, which he describes as follows: Memory reads on NFP would first fetch data from memory to transfer-in registers, then move them from transfer-in to general registers. Given NFP is rich on transfer-in registers, they could serve as memory cache. This patch tries to identify a sequence of packet data read (BPF_LDX) that are executed sequentially, then the total access range of the sequence is calculated and attached to each read instruction, the first instruction in this sequence is marked with an cache init flag so the execution of it would bring in the whole range of packet data for the sequence. All later packet reads in this sequence would fetch data from transfer-in registers directly, no need to JIT NFP memory access. Function call, non-packet-data memory read, packet write and memcpy will invalidate the cache and start a new cache range. Cache invalidation could be improved in the future, for example packet write doesn't need to invalidate the cache if the the write destination won't be read again. ==================== Signed-off-by: Alexei Starovoitov <[email protected]>
2 parents f6ef565 + 7c095f5 commit 2252743

File tree

10 files changed

+771
-80
lines changed

10 files changed

+771
-80
lines changed

drivers/net/ethernet/netronome/nfp/bpf/cmsg.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,17 @@ nfp_bpf_cmsg_communicate(struct nfp_app_bpf *bpf, struct sk_buff *skb,
218218
return skb;
219219

220220
hdr = (struct cmsg_hdr *)skb->data;
221-
/* 0 reply_size means caller will do the validation */
222-
if (reply_size && skb->len != reply_size) {
223-
cmsg_warn(bpf, "cmsg drop - wrong size %d != %d!\n",
224-
skb->len, reply_size);
225-
goto err_free;
226-
}
227221
if (hdr->type != __CMSG_REPLY(type)) {
228222
cmsg_warn(bpf, "cmsg drop - wrong type 0x%02x != 0x%02lx!\n",
229223
hdr->type, __CMSG_REPLY(type));
230224
goto err_free;
231225
}
226+
/* 0 reply_size means caller will do the validation */
227+
if (reply_size && skb->len != reply_size) {
228+
cmsg_warn(bpf, "cmsg drop - type 0x%02x wrong size %d != %d!\n",
229+
type, skb->len, reply_size);
230+
goto err_free;
231+
}
232232

233233
return skb;
234234
err_free:

drivers/net/ethernet/netronome/nfp/bpf/fw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ enum bpf_cap_tlv_type {
4141
NFP_BPF_CAP_TYPE_FUNC = 1,
4242
NFP_BPF_CAP_TYPE_ADJUST_HEAD = 2,
4343
NFP_BPF_CAP_TYPE_MAPS = 3,
44+
NFP_BPF_CAP_TYPE_RANDOM = 4,
4445
};
4546

4647
struct nfp_bpf_cap_tlv_func {

0 commit comments

Comments
 (0)