Commit a2f4c3d9 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: allow retreiving management FW logs on representors

Users should be able to dump the management FW logs on any
of the driver's netdevs.  Make the code only depend on the
nfp_app and share it between vNICs and representors.

Storing the dump flag is simply dropped for now, since we
only support the argument being set to 0.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9e4c2cfc
...@@ -573,7 +573,6 @@ struct nfp_net_dp { ...@@ -573,7 +573,6 @@ struct nfp_net_dp {
* @tx_bar: Pointer to mapped TX queues * @tx_bar: Pointer to mapped TX queues
* @rx_bar: Pointer to mapped FL/RX queues * @rx_bar: Pointer to mapped FL/RX queues
* @debugfs_dir: Device directory in debugfs * @debugfs_dir: Device directory in debugfs
* @ethtool_dump_flag: Ethtool dump flag
* @vnic_list: Entry on device vNIC list * @vnic_list: Entry on device vNIC list
* @pdev: Backpointer to PCI device * @pdev: Backpointer to PCI device
* @app: APP handle if available * @app: APP handle if available
...@@ -640,7 +639,6 @@ struct nfp_net { ...@@ -640,7 +639,6 @@ struct nfp_net {
u8 __iomem *rx_bar; u8 __iomem *rx_bar;
struct dentry *debugfs_dir; struct dentry *debugfs_dir;
u32 ethtool_dump_flag;
struct list_head vnic_list; struct list_head vnic_list;
......
...@@ -727,18 +727,18 @@ static int nfp_net_get_coalesce(struct net_device *netdev, ...@@ -727,18 +727,18 @@ static int nfp_net_get_coalesce(struct net_device *netdev,
/* Other debug dumps /* Other debug dumps
*/ */
static int static int
nfp_dump_nsp_diag(struct nfp_net *nn, struct ethtool_dump *dump, void *buffer) nfp_dump_nsp_diag(struct nfp_app *app, struct ethtool_dump *dump, void *buffer)
{ {
struct nfp_resource *res; struct nfp_resource *res;
int ret; int ret;
if (!nn->app) if (!app)
return -EOPNOTSUPP; return -EOPNOTSUPP;
dump->version = 1; dump->version = 1;
dump->flag = NFP_DUMP_NSP_DIAG; dump->flag = NFP_DUMP_NSP_DIAG;
res = nfp_resource_acquire(nn->app->cpp, NFP_RESOURCE_NSP_DIAG); res = nfp_resource_acquire(app->cpp, NFP_RESOURCE_NSP_DIAG);
if (IS_ERR(res)) if (IS_ERR(res))
return PTR_ERR(res); return PTR_ERR(res);
...@@ -748,7 +748,7 @@ nfp_dump_nsp_diag(struct nfp_net *nn, struct ethtool_dump *dump, void *buffer) ...@@ -748,7 +748,7 @@ nfp_dump_nsp_diag(struct nfp_net *nn, struct ethtool_dump *dump, void *buffer)
goto exit_release; goto exit_release;
} }
ret = nfp_cpp_read(nn->app->cpp, nfp_resource_cpp_id(res), ret = nfp_cpp_read(app->cpp, nfp_resource_cpp_id(res),
nfp_resource_address(res), nfp_resource_address(res),
buffer, dump->len); buffer, dump->len);
if (ret != dump->len) if (ret != dump->len)
...@@ -765,32 +765,30 @@ nfp_dump_nsp_diag(struct nfp_net *nn, struct ethtool_dump *dump, void *buffer) ...@@ -765,32 +765,30 @@ nfp_dump_nsp_diag(struct nfp_net *nn, struct ethtool_dump *dump, void *buffer)
return ret; return ret;
} }
static int nfp_net_set_dump(struct net_device *netdev, struct ethtool_dump *val) static int nfp_app_set_dump(struct net_device *netdev, struct ethtool_dump *val)
{ {
struct nfp_net *nn = netdev_priv(netdev); struct nfp_app *app = nfp_app_from_netdev(netdev);
if (!nn->app) if (!app)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (val->flag != NFP_DUMP_NSP_DIAG) if (val->flag != NFP_DUMP_NSP_DIAG)
return -EINVAL; return -EINVAL;
nn->ethtool_dump_flag = val->flag;
return 0; return 0;
} }
static int static int
nfp_net_get_dump_flag(struct net_device *netdev, struct ethtool_dump *dump) nfp_app_get_dump_flag(struct net_device *netdev, struct ethtool_dump *dump)
{ {
return nfp_dump_nsp_diag(netdev_priv(netdev), dump, NULL); return nfp_dump_nsp_diag(nfp_app_from_netdev(netdev), dump, NULL);
} }
static int static int
nfp_net_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump, nfp_app_get_dump_data(struct net_device *netdev, struct ethtool_dump *dump,
void *buffer) void *buffer)
{ {
return nfp_dump_nsp_diag(netdev_priv(netdev), dump, buffer); return nfp_dump_nsp_diag(nfp_app_from_netdev(netdev), dump, buffer);
} }
static int nfp_net_set_coalesce(struct net_device *netdev, static int nfp_net_set_coalesce(struct net_device *netdev,
...@@ -947,9 +945,9 @@ static const struct ethtool_ops nfp_net_ethtool_ops = { ...@@ -947,9 +945,9 @@ static const struct ethtool_ops nfp_net_ethtool_ops = {
.set_rxfh = nfp_net_set_rxfh, .set_rxfh = nfp_net_set_rxfh,
.get_regs_len = nfp_net_get_regs_len, .get_regs_len = nfp_net_get_regs_len,
.get_regs = nfp_net_get_regs, .get_regs = nfp_net_get_regs,
.set_dump = nfp_net_set_dump, .set_dump = nfp_app_set_dump,
.get_dump_flag = nfp_net_get_dump_flag, .get_dump_flag = nfp_app_get_dump_flag,
.get_dump_data = nfp_net_get_dump_data, .get_dump_data = nfp_app_get_dump_data,
.get_coalesce = nfp_net_get_coalesce, .get_coalesce = nfp_net_get_coalesce,
.set_coalesce = nfp_net_set_coalesce, .set_coalesce = nfp_net_set_coalesce,
.get_channels = nfp_net_get_channels, .get_channels = nfp_net_get_channels,
...@@ -961,6 +959,9 @@ static const struct ethtool_ops nfp_net_ethtool_ops = { ...@@ -961,6 +959,9 @@ static const struct ethtool_ops nfp_net_ethtool_ops = {
const struct ethtool_ops nfp_port_ethtool_ops = { const struct ethtool_ops nfp_port_ethtool_ops = {
.get_drvinfo = nfp_app_get_drvinfo, .get_drvinfo = nfp_app_get_drvinfo,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
.set_dump = nfp_app_set_dump,
.get_dump_flag = nfp_app_get_dump_flag,
.get_dump_data = nfp_app_get_dump_data,
}; };
void nfp_net_set_ethtool_ops(struct net_device *netdev) void nfp_net_set_ethtool_ops(struct net_device *netdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment