On 9/11/26 8:56 AM, Ales Musil via dev wrote:
> There is a check if idle_age and duration are aligned.
> However, the idle age can be -1 if unknown which could break
> this. Use packet_count instead to check if flow received any traffic.
>
> Fixes: fbb501cc8b7d ("mac-cache: Handle never hit flows correctly.")
> Signed-off-by: Ales Musil <[email protected]>
> ---
> controller/mac-cache.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/controller/mac-cache.c b/controller/mac-cache.c
> index 814da223b..67a220aa3 100644
> --- a/controller/mac-cache.c
> +++ b/controller/mac-cache.c
> @@ -347,7 +347,7 @@ void
> mac_binding_stats_process_flow_stats(struct vector *stats_vec,
> struct ofputil_flow_stats *ofp_stats)
> {
> - if (ofp_stats->idle_age == ofp_stats->duration_sec) {
> + if (!ofp_stats->packet_count) {
We use ofp_stats->idle_age just below to construct the stats structure.
Maybe just to be on the safe side I'd change the structure
initialization below to:
struct mac_cache_stats stats = (struct mac_cache_stats) {
.idle_age_ms = ofp_stats->idle_age >= 0
? ofp_stats->idle_age * 1000
: 0,
.data.mb = (struct mac_binding_data) {
.cookie = ntohll(ofp_stats->cookie),
/* The port_key must be zero to match
* mac_binding_data_from_sbrec. */
.port_key = 0,
.dp_key = ntohll(ofp_stats->match.flow.metadata),
.mac = ofp_stats->match.flow.dl_src
},
};
> return;
> }
>
> @@ -452,7 +452,7 @@ void
> fdb_stats_process_flow_stats(struct vector *stats_vec,
> struct ofputil_flow_stats *ofp_stats)
> {
> - if (ofp_stats->idle_age == ofp_stats->duration_sec) {
> + if (!ofp_stats->packet_count) {
Here too.
> return;
> }
>
With that addressed:
Acked-by: Dumitru Ceara <[email protected]>
Regards,
Dumitru
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev