> > The second member of the union should be a variable length array [] of > struct nsh_md2_tlv > > struct nsh_hdr { > ovs_be16 ver_flags_ttl_len; > uint8_t mdtype; > uint8_t np; > ovs_16aligned_be32 path_hdr; > union { > struct nsh_md1_ctx md1; > struct nsh_md2_tlv md2[]; > }; > }; > > That was the original design before Ben removed it due to missing support > in Microsoft compiler. > For the Kernel datapath we should go back to that. > > I wonder about the possible 16-bit alignment of the 32-bit fields, though. > How is that handled in the kernel? Also struct nsh_md1_ctx has 32-bit > members, which might not be 32-bit aligned in the packet. >
One afterthought: I think it would be good to add another member to the union to represent unstructured context headers as used, e.g., in the context of push_nsh. struct nsh_hdr { ovs_be16 ver_flags_ttl_len; uint8_t mdtype; uint8_t np; ovs_16aligned_be32 path_hdr; union { uint8_t ctx_headers[]; struct nsh_md1_ctx md1; struct nsh_md2_tlv md2[]; }; };