From: Or Gerlitz <ogerl...@mellanox.com>

Some drivers would need to check few internal matters for
that. To be used in downstream mlx5 commit.

Signed-off-by: Or Gerlitz <ogerl...@mellanox.com>
Signed-off-by: Saeed Mahameed <sae...@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 2 +-
 include/linux/netdevice.h                      | 4 ++--
 net/core/rtnetlink.c                           | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 4a1f9d5..be32f47 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -857,7 +857,7 @@ mlxsw_sp_port_get_sw_stats64(const struct net_device *dev,
        return 0;
 }
 
-static bool mlxsw_sp_port_has_offload_stats(int attr_id)
+static bool mlxsw_sp_port_has_offload_stats(struct net_device *dev, int 
attr_id)
 {
        switch (attr_id) {
        case IFLA_OFFLOAD_XSTATS_CPU_HIT:
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e84800e..ae32a27 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -925,7 +925,7 @@ struct netdev_xdp {
  *     3. Update dev->stats asynchronously and atomically, and define
  *        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.
  *
  * int (*ndo_get_offload_stats)(int attr_id, const struct net_device *dev,
@@ -1165,7 +1165,7 @@ struct net_device_ops {
 
        struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
                                                     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,
                                                         const struct 
net_device *dev,
                                                         void *attr_data);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index db313ec..f5a8d8a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3665,7 +3665,7 @@ static int rtnl_get_offload_stats(struct sk_buff *skb, 
struct net_device *dev,
                if (!size)
                        continue;
 
-               if (!dev->netdev_ops->ndo_has_offload_stats(attr_id))
+               if (!dev->netdev_ops->ndo_has_offload_stats(dev, attr_id))
                        continue;
 
                attr = nla_reserve_64bit(skb, attr_id, size,
@@ -3706,7 +3706,7 @@ static int rtnl_get_offload_stats_size(const struct 
net_device *dev)
 
        for (attr_id = IFLA_OFFLOAD_XSTATS_FIRST;
             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;
                size = rtnl_get_offload_stats_attr_size(attr_id);
                nla_size += nla_total_size_64bit(size);
-- 
2.7.4

Reply via email to