[ovs-dev] [PATCH 2/4] lib/tc: Support matching on ip tos

Or Gerlitz gerlitz.or at gmail.com
Thu Jul 26 14:53:16 UTC 2018


On Thu, Jul 26, 2018 at 5:44 PM, Simon Horman
<simon.horman at netronome.com> wrote:
> On Wed, Jul 25, 2018 at 09:20:07PM +0300, Or Gerlitz wrote:
>> Add the missing code to match on ip tos when dealing
>> with the TC data-path.

>> --- a/lib/netdev-tc-offloads.c
>> +++ b/lib/netdev-tc-offloads.c
>> @@ -455,6 +455,7 @@ parse_tc_flower_to_match(struct tc_flower *flower,
>>              match_set_nw_proto(match, key->ip_proto);
>>          }
>>
>> +        match_set_nw_tos_masked(match, key->ip_tos, mask->ip_tos);
>>          match_set_nw_ttl_masked(match, key->ip_ttl, mask->ip_ttl);
>>
>>          if (mask->flags) {
>> @@ -1026,6 +1027,9 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match,
>>          flower.key.ip_proto = key->nw_proto;
>>          flower.mask.ip_proto = mask->nw_proto;
>>          mask->nw_proto = 0;
>> +        flower.key.ip_tos = key->nw_tos;
>> +        flower.mask.ip_tos = mask->nw_tos;
>> +        mask->nw_tos = 0;
>>          flower.key.ip_ttl = key->nw_ttl;
>>          flower.mask.ip_ttl = mask->nw_ttl;
>>          mask->nw_ttl = 0;
>> @@ -1074,8 +1078,6 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match,
>>              mask->tp_dst = 0;
>>          }
>>
>> -        mask->nw_tos = 0;

> As per my comment on patch 1/2, the intention of the mask->nw_tos change
> in the above two hunks is not clear to me.

setting mask->zzz to 0 means we consumed (== set into the mask
of the tc rule) the zzz field. Here, the field was marked as consumed but it
wasn't such. While adding the support to actually use tos, I moved the
zering to be near the usage, to align with the rest of the code.


More information about the dev mailing list