From 8e67f56edb5d5f4c46c38ae4057ed34ff8d3c298 Mon Sep 17 00:00:00 2001 From: Harout Hedeshian Date: Mon, 16 Jun 2014 09:26:42 -0600 Subject: [PATCH] net: core: add MAP support to RPS flow dissector More efficiently utilize multiple cores when using MAP encoded frames. RPS flow dissector now appropriately decodes IPv4 and IPv6 frames with MAP headers prepended. CRs-Fixed: 681280 Change-Id: Ia4dde47fcc0f3436dcaa71a5160c0a59fe7ed53a Signed-off-by: Harout Hedeshian --- include/uapi/linux/net_map.h | 3 +++ net/core/flow_dissector.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/uapi/linux/net_map.h b/include/uapi/linux/net_map.h index 879a854cb1da..544cf03b9a5e 100644 --- a/include/uapi/linux/net_map.h +++ b/include/uapi/linux/net_map.h @@ -23,5 +23,8 @@ struct rmnet_map_header_s { #define RMNET_MAP_GET_LENGTH(Y) (ntohs( \ ((struct rmnet_map_header_s *)Y->data)->pkt_len)) +#define RMNET_IP_VER_MASK 0xF0 +#define RMNET_IPV4 0x40 +#define RMNET_IPV6 0x60 #endif /* _NET_MAP_H_ */ diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index f97101b4d373..28b7623eaa8d 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -13,6 +13,7 @@ #include #include #include +#include /* copy saddr & daddr, possibly using 64bit load/store * Equivalent to : flow->src = iph->saddr; @@ -96,6 +97,40 @@ ipv6: return false; } } + case __constant_htons(ETH_P_MAP): { + struct { + struct rmnet_map_header_s map; + uint8_t proto; + } *map, _map; + unsigned int maplen; + + map = skb_header_pointer(skb, nhoff, sizeof(_map), &_map); + if (!map) + return false; + + /* Is MAP command? */ + if (map->map.cd_bit) + return false; + + /* Is aggregated frame? */ + maplen = ntohs(map->map.pkt_len); + maplen += map->map.pad_len; + maplen += sizeof(struct rmnet_map_header_s); + if (maplen < skb->len) + return false; + + nhoff += sizeof(struct rmnet_map_header_s); + switch (map->proto & RMNET_IP_VER_MASK) { + case RMNET_IPV4: + proto = htons(ETH_P_IP); + goto ip; + case RMNET_IPV6: + proto = htons(ETH_P_IPV6); + goto ipv6; + default: + return false; + } + } default: return false; }