提交 2707d6f1 编写于 作者: J Jakub Kicinski 提交者: David S. Miller

nfp: report app name in ethtool -i

Let the app print its name in ethtool -i output.
Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8aa0cb00
......@@ -53,6 +53,7 @@ nfp_bpf_vnic_init(struct nfp_app *app, struct nfp_net *nn, unsigned int id)
const struct nfp_app_type app_bpf = {
.id = NFP_APP_BPF_NIC,
.name = "ebpf",
.vnic_init = nfp_bpf_vnic_init,
};
......@@ -55,7 +55,7 @@ struct nfp_app *nfp_app_alloc(struct nfp_pf *pf, enum nfp_app_id id)
return ERR_PTR(-EINVAL);
}
if (WARN_ON(!apps[i]->vnic_init))
if (WARN_ON(!apps[i]->name || !apps[i]->vnic_init))
return ERR_PTR(-EINVAL);
app = kzalloc(sizeof(*app), GFP_KERNEL);
......
......@@ -51,6 +51,7 @@ extern const struct nfp_app_type app_bpf;
/**
* struct nfp_app_type - application definition
* @id: application ID
* @name: application name
*
* Callbacks
* @init: perform basic app checks
......@@ -58,6 +59,7 @@ extern const struct nfp_app_type app_bpf;
*/
struct nfp_app_type {
enum nfp_app_id id;
const char *name;
int (*init)(struct nfp_app *app);
......@@ -93,6 +95,13 @@ static inline int nfp_app_vnic_init(struct nfp_app *app, struct nfp_net *nn,
return app->type->vnic_init(app, nn, id);
}
static inline const char *nfp_app_name(struct nfp_app *app)
{
if (!app)
return "";
return app->type->name;
}
struct nfp_app *nfp_app_alloc(struct nfp_pf *pf, enum nfp_app_id id);
void nfp_app_free(struct nfp_app *app);
......
......@@ -166,9 +166,10 @@ static void nfp_net_get_drvinfo(struct net_device *netdev,
nfp_net_get_nspinfo(nn->app, nsp_version);
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
"%d.%d.%d.%d %s",
"%d.%d.%d.%d %s %s",
nn->fw_ver.resv, nn->fw_ver.class,
nn->fw_ver.major, nn->fw_ver.minor, nsp_version);
nn->fw_ver.major, nn->fw_ver.minor, nsp_version,
nfp_app_name(nn->app));
strlcpy(drvinfo->bus_info, pci_name(nn->pdev),
sizeof(drvinfo->bus_info));
......
......@@ -51,6 +51,7 @@ static int nfp_nic_init(struct nfp_app *app)
const struct nfp_app_type app_nic = {
.id = NFP_APP_CORE_NIC,
.name = "nic",
.init = nfp_nic_init,
.vnic_init = nfp_app_nic_vnic_init,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册