#define PPC_INST_ERATSX_DOT            0x7c000127
 
 /* Misc instructions for BPF compiler */
+#define PPC_INST_LBZ                   0x88000000
 #define PPC_INST_LD                    0xe8000000
 #define PPC_INST_LHZ                   0xa0000000
 #define PPC_INST_LHBRX                 0x7c00062c
 
 #define PPC_STD(r, base, i)    EMIT(PPC_INST_STD | ___PPC_RS(r) |            \
                                     ___PPC_RA(base) | ((i) & 0xfffc))
 
+
+#define PPC_LBZ(r, base, i)    EMIT(PPC_INST_LBZ | ___PPC_RT(r) |            \
+                                    ___PPC_RA(base) | IMM_L(i))
 #define PPC_LD(r, base, i)     EMIT(PPC_INST_LD | ___PPC_RT(r) |             \
                                     ___PPC_RA(base) | IMM_L(i))
 #define PPC_LWZ(r, base, i)    EMIT(PPC_INST_LWZ | ___PPC_RT(r) |            \
 #define PPC_LHBRX(r, base, b)  EMIT(PPC_INST_LHBRX | ___PPC_RT(r) |          \
                                     ___PPC_RA(base) | ___PPC_RB(b))
 /* Convenience helpers for the above with 'far' offsets: */
+#define PPC_LBZ_OFFS(r, base, i) do { if ((i) < 32768) PPC_LBZ(r, base, i);   \
+               else {  PPC_ADDIS(r, base, IMM_HA(i));                        \
+                       PPC_LBZ(r, r, IMM_L(i)); } } while(0)
+
 #define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i);     \
                else {  PPC_ADDIS(r, base, IMM_HA(i));                        \
                        PPC_LD(r, r, IMM_L(i)); } } while(0)
 
                        PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
                                                          queue_mapping));
                        break;
+               case BPF_ANC | SKF_AD_PKTTYPE:
+                       PPC_LBZ_OFFS(r_A, r_skb, PKT_TYPE_OFFSET());
+                       PPC_ANDI(r_A, r_A, PKT_TYPE_MAX);
+                       PPC_SRWI(r_A, r_A, 5);
+                       break;
                case BPF_ANC | SKF_AD_CPU:
 #ifdef CONFIG_SMP
                        /*