TAPI for RTE MBUF API remote calls
Overview
// global functions rpc_rte_mempool_p rpc_rte_pktmbuf_pool_create(rcf_rpc_server* rpcs, const char* name, uint32_t n, uint32_t cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id); rpc_rte_mempool_p rpc_rte_pktmbuf_pool_create_by_ops(rcf_rpc_server* rpcs, const char* name, uint32_t n, uint32_t cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id, const char* ops_name); rpc_rte_mbuf_p rpc_rte_pktmbuf_alloc(rcf_rpc_server* rpcs, rpc_rte_mempool_p mp); void rpc_rte_pktmbuf_free(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); void rpc_rte_pktmbuf_free_array(rcf_rpc_server* rpcs, rpc_rte_mbuf_p* mbufs, unsigned int count); int rpc_rte_pktmbuf_append_data(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, const uint8_t* buf, size_t len); int rpc_rte_pktmbuf_read_data(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, size_t offset, size_t count, uint8_t* buf, size_t rbuflen); rpc_rte_mbuf_p rpc_rte_pktmbuf_clone(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, rpc_rte_mempool_p mp); int rpc_rte_pktmbuf_prepend_data(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint8_t* buf, size_t len); rpc_rte_mbuf_p rpc_rte_pktmbuf_get_next(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); uint32_t rpc_rte_pktmbuf_get_pkt_len(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); const char* rpc_rte_mbufs2str(te_log_buf* tlbp, const rpc_rte_mbuf_p* mbufs, unsigned int count, rcf_rpc_server* rpcs); int rpc_rte_pktmbuf_alloc_bulk(rcf_rpc_server* rpcs, rpc_rte_mempool_p mp, rpc_rte_mbuf_p* bulk, unsigned int count); int rpc_rte_pktmbuf_chain(rcf_rpc_server* rpcs, rpc_rte_mbuf_p head, rpc_rte_mbuf_p tail); uint16_t rpc_rte_pktmbuf_get_nb_segs(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); uint16_t rpc_rte_pktmbuf_get_port(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); void rpc_rte_pktmbuf_set_port(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t port); uint16_t rpc_rte_pktmbuf_get_data_len(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); uint16_t rpc_rte_pktmbuf_get_vlan_tci(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); void rpc_rte_pktmbuf_set_vlan_tci(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t vlan_tci); uint16_t rpc_rte_pktmbuf_get_vlan_tci_outer(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); void rpc_rte_pktmbuf_set_vlan_tci_outer(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t vlan_tci_outer); uint64_t rpc_rte_pktmbuf_get_flags(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); int rpc_rte_pktmbuf_set_flags(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint64_t ol_flags); rpc_rte_mempool_p rpc_rte_pktmbuf_get_pool(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); uint16_t rpc_rte_pktmbuf_headroom(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); uint16_t rpc_rte_pktmbuf_tailroom(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); int rpc_rte_pktmbuf_trim(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t len); uint16_t rpc_rte_pktmbuf_adj(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t len); void rpc_rte_pktmbuf_get_packet_type(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, struct tarpc_rte_pktmbuf_packet_type* p_type); int rpc_rte_pktmbuf_set_packet_type(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, const struct tarpc_rte_pktmbuf_packet_type* p_type); uint32_t rpc_rte_pktmbuf_get_rss_hash(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); uint32_t rpc_rte_pktmbuf_get_fdir_id(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); void rpc_rte_pktmbuf_get_tx_offload(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, struct tarpc_rte_pktmbuf_tx_offload* tx_offload); void rpc_rte_pktmbuf_set_tx_offload(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, const struct tarpc_rte_pktmbuf_tx_offload* tx_offload); void rpc_rte_pktmbuf_refcnt_update(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, int16_t v); int rpc_rte_pktmbuf_redist_multi(rcf_rpc_server* rpcs, rpc_rte_mbuf_p* m, rpc_rte_mempool_p* mp_multi, unsigned int mp_multi_nb_items, struct tarpc_pktmbuf_seg_group* seg_groups, uint8_t nb_seg_groups); int rpc_rte_pktmbuf_redist(rcf_rpc_server* rpcs, rpc_rte_mbuf_p* m, struct tarpc_pktmbuf_seg_group* seg_groups, uint8_t nb_seg_groups); int rpc_rte_vlan_strip(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m); int rpc_rte_pktmbuf_calc_packet_crc(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, bool crc_in_data, uint32_t* crc);
Detailed Documentation
Global Functions
rpc_rte_mempool_p rpc_rte_pktmbuf_pool_create(rcf_rpc_server* rpcs, const char* name, uint32_t n, uint32_t cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id)
rte_pktmbuf_pool_create() RPC
Parameters:
name |
The name of the mbuf pool |
n |
The number of elements in the mbuf pool |
cache_size |
Size of the per-core object cache |
priv_size |
Size of application private are between the rte_mbuf structure and the data buffer |
data_room_size |
Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM |
socket_id |
The socket identifier where the memory should be allocated |
Returns:
RTE mempool pointer on success; jumps out when pointer is NULL
rpc_rte_mempool_p rpc_rte_pktmbuf_pool_create_by_ops(rcf_rpc_server* rpcs, const char* name, uint32_t n, uint32_t cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id, const char* ops_name)
rte_pktmbuf_pool_create_by_ops() RPC
Parameters:
name |
The name of the mbuf pool |
n |
The number of elements in the mbuf pool |
cache_size |
Size of the per-core object cache |
priv_size |
Size of application private are between the rte_mbuf structure and the data buffer |
data_room_size |
Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM |
socket_id |
The socket identifier where the memory should be allocated |
ops_name |
The mempool ops name to be used for this mempool instead of default mempool. The value can be NULL to use default mempool |
Returns:
RTE mempool pointer on success; jumps out when pointer is NULL
rpc_rte_mbuf_p rpc_rte_pktmbuf_alloc(rcf_rpc_server* rpcs, rpc_rte_mempool_p mp)
rte_pktmbuf_alloc() RPC
Parameters:
mp |
RTE mempool pointer |
Returns:
RTE mbuf pointer on success; jumps out when pointer is NULL
void rpc_rte_pktmbuf_free(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
rte_pktmbuf_free() RPC
Parameters:
m |
RTE mbuf pointer |
void rpc_rte_pktmbuf_free_array(rcf_rpc_server* rpcs, rpc_rte_mbuf_p* mbufs, unsigned int count)
rte_pktmbuf_free_array() RPC
Parameters:
mbufs |
Pointer to array of RTE mbuf pointers |
count |
Number of pointers in array |
int rpc_rte_pktmbuf_append_data(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, const uint8_t* buf, size_t len)
Append data to an mbuf
Parameters:
m |
RTE mbuf pointer |
buf |
Pointer to a buffer containing data |
len |
Buffer length |
Returns:
0
on success; jumps out in case of failure
int rpc_rte_pktmbuf_read_data(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, size_t offset, size_t count, uint8_t* buf, size_t rbuflen)
Read data from an mbuf with a particular offset
Parameters:
m |
RTE mbuf pointer |
offset |
Offset into mbuf data |
count |
Amount of data to be read (bytes) |
buf |
Pointer to a buffer for data to be read in |
rbuflen |
Buffer length |
Returns:
Amount of data actually read (bytes); jumps out on error
rpc_rte_mbuf_p rpc_rte_pktmbuf_clone(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, rpc_rte_mempool_p mp)
rte_pktmbuf_clone() RPC
Parameters:
m |
RTE mbuf pointer |
mp |
RTE mempool pointer |
Returns:
RTE mbuf pointer on success; jumps out when pointer is NULL
int rpc_rte_pktmbuf_prepend_data(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint8_t* buf, size_t len)
Prepend data to an mbuf
Parameters:
m |
RTE mbuf pointer |
buf |
Pointer to a buffer containing data |
len |
Buffer length |
Returns:
0
on success; jumps out in case of failure
rpc_rte_mbuf_p rpc_rte_pktmbuf_get_next(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get pointer to the next mbuf segment in an mbuf chain
Parameters:
m |
RTE mbuf pointer |
Returns:
RTE mbuf pointer; doesn’t jump out when pointer is NULL
uint32_t rpc_rte_pktmbuf_get_pkt_len(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get packet length
Parameters:
m |
RTE mbuf pointer |
Returns:
Packet length (bytes)
const char* rpc_rte_mbufs2str(te_log_buf* tlbp, const rpc_rte_mbuf_p* mbufs, unsigned int count, rcf_rpc_server* rpcs)
Auxiliary function for logging mbuf pointers; it should be used by RPCs in TAPI_RPC_LOG() statements
int rpc_rte_pktmbuf_alloc_bulk(rcf_rpc_server* rpcs, rpc_rte_mempool_p mp, rpc_rte_mbuf_p* bulk, unsigned int count)
rte_pktmbuf_alloc_bulk() RPC
Parameters:
mp |
RTE mempool pointer |
bulk |
Pointer for the resulting array of pointers |
count |
The number of mbufs to allocate |
Returns:
0
on success; jumps out in case of failure
int rpc_rte_pktmbuf_chain(rcf_rpc_server* rpcs, rpc_rte_mbuf_p head, rpc_rte_mbuf_p tail)
rte_pktmbuf_chain() RPC
Parameters:
head |
RTE mbuf pointer (head) |
tail |
RTE mbuf pointer (tail) |
Returns:
0
on success; jumps out in case of error (i.e., -EOVERFLOW)
uint16_t rpc_rte_pktmbuf_get_nb_segs(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
rte_pktmbuf_get_nb_segs() RPC
Parameters:
m |
RTE mbuf pointer |
Returns:
The number of segments in the mbuf chain
uint16_t rpc_rte_pktmbuf_get_port(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
rte_pktmbuf_get_port() RPC
Parameters:
m |
RTE mbuf pointer |
Returns:
Input port
void rpc_rte_pktmbuf_set_port(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t port)
rte_pktmbuf_set_port() RPC
Parameters:
m |
RTE mbuf pointer |
port |
Port number to set |
uint16_t rpc_rte_pktmbuf_get_data_len(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get mbuf segment data length
Parameters:
m |
RTE mbuf pointer |
Returns:
Data length (bytes)
uint16_t rpc_rte_pktmbuf_get_vlan_tci(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get VLAN TCI
Parameters:
m |
RTE mbuf pointer |
Returns:
VLAN TCI
void rpc_rte_pktmbuf_set_vlan_tci(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t vlan_tci)
Set VLAN TCI
Parameters:
m |
RTE mbuf pointer |
vlan_tci |
VLAN TCI |
uint16_t rpc_rte_pktmbuf_get_vlan_tci_outer(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get VLAN TCI (outer)
Parameters:
m |
RTE mbuf pointer |
Returns:
VLAN TCI (outer)
void rpc_rte_pktmbuf_set_vlan_tci_outer(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t vlan_tci_outer)
Set VLAN TCI (outer)
Parameters:
m |
RTE mbuf pointer |
vlan_tci_outer |
VLAN TCI (outer) |
uint64_t rpc_rte_pktmbuf_get_flags(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get mbuf offload flags
Parameters:
m |
RTE mbuf pointer |
Returns:
Offload flags bitmask for the particular mbuf
int rpc_rte_pktmbuf_set_flags(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint64_t ol_flags)
Set mbuf offload flags
Parameters:
m |
RTE mbuf pointer |
ol_flags |
Offload flags bitmask to be set |
Returns:
0
on success; jumps out if some flags cannot be set (i.e. -EINVAL)
rpc_rte_mempool_p rpc_rte_pktmbuf_get_pool(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get a pointer to mempool within which the particular mbuf has been allocated
Parameters:
m |
RTE mbuf pointer |
Returns:
RTE mempool pointer on success; jumps out when pointer is NULL
uint16_t rpc_rte_pktmbuf_headroom(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get the headroom length in the particular mbuf
Parameters:
m |
RTE mbuf pointer |
Returns:
Headroom length; jumps out in case of invalid value (i.e. UINT16_MAX)
uint16_t rpc_rte_pktmbuf_tailroom(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get the tailroom length in the particular mbuf
Parameters:
m |
RTE mbuf pointer |
Returns:
Tailroom length; jumps out in case of invalid value (i.e. UINT16_MAX)
int rpc_rte_pktmbuf_trim(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t len)
rte_pktmbuf_trim() RPC
Parameters:
m |
RTE mbuf pointer |
len |
Amount of bytes to be trimmed |
Returns:
0
on success; jumps out in case of failure
uint16_t rpc_rte_pktmbuf_adj(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, uint16_t len)
rte_pktmbuf_adj() RPC
Parameters:
m |
RTE mbuf pointer |
len |
Amount of bytes to be removed at the beginning of mbuf |
Returns:
The new data_off
on success; jumps out on error (i.e., UINT16_MAX)
void rpc_rte_pktmbuf_get_packet_type(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, struct tarpc_rte_pktmbuf_packet_type* p_type)
Get packet type flags
Parameters:
m |
RTE mbuf pointer |
p_type |
Pointer to a structure to be filled with the info |
int rpc_rte_pktmbuf_set_packet_type(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, const struct tarpc_rte_pktmbuf_packet_type* p_type)
Set packet type flags
Parameters:
m |
RTE mbuf pointer |
p_type |
Pointer to a structure containing info to be populated |
Returns:
0
on success; jumps out if some types cannot be set (i.e. -EINVAL)
uint32_t rpc_rte_pktmbuf_get_rss_hash(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get RSS hash
Parameters:
m |
RTE mbuf pointer |
Returns:
RSS hash for the particular mbuf
uint32_t rpc_rte_pktmbuf_get_fdir_id(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
Get FDIR ID, if RTE_MBUF_F_RX_FDIR_ID is in offload flags
Parameters:
m |
RTE mbuf pointer |
Returns:
FDIR ID for the particular mbuf
void rpc_rte_pktmbuf_get_tx_offload(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, struct tarpc_rte_pktmbuf_tx_offload* tx_offload)
Get parameters needed by TX offload to work
Parameters:
m |
RTE mbuf pointer |
tx_offload |
Pointer to structure to be filled with the info |
void rpc_rte_pktmbuf_set_tx_offload(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, const struct tarpc_rte_pktmbuf_tx_offload* tx_offload)
Set parameters needed by TX offload to work
Parameters:
m |
RTE mbuf pointer |
tx_offload |
Pointer to a structure containing info to be populated |
void rpc_rte_pktmbuf_refcnt_update(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, int16_t v)
rte_pktmbuf_refcnt_update()
RPC
Parameters:
m |
RTE pktmbuf pointer |
v |
The value to be added to reference counters for the corresponding segments which |
int rpc_rte_pktmbuf_redist_multi(rcf_rpc_server* rpcs, rpc_rte_mbuf_p* m, rpc_rte_mempool_p* mp_multi, unsigned int mp_multi_nb_items, struct tarpc_pktmbuf_seg_group* seg_groups, uint8_t nb_seg_groups)
Redistribute a packet mbuf data across some given number of segments of variable length according to segmentation pattern provided by the caller (an array of segment group definitions and the number of elements in the array) to produce a new mbuf chain with a different RPC pointer.
The new segments are allocated from a subset of memory pools mp_multi
in a round-robin style; fallback to the default pool (obtained from m
) will happen if either mp_multi
is unset or mempool shortages take place.
Parameters:
m |
RTE mbuf pointer (in / out) |
mp_multi |
An array of RTE mempool pointers |
mp_multi_nb_items |
The number of RTE mempool pointers |
seg_groups |
An array of segment group definitions |
nb_seg_groups |
The number of segment group definitions |
Returns:
The number of segments produced or a negative errno value
int rpc_rte_pktmbuf_redist(rcf_rpc_server* rpcs, rpc_rte_mbuf_p* m, struct tarpc_pktmbuf_seg_group* seg_groups, uint8_t nb_seg_groups)
Single-pool wrapper for rpc_rte_pktmbuf_redist_multi()
. Default mempool is picked from m
.
int rpc_rte_vlan_strip(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m)
rte_vlan_strip() RPC
If failure is not expected, the function jumps out in the case of return value is not equal to 0 or -1.
int rpc_rte_pktmbuf_calc_packet_crc(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, bool crc_in_data, uint32_t* crc)
Calculate CRC of a packet in the mbuf
Parameters:
m |
RTE mbuf pointer |
crc_in_data |
Is CRC in packet data |
crc |
Calculated CRC |
Returns:
0
on success; jumps out in case of failure