diff options
author | Simon Horman | 2017-06-23 22:12:03 +0200 |
---|---|---|
committer | David S. Miller | 2017-06-25 17:42:01 +0200 |
commit | eadfa4c3be99eaf15670681e6ffa4d995b73594c (patch) | |
tree | 8ba9f5f306ee719f672290c0f51c21941bdaee9c /drivers/net/ethernet/netronome/nfp/nfp_net_repr.h | |
parent | nfp: general representor implementation (diff) | |
download | kernel-qcow2-linux-eadfa4c3be99eaf15670681e6ffa4d995b73594c.tar.gz kernel-qcow2-linux-eadfa4c3be99eaf15670681e6ffa4d995b73594c.tar.xz kernel-qcow2-linux-eadfa4c3be99eaf15670681e6ffa4d995b73594c.zip |
nfp: add stats and xmit helpers for representors
Provide helpers for stats and xmit on representor netdevs.
Parts based on work by Bert van Leeuwen, Benjamin LaHaise and
Jakub Kicinski.
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_net_repr.h')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfp_net_repr.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.h b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.h index 98064f3c2623..c5ed6611f708 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.h @@ -49,17 +49,37 @@ struct nfp_reprs { }; /** + * struct nfp_repr_pcpu_stats + * @rx_packets: Received packets + * @rx_bytes: Received bytes + * @tx_packets: Transmitted packets + * @tx_bytes: Transmitted dropped + * @tx_drops: Packets dropped on transmit + * @syncp: Reference count + */ +struct nfp_repr_pcpu_stats { + u64 rx_packets; + u64 rx_bytes; + u64 tx_packets; + u64 tx_bytes; + u64 tx_drops; + struct u64_stats_sync syncp; +}; + +/** * struct nfp_repr - priv data for representor netdevs * @netdev: Back pointer to netdev * @dst: Destination for packet TX * @port: Port of representor * @app: APP handle + * @stats: Statistic of packets hitting CPU */ struct nfp_repr { struct net_device *netdev; struct metadata_dst *dst; struct nfp_port *port; struct nfp_app *app; + struct nfp_repr_pcpu_stats __percpu *stats; }; /** @@ -77,6 +97,14 @@ enum nfp_repr_type { }; #define NFP_REPR_TYPE_MAX (__NFP_REPR_TYPE_MAX - 1) +void nfp_repr_inc_rx_stats(struct net_device *netdev, unsigned int len); +void +nfp_repr_get_stats64(const struct nfp_app *app, enum nfp_repr_type type, + u8 port, struct rtnl_link_stats64 *stats); +bool nfp_repr_has_offload_stats(const struct net_device *dev, int attr_id); +int nfp_repr_get_offload_stats(int attr_id, const struct net_device *dev, + void *stats); +netdev_tx_t nfp_repr_xmit(struct sk_buff *skb, struct net_device *netdev); int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, const struct net_device_ops *netdev_ops, u32 cmsg_port_id, struct nfp_port *port, |