@@ -83,6 +83,9 @@ struct netdev_flow_api {
int (*flow_del)(struct netdev *, const ovs_u128 *ufid,
struct dpif_flow_stats *);
+ /* Queries an offload provider hardware statistics. */
+ int (*hw_offload_stats_get)(struct netdev *netdev, uint64_t *counter);
+
/* Initializies the netdev flow api.
* Return 0 if successful, otherwise returns a positive errno value. */
int (*init_flow_api)(struct netdev *);
@@ -280,6 +280,17 @@ netdev_flow_del(struct netdev *netdev, const ovs_u128 *ufid,
: EOPNOTSUPP;
}
+int
+netdev_hw_offload_stats_get(struct netdev *netdev, uint64_t *counter)
+{
+ const struct netdev_flow_api *flow_api =
+ ovsrcu_get(const struct netdev_flow_api *, &netdev->flow_api);
+
+ return (flow_api && flow_api->hw_offload_stats_get)
+ ? flow_api->hw_offload_stats_get(netdev, counter)
+ : EOPNOTSUPP;
+}
+
int
netdev_init_flow_api(struct netdev *netdev)
{
@@ -95,6 +95,7 @@ int netdev_flow_get(struct netdev *, struct match *, struct nlattr **actions,
struct dpif_flow_attrs *, struct ofpbuf *wbuffer);
int netdev_flow_del(struct netdev *, const ovs_u128 *,
struct dpif_flow_stats *);
+int netdev_hw_offload_stats_get(struct netdev *, uint64_t *counter);
int netdev_init_flow_api(struct netdev *);
void netdev_uninit_flow_api(struct netdev *);
uint32_t netdev_get_block_id(struct netdev *);
Add a function for an offload provider to report a device hardware offload count. It is not for reporting offload usage statistics, i.e. in terms of packets or bytes matched by offloads, but only to know how many offloads are currently programmed into the device. Because it is not related to any specific flow, this count is not integrated with the more general flow statistics. Signed-off-by: Gaetan Rivet <grive@u256.net> --- lib/netdev-offload-provider.h | 3 +++ lib/netdev-offload.c | 11 +++++++++++ lib/netdev-offload.h | 1 + 3 files changed, 15 insertions(+)