Skip to content

Commit

Permalink
Merge branch 'nfp-add-basic-ethtool-callbacks-to-representors'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Aug 19, 2017
2 parents ef319d4 + 85d8e2b commit e9638c5
Show file tree
Hide file tree
Showing 10 changed files with 497 additions and 261 deletions.
8 changes: 7 additions & 1 deletion drivers/net/ethernet/netronome/nfp/flower/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,18 @@ nfp_flower_spawn_vnic_reprs(struct nfp_app *app,
goto err_reprs_clean;
}

/* For now we only support 1 PF */
WARN_ON(repr_type == NFP_REPR_TYPE_PF && i);

port = nfp_port_alloc(app, port_type, reprs->reprs[i]);
if (repr_type == NFP_REPR_TYPE_PF) {
port->pf_id = i;
port->vnic = priv->nn->dp.ctrl_bar;
} else {
port->pf_id = 0; /* For now we only support 1 PF */
port->pf_id = 0;
port->vf_id = i;
port->vnic =
app->pf->vf_cfg_mem + i * NFP_NET_CFG_BAR_SZ;
}

eth_hw_addr_random(reprs->reprs[i]);
Expand Down
20 changes: 20 additions & 0 deletions drivers/net/ethernet/netronome/nfp/nfp_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "nfpcore/nfp_nffw.h"
#include "nfp_app.h"
#include "nfp_main.h"
#include "nfp_net.h"
#include "nfp_net_repr.h"

static const struct nfp_app_type *apps[] = {
Expand All @@ -48,6 +49,25 @@ static const struct nfp_app_type *apps[] = {
#endif
};

struct nfp_app *nfp_app_from_netdev(struct net_device *netdev)
{
if (nfp_netdev_is_nfp_net(netdev)) {
struct nfp_net *nn = netdev_priv(netdev);

return nn->app;
}

if (nfp_netdev_is_nfp_repr(netdev)) {
struct nfp_repr *repr = netdev_priv(netdev);

return repr->app;
}

WARN(1, "Unknown netdev type for nfp_app\n");

return NULL;
}

const char *nfp_app_mip_name(struct nfp_app *app)
{
if (!app || !app->pf->mip)
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/netronome/nfp/nfp_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ static inline struct net_device *nfp_app_repr_get(struct nfp_app *app, u32 id)
return app->type->repr_get(app, id);
}

struct nfp_app *nfp_app_from_netdev(struct net_device *netdev);

struct nfp_reprs *
nfp_app_reprs_set(struct nfp_app *app, enum nfp_repr_type type,
struct nfp_reprs *reprs);
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/ethernet/netronome/nfp/nfp_net.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ struct nfp_net_dp {
* @tx_bar: Pointer to mapped TX queues
* @rx_bar: Pointer to mapped FL/RX queues
* @debugfs_dir: Device directory in debugfs
* @ethtool_dump_flag: Ethtool dump flag
* @vnic_list: Entry on device vNIC list
* @pdev: Backpointer to PCI device
* @app: APP handle if available
Expand Down Expand Up @@ -640,7 +639,6 @@ struct nfp_net {
u8 __iomem *rx_bar;

struct dentry *debugfs_dir;
u32 ethtool_dump_flag;

struct list_head vnic_list;

Expand Down
13 changes: 7 additions & 6 deletions drivers/net/ethernet/netronome/nfp/nfp_net_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ static int nfp_net_debugfs_tx_q_read(struct seq_file *file, void *data)
struct nfp_net_tx_ring *tx_ring;
struct nfp_net_tx_desc *txd;
int d_rd_p, d_wr_p, txd_cnt;
struct sk_buff *skb;
struct nfp_net *nn;
int i;

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

skb = READ_ONCE(tx_ring->txbufs[i].skb);
if (skb) {
if (tx_ring == r_vec->tx_ring)
if (tx_ring == r_vec->tx_ring) {
struct sk_buff *skb = READ_ONCE(tx_ring->txbufs[i].skb);

if (skb)
seq_printf(file, " skb->head=%p skb->data=%p",
skb->head, skb->data);
else
seq_printf(file, " frag=%p", skb);
} else {
seq_printf(file, " frag=%p",
READ_ONCE(tx_ring->txbufs[i].frag));
}

if (tx_ring->txbufs[i].dma_addr)
Expand Down
Loading

0 comments on commit e9638c5

Please sign in to comment.