kernel: bump 5.15 to 5.15.42
[openwrt/staging/jow.git] / target / linux / generic / hack-5.15 / 600-bridge_offload.patch
index c7942a0aefc2cf438fcbb1a8c44bfc4a66b0cff7..5d49d0775339f0651c9c571adfece6ba64f9f8b8 100644 (file)
  
  static int
  br_netif_receive_skb(struct net *net, struct sock *sk, struct sk_buff *skb)
-@@ -164,6 +165,7 @@ int br_handle_frame_finish(struct net *n
+@@ -171,6 +172,7 @@ int br_handle_frame_finish(struct net *n
                        dst->used = now;
                br_forward(dst->dst, skb, local_rcv, false);
        } else {
                if (!mcast_hit)
                        br_flood(br, skb, pkt_type, local_rcv, false);
                else
-@@ -297,6 +299,9 @@ static rx_handler_result_t br_handle_fra
+@@ -304,6 +306,9 @@ static rx_handler_result_t br_handle_fra
        memset(skb->cb, 0, sizeof(struct br_input_skb_cb));
  
        p = br_port_get_rcu(skb->dev);
 +      vg = nbp_vlan_group_rcu(inp);
 +      vlan = cb->input_vlan_present ? cb->input_vlan_tag : br_get_pvid(vg);
 +      fdb_in = br_fdb_find_rcu(p->br, eth_hdr(skb)->h_source, vlan);
-+      if (!fdb_in)
++      if (!fdb_in || !fdb_in->dst)
 +              goto out;
 +
 +      vg = nbp_vlan_group_rcu(p);
 +      vlan = skb_vlan_tag_present(skb) ? skb_vlan_tag_get_id(skb) : br_get_pvid(vg);
 +      fdb_out = br_fdb_find_rcu(p->br, eth_hdr(skb)->h_dest, vlan);
-+      if (!fdb_out)
++      if (!fdb_out || !fdb_out->dst)
 +              goto out;
 +
 +      br_offload_prepare_key(p, &key, skb);
 +#endif
 +
 +      flow = kmem_cache_alloc(offload_cache, GFP_ATOMIC);
-+      flow->port = fdb_in->dst;
++      flow->port = inp;
 +      memcpy(&flow->key, &key, sizeof(key));
 +
 +#ifdef CONFIG_BRIDGE_VLAN_FILTERING
 +      spin_lock_bh(&offload_lock);
 +      if (!o->enabled ||
 +          atomic_read(&p->offload.rht.nelems) >= p->br->offload_cache_size ||
-+          rhashtable_insert_fast(&flow->port->offload.rht, &flow->node, flow_params)) {
++          rhashtable_insert_fast(&inp->offload.rht, &flow->node, flow_params)) {
 +              kmem_cache_free(offload_cache, flow);
 +              goto out_unlock;
 +      }
 +#ifdef CONFIG_BRIDGE_VLAN_FILTERING
 +              cb->input_vlan_present = key.vlan_present != 0;
 +              cb->input_vlan_tag = key.vlan_tag;
-+              cb->input_ifindex = p->dev->ifindex;
 +#endif
++              cb->input_ifindex = p->dev->ifindex;
 +              goto out;
 +      }
 +