Skip to content

Commit e9638c5

Browse files
committed
Merge branch 'nfp-add-basic-ethtool-callbacks-to-representors'
Jakub Kicinski says: ==================== nfp: add basic ethtool callbacks to representors This set extends the basic ethtool functionality to representor netdevs. I start with providing link state via ethtool and then move on to functions such as driver information, statistics and FW log dump. The series contains a number of clean ups to the ethtool stats code too, some of the logic is simplified by making better use of the nfp_port abstraction. The stats we expose on representors are only the PCIe and MAC port statistics firmware maintains for us. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents ef319d4 + 85d8e2b commit e9638c5

File tree

10 files changed

+497
-261
lines changed

10 files changed

+497
-261
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,18 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
159159
goto err_reprs_clean;
160160
}
161161

162+
/* For now we only support 1 PF */
163+
WARN_ON(repr_type == NFP_REPR_TYPE_PF && i);
164+
162165
port = nfp_port_alloc(app, port_type, reprs->reprs[i]);
163166
if (repr_type == NFP_REPR_TYPE_PF) {
164167
port->pf_id = i;
168+
port->vnic = priv->nn->dp.ctrl_bar;
165169
} else {
166-
port->pf_id = 0; /* For now we only support 1 PF */
170+
port->pf_id = 0;
167171
port->vf_id = i;
172+
port->vnic =
173+
app->pf->vf_cfg_mem + i * NFP_NET_CFG_BAR_SZ;
168174
}
169175

170176
eth_hw_addr_random(reprs->reprs[i]);

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "nfpcore/nfp_nffw.h"
3939
#include "nfp_app.h"
4040
#include "nfp_main.h"
41+
#include "nfp_net.h"
4142
#include "nfp_net_repr.h"
4243

4344
static const struct nfp_app_type *apps[] = {
@@ -48,6 +49,25 @@ static const struct nfp_app_type *apps[] = {
4849
#endif
4950
};
5051

52+
struct nfp_app *nfp_app_from_netdev(struct net_device *netdev)
53+
{
54+
if (nfp_netdev_is_nfp_net(netdev)) {
55+
struct nfp_net *nn = netdev_priv(netdev);
56+
57+
return nn->app;
58+
}
59+
60+
if (nfp_netdev_is_nfp_repr(netdev)) {
61+
struct nfp_repr *repr = netdev_priv(netdev);
62+
63+
return repr->app;
64+
}
65+
66+
WARN(1, "Unknown netdev type for nfp_app\n");
67+
68+
return NULL;
69+
}
70+
5171
const char *nfp_app_mip_name(struct nfp_app *app)
5272
{
5373
if (!app || !app->pf->mip)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ static inline struct net_device *nfp_app_repr_get(struct nfp_app *app, u32 id)
293293
return app->type->repr_get(app, id);
294294
}
295295

296+
struct nfp_app *nfp_app_from_netdev(struct net_device *netdev);
297+
296298
struct nfp_reprs *
297299
nfp_app_reprs_set(struct nfp_app *app, enum nfp_repr_type type,
298300
struct nfp_reprs *reprs);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ struct nfp_net_dp {
573573
* @tx_bar: Pointer to mapped TX queues
574574
* @rx_bar: Pointer to mapped FL/RX queues
575575
* @debugfs_dir: Device directory in debugfs
576-
* @ethtool_dump_flag: Ethtool dump flag
577576
* @vnic_list: Entry on device vNIC list
578577
* @pdev: Backpointer to PCI device
579578
* @app: APP handle if available
@@ -640,7 +639,6 @@ struct nfp_net {
640639
u8 __iomem *rx_bar;
641640

642641
struct dentry *debugfs_dir;
643-
u32 ethtool_dump_flag;
644642

645643
struct list_head vnic_list;
646644

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ static int nfp_net_debugfs_tx_q_read(struct seq_file *file, void *data)
125125
struct nfp_net_tx_ring *tx_ring;
126126
struct nfp_net_tx_desc *txd;
127127
int d_rd_p, d_wr_p, txd_cnt;
128-
struct sk_buff *skb;
129128
struct nfp_net *nn;
130129
int i;
131130

@@ -158,13 +157,15 @@ static int nfp_net_debugfs_tx_q_read(struct seq_file *file, void *data)
158157
txd->vals[0], txd->vals[1],
159158
txd->vals[2], txd->vals[3]);
160159

161-
skb = READ_ONCE(tx_ring->txbufs[i].skb);
162-
if (skb) {
163-
if (tx_ring == r_vec->tx_ring)
160+
if (tx_ring == r_vec->tx_ring) {
161+
struct sk_buff *skb = READ_ONCE(tx_ring->txbufs[i].skb);
162+
163+
if (skb)
164164
seq_printf(file, " skb->head=%p skb->data=%p",
165165
skb->head, skb->data);
166-
else
167-
seq_printf(file, " frag=%p", skb);
166+
} else {
167+
seq_printf(file, " frag=%p",
168+
READ_ONCE(tx_ring->txbufs[i].frag));
168169
}
169170

170171
if (tx_ring->txbufs[i].dma_addr)

0 commit comments

Comments
 (0)