Commit 3df5b3c6 authored by Or Gerlitz's avatar Or Gerlitz Committed by David S. Miller

net: Add net-device param to the get offloaded stats ndo

Some drivers would need to check few internal matters for
that. To be used in downstream mlx5 commit.
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ac32378f
...@@ -857,7 +857,7 @@ mlxsw_sp_port_get_sw_stats64(const struct net_device *dev, ...@@ -857,7 +857,7 @@ mlxsw_sp_port_get_sw_stats64(const struct net_device *dev,
return 0; return 0;
} }
static bool mlxsw_sp_port_has_offload_stats(int attr_id) static bool mlxsw_sp_port_has_offload_stats(const struct net_device *dev, int attr_id)
{ {
switch (attr_id) { switch (attr_id) {
case IFLA_OFFLOAD_XSTATS_CPU_HIT: case IFLA_OFFLOAD_XSTATS_CPU_HIT:
......
...@@ -925,7 +925,7 @@ struct netdev_xdp { ...@@ -925,7 +925,7 @@ struct netdev_xdp {
* 3. Update dev->stats asynchronously and atomically, and define * 3. Update dev->stats asynchronously and atomically, and define
* neither operation. * neither operation.
* *
* bool (*ndo_has_offload_stats)(int attr_id) * bool (*ndo_has_offload_stats)(const struct net_device *dev, int attr_id)
* Return true if this device supports offload stats of this attr_id. * Return true if this device supports offload stats of this attr_id.
* *
* int (*ndo_get_offload_stats)(int attr_id, const struct net_device *dev, * int (*ndo_get_offload_stats)(int attr_id, const struct net_device *dev,
...@@ -1165,7 +1165,7 @@ struct net_device_ops { ...@@ -1165,7 +1165,7 @@ struct net_device_ops {
struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev, struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
struct rtnl_link_stats64 *storage); struct rtnl_link_stats64 *storage);
bool (*ndo_has_offload_stats)(int attr_id); bool (*ndo_has_offload_stats)(const struct net_device *dev, int attr_id);
int (*ndo_get_offload_stats)(int attr_id, int (*ndo_get_offload_stats)(int attr_id,
const struct net_device *dev, const struct net_device *dev,
void *attr_data); void *attr_data);
......
...@@ -3671,7 +3671,7 @@ static int rtnl_get_offload_stats(struct sk_buff *skb, struct net_device *dev, ...@@ -3671,7 +3671,7 @@ static int rtnl_get_offload_stats(struct sk_buff *skb, struct net_device *dev,
if (!size) if (!size)
continue; continue;
if (!dev->netdev_ops->ndo_has_offload_stats(attr_id)) if (!dev->netdev_ops->ndo_has_offload_stats(dev, attr_id))
continue; continue;
attr = nla_reserve_64bit(skb, attr_id, size, attr = nla_reserve_64bit(skb, attr_id, size,
...@@ -3712,7 +3712,7 @@ static int rtnl_get_offload_stats_size(const struct net_device *dev) ...@@ -3712,7 +3712,7 @@ static int rtnl_get_offload_stats_size(const struct net_device *dev)
for (attr_id = IFLA_OFFLOAD_XSTATS_FIRST; for (attr_id = IFLA_OFFLOAD_XSTATS_FIRST;
attr_id <= IFLA_OFFLOAD_XSTATS_MAX; attr_id++) { attr_id <= IFLA_OFFLOAD_XSTATS_MAX; attr_id++) {
if (!dev->netdev_ops->ndo_has_offload_stats(attr_id)) if (!dev->netdev_ops->ndo_has_offload_stats(dev, attr_id))
continue; continue;
size = rtnl_get_offload_stats_attr_size(attr_id); size = rtnl_get_offload_stats_attr_size(attr_id);
nla_size += nla_total_size_64bit(size); nla_size += nla_total_size_64bit(size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment