Intel DPDK API Reference
Intel DPDK API Reference
(Intel DPDK)
API Reference
November 2012
Intel DPDK -
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY
ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN
INTELS TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS
ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES
RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER
INTELLECTUAL PROPERTY RIGHT.
A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, in personal injury or death.
SHOULD YOU PURCHASE OR USE INTELS PRODUCTS FOR ANY SUCH MISSION CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND
HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH,
HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS FEES ARISING OUT OF, DIRECTLY
OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL
APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE
INTEL PRODUCT OR ANY OF ITS PARTS.
Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics
of any features or instructions marked "reserved" or "undefined". Intel reserves these for future definition and shall have no responsibility whatsoever for
conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with
this information.
The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published
specifications. Current characterized errata are available on request.
Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.
Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-5484725, or go to: http://www.intel.com/design/literature.htm
Any software source code reprinted in this document is furnished under a software license and may only be used or copied in accordance with the terms
of that license.
This document contains information on products in the design phase of development.
Intel processor numbers are not a measure of performance. Processor numbers differentiate features within each processor family, not across different
processor families. See http://www.intel.com/products/processor_number for details.
Intel and Intel logo are trademarks of Intel Corporation in the U.S. and other countries.
*Other names and brands may be claimed as the property of others.
Copyright 2012, Intel Corporation. All Rights Reserved.
November 2012
Reference Number: 326004-001
Contents
1 Deprecated List
13
13
14
15
16
17
18
19
19
19
21
21
22
23
24
26
28
29
30
31
November 2012
Reference Number: 326004-001
31
32
33
35
35
36
36
37
38
39
41
42
43
45
47
48
49
49
50
51
51
52
54
55
57
57
58
60
60
61
62
63
64
65
November 2012
Reference Number: 326004-001
66
67
67
68
68
69
70
71
72
73
74
3 File Documentation
75
75
76
90
90
92
97
November 2012
Reference Number: 326004-001
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
November 2012
Reference Number: 326004-001
Chapter 1
Deprecated List
Global rte_82576_pmd_init (void)
rte_82576_pmd_init() is deprecated and will be removed from future versions of Intel(R) DPDK. It has
been replaced by rte_igb_pmd_init().
Global rte_82599_pmd_init (void)
rte_82599_pmd_init() is deprecated and will be removed from future versions of Intel(R) DPDK. It has
been replaced by rte_ixgbe_pmd_init().
Global RTE_LIBRTE_82576_PMD
The config file option CONFIG_RTE_LIBRTE_82576_PMD and resulting preprocessor define RTE_LIBRTE_82576_PMD are deprecated. CONFIG_RTE_LIBRTE_IGB_PMD must be set in the config file
to use Intel(R) DPDK supported Gigabit Ethernet Controllers, and RTE_LIBRTE_IGB_PMD should be
used in code.
Global RTE_LIBRTE_82599_PMD
The config file option CONFIG_RTE_LIBRTE_82599_PMD and resulting preprocessor define RTE_LIBRTE_82599_PMD are deprecated. CONFIG_RTE_LIBRTE_IXGBE_PMD must be set in the config file
to use Intel(R) DPDK supported Gigabit Ethernet Controllers, and RTE_LIBRTE_IXGBE_PMD should
be used in code.
November 2012
Reference Number: 326004-001
Chapter 2
Data Fields
2.1.1
Detailed Description
2.1.2
Field Documentation
2.1.2.1
uint32 t rte_ring::cons::sc_dequeue
uint32 t rte_ring::cons::size
November 2012
Reference Number: 326004-001
2.1.2.4
uint32 t rte_ring::cons::mask
Consumer head.
2.1.2.6
Consumer tail.
2.2
Data Fields
eth_dev_configure_t dev_configure
eth_dev_start_t dev_start
eth_dev_stop_t dev_stop
eth_dev_close_t dev_close
eth_promiscuous_enable_t promiscuous_enable
eth_promiscuous_disable_t promiscuous_disable
eth_allmulticast_enable_t allmulticast_enable
eth_allmulticast_disable_t allmulticast_disable
eth_link_update_t link_update
eth_stats_get_t stats_get
eth_stats_reset_t stats_reset
eth_dev_infos_get_t dev_infos_get
vlan_filter_set_t vlan_filter_set
eth_rx_queue_setup_t rx_queue_setup
eth_tx_queue_setup_t tx_queue_setup
eth_dev_led_on_t dev_led_on
eth_dev_led_off_t dev_led_off
flow_ctrl_set_t flow_ctrl_set
eth_mac_addr_remove_t mac_addr_remove
eth_mac_addr_add_t mac_addr_add
fdir_add_signature_filter_t fdir_add_signature_filter
fdir_update_signature_filter_t fdir_update_signature_filter
fdir_remove_signature_filter_t fdir_remove_signature_filter
fdir_infos_get_t fdir_infos_get
fdir_add_perfect_filter_t fdir_add_perfect_filter
fdir_update_perfect_filter_t fdir_update_perfect_filter
fdir_remove_perfect_filter_t fdir_remove_perfect_filter
fdir_set_masks_t fdir_set_masks
November 2012
Reference Number: 326004-001
2.2.1
Detailed Description
2.2.2
Field Documentation
2.2.2.1
eth_dev_configure_t eth_dev_ops::dev_configure
Configure device.
2.2.2.2
eth_dev_start_t eth_dev_ops::dev_start
Start device.
2.2.2.3
eth_dev_stop_t eth_dev_ops::dev_stop
Stop device.
2.2.2.4
eth_dev_close_t eth_dev_ops::dev_close
Close device.
2.2.2.5
eth_promiscuous_enable_t eth_dev_ops::promiscuous_enable
Promiscuous ON.
2.2.2.6
eth_promiscuous_disable_t eth_dev_ops::promiscuous_disable
Promiscuous OFF.
2.2.2.7
eth_allmulticast_enable_t eth_dev_ops::allmulticast_enable
RX multicast ON.
2.2.2.8
eth_allmulticast_disable_t eth_dev_ops::allmulticast_disable
RX multicast OF.
November 2012
Reference Number: 326004-001
November 2012
Reference Number: 326004-001
November 2012
Reference Number: 326004-001
2.3
Data Fields
struct rte_pci_driver pci_drv
eth_dev_init_t eth_dev_init
unsigned int dev_private_size
2.3.1
Detailed Description
2.3.2
Field Documentation
2.3.2.1
2.3.2.3
2.4
Data Fields
uint8_t addr_bytes [ETHER_ADDR_LEN]
November 2012
Reference Number: 326004-001
2.4.1
Detailed Description
Ethernet address: A universally administered address is uniquely assigned to a device by its manufacturer.
The first three octets (in transmission order) contain the Organizationally Unique Identifier (OUI). The
following three (MAC-48 and EUI-48) octets are assigned by that organization with the only constraint of
uniqueness. A locally administered address is assigned to a device by a network administrator and does
not contain OUIs. See http://standards.ieee.org/regauth/groupmac/tutorial.html
2.4.2
Field Documentation
2.4.2.1
2.5
Data Fields
struct ether_addr d_addr
struct ether_addr s_addr
uint16_t ether_type
2.5.1
Detailed Description
Ethernet header: Contains the destination address, source address and frame type.
2.5.2
Field Documentation
2.5.2.1
Destination address.
2.5.2.2
Source address.
2.5.2.3
uint16 t ether_hdr::ether_type
Frame type.
November 2012
Reference Number: 326004-001
2.6
Data Fields
uint8_t version_ihl
uint8_t type_of_service
uint16_t total_length
uint16_t packet_id
uint16_t fragment_offset
uint8_t time_to_live
uint8_t next_proto_id
uint16_t hdr_checksum
uint32_t src_addr
uint32_t dst_addr
2.6.1
Detailed Description
IPv4 Header
2.6.2
Field Documentation
2.6.2.1
uint8 t ipv4_hdr::version_ihl
2.6.2.2
uint8 t ipv4_hdr::type_of_service
type of service
2.6.2.3
uint16 t ipv4_hdr::total_length
length of packet
2.6.2.4
uint16 t ipv4_hdr::packet_id
packet ID
2.6.2.5
uint16 t ipv4_hdr::fragment_offset
fragmentation offset
November 2012
Reference Number: 326004-001
2.6.2.6
uint8 t ipv4_hdr::time_to_live
time to live
2.6.2.7
uint8 t ipv4_hdr::next_proto_id
protocol ID
2.6.2.8
uint16 t ipv4_hdr::hdr_checksum
header checksum
2.6.2.9
uint32 t ipv4_hdr::src_addr
source address
2.6.2.10
uint32 t ipv4_hdr::dst_addr
destination address
2.7
Data Fields
uint32_t vtc_flow
uint16_t payload_len
uint8_t proto
uint8_t hop_limits
uint8_t src_addr [16]
uint8_t dst_addr [16]
2.7.1
Detailed Description
IPv6 Header
2.7.2
Field Documentation
2.7.2.1
uint32 t ipv6_hdr::vtc_flow
November 2012
Reference Number: 326004-001
2.7.2.2
uint16 t ipv6_hdr::payload_len
uint8 t ipv6_hdr::proto
uint8 t ipv6_hdr::hop_limits
Hop limits.
2.7.2.5
uint8 t ipv6_hdr::src_addr[16]
uint8 t ipv6_hdr::dst_addr[16]
2.8
Data Fields
2.8.1
Detailed Description
2.8.2
Field Documentation
2.8.2.1
November 2012
Reference Number: 326004-001
2.8.2.2
uint32 t rte_ring::prod::watermark
2.8.2.3
uint32 t rte_ring::prod::sp_enqueue
2.8.2.4
uint32 t rte_ring::prod::size
Size of ring.
2.8.2.5
uint32 t rte_ring::prod::mask
2.8.2.6
Producer head.
2.8.2.7
Producer tail.
2.9
Data Fields
volatile int16_t cnt
2.9.1
Detailed Description
2.9.2
Field Documentation
2.9.2.1
November 2012
Reference Number: 326004-001
2.10
Data Fields
volatile int32_t cnt
2.10.1
Detailed Description
2.10.2
Field Documentation
2.10.2.1
2.11
Data Fields
volatile int64_t cnt
2.11.1
Detailed Description
2.11.2
Field Documentation
2.11.2.1
2.12
Data Fields
uint32_t version
uint32_t magic
uint32_t master_lcore
November 2012
Reference Number: 326004-001
uint32_t lcore_count
enum rte_lcore_role_t lcore_role [32,]
enum rte_proc_type_t process_type
struct rte_mem_config mem_config
2.12.1
Detailed Description
2.12.2
Field Documentation
2.12.2.1
uint32 t rte_config::version
2.12.2.2
uint32 t rte_config::magic
2.12.2.3
uint32 t rte_config::master_lcore
2.12.2.4
uint32 t rte_config::lcore_count
2.12.2.5
State of cores.
2.12.2.6
2.12.2.7
Pointer to memory configuration, which may be shared across multiple Intel DPDK instances
November 2012
Reference Number: 326004-001
2.13
Data Fields
void data
uint32_t data_len
2.13.1
Detailed Description
2.13.2
Field Documentation
2.13.2.1
void rte_ctrlmbuf::data
Pointer to data.
2.13.2.2
uint32 t rte_ctrlmbuf::data_len
Length of data.
2.14
Data Fields
TAILQ_ENTRY next
2.14.1
Detailed Description
2.14.2
Field Documentation
2.14.2.1
November 2012
Reference Number: 326004-001
2.15
Data Fields
uint16_t link_speed
uint16_t link_duplex
struct rte_eth_rxmode rxmode
struct rte_eth_txmode txmode
union {
struct rte_eth_rss_conf rss_conf
struct rte_eth_vmdq_dcb_conf vmdq_dcb_conf
} rx_adv_conf
2.15.1
Detailed Description
A structure used to configure an Ethernet port. Depending upon the RX multi-queue mode, extra advanced
configuration settings may be needed.
2.15.2
Field Documentation
2.15.2.1
uint16 t rte_eth_conf::link_speed
2.15.2.2
uint16 t rte_eth_conf::link_duplex
2.15.2.3
Port RX configuration.
2.15.2.4
Port TX configuration.
2.15.2.5
November 2012
Reference Number: 326004-001
2.15.2.6
2.15.2.7
2.15.2.8
FDIR configuration.
2.15.2.9
2.16
Data Fields
eth_rx_burst_t rx_pkt_burst
eth_tx_burst_t tx_pkt_burst
struct rte_eth_dev_data data
struct eth_driver driver
struct eth_dev_ops dev_ops
struct rte_pci_device pci_dev
struct rte_eth_dev_cb_list callbacks
2.16.1
Detailed Description
2.16.2
Field Documentation
November 2012
Reference Number: 326004-001
2.16.2.3
2.16.2.4
2.16.2.5
2.16.2.6
2.16.2.7
2.17
Data Fields
November 2012
Reference Number: 326004-001
uint8_t all_multicast: 1
uint8_t dev_started: 1
2.17.1
Detailed Description
The data part, with no function pointers, associated with each ethernet device.
This structure is safe to place in shared memory to be common among different processes in a multi-process
configuration.
2.17.2
Field Documentation
2.17.2.1
2.17.2.2
2.17.2.3
uint16 t rte_eth_dev_data::nb_rx_queues
Number of RX queues.
2.17.2.4
uint16 t rte_eth_dev_data::nb_tx_queues
Number of TX queues.
2.17.2.5
void rte_eth_dev_data::dev_private
2.17.2.6
2.17.2.7
November 2012
Reference Number: 326004-001
2.17.2.8
uint16 t rte_eth_dev_data::max_frame_size
2.17.2.9
uint64 t rte_eth_dev_data::rx_mbuf_alloc_failed
2.17.2.10
2.17.2.11
uint8 t rte_eth_dev_data::port_id
2.17.2.12
uint8 t rte_eth_dev_data::promiscuous
2.17.2.13
uint8 t rte_eth_dev_data::scattered_rx
2.17.2.14
uint8 t rte_eth_dev_data::all_multicast
2.17.2.15
uint8 t rte_eth_dev_data::dev_started
2.18
Data Fields
November 2012
Reference Number: 326004-001
uint16_t max_rx_queues
uint16_t max_tx_queues
uint32_t max_mac_addrs
2.18.1
Detailed Description
A structure used to retrieve the contextual information of an Ethernet device, such as the controlling driver
of the device, its PCI context, etc...
2.18.2
Field Documentation
2.18.2.1
2.18.2.2
2.18.2.3
uint32 t rte_eth_dev_info::min_rx_bufsize
2.18.2.4
uint32 t rte_eth_dev_info::max_rx_pktlen
2.18.2.5
uint16 t rte_eth_dev_info::max_rx_queues
2.18.2.6
uint16 t rte_eth_dev_info::max_tx_queues
2.18.2.7
uint32 t rte_eth_dev_info::max_mac_addrs
November 2012
Reference Number: 326004-001
2.19
Data Fields
uint32_t high_water
uint32_t low_water
uint16_t pause_time
uint16_t send_xon
enum rte_eth_fc_mode mode
2.19.1
Detailed Description
A structure used to configure Ethernet flow control parameter. These parameters will be configured into the
register of the NIC. Please refer to the corresponding data sheet for proper value.
2.19.2
Field Documentation
2.19.2.1
uint32 t rte_eth_fc_conf::high_water
2.19.2.2
uint32 t rte_eth_fc_conf::low_water
2.19.2.3
uint16 t rte_eth_fc_conf::pause_time
2.19.2.4
uint16 t rte_eth_fc_conf::send_xon
2.19.2.5
November 2012
Reference Number: 326004-001
2.20
Data Fields
uint16_t collision
uint16_t free
uint16_t maxhash
uint8_t maxlen
uint64_t add
uint64_t remove
uint64_t f_add
uint64_t f_remove
2.20.1
Detailed Description
A structure used to report the status of the flow director filters in use.
2.20.2
Field Documentation
2.20.2.1
uint16 t rte_eth_fdir::collision
2.20.2.2
uint16 t rte_eth_fdir::free
2.20.2.3
uint16 t rte_eth_fdir::maxhash
The Lookup hash value of the added filter that updated the value of the MAXLEN field
2.20.2.4
uint8 t rte_eth_fdir::maxlen
2.20.2.5
uint64 t rte_eth_fdir::add
November 2012
Reference Number: 326004-001
2.20.2.6
uint64 t rte_eth_fdir::remove
2.20.2.7
uint64 t rte_eth_fdir::f_add
2.20.2.8
uint64 t rte_eth_fdir::f_remove
2.21
Data Fields
uint16_t link_speed
uint16_t link_duplex
uint8_t link_status: 1
2.21.1
Detailed Description
A structure used to retrieve link-level information of an Ethernet port. aligned for atomic64 read/write
2.21.2
Field Documentation
2.21.2.1
uint16 t rte_eth_link::link_speed
2.21.2.2
uint16 t rte_eth_link::link_duplex
ETH_LINK_[HALF_DUPLEX, FULL_DUPLEX]
2.21.2.3
uint8 t rte_eth_link::link_status
November 2012
Reference Number: 326004-001
2.22
Data Fields
uint8_t rss_key
uint16_t rss_hf
2.22.1
Detailed Description
A structure used to configure the Receive Side Scaling (RSS) feature of an Ethernet port. If not NULL, the
rss_key pointer of the rss_conf structure points to an array of 40 bytes holding the RSS key to use for
hashing specific header fields of received packets. Otherwise, a default random hash key is used by the
device driver.
The rss_hf field of the rss_conf structure indicates the different types of IPv4/IPv6 packets to which the
RSS hashing must be applied. Supplying an rss_hf equal to zero disables the RSS feature.
2.22.2
Field Documentation
2.22.2.1
uint8 t rte_eth_rss_conf::rss_key
2.22.2.2
uint16 t rte_eth_rss_conf::rss_hf
2.23
Data Fields
struct rte_eth_thresh rx_thresh
uint16_t rx_free_thresh
2.23.1
Detailed Description
2.23.2
Field Documentation
November 2012
Reference Number: 326004-001
2.23.2.1
2.23.2.2
uint16 t rte_eth_rxconf::rx_free_thresh
2.24
Data Fields
2.24.1
Detailed Description
2.24.2
Field Documentation
2.24.2.1
2.24.2.2
uint32 t rte_eth_rxmode::max_rx_pkt_len
2.24.2.3
uint16 t rte_eth_rxmode::split_hdr_size
November 2012
Reference Number: 326004-001
2.24.2.4
uint8 t rte_eth_rxmode::header_split
2.24.2.5
uint8 t rte_eth_rxmode::hw_ip_checksum
2.24.2.6
uint8 t rte_eth_rxmode::hw_vlan_filter
2.24.2.7
uint8 t rte_eth_rxmode::jumbo_frame
2.24.2.8
uint8 t rte_eth_rxmode::hw_strip_crc
2.25
Data Fields
uint64_t ipackets
uint64_t opackets
uint64_t ibytes
uint64_t obytes
uint64_t ierrors
uint64_t oerrors
uint64_t imcasts
uint64_t rx_nombuf
uint64_t fdirmatch
uint64_t fdirmiss
2.25.1
Detailed Description
November 2012
Reference Number: 326004-001
2.25.2
Field Documentation
2.25.2.1
uint64 t rte_eth_stats::ipackets
uint64 t rte_eth_stats::opackets
uint64 t rte_eth_stats::ibytes
uint64 t rte_eth_stats::obytes
uint64 t rte_eth_stats::ierrors
uint64 t rte_eth_stats::oerrors
uint64 t rte_eth_stats::imcasts
uint64 t rte_eth_stats::rx_nombuf
uint64 t rte_eth_stats::fdirmatch
uint64 t rte_eth_stats::fdirmiss
November 2012
Reference Number: 326004-001
2.26
Data Fields
uint8_t pthresh
uint8_t hthresh
uint8_t wthresh
2.26.1
Detailed Description
A structure used to configure the ring threshold registers of an RX/TX queue for an Ethernet port.
2.26.2
Field Documentation
2.26.2.1
uint8 t rte_eth_thresh::pthresh
2.26.2.2
uint8 t rte_eth_thresh::hthresh
2.26.2.3
uint8 t rte_eth_thresh::wthresh
2.27
Data Fields
struct rte_eth_thresh tx_thresh
uint16_t tx_rs_thresh
uint16_t tx_free_thresh
2.27.1
Detailed Description
November 2012
Reference Number: 326004-001
2.27.2
Field Documentation
2.27.2.1
uint16 t rte_eth_txconf::tx_rs_thresh
uint16 t rte_eth_txconf::tx_free_thresh
2.28
2.28.1
Detailed Description
A structure used to configure the TX features of an Ethernet port. For future extensions.
2.29
Data Fields
2.29.1
Detailed Description
November 2012
Reference Number: 326004-001
2.29.2
Field Documentation
2.29.2.1
2.29.2.2
uint8 t rte_eth_vmdq_dcb_conf::enable_default_pool
2.29.2.3
uint8 t rte_eth_vmdq_dcb_conf::default_pool
2.29.2.4
uint8 t rte_eth_vmdq_dcb_conf::nb_pool_maps
2.29.2.5
uint16 t rte_eth_vmdq_dcb_conf::vlan_id
2.29.2.6
uint64 t rte_eth_vmdq_dcb_conf::pools
2.29.2.7
2.29.2.8
2.30
Data Fields
uint64_t whole_entry
November 2012
Reference Number: 326004-001
struct {
uint16_t is_entry
uint16_t value
uint32_t key
} entry
2.30.1
Detailed Description
2.30.2
Field Documentation
2.30.2.1
uint64 t rte_fbk_hash_entry::whole_entry
2.30.2.2
uint16 t rte_fbk_hash_entry::is_entry
2.30.2.3
uint16 t rte_fbk_hash_entry::value
2.30.2.4
uint32 t rte_fbk_hash_entry::key
2.30.2.5
2.31
Data Fields
const char name
uint32_t entries
uint32_t entries_per_bucket
November 2012
Reference Number: 326004-001
int socket_id
rte_fbk_hash_fn hash_func
uint32_t init_val
2.31.1
Detailed Description
2.31.2
Field Documentation
2.31.2.1
2.31.2.2
uint32 t rte_fbk_hash_params::entries
2.31.2.3
uint32 t rte_fbk_hash_params::entries_per_bucket
2.31.2.4
int rte_fbk_hash_params::socket_id
2.31.2.6
uint32 t rte_fbk_hash_params::init_val
2.32
Data Fields
TAILQ_ENTRY next
November 2012
Reference Number: 326004-001
2.32.1
Detailed Description
2.32.2
Field Documentation
2.32.2.1
Linked list.
2.32.2.2
2.32.2.3
uint32 t rte_fbk_hash_table::entries
2.32.2.4
uint32 t rte_fbk_hash_table::entries_per_bucket
2.32.2.5
uint32 t rte_fbk_hash_table::used_entries
2.32.2.6
uint32 t rte_fbk_hash_table::bucket_mask
November 2012
Reference Number: 326004-001
2.32.2.7
uint32 t rte_fbk_hash_table::bucket_shift
2.32.2.9
uint32 t rte_fbk_hash_table::init_val
2.32.2.10
2.33
Data Fields
enum rte_fdir_mode mode
enum rte_fdir_pballoc_type pballoc
enum rte_fdir_status_mode status
2.33.1
Detailed Description
A structure used to configure the Flow Director (FDIR) feature of an Ethernet port.
If mode is RTE_FDIR_DISABLE, the pballoc value is ignored.
2.33.2
Field Documentation
2.33.2.1
2.33.2.2
November 2012
Reference Number: 326004-001
2.33.2.3
2.34
Data Fields
uint16_t flex_bytes
uint16_t vlan_id
uint16_t port_src
uint16_t port_dst
union {
uint32_t ipv4_addr
uint32_t ipv6_addr [4]
} ip_src
union {
uint32_t ipv4_addr
uint32_t ipv6_addr [4]
} ip_dst
enum rte_l4type l4type
enum rte_iptype iptype
2.34.1
Detailed Description
2.34.2
Field Documentation
2.34.2.1
uint16 t rte_fdir_filter::flex_bytes
2.34.2.2
uint16 t rte_fdir_filter::vlan_id
2.34.2.3
uint16 t rte_fdir_filter::port_src
November 2012
Reference Number: 326004-001
2.34.2.4
uint16 t rte_fdir_filter::port_dst
2.34.2.5
uint32 t rte_fdir_filter::ipv4_addr
2.34.2.6
uint32 t rte_fdir_filter::ipv6_addr[4]
2.34.2.7
2.34.2.8
2.34.2.9
2.34.2.10
2.35
Data Fields
uint8_t only_ip_flow
uint8_t vlan_id
uint8_t vlan_prio
uint8_t flexbytes
uint32_t dst_ipv4_mask
uint32_t src_ipv4_mask
November 2012
Reference Number: 326004-001
uint16_t src_ipv6_mask
uint16_t src_port_mask
uint16_t dst_port_mask
2.35.1
Detailed Description
A structure used to configure FDIR masks that are used by the device to match the various fields of RX
packet headers.
2.35.2
Field Documentation
2.35.2.1
uint8 t rte_fdir_masks::only_ip_flow
When set to 1, packet l4type is not relevant in filters, and source and destination port masks must be set to
zero.
2.35.2.2
uint8 t rte_fdir_masks::vlan_id
2.35.2.3
uint8 t rte_fdir_masks::vlan_prio
2.35.2.4
uint8 t rte_fdir_masks::flexbytes
2.35.2.5
uint32 t rte_fdir_masks::dst_ipv4_mask
Mask of Destination IPv4 Address. All bits set to 1 define the relevant bits to use in the destination address
of an IPv4 packet when matching it against FDIR filters.
2.35.2.6
uint32 t rte_fdir_masks::src_ipv4_mask
Mask of Source IPv4 Address. All bits set to 1 define the relevant bits to use in the source address of an
IPv4 packet when matching it against FDIR filters.
November 2012
Reference Number: 326004-001
2.35.2.7
uint16 t rte_fdir_masks::src_ipv6_mask
Mask of Source IPv6 Address. All bits set to 1 define the relevant BYTES to use in the source address of
an IPv6 packet when matching it against FDIR filters.
2.35.2.8
uint16 t rte_fdir_masks::src_port_mask
Mask of Source Port. All bits set to 1 define the relevant bits to use in the source port of an IP packets when
matching it against FDIR filters.
2.35.2.9
uint16 t rte_fdir_masks::dst_port_mask
Mask of Destination Port. All bits set to 1 define the relevant bits to use in the destination port of an IP
packet when matching it against FDIR filters.
2.36
Data Fields
TAILQ_ENTRY next
char name [RTE_HASH_NAMESIZE]
uint32_t entries
uint32_t bucket_entries
uint32_t key_len
rte_hash_function hash_func
uint32_t hash_func_init_val
uint32_t num_buckets
uint32_t bucket_bitmask
hash_sig_t sig_msb
uint8_t sig_tbl
uint32_t sig_tbl_bucket_size
uint8_t key_tbl
uint32_t key_tbl_key_size
2.36.1
Detailed Description
2.36.2
Field Documentation
2.36.2.1
Next in list.
November 2012
Reference Number: 326004-001
2.36.2.2
2.36.2.3
uint32 t rte_hash::entries
2.36.2.4
uint32 t rte_hash::bucket_entries
Bucket entries.
2.36.2.5
uint32 t rte_hash::key_len
2.36.2.7
uint32 t rte_hash::hash_func_init_val
2.36.2.8
uint32 t rte_hash::num_buckets
2.36.2.9
uint32 t rte_hash::bucket_bitmask
2.36.2.11
uint8 t rte_hash::sig_tbl
November 2012
Reference Number: 326004-001
2.36.2.12
uint32 t rte_hash::sig_tbl_bucket_size
Signature buckets may be padded for alignment reasons, and this is the bucket size used by sig_tbl.
2.36.2.13
uint8 t rte_hash::key_tbl
2.36.2.14
uint32 t rte_hash::key_tbl_key_size
Keys may be padded for alignment reasons, and this is the key size used by key_tbl.
2.37
Data Fields
2.37.1
Detailed Description
Parameters used when creating the hash table. The total table entries and bucket entries must be a power
of 2.
2.37.2
Field Documentation
2.37.2.1
2.37.2.2
uint32 t rte_hash_parameters::entries
November 2012
Reference Number: 326004-001
2.37.2.3
uint32 t rte_hash_parameters::bucket_entries
Bucket entries.
2.37.2.4
uint32 t rte_hash_parameters::key_len
2.37.2.6
uint32 t rte_hash_parameters::hash_func_init_val
2.37.2.7
int rte_hash_parameters::socket_id
2.38
Data Fields
uint16_t lsc
2.38.1
Detailed Description
2.38.2
Field Documentation
2.38.2.1
uint16 t rte_intr_conf::lsc
November 2012
Reference Number: 326004-001
2.39
Data Fields
uint32_t type
uint32_t level
FILE file
2.39.1
Detailed Description
2.39.2
Field Documentation
2.39.2.1
uint32 t rte_logs::type
uint32 t rte_logs::level
Log level.
2.39.2.3
FILE rte_logs::file
2.40
Data Fields
TAILQ_ENTRY next
char name [RTE_LPM_NAMESIZE]
int mem_location
uint32_t max_rules_per_depth
uint32_t used_rules_at_depth [RTE_LPM_MAX_DEPTH]
struct rte_lpm_tbl24_entry struct rte_lpm_tbl8_entry tbl8 [RTE_LPM_TBL8_NUM_ENTRIES]
struct rte_lpm_tbl24_entry struct rte_lpm_tbl8_entry struct rte_lpm_rule rules_tbl [0]
2.40.1
Detailed Description
LPM structure.
November 2012
Reference Number: 326004-001
2.40.2
Field Documentation
2.40.2.1
Next in list.
2.40.2.2
2.40.2.3
int rte_lpm::mem_location
2.40.2.4
uint32 t rte_lpm::max_rules_per_depth
2.40.2.5
Rules / depth.
2.40.2.6
2.40.2.7
2.41
Data Fields
uint32_t ip
uint8_t next_hop
2.41.1
Detailed Description
Rule structure.
November 2012
Reference Number: 326004-001
2.41.2
Field Documentation
2.41.2.1
uint32 t rte_lpm_rule::ip
Rule IP address.
2.41.2.2
uint8 t rte_lpm_rule::next_hop
2.42
Data Fields
uint8_t valid:1
uint8_t ext_entry:1
uint8_t depth:6
2.42.1
Detailed Description
2.42.2
Field Documentation
2.42.2.1
uint8 t rte_lpm_tbl24_entry::valid
Validation flag.
2.42.2.2
uint8 t rte_lpm_tbl24_entry::ext_entry
External entry.
2.42.2.3
uint8 t rte_lpm_tbl24_entry::depth
Rule depth.
2.43
November 2012
Reference Number: 326004-001
Data Fields
uint8_t valid:1
uint8_t valid_group:1
uint8_t depth:6
uint8_t next_hop
2.43.1
Detailed Description
2.43.2
Field Documentation
2.43.2.1
uint8 t rte_lpm_tbl8_entry::valid
Validation flag.
2.43.2.2
uint8 t rte_lpm_tbl8_entry::valid_group
uint8 t rte_lpm_tbl8_entry::depth
Rule depth.
2.43.2.4
uint8 t rte_lpm_tbl8_entry::next_hop
next hop.
2.44
Data Fields
November 2012
Reference Number: 326004-001
uint8_t type
uint8_t reserved
uint16_t ol_flags
2.44.1
Detailed Description
2.44.2
Field Documentation
2.44.2.1
2.44.2.2
void rte_mbuf::buf_addr
2.44.2.4
uint16 t rte_mbuf::buf_len
2.44.2.6
uint16 t rte_mbuf::refcnt
2.44.2.7
union { ... }
16-bit Reference counter. It should only be accessed using the following functions: rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC config option.
November 2012
Reference Number: 326004-001
2.44.2.8
uint8 t rte_mbuf::type
Type of mbuf.
2.44.2.9
uint8 t rte_mbuf::reserved
2.44.2.10
uint16 t rte_mbuf::ol_flags
Offload features.
2.45
Data Fields
uint32_t nchannel
uint32_t nrank
struct rte_memseg memseg [32,]
struct rte_memzone memzone [512,]
struct rte_tailq_head tailq_head [32,]
2.45.1
Detailed Description
the structure for the memory configuration for the RTE. Used by the rte_config structure. It is separated out,
as for multi-process support, the memory details should be shared across instances
2.45.2
Field Documentation
2.45.2.1
uint32 t rte_mem_config::nchannel
2.45.2.2
uint32 t rte_mem_config::nrank
2.45.2.3
Physmem descriptors.
November 2012
Reference Number: 326004-001
2.45.2.4
Memzone descriptors.
2.45.2.5
2.46
Data Fields
TAILQ_ENTRY next
char name [RTE_MEMPOOL_NAMESIZE]
struct rte_ring ring
phys_addr_t phys_addr
int flags
uint32_t size
uint32_t bulk_default
uint32_t cache_size
uint32_t elt_size
uint32_t header_size
uint32_t trailer_size
unsigned private_data_size
struct rte_mempool_cache local_cache [32,]
2.46.1
Detailed Description
2.46.2
Field Documentation
2.46.2.1
Next in list.
2.46.2.2
Name of mempool.
November 2012
Reference Number: 326004-001
2.46.2.3
2.46.2.5
int rte_mempool::flags
2.46.2.6
uint32 t rte_mempool::size
2.46.2.7
uint32 t rte_mempool::bulk_default
2.46.2.8
uint32 t rte_mempool::cache_size
2.46.2.9
uint32 t rte_mempool::elt_size
Size of an element.
2.46.2.10
uint32 t rte_mempool::header_size
2.46.2.11
uint32 t rte_mempool::trailer_size
2.46.2.12
unsigned rte_mempool::private_data_size
November 2012
Reference Number: 326004-001
2.46.2.13
2.47
Data Fields
unsigned len
void objs [512,]
2.47.1
Detailed Description
2.47.2
Field Documentation
2.47.2.1
unsigned rte_mempool_cache::len
Cache len
2.47.2.2
void rte_mempool_cache::objs[512,]
Cache objects
2.48
Data Fields
phys_addr_t phys_addr
uint64_t len
uint64_t hugepage_sz
int32_t socket_id
uint32_t nchannel
uint32_t nrank
void addr
uint64_t addr_64
2.48.1
Detailed Description
November 2012
Reference Number: 326004-001
2.48.2
Field Documentation
2.48.2.2
void rte_memseg::addr
2.48.2.3
uint64 t rte_memseg::addr_64
2.48.2.4
uint64 t rte_memseg::len
2.48.2.5
uint64 t rte_memseg::hugepage_sz
2.48.2.6
int32 t rte_memseg::socket_id
2.48.2.7
uint32 t rte_memseg::nchannel
Number of channels.
2.48.2.8
uint32 t rte_memseg::nrank
Number of ranks.
2.49
Data Fields
char name [RTE_MEMZONE_NAMESIZE]
phys_addr_t phys_addr
November 2012
Reference Number: 326004-001
uint64_t len
uint64_t hugepage_sz
int32_t socket_id
uint32_t flags
void addr
uint64_t addr_64
2.49.1
Detailed Description
A structure describing a memzone, which is a contiguous portion of physical memory identified by a name.
2.49.2
Field Documentation
2.49.2.1
2.49.2.3
void rte_memzone::addr
2.49.2.4
uint64 t rte_memzone::addr_64
2.49.2.5
uint64 t rte_memzone::len
2.49.2.6
uint64 t rte_memzone::hugepage_sz
2.49.2.7
int32 t rte_memzone::socket_id
November 2012
Reference Number: 326004-001
2.49.2.8
uint32 t rte_memzone::flags
2.50
Data Fields
uint16_t domain
uint8_t bus
uint8_t devid
uint8_t function
2.50.1
Detailed Description
2.50.2
Field Documentation
2.50.2.1
uint16 t rte_pci_addr::domain
Device domain
2.50.2.2
uint8 t rte_pci_addr::bus
Device bus
2.50.2.3
uint8 t rte_pci_addr::devid
Device ID
2.50.2.4
uint8 t rte_pci_addr::function
Device function.
2.51
Data Fields
TAILQ_ENTRY next
November 2012
Reference Number: 326004-001
2.51.1
Detailed Description
2.51.2
Field Documentation
2.51.2.1
2.51.2.2
PCI location.
2.51.2.3
PCI ID.
2.51.2.4
2.51.2.5
Interrupt handle
2.52
Data Fields
TAILQ_ENTRY next
const char name
pci_devinit_t devinit
struct rte_pci_id id_table
uint32_t drv_flags
November 2012
Reference Number: 326004-001
2.52.1
Detailed Description
2.52.2
Field Documentation
2.52.2.1
Next in list.
2.52.2.2
Driver name.
2.52.2.4
2.52.2.5
uint32 t rte_pci_driver::drv_flags
2.53
Data Fields
uint16_t vendor_id
uint16_t device_id
uint16_t subsystem_vendor_id
uint16_t subsystem_device_id
2.53.1
Detailed Description
A structure describing an ID for a PCI driver. Each driver provides a table of these IDs for each device that
it supports.
November 2012
Reference Number: 326004-001
2.53.2
Field Documentation
2.53.2.1
uint16 t rte_pci_id::vendor_id
Vendor ID or PCI_ANY_ID.
2.53.2.2
uint16 t rte_pci_id::device_id
Device ID or PCI_ANY_ID.
2.53.2.3
uint16 t rte_pci_id::subsystem_vendor_id
2.53.2.4
uint16 t rte_pci_id::subsystem_device_id
2.54
Data Fields
uint64_t phys_addr
uint64_t len
void addr
2.54.1
Detailed Description
2.54.2
Field Documentation
2.54.2.1
uint64 t rte_pci_resource::phys_addr
2.54.2.2
uint64 t rte_pci_resource::len
November 2012
Reference Number: 326004-001
2.54.2.3
void rte_pci_resource::addr
2.55
Data Fields
2.55.1
Detailed Description
2.55.2
Field Documentation
2.55.2.1
2.55.2.2
void rte_pktmbuf::data
2.55.2.3
uint16 t rte_pktmbuf::data_len
November 2012
Reference Number: 326004-001
2.55.2.4
uint8 t rte_pktmbuf::nb_segs
Number of segments.
2.55.2.5
uint8 t rte_pktmbuf::in_port
Input port.
2.55.2.6
uint32 t rte_pktmbuf::pkt_len
2.55.2.7
uint16 t rte_pktmbuf::vlan_tci
2.55.2.8
uint16 t rte_pktmbuf::l2_len
2.55.2.9
uint16 t rte_pktmbuf::l3_len
2.55.2.10
uint32 t rte_pktmbuf::rss
2.55.2.11
2.55.2.12
hash information
2.56
November 2012
Reference Number: 326004-001
Data Fields
uint16_t mbuf_data_room_size
2.56.1
Detailed Description
2.56.2
Field Documentation
2.56.2.1
uint16 t rte_pktmbuf_pool_private::mbuf_data_room_size
2.57
Data Structures
struct cons
struct prod
Data Fields
TAILQ_ENTRY next
char name [RTE_RING_NAMESIZE]
int flags
2.57.1
Detailed Description
November 2012
Reference Number: 326004-001
2.57.2
Field Documentation
2.57.2.1
Next in list.
2.57.2.2
2.57.2.3
int rte_ring::flags
2.58
Data Fields
volatile int32_t cnt
2.58.1
Detailed Description
2.58.2
Field Documentation
2.58.2.1
2.59
Data Fields
rte_spinlock_t sl
volatile int user
volatile int count
November 2012
Reference Number: 326004-001
2.59.1
Detailed Description
2.59.2
Field Documentation
2.60
Data Fields
volatile int locked
2.60.1
Detailed Description
2.60.2
Field Documentation
2.60.2.1
2.61
Data Fields
struct rte_dummy_head tailq_head
char qname [RTE_TAILQ_NAMESIZE]
November 2012
Reference Number: 326004-001
2.61.1
Detailed Description
The structure defining a tailq header entry for storing in the rte_config structure in shared memory. Each tailq
is identified by name. Any library storing a set of objects e.g. rings, mempools, hash-tables, is recommended
to use an entry here, so as to make it easy for a multi-process app to find already-created elements in shared
memory.
2.61.2
Field Documentation
2.61.2.1
2.61.2.2
Queue name
2.62
Data Fields
2.62.1
Detailed Description
2.62.2
2.62.2.1
November 2012
Reference Number: 326004-001
2.62.3
Field Documentation
2.62.3.1
Status of timer.
2.62.3.2
uint64 t rte_timer::period
2.62.3.3
uint64 t rte_timer::expire
2.62.3.5
void rte_timer::arg
2.63
Data Fields
uint32_t u32
uint16_t state
int16_t owner
2.63.1
Detailed Description
Timer status: A union of the state (stopped, pending, running, config) and an owner (the id of the lcore that
owns the timer).
2.63.2
Field Documentation
2.63.2.1
uint16 t rte_timer_status::state
November 2012
Reference Number: 326004-001
2.63.2.2
int16 t rte_timer_status::owner
2.63.2.3
uint32 t rte_timer_status::u32
2.64
Data Fields
uint16_t src_port
uint16_t dst_port
uint32_t tag
uint32_t cksum
2.64.1
Detailed Description
SCTP Header
2.64.2
Field Documentation
2.64.2.1
uint16 t sctp_hdr::src_port
Source port.
2.64.2.2
uint16 t sctp_hdr::dst_port
Destin port.
2.64.2.3
uint32 t sctp_hdr::tag
Validation tag.
2.64.2.4
uint32 t sctp_hdr::cksum
Checksum.
November 2012
Reference Number: 326004-001
2.65
Data Fields
uint16_t src_port
uint16_t dst_port
uint32_t sent_seq
uint32_t recv_ack
uint8_t data_off
uint8_t tcp_flags
uint16_t rx_win
uint16_t cksum
uint16_t tcp_urp
2.65.1
Detailed Description
TCP Header
2.65.2
Field Documentation
2.65.2.1
uint16 t tcp_hdr::src_port
2.65.2.2
uint16 t tcp_hdr::dst_port
2.65.2.3
uint32 t tcp_hdr::sent_seq
2.65.2.4
uint32 t tcp_hdr::recv_ack
2.65.2.5
uint8 t tcp_hdr::data_off
Data offset.
November 2012
Reference Number: 326004-001
2.65.2.6
uint8 t tcp_hdr::tcp_flags
TCP flags
2.65.2.7
uint16 t tcp_hdr::rx_win
2.65.2.8
uint16 t tcp_hdr::cksum
TCP checksum.
2.65.2.9
uint16 t tcp_hdr::tcp_urp
2.66
Data Fields
uint16_t src_port
uint16_t dst_port
uint16_t dgram_len
uint16_t dgram_cksum
2.66.1
Detailed Description
UDP Header
2.66.2
Field Documentation
2.66.2.1
uint16 t udp_hdr::src_port
2.66.2.2
uint16 t udp_hdr::dst_port
November 2012
Reference Number: 326004-001
2.66.2.3
uint16 t udp_hdr::dgram_len
2.66.2.4
uint16 t udp_hdr::dgram_cksum
2.67
Data Fields
uint16_t vlan_tci
uint16_t eth_proto
2.67.1
Detailed Description
Ethernet VLAN Header. Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type of the
encapsulated frame.
2.67.2
Field Documentation
2.67.2.1
uint16 t vlan_hdr::vlan_tci
2.67.2.2
uint16 t vlan_hdr::eth_proto
November 2012
Reference Number: 326004-001
Chapter 3
File Documentation
3.1
Typedefs
typedef void( rte_eal_alarm_callback )(void arg)
Functions
int rte_eal_alarm_set (uint64_t us, rte_eal_alarm_callback cb, void cb_arg)
int rte_eal_alarm_cancel (rte_eal_alarm_callback cb_fn, void cb_arg)
3.1.1
Detailed Description
Alarm functions
Simple alarm-clock functionality supplied by eal. Does not require hpet support.
3.1.2
Typedef Documentation
3.1.2.1
3.1.3
Function Documentation
November 2012
Reference Number: 326004-001
3.1.3.1
int rte eal alarm set ( uint64 t us, rte_eal_alarm_callback cb, void cb arg )
Function to set a callback to be triggered when us microseconds have expired. Accuracy of timing to the
microsecond is not guaranteed. The alarm function will not be called before the requested time, but may
be called a short period of time afterwards. The alarm handler will be called only once. There is no need to
call "rte_eal_alarm_cancel" from within the callback function.
Parameters
us The time in microseconds before the callback is called
cb The function to be called when the alarm expires
cb_arg Pointer parameter to be passed to the callback function
Returns
On success, zero. On failure, a negative error number
3.1.3.2
Returns
The number of callbacks removed
3.2
Data Structures
struct rte_atomic16_t
struct rte_atomic32_t
struct rte_atomic64_t
Defines
#define rte_mb()
#define rte_wmb()
#define rte_rmb()
November 2012
Reference Number: 326004-001
#define RTE_ATOMIC16_INIT(val)
#define RTE_ATOMIC32_INIT(val)
#define RTE_ATOMIC64_INIT(val)
Functions
static int rte_atomic16_cmpset (volatile uint16_t dst, uint16_t exp, uint16_t src)
static void rte_atomic16_init (rte_atomic16_t v)
static int16_t rte_atomic16_read (const rte_atomic16_t v)
static void rte_atomic16_set (rte_atomic16_t v, int16_t new_value)
static void rte_atomic16_add (rte_atomic16_t v, int16_t inc)
static void rte_atomic16_sub (rte_atomic16_t v, int16_t dec)
static void rte_atomic16_inc (rte_atomic16_t v)
static void rte_atomic16_dec (rte_atomic16_t v)
static int16_t rte_atomic16_add_return (rte_atomic16_t v, int16_t inc)
static int16_t rte_atomic16_sub_return (rte_atomic16_t v, int16_t dec)
static int rte_atomic16_inc_and_test (rte_atomic16_t v)
static int rte_atomic16_dec_and_test (rte_atomic16_t v)
static int rte_atomic16_test_and_set (rte_atomic16_t v)
static void rte_atomic16_clear (rte_atomic16_t v)
static int rte_atomic32_cmpset (volatile uint32_t dst, uint32_t exp, uint32_t src)
static void rte_atomic32_init (rte_atomic32_t v)
static int32_t rte_atomic32_read (const rte_atomic32_t v)
static void rte_atomic32_set (rte_atomic32_t v, int32_t new_value)
static void rte_atomic32_add (rte_atomic32_t v, int32_t inc)
static void rte_atomic32_sub (rte_atomic32_t v, int32_t dec)
static void rte_atomic32_inc (rte_atomic32_t v)
static void rte_atomic32_dec (rte_atomic32_t v)
static int32_t rte_atomic32_add_return (rte_atomic32_t v, int32_t inc)
static int32_t rte_atomic32_sub_return (rte_atomic32_t v, int32_t dec)
static int rte_atomic32_inc_and_test (rte_atomic32_t v)
static int rte_atomic32_dec_and_test (rte_atomic32_t v)
static int rte_atomic32_test_and_set (rte_atomic32_t v)
static void rte_atomic32_clear (rte_atomic32_t v)
static int rte_atomic64_cmpset (volatile uint64_t dst, uint64_t exp, uint64_t src)
static void rte_atomic64_init (rte_atomic64_t v)
static int64_t rte_atomic64_read (rte_atomic64_t v)
static void rte_atomic64_set (rte_atomic64_t v, int64_t new_value)
static void rte_atomic64_add (rte_atomic64_t v, int64_t inc)
static void rte_atomic64_sub (rte_atomic64_t v, int64_t dec)
static void rte_atomic64_inc (rte_atomic64_t v)
static void rte_atomic64_dec (rte_atomic64_t v)
static int64_t rte_atomic64_add_return (rte_atomic64_t v, int64_t inc)
static int64_t rte_atomic64_sub_return (rte_atomic64_t v, int64_t dec)
static int rte_atomic64_inc_and_test (rte_atomic64_t v)
static int rte_atomic64_dec_and_test (rte_atomic64_t v)
static int rte_atomic64_test_and_set (rte_atomic64_t v)
static void rte_atomic64_clear (rte_atomic64_t v)
November 2012
Reference Number: 326004-001
3.2.1
Detailed Description
Atomic Operations
This file defines a generic API for atomic operations. The implementation is architecture-specific.
See lib/librte_eal/common/include/i686/arch/rte_atomic.h See lib/librte_eal/common/include/x86_64/arch/rte_atomic.h
3.2.2
Define Documentation
3.2.2.1
3.2.2.2
3.2.2.3
3.2.2.4
3.2.2.5
3.2.2.6
November 2012
Reference Number: 326004-001
3.2.3
Function Documentation
3.2.3.1
static int rte atomic16 cmpset ( volatile uint16 t dst, uint16 t exp, uint16 t src ) [static]
Returns
Non-zero on success; 0 on failure.
3.2.3.2
3.2.3.3
Returns
The value of the counter.
3.2.3.4
static void rte atomic16 set ( rte_atomic16_t v, int16 t new value ) [static]
November 2012
Reference Number: 326004-001
3.2.3.5
3.2.3.6
3.2.3.7
3.2.3.8
3.2.3.9
static int16 t rte atomic16 add return ( rte_atomic16_t v, int16 t inc ) [static]
November 2012
Reference Number: 326004-001
Returns
The value of v after the addition.
3.2.3.10
static int16 t rte atomic16 sub return ( rte_atomic16_t v, int16 t dec ) [static]
Atomically subtract a 16-bit value from a counter and return the result.
Atomically subtracts the 16-bit value (inc) from the atomic counter (v) and returns the value of v after the
subtraction.
Parameters
v A pointer to the atomic counter.
dec The value to be subtracted from the counter.
Returns
The value of v after the subtraction.
3.2.3.11
Returns
True if the result after the increment operation is 0; false otherwise.
3.2.3.12
November 2012
Reference Number: 326004-001
Returns
True if the result after the decrement operation is 0; false otherwise.
3.2.3.13
Returns
0 if failed; else 1, success.
3.2.3.14
3.2.3.15
static int rte atomic32 cmpset ( volatile uint32 t dst, uint32 t exp, uint32 t src ) [static]
Returns
Non-zero on success; 0 on failure.
November 2012
Reference Number: 326004-001
3.2.3.16
3.2.3.17
Returns
The value of the counter.
3.2.3.18
static void rte atomic32 set ( rte_atomic32_t v, int32 t new value ) [static]
3.2.3.19
3.2.3.20
November 2012
Reference Number: 326004-001
Parameters
v A pointer to the atomic counter.
dec The value to be subtracted from the counter.
3.2.3.21
3.2.3.22
3.2.3.23
static int32 t rte atomic32 add return ( rte_atomic32_t v, int32 t inc ) [static]
Returns
The value of v after the addition.
3.2.3.24
static int32 t rte atomic32 sub return ( rte_atomic32_t v, int32 t dec ) [static]
Atomically subtract a 32-bit value from a counter and return the result.
Atomically subtracts the 32-bit value (inc) from the atomic counter (v) and returns the value of v after the
subtraction.
November 2012
Reference Number: 326004-001
Parameters
v A pointer to the atomic counter.
dec The value to be subtracted from the counter.
Returns
The value of v after the subtraction.
3.2.3.25
Returns
True if the result after the increment operation is 0; false otherwise.
3.2.3.26
Returns
True if the result after the decrement operation is 0; false otherwise.
3.2.3.27
November 2012
Reference Number: 326004-001
Parameters
v A pointer to the atomic counter.
Returns
0 if failed; else 1, success.
3.2.3.28
3.2.3.29
static int rte atomic64 cmpset ( volatile uint64 t dst, uint64 t exp, uint64 t src ) [static]
An atomic compare and set function used by the mutex functions. (atomic) equivalent to: if (dst == exp)
dst = src (all 64-bit words)
Parameters
dst The destination into which the value will be written.
exp The expected value.
src The new value.
Returns
Non-zero on success; 0 on failure.
3.2.3.30
3.2.3.31
November 2012
Reference Number: 326004-001
Parameters
v A pointer to the atomic counter.
Returns
The value of the counter.
3.2.3.32
static void rte atomic64 set ( rte_atomic64_t v, int64 t new value ) [static]
3.2.3.33
3.2.3.34
3.2.3.35
November 2012
Reference Number: 326004-001
3.2.3.36
3.2.3.37
static int64 t rte atomic64 add return ( rte_atomic64_t v, int64 t inc ) [static]
Returns
The value of v after the addition.
3.2.3.38
static int64 t rte atomic64 sub return ( rte_atomic64_t v, int64 t dec ) [static]
Subtract a 64-bit value from an atomic counter and return the result.
Atomically subtracts the 64-bit value (dec) from the atomic counter (v) and returns the value of v after the
subtraction.
Parameters
v A pointer to the atomic counter.
dec The value to be subtracted from the counter.
Returns
The value of v after the subtraction.
3.2.3.39
November 2012
Reference Number: 326004-001
Parameters
v A pointer to the atomic counter.
Returns
True if the result after the addition is 0; false otherwise.
3.2.3.40
Returns
True if the result after subtraction is 0; false otherwise.
3.2.3.41
Returns
0 if failed; else 1, success.
3.2.3.42
November 2012
Reference Number: 326004-001
3.3
Defines
#define likely(x)
#define unlikely(x)
3.3.1
Detailed Description
3.3.2
Define Documentation
3.3.2.1
#define likely( x )
3.3.2.2
#define unlikely( x )
3.4
Defines
#define rte_bswap16(x)
#define rte_bswap32(x)
#define rte_bswap64(x)
#define rte_cpu_to_le_16(x)
#define rte_cpu_to_le_32(x)
#define rte_cpu_to_le_64(x)
#define rte_cpu_to_be_16(x)
#define rte_cpu_to_be_32(x)
#define rte_cpu_to_be_64(x)
#define rte_le_to_cpu_16(x)
#define rte_le_to_cpu_32(x)
November 2012
Reference Number: 326004-001
#define rte_le_to_cpu_64(x)
#define rte_be_to_cpu_16(x)
#define rte_be_to_cpu_32(x)
#define rte_be_to_cpu_64(x)
3.4.1
Detailed Description
3.4.2
Define Documentation
3.4.2.1
3.4.2.2
3.4.2.3
3.4.2.4
3.4.2.5
3.4.2.6
3.4.2.7
November 2012
Reference Number: 326004-001
3.4.2.8
3.4.2.9
3.4.2.10
3.4.2.11
3.4.2.12
3.4.2.13
3.4.2.14
3.4.2.15
3.5
Defines
#define __rte_unused
#define RTE_SET_USED(x)
#define RTE_PTR_ADD(ptr, x)
#define RTE_PTR_SUB(ptr, x)
November 2012
Reference Number: 326004-001
Functions
3.5.1
Detailed Description
Generic, commonly-used macro and inline function definitions for Intel DPDK.
3.5.2
Define Documentation
3.5.2.1
3.5.2.2
3.5.2.3
3.5.2.4
November 2012
Reference Number: 326004-001
3.5.2.5
get the difference between two pointer values, i.e. how far apart in bytes are the locations they point two. It
is assumed that ptr1 is greater than ptr2.
3.5.2.6
Macro to align a pointer to a given power-of-two. The resultant pointer will be a pointer of the same type as
the first parameter, and point to an address no higher than the first parameter. Second parameter must be
a power-of-two value.
3.5.2.7
Macro to align a pointer to a given power-of-two. The resultant pointer will be a pointer of the same type as
the first parameter, and point to an address no lower than the first parameter. Second parameter must be a
power-of-two value.
3.5.2.8
Macro to align a pointer to a given power-of-two. The resultant pointer will be a pointer of the same type as
the first parameter, and point to an address no lower than the first parameter. Second parameter must be a
power-of-two value. This function is the same as RTE_ALIGN_CEIL
3.5.2.9
November 2012
Reference Number: 326004-001
3.5.3
Function Documentation
3.5.3.1
static uintptr t rte align floor int ( uintptr t ptr, uintptr t align ) [static]
Function which rounds an unsigned int down to a given power-of-two value. Takes uintptr_t types as
parameters, as this type of operation is most commonly done for pointer alignment. (See also RTE_ALIGN_FLOOR, RTE_ALIGN_CEIL, RTE_ALIGN, RTE_PTR_ALIGN_FLOOR, RTE_PTR_ALIGN_CEL, RTE_PTR_ALIGN macros)
Parameters
ptr The value to be rounded down
align The power-of-two of which the result must be a multiple.
Returns
Function returns a properly aligned value where align is a power-of-two. If align is not a power-of-two,
result will be incorrect.
3.5.3.2
Returns
True(1) where the pointer is correctly aligned, false(0) otherwise
3.5.3.3
Returns
1 if true, 0 otherwise
November 2012
Reference Number: 326004-001
3.5.3.4
Returns
Input parameter aligned to the next power of 2
3.5.3.5
3.5.3.6
Converts a numeric string to the equivalent uint64_t value. As well as straight number conversion, also
recognises the suffixes k, m and g for kilobytes, megabytes and gigabytes respectively.
If a negative number is passed in i.e. a string with the first non-black character being "-", zero is returned.
Zero is also returned in the case of an error with the strtoull call in the function.
Parameters
str String containing number to convert.
Returns
Number.
3.5.3.7
void rte exit ( int exit code, const char format, ... )
Function to terminate the application immediately, printing an error message and returning the exit_code
back to the shell.
This function never returns
Parameters
exit_code The exit code to be returned by the application
format The format string to be used for printing the message. This can include printf format
characters which will be expanded using any further parameters to the function.
November 2012
Reference Number: 326004-001
3.6
Enumerations
enum rte_cpu_flag_t { RTE_CPUFLAG_SSE3, RTE_CPUFLAG_PCLMULQDQ, RTE_CPUFLAG_DTES64, RTE_CPUFLAG_MONITOR, RTE_CPUFLAG_DS_CPL, RTE_CPUFLAG_VMX, RTE_CPUFLAG_SMX, RTE_CPUFLAG_EIST, RTE_CPUFLAG_TM2, RTE_CPUFLAG_SSSE3, RTE_CPUFLAG_CNXT_ID, RTE_CPUFLAG_FMA, RTE_CPUFLAG_CMPXCHG16B, RTE_CPUFLAG_XTPR,
RTE_CPUFLAG_PDCM, RTE_CPUFLAG_PCID, RTE_CPUFLAG_DCA, RTE_CPUFLAG_SSE4_1, RTE_CPUFLAG_SSE4_2, RTE_CPUFLAG_X2APIC, RTE_CPUFLAG_MOVBE, RTE_CPUFLAG_POPCNT, RTE_CPUFLAG_TSC_DEADLINE, RTE_CPUFLAG_AES, RTE_CPUFLAG_XSAVE,
RTE_CPUFLAG_OSXSAVE, RTE_CPUFLAG_AVX, RTE_CPUFLAG_F16C, RTE_CPUFLAG_RDRAND, RTE_CPUFLAG_FPU, RTE_CPUFLAG_VME, RTE_CPUFLAG_DE, RTE_CPUFLAG_PSE,
RTE_CPUFLAG_TSC, RTE_CPUFLAG_MSR, RTE_CPUFLAG_PAE, RTE_CPUFLAG_MCE, RTE_CPUFLAG_CX8, RTE_CPUFLAG_APIC, RTE_CPUFLAG_SEP, RTE_CPUFLAG_MTRR, RTE_CPUFLAG_PGE, RTE_CPUFLAG_MCA, RTE_CPUFLAG_CMOV, RTE_CPUFLAG_PAT, RTE_CPUFLAG_PSE36, RTE_CPUFLAG_PSN, RTE_CPUFLAG_CLFSH, RTE_CPUFLAG_DS, RTE_CPUFLAG_ACPI, RTE_CPUFLAG_MMX, RTE_CPUFLAG_FXSR, RTE_CPUFLAG_SSE, RTE_CPUFLAG_SSE2, RTE_CPUFLAG_SS, RTE_CPUFLAG_HTT, RTE_CPUFLAG_TM, RTE_CPUFLAG_PBE,
RTE_CPUFLAG_DIGTEMP, RTE_CPUFLAG_TRBOBST, RTE_CPUFLAG_ARAT, RTE_CPUFLAG_PLN, RTE_CPUFLAG_ECMD, RTE_CPUFLAG_PTM, RTE_CPUFLAG_MPERF_APERF_MSR,
RTE_CPUFLAG_ACNT2, RTE_CPUFLAG_ENERGY_EFF, RTE_CPUFLAG_FSGSBASE, RTE_CPUFLAG_BMI1, RTE_CPUFLAG_AVX2, RTE_CPUFLAG_SMEP, RTE_CPUFLAG_BMI2, RTE_CPUFLAG_ERMS, RTE_CPUFLAG_INVPCID, RTE_CPUFLAG_LAHF_SAHF, RTE_CPUFLAG_LZCNT, RTE_CPUFLAG_SYSCALL, RTE_CPUFLAG_XD, RTE_CPUFLAG_1GB_PG, RTE_CPUFLAG_RDTSCP, RTE_CPUFLAG_EM64T, RTE_CPUFLAG_INVTSC, RTE_CPUFLAG_NUMFLAGS }
Functions
int rte_cpu_get_flag_enabled (enum rte_cpu_flag_t flag)
3.6.1
Detailed Description
3.6.2
3.6.2.1
enum rte_cpu_flag_t
November 2012
Reference Number: 326004-001
RTE_CPUFLAG_DTES64 DTES64
RTE_CPUFLAG_MONITOR MONITOR
RTE_CPUFLAG_DS_CPL DS_CPL
RTE_CPUFLAG_VMX VMX
RTE_CPUFLAG_SMX SMX
RTE_CPUFLAG_EIST EIST
RTE_CPUFLAG_TM2 TM2
RTE_CPUFLAG_SSSE3 SSSE3
RTE_CPUFLAG_CNXT_ID CNXT_ID
RTE_CPUFLAG_FMA FMA
RTE_CPUFLAG_CMPXCHG16B CMPXCHG16B
RTE_CPUFLAG_XTPR XTPR
RTE_CPUFLAG_PDCM PDCM
RTE_CPUFLAG_PCID PCID
RTE_CPUFLAG_DCA DCA
RTE_CPUFLAG_SSE4_1 SSE4_1
RTE_CPUFLAG_SSE4_2 SSE4_2
RTE_CPUFLAG_X2APIC X2APIC
RTE_CPUFLAG_MOVBE MOVBE
RTE_CPUFLAG_POPCNT POPCNT
RTE_CPUFLAG_TSC_DEADLINE TSC_DEADLINE
RTE_CPUFLAG_AES AES
RTE_CPUFLAG_XSAVE XSAVE
RTE_CPUFLAG_OSXSAVE OSXSAVE
RTE_CPUFLAG_AVX AVX
RTE_CPUFLAG_F16C F16C
RTE_CPUFLAG_RDRAND RDRAND
RTE_CPUFLAG_FPU FPU
RTE_CPUFLAG_VME VME
RTE_CPUFLAG_DE DE
RTE_CPUFLAG_PSE PSE
RTE_CPUFLAG_TSC TSC
RTE_CPUFLAG_MSR MSR
RTE_CPUFLAG_PAE PAE
RTE_CPUFLAG_MCE MCE
RTE_CPUFLAG_CX8 CX8
RTE_CPUFLAG_APIC APIC
RTE_CPUFLAG_SEP SEP
November 2012
Reference Number: 326004-001
RTE_CPUFLAG_MTRR MTRR
RTE_CPUFLAG_PGE PGE
RTE_CPUFLAG_MCA MCA
RTE_CPUFLAG_CMOV CMOV
RTE_CPUFLAG_PAT PAT
RTE_CPUFLAG_PSE36 PSE36
RTE_CPUFLAG_PSN PSN
RTE_CPUFLAG_CLFSH CLFSH
RTE_CPUFLAG_DS DS
RTE_CPUFLAG_ACPI ACPI
RTE_CPUFLAG_MMX MMX
RTE_CPUFLAG_FXSR FXSR
RTE_CPUFLAG_SSE SSE
RTE_CPUFLAG_SSE2 SSE2
RTE_CPUFLAG_SS SS
RTE_CPUFLAG_HTT HTT
RTE_CPUFLAG_TM TM
RTE_CPUFLAG_PBE PBE
RTE_CPUFLAG_DIGTEMP DIGTEMP
RTE_CPUFLAG_TRBOBST TRBOBST
RTE_CPUFLAG_ARAT ARAT
RTE_CPUFLAG_PLN PLN
RTE_CPUFLAG_ECMD ECMD
RTE_CPUFLAG_PTM PTM
RTE_CPUFLAG_MPERF_APERF_MSR MPERF_APERF_MSR
RTE_CPUFLAG_ACNT2 ACNT2
RTE_CPUFLAG_ENERGY_EFF ENERGY_EFF
RTE_CPUFLAG_FSGSBASE FSGSBASE
RTE_CPUFLAG_BMI1 BMI1
RTE_CPUFLAG_AVX2 AVX2
RTE_CPUFLAG_SMEP SMEP
RTE_CPUFLAG_BMI2 BMI2
RTE_CPUFLAG_ERMS ERMS
RTE_CPUFLAG_INVPCID INVPCID
RTE_CPUFLAG_LAHF_SAHF LAHF_SAHF
RTE_CPUFLAG_LZCNT LZCNT
RTE_CPUFLAG_SYSCALL SYSCALL
RTE_CPUFLAG_XD XD
November 2012
Reference Number: 326004-001
RTE_CPUFLAG_1GB_PG 1GB_PG
RTE_CPUFLAG_RDTSCP RDTSCP
RTE_CPUFLAG_EM64T EM64T
RTE_CPUFLAG_INVTSC INVTSC
RTE_CPUFLAG_NUMFLAGS This should always be the last!
3.6.3
Function Documentation
3.6.3.1
3.7
Functions
3.7.1
Detailed Description
3.7.2
Function Documentation
3.7.2.1
November 2012
Reference Number: 326004-001
3.7.2.2
3.7.2.3
3.7.2.4
3.7.2.5
3.8
Defines
#define rte_panic(format, args...)
November 2012
Reference Number: 326004-001
Functions
void rte_dump_stack (void)
void rte_dump_registers (void)
3.8.1
Detailed Description
3.8.2
Define Documentation
3.8.2.1
3.8.3
Function Documentation
3.8.3.1
3.8.3.2
3.9
Data Structures
struct rte_mem_config
November 2012
Reference Number: 326004-001
struct rte_config
Defines
#define RTE_VERSION
#define RTE_MAGIC
Enumerations
enum rte_lcore_role_t
enum rte_proc_type_t
Functions
3.9.1
Detailed Description
3.9.2
Define Documentation
3.9.2.1
3.9.2.2
3.9.3
3.9.3.1
enum rte_lcore_role_t
November 2012
Reference Number: 326004-001
3.9.3.2
enum rte_proc_type_t
3.9.4
Function Documentation
3.9.4.1
3.9.4.2
3.9.4.3
3.9.4.4
November 2012
Reference Number: 326004-001
Parameters
argc The argc argument that was given to the main() function.
argv The argv argument that was given to the main() function.
Returns
On success, the number of parsed arguments, which is greater or equal to zero. After the call to
rte_eal_init(), all arguments argv[x] with x < ret may be modified and should not be accessed by
the application.
On failure, a negative error value.
3.10
Defines
#define rte_errno
#define __ELASTERROR
Enumerations
enum { RTE_MIN_ERRNO, E_RTE_SECONDARY, E_RTE_NO_CONFIG, E_RTE_NO_TAILQ, RTE_MAX_ERRNO }
Functions
RTE_DECLARE_PER_LCORE (int, _rte_errno)
const char rte_strerror (int errnum)
3.10.1
Detailed Description
3.10.2
Define Documentation
3.10.2.1
Error number value, stored per-thread, which can be queried after calls to certain functions to determine
why those functions failed.
Uses standard values from errno.h wherever possible, with a small number of additional possible values for
RTE-specific conditions.
November 2012
Reference Number: 326004-001
3.10.2.2
#define ELASTERROR
Check if we have a defined value for the max system-defined errno values. if no max defined, start from
1000 to prevent overlap with standard values
3.10.3
3.10.3.1
anonymous enum
Error types
Enumerator:
RTE_MIN_ERRNO Start numbering above std errno vals
E_RTE_SECONDARY Operation not allowed in secondary processes
E_RTE_NO_CONFIG Missing rte_config
E_RTE_NO_TAILQ Uninitialised TAILQ
RTE_MAX_ERRNO Max RTE error number
3.10.4
Function Documentation
3.10.4.1
3.10.4.2
Function which returns a printable string describing a particular error code. For non-RTE-specific error
codes, this function returns the value from the libc strerror function.
Parameters
errnum The error number to be looked up - generally the value of rte_errno
Returns
A pointer to a thread-local string containing the text describing the error.
3.11
Data Structures
struct rte_eth_stats
November 2012
Reference Number: 326004-001
struct rte_eth_link
struct rte_eth_thresh
struct rte_eth_rxmode
struct rte_eth_rss_conf
struct rte_eth_vmdq_dcb_conf
struct rte_eth_txmode
struct rte_eth_rxconf
struct rte_eth_txconf
struct rte_eth_fc_conf
struct rte_fdir_conf
struct rte_fdir_filter
struct rte_fdir_masks
struct rte_eth_fdir
struct rte_intr_conf
struct rte_eth_conf
struct rte_eth_dev_info
struct eth_dev_ops
struct rte_eth_dev
struct rte_eth_dev_data
struct eth_driver
Defines
#define ETH_LINK_SPEED_AUTONEG
#define ETH_LINK_SPEED_10
#define ETH_LINK_SPEED_100
#define ETH_LINK_SPEED_1000
#define ETH_LINK_SPEED_10000
#define ETH_LINK_AUTONEG_DUPLEX
#define ETH_LINK_HALF_DUPLEX
#define ETH_LINK_FULL_DUPLEX
#define ETH_RSS_IPV4
#define ETH_RSS_IPV4_TCP
#define ETH_RSS_IPV6
#define ETH_RSS_IPV6_EX
#define ETH_RSS_IPV6_TCP
#define ETH_RSS_IPV6_TCP_EX
#define ETH_RSS_IPV4_UDP
#define ETH_RSS_IPV6_UDP
#define ETH_RSS_IPV6_UDP_EX
#define ETH_VMDQ_MAX_VLAN_FILTERS
#define ETH_DCB_NUM_USER_PRIORITIES
#define ETH_VMDQ_DCB_NUM_QUEUES
#define RTE_LIBRTE_82576_PMD
#define RTE_LIBRTE_82599_PMD
November 2012
Reference Number: 326004-001
Typedefs
typedef int( eth_dev_configure_t )(struct rte_eth_dev dev, uint16_t nb_rx_q, uint16_t nb_tx_q)
typedef int( eth_dev_start_t )(struct rte_eth_dev dev)
typedef void( eth_dev_stop_t )(struct rte_eth_dev dev)
typedef void( eth_dev_close_t )(struct rte_eth_dev dev)
typedef void( eth_promiscuous_enable_t )(struct rte_eth_dev dev)
typedef void( eth_promiscuous_disable_t )(struct rte_eth_dev dev)
typedef void( eth_allmulticast_enable_t )(struct rte_eth_dev dev)
typedef void( eth_allmulticast_disable_t )(struct rte_eth_dev dev)
typedef int( eth_link_update_t )(struct rte_eth_dev dev, int wait_to_complete)
typedef void( eth_stats_get_t )(struct rte_eth_dev dev, struct rte_eth_stats igb_stats)
typedef void( eth_stats_reset_t )(struct rte_eth_dev dev)
typedef void( eth_dev_infos_get_t )(struct rte_eth_dev dev, struct rte_eth_dev_info dev_info)
typedef int( eth_rx_queue_setup_t )(struct rte_eth_dev dev, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf rx_conf, struct rte_mempool mb_pool)
typedef int( eth_tx_queue_setup_t )(struct rte_eth_dev dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf tx_conf)
typedef void( vlan_filter_set_t )(struct rte_eth_dev dev, uint16_t vlan_id, int on)
typedef uint16_t( eth_rx_burst_t )(struct igb_rx_queue rxq, struct rte_mbuf rx_pkts, uint16_t nb_pkts)
typedef uint16_t( eth_tx_burst_t )(struct igb_tx_queue txq, struct rte_mbuf tx_pkts, uint16_t nb_pkts)
typedef int( fdir_add_signature_filter_t )(struct rte_eth_dev dev, struct rte_fdir_filter fdir_ftr, uint8_t
rx_queue)
typedef int( fdir_update_signature_filter_t )(struct rte_eth_dev dev, struct rte_fdir_filter fdir_ftr,
uint8_t rx_queue)
typedef int( fdir_remove_signature_filter_t )(struct rte_eth_dev dev, struct rte_fdir_filter fdir_ftr)
typedef void( fdir_infos_get_t )(struct rte_eth_dev dev, struct rte_eth_fdir fdir)
typedef int( fdir_add_perfect_filter_t )(struct rte_eth_dev dev, struct rte_fdir_filter fdir_ftr, uint16_t
soft_id, uint8_t rx_queue, uint8_t drop)
typedef int( fdir_update_perfect_filter_t )(struct rte_eth_dev dev, struct rte_fdir_filter fdir_ftr, uint16_t soft_id, uint8_t rx_queue, uint8_t drop)
typedef int( fdir_remove_perfect_filter_t )(struct rte_eth_dev dev, struct rte_fdir_filter fdir_ftr, uint16_t soft_id)
typedef int( fdir_set_masks_t )(struct rte_eth_dev dev, struct rte_fdir_masks fdir_masks)
typedef int( flow_ctrl_set_t )(struct rte_eth_dev dev, struct rte_eth_fc_conf fc_conf)
typedef int( eth_dev_led_on_t )(struct rte_eth_dev dev)
typedef int( eth_dev_led_off_t )(struct rte_eth_dev dev)
typedef void( eth_mac_addr_remove_t )(struct rte_eth_dev dev, uint32_t index)
typedef void( eth_mac_addr_add_t )(struct rte_eth_dev dev, struct ether_addr mac_addr, uint32_t
index, uint32_t vmdq)
typedef int( eth_dev_init_t )(struct eth_driver eth_drv, struct rte_eth_dev eth_dev)
typedef void( rte_eth_dev_cb_fn )(uint8_t port_id, enum rte_eth_event_type event, void cb_arg)
November 2012
Reference Number: 326004-001
Enumerations
enum rte_eth_rx_mq_mode { ETH_RSS, ETH_VMDQ_DCB }
enum rte_eth_nb_pools { ETH_16_POOLS, ETH_32_POOLS }
enum rte_eth_fc_mode { RTE_FC_NONE, RTE_FC_RX_PAUSE, RTE_FC_TX_PAUSE, RTE_FC_FULL }
enum rte_fdir_mode { RTE_FDIR_MODE_NONE, RTE_FDIR_MODE_SIGNATURE, RTE_FDIR_MODE_PERFECT }
enum rte_fdir_pballoc_type { RTE_FDIR_PBALLOC_64K, RTE_FDIR_PBALLOC_128K, RTE_FDIR_PBALLOC_256K }
enum rte_fdir_status_mode { RTE_FDIR_NO_REPORT_STATUS, RTE_FDIR_REPORT_STATUS,
RTE_FDIR_REPORT_STATUS_ALWAYS }
enum rte_l4type { RTE_FDIR_L4TYPE_NONE, RTE_FDIR_L4TYPE_UDP, RTE_FDIR_L4TYPE_TCP, RTE_FDIR_L4TYPE_SCTP }
enum rte_iptype { RTE_FDIR_IPTYPE_IPV4, RTE_FDIR_IPTYPE_IPV6 }
enum rte_eth_event_type { RTE_ETH_EVENT_UNKNOWN, RTE_ETH_EVENT_INTR_LSC, RTE_ETH_EVENT_MAX }
Functions
November 2012
Reference Number: 326004-001
Variables
struct rte_eth_dev rte_eth_devices [ ]
3.11.1
Detailed Description
November 2012
Reference Number: 326004-001
The driver-oriented Ethernet API that exports a function allowing an Ethernet Poll Mode Driver (PMD)
to simultaneously register itself as an Ethernet device driver and as a PCI driver for a set of matching
PCI [Ethernet] devices classes.
By default, all the functions of the Ethernet Device API exported by a PMD are lock-free functions which
assume to not be invoked in parallel on different logical cores to work on the same target object. For
instance, the receive function of a PMD cannot be invoked in parallel on two logical cores to poll the same
RX queue [of the same port]. Of course, this function can be invoked in parallel by different logical cores on
different RX queues. It is the responsibility of the upper level application to enforce this rule.
If needed, parallel accesses by multiple logical cores to shared queues shall be explicitly protected by
dedicated inline lock-aware functions built on top of their corresponding lock-free functions of the PMD API.
In all functions of the Ethernet API, the Ethernet device is designated by an integer >= 0 named the device
port identifier.
At the Ethernet driver level, Ethernet devices are represented by a generic data structure of type rte_eth_dev.
Ethernet devices are dynamically registered during the PCI probing phase performed at EAL initialization
time. When an Ethernet device is being probed, an rte_eth_dev structure and a new port identifier are
allocated for that device. Then, the eth_dev_init() function supplied by the Ethernet driver matching the
probed PCI device is invoked to properly initialize the device.
The role of the device init function consists of resetting the hardware, checking access to Non-volatile Memory (NVM), reading the MAC address from NVM etc.
If the device init operation is successful, the correspondence between the port identifier assigned to the new
device and its associated rte_eth_dev structure is effectively registered. Otherwise, both the rte_eth_dev structure and the port identifier are freed.
The functions exported by the application Ethernet API to setup a device designated by its port identifier
must be invoked in the following order:
rte_eth_dev_configure()
rte_eth_tx_queue_setup()
rte_eth_rx_queue_setup()
rte_eth_dev_start()
Then, the network application can invoke, in any order, the functions exported by the Ethernet API to get the
MAC address of a given device, to get the speed and the status of a device physical link, to receive/transmit
[burst of] packets, and so on.
If the application wants to change the configuration (i.e. call rte_eth_dev_configure(), rte_eth_tx_queue_setup(), or rte_eth_rx_queue_setup()), it must call rte_eth_dev_stop() first to stop the device and then do
the reconfiguration before calling rte_eth_dev_start() again. The tramsit and receive functions should not be
invoked when the device is stopped.
Please note that some configuration is not stored between calls to rte_eth_dev_stop()/rte_eth_dev_start().
The following configuration will be retained:
flow control settings
November 2012
Reference Number: 326004-001
receive mode configuration (promiscuous mode, hardware checksum mode, RSS/VMDQ settings etc.)
VLAN filtering configuration
MAC addresses supplied to MAC address array
flow director filtering mode (but not filtering rules)
Any other configuration will not be stored and will need to be re-entered after a call to rte_eth_dev_start().
Finally, a network application can close an Ethernet device by invoking the rte_eth_dev_close() function.
Each function of the application Ethernet API invokes a specific function of the PMD that controls the target
device designated by its port identifier. For this purpose, all device-specific functions of an Ethernet driver
are supplied through a set of pointers contained in a generic structure of type eth_dev_ops. The address
of the eth_dev_ops structure is stored in the rte_eth_dev structure by the device init function of the
Ethernet driver, which is invoked during the PCI probing phase, as explained earlier.
In other words, each function of the Ethernet API simply retrieves the rte_eth_dev structure associated
with the device port identifier and performs an indirect invocation of the corresponding driver function
supplied in the eth_dev_ops structure of the rte_eth_dev structure.
For performance reasons, the address of the burst-oriented RX and TX functions of the Ethernet driver
are not contained in the eth_dev_ops structure. Instead, they are directly stored at the beginning of the
rte_eth_dev structure to avoid an extra indirect memory access during their invocation.
RTE ethernet device drivers do not use interrupts for transmitting or receiving. Instead, Ethernet drivers
export Poll-Mode receive and transmit functions to applications. Both receive and transmit functions are
packet-burst oriented to minimize their cost per packet through the following optimizations:
Sharing among multiple packets the incompressible cost of the invocation of receive/transmit functions.
Enabling receive/transmit functions to take advantage of burst-oriented hardware features (L1 cache,
prefetch instructions, NIC head/tail registers) to minimize the number of CPU cycles per packet, for
instance, by avoiding useless read memory accesses to ring descriptors, or by systematically using
arrays of pointers that exactly fit L1 cache line boundaries and sizes.
The burst-oriented receive function does not provide any error notification, to avoid the corresponding
overhead. As a hint, the upper-level application might check the status of the device link once being
systematically returned a 0 value by the receive function of the driver for a given number of tries.
3.11.2
Define Documentation
3.11.2.1
3.11.2.2
10 megabits/second.
November 2012
Reference Number: 326004-001
3.11.2.3
100 megabits/second.
3.11.2.4
1 gigabits/second.
3.11.2.5
10 gigabits/second.
3.11.2.6
Auto-negotiate duplex.
3.11.2.7
Half-duplex connection.
3.11.2.8
Full-duplex connection.
3.11.2.9
IPv4 packet.
3.11.2.10
IPv4/TCP packet.
3.11.2.11
IPv6 packet.
3.11.2.12
November 2012
Reference Number: 326004-001
3.11.2.13
IPv6/TCP packet.
3.11.2.14
3.11.2.15
IPv4/UDP packet.
3.11.2.16
IPv6/UDP packet.
3.11.2.17
3.11.2.18
3.11.2.19
3.11.2.20
3.11.2.21
Deprecated The config file option CONFIG_RTE_LIBRTE_82576_PMD and resulting preprocessor define
RTE_LIBRTE_82576_PMD are deprecated. CONFIG_RTE_LIBRTE_IGB_PMD must be set
in the config file to use Intel(R) DPDK supported Gigabit Ethernet Controllers, and RTE_LIBRTE_IGB_PMD should be used in code.
November 2012
Reference Number: 326004-001
3.11.2.22
Deprecated The config file option CONFIG_RTE_LIBRTE_82599_PMD and resulting preprocessor define
RTE_LIBRTE_82599_PMD are deprecated. CONFIG_RTE_LIBRTE_IXGBE_PMD must be
set in the config file to use Intel(R) DPDK supported Gigabit Ethernet Controllers, and RTE_LIBRTE_IXGBE_PMD should be used in code.
3.11.3
Typedef Documentation
3.11.3.1
3.11.3.2
3.11.3.3
3.11.3.4
3.11.3.5
3.11.3.6
3.11.3.7
3.11.3.8
November 2012
Reference Number: 326004-001
3.11.3.9
Get link speed, duplex mode and state (up/down) of an Ethernet device.
3.11.3.10
3.11.3.11
3.11.3.12
3.11.3.13
3.11.3.14
3.11.3.15
typedef void( vlan_filter_set_t)(struct rte_eth_dev dev, uint16 t vlan id, int on)
3.11.3.16
typedef uint16 t( eth_rx_burst_t)(struct igb rx queue rxq, struct rte_mbuf rx pkts, uint16 t nb pkts)
3.11.3.17
typedef uint16 t( eth_tx_burst_t)(struct igb tx queue txq, struct rte_mbuf tx pkts, uint16 t nb pkts)
November 2012
Reference Number: 326004-001
3.11.3.18
3.11.3.19
3.11.3.20
3.11.3.21
3.11.3.22
3.11.3.23
3.11.3.24
3.11.3.25
3.11.3.26
November 2012
Reference Number: 326004-001
3.11.3.27
3.11.3.28
3.11.3.29
3.11.3.30
typedef void( eth_mac_addr_add_t)(struct rte_eth_dev dev, struct ether_addr mac addr, uint32 t
index, uint32 t vmdq)
3.11.3.31
typedef int( eth_dev_init_t)(struct eth_driver eth drv, struct rte_eth_dev eth dev)
Initialization function of an Ethernet driver invoked for each matching Ethernet PCI device detected during
the PCI probing phase.
Parameters
eth_drv The pointer to the [matching] Ethernet driver structure supplied by the PMD when it
registered itself.
eth_dev The eth_dev pointer is the address of the rte_eth_dev structure associated with
the matching device and which have been [automatically] allocated in the rte_eth_devices array. The eth_dev structure is supplied to the driver initialization function
with the following fields already initialized:
pci_dev: Holds the pointers to the rte_pci_device structure which contains the generic PCI
information of the matching device.
dev_private: Holds a pointer to the device private data structure.
max_frame_size: Contains the default Ethernet maximum frame length (1518).
port_id: Contains the port index of the device (actually the index of the eth_dev structure in the
rte_eth_devices array).
November 2012
Reference Number: 326004-001
Returns
0: Success, the device is properly initialized by the driver. In particular, the driver MUST have set
up the dev_ops pointer of the eth_dev structure.
<0: Error code of the device initialization failure.
3.11.3.32
typedef void( rte_eth_dev_cb_fn)(uint8 t port id, enum rte_eth_event_type event, void cb arg)
3.11.4
3.11.4.1
enum rte_eth_rx_mq_mode
A set of values to identify what method is to be used to route packets to multiple queues.
Enumerator:
ETH_RSS Default to RSS mode
ETH_VMDQ_DCB Use VMDQ+DCB to route traffic to queues
3.11.4.2
enum rte_eth_nb_pools
This enum indicates the possible number of queue pools in VMDQ+DCB configurations.
Enumerator:
ETH_16_POOLS 16 pools with DCB.
ETH_32_POOLS 32 pools with DCB.
3.11.4.3
enum rte_eth_fc_mode
November 2012
Reference Number: 326004-001
3.11.4.4
enum rte_fdir_mode
3.11.4.5
enum rte_fdir_pballoc_type
Memory space that can be configured to store Flow Director filters in the board memory.
Enumerator:
RTE_FDIR_PBALLOC_64K 64k.
RTE_FDIR_PBALLOC_128K 128k.
RTE_FDIR_PBALLOC_256K 256k.
3.11.4.6
enum rte_fdir_status_mode
3.11.4.7
enum rte_l4type
November 2012
Reference Number: 326004-001
3.11.4.8
enum rte_iptype
3.11.4.9
enum rte_eth_event_type
The eth device event type for interrupt, and maybe others in the future.
Enumerator:
RTE_ETH_EVENT_UNKNOWN unknown event type
RTE_ETH_EVENT_INTR_LSC lsc interrupt event
RTE_ETH_EVENT_MAX max value of this enum
3.11.5
Function Documentation
3.11.5.1
TAILQ HEAD ( rte eth dev cb list , rte eth dev callback )
3.11.5.2
Get the total number of Ethernet devices that have been successfully initialized by the [matching] Ethernet
driver during the PCI probing phase. All devices whose port identifier is in the range [0, rte_eth_dev_count()
- 1] can be operated on by network applications.
Returns
The total number of usable Ethernet devices.
3.11.5.3
A function invoked by the initialization function of an Ethernet driver to simultaneously register itself as a PCI
driver and as an Ethernet Poll Mode Driver (PMD).
Parameters
eth_drv The pointer to the eth_driver structure associated with the Ethernet driver.
November 2012
Reference Number: 326004-001
3.11.5.4
The initialization function of the driver for Intel(r) IGB Gigabit Ethernet Controller devices. This function is
invoked once at EAL start time.
Returns
0 on success
3.11.5.5
The initialization function of the driver for 10Gbps Intel IXGBE Ethernet devices. Invoked once at EAL start
time.
Returns
0 on success
3.11.5.6
The initialization function of the driver for 10Gbps Intel IXGBE_VF Ethernet devices. Invoked once at EAL
start time.
Returns
0 on success
3.11.5.7
int rte eth dev configure ( uint8 t port id, uint16 t nb rx queue, uint16 t nb tx queue, const struct
rte_eth_conf eth conf )
Configure an Ethernet device. This function must be invoked first before any other function in the Ethernet
API. This function can also be re-invoked when a device is in the stopped state.
Parameters
port_id
nb_rx_queue
nb_tx_queue
eth_conf
November 2012
Reference Number: 326004-001
Embedding all configuration information in a single data structure is the more flexible method that allows the
addition of new features without changing the syntax of the API.
Returns
0: Success, device configured.
<0: Error code returned by the driver configuration function.
3.11.5.8
int rte eth rx queue setup ( uint8 t port id, uint16 t rx queue id, uint16 t nb rx desc, unsigned int
socket id, const struct rte_eth_rxconf rx conf, struct rte_mempool mb pool )
Returns
0: Success, receive queue correctly set up.
-EINVAL: The size of network buffers which can be allocated from the memory pool does not fit
the various buffer sizes allowed by the device controller.
-ENOMEM: Unable to allocate the receive ring descriptors or to allocate network memory buffers
from the memory pool when initializing receive descriptors.
3.11.5.9
int rte eth tx queue setup ( uint8 t port id, uint16 t tx queue id, uint16 t nb tx desc, unsigned int socket id,
const struct rte_eth_txconf tx conf )
November 2012
Reference Number: 326004-001
Parameters
port_id The port identifier of the Ethernet device.
tx_queue_id The index of the transmit queue to set up. The value must be in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
nb_tx_desc The number of transmit descriptors to allocate for the transmit ring.
socket_id The socket_id argument is the socket identifier in case of NUMA. Its value can be
SOCKET_ID_ANY if there is no NUMA constraint for the DMA memory allocated for
the transmit descriptors of the ring.
tx_conf The pointer to the configuration data to be used for the transmit queue. The tx_conf
structure contains the following data:
The tx_thresh structure with the values of the Prefetch, Host, and Write-Back
threshold registers of the transmit ring. When setting Write-Back threshold to the
value greater then zero, tx_rs_thresh value should be explicitly set to one.
The tx_free_thresh value indicates the [minimum] number of network buffers that
must be pending in the transmit ring to trigger their [implicit] freeing by the driver
transmit function.
The tx_rs_thresh value indicates the [minimum] number of transmit descriptors
that must be pending in the transmit ring before setting the RS bit on a descriptor
by the driver transmit function. The tx_rs_thresh value should be less or equal
then tx_free_thresh value, and both of them should be less then nb_tx_desc 3.
Note that setting tx_free_thresh or tx_rs_thresh value to 0 forces the transmit function to use default
values.
Returns
0: Success, the transmit queue is correctly set up.
-ENOMEM: Unable to allocate the transmit ring descriptors.
3.11.5.10
November 2012
Reference Number: 326004-001
3.11.5.11
Stop an Ethernet device. The device can be restarted with a call to rte_eth_dev_start()
Parameters
port_id The port identifier of the Ethernet device.
3.11.5.12
3.11.5.13
3.11.5.14
3.11.5.15
November 2012
Reference Number: 326004-001
(-1) on error
3.11.5.16
3.11.5.17
3.11.5.18
Returns
(1) if allmulticast is enabled
(0) if allmulticast is disabled.
(-1) on error
3.11.5.19
void rte eth link get ( uint8 t port id, struct rte_eth_link link )
Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX or FULL-DUPLEX) of the
physical link of an Ethernet device. It might need to wait up to 9 seconds in it.
Parameters
port_id The port identifier of the Ethernet device.
link A pointer to an rte_eth_link structure to be filled with the status, the speed and the
mode of the Ethernet device link.
November 2012
Reference Number: 326004-001
3.11.5.20
void rte eth link get nowait ( uint8 t port id, struct rte_eth_link link )
Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX or FULL-DUPLEX) of the
physical link of an Ethernet device. It is a no-wait version of rte_eth_link_get().
Parameters
port_id The port identifier of the Ethernet device.
link A pointer to an rte_eth_link structure to be filled with the status, the speed and the
mode of the Ethernet device link.
3.11.5.21
void rte eth stats get ( uint8 t port id, struct rte_eth_stats stats )
3.11.5.22
3.11.5.23
void rte eth macaddr get ( uint8 t port id, struct ether_addr mac addr )
November 2012
Reference Number: 326004-001
mac_addr A pointer to a structure of type ether_addr to be filled with the Ethernet address of the
Ethernet device.
void rte eth dev info get ( uint8 t port id, struct rte_eth_dev_info dev info )
3.11.5.24
3.11.5.25
int rte eth dev vlan filter ( uint8 t port id, uint16 t vlan id, int on )
Enable/Disable hardware filtering by an Ethernet device of received VLAN packets tagged with a given VLAN
Tag Identifier.
Parameters
port_id The port identifier of the Ethernet device.
vlan_id The VLAN Tag Identifier whose filtering must be enabled or disabled.
on If > 0, enable VLAN filtering of VLAN packets tagged with vlan_id. Otherwise, disable
VLAN filtering of VLAN packets tagged with vlan_id.
Returns
3.11.5.26
(0) if successful.
(-ENOSUP) if hardware-assisted VLAN filtering not configured.
(-ENODEV) if port_id invalid.
(-ENOSYS) if VLAN filtering on port_id disabled.
(-EINVAL) if vlan_id > 4095.
static uint16 t rte eth rx burst ( uint8 t port id, uint16 t queue id, struct rte_mbuf rx pkts, uint16 t
nb pkts ) [static]
Retrieve a burst of input packets from a receive queue of an Ethernet device. The retrieved packets are
stored in rte_mbuf structures whose pointers are supplied in the rx_pkts array.
The rte_eth_rx_burst() function loops, parsing the RX ring of the receive queue, up to nb_pkts packets,
and for each completed RX descriptor in the ring, it performs the following operations:
Initialize the rte_mbuf data structure associated with the RX descriptor according to the information
provided by the NIC into that RX descriptor.
November 2012
Reference Number: 326004-001
Store the rte_mbuf data structure into the next entry of the rx_pkts array.
Replenish the RX descriptor with a new rte_mbuf buffer allocated from the memory pool associated
with the receive queue at initialization time.
When retrieving an input packet that was scattered by the controller into multiple receive descriptors, the
rte_eth_rx_burst() function appends the associated rte_mbuf buffers to the first buffer of the packet.
The rte_eth_rx_burst() function returns the number of packets actually retrieved, which is the number of
rte_mbuf data structures effectively supplied into the rx_pkts array. A return value equal to nb_pkts indicates that the RX queue contained at least rx_pkts packets, and this is likely to signify that
other received packets remain in the input queue. Applications implementing a "retrieve as much received
packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function
until a value less than nb_pkts is returned.
This receive method has the following advantages:
It allows a run-to-completion network stack engine to retrieve and to immediately process received
packets in a fast burst-oriented approach, avoiding the overhead of unnecessary intermediate packet
queue/dequeue operations.
Conversely, it also allows an asynchronous-oriented processing method to retrieve bursts of received
packets and to immediately queue them for further parallel processing by another logical core, for
instance. However, instead of having received packets being individually queued by the driver, this
approach allows the invoker of the rte_eth_rx_burst() function to queue a burst of retrieved packets at
a time and therefore dramatically reduce the cost of enqueue/dequeue operations per packet.
It allows the rte_eth_rx_burst() function of the driver to take advantage of burst-oriented hardware
features (CPU cache, prefetch instructions, and so on) to minimize the number of CPU cycles per
packet.
To summarize, the proposed receive API enables many burst-oriented optimizations in both synchronous
and asynchronous packet processing environments with no overhead in both cases.
The rte_eth_rx_burst() function does not provide any error notification to avoid the corresponding overhead.
As a hint, the upper-level application might check the status of the device link once being systematically
returned a 0 value for a given number of tries.
Parameters
port_id The port identifier of the Ethernet device.
queue_id The index of the receive queue from which to retrieve input packets. The value must be
in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
rx_pkts The address of an array of pointers to rte_mbuf structures that must be large enough
to store nb_pkts pointers in it.
nb_pkts The maximum number of packets to retrieve.
November 2012
Reference Number: 326004-001
Returns
The number of packets actually retrieved, which is the number of pointers to rte_mbuf structures
effectively supplied to the rx_pkts array.
static uint16 t rte eth tx burst ( uint8 t port id, uint16 t queue id, struct rte_mbuf tx pkts, uint16 t
nb pkts ) [static]
3.11.5.27
November 2012
Reference Number: 326004-001
Returns
The number of output packets actually stored in transmit descriptors of the transmit ring. The return
value can be less than the value of the tx_pkts parameter when the transmit ring is full or has been
filled up.
int rte eth dev fdir add signature filter ( uint8 t port id, struct rte_fdir_filter fdir filter, uint8 t rx queue
)
3.11.5.28
Returns
(0) if successful.
(-ENOTSUP) if hardware doesnt support flow director mode.
(-ENODEV) if port_id invalid.
(-ENOSYS) if the FDIR mode is not configured in signature mode on port_id.
(-EINVAL) if the fdir_filter information is not correct.
int rte eth dev fdir update signature filter ( uint8 t port id, struct rte_fdir_filter fdir ftr, uint8 t rx queue
)
3.11.5.29
Update a signature filter rule on an Ethernet device. If the rule doesnt exits, it is created.
Parameters
port_id The port identifier of the Ethernet device.
fdir_ftr The pointer to the structure describing the signature filter rule. The rte_fdir_filter
structure includes the values of the different fields to match: source and destination
IP addresses, vlan id, flexbytes, source and destination ports, and so on.
rx_queue The index of the RX queue where to store RX packets matching the added signature
filter defined in fdir_ftr.
Returns
(0) if successful.
November 2012
Reference Number: 326004-001
3.11.5.30
int rte eth dev fdir remove signature filter ( uint8 t port id, struct rte_fdir_filter fdir ftr )
Returns
(0) if successful.
(-ENOTSUP) if hardware doesnt support flow director mode.
(-ENODEV) if port_id invalid.
(-ENOSYS) if the flow director mode is not configured in signature mode on port_id.
(-EINVAL) if the fdir_filter information is not correct.
3.11.5.31
int rte eth dev fdir get infos ( uint8 t port id, struct rte_eth_fdir fdir )
Returns
(0) if successful.
(-ENOTSUP) if hardware doesnt support flow director mode.
(-ENODEV) if port_id invalid.
(-ENOSYS) if the flow director mode is not configured on port_id.
November 2012
Reference Number: 326004-001
int rte eth dev fdir add perfect filter ( uint8 t port id, struct rte_fdir_filter fdir filter, uint16 t soft id,
uint8 t rx queue, uint8 t drop )
3.11.5.32
Returns
(0) if successful.
(-ENOTSUP) if hardware doesnt support flow director mode.
(-ENODEV) if port_id invalid.
(-ENOSYS) if the flow director mode is not configured in perfect mode on port_id.
(-EINVAL) if the fdir_filter information is not correct.
int rte eth dev fdir update perfect filter ( uint8 t port id, struct rte_fdir_filter fdir filter, uint16 t soft id,
uint8 t rx queue, uint8 t drop )
3.11.5.33
Update a perfect filter rule on an Ethernet device. If the rule doesnt exits, it is created.
Parameters
port_id The port identifier of the Ethernet device.
fdir_filter The pointer to the structure describing the perfect filter rule. The rte_fdir_filter
structure includes the values of the different fields to match: source and destination
IP addresses, vlan id, flexbytes, source and destination ports, and so on. IPv6 are not
supported.
soft_id The 16-bit value supplied in the field hash.fdir.id of mbuf for RX packets matching the
perfect filter.
rx_queue The index of the RX queue where to store RX packets matching the added perfect filter
defined in fdir_filter.
drop If drop is set to 1, matching RX packets are stored into the RX drop queue defined in
the rte_fdir_conf.
November 2012
Reference Number: 326004-001
Returns
(0) if successful.
(-ENOTSUP) if hardware doesnt support flow director mode.
(-ENODEV) if port_id invalid.
(-ENOSYS) if the flow director mode is not configured in perfect mode on port_id.
(-EINVAL) if the fdir_filter information is not correct.
int rte eth dev fdir remove perfect filter ( uint8 t port id, struct rte_fdir_filter fdir filter, uint16 t soft id
)
3.11.5.34
Returns
(0) if successful.
(-ENOTSUP) if hardware doesnt support flow director mode.
(-ENODEV) if port_id invalid.
(-ENOSYS) if the flow director mode is not configured in perfect mode on port_id.
(-EINVAL) if the fdir_filter information is not correct.
3.11.5.35
int rte eth dev fdir set masks ( uint8 t port id, struct rte_fdir_masks fdir mask )
Configure globally the masks for flow director mode for an Ethernet device. For example, the device can
match packets with only the first 24 bits of the IPv4 source address.
The following fields can be masked: IPv4 addresses and L4 port numbers. The following fields can be either
enabled or disabled completely for the matching functionality: VLAN ID tag; VLAN Priority + CFI bit; Flexible
2-byte tuple. IPv6 masks are not supported.
All filters must comply with the masks previously configured. For example, with a mask equal to 255.255.255.0 for the source IPv4 address, all IPv4 filters must be created with a source IPv4 address that fits the
"X.X.X.0" format.
This function flushes all filters that have been previously added in the device.
November 2012
Reference Number: 326004-001
Parameters
port_id The port identifier of the Ethernet device.
fdir_mask The pointer to the fdir mask structure describing relevant headers fields and relevant
bits to use when matching packets addresses and ports. IPv6 masks are not supported.
Returns
(0) if successful.
(-ENOTSUP) if hardware doesnt support flow director mode.
(-ENODEV) if port_id invalid.
(-ENOSYS) if the flow director mode is not configured in perfect mode on port_id.
(-EINVAL) if the fdir_filter information is not correct
3.11.5.36
int rte eth dev callback register ( uint8 t port id, enum rte_eth_event_type event,
rte_eth_dev_cb_fn cb fn, void cb arg )
Port id.
Event interested.
User supplied callback function to be called.
Pointer to the parameters for the registered callback.
Returns
On success, zero.
On failure, a negative value.
3.11.5.37
int rte eth dev callback unregister ( uint8 t port id, enum rte_eth_event_type event,
rte_eth_dev_cb_fn cb fn, void cb arg )
Port id.
Event interested.
User supplied callback function to be called.
Pointer to the parameters for the registered callback. -1 means to remove all for the
same callback address and same event.
November 2012
Reference Number: 326004-001
Returns
On success, zero.
On failure, a negative value.
3.11.5.38
void rte eth dev callback process ( struct rte_eth_dev dev, enum rte_eth_event_type event )
Executes all the user application registered callbacks for the specific device. It is for DPDK internal user
only. User application should not call it directly.
Parameters
dev Pointer to struct rte_eth_dev.
event Eth device interrupt event type.
Returns
void
3.11.5.39
Turn on the LED on the Ethernet device. This function turns on the LED on the Ethernet device.
Parameters
port_id The port identifier of the Ethernet device.
Returns
(0) if successful.
(-ENOTSUP) if underlying hardware OR driver doesnt support that operation.
(-ENODEV) if port_id invalid.
3.11.5.40
Turn off the LED on the Ethernet device. This function turns off the LED on the Ethernet device.
Parameters
port_id The port identifier of the Ethernet device.
Returns
(0) if successful.
November 2012
Reference Number: 326004-001
3.11.5.41
int rte eth dev flow ctrl set ( uint8 t port id, struct rte_eth_fc_conf fc conf )
Returns
(0) if successful.
(-ENOTSUP) if hardware doesnt support flow director mode.
(-ENODEV) if port_id invalid.
(-EINVAL) if bad parameter
(-EIO) if flow control setup failure
3.11.5.42
int rte eth dev mac addr add ( uint8 t port, struct ether_addr mac addr, uint32 t pool )
Add a MAC address to an internal array of addresses used to enable whitelist filtering to accept packets
only if the destination MAC address matches.
Parameters
port The port identifier of the Ethernet device.
mac_addr The MAC address to add.
pool VMDq pool index to associate address with (if VMDq is enabled). If VMDq is not enabled,
this should be set to 0.
Returns
(0) if successfully added or mac_addr" was already added.
(-ENOTSUP) if hardware doesnt support this feature.
(-ENODEV) if port is invalid.
(-ENOSPC) if no more MAC addresses can be added.
(-EINVAL) if MAC address is invalid.
November 2012
Reference Number: 326004-001
int rte eth dev mac addr remove ( uint8 t port, struct ether_addr mac addr )
3.11.5.43
Returns
(0) if successful, or mac_addr didnt exist.
(-ENOTSUP) if hardware doesnt support.
(-ENODEV) if port invalid.
(-EADDRINUSE) if attempting to remove the default MAC address
3.11.5.44
Deprecated rte_82576_pmd_init() is deprecated and will be removed from future versions of Intel(R) DPDK. It has been replaced by rte_igb_pmd_init().
Returns
0 on success
3.11.5.45
Deprecated rte_82599_pmd_init() is deprecated and will be removed from future versions of Intel(R) DPDK. It has been replaced by rte_ixgbe_pmd_init().
Returns
0 on success
3.11.6
Variable Documentation
3.11.6.1
The pool of rte_eth_dev structures. The size of the pool is configured at compile-time in the <rte_ethdev.c> file.
November 2012
Reference Number: 326004-001
3.12
Data Structures
struct ether_addr
struct ether_hdr
struct vlan_hdr
Defines
#define ETHER_ADDR_LEN
#define ETHER_TYPE_LEN
#define ETHER_CRC_LEN
#define ETHER_HDR_LEN
#define ETHER_MIN_LEN
#define ETHER_MAX_LEN
#define ETHER_MTU
#define ETHER_MAX_VLAN_FRAME_LEN
#define ETHER_MAX_JUMBO_FRAME_LEN
#define ETHER_LOCAL_ADMIN_ADDR
#define ETHER_GROUP_ADDR
#define ETHER_TYPE_IPv4
#define ETHER_TYPE_IPv6
#define ETHER_TYPE_ARP
#define ETHER_TYPE_RARP
#define ETHER_TYPE_VLAN
#define ETHER_TYPE_1588
Functions
3.12.1
Detailed Description
November 2012
Reference Number: 326004-001
3.12.2
Define Documentation
3.12.2.1
Ethernet MTU.
3.12.2.8
November 2012
Reference Number: 326004-001
3.12.2.11
3.12.2.12
IPv4 Protocol.
3.12.2.13
IPv6 Protocol.
3.12.2.14
Arp Protocol.
3.12.2.15
3.12.2.16
3.12.2.17
3.12.3
Function Documentation
3.12.3.1
Returns
True (1) if the given ethernet address is filled with zeros; false (0) otherwise.
November 2012
Reference Number: 326004-001
3.12.3.2
Returns
True (1) if the given ethernet address is a unicast address; false (0) otherwise.
3.12.3.3
Returns
True (1) if the given ethernet address is a multicast address; false (0) otherwise.
3.12.3.4
Returns
True (1) if the given ethernet address is a broadcast address; false (0) otherwise.
3.12.3.5
November 2012
Reference Number: 326004-001
Returns
True (1) if the given ethernet address is a universally assigned address; false (0) otherwise.
3.12.3.6
static int is local admin ether addr ( const struct ether_addr ea ) [static]
Returns
True (1) if the given ethernet address is a locally assigned address; false (0) otherwise.
3.12.3.7
static int is valid assigned ether addr ( const struct ether_addr ea ) [static]
Check if an Ethernet address is a valid address. Checks that the address is a unicast address and is not
filled with zeros.
Parameters
ea A pointer to a ether_addr structure containing the ethernet address to check.
Returns
True (1) if the given ethernet address is valid; false (0) otherwise.
3.12.3.8
static void ether addr copy ( const struct ether_addr ea from, struct ether_addr ea to ) [static]
3.13
Data Structures
struct rte_fbk_hash_params
November 2012
Reference Number: 326004-001
union rte_fbk_hash_entry
struct rte_fbk_hash_table
Defines
#define RTE_FBK_HASH_FUNC_DEFAULT
#define RTE_FBK_HASH_INIT_VAL_DEFAULT
#define RTE_FBK_HASH_ENTRIES_MAX
#define RTE_FBK_HASH_ENTRIES_PER_BUCKET_MAX
#define RTE_FBK_HASH_NAMESIZE
Typedefs
typedef uint32_t( rte_fbk_hash_fn )(uint32_t key, uint32_t init_val)
Functions
3.13.1
Detailed Description
3.13.2
Define Documentation
3.13.2.1
3.13.2.2
November 2012
Reference Number: 326004-001
3.13.2.3
3.13.2.4
3.13.2.5
3.13.3
Typedef Documentation
3.13.3.1
Type of function that can be used for calculating the hash value.
3.13.4
Function Documentation
3.13.4.1
static uint32 t rte fbk hash get bucket ( const struct rte_fbk_hash_table ht, uint32 t key )
[static]
Find the offset into hash table of the bucket containing a particular key.
Parameters
ht Pointer to hash table.
key Key to calculate bucket for.
Returns
Offset into hash table.
3.13.4.2
static int rte fbk hash add key ( struct rte_fbk_hash_table ht, uint32 t key, uint16 t value )
[static]
Add a key to an existing hash table. This operation is not multi-thread safe and should only be called from
one thread.
Parameters
ht Hash table to add the key to.
key Key to add to the hash table.
value Value to associate with key.
November 2012
Reference Number: 326004-001
Returns
0 if ok, or negative value on error.
3.13.4.3
static int rte fbk hash delete key ( struct rte_fbk_hash_table ht, uint32 t key ) [static]
Remove a key from an existing hash table. This operation is not multi-thread safe and should only be called
from one thread.
Parameters
ht Hash table to remove the key from.
key Key to remove from the hash table.
Returns
0 if ok, or negative value on error.
3.13.4.4
static int rte fbk hash lookup ( const struct rte_fbk_hash_table ht, uint32 t key ) [static]
Returns
The value that was associated with the key, or negative value on error.
3.13.4.5
static void rte fbk hash clear all ( struct rte_fbk_hash_table ht ) [static]
Delete all entries in a hash table. This operation is not multi-thread safe and should only be called from one
thread.
Parameters
ht Hash table to delete entries in.
3.13.4.6
static double rte fbk hash get load factor ( struct rte_fbk_hash_table ht ) [static]
November 2012
Reference Number: 326004-001
Parameters
ht Hash table to find how many entries are being used in.
Returns
Load factor of the hash table, or negative value on error.
3.13.4.7
struct rte_fbk_hash_table rte fbk hash find existing ( const char name ) [read]
Performs a lookup for an existing hash table, and returns a pointer to the table if found.
Parameters
name Name of the hash table to find
Returns
pointer to hash table structure or NULL on error with rte_errno set appropriately. Possible rte_errno
values include:
ENOENT - required entry not available to return.
3.13.4.8
struct rte_fbk_hash_table rte fbk hash create ( const struct rte_fbk_hash_params params )
[read]
Create a new hash table for use with four byte keys.
Parameters
params Parameters used in creation of hash table.
Returns
Pointer to hash table structure that is used in future hash table operations, or NULL on error with rte_errno set appropriately. Possible rte_errno error values include:
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
E_RTE_SECONDARY - function was called from a secondary process instance
E_RTE_NO_TAILQ - no tailq list could be got for the fbk hash table list
EINVAL - invalid parameter value passed to function
ENOSPC - the maximum number of memzones has already been allocated
EEXIST - a memzone with the same name already exists
ENOMEM - no appropriate memory area found in which to create memzone
November 2012
Reference Number: 326004-001
3.13.4.9
Free all memory used by a hash table. Has no effect on hash tables allocated in memory zones
Parameters
ht Hash table to deallocate.
3.14
Data Structures
struct rte_hash_parameters
struct rte_hash
Defines
#define RTE_HASH_ENTRIES_MAX
#define RTE_HASH_BUCKET_ENTRIES_MAX
#define RTE_HASH_KEY_LENGTH_MAX
#define RTE_HASH_LOOKUP_MULTI_MAX
#define RTE_HASH_NAMESIZE
Typedefs
typedef uint32_t hash_sig_t
typedef uint32_t( rte_hash_function )(const void key, uint32_t key_len, uint32_t init_val)
Functions
3.14.1
Detailed Description
November 2012
Reference Number: 326004-001
3.14.2
Define Documentation
3.14.2.1
3.14.2.2
3.14.2.3
3.14.2.4
3.14.2.5
3.14.3
Typedef Documentation
3.14.3.1
3.14.3.2
typedef uint32 t( rte_hash_function)(const void key, uint32 t key len, uint32 t init val)
Type of function that can be used for calculating the hash value.
3.14.4
Function Documentation
3.14.4.1
struct rte_hash rte hash create ( const struct rte_hash_parameters params ) [read]
Create a new hash table. If RTE_LIBRTE_HASH_USE_MEMZONE is defined, then the hash table is
allocated in a memzone on a specific NUMA socket ID, otherwise it is allocated in the heap.
November 2012
Reference Number: 326004-001
Parameters
params Parameters used to create and initialise the hash table.
Returns
Pointer to hash table structure that is used in future hash table operations, or NULL on error, with error
code set in rte_errno. Possible rte_errno errors include:
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
E_RTE_SECONDARY - function was called from a secondary process instance
E_RTE_NO_TAILQ - no tailq list could be got for the hash table list
ENOENT - missing entry
EINVAL - invalid parameter passed to function
ENOSPC - the maximum number of memzones has already been allocated
EEXIST - a memzone with the same name already exists
ENOMEM - no appropriate memory area found in which to create memzone
3.14.4.2
struct rte_hash rte hash find existing ( const char name ) [read]
Returns
Pointer to hash table or NULL if object not found with rte_errno set appropriately. Possible rte_errno
values include:
ENOENT - value not available for return
3.14.4.3
De-allocate all memory used by hash table. If RTE_LIBRTE_HASH_USE_MEMZONE is defined, then this
has no effect.
Parameters
h Hash table to free
November 2012
Reference Number: 326004-001
3.14.4.4
int32 t rte hash add key ( const struct rte_hash h, const void key )
Add a key to an existing hash table. This operation is not multi-thread safe and should only be called from
one thread.
Parameters
h Hash table to add the key to.
key Key to add to the hash table.
Returns
-EINVAL if the parameters are invalid.
-ENOSPC if there is no space in the hash for this key.
A positive value that can be used by the caller as an offset into an array of user data. This value is
unique for this key.
3.14.4.5
int32 t rte hash del key ( const struct rte_hash h, const void key )
Remove a key from an existing hash table. This operation is not multi-thread safe and should only be called
from one thread.
Parameters
h Hash table to remove the key from.
key Key to remove from the hash table.
Returns
-EINVAL if the parameters are invalid.
-ENOENT if the key is not found.
A positive value that can be used by the caller as an offset into an array of user data. This value is
unique for this key, and is the same value that was returned when the key was added.
3.14.4.6
int32 t rte hash lookup ( const struct rte_hash h, const void key )
November 2012
Reference Number: 326004-001
Returns
-EINVAL if the parameters are invalid.
-ENOENT if the key is not found.
A positive value that can be used by the caller as an offset into an array of user data. This value is
unique for this key, and is the same value that was returned when the key was added.
3.14.4.7
int rte hash lookup multi ( const struct rte_hash h, const void keys, uint32 t num keys, int32 t
positions )
Find multiple keys in the hash table. This operation is multi-thread safe.
Parameters
h
keys
num_keys
positions
Returns
-EINVAL if theres an error, otherwise 0.
3.15
Functions
static uint32_t rte_hash_crc_4byte (uint32_t data, uint32_t init_val)
static uint32_t rte_hash_crc (const void data, uint32_t data_len, uint32_t init_val)
3.15.1
Detailed Description
3.15.2
Function Documentation
3.15.2.1
static uint32 t rte hash crc 4byte ( uint32 t data, uint32 t init val ) [static]
November 2012
Reference Number: 326004-001
Parameters
data Data to perform hash on.
init_val Value to initialise hash generator.
Returns
32bit calculated hash value.
3.15.2.2
static uint32 t rte hash crc ( const void data, uint32 t data len, uint32 t init val ) [static]
Returns
32bit calculated hash value.
3.16
Typedefs
typedef void( rte_intr_callback_fn )(struct rte_intr_handle intr_handle, void cb_arg)
Functions
int rte_intr_callback_register (struct rte_intr_handle intr_handle, rte_intr_callback_fn cb, void cb_arg)
int rte_intr_callback_unregister (struct rte_intr_handle intr_handle, rte_intr_callback_fn cb, void cb_arg)
int rte_intr_enable (struct rte_intr_handle intr_handle)
int rte_intr_disable (struct rte_intr_handle intr_handle)
3.16.1
Detailed Description
The RTE interrupt interface provides functions to register/unregister callbacks for a specific interrupt.
November 2012
Reference Number: 326004-001
3.16.2
Typedef Documentation
3.16.2.1
typedef void( rte_intr_callback_fn)(struct rte intr handle intr handle, void cb arg)
3.16.3
Function Documentation
3.16.3.1
int rte intr callback register ( struct rte intr handle intr handle, rte_intr_callback_fn cb, void cb arg )
It registers the callback for the specific interrupt. Multiple callbacks cal be registered at the same time.
Parameters
intr_handle Pointer to the interrupt handle.
cb callback address.
cb_arg address of parameter for callback.
Returns
On success, zero.
On failure, a negative value.
3.16.3.2
int rte intr callback unregister ( struct rte intr handle intr handle, rte_intr_callback_fn cb, void
cb arg )
Returns
On success, return the number of callback entities removed.
On failure, a negative value.
3.16.3.3
int rte intr enable ( struct rte intr handle intr handle )
November 2012
Reference Number: 326004-001
Parameters
intr_handle pointer to the interrupt handle.
Returns
On success, zero.
On failure, a negative value.
int rte intr disable ( struct rte intr handle intr handle )
3.16.3.4
Returns
On success, zero.
On failure, a negative value.
3.17
Data Structures
struct ipv4_hdr
struct ipv6_hdr
Defines
#define IPv4(a, b, c, d)
#define IPPROTO_IP
#define IPPROTO_HOPOPTS
#define IPPROTO_ICMP
#define IPPROTO_IGMP
#define IPPROTO_GGP
#define IPPROTO_IPV4
#define IPPROTO_TCP
#define IPPROTO_ST
#define IPPROTO_EGP
#define IPPROTO_PIGP
#define IPPROTO_RCCMON
November 2012
Reference Number: 326004-001
#define IPPROTO_NVPII
#define IPPROTO_PUP
#define IPPROTO_ARGUS
#define IPPROTO_EMCON
#define IPPROTO_XNET
#define IPPROTO_CHAOS
#define IPPROTO_UDP
#define IPPROTO_MUX
#define IPPROTO_MEAS
#define IPPROTO_HMP
#define IPPROTO_PRM
#define IPPROTO_IDP
#define IPPROTO_TRUNK1
#define IPPROTO_TRUNK2
#define IPPROTO_LEAF1
#define IPPROTO_LEAF2
#define IPPROTO_RDP
#define IPPROTO_IRTP
#define IPPROTO_TP
#define IPPROTO_BLT
#define IPPROTO_NSP
#define IPPROTO_INP
#define IPPROTO_SEP
#define IPPROTO_3PC
#define IPPROTO_IDPR
#define IPPROTO_XTP
#define IPPROTO_DDP
#define IPPROTO_CMTP
#define IPPROTO_TPXX
#define IPPROTO_IL
#define IPPROTO_IPV6
#define IPPROTO_SDRP
#define IPPROTO_ROUTING
#define IPPROTO_FRAGMENT
#define IPPROTO_IDRP
#define IPPROTO_RSVP
#define IPPROTO_GRE
#define IPPROTO_MHRP
#define IPPROTO_BHA
#define IPPROTO_ESP
#define IPPROTO_AH
#define IPPROTO_INLSP
#define IPPROTO_SWIPE
#define IPPROTO_NHRP
#define IPPROTO_ICMPV6
#define IPPROTO_NONE
November 2012
Reference Number: 326004-001
#define IPPROTO_DSTOPTS
#define IPPROTO_AHIP
#define IPPROTO_CFTP
#define IPPROTO_HELLO
#define IPPROTO_SATEXPAK
#define IPPROTO_KRYPTOLAN
#define IPPROTO_RVD
#define IPPROTO_IPPC
#define IPPROTO_ADFS
#define IPPROTO_SATMON
#define IPPROTO_VISA
#define IPPROTO_IPCV
#define IPPROTO_CPNX
#define IPPROTO_CPHB
#define IPPROTO_WSN
#define IPPROTO_PVP
#define IPPROTO_BRSATMON
#define IPPROTO_ND
#define IPPROTO_WBMON
#define IPPROTO_WBEXPAK
#define IPPROTO_EON
#define IPPROTO_VMTP
#define IPPROTO_SVMTP
#define IPPROTO_VINES
#define IPPROTO_TTP
#define IPPROTO_IGP
#define IPPROTO_DGP
#define IPPROTO_TCF
#define IPPROTO_IGRP
#define IPPROTO_OSPFIGP
#define IPPROTO_SRPC
#define IPPROTO_LARP
#define IPPROTO_MTP
#define IPPROTO_AX25
#define IPPROTO_IPEIP
#define IPPROTO_MICP
#define IPPROTO_SCCSP
#define IPPROTO_ETHERIP
#define IPPROTO_ENCAP
#define IPPROTO_APES
#define IPPROTO_GMTP
#define IPPROTO_IPCOMP
#define IPPROTO_PIM
#define IPPROTO_PGM
#define IPPROTO_SCTP
#define IPPROTO_DIVERT
November 2012
Reference Number: 326004-001
#define IPPROTO_RAW
#define IPPROTO_MAX
#define IPV4_ANY
#define IPV4_LOOPBACK
#define IPV4_BROADCAST
#define IPV4_ALLHOSTS_GROUP
#define IPV4_ALLRTRS_GROUP
#define IPV4_MAX_LOCAL_GROUP
#define IPV4_MIN_MCAST
#define IPV4_MAX_MCAST
#define IS_IPV4_MCAST(x)
3.17.1
Detailed Description
IP-related defines
3.17.2
Define Documentation
3.17.2.1
#define IPv4( a, b, c, d )
3.17.2.2
#define IPPROTO IP
dummy for IP
3.17.2.3
3.17.2.4
3.17.2.5
3.17.2.6
gateway 2 (deprecated)
November 2012
Reference Number: 326004-001
3.17.2.7
IPv4 encapsulation
3.17.2.8
tcp
3.17.2.9
#define IPPROTO ST
Stream protocol II
3.17.2.10
3.17.2.11
3.17.2.12
3.17.2.13
3.17.2.14
pup
3.17.2.15
Argus
3.17.2.16
EMCON
November 2012
Reference Number: 326004-001
3.17.2.17
3.17.2.18
Chaos
3.17.2.19
3.17.2.20
Multiplexing
3.17.2.21
3.17.2.22
Host Monitoring
3.17.2.23
3.17.2.24
xns idp
3.17.2.25
Trunk-1
3.17.2.26
Trunk-2
November 2012
Reference Number: 326004-001
3.17.2.27
Leaf-1
3.17.2.28
Leaf-2
3.17.2.29
Reliable Data
3.17.2.30
Reliable Transaction
3.17.2.31
#define IPPROTO TP
3.17.2.32
3.17.2.33
Network Services
3.17.2.34
Merit Internodal
3.17.2.35
Sequential Exchange
3.17.2.36
November 2012
Reference Number: 326004-001
3.17.2.37
3.17.2.38
XTP
3.17.2.39
Datagram Delivery
3.17.2.40
3.17.2.41
TP++ Transport
3.17.2.42
#define IPPROTO IL
IL transport protocol
3.17.2.43
IP6 header
3.17.2.44
3.17.2.45
3.17.2.46
November 2012
Reference Number: 326004-001
3.17.2.47
InterDomain Routing
3.17.2.48
resource reservation
3.17.2.49
3.17.2.50
3.17.2.51
BHA
3.17.2.52
3.17.2.53
#define IPPROTO AH
3.17.2.54
3.17.2.55
IP with encryption
3.17.2.56
November 2012
Reference Number: 326004-001
3.17.2.57
ICMP6
3.17.2.58
3.17.2.59
3.17.2.60
3.17.2.61
CFTP
3.17.2.62
3.17.2.63
SATNET/Backroom EXPAK
3.17.2.64
Kryptolan
3.17.2.65
3.17.2.66
November 2012
Reference Number: 326004-001
3.17.2.67
Any distributed FS
3.17.2.68
Satnet Monitoring
3.17.2.69
VISA Protocol
3.17.2.70
3.17.2.71
3.17.2.72
3.17.2.73
3.17.2.74
3.17.2.75
3.17.2.76
#define IPPROTO ND
November 2012
Reference Number: 326004-001
3.17.2.77
WIDEBAND Monitoring
3.17.2.78
WIDEBAND EXPAK
3.17.2.79
ISO cnlp
3.17.2.80
VMTP
3.17.2.81
Secure VMTP
3.17.2.82
Banyon VINES
3.17.2.83
TTP
3.17.2.84
NSFNET-IGP
3.17.2.85
3.17.2.86
TCF
November 2012
Reference Number: 326004-001
3.17.2.87
Cisco/GXS IGRP
3.17.2.88
OSPFIGP
3.17.2.89
3.17.2.90
3.17.2.91
Multicast Transport
3.17.2.92
AX.25 Frames
3.17.2.93
IP encapsulated in IP
3.17.2.94
3.17.2.95
3.17.2.96
Ethernet IP encapsulation
November 2012
Reference Number: 326004-001
3.17.2.97
encapsulation header
3.17.2.98
3.17.2.99
GMTP
3.17.2.100
3.17.2.101
3.17.2.102
PGM
3.17.2.103
3.17.2.104
divert pseudo-protocol
3.17.2.105
raw IP packet
3.17.2.106
November 2012
Reference Number: 326004-001
3.17.2.107
0.0.0.0
3.17.2.108
127.0.0.1
3.17.2.109
224.0.0.0
3.17.2.110
224.0.0.1
3.17.2.111
224.0.0.2
3.17.2.112
224.0.0.255
3.17.2.113
3.17.2.114
3.17.2.115
3.18
November 2012
Reference Number: 326004-001
Defines
#define __rte_jhash_mix(a, b, c)
#define RTE_JHASH_GOLDEN_RATIO
Functions
static uint32_t rte_jhash (const void key, uint32_t length, uint32_t initval)
static uint32_t rte_jhash2 (uint32_t k, uint32_t length, uint32_t initval)
static uint32_t rte_jhash_3words (uint32_t a, uint32_t b, uint32_t c, uint32_t initval)
static uint32_t rte_jhash_2words (uint32_t a, uint32_t b, uint32_t initval)
static uint32_t rte_jhash_1word (uint32_t a, uint32_t initval)
3.18.1
Detailed Description
jhash functions.
3.18.2
Define Documentation
3.18.2.1
3.18.2.2
3.18.3
Function Documentation
3.18.3.1
static uint32 t rte jhash ( const void key, uint32 t length, uint32 t initval ) [static]
The most generic version, hashes an arbitrary sequence of bytes. No alignment or length assumptions are
made about the input key.
Parameters
key Key to calculate hash of.
length Length of key in bytes.
initval Initialising value of hash.
Returns
Calculated hash value.
November 2012
Reference Number: 326004-001
3.18.3.2
static uint32 t rte jhash2 ( uint32 t k, uint32 t length, uint32 t initval ) [static]
A special optimized version that handles 1 or more of uint32_ts. The length parameter here is the number
of uint32_ts in the key.
Parameters
k Key to calculate hash of.
length Length of key in units of 4 bytes.
initval Initialising value of hash.
Returns
Calculated hash value.
3.18.3.3
static uint32 t rte jhash 3words ( uint32 t a, uint32 t b, uint32 t c, uint32 t initval ) [static]
Returns
Calculated hash value.
3.18.3.4
static uint32 t rte jhash 2words ( uint32 t a, uint32 t b, uint32 t initval ) [static]
Returns
Calculated hash value.
November 2012
Reference Number: 326004-001
3.18.3.5
3.19
Typedefs
typedef int( lcore_function_t )(void )
Enumerations
enum rte_lcore_state_t { WAIT, RUNNING, FINISHED }
enum rte_rmt_call_master_t { SKIP_MASTER, CALL_MASTER }
Functions
int rte_eal_remote_launch (lcore_function_t f, void arg, unsigned slave_id)
int rte_eal_mp_remote_launch (lcore_function_t f, void arg, enum rte_rmt_call_master_t call_master)
enum rte_lcore_state_t rte_eal_get_lcore_state (unsigned slave_id)
int rte_eal_wait_lcore (unsigned slave_id)
void rte_eal_mp_wait_lcore (void)
3.19.1
Detailed Description
3.19.2
Typedef Documentation
3.19.2.1
November 2012
Reference Number: 326004-001
3.19.3
3.19.3.1
enum rte_lcore_state_t
State of an lcore.
Enumerator:
WAIT waiting a new command
RUNNING executing command
FINISHED command executed
3.19.3.2
enum rte_rmt_call_master_t
This enum indicates whether the master core must execute the handler launched on all logical cores.
Enumerator:
SKIP_MASTER lcore handler not executed by master core.
CALL_MASTER lcore handler executed by master core.
3.19.4
Function Documentation
3.19.4.1
int rte eal remote launch ( lcore_function_t f, void arg, unsigned slave id )
November 2012
Reference Number: 326004-001
Returns
0: Success. Execution of function f started on the remote lcore.
(-EBUSY): The remote lcore is not in a WAIT state.
3.19.4.2
int rte eal mp remote launch ( lcore_function_t f, void arg, enum rte_rmt_call_master_t
call master )
Returns
0: Success. Execution of function f started on all remote lcores.
(-EBUSY): At least one remote lcore is not in a WAIT state. In this case, no message is sent to
any of the lcores.
3.19.4.3
Returns
The state of the lcore.
3.19.4.4
November 2012
Reference Number: 326004-001
If the slave lcore identified by the slave_id is in a FINISHED state, switch to the WAIT state. If the lcore is in
RUNNING state, wait until the lcore finishes its job and moves to the FINISHED state.
Parameters
slave_id The identifier of the lcore.
Returns
0: If the lcore identified by the slave_id is in a WAIT state.
The value that was returned by the previous remote launch function call if the lcore identified by
the slave_id was in a FINISHED or RUNNING state. In this case, it changes the state of the lcore
to WAIT.
3.19.4.5
3.20
Defines
#define LCORE_ID_ANY
#define RTE_LCORE_FOREACH(i)
#define RTE_LCORE_FOREACH_SLAVE(i)
Functions
3.20.1
Detailed Description
API for lcore and Socket Manipulation. Parts of this are execution environment specific.
November 2012
Reference Number: 326004-001
3.20.2
Define Documentation
3.20.2.1
Any lcore.
3.20.2.2
3.20.3
Function Documentation
3.20.3.1
3.20.3.3
3.20.3.4
November 2012
Reference Number: 326004-001
3.20.3.5
Return the ID of the physical socket of the logical core we are running on.
Returns
Socket ID
3.20.3.6
Returns
the ID of lcoreids physical socket
3.20.3.7
Returns
True if the given lcore is enabled; false otherwise.
3.20.3.8
static unsigned rte get next lcore ( unsigned i, int skip master, int wrap ) [static]
November 2012
Reference Number: 326004-001
Returns
The next lcore_id or RTE_MAX_LCORE if not found.
3.21
Data Structures
struct rte_logs
Defines
#define RTE_LOGTYPE_EAL
#define RTE_LOGTYPE_MALLOC
#define RTE_LOGTYPE_RING
#define RTE_LOGTYPE_MEMPOOL
#define RTE_LOGTYPE_TIMER
#define RTE_LOGTYPE_PMD
#define RTE_LOGTYPE_HASH
#define RTE_LOGTYPE_LPM
#define RTE_LOGTYPE_USER1
#define RTE_LOGTYPE_USER2
#define RTE_LOGTYPE_USER3
#define RTE_LOGTYPE_USER4
#define RTE_LOGTYPE_USER5
#define RTE_LOGTYPE_USER6
#define RTE_LOGTYPE_USER7
#define RTE_LOGTYPE_USER8
#define RTE_LOG_EMERG
#define RTE_LOG_ALERT
#define RTE_LOG_CRIT
#define RTE_LOG_ERR
#define RTE_LOG_WARNING
#define RTE_LOG_NOTICE
#define RTE_LOG_INFO
#define RTE_LOG_DEBUG
#define RTE_LOG(l, t, fmt, args...)
Functions
November 2012
Reference Number: 326004-001
Variables
struct rte_logs rte_logs
FILE eal_default_log_stream
3.21.1
Detailed Description
3.21.2
Define Documentation
3.21.2.1
3.21.2.2
3.21.2.3
3.21.2.4
3.21.2.5
November 2012
Reference Number: 326004-001
3.21.2.6
3.21.2.7
3.21.2.8
3.21.2.9
3.21.2.10
3.21.2.11
3.21.2.12
3.21.2.13
3.21.2.14
3.21.2.15
November 2012
Reference Number: 326004-001
3.21.2.16
3.21.2.17
System is unusable.
3.21.2.18
3.21.2.19
Critical conditions.
3.21.2.20
Error conditions.
3.21.2.21
Warning conditions.
3.21.2.22
3.21.2.23
Informational.
3.21.2.24
Debug-level messages.
3.21.2.25
November 2012
Reference Number: 326004-001
RTE_LOG() can be used to remove debug logs at compilation time, depending on RTE_LOG_LEVEL
configuration option, and compilation optimization level. If optimization is enabled, the tests involving
constants only are pre-computed. If compilation is done with -O0, these tests will be done at run time.
The log level and log type names are smaller, for example: RTE_LOG(INFO, EAL, "this is a %s", "log");
Parameters
l Log level. A value between EMERG (1) and DEBUG (8). The short name is expanded
by the macro, so it cannot be an integer value.
t The log type, for example, EAL. The short name is expanded by the macro, so it cannot
be an integer value.
fmt The fmt string, as in printf(3), followed by the variable arguments required by the format.
args The variable list of arguments according to the format string.
Returns
0: Success.
Negative on error.
3.21.3
Function Documentation
3.21.3.1
Returns
0 on success.
Negative on error.
3.21.3.2
November 2012
Reference Number: 326004-001
Parameters
level Log level. A value between RTE_LOG_EMERG (1) and RTE_LOG_DEBUG (8).
3.21.3.3
3.21.3.4
3.21.3.5
3.21.3.6
November 2012
Reference Number: 326004-001
3.21.3.7
3.21.3.8
int rte log add in history ( const char buf, size t size )
Returns
0: Success.
(-ENOBUFS) if there is no room to store the message.
3.21.3.9
int rte log ( uint32 t level, uint32 t logtype, const char format, ... )
Returns
0: Success.
Negative on error.
November 2012
Reference Number: 326004-001
int rte vlog ( uint32 t level, uint32 t logtype, const char format, va list ap )
3.21.3.10
Returns
0: Success.
Negative on error.
3.21.4
Variable Documentation
3.21.4.1
3.21.4.2
FILE eal_default_log_stream
3.22
Data Structures
struct rte_lpm_tbl24_entry
struct rte_lpm_tbl8_entry
struct rte_lpm_rule
struct rte_lpm
November 2012
Reference Number: 326004-001
Defines
#define RTE_LPM_NAMESIZE
#define RTE_LPM_HEAP
#define RTE_LPM_MEMZONE
#define RTE_LPM_MAX_DEPTH
#define RTE_LPM_TBL24_NUM_ENTRIES
#define RTE_LPM_TBL8_GROUP_NUM_ENTRIES
#define RTE_LPM_TBL8_NUM_GROUPS
#define RTE_LPM_TBL8_NUM_ENTRIES
#define RTE_LPM_RETURN_IF_TRUE(cond, retval)
Functions
struct rte_lpm rte_lpm_create (const char name, int socket_id, int max_rules, int mem_location)
struct rte_lpm rte_lpm_find_existing (const char name)
void rte_lpm_free (struct rte_lpm lpm)
int rte_lpm_add (struct rte_lpm lpm, uint32_t ip, uint8_t depth, uint8_t next_hop)
int rte_lpm_delete (struct rte_lpm lpm, uint32_t ip, uint8_t depth)
void rte_lpm_delete_all (struct rte_lpm lpm)
static int rte_lpm_lookup (struct rte_lpm lpm, uint32_t ip, uint8_t next_hop)
3.22.1
Detailed Description
3.22.2
Define Documentation
3.22.2.1
November 2012
Reference Number: 326004-001
3.22.2.5
3.22.2.6
3.22.2.7
3.22.2.8
3.22.2.9
3.22.3
Function Documentation
3.22.3.1
struct rte_lpm rte lpm create ( const char name, int socket id, int max rules, int mem location )
[read]
Returns
Handle to LPM object on success, NULL otherwise with rte_errno set to an appropriate values. Possible
rte_errno values include:
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
E_RTE_SECONDARY - function was called from a secondary process instance
E_RTE_NO_TAILQ - no tailq list could be got for the lpm object list
EINVAL - invalid parameter passed to function
November 2012
Reference Number: 326004-001
3.22.3.2
struct rte_lpm rte lpm find existing ( const char name ) [read]
Returns
Pointer to lpm object or NULL if object not found with rte_errno set appropriately. Possible rte_errno
values include:
ENOENT - required entry not available to return.
3.22.3.3
Returns
None
3.22.3.4
int rte lpm add ( struct rte_lpm lpm, uint32 t ip, uint8 t depth, uint8 t next hop )
November 2012
Reference Number: 326004-001
Returns
0 on success, negative value otherwise
3.22.3.5
int rte lpm delete ( struct rte_lpm lpm, uint32 t ip, uint8 t depth )
Returns
0 on success, negative value otherwise
3.22.3.6
3.22.3.7
static int rte lpm lookup ( struct rte_lpm lpm, uint32 t ip, uint8 t next hop ) [static]
Returns
-EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit
3.23
November 2012
Reference Number: 326004-001
Functions
3.23.1
Detailed Description
RTE Malloc. This library provides methods for dynamically allocating memory from hugepages.
3.23.2
Function Documentation
3.23.2.1
void rte malloc ( const char type, size t size, unsigned align )
This function allocates memory from the huge-page area of memory. The memory is not cleared.
Parameters
type A string identifying the type of allocated objects (useful for debug purposes, such as
identifying the cause of a memory leak). Can be NULL.
size Size (in bytes) to be allocated.
align If 0, the return is a pointer that is suitably aligned for any kind of variable (in the same
manner as malloc()). Otherwise, the return is a pointer that is a multiple of align. In this case, it must be a power of two. (Minimum alignment is the cacheline size, i.e.
64-bytes)
Returns
NULL on error. Not enough memory, or invalid arguments (size is 0, align is not a power of two).
Otherwise, the pointer to the allocated object.
3.23.2.2
void rte zmalloc ( const char type, size t size, unsigned align )
November 2012
Reference Number: 326004-001
Parameters
type A string identifying the type of allocated objects (useful for debug purposes, such as
identifying the cause of a memory leak). Can be NULL.
size Size (in bytes) to be allocated.
align If 0, the return is a pointer that is suitably aligned for any kind of variable (in the same
manner as malloc()). Otherwise, the return is a pointer that is a multiple of align. In
this case, it must obviously be a power of two. (Minimum alignment is the cacheline size,
i.e. 64-bytes)
Returns
NULL on error. Not enough memory, or invalid arguments (size is 0, align is not a power of two).
Otherwise, the pointer to the allocated object.
3.23.2.3
void rte calloc ( const char type, size t num, size t size, unsigned align )
Replacement function for calloc(), using huge-page memory. Memory area is initialised with zeros.
Parameters
type A string identifying the type of allocated objects (useful for debug purposes, such as
identifying the cause of a memory leak). Can be NULL.
num Number of elements to be allocated.
size Size (in bytes) of a single element.
align If 0, the return is a pointer that is suitably aligned for any kind of variable (in the same
manner as malloc()). Otherwise, the return is a pointer that is a multiple of align. In
this case, it must obviously be a power of two. (Minimum alignment is the cacheline size,
i.e. 64-bytes)
Returns
NULL on error. Not enough memory, or invalid arguments (size is 0, align is not a power of two).
Otherwise, the pointer to the allocated object.
3.23.2.4
Replacement function for realloc(), using huge-page memory. Reserved area memory is resized, preserving
contents.
Parameters
ptr Pointer to already allocated memory
size Size (in bytes) of new area. If this is 0, memory is freed.
align If 0, the return is a pointer that is suitably aligned for any kind of variable (in the same
manner as malloc()). Otherwise, the return is a pointer that is a multiple of align. In
this case, it must obviously be a power of two. (Minimum alignment is the cacheline size,
i.e. 64-bytes)
November 2012
Reference Number: 326004-001
Returns
NULL on error. Not enough memory, or invalid arguments (size is 0, align is not a power of two).
Otherwise, the pointer to the reallocated memory.
3.23.2.5
3.23.2.6
If malloc debug is enabled, check a memory block for header and trailer markers to indicate that all is well
with the block. If size is non-null, also return the size of the block.
Parameters
ptr pointer to the start of a data block, must have been returned by a previous call to rte_malloc(), rte_zmalloc(), rte_calloc() or rte_realloc()
size if non-null, and memory block pointer is valid, returns the size of the memory block
Returns
-1 on error, invalid pointer passed or header and trailer markers are missing or corrupted 0 on success
3.23.2.7
Dump statistics.
Dump for the specified type to the console. If the type argument is NULL, all memory types will be dumped.
Parameters
type A string identifying the type of objects to dump, or NULL to dump all objects.
November 2012
Reference Number: 326004-001
int rte malloc set limit ( const char type, size t max )
3.23.2.8
Returns
0: Success.
(-1): Error.
3.24
Data Structures
struct rte_ctrlmbuf
struct rte_pktmbuf
struct rte_mbuf
struct rte_pktmbuf_pool_private
Defines
#define PKT_RX_VLAN_PKT
#define PKT_RX_RSS_HASH
#define PKT_RX_FDIR
#define PKT_RX_L4_CKSUM_BAD
#define PKT_RX_IP_CKSUM_BAD
#define PKT_RX_IPV4_HDR
#define PKT_RX_IPV4_HDR_EXT
#define PKT_RX_IPV6_HDR
#define PKT_RX_IPV6_HDR_EXT
#define PKT_RX_IEEE1588_PTP
#define PKT_RX_IEEE1588_TMST
#define PKT_TX_VLAN_PKT
#define PKT_TX_IP_CKSUM
#define PKT_TX_L4_MASK
#define PKT_TX_L4_NO_CKSUM
#define PKT_TX_TCP_CKSUM
#define PKT_TX_SCTP_CKSUM
#define PKT_TX_UDP_CKSUM
#define PKT_TX_IEEE1588_TMST
November 2012
Reference Number: 326004-001
#define PKT_TX_OFFLOAD_MASK
#define TX_VLAN_CMP_MASK
#define TX_MAC_LEN_CMP_MASK
#define TX_IP_LEN_CMP_MASK
#define TX_MACIP_LEN_CMP_MASK
#define RTE_MBUF_FROM_BADDR(ba)
#define RTE_MBUF_TO_BADDR(mb)
#define RTE_MBUF_INDIRECT(mb)
#define RTE_MBUF_DIRECT(mb)
#define __rte_mbuf_sanity_check(m, t, is_h)
#define __rte_mbuf_sanity_check_raw(m, t, is_h)
#define RTE_MBUF_ASSERT(exp)
#define RTE_MBUF_PREFETCH_TO_FREE(m)
#define rte_ctrlmbuf_data(m)
#define rte_ctrlmbuf_len(m)
#define rte_pktmbuf_mtod(m, t)
#define rte_pktmbuf_pkt_len(m)
#define rte_pktmbuf_data_len(m)
Enumerations
enum rte_mbuf_type { RTE_MBUF_CTRL, RTE_MBUF_PKT }
Functions
November 2012
Reference Number: 326004-001
3.24.1
Detailed Description
RTE Mbuf
The mbuf library provides the ability to create and destroy buffers that may be used by the RTE application
to store message buffers. The message buffers are stored in a mempool, using the RTE mempool library.
This library provide an API to allocate/free mbufs, manipulate control message buffer (ctrlmbuf), which are
generic message buffers, and packet buffers (pktmbuf), which are used to carry network packets.
To understand the concepts of packet buffers or mbufs, you should read "TCP/IP Illustrated, Volume 2:
The Implementation, Addison-Wesley, 1995, ISBN 0-201-63354-X from Richard Stevens" http://www.kohala.com/start/tcpipiv2.html
The main modification of this implementation is the use of mbuf for transports other than packets. mbufs
can have other types.
3.24.2
Define Documentation
3.24.2.1
3.24.2.2
3.24.2.3
3.24.2.4
November 2012
Reference Number: 326004-001
3.24.2.5
3.24.2.6
3.24.2.7
3.24.2.8
3.24.2.9
3.24.2.10
3.24.2.11
3.24.2.12
3.24.2.13
3.24.2.14
November 2012
Reference Number: 326004-001
3.24.2.15
3.24.2.16
3.24.2.17
3.24.2.18
3.24.2.19
3.24.2.20
3.24.2.21
3.24.2.22
3.24.2.23
IP length - 9-bits.
3.24.2.24
MAC+IP length.
November 2012
Reference Number: 326004-001
3.24.2.25
3.24.2.26
Given the pointer to mbuf returns an address where its buf_addr should point to.
3.24.2.27
3.24.2.28
3.24.2.29
3.24.2.30
3.24.2.31
3.24.2.32
Mbuf prefetch
3.24.2.33
November 2012
Reference Number: 326004-001
3.24.2.34
3.24.2.35
3.24.2.36
3.24.2.37
3.24.3
November 2012
Reference Number: 326004-001
3.24.3.1
enum rte_mbuf_type
3.24.4
Function Documentation
3.24.4.1
static uint16 t rte mbuf refcnt update ( struct rte_mbuf m, int16 t value ) [static]
Adds given value to an mbufs refcnt and returns its new value.
Parameters
m Mbuf to update
value Value to add/subtract
Returns
Updated value
3.24.4.2
static uint16 t rte mbuf refcnt read ( const struct rte_mbuf m ) [static]
Returns
Reference count number.
3.24.4.3
static void rte mbuf refcnt set ( struct rte_mbuf m, uint16 t new value ) [static]
November 2012
Reference Number: 326004-001
3.24.4.4
void rte mbuf sanity check ( const struct rte_mbuf m, enum rte_mbuf_type t, int is header )
3.24.4.5
static struct rte_mbuf rte mbuf raw alloc ( struct rte_mempool mp ) [static, read]
Allocate a new mbuf from mempool mp. The use of that function is reserved for RTE internal needs.
Please use either rte_ctrlmbuf_alloc() or rte_pktmbuf_alloc().
Parameters
mp The mempool from which mbuf is allocated.
Returns
The pointer to the new mbuf on success.
NULL if allocation failed.
3.24.4.6
Put mbuf back into its original mempool. The use of that function is reserved for RTE internal needs. Please
use either rte_ctrlmbuf_free() or rte_pktmbuf_free().
Parameters
m The mbuf to be freed.
3.24.4.7
void rte ctrlmbuf init ( struct rte_mempool mp, void opaque arg, void m, unsigned i )
November 2012
Reference Number: 326004-001
Parameters
mp The mempool from which the mbuf is allocated.
opaque_arg A pointer that can be used by the user to retrieve useful information for mbuf initialization.
This pointer comes from the init_arg parameter of rte_mempool_create().
m The mbuf to initialize.
i The index of the mbuf in the pool table.
static struct rte_mbuf rte ctrlmbuf alloc ( struct rte_mempool mp ) [static, read]
3.24.4.8
Returns
The pointer to the new mbuf on success.
NULL if allocation failed.
3.24.4.9
3.24.4.10
void rte pktmbuf init ( struct rte_mempool mp, void opaque arg, void m, unsigned i )
November 2012
Reference Number: 326004-001
3.24.4.11
void rte pktmbuf pool init ( struct rte_mempool mp, void opaque arg )
3.24.4.12
3.24.4.13
static struct rte_mbuf rte pktmbuf alloc ( struct rte_mempool mp ) [static, read]
Returns
The pointer to the new mbuf on success.
NULL if allocation failed.
3.24.4.14
static void rte pktmbuf attach ( struct rte_mbuf mi, struct rte_mbuf md ) [static]
Attach packet mbuf to another packet mbuf. After attachment we refer the mbuf we attached as indirect,
while mbuf we attached to as direct. Right now, not supported:
attachment to indirect mbuf (e.g. - md has to be direct).
November 2012
Reference Number: 326004-001
3.24.4.15
Detach an indirect packet mbuf restore original mbuf address and length values.
reset pktmbuf data and data_len to their default values. All other fields of the given packet mbuf will be
left intact.
Parameters
m The indirect attached packet mbuf.
3.24.4.16
3.24.4.17
November 2012
Reference Number: 326004-001
3.24.4.18
static struct rte_mbuf rte pktmbuf clone ( struct rte_mbuf md, struct rte_mempool mp )
[static, read]
Returns
The pointer to the new "clone" mbuf on success.
NULL if allocation fails.
3.24.4.19
static void rte pktmbuf refcnt update ( struct rte_mbuf m, int16 t v ) [static]
3.24.4.20
Returns
The length of the headroom.
November 2012
Reference Number: 326004-001
3.24.4.21
Returns
The length of the tailroom.
3.24.4.22
static struct rte_mbuf rte pktmbuf lastseg ( struct rte_mbuf m ) [static, read]
Returns
The last segment of the given mbuf.
3.24.4.23
static char rte pktmbuf prepend ( struct rte_mbuf m, uint16 t len ) [static]
Returns
A pointer to the start of the newly prepended data, or NULL if there is not enough headroom space in
the first segment
3.24.4.24
static char rte pktmbuf append ( struct rte_mbuf m, uint16 t len ) [static]
November 2012
Reference Number: 326004-001
Append len bytes to an mbuf and return a pointer to the start address of the added data. If there is not
enough tailroom in the last segment, the function will return NULL, without modifying the mbuf.
Parameters
m The packet mbuf.
len The amount of data to append (in bytes).
Returns
A pointer to the start of the newly appended data, or NULL if there is not enough tailroom space in the
last segment
3.24.4.25
static char rte pktmbuf adj ( struct rte_mbuf m, uint16 t len ) [static]
Returns
A pointer to the new start of the data.
3.24.4.26
static int rte pktmbuf trim ( struct rte_mbuf m, uint16 t len ) [static]
Returns
0: On success.
-1: On error.
November 2012
Reference Number: 326004-001
3.24.4.27
Returns
1, if all data is contiguous (one segment).
0, if there is several segments.
void rte pktmbuf dump ( const struct rte_mbuf m, unsigned dump len )
3.24.4.28
3.25
Defines
#define rte_memcpy
Functions
3.25.1
Detailed Description
November 2012
Reference Number: 326004-001
3.25.2
Define Documentation
3.25.2.1
3.25.3
Function Documentation
3.25.3.1
static void rte mov16 ( uint8 t dst, const uint8 t src ) [static]
Copy 16 bytes from one location to another using optimised SSE instructions. The locations should not
overlap.
Parameters
dst Pointer to the destination of the data.
src Pointer to the source data.
3.25.3.2
static void rte mov32 ( uint8 t dst, const uint8 t src ) [static]
Copy 32 bytes from one location to another using optimised SSE instructions. The locations should not
overlap.
Parameters
dst Pointer to the destination of the data.
src Pointer to the source data.
3.25.3.3
static void rte mov48 ( uint8 t dst, const uint8 t src ) [static]
Copy 48 bytes from one location to another using optimised SSE instructions. The locations should not
overlap.
Parameters
dst Pointer to the destination of the data.
src Pointer to the source data.
3.25.3.4
static void rte mov64 ( uint8 t dst, const uint8 t src ) [static]
Copy 64 bytes from one location to another using optimised SSE instructions. The locations should not
overlap.
November 2012
Reference Number: 326004-001
Parameters
dst Pointer to the destination of the data.
src Pointer to the source data.
3.25.3.5
static void rte mov128 ( uint8 t dst, const uint8 t src ) [static]
Copy 128 bytes from one location to another using optimised SSE instructions. The locations should not
overlap.
Parameters
dst Pointer to the destination of the data.
src Pointer to the source data.
3.25.3.6
static void rte mov256 ( uint8 t dst, const uint8 t src ) [static]
Copy 256 bytes from one location to another using optimised SSE instructions. The locations should not
overlap.
Parameters
dst Pointer to the destination of the data.
src Pointer to the source data.
3.25.3.7
static void rte memcpy func ( void dst, const void src, size t n ) [static]
Copy bytes from one location to another. The locations must not overlap.
Parameters
dst Pointer to the destination of the data.
src Pointer to the source data.
n Number of bytes to copy.
Returns
Pointer to the destination data.
3.26
Data Structures
struct rte_memseg
November 2012
Reference Number: 326004-001
Defines
#define SOCKET_ID_ANY
#define CACHE_LINE_SIZE
#define CACHE_LINE_MASK
#define CACHE_LINE_ROUNDUP(size)
#define __rte_cache_aligned
Typedefs
typedef uint64_t phys_addr_t
Functions
3.26.1
Detailed Description
3.26.2
Define Documentation
3.26.2.1
3.26.2.2
3.26.2.3
3.26.2.4
November 2012
Reference Number: 326004-001
3.26.2.5
3.26.3
Typedef Documentation
3.26.3.1
3.26.4
Function Documentation
3.26.4.1
3.26.4.2
3.26.4.3
3.26.4.4
November 2012
Reference Number: 326004-001
Returns
The number of memory channels on the system. The value is 0 if unknown or not the same on all
devices.
3.26.4.5
3.27
Data Structures
struct rte_mempool_cache
struct rte_mempool
Defines
#define RTE_MEMPOOL_HEADER_COOKIE1
#define RTE_MEMPOOL_HEADER_COOKIE2
#define RTE_MEMPOOL_TRAILER_COOKIE
#define RTE_MEMPOOL_NAMESIZE
#define MEMPOOL_F_NO_SPREAD
#define MEMPOOL_F_NO_CACHE_ALIGN
#define MEMPOOL_F_SP_PUT
#define MEMPOOL_F_SC_GET
#define __MEMPOOL_STAT_ADD(mp, name, n)
#define __mempool_check_cookies(mp, obj_table_const, n, free)
Typedefs
typedef void( rte_mempool_obj_ctor_t )(struct rte_mempool , void , void , unsigned)
typedef void( rte_mempool_ctor_t )(struct rte_mempool , void )
November 2012
Reference Number: 326004-001
Functions
static struct rte_mempool __mempool_from_obj (void obj)
static struct rte_mempool rte_mempool_from_obj (void obj)
struct rte_mempool rte_mempool_create (const char name, unsigned n, unsigned elt_size,
unsigned cache_size, unsigned private_data_size, rte_mempool_ctor_t mp_init, void mp_init_arg,
rte_mempool_obj_ctor_t obj_init, void obj_init_arg, int socket_id, unsigned flags)
static int rte_mempool_set_bulk_count (struct rte_mempool mp, unsigned count)
static unsigned rte_mempool_get_bulk_count (struct rte_mempool mp)
void rte_mempool_dump (const struct rte_mempool mp)
static void __mempool_put_bulk (struct rte_mempool mp, void const obj_table, unsigned n, int
is_mp)
static void rte_mempool_mp_put_bulk (struct rte_mempool mp, void const obj_table, unsigned n)
static void rte_mempool_sp_put_bulk (struct rte_mempool mp, void const obj_table, unsigned n)
static void rte_mempool_put_bulk (struct rte_mempool mp, void const obj_table, unsigned n)
static void rte_mempool_mp_put (struct rte_mempool mp, void obj)
static void rte_mempool_sp_put (struct rte_mempool mp, void obj)
static void rte_mempool_put (struct rte_mempool mp, void obj)
static int __mempool_get_bulk (struct rte_mempool mp, void obj_table, unsigned n, int is_mc)
static int rte_mempool_mc_get_bulk (struct rte_mempool mp, void obj_table, unsigned n)
static int rte_mempool_sc_get_bulk (struct rte_mempool mp, void obj_table, unsigned n)
static int rte_mempool_get_bulk (struct rte_mempool mp, void obj_table, unsigned n)
static int rte_mempool_mc_get (struct rte_mempool mp, void obj_p)
static int rte_mempool_sc_get (struct rte_mempool mp, void obj_p)
static int rte_mempool_get (struct rte_mempool mp, void obj_p)
unsigned rte_mempool_count (const struct rte_mempool mp)
static unsigned rte_mempool_free_count (const struct rte_mempool mp)
static int rte_mempool_full (const struct rte_mempool mp)
static int rte_mempool_empty (const struct rte_mempool mp)
static phys_addr_t rte_mempool_virt2phy (const struct rte_mempool mp, const void elt)
void rte_mempool_audit (const struct rte_mempool mp)
static void rte_mempool_get_priv (struct rte_mempool mp)
void rte_mempool_list_dump (void)
struct rte_mempool rte_mempool_lookup (const char name)
3.27.1
Detailed Description
RTE Mempool.
A memory pool is an allocator of fixed-size object. It is identified by its name, and uses a ring to store free
objects. It provides some other optional services, like a per-core object cache, and an alignment helper to
ensure that objects are padded to spread them equally on all RAM channels, ranks, and so on.
Objects owned by a mempool should never be added in another mempool. When an object is freed using
rte_mempool_put() or equivalent, the object data is not modified; the user can save some meta-data in the
object data and retrieve them when allocating a new object.
November 2012
Reference Number: 326004-001
Note: the mempool implementation is not preemptable. A lcore must not be interrupted by another task
that uses the same mempool (because it uses a ring which is not preemptable). Also, mempool functions
must not be used outside the DPDK environment: for example, in linuxapp environment, a thread that is
not created by the EAL must not use mempools. This is due to the per-lcore cache that wont work as
rte_lcore_id() will not return a correct value.
3.27.2
Define Documentation
3.27.2.1
Header cookie.
3.27.2.2
Header cookie.
3.27.2.3
Trailer cookie.
3.27.2.4
3.27.2.5
3.27.2.6
3.27.2.7
3.27.2.8
November 2012
Reference Number: 326004-001
3.27.2.9
3.27.2.10
3.27.3
Typedef Documentation
3.27.3.1
3.27.3.2
3.27.4
Function Documentation
November 2012
Reference Number: 326004-001
3.27.4.1
static struct rte_mempool mempool from obj ( void obj ) [static, read]
Returns
The pointer to the mempool from which the object was allocated.
3.27.4.2
static struct rte_mempool rte mempool from obj ( void obj ) [static, read]
Returns
A pointer to the mempool structure.
3.27.4.3
struct rte_mempool rte mempool create ( const char name, unsigned n, unsigned elt size,
unsigned cache size, unsigned private data size, rte_mempool_ctor_t mp init, void mp init arg,
rte_mempool_obj_ctor_t obj init, void obj init arg, int socket id, unsigned flags ) [read]
Parameters
name The name of the mempool.
n The number of elements in the mempool. The optimum size (in terms of memory usage)
for a mempool is when n is a power of two minus one: n = (2 q - 1).
elt_size The size of each element.
November 2012
Reference Number: 326004-001
cache_size If cache_size is non-zero, the rte_mempool library will try to limit the accesses to the
common lockless pool, by maintaining a per-lcore object cache. This argument must
be lower or equal to CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE. It is advised to
choose cache_size to have "n modulo cache_size == 0": if this is not the case, some
elements will always stay in the pool and will never be used. The access to the perlcore table is of course faster than the multi-producer/consumer pool. The cache can be
disabled if the cache_size argument is set to 0; it can be useful to avoid loosing objects
in cache. Note that even if not used, the memory space for cache is always reserved in
a mempool structure, except if CONFIG_RTE_MEMPOOL_CACHE_MAX_SIZE is set
to 0.
private_data_- The size of the private data appended after the mempool structure. This is useful for
size storing some private data after the mempool structure, as is done for rte_mbuf_pool for
example.
mp_init A function pointer that is called for initialization of the pool, before object initialization.
The user can initialize the private data in this function if needed. This parameter can be
NULL if not needed.
mp_init_arg An opaque pointer to data that can be used in the mempool constructor function.
obj_init A function pointer that is called for each object at initialization of the pool. The user can
set some meta data in objects if needed. This parameter can be NULL if not needed.
The obj_init() function takes the mempool pointer, the init_arg, the object pointer and the
object number as parameters.
obj_init_arg An opaque pointer to data that can be used as an argument for each call to the object
constructor function.
socket_id The socket_id argument is the socket identifier in the case of NUMA. The value can
be SOCKET_ID_ANY if there is no NUMA constraint for the reserved zone.
flags The flags arguments is an OR of following flags:
MEMPOOL_F_NO_SPREAD: By default, objects addresses are spread between
channels in RAM: the pool allocator will add padding between objects depending
on the hardware configuration. See Memory alignment constraints for details. If
this flag is set, the allocator will just align them to a cache line.
MEMPOOL_F_NO_CACHE_ALIGN: By default, the returned objects are cachealigned. This flag removes this constraint, and no padding will be present between
objects. This flag implies MEMPOOL_F_NO_SPREAD.
MEMPOOL_F_SP_PUT: If this flag is set, the default behavior when using rte_mempool_put() or rte_mempool_put_bulk() is "single-producer". Otherwise, it is
"multi-producers".
MEMPOOL_F_SC_GET: If this flag is set, the default behavior when using rte_mempool_get() or rte_mempool_get_bulk() is "single-consumer". Otherwise, it is
"multi-consumers".
Returns
The pointer to the new allocated mempool, on success. NULL on error with rte_errno set appropriately.
Possible rte_errno values include:
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
November 2012
Reference Number: 326004-001
3.27.4.4
static int rte mempool set bulk count ( struct rte_mempool mp, unsigned count ) [static]
Returns
0: Success; default_bulk_count changed.
-EINVAL: Invalid count value.
3.27.4.5
static unsigned rte mempool get bulk count ( struct rte_mempool mp ) [static]
Returns
The default bulk count for enqueue/dequeue.
3.27.4.6
November 2012
Reference Number: 326004-001
3.27.4.7
static void mempool put bulk ( struct rte_mempool mp, void const obj table, unsigned n, int is mp
) [static]
3.27.4.8
static void rte mempool mp put bulk ( struct rte_mempool mp, void const obj table, unsigned n )
[static]
3.27.4.9
static void rte mempool sp put bulk ( struct rte_mempool mp, void const obj table, unsigned n )
[static]
static void rte mempool put bulk ( struct rte_mempool mp, void const obj table, unsigned n )
[static]
3.27.4.10
November 2012
Reference Number: 326004-001
static void rte mempool mp put ( struct rte_mempool mp, void obj ) [static]
3.27.4.11
static void rte mempool sp put ( struct rte_mempool mp, void obj ) [static]
3.27.4.12
static void rte mempool put ( struct rte_mempool mp, void obj ) [static]
3.27.4.13
static int mempool get bulk ( struct rte_mempool mp, void obj table, unsigned n, int is mc )
[static]
3.27.4.14
November 2012
Reference Number: 326004-001
Returns
>=0: Success; number of objects supplied.
<0: Error; code of ring dequeue function.
static int rte mempool mc get bulk ( struct rte_mempool mp, void obj table, unsigned n )
[static]
3.27.4.15
Returns
0: Success; objects taken.
-ENOENT: Not enough entries in the mempool; no object is retrieved.
static int rte mempool sc get bulk ( struct rte_mempool mp, void obj table, unsigned n )
[static]
3.27.4.16
Returns
0: Success; objects taken.
-ENOENT: Not enough entries in the mempool; no object is retrieved.
November 2012
Reference Number: 326004-001
static int rte mempool get bulk ( struct rte_mempool mp, void obj table, unsigned n ) [static]
3.27.4.17
Returns
0: Success; objects taken
-ENOENT: Not enough entries in the mempool; no object is retrieved.
3.27.4.18
static int rte mempool mc get ( struct rte_mempool mp, void obj p ) [static]
Returns
0: Success; objects taken.
-ENOENT: Not enough entries in the mempool; no object is retrieved.
3.27.4.19
static int rte mempool sc get ( struct rte_mempool mp, void obj p ) [static]
November 2012
Reference Number: 326004-001
Parameters
mp A pointer to the mempool structure.
obj_p A pointer to a void pointer (object) that will be filled.
Returns
0: Success; objects taken.
-ENOENT: Not enough entries in the mempool; no object is retrieved.
3.27.4.20
static int rte mempool get ( struct rte_mempool mp, void obj p ) [static]
Returns
0: Success; objects taken.
-ENOENT: Not enough entries in the mempool; no object is retrieved.
3.27.4.21
Returns
The number of entries in the mempool.
November 2012
Reference Number: 326004-001
3.27.4.22
static unsigned rte mempool free count ( const struct rte_mempool mp ) [static]
Returns
The number of free entries in the mempool.
3.27.4.23
Returns
1: The mempool is full.
0: The mempool is not full.
3.27.4.24
Returns
1: The mempool is empty.
0: The mempool is not empty.
November 2012
Reference Number: 326004-001
3.27.4.25
static phys_addr_t rte mempool virt2phy ( const struct rte_mempool mp, const void elt )
[static]
Return the physical address of elt, which is an element of the pool mp.
Parameters
mp A pointer to the mempool structure.
elt A pointer (virtual address) to the element of the pool.
Returns
The physical address of the elt element.
3.27.4.26
3.27.4.27
Returns
A pointer to the private data.
3.27.4.28
3.27.4.29
November 2012
Reference Number: 326004-001
Parameters
name The name of the mempool.
Returns
The pointer to the mempool matching the name, or NULL if not found.NULL on error with rte_errno set
appropriately. Possible rte_errno values include:
ENOENT - required entry not available to return.
3.28
Data Structures
struct rte_memzone
Defines
#define RTE_MEMZONE_2MB
#define RTE_MEMZONE_1GB
#define RTE_MEMZONE_SIZE_HINT_ONLY
#define RTE_MEMZONE_NAMESIZE
Functions
struct rte_memzone rte_memzone_reserve (const char name, uint64_t len, int socket_id, unsigned
flags)
struct rte_memzone rte_memzone_reserve_aligned (const char name, uint64_t len, int socket_id,
unsigned flags, unsigned align)
struct rte_memzone rte_memzone_lookup (const char name)
void rte_memzone_dump (void)
3.28.1
Detailed Description
RTE Memzone
The goal of the memzone allocator is to reserve contiguous portions of physical memory. These zones are
identified by a name.
The memzone descriptors are shared by all partitions and are located in a known place of physical memory.
This zone is accessed using rte_eal_get_configuration(). The lookup (by name) of a memory zone can be
done in any partition and returns the same physical address.
A reserved memory zone cannot be unreserved. The reservation shall be done at initialization time only.
November 2012
Reference Number: 326004-001
3.28.2
Define Documentation
3.28.2.1
3.28.2.2
3.28.2.3
3.28.2.4
3.28.3
Function Documentation
3.28.3.1
struct rte_memzone rte memzone reserve ( const char name, uint64 t len, int socket id, unsigned
flags ) [read]
November 2012
Reference Number: 326004-001
Returns
A pointer to a correctly-filled read-only memzone descriptor, or NULL on error. On error case, rte_errno
will be set appropriately:
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
E_RTE_SECONDARY - function was called from a secondary process instance
ENOSPC - the maximum number of memzones has already been allocated
EEXIST - a memzone with the same name already exists
ENOMEM - no appropriate memory area found in which to create memzone
EINVAL - invalid parameters
3.28.3.2
struct rte_memzone rte memzone reserve aligned ( const char name, uint64 t len, int socket id,
unsigned flags, unsigned align ) [read]
Returns
A pointer to a correctly-filled read-only memzone descriptor, or NULL on error. On error case, rte_errno
will be set appropriately:
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
E_RTE_SECONDARY - function was called from a secondary process instance
ENOSPC - the maximum number of memzones has already been allocated
EEXIST - a memzone with the same name already exists
November 2012
Reference Number: 326004-001
3.28.3.3
Returns
A pointer to a read-only memzone descriptor.
3.28.3.4
3.29
Data Structures
struct rte_pci_resource
struct rte_pci_id
struct rte_pci_addr
struct rte_pci_device
struct rte_pci_driver
Defines
#define SYSFS_PCI_DEVICES
#define PCI_PRI_FMT
#define PCI_FMT_NVAL
#define PCI_RESOURCE_FMT_NVAL
#define PCI_MAX_RESOURCE
#define PCI_ANY_ID
#define RTE_PCI_DEVICE(vend, dev)
November 2012
Reference Number: 326004-001
Typedefs
typedef int( pci_devinit_t )(struct rte_pci_driver , struct rte_pci_device )
Functions
Variables
struct pci_driver_list driver_list
struct pci_device_list device_list
3.29.1
Detailed Description
3.29.2
Define Documentation
3.29.2.1
3.29.2.2
3.29.2.3
3.29.2.4
November 2012
Reference Number: 326004-001
3.29.2.5
3.29.2.6
3.29.2.7
3.29.3
Typedef Documentation
3.29.3.1
3.29.4
Function Documentation
3.29.4.1
3.29.4.2
3.29.4.3
November 2012
Reference Number: 326004-001
3.29.4.4
3.29.4.5
3.29.4.6
void rte eal pci set blacklist ( struct rte_pci_addr blacklist, unsigned size )
Register a list of PCI locations that will be blacklisted (not used by DPDK).
Parameters
blacklist List of PCI device addresses that will not be used by DPDK.
size Number of items in the list.
3.29.5
Variable Documentation
3.29.5.1
3.29.5.2
3.30
Defines
#define PCI_VENDOR_ID_INTEL
3.30.1
Detailed Description
This file contains a list of the PCI device IDs recognised by DPDK, which can be used to fill out an array of
structures describing the devices.
November 2012
Reference Number: 326004-001
Currently two families of devices are recognised: those supported by the IGB driver, and those supported
by the IXGBE driver. The inclusion of these in an array built using this file depends on the definition of
RTE_LIBRTE_IGB_PMD and RTE_LIBRTE_IXGBE_PMD at the time when this file is included.
In order to populate an array, the user of this file must define this macro: RTE_PCI_DEV_ID_DECL(vendorID, deviceID). For example:
struct device {
int vend;
int dev;
};
struct device devices[] = {
#define RTE_PCI_DEV_ID_DECL(vendorID, deviceID) {vend, dev},
#include <rte_pci_dev_ids.h>
};
Note that this file can be included multiple times within the same file.
3.30.2
Define Documentation
3.30.2.1
3.31
Defines
#define RTE_DEFINE_PER_LCORE(type, name)
#define RTE_DECLARE_PER_LCORE(type, name)
#define RTE_PER_LCORE(name)
3.31.1
Detailed Description
3.31.2
Define Documentation
November 2012
Reference Number: 326004-001
3.31.2.1
Macro to define a per lcore variable "var" of type "type", dont use keywords like "static" or "volatile" in type,
just prefix the whole macro.
3.31.2.2
3.31.2.3
3.32
Functions
static void rte_prefetch0 (volatile void p)
static void rte_prefetch1 (volatile void p)
static void rte_prefetch2 (volatile void p)
3.32.1
Detailed Description
Prefetch operations.
This file defines an API for prefetch macros / inline-functions, which are architecture-dependent. Prefetching
occurs when a processor requests an instruction or data from memory to cache before it is actually needed,
potentially speeding up the execution of the program.
3.32.2
Function Documentation
3.32.2.1
3.32.2.2
Prefetch a cache line into all cache levels except the 0th cache level.
November 2012
Reference Number: 326004-001
Parameters
p Address to prefetch
3.32.2.3
Prefetch a cache line into all cache levels except the 0th and 1th cache levels.
Parameters
p Address to prefetch
3.33
Functions
static void rte_srand (uint64_t seedval)
static uint64_t rte_rand (void)
3.33.1
Detailed Description
3.33.2
Function Documentation
3.33.2.1
3.33.2.2
November 2012
Reference Number: 326004-001
Returns
A pseudo-random value between 0 and (1<<64)-1.
3.34
Data Structures
struct rte_ring
struct rte_ring::prod
struct rte_ring::cons
Defines
#define RTE_RING_NAMESIZE
#define RING_F_SP_ENQ
#define RING_F_SC_DEQ
#define __RING_STAT_ADD(r, name, n)
Functions
struct rte_ring rte_ring_create (const char name, unsigned count, int socket_id, unsigned flags)
static int rte_ring_set_bulk_count (struct rte_ring r, unsigned count)
static unsigned rte_ring_get_bulk_count (struct rte_ring r)
int rte_ring_set_water_mark (struct rte_ring r, unsigned count)
void rte_ring_dump (const struct rte_ring r)
static int rte_ring_mp_enqueue_bulk (struct rte_ring r, void const obj_table, unsigned n)
static int rte_ring_sp_enqueue_bulk (struct rte_ring r, void const obj_table, unsigned n)
static int rte_ring_enqueue_bulk (struct rte_ring r, void const obj_table, unsigned n)
static int rte_ring_mp_enqueue (struct rte_ring r, void obj)
static int rte_ring_sp_enqueue (struct rte_ring r, void obj)
static int rte_ring_enqueue (struct rte_ring r, void obj)
static int rte_ring_mc_dequeue_bulk (struct rte_ring r, void obj_table, unsigned n)
static int rte_ring_sc_dequeue_bulk (struct rte_ring r, void obj_table, unsigned n)
static int rte_ring_dequeue_bulk (struct rte_ring r, void obj_table, unsigned n)
static int rte_ring_mc_dequeue (struct rte_ring r, void obj_p)
static int rte_ring_sc_dequeue (struct rte_ring r, void obj_p)
static int rte_ring_dequeue (struct rte_ring r, void obj_p)
static int rte_ring_full (const struct rte_ring r)
static int rte_ring_empty (const struct rte_ring r)
static unsigned rte_ring_count (const struct rte_ring r)
static unsigned rte_ring_free_count (const struct rte_ring r)
void rte_ring_list_dump (void)
struct rte_ring rte_ring_lookup (const char name)
November 2012
Reference Number: 326004-001
3.34.1
Detailed Description
RTE Ring
The Ring Manager is a fixed-size queue, implemented as a table of pointers. Head and tail pointers are
modified atomically, allowing concurrent access to it. It has the following features:
FIFO (First In First Out)
Maximum size is fixed; the pointers are stored in a table.
Lockless implementation.
Multi- or single-consumer dequeue.
Multi- or single-producer enqueue.
Bulk dequeue.
Bulk enqueue.
Note: the ring implementation is not preemptable. A lcore must not be interrupted by another task that uses
the same ring.
3.34.2
Define Documentation
3.34.2.1
3.34.2.2
3.34.2.3
3.34.2.4
November 2012
Reference Number: 326004-001
3.34.3
Function Documentation
3.34.3.1
struct rte_ring rte ring create ( const char name, unsigned count, int socket id, unsigned flags )
[read]
Returns
On success, the pointer to the new allocated ring. NULL on error with rte_errno set appropriately.
Possible errno values include:
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
E_RTE_SECONDARY - function was called from a secondary process instance
E_RTE_NO_TAILQ - no tailq list could be got for the ring list
EINVAL - count provided is not a power of 2
ENOSPC - the maximum number of memzones has already been allocated
EEXIST - a memzone with the same name already exists
ENOMEM - no appropriate memory area found in which to create memzone
3.34.3.2
static int rte ring set bulk count ( struct rte_ring r, unsigned count ) [static]
November 2012
Reference Number: 326004-001
Parameters
r A pointer to the ring structure.
count A new water mark value.
Returns
0: Success; default_bulk_count changed.
-EINVAL: Invalid count value.
3.34.3.3
static unsigned rte ring get bulk count ( struct rte_ring r ) [static]
Returns
The default bulk count for enqueue/dequeue.
3.34.3.4
int rte ring set water mark ( struct rte_ring r, unsigned count )
Returns
0: Success; water mark changed.
-EINVAL: Invalid water mark value.
3.34.3.5
November 2012
Reference Number: 326004-001
Parameters
r A pointer to the ring structure.
3.34.3.6
static int rte ring mp enqueue bulk ( struct rte_ring r, void const obj table, unsigned n ) [static]
Returns
0: Success; objects enqueue.
-EDQUOT: Quota exceeded. The objects have been enqueued, but the high water mark is
exceeded.
-ENOBUFS: Not enough room in the ring to enqueue, no object is enqueued.
3.34.3.7
static int rte ring sp enqueue bulk ( struct rte_ring r, void const obj table, unsigned n ) [static]
3.34.3.8
static int rte ring enqueue bulk ( struct rte_ring r, void const obj table, unsigned n ) [static]
November 2012
Reference Number: 326004-001
This function calls the multi-producer or the single-producer version depending on the default behavior that
was specified at ring creation time (see flags).
Parameters
r A pointer to the ring structure.
obj_table A pointer to a table of void pointers (objects).
n The number of objects to add in the ring from the obj_table.
Returns
0: Success; objects enqueued.
-EDQUOT: Quota exceeded. The objects have been enqueued, but the high water mark is
exceeded.
-ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
static int rte ring mp enqueue ( struct rte_ring r, void obj ) [static]
3.34.3.9
Returns
0: Success; objects enqueued.
-EDQUOT: Quota exceeded. The objects have been enqueued, but the high water mark is
exceeded.
-ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
3.34.3.10
static int rte ring sp enqueue ( struct rte_ring r, void obj ) [static]
November 2012
Reference Number: 326004-001
Returns
0: Success; objects enqueued.
-EDQUOT: Quota exceeded. The objects have been enqueued, but the high water mark is
exceeded.
-ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
static int rte ring enqueue ( struct rte_ring r, void obj ) [static]
3.34.3.11
Returns
0: Success; objects enqueued.
-EDQUOT: Quota exceeded. The objects have been enqueued, but the high water mark is
exceeded.
-ENOBUFS: Not enough room in the ring to enqueue; no object is enqueued.
static int rte ring mc dequeue bulk ( struct rte_ring r, void obj table, unsigned n ) [static]
3.34.3.12
Returns
0: Success; objects dequeued.
-ENOENT: Not enough entries in the ring to dequeue; no object is dequeued.
November 2012
Reference Number: 326004-001
static int rte ring sc dequeue bulk ( struct rte_ring r, void obj table, unsigned n ) [static]
3.34.3.13
Returns
0: Success; objects dequeued.
-ENOENT: Not enough entries in the ring to dequeue; no object is dequeued.
static int rte ring dequeue bulk ( struct rte_ring r, void obj table, unsigned n ) [static]
3.34.3.14
Returns
0: Success; objects dequeued.
-ENOENT: Not enough entries in the ring to dequeue, no object is dequeued.
3.34.3.15
static int rte ring mc dequeue ( struct rte_ring r, void obj p ) [static]
November 2012
Reference Number: 326004-001
Returns
0: Success; objects dequeued.
-ENOENT: Not enough entries in the ring to dequeue; no object is dequeued.
3.34.3.16
static int rte ring sc dequeue ( struct rte_ring r, void obj p ) [static]
Returns
0: Success; objects dequeued.
-ENOENT: Not enough entries in the ring to dequeue, no object is dequeued.
3.34.3.17
static int rte ring dequeue ( struct rte_ring r, void obj p ) [static]
Returns
0: Success, objects dequeued.
-ENOENT: Not enough entries in the ring to dequeue, no object is dequeued.
3.34.3.18
November 2012
Reference Number: 326004-001
Returns
1: The ring is full.
0: The ring is not full.
3.34.3.19
Returns
1: The ring is empty.
0: The ring is not empty.
3.34.3.20
Returns
The number of entries in the ring.
3.34.3.21
static unsigned rte ring free count ( const struct rte_ring r ) [static]
Returns
The number of free entries in the ring.
November 2012
Reference Number: 326004-001
3.34.3.22
3.34.3.23
Returns
The pointer to the ring matching the name, or NULL if not found, with rte_errno set appropriately. Possible rte_errno values include:
ENOENT - required entry not available to return.
3.35
Data Structures
struct rte_rwlock_t
Defines
#define RTE_RWLOCK_INITIALIZER
Functions
3.35.1
Detailed Description
November 2012
Reference Number: 326004-001
3.35.2
Define Documentation
3.35.2.1
3.35.3
Function Documentation
3.35.3.1
3.35.3.2
3.35.3.3
3.35.3.4
November 2012
Reference Number: 326004-001
3.35.3.5
3.36
Data Structures
struct sctp_hdr
3.36.1
Detailed Description
SCTP-related defines
3.37
Data Structures
struct rte_spinlock_t
struct rte_spinlock_recursive_t
Defines
#define RTE_SPINLOCK_INITIALIZER
#define RTE_SPINLOCK_RECURSIVE_INITIALIZER
Functions
November 2012
Reference Number: 326004-001
3.37.1
Detailed Description
RTE Spinlocks
This file defines an API for read-write locks, which are implemented in an architecture-specific way. This
kind of lock simply waits in a loop repeatedly checking until the lock becomes available.
All locks must be initialised before use, and only initialised once.
3.37.2
Define Documentation
3.37.2.1
3.37.2.2
3.37.3
Function Documentation
3.37.3.1
3.37.3.2
3.37.3.3
November 2012
Reference Number: 326004-001
Parameters
sl A pointer to the spinlock.
3.37.3.4
Returns
1 if the lock is successfully taken; 0 otherwise.
3.37.3.5
Returns
1 if the lock is currently taken; 0 otherwise.
3.37.3.6
3.37.3.7
November 2012
Reference Number: 326004-001
3.37.3.8
3.37.3.9
Returns
1 if the lock is successfully taken; 0 otherwise.
3.38
Functions
static int rte_snprintf (char buffer, int buflen, const char format,...)
static int rte_strsplit (char string, int stringlen, char tokens, int maxtokens, char delim)
3.38.1
Detailed Description
3.38.2
Function Documentation
3.38.2.1
static int rte snprintf ( char buffer, int buflen, const char format, ... ) [static]
Safer version of snprintf that writes up to buflen characters to the output buffer and ensures that the resultant
string is null-terminated, that is, it writes at most buflen-1 actual string characters to buffer. The return value
is the number of characters which should be written to the buffer, so string truncation can be detected by
the caller by checking if the return value is greater than or equal to the buflen.
Parameters
buffer The buffer into which the output is to be written
buflen The size of the output buffer
format The format string to be printed to the buffer
November 2012
Reference Number: 326004-001
Returns
The number of characters written to the buffer, or if the string has been truncated, the number of
characters which would have been written had the buffer been sufficiently big.
3.38.2.2
static int rte strsplit ( char string, int stringlen, char tokens, int maxtokens, char delim ) [static]
Takes string "string" parameter and splits it at character "delim" up to maxtokens-1 times - to give
"maxtokens" resulting tokens. Like strtok or strsep functions, this modifies its input string, by replacing
instances of "delim" with \0. All resultant tokens are returned in the "tokens" array which must have enough
entries to hold "maxtokens".
Parameters
string
stringlen
tokens
maxtokens
Returns
The number of tokens in the tokens array.
3.39
Data Structures
struct rte_dummy
struct rte_tailq_head
Defines
#define RTE_TAILQ_RESERVE(name, struct_name)
#define RTE_TAILQ_LOOKUP(name, struct_name)
Functions
TAILQ_HEAD (rte_dummy_head, rte_dummy)
struct rte_tailq_head rte_eal_tailq_reserve (const char name)
struct rte_tailq_head rte_eal_tailq_lookup (const char name)
November 2012
Reference Number: 326004-001
3.39.1
Detailed Description
3.39.2
Define Documentation
3.39.2.1
Returns
The return value from rte_eal_tailq_reserve, typecast to the appropriate structure pointer type. NULL
on error, since the tailq_head is the first element in the rte_tailq_head structure.
3.39.2.2
Returns
The return value from rte_eal_tailq_lookup, typecast to the appropriate structure pointer type. NULL on
error, since the tailq_head is the first element in the rte_tailq_head structure.
3.39.3
Function Documentation
3.39.3.1
dummy
3.39.3.2
struct rte_tailq_head rte eal tailq reserve ( const char name ) [read]
Reserve a slot in the tailq list for a particular tailq header Note: this function, along with rte_tailq_lookup, is
not multi-thread safe, and both these functions should only be called from a single thread at a time
November 2012
Reference Number: 326004-001
Parameters
name The name to be given to the tail queue.
Returns
A pointer to the newly reserved tailq entry
3.39.3.3
struct rte_tailq_head rte eal tailq lookup ( const char name ) [read]
Returns
A pointer to the tail queue head structure.
3.40
Data Structures
struct tcp_hdr
3.40.1
Detailed Description
TCP-related defines
3.41
Data Structures
union rte_timer_status
struct rte_timer
November 2012
Reference Number: 326004-001
Defines
#define RTE_TIMER_STOP
#define RTE_TIMER_PENDING
#define RTE_TIMER_RUNNING
#define RTE_TIMER_CONFIG
#define RTE_TIMER_NO_OWNER
#define RTE_TIMER_INITIALIZER
Typedefs
typedef void( rte_timer_cb_t )(struct rte_timer , void )
Enumerations
enum rte_timer_type
Functions
void rte_timer_subsystem_init (void)
void rte_timer_init (struct rte_timer tim)
int rte_timer_reset (struct rte_timer tim, uint64_t ticks, enum rte_timer_type type, unsigned tim_lcore,
rte_timer_cb_t fct, void arg)
void rte_timer_reset_sync (struct rte_timer tim, uint64_t ticks, enum rte_timer_type type, unsigned
tim_lcore, rte_timer_cb_t fct, void arg)
int rte_timer_stop (struct rte_timer tim)
void rte_timer_stop_sync (struct rte_timer tim)
int rte_timer_pending (struct rte_timer tim)
void rte_timer_manage (void)
void rte_timer_dump_stats (void)
3.41.1
Detailed Description
RTE Timer
This library provides a timer service to RTE Data Plane execution units that allows the execution of callback
functions asynchronously.
Timers can be periodic or single (one-shot).
The timers can be loaded from one core and executed on another. This has to be specified in the call
to rte_timer_reset().
High precision is possible. NOTE: this depends on the call frequency to rte_timer_manage() that check
the timer expiration for the local core.
November 2012
Reference Number: 326004-001
If not used in an application, for improved performance, it can be disabled at compilation time by not
calling the rte_timer_manage() to improve performance.
The timer library uses the rte_get_hpet_cycles() function that uses the HPET, when available, to provide a
reliable time reference. [HPET routines are provided by EAL, which falls back to using the chip TSC (timestamp counter) as fallback when HPET is not available]
This library provides an interface to add, delete and restart a timer. The API is based on the BSD callout(9)
API with a few differences.
See the RTE architecture documentation for more information about the design of this library.
3.41.2
Define Documentation
3.41.2.1
3.41.2.2
3.41.2.3
3.41.2.4
3.41.2.5
3.41.2.6
3.41.3
Typedef Documentation
3.41.3.1
November 2012
Reference Number: 326004-001
3.41.4
3.41.4.1
enum rte_timer_type
3.41.5
Function Documentation
3.41.5.1
3.41.5.2
3.41.5.3
int rte timer reset ( struct rte_timer tim, uint64 t ticks, enum rte_timer_type type, unsigned tim lcore,
rte_timer_cb_t fct, void arg )
Reset and start the timer associated with the timer handle.
The rte_timer_reset() function resets and starts the timer associated with the timer handle tim. When the
timer expires after ticks HPET cycles, the function specified by fct will be called with the argument arg
on core tim_lcore.
If the timer associated with the timer handle is already running (in the RUNNING state), the function will
fail. The user has to check the return value of the function to see if there is a chance that the timer is in the
RUNNING state.
If the timer is being configured on another core (the CONFIG state), it will also fail.
If the timer is pending or stopped, it will be rescheduled with the new parameters.
November 2012
Reference Number: 326004-001
Parameters
tim The timer handle.
ticks The number of cycles (see rte_get_hpet_hz()) before the callback function is called.
type The type can be either:
PERIODICAL: The timer is automatically reloaded after execution (returns to the
PENDING state)
SINGLE: The timer is one-shot, that is, the timer goes to a STOPPED state after
execution.
tim_lcore The ID of the lcore where the timer callback function has to be executed. If tim_lcore is
LCORE_ID_ANY, the timer library will launch it on a different core for each call (roundrobin).
fct The callback function of the timer.
arg The user argument of the callback function.
Returns
0: Success; the timer is scheduled.
(-1): Timer is in the RUNNING or CONFIG state.
3.41.5.4
void rte timer reset sync ( struct rte_timer tim, uint64 t ticks, enum rte_timer_type type, unsigned
tim lcore, rte_timer_cb_t fct, void arg )
November 2012
Reference Number: 326004-001
3.41.5.5
Stop a timer.
The rte_timer_stop() function stops the timer associated with the timer handle tim. It may fail if the timer
is currently running or being configured.
If the timer is pending or stopped (for instance, already expired), the function will succeed. The timer handle
tim must have been initialized using rte_timer_init(), otherwise, undefined behavior will occur.
This function can be called safely from a timer callback. If it succeeds, the timer is not referenced anymore
by the timer library and the timer structure can be freed (even in the callback function).
Parameters
tim The timer handle.
Returns
0: Success; the timer is stopped.
(-1): The timer is in the RUNNING or CONFIG state.
3.41.5.6
3.41.5.7
Returns
0: The timer is not pending.
1: The timer is pending.
November 2012
Reference Number: 326004-001
3.41.5.8
3.41.5.9
3.42
Data Structures
struct udp_hdr
3.42.1
Detailed Description
UDP-related defines
3.43
Defines
#define RTE_VER_MAJOR
#define RTE_VER_MINOR
#define RTE_VER_PATCH_LEVEL
Functions
static const char rte_version (void)
3.43.1
Detailed Description
November 2012
Reference Number: 326004-001
3.43.2
Define Documentation
3.43.2.1
3.43.2.2
3.43.2.3
3.43.3
Function Documentation
3.43.3.1
3.44
3.44.1
Detailed Description
November 2012
Reference Number: 326004-001