pch_gbe: run the ptp bpf just once per packet
authorRichard Cochran <richardcochran@gmail.com>
Fri, 20 Apr 2012 18:50:35 +0000 (18:50 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Apr 2012 19:27:45 +0000 (15:27 -0400)
This patch fixes code which needlessly ran the BPF twice per
packet. Instead, we just run the classifier once and test
whether the packet is any kind of PTP event message.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c

index 53ac2fb..e9b785e 100644 (file)
@@ -134,10 +134,8 @@ static int pch_ptp_match(struct sk_buff *skb, u16 uid_hi, u32 uid_lo, u16 seqid)
        u16 *hi, *id;
        u32 lo;
 
-       if ((sk_run_filter(skb, ptp_filter) != PTP_CLASS_V2_IPV4) &&
-               (sk_run_filter(skb, ptp_filter) != PTP_CLASS_V1_IPV4)) {
+       if (sk_run_filter(skb, ptp_filter) == PTP_CLASS_NONE)
                return 0;
-       }
 
        offset = ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN;