nvethernet: use single API for ioctl

To reduce number of external OSI interface APIs,
consolidated all IOCTL API to one interface API.
OSD should use same for all interaction to OSI.

Bug 200671160

Change-Id: I2ada2746f29be6cf396709c2ec12dd96d4a5ca15
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
This commit is contained in:
rakesh goyal
2021-02-18 21:49:45 +05:30
committed by Revanth Kumar Uppala
parent d792dda9be
commit 1c87167250
6 changed files with 382 additions and 206 deletions

View File

@@ -63,6 +63,7 @@ static ssize_t ether_mac_loopback_store(struct device *dev,
struct net_device *ndev = (struct net_device *)dev_get_drvdata(dev);
struct phy_device *phydev = ndev->phydev;
struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_ioctl ioctl_data = {};
int ret = -1;
/* Interface is not up so LB mode can't be set */
@@ -81,7 +82,9 @@ static ssize_t ether_mac_loopback_store(struct device *dev,
netif_carrier_on(ndev);
}
/* Enabling the MAC Loopback Mode */
ret = osi_config_mac_loopback(pdata->osi_core, OSI_ENABLE);
ioctl_data.arg1_u32 = OSI_ENABLE;
ioctl_data.cmd = OSI_CMD_MAC_LB;
ret = osi_handle_ioctl(pdata->osi_core, &ioctl_data);
if (ret < 0) {
dev_err(pdata->dev, "Enabling MAC Loopback failed\n");
} else {
@@ -98,7 +101,9 @@ static ssize_t ether_mac_loopback_store(struct device *dev,
netif_carrier_off(ndev);
}
/* Disabling the MAC Loopback Mode */
ret = osi_config_mac_loopback(pdata->osi_core, OSI_DISABLE);
ioctl_data.arg1_u32 = OSI_DISABLE;
ioctl_data.cmd = OSI_CMD_MAC_LB;
ret = osi_handle_ioctl(pdata->osi_core, &ioctl_data);
if (ret < 0) {
dev_err(pdata->dev, "Disabling MAC Loopback failed\n");
} else {