mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 02:01:36 +03:00
nvethernet: Add save/restore command
Add a new private IOCTL command to configure MAC register save and restore operations from user space. Bug 200596517 Change-Id: Ic0e7069e064e277b842b5fd3ceb7ea17327687d5 Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2315790 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Revanth Kumar Uppala
parent
b18ab27659
commit
c547794a00
@@ -577,6 +577,45 @@ static int ether_config_l2_da_filter(struct net_device *dev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function is invoked by ioctl when user issues an ioctl command
|
||||
* to save/restore MAC registers.
|
||||
*
|
||||
* Algorithm: Call osi_save_registers and osi_restore_registers
|
||||
* based on user flags.
|
||||
*
|
||||
* @param[in] ndev: network device structure
|
||||
* @param[in] flags: flags to indicate whether to save and restore MAC registers
|
||||
*
|
||||
* @note Ethernet interface need to be up.
|
||||
*
|
||||
* @retval 0 on Success
|
||||
* @retval "negative value" on Failure
|
||||
*/
|
||||
static int ether_reg_save_restore(struct net_device *ndev,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct ether_priv_data *pdata = netdev_priv(ndev);
|
||||
struct osi_core_priv_data *osi_core = pdata->osi_core;
|
||||
|
||||
if (flags == OSI_ENABLE) {
|
||||
if (osi_restore_registers(osi_core)) {
|
||||
dev_err(pdata->dev, "Restore MAC registers fail\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
} else if (flags == OSI_DISABLE) {
|
||||
if (osi_save_registers(osi_core)) {
|
||||
dev_err(pdata->dev, "Save MAC registers fail\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
} else {
|
||||
dev_err(pdata->dev, "Invalid flag values:%d\n", flags);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function is invoked by ioctl when user issues an ioctl command
|
||||
* to enable/disable MAC loopback mode.
|
||||
@@ -591,7 +630,7 @@ static int ether_config_l2_da_filter(struct net_device *dev,
|
||||
*
|
||||
* @note MAC and PHY need to be initialized.
|
||||
*
|
||||
* @retval 0 on Sucess
|
||||
* @retval 0 on Success
|
||||
* @retval "negative value" on Failure
|
||||
*/
|
||||
static int ether_config_loopback_mode(struct net_device *ndev,
|
||||
@@ -750,6 +789,9 @@ int ether_handle_priv_ioctl(struct net_device *ndev,
|
||||
case ETHER_CONFIG_LOOPBACK_MODE:
|
||||
ret = ether_config_loopback_mode(ndev, ifdata.if_flags);
|
||||
break;
|
||||
case ETHER_SAVE_RESTORE:
|
||||
ret = ether_reg_save_restore(ndev, ifdata.if_flags);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -50,6 +50,7 @@
|
||||
#define ETHER_CONFIG_ARP_OFFLOAD 36
|
||||
#define ETHER_CONFIG_LOOPBACK_MODE 40
|
||||
#define ETHER_GET_AVB_ALGORITHM 46
|
||||
#define ETHER_SAVE_RESTORE 47
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user