lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZOSH1GxHkWbDGSLj@shell.armlinux.org.uk>
Date: Tue, 22 Aug 2023 11:03:00 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Feiyang Chen <chenfeiyang@...ngson.cn>
Cc: andrew@...n.ch, hkallweit1@...il.com, peppe.cavallaro@...com,
	alexandre.torgue@...s.st.com, joabreu@...opsys.com,
	chenhuacai@...ngson.cn, dongbiao@...ngson.cn,
	guyinggang@...ngson.cn, siyanteng@...ngson.cn,
	loongson-kernel@...ts.loongnix.cn, netdev@...r.kernel.org,
	loongarch@...ts.linux.dev, chris.chenfeiyang@...il.com
Subject: Re: [PATCH v4 01/11] net: stmmac: Pass stmmac_priv and chan in some
 callbacks

On Tue, Aug 22, 2023 at 05:40:26PM +0800, Feiyang Chen wrote:
> @@ -636,7 +637,8 @@ static void sun8i_dwmac_set_mac(void __iomem *ioaddr, bool enable)
>   * All slot > 0 need to be enabled with MAC_ADDR_TYPE_DST
>   * If addr is NULL, clear the slot
>   */
> -static void sun8i_dwmac_set_umac_addr(struct mac_device_info *hw,
> +static void sun8i_dwmac_set_umac_addr(struct stmmac_priv *priv,
> +				      struct mac_device_info *hw,
>  				      const unsigned char *addr,
>  				      unsigned int reg_n)
>  {

Given that hw is always priv->hw, would it be sensible to simplify the
callback by dropping the "hw" argument, and have the called methods do:

	struct mac_device_info *hw = priv->hw;

> @@ -657,7 +659,8 @@ static void sun8i_dwmac_set_umac_addr(struct mac_device_info *hw,
>  	}
>  }
>  
> -static void sun8i_dwmac_get_umac_addr(struct mac_device_info *hw,
> +static void sun8i_dwmac_get_umac_addr(struct stmmac_priv *priv,
> +				      struct mac_device_info *hw,
>  				      unsigned char *addr,
>  				      unsigned int reg_n)
>  {

Same here.

> @@ -680,7 +683,8 @@ static int sun8i_dwmac_rx_ipc_enable(struct mac_device_info *hw)
>  	return 1;
>  }
>  
> -static void sun8i_dwmac_set_filter(struct mac_device_info *hw,
> +static void sun8i_dwmac_set_filter(struct stmmac_priv *priv,
> +				   struct mac_device_info *hw,
>  				   struct net_device *dev)
>  {

Probably also worth doing for this method as well. I think the only
thing which this function uses is hw->unicast_filter_entries, so
one could declare:

	unsigned int unicast_filter_entries = priv->hw->unicast_filter_entries;

rather than carrying the pointer to both "priv" and "hw" through this
function.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ