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: I05324777c9bd7ed3c167e4f8a629af2e695389d2
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2493248
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
rakesh goyal
2021-02-18 21:49:45 +05:30
committed by Revanth Kumar Uppala
parent 71fa042ce4
commit f4d30eb89b
6 changed files with 352 additions and 177 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2021, 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,
@@ -313,6 +313,7 @@ static void ether_get_ethtool_stats(struct net_device *dev,
struct ether_priv_data *pdata = netdev_priv(dev);
struct osi_core_priv_data *osi_core = pdata->osi_core;
struct osi_dma_priv_data *osi_dma = pdata->osi_dma;
struct osi_ioctl ioctl_data = {};
int i, j = 0;
int ret;
@@ -322,7 +323,8 @@ static void ether_get_ethtool_stats(struct net_device *dev,
}
if (pdata->hw_feat.mmc_sel == 1U) {
ret = osi_read_mmc(osi_core);
ioctl_data.cmd = OSI_CMD_READ_MMC;
ret = osi_handle_ioctl(osi_core, &ioctl_data);
if (ret == -1) {
dev_err(pdata->dev, "Error in reading MMC counter\n");
return;
@@ -540,6 +542,7 @@ static int ether_set_pauseparam(struct net_device *ndev,
struct ethtool_pauseparam *pause)
{
struct ether_priv_data *pdata = netdev_priv(ndev);
struct osi_ioctl ioctl_data = {};
struct phy_device *phydev = pdata->phydev;
int curflow_ctrl = OSI_FLOW_CTRL_DISABLE;
int ret;
@@ -586,8 +589,13 @@ static int ether_set_pauseparam(struct net_device *ndev,
}
/* Configure current flow control settings */
ret = osi_configure_flow_control(pdata->osi_core,
pdata->osi_core->flow_ctrl);
ioctl_data.cmd = OSI_CMD_FLOW_CTRL;
ioctl_data.arg1_u32 = pdata->osi_core->flow_ctrl;
ret = osi_handle_ioctl(pdata->osi_core, &ioctl_data);
if (ret < 0) {
dev_err(pdata->dev, "Setting flow control failed\n");
return -EFAULT;
}
return ret;
}