On 12/6/22 12:57, Ales Musil wrote:
> In order to keep backward compatibility with northd we need
> to check if MAC binding table actually has the timestamp column.
> 
> Reported-at: https://bugzilla.redhat.com/2151066
> Signed-off-by: Ales Musil <[email protected]>
> ---

Hi Ales,

Thanks for your patch!

>  controller/pinctrl.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/controller/pinctrl.c b/controller/pinctrl.c
> index f44775c7e..3def379f2 100644
> --- a/controller/pinctrl.c
> +++ b/controller/pinctrl.c
> @@ -4245,12 +4245,18 @@ mac_binding_add_to_sb(struct ovsdb_idl_txn 
> *ovnsb_idl_txn,
>          b = sbrec_mac_binding_insert(ovnsb_idl_txn);
>          sbrec_mac_binding_set_logical_port(b, logical_port);
>          sbrec_mac_binding_set_ip(b, ip);
> -        sbrec_mac_binding_set_mac(b, mac_string);
>          sbrec_mac_binding_set_datapath(b, dp);
> -        sbrec_mac_binding_set_timestamp(b, time_wall_msec());
> -    } else if (strcmp(b->mac, mac_string)) {
> +    }
> +
> +    if (strcmp(b->mac, mac_string)) {
>          sbrec_mac_binding_set_mac(b, mac_string);
> -        sbrec_mac_binding_set_timestamp(b, time_wall_msec());
> +
> +        /* For backward compatibility check if timestamp column is available
> +         * in SB DB. */
> +        struct ovsdb_idl *idl = ovsdb_idl_txn_get_idl(ovnsb_idl_txn);
> +        if (sbrec_server_has_mac_binding_table_col_timestamp(idl)) {
> +            sbrec_mac_binding_set_timestamp(b, time_wall_msec());
> +        }

It's not really a performance hit but what if we add a field to 'struct
pinctrl' and set in pinctrl_run() to track whether the column exists or not?

Thanks,
Dumitru

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to