From: Ophir Munk <[email protected]> Add flow_stats_get() function to netdev offload class, as a pre-step towards implementation of statistics quering fully offloaded flows.
Signed-off-by: Ophir Munk <[email protected]> Reviewed-by: Oz Shlomo <[email protected]> Signed-off-by: Eli Britstein <[email protected]> --- lib/netdev-offload-provider.h | 7 +++++++ lib/netdev-offload.c | 12 ++++++++++++ lib/netdev-offload.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h index 4e1c4251d..9d275e07a 100644 --- a/lib/netdev-offload-provider.h +++ b/lib/netdev-offload-provider.h @@ -82,6 +82,13 @@ struct netdev_flow_api { int (*flow_del)(struct netdev *, const ovs_u128 *ufid, struct dpif_flow_stats *); + /* Get offloaded flow stats. + * Populate the 'stats' structure with the HW counters values for the + * specified ufid. + * Return 0 if successful, otherwise returns a positive errno value. */ + int (*flow_stats_get)(struct netdev *netdev, const ovs_u128 *ufid, + struct dpif_flow_stats *stats); + /* Initializies the netdev flow api. * Return 0 if successful, otherwise returns a positive errno value. */ int (*init_flow_api)(struct netdev *); diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c index ae01acda6..9726bb19a 100644 --- a/lib/netdev-offload.c +++ b/lib/netdev-offload.c @@ -267,6 +267,18 @@ netdev_flow_del(struct netdev *netdev, const ovs_u128 *ufid, : EOPNOTSUPP; } +int +netdev_flow_stats_get(struct netdev *netdev, const ovs_u128 *ufid, + struct dpif_flow_stats *stats) +{ + const struct netdev_flow_api *flow_api = + ovsrcu_get(const struct netdev_flow_api *, &netdev->flow_api); + + return (flow_api && flow_api->flow_stats_get + ? flow_api->flow_stats_get(netdev, ufid, stats) + : EOPNOTSUPP); +} + int netdev_init_flow_api(struct netdev *netdev) { diff --git a/lib/netdev-offload.h b/lib/netdev-offload.h index e27b8782e..78909a416 100644 --- a/lib/netdev-offload.h +++ b/lib/netdev-offload.h @@ -89,6 +89,8 @@ 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_flow_stats_get(struct netdev *, const ovs_u128 *, + struct dpif_flow_stats *); int netdev_init_flow_api(struct netdev *); void netdev_uninit_flow_api(struct netdev *); uint32_t netdev_get_block_id(struct netdev *); -- 2.14.5 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
