diff options
author | Maciej Żenczykowski <maze@google.com> | 2024-03-11 23:14:20 -0700 |
---|---|---|
committer | Maciej Żenczykowski <maze@google.com> | 2024-03-12 00:21:17 -0700 |
commit | 76bf725261dbd9707ed76bd39c3b8fa180fbddcb (patch) | |
tree | c91ef0484d0fcf33855bea8c48dd44b6e2737a6d | |
parent | a0b290774b36d49c704d7c3b04c34bb90f8cb90e (diff) | |
download | apf-76bf725261dbd9707ed76bd39c3b8fa180fbddcb.tar.gz |
v5: add a few clarifying comments
Size at this commit (per devtools/mk) is:
text data bss dec hex filename
3780 0 0 3780 ec4 apf_interpreter.arm.o
text data bss dec hex filename
4605 0 0 4605 11fd apf_interpreter.x86.o
Test: N/A, comments only
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia51ea9f28361f1ffca64247dfff54f46e9e391f6
-rw-r--r-- | v5/apf_interpreter.c | 6 | ||||
-rw-r--r-- | v5/apf_interpreter_source.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/v5/apf_interpreter.c b/v5/apf_interpreter.c index 68d2f6b..15172ea 100644 --- a/v5/apf_interpreter.c +++ b/v5/apf_interpreter.c @@ -704,7 +704,7 @@ static int do_apf_run(apf_context* ctx) { u32 pktcopy_src_offset = 0; /* used for various pktdatacopy opcodes */ switch (opcode) { - case PASSDROP_OPCODE: { + case PASSDROP_OPCODE: { /* APFv6+ */ if (len_field > 2) return PASS_PACKET; /* max 64K counters (ie. imm < 64K) */ if (imm) { if (4 * imm > ctx->ram_len) return PASS_PACKET; @@ -749,7 +749,7 @@ static int do_apf_run(apf_context* ctx) { break; } case JMP_OPCODE: - if (reg_num && !ctx->v6) { + if (reg_num && !ctx->v6) { /* APFv6+ */ /* First invocation of APFv6 jmpdata instruction */ counter[-1] = 0x12345678; /* endianness marker */ counter[-2]++; /* total packets ++ */ @@ -914,7 +914,7 @@ static int do_apf_run(apf_context* ctx) { case JDNSAMATCH_EXT_OPCODE: /* 44 */ case JDNSQMATCHSAFE_EXT_OPCODE: /* 45 */ case JDNSAMATCHSAFE_EXT_OPCODE: { /* 46 */ - const u32 imm_len = 1 << (len_field - 1); + const u32 imm_len = 1 << (len_field - 1); /* EXT_OPCODE, thus len_field > 0 */ u32 jump_offs = decode_imm(ctx, imm_len); /* 2nd imm, at worst 8 B past prog_len */ int qtype = -1; if (imm & 1) { /* JDNSQMATCH & JDNSQMATCHSAFE are *odd* extended opcodes */ diff --git a/v5/apf_interpreter_source.c b/v5/apf_interpreter_source.c index 24dbbca..eee915a 100644 --- a/v5/apf_interpreter_source.c +++ b/v5/apf_interpreter_source.c @@ -173,7 +173,7 @@ static int do_apf_run(apf_context* ctx) { u32 pktcopy_src_offset = 0; // used for various pktdatacopy opcodes switch (opcode) { - case PASSDROP_OPCODE: { + case PASSDROP_OPCODE: { // APFv6+ if (len_field > 2) return PASS_PACKET; // max 64K counters (ie. imm < 64K) if (imm) { if (4 * imm > ctx->ram_len) return PASS_PACKET; @@ -218,7 +218,7 @@ static int do_apf_run(apf_context* ctx) { break; } case JMP_OPCODE: - if (reg_num && !ctx->v6) { + if (reg_num && !ctx->v6) { // APFv6+ // First invocation of APFv6 jmpdata instruction counter[-1] = 0x12345678; // endianness marker counter[-2]++; // total packets ++ @@ -383,7 +383,7 @@ static int do_apf_run(apf_context* ctx) { case JDNSAMATCH_EXT_OPCODE: // 44 case JDNSQMATCHSAFE_EXT_OPCODE: // 45 case JDNSAMATCHSAFE_EXT_OPCODE: { // 46 - const u32 imm_len = 1 << (len_field - 1); + const u32 imm_len = 1 << (len_field - 1); // EXT_OPCODE, thus len_field > 0 u32 jump_offs = decode_imm(ctx, imm_len); // 2nd imm, at worst 8 B past prog_len int qtype = -1; if (imm & 1) { // JDNSQMATCH & JDNSQMATCHSAFE are *odd* extended opcodes |