]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: fec: fec_enet_rx_queue(): move_call to _vlan_hwaccel_put_tag()
authorMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 18 Jun 2025 12:00:10 +0000 (14:00 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 19 Jun 2025 22:27:54 +0000 (15:27 -0700)
Move __vlan_hwaccel_put_tag() into the if statement that sets
vlan_packet_rcvd = true. This change eliminates the unnecessary
vlan_packet_rcvd variable, simplifying the code and improving clarity.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://patch.msgid.link/20250618-fec-cleanups-v4-10-c16f9a1af124@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/fec_main.c

index 84dd0847328095a81eb8adddaa5d53bce9f38b2a..6797aa1ed639f31f42d47d8dc9f41cb52b3e5f7b 100644 (file)
@@ -1722,8 +1722,6 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
        ushort  pkt_len;
        int     pkt_received = 0;
        struct  bufdesc_ex *ebdp = NULL;
-       bool    vlan_packet_rcvd = false;
-       u16     vlan_tag;
        int     index = 0;
        bool    need_swap = fep->quirks & FEC_QUIRK_SWAP_FRAME;
        struct bpf_prog *xdp_prog = READ_ONCE(fep->xdp_prog);
@@ -1854,18 +1852,18 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
                        ebdp = (struct bufdesc_ex *)bdp;
 
                /* If this is a VLAN packet remove the VLAN Tag */
-               vlan_packet_rcvd = false;
                if ((ndev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
                    fep->bufdesc_ex &&
                    (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) {
                        /* Push and remove the vlan tag */
                        struct vlan_ethhdr *vlan_header = skb_vlan_eth_hdr(skb);
-                       vlan_tag = ntohs(vlan_header->h_vlan_TCI);
-
-                       vlan_packet_rcvd = true;
+                       u16 vlan_tag = ntohs(vlan_header->h_vlan_TCI);
 
                        memmove(skb->data + VLAN_HLEN, skb->data, ETH_ALEN * 2);
                        skb_pull(skb, VLAN_HLEN);
+                       __vlan_hwaccel_put_tag(skb,
+                                              htons(ETH_P_8021Q),
+                                              vlan_tag);
                }
 
                skb->protocol = eth_type_trans(skb, ndev);
@@ -1885,12 +1883,6 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
                        }
                }
 
-               /* Handle received VLAN packets */
-               if (vlan_packet_rcvd)
-                       __vlan_hwaccel_put_tag(skb,
-                                              htons(ETH_P_8021Q),
-                                              vlan_tag);
-
                skb_record_rx_queue(skb, queue_id);
                napi_gro_receive(&fep->napi, skb);