Skip to content

Commit

Permalink
net/ncsi: Fix gma flag setting after response
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Samuel Mendoza-Jonas <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
vijaykhemka authored and davem330 committed Dec 31, 2019
1 parent f398efc commit 9e86094
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions net/ncsi/ncsi-manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 6 additions & 0 deletions net/ncsi/ncsi-rsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 9e86094

Please sign in to comment.