All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes
@ 2021-11-18 14:27 Jakub Kicinski
  2021-11-18 14:27 ` [PATCH net-next 1/4] net: ax88796c: don't write to netdev->dev_addr directly Jakub Kicinski
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Jakub Kicinski @ 2021-11-18 14:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski

Resending these so they can get merged while I battle random cross builds.

Jakub Kicinski (4):
  net: ax88796c: don't write to netdev->dev_addr directly
  mlxsw: constify address in mlxsw_sp_port_dev_addr_set
  wilc1000: copy address before calling wilc_set_mac_address
  ipw2200: constify address in ipw_send_adapter_address

 drivers/net/ethernet/asix/ax88796c_main.c      | 18 ++++++++++--------
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c |  2 +-
 drivers/net/wireless/intel/ipw2x00/ipw2200.c   |  2 +-
 .../net/wireless/microchip/wilc1000/netdev.c   |  6 +++---
 4 files changed, 15 insertions(+), 13 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next 1/4] net: ax88796c: don't write to netdev->dev_addr directly
  2021-11-18 14:27 [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes Jakub Kicinski
@ 2021-11-18 14:27 ` Jakub Kicinski
  2021-11-18 14:27 ` [PATCH net-next 2/4] mlxsw: constify address in mlxsw_sp_port_dev_addr_set Jakub Kicinski
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2021-11-18 14:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Lukasz Stelmach

The future is here, convert the new driver as we are about
to make netdev->dev_addr const.

Acked-by: Lukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/asix/ax88796c_main.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/asix/ax88796c_main.c b/drivers/net/ethernet/asix/ax88796c_main.c
index e230d8d0ff73..e7a9f9863258 100644
--- a/drivers/net/ethernet/asix/ax88796c_main.c
+++ b/drivers/net/ethernet/asix/ax88796c_main.c
@@ -144,12 +144,13 @@ static void ax88796c_set_mac_addr(struct net_device *ndev)
 static void ax88796c_load_mac_addr(struct net_device *ndev)
 {
 	struct ax88796c_device *ax_local = to_ax88796c_device(ndev);
+	u8 addr[ETH_ALEN];
 	u16 temp;
 
 	lockdep_assert_held(&ax_local->spi_lock);
 
 	/* Try the device tree first */
-	if (!eth_platform_get_mac_address(&ax_local->spi->dev, ndev->dev_addr) &&
+	if (!platform_get_ethdev_address(&ax_local->spi->dev, ndev) &&
 	    is_valid_ether_addr(ndev->dev_addr)) {
 		if (netif_msg_probe(ax_local))
 			dev_info(&ax_local->spi->dev,
@@ -159,18 +160,19 @@ static void ax88796c_load_mac_addr(struct net_device *ndev)
 
 	/* Read the MAC address from AX88796C */
 	temp = AX_READ(&ax_local->ax_spi, P3_MACASR0);
-	ndev->dev_addr[5] = (u8)temp;
-	ndev->dev_addr[4] = (u8)(temp >> 8);
+	addr[5] = (u8)temp;
+	addr[4] = (u8)(temp >> 8);
 
 	temp = AX_READ(&ax_local->ax_spi, P3_MACASR1);
-	ndev->dev_addr[3] = (u8)temp;
-	ndev->dev_addr[2] = (u8)(temp >> 8);
+	addr[3] = (u8)temp;
+	addr[2] = (u8)(temp >> 8);
 
 	temp = AX_READ(&ax_local->ax_spi, P3_MACASR2);
-	ndev->dev_addr[1] = (u8)temp;
-	ndev->dev_addr[0] = (u8)(temp >> 8);
+	addr[1] = (u8)temp;
+	addr[0] = (u8)(temp >> 8);
 
-	if (is_valid_ether_addr(ndev->dev_addr)) {
+	if (is_valid_ether_addr(addr)) {
+		eth_hw_addr_set(ndev, addr);
 		if (netif_msg_probe(ax_local))
 			dev_info(&ax_local->spi->dev,
 				 "MAC address read from ASIX chip\n");
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 2/4] mlxsw: constify address in mlxsw_sp_port_dev_addr_set
  2021-11-18 14:27 [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes Jakub Kicinski
  2021-11-18 14:27 ` [PATCH net-next 1/4] net: ax88796c: don't write to netdev->dev_addr directly Jakub Kicinski
@ 2021-11-18 14:27 ` Jakub Kicinski
  2021-11-18 14:27 ` [PATCH net-next 3/4] wilc1000: copy address before calling wilc_set_mac_address Jakub Kicinski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2021-11-18 14:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Ido Schimmel

Argument comes from netdev->dev_addr directly, it needs a const.

Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 5925db386b1b..4ce07f9905f6 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -303,7 +303,7 @@ int mlxsw_sp_port_admin_status_set(struct mlxsw_sp_port *mlxsw_sp_port,
 }
 
 static int mlxsw_sp_port_dev_addr_set(struct mlxsw_sp_port *mlxsw_sp_port,
-				      unsigned char *addr)
+				      const unsigned char *addr)
 {
 	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
 	char ppad_pl[MLXSW_REG_PPAD_LEN];
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 3/4] wilc1000: copy address before calling wilc_set_mac_address
  2021-11-18 14:27 [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes Jakub Kicinski
  2021-11-18 14:27 ` [PATCH net-next 1/4] net: ax88796c: don't write to netdev->dev_addr directly Jakub Kicinski
  2021-11-18 14:27 ` [PATCH net-next 2/4] mlxsw: constify address in mlxsw_sp_port_dev_addr_set Jakub Kicinski
@ 2021-11-18 14:27 ` Jakub Kicinski
  2021-11-18 14:27 ` [PATCH net-next 4/4] ipw2200: constify address in ipw_send_adapter_address Jakub Kicinski
  2021-11-19 11:10 ` [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes patchwork-bot+netdevbpf
  4 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2021-11-18 14:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Kalle Valo, ajay.kathat, claudiu.beznea

wilc_set_mac_address() calls IO routines which don't guarantee
the pointer won't be written to. Make a copy.

Acked-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: ajay.kathat@microchip.com
CC: claudiu.beznea@microchip.com
---
 drivers/net/wireless/microchip/wilc1000/netdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
index 690572e01a2a..4712cd7dff9f 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.c
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@ -574,6 +574,7 @@ static int wilc_mac_open(struct net_device *ndev)
 	struct wilc *wl = vif->wilc;
 	int ret = 0;
 	struct mgmt_frame_regs mgmt_regs = {};
+	u8 addr[ETH_ALEN] __aligned(2);
 
 	if (!wl || !wl->dev) {
 		netdev_err(ndev, "device not ready\n");
@@ -596,10 +597,9 @@ static int wilc_mac_open(struct net_device *ndev)
 				vif->idx);
 
 	if (is_valid_ether_addr(ndev->dev_addr)) {
-		wilc_set_mac_address(vif, ndev->dev_addr);
+		ether_addr_copy(addr, ndev->dev_addr);
+		wilc_set_mac_address(vif, addr);
 	} else {
-		u8 addr[ETH_ALEN];
-
 		wilc_get_mac_address(vif, addr);
 		eth_hw_addr_set(ndev, addr);
 	}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 4/4] ipw2200: constify address in ipw_send_adapter_address
  2021-11-18 14:27 [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes Jakub Kicinski
                   ` (2 preceding siblings ...)
  2021-11-18 14:27 ` [PATCH net-next 3/4] wilc1000: copy address before calling wilc_set_mac_address Jakub Kicinski
@ 2021-11-18 14:27 ` Jakub Kicinski
  2021-11-18 17:27   ` Stanislav Yakovlev
  2021-11-19 11:10 ` [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes patchwork-bot+netdevbpf
  4 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2021-11-18 14:27 UTC (permalink / raw)
  To: davem; +Cc: netdev, Jakub Kicinski, Kalle Valo, stas.yakovlev

Add const to the address param of ipw_send_adapter_address()
all the functions down the chain have already been changed.

Not sure how I lost this in the rebase.

Acked-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: stas.yakovlev@gmail.com
---
 drivers/net/wireless/intel/ipw2x00/ipw2200.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
index 23037bfc9e4c..5727c7c00a28 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
@@ -2303,7 +2303,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len)
 				ssid);
 }
 
-static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac)
+static int ipw_send_adapter_address(struct ipw_priv *priv, const u8 * mac)
 {
 	if (!priv || !mac) {
 		IPW_ERROR("Invalid args\n");
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 4/4] ipw2200: constify address in ipw_send_adapter_address
  2021-11-18 14:27 ` [PATCH net-next 4/4] ipw2200: constify address in ipw_send_adapter_address Jakub Kicinski
@ 2021-11-18 17:27   ` Stanislav Yakovlev
  0 siblings, 0 replies; 7+ messages in thread
From: Stanislav Yakovlev @ 2021-11-18 17:27 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: David S. Miller, netdev, Kalle Valo

On Thu, 18 Nov 2021 at 18:27, Jakub Kicinski <kuba@kernel.org> wrote:
>
> Add const to the address param of ipw_send_adapter_address()
> all the functions down the chain have already been changed.
>
> Not sure how I lost this in the rebase.
>
> Acked-by: Kalle Valo <kvalo@codeaurora.org>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: stas.yakovlev@gmail.com
> ---
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Acked-by: Stanislav Yakovlev <stas.yakovlev@gmail.com>

> diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> index 23037bfc9e4c..5727c7c00a28 100644
> --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
> @@ -2303,7 +2303,7 @@ static int ipw_send_ssid(struct ipw_priv *priv, u8 * ssid, int len)
>                                 ssid);
>  }
>
> -static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac)
> +static int ipw_send_adapter_address(struct ipw_priv *priv, const u8 * mac)
>  {
>         if (!priv || !mac) {
>                 IPW_ERROR("Invalid args\n");
> --
> 2.31.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes
  2021-11-18 14:27 [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes Jakub Kicinski
                   ` (3 preceding siblings ...)
  2021-11-18 14:27 ` [PATCH net-next 4/4] ipw2200: constify address in ipw_send_adapter_address Jakub Kicinski
@ 2021-11-19 11:10 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-19 11:10 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 18 Nov 2021 06:27:16 -0800 you wrote:
> Resending these so they can get merged while I battle random cross builds.
> 
> Jakub Kicinski (4):
>   net: ax88796c: don't write to netdev->dev_addr directly
>   mlxsw: constify address in mlxsw_sp_port_dev_addr_set
>   wilc1000: copy address before calling wilc_set_mac_address
>   ipw2200: constify address in ipw_send_adapter_address
> 
> [...]

Here is the summary with links:
  - [net-next,1/4] net: ax88796c: don't write to netdev->dev_addr directly
    https://git.kernel.org/netdev/net-next/c/e291422c8f00
  - [net-next,2/4] mlxsw: constify address in mlxsw_sp_port_dev_addr_set
    https://git.kernel.org/netdev/net-next/c/54612b4a8bc7
  - [net-next,3/4] wilc1000: copy address before calling wilc_set_mac_address
    https://git.kernel.org/netdev/net-next/c/b09d58025e3c
  - [net-next,4/4] ipw2200: constify address in ipw_send_adapter_address
    https://git.kernel.org/netdev/net-next/c/a608e6794b08

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-19 11:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 14:27 [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes Jakub Kicinski
2021-11-18 14:27 ` [PATCH net-next 1/4] net: ax88796c: don't write to netdev->dev_addr directly Jakub Kicinski
2021-11-18 14:27 ` [PATCH net-next 2/4] mlxsw: constify address in mlxsw_sp_port_dev_addr_set Jakub Kicinski
2021-11-18 14:27 ` [PATCH net-next 3/4] wilc1000: copy address before calling wilc_set_mac_address Jakub Kicinski
2021-11-18 14:27 ` [PATCH net-next 4/4] ipw2200: constify address in ipw_send_adapter_address Jakub Kicinski
2021-11-18 17:27   ` Stanislav Yakovlev
2021-11-19 11:10 ` [PATCH net-next 0/4] net: constify netdev->dev_addr - x86 changes patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.