[ovs-git] [openvswitch/ovs] a80dd0: cmap: Use PADDED_MEMBERS macro for cmap_bucket pad...

GitHub noreply at github.com
Thu Nov 30 17:41:41 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: a80dd094b657725b77e8ba2e05f8bf62d4ae2fbb
      https://github.com/openvswitch/ovs/commit/a80dd094b657725b77e8ba2e05f8bf62d4ae2fbb
  Author: Ilya Maximets <i.maximets at samsung.com>
  Date:   2017-11-30 (Thu, 30 Nov 2017)

  Changed paths:
    M lib/cmap.c

  Log Message:
  -----------
  cmap: Use PADDED_MEMBERS macro for cmap_bucket padding.

Current implementation of manual padding inside struct cmap_bucket
doesn't work for some cacheline sizes. For example, if CACHE_LINE_SIZE
equals to 128, compiler adds an additional 8 bytes: 4 bytes between
'hashes' and 'nodes' and 4 bytes after the manual 'pad'. This leads to
build time assertion, because sizeof(struct cmap_bucket) == 136.

Fix that by using PADDED_MEMBERS macro, which will handle all the
unexpected compiler paddings.
This is safe because we still have build time assert for the structure
size. Other possible solution is to pack the structure, but the padding
marco looks better and matches the other code.

Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>




More information about the git mailing list