summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
diff options
context:
space:
mode:
authorSudarsana Reddy Kalluru <skalluru@marvell.com>2019-09-11 14:42:50 +0300
committerDavid S. Miller <davem@davemloft.net>2019-09-11 17:15:23 +0300
commit9e54ba7c3752f27456ca691acc3f154e2597478c (patch)
tree9769c195b0eda62fd940ab9846d7fb3133f5069c /drivers/net/ethernet/qlogic/qede/qede_ethtool.c
parent2f2fa16e23816bded4b97117faf6e97a95ba9056 (diff)
downloadlinux-9e54ba7c3752f27456ca691acc3f154e2597478c.tar.xz
qed*: Fix size of config attribute dump.
Driver currently returns max-buf-size as size of the config attribute. This patch incorporates changes to read this value from MFW (if available) and provide it to the user. Also did a trivial clean up in this path. Fixes: d44a3ced7023 ("qede: Add support for reading the config id attributes.") Signed-off-by: Sudarsana Reddy Kalluru <skalluru@marvell.com> Signed-off-by: Ariel Elior <aelior@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic/qede/qede_ethtool.c')
-rw-r--r--drivers/net/ethernet/qlogic/qede/qede_ethtool.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
index ec27a43230d7..8a426afb6a55 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
@@ -49,7 +49,6 @@
#define QEDE_SELFTEST_POLL_COUNT 100
#define QEDE_DUMP_VERSION 0x1
-#define QEDE_DUMP_NVM_BUF_LEN 32
#define QEDE_DUMP_NVM_ARG_COUNT 2
static const struct {
@@ -2026,7 +2025,8 @@ static int qede_get_dump_flag(struct net_device *dev,
switch (edev->dump_info.cmd) {
case QEDE_DUMP_CMD_NVM_CFG:
dump->flag = QEDE_DUMP_CMD_NVM_CFG;
- dump->len = QEDE_DUMP_NVM_BUF_LEN;
+ dump->len = edev->ops->common->read_nvm_cfg_len(edev->cdev,
+ edev->dump_info.args[0]);
break;
case QEDE_DUMP_CMD_GRCDUMP:
dump->flag = QEDE_DUMP_CMD_GRCDUMP;
@@ -2051,9 +2051,8 @@ static int qede_get_dump_data(struct net_device *dev,
if (!edev->ops || !edev->ops->common) {
DP_ERR(edev, "Edev ops not populated\n");
- edev->dump_info.cmd = QEDE_DUMP_CMD_NONE;
- edev->dump_info.num_args = 0;
- return -EINVAL;
+ rc = -EINVAL;
+ goto err;
}
switch (edev->dump_info.cmd) {
@@ -2062,7 +2061,8 @@ static int qede_get_dump_data(struct net_device *dev,
DP_ERR(edev, "Arg count = %d required = %d\n",
edev->dump_info.num_args,
QEDE_DUMP_NVM_ARG_COUNT);
- return -EINVAL;
+ rc = -EINVAL;
+ goto err;
}
rc = edev->ops->common->read_nvm_cfg(edev->cdev, (u8 **)&buf,
edev->dump_info.args[0],
@@ -2078,8 +2078,10 @@ static int qede_get_dump_data(struct net_device *dev,
break;
}
+err:
edev->dump_info.cmd = QEDE_DUMP_CMD_NONE;
edev->dump_info.num_args = 0;
+ memset(edev->dump_info.args, 0, sizeof(edev->dump_info.args));
return rc;
}