mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 08:25:20 +07:00
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:
parent
8aa0cb0074
commit
2707d6f18b
@ -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 = {
|
const struct nfp_app_type app_bpf = {
|
||||||
.id = NFP_APP_BPF_NIC,
|
.id = NFP_APP_BPF_NIC,
|
||||||
|
.name = "ebpf",
|
||||||
|
|
||||||
.vnic_init = nfp_bpf_vnic_init,
|
.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);
|
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);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
app = kzalloc(sizeof(*app), GFP_KERNEL);
|
app = kzalloc(sizeof(*app), GFP_KERNEL);
|
||||||
|
@ -51,6 +51,7 @@ extern const struct nfp_app_type app_bpf;
|
|||||||
/**
|
/**
|
||||||
* struct nfp_app_type - application definition
|
* struct nfp_app_type - application definition
|
||||||
* @id: application ID
|
* @id: application ID
|
||||||
|
* @name: application name
|
||||||
*
|
*
|
||||||
* Callbacks
|
* Callbacks
|
||||||
* @init: perform basic app checks
|
* @init: perform basic app checks
|
||||||
@ -58,6 +59,7 @@ extern const struct nfp_app_type app_bpf;
|
|||||||
*/
|
*/
|
||||||
struct nfp_app_type {
|
struct nfp_app_type {
|
||||||
enum nfp_app_id id;
|
enum nfp_app_id id;
|
||||||
|
const char *name;
|
||||||
|
|
||||||
int (*init)(struct nfp_app *app);
|
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);
|
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);
|
struct nfp_app *nfp_app_alloc(struct nfp_pf *pf, enum nfp_app_id id);
|
||||||
void nfp_app_free(struct nfp_app *app);
|
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);
|
nfp_net_get_nspinfo(nn->app, nsp_version);
|
||||||
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_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.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),
|
strlcpy(drvinfo->bus_info, pci_name(nn->pdev),
|
||||||
sizeof(drvinfo->bus_info));
|
sizeof(drvinfo->bus_info));
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ static int nfp_nic_init(struct nfp_app *app)
|
|||||||
|
|
||||||
const struct nfp_app_type app_nic = {
|
const struct nfp_app_type app_nic = {
|
||||||
.id = NFP_APP_CORE_NIC,
|
.id = NFP_APP_CORE_NIC,
|
||||||
|
.name = "nic",
|
||||||
|
|
||||||
.init = nfp_nic_init,
|
.init = nfp_nic_init,
|
||||||
.vnic_init = nfp_app_nic_vnic_init,
|
.vnic_init = nfp_app_nic_vnic_init,
|
||||||
|
Loading…
Reference in New Issue
Block a user