@@ -562,7 +562,7 @@ NIC Reset API
.. code-block:: c
- int rte_eth_dev_reset(uint8_t port_id);
+ int rte_eth_dev_reset(uint16_t port_id);
Sometimes a port has to be reset passively. For example when a PF is
reset, all its VFs should also be reset by the application to make them
@@ -1418,7 +1418,7 @@ supported and can be created.
.. code-block:: c
int
- rte_flow_validate(uint8_t port_id,
+ rte_flow_validate(uint16_t port_id,
const struct rte_flow_attr *attr,
const struct rte_flow_item pattern[],
const struct rte_flow_action actions[],
@@ -1473,7 +1473,7 @@ actually created and a handle returned.
.. code-block:: c
struct rte_flow *
- rte_flow_create(uint8_t port_id,
+ rte_flow_create(uint16_t port_id,
const struct rte_flow_attr *attr,
const struct rte_flow_item pattern[],
const struct rte_flow_action *actions[],
@@ -1505,7 +1505,7 @@ performing this step before releasing resources.
.. code-block:: c
int
- rte_flow_destroy(uint8_t port_id,
+ rte_flow_destroy(uint16_t port_id,
struct rte_flow *flow,
struct rte_flow_error *error);
@@ -1536,7 +1536,7 @@ port. They are released as with successive calls to ``rte_flow_destroy()``.
.. code-block:: c
int
- rte_flow_flush(uint8_t port_id,
+ rte_flow_flush(uint16_t port_id,
struct rte_flow_error *error);
In the unlikely event of failure, handles are still considered destroyed and
@@ -1564,7 +1564,7 @@ definition.
.. code-block:: c
int
- rte_flow_query(uint8_t port_id,
+ rte_flow_query(uint16_t port_id,
struct rte_flow *flow,
enum rte_flow_action_type action,
void *data,
@@ -1637,7 +1637,7 @@ port and may return errors such as ``ENOTSUP`` ("not supported"):
.. code-block:: c
int
- rte_flow_isolate(uint8_t port_id, int set, struct rte_flow_error *error);
+ rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
Arguments:
@@ -268,7 +268,7 @@ The actual packet transmission is done in the mcast_send_pkt() function:
.. code-block:: c
- static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint8_t port)
+ static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port)
{
struct ether_hdr *ethdr;
uint16_t len;
@@ -246,7 +246,7 @@ The code for allocating the kernel NIC interfaces for a specific port is as foll
.. code-block:: c
static int
- kni_alloc(uint8_t port_id)
+ kni_alloc(uint16_t port_id)
{
uint8_t i;
struct rte_kni *kni;
@@ -335,7 +335,7 @@ The code is as follows:
int i, j, nb_token;
char *str_fld[_NUM_FLD];
unsigned long int_fld[_NUM_FLD];
- uint8_t port_id, nb_kni_port_params = 0;
+ uint16_t port_id, nb_kni_port_params = 0;
memset(&kni_port_params_array, 0, sizeof(kni_port_params_array));
@@ -532,7 +532,7 @@ Currently, setting a new MTU and configuring the network interface (up/ down) ar
/* Callback for request of changing MTU */
static int
- kni_change_mtu(uint8_t port_id, unsigned new_mtu)
+ kni_change_mtu(uint16_t port_id, unsigned new_mtu)
{
int ret;
struct rte_eth_conf conf;
@@ -581,7 +581,7 @@ Currently, setting a new MTU and configuring the network interface (up/ down) ar
/* Callback for request of configuring network interface up/down */
static int
- kni_config_network_interface(uint8_t port_id, uint8_t if_up)
+ kni_config_network_interface(uint16_t port_id, uint8_t if_up)
{
int ret = 0;
@@ -558,7 +558,7 @@ If the table is full, the whole packets table is transmitted using the l2fwd_sen
/* Send the packet on an output interface */
static int
- l2fwd_send_packet(struct rte_mbuf *m, uint8_t port)
+ l2fwd_send_packet(struct rte_mbuf *m, uint16_t port)
{
unsigned lcore_id, len;
struct lcore_queue_conf *qconf;
@@ -593,7 +593,7 @@ however it improves performance:
unsigned lcore_id;
struct lcore_queue_conf *qconf;
struct mbuf_table *m_table;
- uint8_t portid;
+ uint16_t portid;
lcore_id = rte_lcore_id();
qconf = &lcore_queue_conf[lcore_id];
@@ -474,7 +474,7 @@ If the table is full, the whole packets table is transmitted using the l2fwd_sen
/* Send the packet on an output interface */
static int
- l2fwd_send_packet(struct rte_mbuf *m, uint8_t port)
+ l2fwd_send_packet(struct rte_mbuf *m, uint16_t port)
{
unsigned lcore_id, len;
struct lcore_queue_conf *qconf;
@@ -283,7 +283,7 @@ The get_ipv4_dst_port() function is shown below:
.. code-block:: c
static inline uint8_t
- get_ipv4_dst_port(void *ipv4_hdr, uint8_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct)
+ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct)
{
int ret = 0;
union ipv4_5tuple_host key;
@@ -312,7 +312,7 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below:
.. code-block:: c
static inline void
- simple_ipv4_fwd_4pkts(struct rte_mbuf* m[4], uint8_t portid, struct lcore_conf *qconf)
+ simple_ipv4_fwd_4pkts(struct rte_mbuf* m[4], uint16_t portid, struct lcore_conf *qconf)
{
// ...
@@ -351,10 +351,10 @@ for LPM-based lookups is done by the get_ipv4_dst_port() function below:
.. code-block:: c
- static inline uint8_t
- get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint8_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct)
+ static inline uint16_t
+ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct)
{
uint8_t next_hop;
- return (uint8_t) ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop) == 0)? next_hop : portid);
+ return ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop) == 0)? next_hop : portid);
}
@@ -181,11 +181,11 @@ responsible for checking if it needs to scale down frequency at run time by chec
struct lcore_conf *qconf;
int ret;
unsigned nb_ports;
- uint16_t queueid;
+ uint16_t queueid, portid;
unsigned lcore_id;
uint64_t hz;
uint32_t n_tx_queue, nb_lcores;
- uint8_t portid, nb_rx_queue, queue, socketid;
+ uint8_t nb_rx_queue, queue, socketid;
// ...
@@ -219,7 +219,7 @@ An example callback function that has been written as indicated below.
.. code-block:: c
static void
- lsi_event_callback(uint8_t port_id, enum rte_eth_event_type type, void *param)
+ lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param)
{
struct rte_eth_link link;
@@ -405,7 +405,7 @@ If the table is full, the whole packets table is transmitted using the lsi_send_
/* Send the packet on an output interface */
static int
- lsi_send_packet(struct rte_mbuf *m, uint8_t port)
+ lsi_send_packet(struct rte_mbuf *m, uint16_t port)
{
unsigned lcore_id, len;
struct lcore_queue_conf *qconf;
@@ -257,7 +257,7 @@ PTP IEEE1588 L2 functionality.
.. code-block:: c
void
- parse_ptp_frames(uint8_t portid, struct rte_mbuf *m) {
+ parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) {
struct ptp_header *ptp_hdr;
struct ether_hdr *eth_hdr;
uint16_t eth_type;
@@ -124,7 +124,7 @@ comments:
.. code-block:: c
static inline int
- port_init(uint8_t port, struct rte_mempool *mbuf_pool)
+ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
{
struct rte_eth_conf port_conf = port_conf_default;
const uint16_t rx_rings = 1, tx_rings = 1;
@@ -196,7 +196,7 @@ all packets received:
.. code-block:: c
static uint16_t
- add_timestamps(uint8_t port __rte_unused, uint16_t qidx __rte_unused,
+ add_timestamps(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
struct rte_mbuf **pkts, uint16_t nb_pkts, void *_ __rte_unused)
{
unsigned i;
@@ -222,7 +222,7 @@ packets prior to transmission:
.. code-block:: c
static uint16_t
- calc_latency(uint8_t port __rte_unused, uint16_t qidx __rte_unused,
+ calc_latency(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
struct rte_mbuf **pkts, uint16_t nb_pkts, void *_ __rte_unused)
{
uint64_t cycles = 0;
@@ -160,7 +160,7 @@ Forwarding application is shown below:
.. code-block:: c
static inline int
- port_init(uint8_t port, struct rte_mempool *mbuf_pool)
+ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
{
struct rte_eth_conf port_conf = port_conf_default;
const uint16_t rx_rings = 1, tx_rings = 1;
@@ -241,8 +241,8 @@ looks like the following:
static __attribute__((noreturn)) void
lcore_main(void)
{
- const uint8_t nb_ports = rte_eth_dev_count();
- uint8_t port;
+ const uint16_t nb_ports = rte_eth_dev_count();
+ uint16_t port;
/*
* Check that the port is on the same NUMA node as the polling thread