[ovs-git] [openvswitch/ovs] f8b63e: lib/tc: make pedit mask calculations byte order ag...

Pieter Jansen van Vuuren noreply at github.com
Thu Jan 31 09:54:30 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: f8b63e59301fda6211e8ab69bd2e32c3f98325c9
      https://github.com/openvswitch/ovs/commit/f8b63e59301fda6211e8ab69bd2e32c3f98325c9
  Author: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>
  Date:   2019-01-31 (Thu, 31 Jan 2019)

  Changed paths:
    M include/sparse/automake.mk
    A include/sparse/linux/tc_act/tc_pedit.h
    M lib/tc.c

  Log Message:
  -----------
  lib/tc: make pedit mask calculations byte order agnostic

pedit allows setting entire words with an optional mask and OVS
makes use of such masks to allow setting fields that do not span
entire words.

The struct tc_pedit_key structure, which is part of the kernel
ABI, uses host byte order fields to store the mask and value for
a pedit action, however, these fields contain values in network
byte order.

In order to allow static analysis tools to check for endianness
problems this patch adds a local version of struct tc_pedit_key
which uses big endian types and refactors the relevant code as
appropriate.

In the course of making this change it became apparent that the
calculation of masks was occurring using host byte order although
the values are in network byte order. This patch also fixes that
problem by shifting values in host byte order and then converting
them to network byte order. It is believe this fixes a bug on big
endian systems although we are not in a position to test that.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>
Signed-off-by: Simon Horman <simon.horman at netronome.com>


  Commit: 0d9f0cd44ba1619b8f777e3994c25ef3df391768
      https://github.com/openvswitch/ovs/commit/0d9f0cd44ba1619b8f777e3994c25ef3df391768
  Author: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>
  Date:   2019-01-31 (Thu, 31 Jan 2019)

  Changed paths:
    M lib/tc.c

  Log Message:
  -----------
  lib/tc: fix 32 bits shift for pedit offset calculation

pedit allows setting entire words with an optional mask and OVS
makes use of such masks to allow setting fields that do not span
entire words. One mask for leading bytes that should not be
updated and another mask for trailing bytes that should not be
updated. The masks are created using bit shifts.

In the case of the mask to omit trailing bytes a right bit shift
is used. Currently the code can produce shifts of 1, 2, 3 or 4
bytes (8, 16, 24 or 32 bits) based on the alignment of the end
of field being set.

However, a shift of 32 bits on a 32bit value is undefined.
As it stands the code relies on the result of UINT32_MAX >> 32
being UINT32_MAX. Or in other words a mask that results in the
pedit action setting all bytes of the word under operation.

This patch adjusts the code to use a shift of 0 for this case,
which gives the same result as the undefined behaviour that was
relied on, and appears logically correct as the desire is for no
trailing bytes (or bits!) to be omitted from the set action.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>
Signed-off-by: Simon Horman <simon.horman at netronome.com>


  Commit: 95431229b9ed559efd1da92f7a96ae39ab9fe746
      https://github.com/openvswitch/ovs/commit/95431229b9ed559efd1da92f7a96ae39ab9fe746
  Author: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>
  Date:   2019-01-31 (Thu, 31 Jan 2019)

  Changed paths:
    M lib/netdev-tc-offloads.c
    M lib/tc.c
    M lib/tc.h

  Log Message:
  -----------
  lib/tc: add set ipv4 dscp and ecn action offload via pedit

Add setting of ipv4 dscp and ecn fields in tc offload using pedit.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>
Signed-off-by: Louis Peens <louis.peens at netronome.com>
Signed-off-by: Simon Horman <simon.horman at netronome.com>


  Commit: dbcb014d1f0de388c8869a2b8803a21ba81b02ee
      https://github.com/openvswitch/ovs/commit/dbcb014d1f0de388c8869a2b8803a21ba81b02ee
  Author: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>
  Date:   2019-01-31 (Thu, 31 Jan 2019)

  Changed paths:
    M lib/netdev-tc-offloads.c
    M lib/tc.c
    M lib/tc.h

  Log Message:
  -----------
  lib/tc: add set ipv6 traffic class action offload via pedit

Extend ovs-tc translation by allowing non-byte-aligned fields
for set actions. Use new boundary shifts and add set ipv6 traffic
class action offload via pedit.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>
Signed-off-by: Louis Peens <louis.peens at netronome.com>
Signed-off-by: Simon Horman <simon.horman at netronome.com>


Compare: https://github.com/openvswitch/ovs/compare/68c00e3eed72...dbcb014d1f0d


More information about the git mailing list