提交 d44a3ced 编写于 作者: S Sudarsana Reddy Kalluru 提交者: David S. Miller

qede: Add support for reading the config id attributes.

Add driver support for dumping the config id attributes via ethtool dump
interfaces.
Signed-off-by: NSudarsana Reddy Kalluru <skalluru@marvell.com>
Signed-off-by: NAriel Elior <aelior@marvell.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2d4c8495
...@@ -177,6 +177,19 @@ enum qede_flags_bit { ...@@ -177,6 +177,19 @@ enum qede_flags_bit {
QEDE_FLAGS_TX_TIMESTAMPING_EN QEDE_FLAGS_TX_TIMESTAMPING_EN
}; };
#define QEDE_DUMP_MAX_ARGS 4
enum qede_dump_cmd {
QEDE_DUMP_CMD_NONE = 0,
QEDE_DUMP_CMD_NVM_CFG,
QEDE_DUMP_CMD_MAX
};
struct qede_dump_info {
enum qede_dump_cmd cmd;
u8 num_args;
u32 args[QEDE_DUMP_MAX_ARGS];
};
struct qede_dev { struct qede_dev {
struct qed_dev *cdev; struct qed_dev *cdev;
struct net_device *ndev; struct net_device *ndev;
...@@ -262,6 +275,7 @@ struct qede_dev { ...@@ -262,6 +275,7 @@ struct qede_dev {
struct qede_rdma_dev rdma_info; struct qede_rdma_dev rdma_info;
struct bpf_prog *xdp_prog; struct bpf_prog *xdp_prog;
struct qede_dump_info dump_info;
}; };
enum QEDE_STATE { enum QEDE_STATE {
......
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
{QEDE_RQSTAT_OFFSET(stat_name), QEDE_RQSTAT_STRING(stat_name)} {QEDE_RQSTAT_OFFSET(stat_name), QEDE_RQSTAT_STRING(stat_name)}
#define QEDE_SELFTEST_POLL_COUNT 100 #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 { static const struct {
u64 offset; u64 offset;
...@@ -1973,6 +1976,89 @@ static int qede_get_module_eeprom(struct net_device *dev, ...@@ -1973,6 +1976,89 @@ static int qede_get_module_eeprom(struct net_device *dev,
return rc; return rc;
} }
static int qede_set_dump(struct net_device *dev, struct ethtool_dump *val)
{
struct qede_dev *edev = netdev_priv(dev);
int rc = 0;
if (edev->dump_info.cmd == QEDE_DUMP_CMD_NONE) {
if (val->flag > QEDE_DUMP_CMD_MAX) {
DP_ERR(edev, "Invalid command %d\n", val->flag);
return -EINVAL;
}
edev->dump_info.cmd = val->flag;
edev->dump_info.num_args = 0;
return 0;
}
if (edev->dump_info.num_args == QEDE_DUMP_MAX_ARGS) {
DP_ERR(edev, "Arg count = %d\n", edev->dump_info.num_args);
return -EINVAL;
}
switch (edev->dump_info.cmd) {
case QEDE_DUMP_CMD_NVM_CFG:
edev->dump_info.args[edev->dump_info.num_args] = val->flag;
edev->dump_info.num_args++;
break;
default:
break;
}
return rc;
}
static int qede_get_dump_flag(struct net_device *dev,
struct ethtool_dump *dump)
{
struct qede_dev *edev = netdev_priv(dev);
dump->version = QEDE_DUMP_VERSION;
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;
break;
default:
break;
}
DP_VERBOSE(edev, QED_MSG_DEBUG,
"dump->version = 0x%x dump->flag = %d dump->len = %d\n",
dump->version, dump->flag, dump->len);
return 0;
}
static int qede_get_dump_data(struct net_device *dev,
struct ethtool_dump *dump, void *buf)
{
struct qede_dev *edev = netdev_priv(dev);
int rc;
switch (edev->dump_info.cmd) {
case QEDE_DUMP_CMD_NVM_CFG:
if (edev->dump_info.num_args != QEDE_DUMP_NVM_ARG_COUNT) {
DP_ERR(edev, "Arg count = %d required = %d\n",
edev->dump_info.num_args,
QEDE_DUMP_NVM_ARG_COUNT);
return -EINVAL;
}
rc = edev->ops->common->read_nvm_cfg(edev->cdev, (u8 **)&buf,
edev->dump_info.args[0],
edev->dump_info.args[1]);
break;
default:
DP_ERR(edev, "Invalid cmd = %d\n", edev->dump_info.cmd);
rc = -EINVAL;
break;
}
edev->dump_info.cmd = QEDE_DUMP_CMD_NONE;
edev->dump_info.num_args = 0;
return rc;
}
static const struct ethtool_ops qede_ethtool_ops = { static const struct ethtool_ops qede_ethtool_ops = {
.get_link_ksettings = qede_get_link_ksettings, .get_link_ksettings = qede_get_link_ksettings,
.set_link_ksettings = qede_set_link_ksettings, .set_link_ksettings = qede_set_link_ksettings,
...@@ -2014,6 +2100,9 @@ static const struct ethtool_ops qede_ethtool_ops = { ...@@ -2014,6 +2100,9 @@ static const struct ethtool_ops qede_ethtool_ops = {
.get_tunable = qede_get_tunable, .get_tunable = qede_get_tunable,
.set_tunable = qede_set_tunable, .set_tunable = qede_set_tunable,
.flash_device = qede_flash_device, .flash_device = qede_flash_device,
.get_dump_flag = qede_get_dump_flag,
.get_dump_data = qede_get_dump_data,
.set_dump = qede_set_dump,
}; };
static const struct ethtool_ops qede_vf_ethtool_ops = { static const struct ethtool_ops qede_vf_ethtool_ops = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册