[ovs-dev] ofpact alignment problem on Windows

Jarno Rajahalme jrajahalme at nicira.com
Mon Mar 16 22:02:29 UTC 2015


As ofpacts are always 8-byte aligned, I figured it would be nice to let the compiler know about this, so that we could not need casts where this may make a difference. Unfortunately that also increased the size of the struct to 8 bytes, and I did not consider the effect this has to all the acttion structs that incorporate ofpact as their first member.

I’ll revert this patch and fix the resulting issue in the affected patch that is still under review.

Thanks,

  Jarno
 
> On Mar 16, 2015, at 1:14 PM, Alin Serdean <aserdean at cloudbasesolutions.com> wrote:
> 
> Hi Ben,
> 
> I have sent out a patch (http://openvswitch.org/pipermail/dev/2015-March/052465.html).
> 
> If you want to revert back to 4 bytes please tell me.
> 
> Alin. 
> 
> -----Mesaj original-----
> De la: dev [mailto:dev-bounces at openvswitch.org] În numele Ben Pfaff
> Trimis: Friday, March 13, 2015 11:58 PM
> Către: Nithin Raju
> Cc: dev at openvswitch.org
> Subiect: Re: [ovs-dev] ofpact alignment problem on Windows
> 
> I think that just deleting the "pad" member would fix the problem in the short-term.  I don't know whether it's the fix we want long-term, since it wastes memory.
> 
> On Fri, Mar 13, 2015 at 09:47:59PM +0000, Nithin Raju wrote:
>> Thanks Ben for reporting this. One of the Hyper-V developers will provide a fix, if not for Jarno.
>> 
>> -- Nithin
>> 
>>> On Mar 13, 2015, at 1:57 PM, Ben Pfaff <blp at nicira.com> wrote:
>>> 
>>> The appveyor build on Windows failed (see 
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__ci.appveyor.com
>>> _project_blp_ovs_build_1.0.41-29-3A&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIi
>>> DJAXVeAw-YihVMNtXt-uEs&r=pNHQcdr7B40b4h6Yb7FIedI1dnBsxdDuTLBYD3JqV80
>>> &m=_gJhXVPL_EOiwr3MKszpi6BRxExM1wVF4rbjzsG2bIU&s=VspKJWfLNZcMDmq38to
>>> pyQ20jo4JR7Tg6JJTIuzmH0g&e=
>>> 
>>>   c:\openvswitch\lib\ofp-actions.h(461) : error C2229: struct 'ofpact_nest' has an illegal zero-sized array 
>>>   c:\openvswitch\lib\ofp-actions.h(756) : error C2719: 'a': formal parameter with __declspec(align('8')) won't be aligned 
>>>   c:\openvswitch\lib\ofp-actions.h(756) : error C2719: 'b': formal 
>>> parameter with __declspec(align('8')) won't be aligned
>>> 
>>> That's about this code:
>>> 
>>> 458 struct ofpact_nest {
>>> 459     struct ofpact ofpact;
>>> 460     uint8_t pad[PAD_SIZE(sizeof(struct ofpact), OFPACT_ALIGNTO)];
>>> 461     struct ofpact actions[];
>>> 462 };
>>> 
>>> I agree with it that pad[] is zero bytes long now, since "struct 
>>> ofpact" is now 8 bytes long.  That's a bit wasteful don't you think 
>>> since only 4 bytes of it is actually used?  I guess the solution 
>>> would be to remove pad[] or to shrink struct ofpact back to 4 bytes.
>>> _______________________________________________
>>> dev mailing list
>>> dev at openvswitch.org
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_
>>> mailman_listinfo_dev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMN
>>> tXt-uEs&r=pNHQcdr7B40b4h6Yb7FIedI1dnBsxdDuTLBYD3JqV80&m=_gJhXVPL_EOi
>>> wr3MKszpi6BRxExM1wVF4rbjzsG2bIU&s=H9RnmmV_GTfF3c_epOW0gjNETJx_3TzrWi
>>> H1QTtSCMc&e=
>> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list