]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
netdevice: Add offload statistics ndo
authorNogah Frankel <nogahf@mellanox.com>
Fri, 16 Sep 2016 13:05:36 +0000 (15:05 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 Sep 2016 02:33:41 +0000 (22:33 -0400)
Add a new ndo to return statistics for offloaded operation.
Since there can be many different offloaded operation with many
stats types, the ndo gets an attribute id by which it knows which
stats are wanted. The ndo also gets a void pointer to be cast according
to the attribute id.

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h

index 2095b6ab3661f4bf87d6d0d2999aad3d687b9646..a10d8d18ce1999d82db45747e468daef9df44fbd 100644 (file)
@@ -924,6 +924,14 @@ struct netdev_xdp {
  *     3. Update dev->stats asynchronously and atomically, and define
  *        neither operation.
  *
+ * bool (*ndo_has_offload_stats)(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,
+ *     void *attr_data)
+ *     Get statistics for offload operations by attr_id. Write it into the
+ *     attr_data pointer.
+ *
  * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16 vid);
  *     If device supports VLAN filtering this function is called when a
  *     VLAN id is registered.
@@ -1155,6 +1163,10 @@ 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);
+       int                     (*ndo_get_offload_stats)(int attr_id,
+                                                        const struct net_device *dev,
+                                                        void *attr_data);
        struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
 
        int                     (*ndo_vlan_rx_add_vid)(struct net_device *dev,