@@ -1183,6 +1183,8 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
/* Clear stats. */
if (a[OVS_FLOW_ATTR_CLEAR])
ovs_flow_stats_clear(flow);
+ if (a[OVS_FLOW_ATTR_USED])
+ ovs_flow_refresh(flow);
ovs_unlock();
if (reply)
@@ -167,6 +167,12 @@ void ovs_flow_stats_get(const struct sw_flow *flow,
}
}
+/* Must be called with rcu_read_lock or ovs_mutex. */
+void ovs_flow_refresh(struct sw_flow *flow)
+{
+ ovs_flow_stats_update(flow, 0, 0, 0);
+}
+
/* Called with ovs_mutex. */
void ovs_flow_stats_clear(struct sw_flow *flow)
{
@@ -214,6 +214,7 @@ void ovs_flow_stats_update_skb(struct sw_flow *, __be16 tcp_flags,
const struct sk_buff *);
void ovs_flow_stats_get(const struct sw_flow *, struct ovs_flow_stats *,
unsigned long *used, __be16 *tcp_flags);
+void ovs_flow_refresh(struct sw_flow *);
void ovs_flow_stats_clear(struct sw_flow *);
u64 ovs_flow_used_time(unsigned long flow_jiffies);
The used parameter of a flow tells us when it was used for the last time. It is possible to set this parameter to 0 using the OVS_FLOW_ATTR_CLEAR attribute, which means 'never used'. But it is not possible to set this parameter to 'now'. With this commit, adding OVS_FLOW_ATTR_USED to a 'set flow' netlink message refreshes the flow used time to the current time. The value in OVS_FLOW_ATTR_USED attribute is not used in this case. Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com> --- net/openvswitch/datapath.c | 2 ++ net/openvswitch/flow.c | 6 ++++++ net/openvswitch/flow.h | 1 + 3 files changed, 9 insertions(+)