diff options
author | Maor Gottlieb <maorg@mellanox.com> | 2016-07-04 17:23:10 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-07-05 00:06:03 -0700 |
commit | f913a72aa008777d4a92f82acafb17cce9aed4dc (patch) | |
tree | 904d0860110f0793788fd00a2be9dc3080590710 /drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c | |
parent | 1174fce8d1410d13b665cb7693250cc789637b9a (diff) | |
download | linux-f913a72aa008777d4a92f82acafb17cce9aed4dc.tar.bz2 |
net/mlx5e: Add support to get ethtool flow rules
Enhance the existing get_rxnfc callback:
1. Get flow rule of specific ID.
2. Get all flow rules.
3. Get number of rules.
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c index 830106ede872..d17c24227900 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c @@ -537,6 +537,40 @@ out: return err; } +int mlx5e_ethtool_get_flow(struct mlx5e_priv *priv, struct ethtool_rxnfc *info, + int location) +{ + struct mlx5e_ethtool_rule *eth_rule; + + if (location < 0 || location >= MAX_NUM_OF_ETHTOOL_RULES) + return -EINVAL; + + list_for_each_entry(eth_rule, &priv->fs.ethtool.rules, list) { + if (eth_rule->flow_spec.location == location) { + info->fs = eth_rule->flow_spec; + return 0; + } + } + + return -ENOENT; +} + +int mlx5e_ethtool_get_all_flows(struct mlx5e_priv *priv, struct ethtool_rxnfc *info, + u32 *rule_locs) +{ + int location = 0; + int idx = 0; + int err = 0; + + while ((!err || err == -ENOENT) && idx < info->rule_cnt) { + err = mlx5e_ethtool_get_flow(priv, info, location); + if (!err) + rule_locs[idx++] = location; + location++; + } + return err; +} + void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv) { struct mlx5e_ethtool_rule *iter; |