DPDK: Data Plane Development Kit

18.02.0-rc0
rte_branch_prediction.h File Reference

Go to the source code of this file.

Macros

#define likely(x)   __builtin_expect((x),1)
#define unlikely(x)   __builtin_expect((x),0)

Detailed Description

Branch Prediction Helpers in RTE

Definition in file rte_branch_prediction.h.

Macro Definition Documentation

#define unlikely (   x)    __builtin_expect((x),0)

Check if a branch is unlikely to be taken.

This compiler builtin allows the developer to indicate if a branch is unlikely to be taken. Example:

if (unlikely(x < 1)) do_stuff();

Examples:
examples/distributor/main.c, examples/exception_path/main.c, examples/flow_classify/flow_classify.c, examples/ip_fragmentation/main.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/esp.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipsec-secgw/ipsec.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd-vf/main.c, examples/l3fwd/l3fwd_em.c, examples/l3fwd/l3fwd_lpm.c, examples/link_status_interrupt/main.c, examples/load_balancer/runtime.c, examples/multi_process/client_server_mp/mp_client/client.c, examples/multi_process/client_server_mp/mp_server/main.c, examples/multi_process/l2fwd_fork/flib.c, examples/multi_process/l2fwd_fork/main.c, examples/netmap_compat/lib/compat_netmap.c, examples/packet_ordering/main.c, examples/performance-thread/common/lthread_sched.c, examples/performance-thread/l3fwd-thread/main.c, examples/qos_meter/main.c, examples/qos_sched/app_thread.c, examples/quota_watermark/qw/main.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/node/node.c, examples/server_node_efd/server/main.c, examples/skeleton/basicfwd.c, examples/tep_termination/main.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vhost/virtio_net.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

Definition at line 67 of file rte_branch_prediction.h.