On Tue, Mar 30, 2021 at 01:00:15PM +0300, Ariel Levkovich wrote:

TCA_FLOWER_KEY_CT_FLAGS_RELATED is already defined in ovs' copy at
include/linux/pkt_cls.h, so no change there is needed.
To and from flower parsing is handled below.
Mainly due to previous patches, it will not attempt to use it with
kernels that may ignore it.

Tested with ct_state -rel, and it got correctly used.

The change LGTM.

Something ate the '[PATCH]' tag from subject, though. Not sure if
that's a problem.

Thanks,
Marcelo

> Signed-off-by: Ariel Levkovich <lar...@nvidia.com>
> ---
>  lib/netdev-offload-tc.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
> index 448747eae..41acbdeb7 100644
> --- a/lib/netdev-offload-tc.c
> +++ b/lib/netdev-offload-tc.c
> @@ -765,6 +765,13 @@ parse_tc_flower_to_match(struct tc_flower *flower,
>                  ct_statem |= OVS_CS_F_INVALID;
>              }
>  
> +            if (mask->ct_state & TCA_FLOWER_KEY_CT_FLAGS_RELATED) {
> +                if (key->ct_state & TCA_FLOWER_KEY_CT_FLAGS_RELATED) {
> +                    ct_statev |= OVS_CS_F_RELATED;
> +                }
> +                ct_statem |= OVS_CS_F_RELATED;
> +            }
> +
>              match_set_ct_state_masked(match, ct_statev, ct_statem);
>          }
>  
> @@ -1522,6 +1529,14 @@ parse_match_ct_state_to_flower(struct tc_flower 
> *flower, struct match *match)
>              mask->ct_state &= ~OVS_CS_F_INVALID;
>          }
>  
> +        if (mask->ct_state & OVS_CS_F_RELATED) {
> +            if (key->ct_state & OVS_CS_F_RELATED) {
> +                flower->key.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_RELATED;
> +            }
> +            flower->mask.ct_state |= TCA_FLOWER_KEY_CT_FLAGS_RELATED;
> +            mask->ct_state &= ~OVS_CS_F_RELATED;
> +        }
> +
>          if (flower->key.ct_state & TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED) {
>              flower->key.ct_state &= ~(TCA_FLOWER_KEY_CT_FLAGS_NEW);
>              flower->mask.ct_state &= ~(TCA_FLOWER_KEY_CT_FLAGS_NEW);
> -- 
> 2.25.2
> 
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to