Skip to content

Commit 2707d6f

Browse files
Jakub Kicinskidavem330
authored andcommitted
nfp: report app name in ethtool -i
Let the app print its name in ethtool -i output. Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8aa0cb0 commit 2707d6f

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

drivers/net/ethernet/netronome/nfp/bpf/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ nfp_bpf_vnic_init(struct nfp_app *app, struct nfp_net *nn, unsigned int id)
5353

5454
const struct nfp_app_type app_bpf = {
5555
.id = NFP_APP_BPF_NIC,
56+
.name = "ebpf",
5657

5758
.vnic_init = nfp_bpf_vnic_init,
5859
};

drivers/net/ethernet/netronome/nfp/nfp_app.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct nfp_app *nfp_app_alloc(struct nfp_pf *pf, enum nfp_app_id id)
5555
return ERR_PTR(-EINVAL);
5656
}
5757

58-
if (WARN_ON(!apps[i]->vnic_init))
58+
if (WARN_ON(!apps[i]->name || !apps[i]->vnic_init))
5959
return ERR_PTR(-EINVAL);
6060

6161
app = kzalloc(sizeof(*app), GFP_KERNEL);

drivers/net/ethernet/netronome/nfp/nfp_app.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ extern const struct nfp_app_type app_bpf;
5151
/**
5252
* struct nfp_app_type - application definition
5353
* @id: application ID
54+
* @name: application name
5455
*
5556
* Callbacks
5657
* @init: perform basic app checks
5758
* @vnic_init: init vNICs (assign port types, etc.)
5859
*/
5960
struct nfp_app_type {
6061
enum nfp_app_id id;
62+
const char *name;
6163

6264
int (*init)(struct nfp_app *app);
6365

@@ -93,6 +95,13 @@ static inline int nfp_app_vnic_init(struct nfp_app *app, struct nfp_net *nn,
9395
return app->type->vnic_init(app, nn, id);
9496
}
9597

98+
static inline const char *nfp_app_name(struct nfp_app *app)
99+
{
100+
if (!app)
101+
return "";
102+
return app->type->name;
103+
}
104+
96105
struct nfp_app *nfp_app_alloc(struct nfp_pf *pf, enum nfp_app_id id);
97106
void nfp_app_free(struct nfp_app *app);
98107

drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ static void nfp_net_get_drvinfo(struct net_device *netdev,
166166

167167
nfp_net_get_nspinfo(nn->app, nsp_version);
168168
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
169-
"%d.%d.%d.%d %s",
169+
"%d.%d.%d.%d %s %s",
170170
nn->fw_ver.resv, nn->fw_ver.class,
171-
nn->fw_ver.major, nn->fw_ver.minor, nsp_version);
171+
nn->fw_ver.major, nn->fw_ver.minor, nsp_version,
172+
nfp_app_name(nn->app));
172173
strlcpy(drvinfo->bus_info, pci_name(nn->pdev),
173174
sizeof(drvinfo->bus_info));
174175

drivers/net/ethernet/netronome/nfp/nic/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static int nfp_nic_init(struct nfp_app *app)
5151

5252
const struct nfp_app_type app_nic = {
5353
.id = NFP_APP_CORE_NIC,
54+
.name = "nic",
5455

5556
.init = nfp_nic_init,
5657
.vnic_init = nfp_app_nic_vnic_init,

0 commit comments

Comments
 (0)