- return (esh->dsap == LLC_SAP_SNAP
- && esh->ssap == LLC_SAP_SNAP
- && !memcmp(esh->oui, "\0\0\0", 3));
+ struct llc_snap_hdr {
+ u8 dsap; /* Always 0xAA */
+ u8 ssap; /* Always 0xAA */
+ u8 ctrl;
+ u8 oui[3];
+ u16 ethertype;
+ };
+ struct llc_snap_hdr *llc;
+ __be16 proto;
+
+ proto = *(__be16 *) skb->data;
+ __skb_pull(skb, sizeof(__be16));
+
+ if (ntohs(proto) >= ODP_DL_TYPE_ETH2_CUTOFF)
+ return proto;
+
+ if (unlikely(skb->len < sizeof(struct llc_snap_hdr)))
+ return htons(ODP_DL_TYPE_NOT_ETH_TYPE);
+
+ llc = (struct llc_snap_hdr *) skb->data;
+ if (llc->dsap != LLC_SAP_SNAP ||
+ llc->ssap != LLC_SAP_SNAP ||
+ (llc->oui[0] | llc->oui[1] | llc->oui[2]) != 0)
+ return htons(ODP_DL_TYPE_NOT_ETH_TYPE);
+
+ __skb_pull(skb, sizeof(struct llc_snap_hdr));
+ return llc->ethertype;