[PATCH net-next 11/13] net: fec: fec_enet_rx_queue(): reduce scope of data

Marc Kleine-Budde posted 13 patches 1 month, 1 week ago
[PATCH net-next 11/13] net: fec: fec_enet_rx_queue(): reduce scope of data
Posted by Marc Kleine-Budde 1 month, 1 week ago
In order to clean up of the VLAN handling, reduce the scope of data.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index fd7a78ec5fa8ac0f7d141779938a4690594dbef1..640fbde10861005e7e2eb23358bfeaac49ec1792 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1686,7 +1686,6 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 	unsigned short status;
 	struct  sk_buff *skb;
 	ushort	pkt_len;
-	__u8 *data;
 	int	pkt_received = 0;
 	struct	bufdesc_ex *ebdp = NULL;
 	bool	vlan_packet_rcvd = false;
@@ -1803,10 +1802,11 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 		skb_mark_for_recycle(skb);
 
 		if (unlikely(need_swap)) {
+			u8 *data;
+
 			data = page_address(page) + FEC_ENET_XDP_HEADROOM;
 			swap_buffer(data, pkt_len);
 		}
-		data = skb->data;
 
 		/* Extract the enhanced buffer descriptor */
 		ebdp = NULL;
@@ -1824,7 +1824,7 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 
 			vlan_packet_rcvd = true;
 
-			memmove(skb->data + VLAN_HLEN, data, ETH_ALEN * 2);
+			memmove(skb->data + VLAN_HLEN, skb->data, ETH_ALEN * 2);
 			skb_pull(skb, VLAN_HLEN);
 		}
 

-- 
2.45.2
Re: [PATCH net-next 11/13] net: fec: fec_enet_rx_queue(): reduce scope of data
Posted by Frank Li 1 month, 1 week ago
On Wed, Oct 16, 2024 at 11:51:59PM +0200, Marc Kleine-Budde wrote:
> In order to clean up of the VLAN handling, reduce the scope of data.
>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index fd7a78ec5fa8ac0f7d141779938a4690594dbef1..640fbde10861005e7e2eb23358bfeaac49ec1792 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1686,7 +1686,6 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
>  	unsigned short status;
>  	struct  sk_buff *skb;
>  	ushort	pkt_len;
> -	__u8 *data;
>  	int	pkt_received = 0;
>  	struct	bufdesc_ex *ebdp = NULL;
>  	bool	vlan_packet_rcvd = false;
> @@ -1803,10 +1802,11 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
>  		skb_mark_for_recycle(skb);
>
>  		if (unlikely(need_swap)) {
> +			u8 *data;
> +
>  			data = page_address(page) + FEC_ENET_XDP_HEADROOM;
>  			swap_buffer(data, pkt_len);
>  		}
> -		data = skb->data;
>
>  		/* Extract the enhanced buffer descriptor */
>  		ebdp = NULL;
> @@ -1824,7 +1824,7 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
>
>  			vlan_packet_rcvd = true;
>
> -			memmove(skb->data + VLAN_HLEN, data, ETH_ALEN * 2);
> +			memmove(skb->data + VLAN_HLEN, skb->data, ETH_ALEN * 2);
>  			skb_pull(skb, VLAN_HLEN);
>  		}
>
>
> --
> 2.45.2
>
>