summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNogah Frankel <nogahf@mellanox.com>2016-09-16 09:05:36 -0400
committerDavid S. Miller <davem@davemloft.net>2016-09-18 22:33:41 -0400
commit2c9d85d4d82d9e0a62aad08bf50650804e68ed30 (patch)
tree869f1aa551e8affeca3a5270c743f0b00ca282bc
parentc13ed534b8db543e4d8ead3885f4b06585a5771c (diff)
netdevice: Add offload statistics ndo
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>
-rw-r--r--include/linux/netdevice.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 2095b6ab3661..a10d8d18ce19 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -924,6 +924,14 @@ struct netdev_xdp {
924 * 3. Update dev->stats asynchronously and atomically, and define 924 * 3. Update dev->stats asynchronously and atomically, and define
925 * neither operation. 925 * neither operation.
926 * 926 *
927 * bool (*ndo_has_offload_stats)(int attr_id)
928 * Return true if this device supports offload stats of this attr_id.
929 *
930 * int (*ndo_get_offload_stats)(int attr_id, const struct net_device *dev,
931 * void *attr_data)
932 * Get statistics for offload operations by attr_id. Write it into the
933 * attr_data pointer.
934 *
927 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16 vid); 935 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16 vid);
928 * If device supports VLAN filtering this function is called when a 936 * If device supports VLAN filtering this function is called when a
929 * VLAN id is registered. 937 * VLAN id is registered.
@@ -1155,6 +1163,10 @@ struct net_device_ops {
1155 1163
1156 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev, 1164 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
1157 struct rtnl_link_stats64 *storage); 1165 struct rtnl_link_stats64 *storage);
1166 bool (*ndo_has_offload_stats)(int attr_id);
1167 int (*ndo_get_offload_stats)(int attr_id,
1168 const struct net_device *dev,
1169 void *attr_data);
1158 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 1170 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
1159 1171
1160 int (*ndo_vlan_rx_add_vid)(struct net_device *dev, 1172 int (*ndo_vlan_rx_add_vid)(struct net_device *dev,