Skip to content

Commit 709f6c5

Browse files
Alexei Starovoitovdavem330
authored andcommitted
sparc: bpf_jit: add SKF_AD_PKTTYPE support to JIT
commit 233577a ("net: filter: constify detection of pkt_type_offset") allows us to implement simple PKTTYPE support in sparc JIT Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent bf3c228 commit 709f6c5

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

arch/sparc/net/bpf_jit_comp.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -579,16 +579,11 @@ void bpf_jit_compile(struct bpf_prog *fp)
579579
case BPF_ANC | SKF_AD_PROTOCOL:
580580
emit_skb_load16(protocol, r_A);
581581
break;
582-
#if 0
583-
/* GCC won't let us take the address of
584-
* a bit field even though we very much
585-
* know what we are doing here.
586-
*/
587582
case BPF_ANC | SKF_AD_PKTTYPE:
588-
__emit_skb_load8(pkt_type, r_A);
583+
__emit_skb_load8(__pkt_type_offset, r_A);
584+
emit_andi(r_A, PKT_TYPE_MAX, r_A);
589585
emit_alu_K(SRL, 5);
590586
break;
591-
#endif
592587
case BPF_ANC | SKF_AD_IFINDEX:
593588
emit_skb_loadptr(dev, r_A);
594589
emit_cmpi(r_A, 0);

0 commit comments

Comments
 (0)