diff options
author | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-02-08 20:47:58 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-02-08 20:47:58 +0300 |
commit | bbd5ac81d9e606415f2ad2ecb999c2ff8c3716c9 (patch) | |
tree | d6da6a9a491b05721cd562b1c22ea49c6076b107 /platform/linux-generic/include/odp_classification_inlines.h | |
parent | ee90f447a6f5c76ab7751e6b747d1da3ac407fb1 (diff) | |
parent | fd93da30b42937f62afecccd43809815044f5a45 (diff) |
Merge branch 'next'v1.7.0.0
Diffstat (limited to 'platform/linux-generic/include/odp_classification_inlines.h')
-rw-r--r-- | platform/linux-generic/include/odp_classification_inlines.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h index 5f0b564f7..96cf77ee2 100644 --- a/platform/linux-generic/include/odp_classification_inlines.h +++ b/platform/linux-generic/include/odp_classification_inlines.h @@ -154,11 +154,28 @@ static inline int verify_pmr_udp_sport(const uint8_t *pkt_addr, return 0; } -static inline int verify_pmr_dmac(const uint8_t *pkt_addr ODP_UNUSED, - odp_packet_hdr_t *pkt_hdr ODP_UNUSED, - pmr_term_value_t *term_value ODP_UNUSED) +static inline int verify_pmr_dmac(const uint8_t *pkt_addr, + odp_packet_hdr_t *pkt_hdr, + pmr_term_value_t *term_value) { - ODP_UNIMPLEMENTED(); + uint64_t dmac = 0; + uint64_t dmac_be = 0; + const odph_ethhdr_t *eth; + + if (!pkt_hdr->input_flags.eth) + return 0; + + eth = (const odph_ethhdr_t *)(pkt_addr + pkt_hdr->l2_offset); + memcpy(&dmac_be, eth->dst.addr, ODPH_ETHADDR_LEN); + dmac = odp_be_to_cpu_64(dmac_be); + /* since we are converting a 48 bit ethernet address from BE to cpu + format using odp_be_to_cpu_64() the last 16 bits needs to be right + shifted */ + if (dmac_be != dmac) + dmac = dmac >> (64 - (ODPH_ETHADDR_LEN * 8)); + + if (term_value->val == (dmac & term_value->mask)) + return 1; return 0; } |