[ovs-dev] [PATCH v4] packets: Use packet metadata initialization function instead of macro.

Gurucharan Shetty shettyg at nicira.com
Fri Mar 21 17:53:35 UTC 2014


On Fri, Mar 21, 2014 at 9:47 AM, Ben Pfaff <blp at nicira.com> wrote:
> On Fri, Mar 21, 2014 at 09:49:17AM -0700, Jarno Rajahalme wrote:
>> IMO this would better match the macro, can you try this one instead:
>>
>> static inline struct pkt_metadata pkt_metadata_from_flow(const struct flow *flow)
>> {
>>     struct pkt_metadata md;
>>
>>     md.tunnel = flow->tunnel;
>>     md.skb_priority = flow->skb_priority;
>>     md.pkt_mark = flow->pkt_mark;
>>     md.in_port = flow->in_port;
>>
>>     return md;
>> }
>>
>> I did not try this myself, hopefully no typos above. If this works, then the changes in packets.c are not necessary, and both call sites change to something like:
>>
>> > -            struct pkt_metadata md = PKT_METADATA_INITIALIZER_FLOW(&flow);
>> > +            struct pkt_metadata md = pkt_metadata_from_flow(&flow);
>
> Old compilers generated bad code for struct returns, so it might be a
> good idea to look at the generated code to make sure it's sensible.
struct returns does not seem to be a problem for visual studio.



More information about the dev mailing list