-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ethtool-add-pause-frame-stats'
Jakub Kicinski says: ==================== ethtool: add pause frame stats This is the first (small) series which exposes some stats via the corresponding ethtool interface. Here (thanks to the excitability of netlink) we expose pause frame stats via the same interfaces as ethtool -a / -A. In particular the following stats from the standard: - 30.3.4.2 aPAUSEMACCtrlFramesTransmitted - 30.3.4.3 aPAUSEMACCtrlFramesReceived 4 real drivers are converted, I believe we got confirmation from maintainers that all exposed stats match the standard. v3: - fix mlx5 build - adjust the init logic in patch 1 v2: - netdevsim: add missing static - bnxt: fix sparse warning - mlx5: address Saeed's comments ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
18 changed files
with
462 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
// Copyright (c) 2020 Facebook | ||
|
||
#include <linux/debugfs.h> | ||
#include <linux/ethtool.h> | ||
#include <linux/random.h> | ||
|
||
#include "netdevsim.h" | ||
|
||
static void | ||
nsim_get_pause_stats(struct net_device *dev, | ||
struct ethtool_pause_stats *pause_stats) | ||
{ | ||
struct netdevsim *ns = netdev_priv(dev); | ||
|
||
if (ns->ethtool.report_stats_rx) | ||
pause_stats->rx_pause_frames = 1; | ||
if (ns->ethtool.report_stats_tx) | ||
pause_stats->tx_pause_frames = 2; | ||
} | ||
|
||
static void | ||
nsim_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) | ||
{ | ||
struct netdevsim *ns = netdev_priv(dev); | ||
|
||
pause->autoneg = 0; /* We don't support ksettings, so can't pretend */ | ||
pause->rx_pause = ns->ethtool.rx; | ||
pause->tx_pause = ns->ethtool.tx; | ||
} | ||
|
||
static int | ||
nsim_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) | ||
{ | ||
struct netdevsim *ns = netdev_priv(dev); | ||
|
||
if (pause->autoneg) | ||
return -EINVAL; | ||
|
||
ns->ethtool.rx = pause->rx_pause; | ||
ns->ethtool.tx = pause->tx_pause; | ||
return 0; | ||
} | ||
|
||
static const struct ethtool_ops nsim_ethtool_ops = { | ||
.get_pause_stats = nsim_get_pause_stats, | ||
.get_pauseparam = nsim_get_pauseparam, | ||
.set_pauseparam = nsim_set_pauseparam, | ||
}; | ||
|
||
void nsim_ethtool_init(struct netdevsim *ns) | ||
{ | ||
struct dentry *ethtool, *dir; | ||
|
||
ns->netdev->ethtool_ops = &nsim_ethtool_ops; | ||
|
||
ethtool = debugfs_create_dir("ethtool", ns->nsim_dev->ddir); | ||
|
||
dir = debugfs_create_dir("pause", ethtool); | ||
debugfs_create_bool("report_stats_rx", 0600, dir, | ||
&ns->ethtool.report_stats_rx); | ||
debugfs_create_bool("report_stats_tx", 0600, dir, | ||
&ns->ethtool.report_stats_tx); | ||
} |
Oops, something went wrong.