Signed-off-by: Michał Mirosław <mirq-li...@rere.qmqm.pl>
---
 arch/sparc/net/bpf_jit_comp.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index a6d9204a6a0b..61cc15dc86f7 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -601,15 +601,17 @@ void bpf_jit_compile(struct bpf_prog *fp)
                                emit_skb_load32(hash, r_A);
                                break;
                        case BPF_ANC | SKF_AD_VLAN_TAG:
-                       case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
                                emit_skb_load16(vlan_tci, r_A);
-                               if (code != (BPF_ANC | SKF_AD_VLAN_TAG)) {
-                                       emit_alu_K(SRL, 12);
-                                       emit_andi(r_A, 1, r_A);
-                               } else {
-                                       emit_loadimm(~VLAN_TAG_PRESENT, r_TMP);
-                                       emit_and(r_A, r_TMP, r_A);
-                               }
+#ifdef VLAN_TAG_PRESENT
+                               emit_loadimm(~VLAN_TAG_PRESENT, r_TMP);
+                               emit_and(r_A, r_TMP, r_A);
+#endif
+                               break;
+                       case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
+                               __emit_skb_load8(__pkt_vlan_present_offset, 
r_A);
+                               if (PKT_VLAN_PRESENT_BIT)
+                                       emit_alu_K(SRL, PKT_VLAN_PRESENT_BIT);
+                               emit_andi(r_A, 1, r_A);
                                break;
                        case BPF_LD | BPF_W | BPF_LEN:
                                emit_skb_load32(len, r_A);
-- 
2.11.0

Reply via email to