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>
const struct nfp_app_type app_bpf = {
.id = NFP_APP_BPF_NIC,
+ .name = "ebpf",
.vnic_init = nfp_bpf_vnic_init,
};
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);
/**
* struct nfp_app_type - application definition
* @id: application ID
+ * @name: application name
*
* Callbacks
* @init: perform basic app checks
*/
struct nfp_app_type {
enum nfp_app_id id;
+ const char *name;
int (*init)(struct nfp_app *app);
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);
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));
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,