Skip to contentSkip to conversation

fm10k: add support for ndo_get_vf_stats operation

PATCH Superseded Jacob Keller 2 participants 3 messages Aug 20, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fm10k: add support for ndo_get_vf_stats operation

From: "nosbuild (Code Review)" <[email protected]>

Support capturing and reporting statistics for all of the VFs associated with a given PF device via the ndo_get_vf_stats callback.

---
 drivers/net/ethernet/intel/fm10k/fm10k.h      |  3 ++
 drivers/net/ethernet/intel/fm10k/fm10k_iov.c  | 48 +++++++++++++++++++
 .../net/ethernet/intel/fm10k/fm10k_netdev.c   |  1 +
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c  |  3 ++
 drivers/net/ethernet/intel/fm10k/fm10k_type.h |  1 +
 5 files changed, 56 insertions(+)
drivers/net/ethernet/intel/fm10k/fm10k.h +3 -0
index b14441944b4b..f306084ca12c 100644
@@ -534,6 +534,7 @@ void fm10k_iov_suspend(struct pci_dev *pdev);
 int fm10k_iov_resume(struct pci_dev *pdev);
 void fm10k_iov_disable(struct pci_dev *pdev);
 int fm10k_iov_configure(struct pci_dev *pdev, int num_vfs);
+void fm10k_iov_update_stats(struct fm10k_intfc *interface);
 s32 fm10k_iov_update_pvid(struct fm10k_intfc *interface, u16 glort, u16 pvid);
 int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac);
 int fm10k_ndo_set_vf_vlan(struct net_device *netdev,
@@ -542,6 +543,8 @@ int fm10k_ndo_set_vf_bw(struct net_device *netdev, int vf_idx,
 			int __always_unused min_rate, int max_rate);
 int fm10k_ndo_get_vf_config(struct net_device *netdev,
 			    int vf_idx, struct ifla_vf_info *ivi);
+int fm10k_ndo_get_vf_stats(struct net_device *netdev,
+			   int vf_idx, struct ifla_vf_stats *stats);
 
 /* DebugFS */
 #ifdef CONFIG_DEBUG_FS
drivers/net/ethernet/intel/fm10k/fm10k_iov.c +48 -0

57 lines not on this page · raw message

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +1 -0
index d3e85480f46d..2873e8283192 100644
@@ -1644,6 +1644,7 @@ static const struct net_device_ops fm10k_netdev_ops = {
 	.ndo_set_vf_vlan	= fm10k_ndo_set_vf_vlan,
 	.ndo_set_vf_rate	= fm10k_ndo_set_vf_bw,
 	.ndo_get_vf_config	= fm10k_ndo_get_vf_config,
+	.ndo_get_vf_stats	= fm10k_ndo_get_vf_stats,
 	.ndo_udp_tunnel_add	= fm10k_udp_tunnel_add,
 	.ndo_udp_tunnel_del	= fm10k_udp_tunnel_del,
 	.ndo_dfwd_add_station	= fm10k_dfwd_add_station,
drivers/net/ethernet/intel/fm10k/fm10k_pci.c +3 -0
index bb236fa44048..d122d0087191 100644
@@ -630,6 +630,9 @@ void fm10k_update_stats(struct fm10k_intfc *interface)
 	net_stats->rx_errors = rx_errors;
 	net_stats->rx_dropped = interface->stats.nodesc_drop.count;
 
+	/* Update VF statistics */
+	fm10k_iov_update_stats(interface);
+
 	clear_bit(__FM10K_UPDATING_STATS, interface->state);
 }
 
drivers/net/ethernet/intel/fm10k/fm10k_type.h +1 -0
index 15ac1c7885bc..63968c5d7c5d 100644
@@ -581,6 +581,7 @@ struct fm10k_vf_info {
 	 * at the same offset as the mailbox
 	 */
 	struct fm10k_mbx_info	mbx;		/* PF side of VF mailbox */
+	struct fm10k_hw_stats_q	stats[FM10K_MAX_QUEUES_POOL];
 	int			rate;		/* Tx BW cap as defined by OS */
 	u16			glort;		/* resource tag for this VF */
 	u16			sw_vid;		/* Switch API assigned VLAN */
Signature · 1 line
2.23.0.245.gf157bbb9169d
#1 lore raw

PATCH 1/1 fm10k: add support for ndo_get_vf_stats operation

Quoted 3 lines

From: "nosbuild (Code Review)" <[email protected]>

Please fix the "From:"

#2 lore raw

PATCH 1/1 fm10k: add support for ndo_get_vf_stats operation

Quoted 11 lines

-----Original Message-----
From: Brandeburg, Jesse
Sent: Tuesday, August 20, 2019 11:42 AM
To: Keller, Jacob E <[email protected]>; Intel Wired LAN <intel-wired- lan at lists.osuosl.org>
Cc: nosbuild <[email protected]>
Subject: RE: [Intel-wired-lan] [PATCH] fm10k: add support for ndo_get_vf_stats operation

Quoted 3 lines
Quoted 1 line

From: "nosbuild (Code Review)" <[email protected]>

Please fix the "From:"

Hah, yep that got messed up. Will fix and send a v2.

Regards,
Jake