Merge tag 'spdx-5.2-rc3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[linux-2.6-block.git] / net / core / dev.c
index 9c8b3e193e85cfd90c260ff8019b9f6e6c53d138..140858d4a0489994f9b323a1a6da5acf020bfe24 100644 (file)
@@ -4498,23 +4498,6 @@ static int netif_rx_internal(struct sk_buff *skb)
 
        trace_netif_rx(skb);
 
-       if (static_branch_unlikely(&generic_xdp_needed_key)) {
-               int ret;
-
-               preempt_disable();
-               rcu_read_lock();
-               ret = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb);
-               rcu_read_unlock();
-               preempt_enable();
-
-               /* Consider XDP consuming the packet a success from
-                * the netdev point of view we do not want to count
-                * this as an error.
-                */
-               if (ret != XDP_PASS)
-                       return NET_RX_SUCCESS;
-       }
-
 #ifdef CONFIG_RPS
        if (static_branch_unlikely(&rps_needed)) {
                struct rps_dev_flow voidflow, *rflow = &voidflow;
@@ -4854,6 +4837,18 @@ another_round:
 
        __this_cpu_inc(softnet_data.processed);
 
+       if (static_branch_unlikely(&generic_xdp_needed_key)) {
+               int ret2;
+
+               preempt_disable();
+               ret2 = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb);
+               preempt_enable();
+
+               if (ret2 != XDP_PASS)
+                       return NET_RX_DROP;
+               skb_reset_mac_len(skb);
+       }
+
        if (skb->protocol == cpu_to_be16(ETH_P_8021Q) ||
            skb->protocol == cpu_to_be16(ETH_P_8021AD)) {
                skb = skb_vlan_untag(skb);
@@ -5174,19 +5169,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb)
        if (skb_defer_rx_timestamp(skb))
                return NET_RX_SUCCESS;
 
-       if (static_branch_unlikely(&generic_xdp_needed_key)) {
-               int ret;
-
-               preempt_disable();
-               rcu_read_lock();
-               ret = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb);
-               rcu_read_unlock();
-               preempt_enable();
-
-               if (ret != XDP_PASS)
-                       return NET_RX_DROP;
-       }
-
        rcu_read_lock();
 #ifdef CONFIG_RPS
        if (static_branch_unlikely(&rps_needed)) {
@@ -5207,7 +5189,6 @@ static int netif_receive_skb_internal(struct sk_buff *skb)
 
 static void netif_receive_skb_list_internal(struct list_head *head)
 {
-       struct bpf_prog *xdp_prog = NULL;
        struct sk_buff *skb, *next;
        struct list_head sublist;
 
@@ -5220,21 +5201,6 @@ static void netif_receive_skb_list_internal(struct list_head *head)
        }
        list_splice_init(&sublist, head);
 
-       if (static_branch_unlikely(&generic_xdp_needed_key)) {
-               preempt_disable();
-               rcu_read_lock();
-               list_for_each_entry_safe(skb, next, head, list) {
-                       xdp_prog = rcu_dereference(skb->dev->xdp_prog);
-                       skb_list_del_init(skb);
-                       if (do_xdp_generic(xdp_prog, skb) == XDP_PASS)
-                               list_add_tail(&skb->list, &sublist);
-               }
-               rcu_read_unlock();
-               preempt_enable();
-               /* Put passed packets back on main list */
-               list_splice_init(&sublist, head);
-       }
-
        rcu_read_lock();
 #ifdef CONFIG_RPS
        if (static_branch_unlikely(&rps_needed)) {
@@ -5805,7 +5771,6 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
        skb_reset_mac_header(skb);
        skb_gro_reset_offset(skb);
 
-       eth = skb_gro_header_fast(skb, 0);
        if (unlikely(skb_gro_header_hard(skb, hlen))) {
                eth = skb_gro_header_slow(skb, hlen, 0);
                if (unlikely(!eth)) {
@@ -5815,6 +5780,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
                        return NULL;
                }
        } else {
+               eth = (const struct ethhdr *)skb->data;
                gro_pull_from_frag0(skb, hlen);
                NAPI_GRO_CB(skb)->frag0 += hlen;
                NAPI_GRO_CB(skb)->frag0_len -= hlen;