--- zzzz-none-000/linux-2.6.39.4/net/bridge/br_input.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-atom-6490-729/linux-2.6.39.4/net/bridge/br_input.c 2021-11-10 13:38:18.000000000 +0000 @@ -10,6 +10,15 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ +/* + Includes Intel Corporation's changes/modifications dated: [Dec.2013]. + Changed/modified portions - Copyright © 2013, Intel Corporation + 1. WARN on NULL pointer in br_handle_frame() + + Includes Intel Corporation's changes/modifications dated: [May.2014]. + Changed/modified portions - Copyright © 2014, Intel Corporation + 2. Skip Link Local spacial proccess for L2VPN packets in br_handle_frame() +*/ #include #include @@ -21,6 +30,15 @@ /* Bridge group multicast address 802.1d (pg 51). */ const u8 br_group_address[ETH_ALEN] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; +#ifdef CONFIG_TI_L2_SELECTIVE_FORWARDER +extern int ti_selective_packet_handler (struct sk_buff *skb); +#endif /* CONFIG_TI_L2_SELECTIVE_FORWARDER */ + +#ifdef CONFIG_INTEL_L2VPN_L2CP_FORWARD +extern int intel_l2vpn_packet_handler (struct sk_buff *skb, int *l2vpnRelate); +#endif /* CONFIG_INTEL_L2VPN_L2CP_FORWARD */ + + /* Hook for brouter */ br_should_route_hook_t __rcu *br_should_route_hook __read_mostly; EXPORT_SYMBOL(br_should_route_hook); @@ -68,6 +86,7 @@ goto drop; BR_INPUT_SKB_CB(skb)->brdev = br->dev; + BR_INPUT_SKB_CB(skb)->src_port_isolated = !!(p->flags & BR_ISOLATED); /* The packet skb2 goes to the local host (NULL to skip). */ skb2 = NULL; @@ -78,6 +97,12 @@ dst = NULL; if (is_multicast_ether_addr(dest)) { +#ifdef CONFIG_TI_L2_SELECTIVE_FORWARDER + /* If return value is zero indicates fall back to default behavior */ + if (ti_selective_packet_handler(skb) != 0) { + goto out; + } +#endif /* CONFIG_TI_L2_SELECTIVE_FORWARDER */ mdst = br_mdb_get(br, skb); if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) { if ((mdst && mdst->mglist) || @@ -100,8 +125,14 @@ if (skb) { if (dst) br_forward(dst->dst, skb, skb2); - else + else { +#ifdef CONFIG_TI_L2_SELECTIVE_FORWARDER + /* If return value is zero indicates fall back to default behavior */ + if (ti_selective_packet_handler(skb) != 0) + goto out; +#endif /* CONFIG_TI_L2_SELECTIVE_FORWARDER */ br_flood_forward(br, skb, skb2); + } } if (skb2) @@ -146,6 +177,11 @@ const unsigned char *dest = eth_hdr(skb)->h_dest; br_should_route_hook_t *rhook; +#ifdef CONFIG_INTEL_L2VPN_L2CP_FORWARD + int l2vpnRelated = 0; +#endif /* CONFIG_INTEL_L2VPN_L2CP_FORWARD */ + + if (unlikely(skb->pkt_type == PACKET_LOOPBACK)) return RX_HANDLER_PASS; @@ -156,9 +192,38 @@ if (!skb) return RX_HANDLER_CONSUMED; + /*this cond was added for skb->ti_selective_forward will receive later on the correct vlan device*/ + #ifdef CONFIG_TI_DOCSIS_INPUT_DEV + if(!skb->ti_docsis_input_dev) + { + skb->ti_docsis_input_dev = skb->dev; + } + #endif + p = br_port_get_rcu(skb->dev); - if (unlikely(is_link_local(dest))) { + if (WARN(p == NULL, "%s - %d: br_port_get_rcu(skb->dev) returned NULL, dropping packet (dev == %s)", + __func__, __LINE__, skb->dev ? skb->dev->name : "NULL")) + { + /* Cannot continue since the following lines require p != NULL */ + /* What should we do with this packet???? */ + goto drop; + } + + if (unlikely(is_link_local(dest))) + { +#ifdef CONFIG_INTEL_L2VPN_L2CP_FORWARD + /* Check if the packet is L2VPN related. If so, skip link local special proccess. */ + /* Upstream L2VPN packets will be handle Link Local packets in Docsis Bridge */ + if (!intel_l2vpn_packet_handler(skb, &l2vpnRelated)) + { + if (l2vpnRelated) + { + goto forward; + } + } +#endif /* CONFIG_INTEL_L2VPN_L2CP_FORWARD */ + /* Pause frames shouldn't be passed up by driver anyway */ if (skb->protocol == htons(ETH_P_PAUSE)) goto drop;