nfp: report app name in ethtool -i

Let the app print its name in ethtool -i output.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski 2017-05-31 08:06:47 -07:00 committed by David S. Miller
parent 8aa0cb0074
commit 2707d6f18b
5 changed files with 15 additions and 3 deletions

View file

@ -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,
};

View file

@ -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);

View file

@ -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);

View file

@ -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));

View file

@ -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,