All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next PATCH] net/ncsi: Fix gma flag setting after response
@ 2019-12-27 22:43 Vijay Khemka
  2019-12-28 17:58 ` Samuel Mendoza-Jonas
  2019-12-31  4:34 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Vijay Khemka @ 2019-12-27 22:43 UTC (permalink / raw)
  To: Samuel Mendoza-Jonas, David S. Miller, netdev, linux-kernel
  Cc: vijaykhemka, joel, linux-aspeed, sdasari

gma_flag was set at the time of GMA command request but it should
only be set after getting successful response. Movinng this flag
setting in GMA response handler.

This flag is used mainly for not repeating GMA command once
received MAC address.

Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
---
 net/ncsi/ncsi-manage.c | 3 ---
 net/ncsi/ncsi-rsp.c    | 6 ++++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 70fe02697544..e20b81514029 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -764,9 +764,6 @@ static int ncsi_gma_handler(struct ncsi_cmd_arg *nca, unsigned int mf_id)
 		return -1;
 	}
 
-	/* Set the flag for GMA command which should only be called once */
-	nca->ndp->gma_flag = 1;
-
 	/* Get Mac address from NCSI device */
 	return nch->handler(nca);
 }
diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c
index d5611f04926d..a94bb59793f0 100644
--- a/net/ncsi/ncsi-rsp.c
+++ b/net/ncsi/ncsi-rsp.c
@@ -627,6 +627,9 @@ static int ncsi_rsp_handler_oem_mlx_gma(struct ncsi_request *nr)
 	saddr.sa_family = ndev->type;
 	ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
 	memcpy(saddr.sa_data, &rsp->data[MLX_MAC_ADDR_OFFSET], ETH_ALEN);
+	/* Set the flag for GMA command which should only be called once */
+	ndp->gma_flag = 1;
+
 	ret = ops->ndo_set_mac_address(ndev, &saddr);
 	if (ret < 0)
 		netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");
@@ -671,6 +674,9 @@ static int ncsi_rsp_handler_oem_bcm_gma(struct ncsi_request *nr)
 	if (!is_valid_ether_addr((const u8 *)saddr.sa_data))
 		return -ENXIO;
 
+	/* Set the flag for GMA command which should only be called once */
+	ndp->gma_flag = 1;
+
 	ret = ops->ndo_set_mac_address(ndev, &saddr);
 	if (ret < 0)
 		netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");
-- 
2.17.1


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

* Re: [net-next PATCH] net/ncsi: Fix gma flag setting after response
  2019-12-27 22:43 [net-next PATCH] net/ncsi: Fix gma flag setting after response Vijay Khemka
@ 2019-12-28 17:58 ` Samuel Mendoza-Jonas
  2019-12-30 19:22   ` Vijay Khemka
  2019-12-31  4:34 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Samuel Mendoza-Jonas @ 2019-12-28 17:58 UTC (permalink / raw)
  To: Vijay Khemka, David S. Miller, netdev, linux-kernel
  Cc: joel, linux-aspeed, sdasari

On Fri, 2019-12-27 at 14:43 -0800, Vijay Khemka wrote:
> gma_flag was set at the time of GMA command request but it should
> only be set after getting successful response. Movinng this flag
> setting in GMA response handler.
> 
> This flag is used mainly for not repeating GMA command once
> received MAC address.
> 
> Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>

Technically this means the driver will always send this command every
time it configures if the associated NIC doesn't respond to this
command, but that won't change the behaviour otherwise.

Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>

> ---
>  net/ncsi/ncsi-manage.c | 3 ---
>  net/ncsi/ncsi-rsp.c    | 6 ++++++
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
> index 70fe02697544..e20b81514029 100644
> --- a/net/ncsi/ncsi-manage.c
> +++ b/net/ncsi/ncsi-manage.c
> @@ -764,9 +764,6 @@ static int ncsi_gma_handler(struct ncsi_cmd_arg
> *nca, unsigned int mf_id)
>  		return -1;
>  	}
>  
> -	/* Set the flag for GMA command which should only be called
> once */
> -	nca->ndp->gma_flag = 1;
> -
>  	/* Get Mac address from NCSI device */
>  	return nch->handler(nca);
>  }
> diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c
> index d5611f04926d..a94bb59793f0 100644
> --- a/net/ncsi/ncsi-rsp.c
> +++ b/net/ncsi/ncsi-rsp.c
> @@ -627,6 +627,9 @@ static int ncsi_rsp_handler_oem_mlx_gma(struct
> ncsi_request *nr)
>  	saddr.sa_family = ndev->type;
>  	ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
>  	memcpy(saddr.sa_data, &rsp->data[MLX_MAC_ADDR_OFFSET],
> ETH_ALEN);
> +	/* Set the flag for GMA command which should only be called
> once */
> +	ndp->gma_flag = 1;
> +
>  	ret = ops->ndo_set_mac_address(ndev, &saddr);
>  	if (ret < 0)
>  		netdev_warn(ndev, "NCSI: 'Writing mac address to device
> failed\n");
> @@ -671,6 +674,9 @@ static int ncsi_rsp_handler_oem_bcm_gma(struct
> ncsi_request *nr)
>  	if (!is_valid_ether_addr((const u8 *)saddr.sa_data))
>  		return -ENXIO;
>  
> +	/* Set the flag for GMA command which should only be called
> once */
> +	ndp->gma_flag = 1;
> +
>  	ret = ops->ndo_set_mac_address(ndev, &saddr);
>  	if (ret < 0)
>  		netdev_warn(ndev, "NCSI: 'Writing mac address to device
> failed\n");


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

* Re: [net-next PATCH] net/ncsi: Fix gma flag setting after response
  2019-12-28 17:58 ` Samuel Mendoza-Jonas
@ 2019-12-30 19:22   ` Vijay Khemka
  0 siblings, 0 replies; 5+ messages in thread
From: Vijay Khemka @ 2019-12-30 19:22 UTC (permalink / raw)
  To: Samuel Mendoza-Jonas, David S. Miller, netdev, linux-kernel
  Cc: joel, linux-aspeed, Sai Dasari



On 12/28/19, 9:58 AM, "Samuel Mendoza-Jonas" <sam@mendozajonas.com> wrote:

    On Fri, 2019-12-27 at 14:43 -0800, Vijay Khemka wrote:
    > gma_flag was set at the time of GMA command request but it should
    > only be set after getting successful response. Movinng this flag
    > setting in GMA response handler.
    > 
    > This flag is used mainly for not repeating GMA command once
    > received MAC address.
    > 
    > Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
    
    Technically this means the driver will always send this command every
    time it configures if the associated NIC doesn't respond to this
    command, but that won't change the behaviour otherwise.

Yes Sam, you are right. 
    
    Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
    
    > ---
    >  net/ncsi/ncsi-manage.c | 3 ---
    >  net/ncsi/ncsi-rsp.c    | 6 ++++++
    >  2 files changed, 6 insertions(+), 3 deletions(-)
    > 
    > diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
    > index 70fe02697544..e20b81514029 100644
    > --- a/net/ncsi/ncsi-manage.c
    > +++ b/net/ncsi/ncsi-manage.c
    > @@ -764,9 +764,6 @@ static int ncsi_gma_handler(struct ncsi_cmd_arg
    > *nca, unsigned int mf_id)
    >  		return -1;
    >  	}
    >  
    > -	/* Set the flag for GMA command which should only be called
    > once */
    > -	nca->ndp->gma_flag = 1;
    > -
    >  	/* Get Mac address from NCSI device */
    >  	return nch->handler(nca);
    >  }
    > diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c
    > index d5611f04926d..a94bb59793f0 100644
    > --- a/net/ncsi/ncsi-rsp.c
    > +++ b/net/ncsi/ncsi-rsp.c
    > @@ -627,6 +627,9 @@ static int ncsi_rsp_handler_oem_mlx_gma(struct
    > ncsi_request *nr)
    >  	saddr.sa_family = ndev->type;
    >  	ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
    >  	memcpy(saddr.sa_data, &rsp->data[MLX_MAC_ADDR_OFFSET],
    > ETH_ALEN);
    > +	/* Set the flag for GMA command which should only be called
    > once */
    > +	ndp->gma_flag = 1;
    > +
    >  	ret = ops->ndo_set_mac_address(ndev, &saddr);
    >  	if (ret < 0)
    >  		netdev_warn(ndev, "NCSI: 'Writing mac address to device
    > failed\n");
    > @@ -671,6 +674,9 @@ static int ncsi_rsp_handler_oem_bcm_gma(struct
    > ncsi_request *nr)
    >  	if (!is_valid_ether_addr((const u8 *)saddr.sa_data))
    >  		return -ENXIO;
    >  
    > +	/* Set the flag for GMA command which should only be called
    > once */
    > +	ndp->gma_flag = 1;
    > +
    >  	ret = ops->ndo_set_mac_address(ndev, &saddr);
    >  	if (ret < 0)
    >  		netdev_warn(ndev, "NCSI: 'Writing mac address to device
    > failed\n");
    
    


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

* Re: [net-next PATCH] net/ncsi: Fix gma flag setting after response
  2019-12-27 22:43 [net-next PATCH] net/ncsi: Fix gma flag setting after response Vijay Khemka
  2019-12-28 17:58 ` Samuel Mendoza-Jonas
@ 2019-12-31  4:34 ` David Miller
  2020-01-02 18:56   ` Vijay Khemka
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2019-12-31  4:34 UTC (permalink / raw)
  To: vijaykhemka; +Cc: sam, netdev, linux-kernel, joel, linux-aspeed, sdasari

From: Vijay Khemka <vijaykhemka@fb.com>
Date: Fri, 27 Dec 2019 14:43:49 -0800

> gma_flag was set at the time of GMA command request but it should
> only be set after getting successful response. Movinng this flag
> setting in GMA response handler.
> 
> This flag is used mainly for not repeating GMA command once
> received MAC address.
> 
> Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>

Applied.

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

* Re: [net-next PATCH] net/ncsi: Fix gma flag setting after response
  2019-12-31  4:34 ` David Miller
@ 2020-01-02 18:56   ` Vijay Khemka
  0 siblings, 0 replies; 5+ messages in thread
From: Vijay Khemka @ 2020-01-02 18:56 UTC (permalink / raw)
  To: David Miller; +Cc: sam, netdev, linux-kernel, joel, linux-aspeed, Sai Dasari



On 12/30/19, 8:34 PM, "David Miller" <davem@davemloft.net> wrote:

    From: Vijay Khemka <vijaykhemka@fb.com>
    Date: Fri, 27 Dec 2019 14:43:49 -0800
    
    > gma_flag was set at the time of GMA command request but it should
    > only be set after getting successful response. Movinng this flag
    > setting in GMA response handler.
    > 
    > This flag is used mainly for not repeating GMA command once
    > received MAC address.
    > 
    > Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
    
    Applied.
Thanks David
    


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

end of thread, other threads:[~2020-01-02 18:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-27 22:43 [net-next PATCH] net/ncsi: Fix gma flag setting after response Vijay Khemka
2019-12-28 17:58 ` Samuel Mendoza-Jonas
2019-12-30 19:22   ` Vijay Khemka
2019-12-31  4:34 ` David Miller
2020-01-02 18:56   ` Vijay Khemka

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.