[ovs-dev] OVS_LIKELY in miniflow_extract()
Jarno Rajahalme
jrajahalme at nicira.com
Fri May 30 00:19:33 UTC 2014
On May 29, 2014, at 2:09 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Thu, May 29, 2014 at 01:56:31PM -0700, Jarno Rajahalme wrote:
>>
>>> On May 29, 2014, at 1:03 PM, Ben Pfaff <blp at nicira.com> wrote:
>>>
>>> I think that miniflow_extract() goes a little overboard on the
>>> OVS_LIKELYs. In particular these seem suspicious:
>>>
>>> if (OVS_LIKELY((nw_proto != IPPROTO_HOPOPTS)
>>> if (OVS_LIKELY(nw_proto == IPPROTO_TCP)) {
>>> } else if (OVS_LIKELY(nw_proto == IPPROTO_UDP)) {
>>> } else if (OVS_LIKELY(nw_proto == IPPROTO_SCTP)) {
>>> } else if (OVS_LIKELY(nw_proto == IPPROTO_ICMP)) {
>>> } else if (OVS_LIKELY(nw_proto == IPPROTO_ICMPV6)) {
>>>
>>> I would put all of these into a single outermost OVS_LIKELY, to make
>>> it easier to read:
>>> if (OVS_LIKELY(arp) && OVS_LIKELY(arp->ar_hrd == htons(1))
>>> && OVS_LIKELY(arp->ar_pro == htons(ETH_TYPE_IP))
>>> && OVS_LIKELY(arp->ar_hln == ETH_ADDR_LEN)
>>> && OVS_LIKELY(arp->ar_pln == 4)) {
>>>
>>> What do you think?
>>
>> You are LIKELY right, and we can always tune these if there is a
>> practical difference in generated code.
>
> OK.
>
> Your patch or mine?
I don’t have one, so… also as I took it overboard, it might be better you fix it to your liking, less expected back and forth.
Jarno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20140529/194f5a8e/attachment-0005.html>
More information about the dev
mailing list