examples: fix port id type
Fixes: f8244c6399
("ethdev: increase port id range")
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
This commit is contained in:
parent
b526f05524
commit
47523597ff
@ -212,7 +212,7 @@ lcore_rx(struct lcore_params *p)
|
||||
{
|
||||
const uint16_t nb_ports = rte_eth_dev_count();
|
||||
const int socket_id = rte_socket_id();
|
||||
uint8_t port;
|
||||
uint16_t port;
|
||||
struct rte_mbuf *bufs[BURST_SIZE*2];
|
||||
|
||||
for (port = 0; port < nb_ports; port++) {
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
|
||||
int
|
||||
rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
|
||||
rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
|
||||
{
|
||||
struct rte_eth_dev_info dev_info;
|
||||
struct rte_dev_reg_info reg_info;
|
||||
@ -106,7 +106,7 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_get_regs_len(uint8_t port_id)
|
||||
rte_ethtool_get_regs_len(uint16_t port_id)
|
||||
{
|
||||
struct rte_dev_reg_info reg_info;
|
||||
int ret;
|
||||
@ -121,7 +121,7 @@ rte_ethtool_get_regs_len(uint8_t port_id)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_get_regs(uint8_t port_id, struct ethtool_regs *regs, void *data)
|
||||
rte_ethtool_get_regs(uint16_t port_id, struct ethtool_regs *regs, void *data)
|
||||
{
|
||||
struct rte_dev_reg_info reg_info;
|
||||
int status;
|
||||
@ -141,7 +141,7 @@ rte_ethtool_get_regs(uint8_t port_id, struct ethtool_regs *regs, void *data)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_get_link(uint8_t port_id)
|
||||
rte_ethtool_get_link(uint16_t port_id)
|
||||
{
|
||||
struct rte_eth_link link;
|
||||
|
||||
@ -151,13 +151,13 @@ rte_ethtool_get_link(uint8_t port_id)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_get_eeprom_len(uint8_t port_id)
|
||||
rte_ethtool_get_eeprom_len(uint16_t port_id)
|
||||
{
|
||||
return rte_eth_dev_get_eeprom_length(port_id);
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_get_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,
|
||||
rte_ethtool_get_eeprom(uint16_t port_id, struct ethtool_eeprom *eeprom,
|
||||
void *words)
|
||||
{
|
||||
struct rte_dev_eeprom_info eeprom_info;
|
||||
@ -180,7 +180,7 @@ rte_ethtool_get_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_set_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,
|
||||
rte_ethtool_set_eeprom(uint16_t port_id, struct ethtool_eeprom *eeprom,
|
||||
void *words)
|
||||
{
|
||||
struct rte_dev_eeprom_info eeprom_info;
|
||||
@ -203,7 +203,7 @@ rte_ethtool_set_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_get_pauseparam(uint8_t port_id,
|
||||
rte_ethtool_get_pauseparam(uint16_t port_id,
|
||||
struct ethtool_pauseparam *pause_param)
|
||||
{
|
||||
struct rte_eth_fc_conf fc_conf;
|
||||
@ -238,7 +238,7 @@ rte_ethtool_get_pauseparam(uint8_t port_id,
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_set_pauseparam(uint8_t port_id,
|
||||
rte_ethtool_set_pauseparam(uint16_t port_id,
|
||||
struct ethtool_pauseparam *pause_param)
|
||||
{
|
||||
struct rte_eth_fc_conf fc_conf;
|
||||
@ -281,7 +281,7 @@ rte_ethtool_set_pauseparam(uint8_t port_id,
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_net_open(uint8_t port_id)
|
||||
rte_ethtool_net_open(uint16_t port_id)
|
||||
{
|
||||
rte_eth_dev_stop(port_id);
|
||||
|
||||
@ -289,7 +289,7 @@ rte_ethtool_net_open(uint8_t port_id)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_net_stop(uint8_t port_id)
|
||||
rte_ethtool_net_stop(uint16_t port_id)
|
||||
{
|
||||
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
|
||||
rte_eth_dev_stop(port_id);
|
||||
@ -298,7 +298,7 @@ rte_ethtool_net_stop(uint8_t port_id)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr)
|
||||
rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr)
|
||||
{
|
||||
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
|
||||
if (addr == NULL)
|
||||
@ -309,7 +309,7 @@ rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr *addr)
|
||||
rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr)
|
||||
{
|
||||
if (addr == NULL)
|
||||
return -EINVAL;
|
||||
@ -317,7 +317,7 @@ rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr *addr)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_net_validate_addr(uint8_t port_id __rte_unused,
|
||||
rte_ethtool_net_validate_addr(uint16_t port_id __rte_unused,
|
||||
struct ether_addr *addr)
|
||||
{
|
||||
if (addr == NULL)
|
||||
@ -326,7 +326,7 @@ rte_ethtool_net_validate_addr(uint8_t port_id __rte_unused,
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_net_change_mtu(uint8_t port_id, int mtu)
|
||||
rte_ethtool_net_change_mtu(uint16_t port_id, int mtu)
|
||||
{
|
||||
if (mtu < 0 || mtu > UINT16_MAX)
|
||||
return -EINVAL;
|
||||
@ -334,7 +334,7 @@ rte_ethtool_net_change_mtu(uint8_t port_id, int mtu)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats *stats)
|
||||
rte_ethtool_net_get_stats64(uint16_t port_id, struct rte_eth_stats *stats)
|
||||
{
|
||||
if (stats == NULL)
|
||||
return -EINVAL;
|
||||
@ -342,13 +342,13 @@ rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats *stats)
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_net_vlan_rx_add_vid(uint8_t port_id, uint16_t vid)
|
||||
rte_ethtool_net_vlan_rx_add_vid(uint16_t port_id, uint16_t vid)
|
||||
{
|
||||
return rte_eth_dev_vlan_filter(port_id, vid, 1);
|
||||
}
|
||||
|
||||
int
|
||||
rte_ethtool_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid)
|
||||
rte_ethtool_net_vlan_rx_kill_vid(uint16_t port_id, uint16_t vid)
|
||||
{
|
||||
return rte_eth_dev_vlan_filter(port_id, vid, 0);
|
||||
}
|
||||
@ -361,7 +361,7 @@ rte_ethtool_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid)
|
||||
* driver can register device-specific implementation
|
||||
*/
|
||||
int
|
||||
rte_ethtool_net_set_rx_mode(uint8_t port_id)
|
||||
rte_ethtool_net_set_rx_mode(uint16_t port_id)
|
||||
{
|
||||
uint16_t num_vfs;
|
||||
struct rte_eth_dev_info dev_info;
|
||||
@ -387,7 +387,7 @@ rte_ethtool_net_set_rx_mode(uint8_t port_id)
|
||||
|
||||
|
||||
int
|
||||
rte_ethtool_get_ringparam(uint8_t port_id,
|
||||
rte_ethtool_get_ringparam(uint16_t port_id,
|
||||
struct ethtool_ringparam *ring_param)
|
||||
{
|
||||
struct rte_eth_dev_info dev_info;
|
||||
@ -419,7 +419,7 @@ rte_ethtool_get_ringparam(uint8_t port_id,
|
||||
|
||||
|
||||
int
|
||||
rte_ethtool_set_ringparam(uint8_t port_id,
|
||||
rte_ethtool_set_ringparam(uint16_t port_id,
|
||||
struct ethtool_ringparam *ring_param)
|
||||
{
|
||||
struct rte_eth_rxq_info rx_qinfo;
|
||||
|
@ -79,7 +79,7 @@ extern "C" {
|
||||
* - (0) if successful.
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
*/
|
||||
int rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo);
|
||||
int rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo);
|
||||
|
||||
/**
|
||||
* Retrieve the Ethernet device register length in bytes.
|
||||
@ -93,7 +93,7 @@ int rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo);
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_get_regs_len(uint8_t port_id);
|
||||
int rte_ethtool_get_regs_len(uint16_t port_id);
|
||||
|
||||
/**
|
||||
* Retrieve the Ethernet device register information according to
|
||||
@ -111,7 +111,7 @@ int rte_ethtool_get_regs_len(uint8_t port_id);
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_get_regs(uint8_t port_id, struct ethtool_regs *regs,
|
||||
int rte_ethtool_get_regs(uint16_t port_id, struct ethtool_regs *regs,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
@ -127,7 +127,7 @@ int rte_ethtool_get_regs(uint8_t port_id, struct ethtool_regs *regs,
|
||||
* - (-EINVAL) if parameters invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_get_link(uint8_t port_id);
|
||||
int rte_ethtool_get_link(uint16_t port_id);
|
||||
|
||||
/**
|
||||
* Retrieve the Ethernet device EEPROM size
|
||||
@ -141,7 +141,7 @@ int rte_ethtool_get_link(uint8_t port_id);
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_get_eeprom_len(uint8_t port_id);
|
||||
int rte_ethtool_get_eeprom_len(uint16_t port_id);
|
||||
|
||||
/**
|
||||
* Retrieve EEPROM content based upon eeprom range described in ethtool
|
||||
@ -159,7 +159,7 @@ int rte_ethtool_get_eeprom_len(uint8_t port_id);
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_get_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,
|
||||
int rte_ethtool_get_eeprom(uint16_t port_id, struct ethtool_eeprom *eeprom,
|
||||
void *words);
|
||||
|
||||
/**
|
||||
@ -179,7 +179,7 @@ int rte_ethtool_get_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,
|
||||
* - (-EINVAL) if parameters invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_set_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,
|
||||
int rte_ethtool_set_eeprom(uint16_t port_id, struct ethtool_eeprom *eeprom,
|
||||
void *words);
|
||||
|
||||
/**
|
||||
@ -199,7 +199,7 @@ int rte_ethtool_set_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,
|
||||
* - (-EINVAL) if parameters invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_get_pauseparam(uint8_t port_id,
|
||||
int rte_ethtool_get_pauseparam(uint16_t port_id,
|
||||
struct ethtool_pauseparam *pause_param);
|
||||
|
||||
/**
|
||||
@ -217,7 +217,7 @@ int rte_ethtool_get_pauseparam(uint8_t port_id,
|
||||
* - (-EINVAL) if parameters invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_set_pauseparam(uint8_t port_id,
|
||||
int rte_ethtool_set_pauseparam(uint16_t port_id,
|
||||
struct ethtool_pauseparam *param);
|
||||
|
||||
/**
|
||||
@ -231,7 +231,7 @@ int rte_ethtool_set_pauseparam(uint8_t port_id,
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_net_open(uint8_t port_id);
|
||||
int rte_ethtool_net_open(uint16_t port_id);
|
||||
|
||||
/**
|
||||
* Stop the Ethernet device.
|
||||
@ -242,7 +242,7 @@ int rte_ethtool_net_open(uint8_t port_id);
|
||||
* - (0) if successful.
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
*/
|
||||
int rte_ethtool_net_stop(uint8_t port_id);
|
||||
int rte_ethtool_net_stop(uint16_t port_id);
|
||||
|
||||
/**
|
||||
* Get the Ethernet device MAC address.
|
||||
@ -255,7 +255,7 @@ int rte_ethtool_net_stop(uint8_t port_id);
|
||||
* - (0) if successful.
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
*/
|
||||
int rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr);
|
||||
int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr);
|
||||
|
||||
/**
|
||||
* Setting the Ethernet device MAC address.
|
||||
@ -271,7 +271,7 @@ int rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr);
|
||||
* - (-EINVAL) if parameters invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr *addr);
|
||||
int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr);
|
||||
|
||||
/**
|
||||
* Validate if the provided MAC address is valid unicast address
|
||||
@ -287,7 +287,7 @@ int rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr *addr);
|
||||
* - (-EINVAL) if parameters invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_net_validate_addr(uint8_t port_id, struct ether_addr *addr);
|
||||
int rte_ethtool_net_validate_addr(uint16_t port_id, struct ether_addr *addr);
|
||||
|
||||
/**
|
||||
* Setting the Ethernet device maximum Tx unit.
|
||||
@ -303,7 +303,7 @@ int rte_ethtool_net_validate_addr(uint8_t port_id, struct ether_addr *addr);
|
||||
* - (-EINVAL) if parameters invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_net_change_mtu(uint8_t port_id, int mtu);
|
||||
int rte_ethtool_net_change_mtu(uint16_t port_id, int mtu);
|
||||
|
||||
/**
|
||||
* Retrieve the Ethernet device traffic statistics
|
||||
@ -319,7 +319,7 @@ int rte_ethtool_net_change_mtu(uint8_t port_id, int mtu);
|
||||
* - (-EINVAL) if parameters invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats *stats);
|
||||
int rte_ethtool_net_get_stats64(uint16_t port_id, struct rte_eth_stats *stats);
|
||||
|
||||
/**
|
||||
* Update the Ethernet device VLAN filter with new vid
|
||||
@ -334,7 +334,7 @@ int rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats *stats);
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_net_vlan_rx_add_vid(uint8_t port_id, uint16_t vid);
|
||||
int rte_ethtool_net_vlan_rx_add_vid(uint16_t port_id, uint16_t vid);
|
||||
|
||||
/**
|
||||
* Remove VLAN id from Ethernet device.
|
||||
@ -349,7 +349,7 @@ int rte_ethtool_net_vlan_rx_add_vid(uint8_t port_id, uint16_t vid);
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid);
|
||||
int rte_ethtool_net_vlan_rx_kill_vid(uint16_t port_id, uint16_t vid);
|
||||
|
||||
/**
|
||||
* Setting the Ethernet device rx mode.
|
||||
@ -362,7 +362,7 @@ int rte_ethtool_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid);
|
||||
* - (-ENODEV) if *port_id* invalid.
|
||||
* - others depends on the specific operations implementation.
|
||||
*/
|
||||
int rte_ethtool_net_set_rx_mode(uint8_t port_id);
|
||||
int rte_ethtool_net_set_rx_mode(uint16_t port_id);
|
||||
|
||||
/**
|
||||
* Getting ring parameters for Ethernet device.
|
||||
@ -380,7 +380,7 @@ int rte_ethtool_net_set_rx_mode(uint8_t port_id);
|
||||
* Only the tx_pending and rx_pending fields of struct ethtool_ringparam
|
||||
* are used, and the function only gets parameters for queue 0.
|
||||
*/
|
||||
int rte_ethtool_get_ringparam(uint8_t port_id,
|
||||
int rte_ethtool_get_ringparam(uint16_t port_id,
|
||||
struct ethtool_ringparam *ring_param);
|
||||
|
||||
/**
|
||||
@ -399,7 +399,7 @@ int rte_ethtool_get_ringparam(uint8_t port_id,
|
||||
* Only the tx_pending and rx_pending fields of struct ethtool_ringparam
|
||||
* are used, and the function only sets parameters for queue 0.
|
||||
*/
|
||||
int rte_ethtool_set_ringparam(uint8_t port_id,
|
||||
int rte_ethtool_set_ringparam(uint16_t port_id,
|
||||
struct ethtool_ringparam *ring_param);
|
||||
|
||||
|
||||
|
@ -444,7 +444,7 @@ parse_args(int argc, char **argv)
|
||||
|
||||
/* Initialise a single port on an Ethernet device */
|
||||
static void
|
||||
init_port(uint8_t port)
|
||||
init_port(uint16_t port)
|
||||
{
|
||||
int ret;
|
||||
uint16_t nb_rxd = NB_RXD;
|
||||
|
@ -163,12 +163,12 @@ static uint32_t single_sa;
|
||||
static uint32_t single_sa_idx;
|
||||
|
||||
struct lcore_rx_queue {
|
||||
uint8_t port_id;
|
||||
uint16_t port_id;
|
||||
uint8_t queue_id;
|
||||
} __rte_cache_aligned;
|
||||
|
||||
struct lcore_params {
|
||||
uint8_t port_id;
|
||||
uint16_t port_id;
|
||||
uint8_t queue_id;
|
||||
uint8_t lcore_id;
|
||||
} __rte_cache_aligned;
|
||||
@ -290,7 +290,7 @@ prepare_traffic(struct rte_mbuf **pkts, struct ipsec_traffic *t,
|
||||
}
|
||||
|
||||
static inline void
|
||||
prepare_tx_pkt(struct rte_mbuf *pkt, uint8_t port)
|
||||
prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port)
|
||||
{
|
||||
struct ip *ip;
|
||||
struct ether_hdr *ethhdr;
|
||||
@ -320,7 +320,7 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint8_t port)
|
||||
}
|
||||
|
||||
static inline void
|
||||
prepare_tx_burst(struct rte_mbuf *pkts[], uint16_t nb_pkts, uint8_t port)
|
||||
prepare_tx_burst(struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t port)
|
||||
{
|
||||
int32_t i;
|
||||
const int32_t prefetch_offset = 2;
|
||||
@ -336,7 +336,7 @@ prepare_tx_burst(struct rte_mbuf *pkts[], uint16_t nb_pkts, uint8_t port)
|
||||
|
||||
/* Send burst of packets on an output interface */
|
||||
static inline int32_t
|
||||
send_burst(struct lcore_conf *qconf, uint16_t n, uint8_t port)
|
||||
send_burst(struct lcore_conf *qconf, uint16_t n, uint16_t port)
|
||||
{
|
||||
struct rte_mbuf **m_table;
|
||||
int32_t ret;
|
||||
@ -359,7 +359,7 @@ send_burst(struct lcore_conf *qconf, uint16_t n, uint8_t port)
|
||||
|
||||
/* Enqueue a single packet, and send burst if queue is filled */
|
||||
static inline int32_t
|
||||
send_single_packet(struct rte_mbuf *m, uint8_t port)
|
||||
send_single_packet(struct rte_mbuf *m, uint16_t port)
|
||||
{
|
||||
uint32_t lcore_id;
|
||||
uint16_t len;
|
||||
@ -646,7 +646,7 @@ route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_pkts)
|
||||
|
||||
static inline void
|
||||
process_pkts(struct lcore_conf *qconf, struct rte_mbuf **pkts,
|
||||
uint8_t nb_pkts, uint8_t portid)
|
||||
uint8_t nb_pkts, uint16_t portid)
|
||||
{
|
||||
struct ipsec_traffic traffic;
|
||||
|
||||
@ -691,7 +691,8 @@ main_loop(__attribute__((unused)) void *dummy)
|
||||
uint32_t lcore_id;
|
||||
uint64_t prev_tsc, diff_tsc, cur_tsc;
|
||||
int32_t i, nb_rx;
|
||||
uint8_t portid, queueid;
|
||||
uint16_t portid;
|
||||
uint8_t queueid;
|
||||
struct lcore_conf *qconf;
|
||||
int32_t socket_id;
|
||||
const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1)
|
||||
@ -728,7 +729,7 @@ main_loop(__attribute__((unused)) void *dummy)
|
||||
portid = rxql[i].port_id;
|
||||
queueid = rxql[i].queue_id;
|
||||
RTE_LOG(INFO, IPSEC,
|
||||
" -- lcoreid=%u portid=%hhu rxqueueid=%hhu\n",
|
||||
" -- lcoreid=%u portid=%u rxqueueid=%hhu\n",
|
||||
lcore_id, portid, queueid);
|
||||
}
|
||||
|
||||
@ -759,7 +760,8 @@ main_loop(__attribute__((unused)) void *dummy)
|
||||
static int32_t
|
||||
check_params(void)
|
||||
{
|
||||
uint8_t lcore, portid, nb_ports;
|
||||
uint8_t lcore;
|
||||
uint16_t portid, nb_ports;
|
||||
uint16_t i;
|
||||
int32_t socket_id;
|
||||
|
||||
@ -797,7 +799,7 @@ check_params(void)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
get_port_nb_rx_queues(const uint8_t port)
|
||||
get_port_nb_rx_queues(const uint16_t port)
|
||||
{
|
||||
int32_t queue = -1;
|
||||
uint16_t i;
|
||||
@ -1055,11 +1057,12 @@ print_ethaddr(const char *name, const struct ether_addr *eth_addr)
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
static void
|
||||
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
{
|
||||
#define CHECK_INTERVAL 100 /* 100ms */
|
||||
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
|
||||
uint8_t portid, count, all_ports_up, print_flag = 0;
|
||||
uint16_t portid;
|
||||
uint8_t count, all_ports_up, print_flag = 0;
|
||||
struct rte_eth_link link;
|
||||
|
||||
printf("\nChecking link status");
|
||||
@ -1074,14 +1077,13 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
/* print link status if flag set */
|
||||
if (print_flag == 1) {
|
||||
if (link.link_status)
|
||||
printf("Port %d Link Up - speed %u "
|
||||
"Mbps - %s\n", (uint8_t)portid,
|
||||
(uint32_t)link.link_speed,
|
||||
printf(
|
||||
"Port%d Link Up - speed %u Mbps -%s\n",
|
||||
portid, link.link_speed,
|
||||
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
|
||||
("full-duplex") : ("half-duplex\n"));
|
||||
else
|
||||
printf("Port %d Link Down\n",
|
||||
(uint8_t)portid);
|
||||
printf("Port %d Link Down\n", portid);
|
||||
continue;
|
||||
}
|
||||
/* clear all_ports_up flag if any link down */
|
||||
@ -1322,7 +1324,7 @@ cryptodevs_init(void)
|
||||
}
|
||||
|
||||
static void
|
||||
port_init(uint8_t portid)
|
||||
port_init(uint16_t portid)
|
||||
{
|
||||
struct rte_eth_dev_info dev_info;
|
||||
struct rte_eth_txconf *txconf;
|
||||
@ -1438,8 +1440,9 @@ int32_t
|
||||
main(int32_t argc, char **argv)
|
||||
{
|
||||
int32_t ret;
|
||||
uint32_t lcore_id, nb_ports;
|
||||
uint8_t portid, socket_id;
|
||||
uint32_t lcore_id;
|
||||
uint8_t socket_id;
|
||||
uint16_t portid, nb_ports;
|
||||
|
||||
/* init EAL */
|
||||
ret = rte_eal_init(argc, argv);
|
||||
@ -1522,7 +1525,7 @@ main(int32_t argc, char **argv)
|
||||
rte_eth_promiscuous_enable(portid);
|
||||
}
|
||||
|
||||
check_all_ports_link_status((uint8_t)nb_ports, enabled_port_mask);
|
||||
check_all_ports_link_status(nb_ports, enabled_port_mask);
|
||||
|
||||
/* launch per-lcore init on every lcore */
|
||||
rte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER);
|
||||
|
@ -603,7 +603,7 @@ init_kni(void)
|
||||
|
||||
/* Initialise a single port on an Ethernet device */
|
||||
static void
|
||||
init_port(uint8_t port)
|
||||
init_port(uint16_t port)
|
||||
{
|
||||
int ret;
|
||||
uint16_t nb_rxd = NB_RXD;
|
||||
@ -645,11 +645,12 @@ init_port(uint8_t port)
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
static void
|
||||
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
{
|
||||
#define CHECK_INTERVAL 100 /* 100ms */
|
||||
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
|
||||
uint8_t portid, count, all_ports_up, print_flag = 0;
|
||||
uint16_t portid;
|
||||
uint8_t count, all_ports_up, print_flag = 0;
|
||||
struct rte_eth_link link;
|
||||
|
||||
printf("\nChecking link status\n");
|
||||
@ -664,14 +665,13 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
/* print link status if flag set */
|
||||
if (print_flag == 1) {
|
||||
if (link.link_status)
|
||||
printf("Port %d Link Up - speed %u "
|
||||
"Mbps - %s\n", (uint8_t)portid,
|
||||
(unsigned)link.link_speed,
|
||||
printf(
|
||||
"Port%d Link Up - speed %uMbps - %s\n",
|
||||
portid, link.link_speed,
|
||||
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
|
||||
("full-duplex") : ("half-duplex\n"));
|
||||
else
|
||||
printf("Port %d Link Down\n",
|
||||
(uint8_t)portid);
|
||||
printf("Port %d Link Down\n", portid);
|
||||
continue;
|
||||
}
|
||||
/* clear all_ports_up flag if any link down */
|
||||
|
@ -577,7 +577,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
|
||||
/* Send the burst of packets on an output interface */
|
||||
static int
|
||||
l2fwd_send_burst(struct lcore_queue_conf *qconf, unsigned n,
|
||||
uint8_t port)
|
||||
uint16_t port)
|
||||
{
|
||||
struct rte_mbuf **pkt_buffer;
|
||||
unsigned ret;
|
||||
@ -598,7 +598,7 @@ l2fwd_send_burst(struct lcore_queue_conf *qconf, unsigned n,
|
||||
|
||||
/* Enqueue packets for TX and prepare them to be sent */
|
||||
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;
|
||||
@ -1754,11 +1754,12 @@ l2fwd_crypto_parse_args(struct l2fwd_crypto_options *options,
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
static void
|
||||
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
{
|
||||
#define CHECK_INTERVAL 100 /* 100ms */
|
||||
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
|
||||
uint8_t portid, count, all_ports_up, print_flag = 0;
|
||||
uint16_t portid;
|
||||
uint8_t count, all_ports_up, print_flag = 0;
|
||||
struct rte_eth_link link;
|
||||
|
||||
printf("\nChecking link status");
|
||||
@ -1773,14 +1774,13 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
/* print link status if flag set */
|
||||
if (print_flag == 1) {
|
||||
if (link.link_status)
|
||||
printf("Port %d Link Up - speed %u "
|
||||
"Mbps - %s\n", (uint8_t)portid,
|
||||
(unsigned)link.link_speed,
|
||||
printf(
|
||||
"Port%d Link Up. Speed %u Mbps - %s\n",
|
||||
portid, link.link_speed,
|
||||
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
|
||||
("full-duplex") : ("half-duplex\n"));
|
||||
else
|
||||
printf("Port %d Link Down\n",
|
||||
(uint8_t)portid);
|
||||
printf("Port %d Link Down\n", portid);
|
||||
continue;
|
||||
}
|
||||
/* clear all_ports_up flag if any link down */
|
||||
|
@ -176,7 +176,7 @@ show_lcore_stats(unsigned lcore_id)
|
||||
uint64_t busy, busy_min, busy_max;
|
||||
|
||||
/* Jobs statistics. */
|
||||
const uint8_t port_cnt = qconf->n_rx_port;
|
||||
const uint16_t port_cnt = qconf->n_rx_port;
|
||||
uint64_t jobs_exec_cnt[port_cnt], jobs_period[port_cnt];
|
||||
uint64_t jobs_exec[port_cnt], jobs_exec_min[port_cnt],
|
||||
jobs_exec_max[port_cnt];
|
||||
@ -414,11 +414,11 @@ l2fwd_fwd_job(__rte_unused struct rte_timer *timer, void *arg)
|
||||
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
|
||||
struct rte_mbuf *m;
|
||||
|
||||
const uint8_t port_idx = (uintptr_t) arg;
|
||||
const uint16_t port_idx = (uintptr_t) arg;
|
||||
const unsigned lcore_id = rte_lcore_id();
|
||||
struct lcore_queue_conf *qconf = &lcore_queue_conf[lcore_id];
|
||||
struct rte_jobstats *job = &qconf->port_fwd_jobs[port_idx];
|
||||
const uint8_t portid = qconf->rx_port_list[port_idx];
|
||||
const uint16_t portid = qconf->rx_port_list[port_idx];
|
||||
|
||||
uint8_t j;
|
||||
uint16_t total_nb_rx;
|
||||
@ -428,7 +428,7 @@ l2fwd_fwd_job(__rte_unused struct rte_timer *timer, void *arg)
|
||||
/* Call rx burst 2 times. This allow rte_jobstats logic to see if this
|
||||
* function must be called more frequently. */
|
||||
|
||||
total_nb_rx = rte_eth_rx_burst((uint8_t) portid, 0, pkts_burst,
|
||||
total_nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst,
|
||||
MAX_PKT_BURST);
|
||||
|
||||
for (j = 0; j < total_nb_rx; j++) {
|
||||
@ -438,7 +438,7 @@ l2fwd_fwd_job(__rte_unused struct rte_timer *timer, void *arg)
|
||||
}
|
||||
|
||||
if (total_nb_rx == MAX_PKT_BURST) {
|
||||
const uint16_t nb_rx = rte_eth_rx_burst((uint8_t) portid, 0, pkts_burst,
|
||||
const uint16_t nb_rx = rte_eth_rx_burst(portid, 0, pkts_burst,
|
||||
MAX_PKT_BURST);
|
||||
|
||||
total_nb_rx += nb_rx;
|
||||
@ -464,7 +464,7 @@ l2fwd_flush_job(__rte_unused struct rte_timer *timer, __rte_unused void *arg)
|
||||
uint64_t now;
|
||||
unsigned lcore_id;
|
||||
struct lcore_queue_conf *qconf;
|
||||
uint8_t portid;
|
||||
uint16_t portid;
|
||||
unsigned i;
|
||||
uint32_t sent;
|
||||
struct rte_eth_dev_tx_buffer *buffer;
|
||||
@ -714,11 +714,12 @@ l2fwd_parse_args(int argc, char **argv)
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
static void
|
||||
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
{
|
||||
#define CHECK_INTERVAL 100 /* 100ms */
|
||||
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
|
||||
uint8_t portid, count, all_ports_up, print_flag = 0;
|
||||
uint16_t portid;
|
||||
uint8_t count, all_ports_up, print_flag = 0;
|
||||
struct rte_eth_link link;
|
||||
|
||||
printf("\nChecking link status");
|
||||
@ -733,14 +734,13 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
/* print link status if flag set */
|
||||
if (print_flag == 1) {
|
||||
if (link.link_status)
|
||||
printf("Port %d Link Up - speed %u "
|
||||
"Mbps - %s\n", (uint8_t)portid,
|
||||
(unsigned)link.link_speed,
|
||||
printf(
|
||||
"Port%d Link Up. Speed %u Mbps - %s\n",
|
||||
portid, link.link_speed,
|
||||
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
|
||||
("full-duplex") : ("half-duplex\n"));
|
||||
else
|
||||
printf("Port %d Link Down\n",
|
||||
(uint8_t)portid);
|
||||
printf("Port %d Link Down\n", portid);
|
||||
continue;
|
||||
}
|
||||
/* clear all_ports_up flag if any link down */
|
||||
|
@ -184,7 +184,7 @@ static inline int
|
||||
is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len);
|
||||
#endif
|
||||
static inline void
|
||||
send_single_packet(struct rte_mbuf *m, uint8_t port);
|
||||
send_single_packet(struct rte_mbuf *m, uint16_t port);
|
||||
|
||||
#define MAX_ACL_RULE_NUM 100000
|
||||
#define DEFAULT_MAX_CATEGORIES 1
|
||||
@ -1297,7 +1297,7 @@ static struct lcore_conf lcore_conf[RTE_MAX_LCORE];
|
||||
|
||||
/* Enqueue a single packet, and send burst if queue is filled */
|
||||
static inline void
|
||||
send_single_packet(struct rte_mbuf *m, uint8_t port)
|
||||
send_single_packet(struct rte_mbuf *m, uint16_t port)
|
||||
{
|
||||
uint32_t lcore_id;
|
||||
struct lcore_conf *qconf;
|
||||
@ -1501,7 +1501,7 @@ check_port_config(const unsigned nb_ports)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
get_port_n_rx_queues(const uint8_t port)
|
||||
get_port_n_rx_queues(const uint16_t port)
|
||||
{
|
||||
int queue = -1;
|
||||
uint16_t i;
|
||||
@ -1830,11 +1830,12 @@ init_mem(unsigned nb_mbuf)
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
static void
|
||||
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
{
|
||||
#define CHECK_INTERVAL 100 /* 100ms */
|
||||
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
|
||||
uint8_t portid, count, all_ports_up, print_flag = 0;
|
||||
uint16_t portid;
|
||||
uint8_t count, all_ports_up, print_flag = 0;
|
||||
struct rte_eth_link link;
|
||||
|
||||
printf("\nChecking link status");
|
||||
@ -1849,14 +1850,13 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
/* print link status if flag set */
|
||||
if (print_flag == 1) {
|
||||
if (link.link_status)
|
||||
printf("Port %d Link Up - speed %u "
|
||||
"Mbps - %s\n", (uint8_t)portid,
|
||||
(unsigned)link.link_speed,
|
||||
printf(
|
||||
"Port%d Link Up. Speed %u Mbps %s\n",
|
||||
portid, link.link_speed,
|
||||
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
|
||||
("full-duplex") : ("half-duplex\n"));
|
||||
else
|
||||
printf("Port %d Link Down\n",
|
||||
(uint8_t)portid);
|
||||
printf("Port %d Link Down\n", portid);
|
||||
continue;
|
||||
}
|
||||
/* clear all_ports_up flag if any link down */
|
||||
@ -1894,7 +1894,8 @@ main(int argc, char **argv)
|
||||
uint16_t queueid;
|
||||
unsigned lcore_id;
|
||||
uint32_t n_tx_queue, nb_lcores;
|
||||
uint8_t portid, nb_rx_queue, queue, socketid;
|
||||
uint16_t portid;
|
||||
uint8_t nb_rx_queue, queue, socketid;
|
||||
|
||||
/* init EAL */
|
||||
ret = rte_eal_init(argc, argv);
|
||||
|
@ -451,7 +451,7 @@ power_timer_cb(__attribute__((unused)) struct rte_timer *tim,
|
||||
|
||||
/* Enqueue a single packet, and send burst if queue is filled */
|
||||
static inline int
|
||||
send_single_packet(struct rte_mbuf *m, uint8_t port)
|
||||
send_single_packet(struct rte_mbuf *m, uint16_t port)
|
||||
{
|
||||
uint32_t lcore_id;
|
||||
struct lcore_conf *qconf;
|
||||
@ -659,7 +659,7 @@ add_cb_parse_ptype(uint16_t portid, uint16_t queueid)
|
||||
}
|
||||
|
||||
static inline void
|
||||
l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid,
|
||||
l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid,
|
||||
struct lcore_conf *qconf)
|
||||
{
|
||||
struct ether_hdr *eth_hdr;
|
||||
@ -1115,7 +1115,7 @@ check_port_config(const unsigned nb_ports)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
get_port_n_rx_queues(const uint8_t port)
|
||||
get_port_n_rx_queues(const uint16_t port)
|
||||
{
|
||||
int queue = -1;
|
||||
uint16_t i;
|
||||
@ -1599,7 +1599,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
}
|
||||
}
|
||||
|
||||
static int check_ptype(uint8_t portid)
|
||||
static int check_ptype(uint16_t portid)
|
||||
{
|
||||
int i, ret;
|
||||
int ptype_l3_ipv4 = 0;
|
||||
@ -1650,7 +1650,7 @@ main(int argc, char **argv)
|
||||
struct rte_eth_dev_info dev_info;
|
||||
struct rte_eth_txconf *txconf;
|
||||
int ret;
|
||||
unsigned nb_ports;
|
||||
uint16_t nb_ports;
|
||||
uint16_t queueid;
|
||||
unsigned lcore_id;
|
||||
uint64_t hz;
|
||||
@ -1877,7 +1877,7 @@ main(int argc, char **argv)
|
||||
rte_spinlock_init(&(locks[portid]));
|
||||
}
|
||||
|
||||
check_all_ports_link_status((uint8_t)nb_ports, enabled_port_mask);
|
||||
check_all_ports_link_status(nb_ports, enabled_port_mask);
|
||||
|
||||
/* launch per-lcore init on every lcore */
|
||||
rte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER);
|
||||
|
@ -274,8 +274,8 @@ em_mask_key(void *key, xmm_t mask)
|
||||
#error No vector engine (SSE, NEON, ALTIVEC) available, check your toolchain
|
||||
#endif
|
||||
|
||||
static inline uint8_t
|
||||
em_get_ipv4_dst_port(void *ipv4_hdr, uint8_t portid, void *lookup_struct)
|
||||
static inline uint16_t
|
||||
em_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct)
|
||||
{
|
||||
int ret = 0;
|
||||
union ipv4_5tuple_host key;
|
||||
@ -292,11 +292,11 @@ em_get_ipv4_dst_port(void *ipv4_hdr, uint8_t portid, void *lookup_struct)
|
||||
|
||||
/* Find destination port */
|
||||
ret = rte_hash_lookup(ipv4_l3fwd_lookup_struct, (const void *)&key);
|
||||
return (uint8_t)((ret < 0) ? portid : ipv4_l3fwd_out_if[ret]);
|
||||
return (ret < 0) ? portid : ipv4_l3fwd_out_if[ret];
|
||||
}
|
||||
|
||||
static inline uint8_t
|
||||
em_get_ipv6_dst_port(void *ipv6_hdr, uint8_t portid, void *lookup_struct)
|
||||
static inline uint16_t
|
||||
em_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct)
|
||||
{
|
||||
int ret = 0;
|
||||
union ipv6_5tuple_host key;
|
||||
@ -325,7 +325,7 @@ em_get_ipv6_dst_port(void *ipv6_hdr, uint8_t portid, void *lookup_struct)
|
||||
|
||||
/* Find destination port */
|
||||
ret = rte_hash_lookup(ipv6_l3fwd_lookup_struct, (const void *)&key);
|
||||
return (uint8_t)((ret < 0) ? portid : ipv6_l3fwd_out_if[ret]);
|
||||
return (ret < 0) ? portid : ipv6_l3fwd_out_if[ret];
|
||||
}
|
||||
|
||||
#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON
|
||||
@ -649,7 +649,8 @@ em_main_loop(__attribute__((unused)) void *dummy)
|
||||
unsigned lcore_id;
|
||||
uint64_t prev_tsc, diff_tsc, cur_tsc;
|
||||
int i, nb_rx;
|
||||
uint8_t portid, queueid;
|
||||
uint8_t queueid;
|
||||
uint16_t portid;
|
||||
struct lcore_conf *qconf;
|
||||
const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
|
||||
US_PER_S * BURST_TX_DRAIN_US;
|
||||
@ -671,7 +672,7 @@ em_main_loop(__attribute__((unused)) void *dummy)
|
||||
portid = qconf->rx_queue_list[i].port_id;
|
||||
queueid = qconf->rx_queue_list[i].queue_id;
|
||||
RTE_LOG(INFO, L3FWD,
|
||||
" -- lcoreid=%u portid=%hhu rxqueueid=%hhu\n",
|
||||
" -- lcoreid=%u portid=%u rxqueueid=%hhu\n",
|
||||
lcore_id, portid, queueid);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
static __rte_always_inline uint16_t
|
||||
em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
|
||||
uint8_t portid)
|
||||
uint16_t portid)
|
||||
{
|
||||
uint8_t next_hop;
|
||||
struct ipv4_hdr *ipv4_hdr;
|
||||
@ -103,7 +103,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
|
||||
*/
|
||||
static inline void
|
||||
l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst,
|
||||
uint8_t portid, struct lcore_conf *qconf)
|
||||
uint16_t portid, struct lcore_conf *qconf)
|
||||
{
|
||||
int32_t i, j;
|
||||
uint16_t dst_port[MAX_PKT_BURST];
|
||||
|
@ -494,7 +494,7 @@ lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param,
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
static void
|
||||
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
{
|
||||
#define CHECK_INTERVAL 100 /* 100ms */
|
||||
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
|
||||
@ -514,14 +514,13 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
/* print link status if flag set */
|
||||
if (print_flag == 1) {
|
||||
if (link.link_status)
|
||||
printf("Port %d Link Up - speed %u "
|
||||
"Mbps - %s\n", (uint8_t)portid,
|
||||
(unsigned)link.link_speed,
|
||||
printf(
|
||||
"Port%d Link Up. Speed %u Mbps - %s\n",
|
||||
portid, link.link_speed,
|
||||
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
|
||||
("full-duplex") : ("half-duplex\n"));
|
||||
else
|
||||
printf("Port %d Link Down\n",
|
||||
(uint8_t)portid);
|
||||
printf("Port %d Link Down\n", portid);
|
||||
continue;
|
||||
}
|
||||
/* clear all_ports_up flag if any link down */
|
||||
@ -554,8 +553,8 @@ main(int argc, char **argv)
|
||||
struct lcore_queue_conf *qconf;
|
||||
struct rte_eth_dev_info dev_info;
|
||||
int ret;
|
||||
uint8_t nb_ports;
|
||||
uint8_t portid, portid_last = 0;
|
||||
uint16_t nb_ports;
|
||||
uint16_t portid, portid_last = 0;
|
||||
unsigned lcore_id, rx_lcore_id;
|
||||
unsigned nb_ports_in_mask = 0;
|
||||
|
||||
|
@ -216,8 +216,8 @@ static void
|
||||
handle_packet(struct rte_mbuf *buf)
|
||||
{
|
||||
int sent;
|
||||
const uint8_t in_port = buf->port;
|
||||
const uint8_t out_port = output_ports[in_port];
|
||||
const uint16_t in_port = buf->port;
|
||||
const uint16_t out_port = output_ports[in_port];
|
||||
struct rte_eth_dev_tx_buffer *buffer = tx_buffer[out_port];
|
||||
|
||||
sent = rte_eth_tx_buffer(out_port, client_id, buffer, buf);
|
||||
@ -276,7 +276,7 @@ main(int argc, char *argv[])
|
||||
|
||||
for (;;) {
|
||||
uint16_t i, rx_pkts;
|
||||
uint8_t port;
|
||||
uint16_t port;
|
||||
|
||||
rx_pkts = rte_ring_dequeue_burst(rx_ring, pkts,
|
||||
PKT_READ_SIZE, NULL);
|
||||
|
@ -102,7 +102,7 @@ struct port_stats{
|
||||
static int proc_id = -1;
|
||||
static unsigned num_procs = 0;
|
||||
|
||||
static uint8_t ports[RTE_MAX_ETHPORTS];
|
||||
static uint16_t ports[RTE_MAX_ETHPORTS];
|
||||
static unsigned num_ports = 0;
|
||||
|
||||
static struct lcore_ports lcore_ports[RTE_MAX_LCORE];
|
||||
@ -202,7 +202,8 @@ smp_parse_args(int argc, char **argv)
|
||||
* coming from the mbuf_pool passed as parameter
|
||||
*/
|
||||
static inline int
|
||||
smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
|
||||
smp_port_init(uint16_t port, struct rte_mempool *mbuf_pool,
|
||||
uint16_t num_queues)
|
||||
{
|
||||
struct rte_eth_conf port_conf = {
|
||||
.rxmode = {
|
||||
@ -237,7 +238,7 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
|
||||
if (port >= rte_eth_dev_count())
|
||||
return -1;
|
||||
|
||||
printf("# Initialising port %u... ", (unsigned)port);
|
||||
printf("# Initialising port %u... ", port);
|
||||
fflush(stdout);
|
||||
|
||||
rte_eth_dev_info_get(port, &info);
|
||||
@ -362,11 +363,12 @@ lcore_main(void *arg __rte_unused)
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
static void
|
||||
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
{
|
||||
#define CHECK_INTERVAL 100 /* 100ms */
|
||||
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
|
||||
uint8_t portid, count, all_ports_up, print_flag = 0;
|
||||
uint16_t portid;
|
||||
uint8_t count, all_ports_up, print_flag = 0;
|
||||
struct rte_eth_link link;
|
||||
|
||||
printf("\nChecking link status");
|
||||
@ -381,14 +383,13 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
/* print link status if flag set */
|
||||
if (print_flag == 1) {
|
||||
if (link.link_status)
|
||||
printf("Port %d Link Up - speed %u "
|
||||
"Mbps - %s\n", (uint8_t)portid,
|
||||
(unsigned)link.link_speed,
|
||||
printf(
|
||||
"Port%d Link Up. Speed %u Mbps - %s\n",
|
||||
portid, link.link_speed,
|
||||
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
|
||||
("full-duplex") : ("half-duplex\n"));
|
||||
else
|
||||
printf("Port %d Link Down\n",
|
||||
(uint8_t)portid);
|
||||
printf("Port %d Link Down\n", portid);
|
||||
continue;
|
||||
}
|
||||
/* clear all_ports_up flag if any link down */
|
||||
|
@ -2037,7 +2037,7 @@ static void
|
||||
lthread_tx_per_ring(void *dummy)
|
||||
{
|
||||
int nb_rx;
|
||||
uint8_t portid;
|
||||
uint16_t portid;
|
||||
struct rte_ring *ring;
|
||||
struct thread_tx_conf *tx_conf;
|
||||
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
|
||||
@ -2544,7 +2544,7 @@ check_port_config(const unsigned nb_ports)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
get_port_n_rx_queues(const uint8_t port)
|
||||
get_port_n_rx_queues(const uint16_t port)
|
||||
{
|
||||
int queue = -1;
|
||||
uint16_t i;
|
||||
@ -3441,7 +3441,7 @@ init_mem(unsigned nb_mbuf)
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
static void
|
||||
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
{
|
||||
#define CHECK_INTERVAL 100 /* 100ms */
|
||||
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
|
||||
|
@ -202,7 +202,7 @@ ns_to_timeval(int64_t nsec)
|
||||
* coming from the mbuf_pool passed as a parameter.
|
||||
*/
|
||||
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_dev_info dev_info;
|
||||
struct rte_eth_conf port_conf = port_conf_default;
|
||||
@ -555,7 +555,7 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data)
|
||||
* functionality.
|
||||
*/
|
||||
static 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;
|
||||
@ -593,7 +593,7 @@ parse_ptp_frames(uint8_t portid, struct rte_mbuf *m) {
|
||||
static __attribute__((noreturn)) void
|
||||
lcore_main(void)
|
||||
{
|
||||
uint8_t portid;
|
||||
uint16_t portid;
|
||||
unsigned nb_rx;
|
||||
struct rte_mbuf *m;
|
||||
|
||||
@ -728,7 +728,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
unsigned nb_ports;
|
||||
|
||||
uint8_t portid;
|
||||
uint16_t portid;
|
||||
|
||||
/* Initialize the Environment Abstraction Layer (EAL). */
|
||||
int ret = rte_eal_init(argc, argv);
|
||||
|
@ -116,8 +116,8 @@ static struct rte_eth_conf port_conf = {
|
||||
#define PKT_TX_BURST_MAX 32
|
||||
#define TIME_TX_DRAIN 200000ULL
|
||||
|
||||
static uint8_t port_rx;
|
||||
static uint8_t port_tx;
|
||||
static uint16_t port_rx;
|
||||
static uint16_t port_tx;
|
||||
static struct rte_mbuf *pkts_rx[PKT_RX_BURST_MAX];
|
||||
struct rte_eth_dev_tx_buffer *tx_buffer;
|
||||
|
||||
|
@ -191,7 +191,7 @@ cmdline_parse_inst_t cmd_appstats = {
|
||||
struct cmd_subportstats_result {
|
||||
cmdline_fixed_string_t stats_string;
|
||||
cmdline_fixed_string_t port_string;
|
||||
uint8_t port_number;
|
||||
uint16_t port_number;
|
||||
cmdline_fixed_string_t subport_string;
|
||||
uint32_t subport_number;
|
||||
};
|
||||
@ -220,7 +220,7 @@ cmdline_parse_token_num_t cmd_subportstats_subport_number =
|
||||
UINT32);
|
||||
cmdline_parse_token_num_t cmd_subportstats_port_number =
|
||||
TOKEN_NUM_INITIALIZER(struct cmd_subportstats_result, port_number,
|
||||
UINT8);
|
||||
UINT16);
|
||||
|
||||
cmdline_parse_inst_t cmd_subportstats = {
|
||||
.f = cmd_subportstats_parsed,
|
||||
@ -240,7 +240,7 @@ cmdline_parse_inst_t cmd_subportstats = {
|
||||
struct cmd_pipestats_result {
|
||||
cmdline_fixed_string_t stats_string;
|
||||
cmdline_fixed_string_t port_string;
|
||||
uint8_t port_number;
|
||||
uint16_t port_number;
|
||||
cmdline_fixed_string_t subport_string;
|
||||
uint32_t subport_number;
|
||||
cmdline_fixed_string_t pipe_string;
|
||||
@ -265,7 +265,7 @@ cmdline_parse_token_string_t cmd_pipestats_port_string =
|
||||
"port");
|
||||
cmdline_parse_token_num_t cmd_pipestats_port_number =
|
||||
TOKEN_NUM_INITIALIZER(struct cmd_pipestats_result, port_number,
|
||||
UINT8);
|
||||
UINT16);
|
||||
cmdline_parse_token_string_t cmd_pipestats_subport_string =
|
||||
TOKEN_STRING_INITIALIZER(struct cmd_pipestats_result, subport_string,
|
||||
"subport");
|
||||
@ -299,7 +299,7 @@ cmdline_parse_inst_t cmd_pipestats = {
|
||||
struct cmd_avg_q_result {
|
||||
cmdline_fixed_string_t qavg_string;
|
||||
cmdline_fixed_string_t port_string;
|
||||
uint8_t port_number;
|
||||
uint16_t port_number;
|
||||
cmdline_fixed_string_t subport_string;
|
||||
uint32_t subport_number;
|
||||
cmdline_fixed_string_t pipe_string;
|
||||
@ -327,8 +327,8 @@ cmdline_parse_token_string_t cmd_avg_q_port_string =
|
||||
TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result, port_string,
|
||||
"port");
|
||||
cmdline_parse_token_num_t cmd_avg_q_port_number =
|
||||
TOKEN_NUM_INITIALIZER(struct cmd_avg_q_result, port_number,
|
||||
UINT8);
|
||||
TOKEN_NUM_INITIALIZER(struct cmd_avg_q_result, port_number,
|
||||
UINT16);
|
||||
cmdline_parse_token_string_t cmd_avg_q_subport_string =
|
||||
TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result, subport_string,
|
||||
"subport");
|
||||
@ -378,7 +378,7 @@ cmdline_parse_inst_t cmd_avg_q = {
|
||||
struct cmd_avg_tcpipe_result {
|
||||
cmdline_fixed_string_t qavg_string;
|
||||
cmdline_fixed_string_t port_string;
|
||||
uint8_t port_number;
|
||||
uint16_t port_number;
|
||||
cmdline_fixed_string_t subport_string;
|
||||
uint32_t subport_number;
|
||||
cmdline_fixed_string_t pipe_string;
|
||||
@ -405,7 +405,7 @@ cmdline_parse_token_string_t cmd_avg_tcpipe_port_string =
|
||||
"port");
|
||||
cmdline_parse_token_num_t cmd_avg_tcpipe_port_number =
|
||||
TOKEN_NUM_INITIALIZER(struct cmd_avg_tcpipe_result, port_number,
|
||||
UINT8);
|
||||
UINT16);
|
||||
cmdline_parse_token_string_t cmd_avg_tcpipe_subport_string =
|
||||
TOKEN_STRING_INITIALIZER(struct cmd_avg_tcpipe_result, subport_string,
|
||||
"subport");
|
||||
@ -447,7 +447,7 @@ cmdline_parse_inst_t cmd_avg_tcpipe = {
|
||||
struct cmd_avg_pipe_result {
|
||||
cmdline_fixed_string_t qavg_string;
|
||||
cmdline_fixed_string_t port_string;
|
||||
uint8_t port_number;
|
||||
uint16_t port_number;
|
||||
cmdline_fixed_string_t subport_string;
|
||||
uint32_t subport_number;
|
||||
cmdline_fixed_string_t pipe_string;
|
||||
@ -472,7 +472,7 @@ cmdline_parse_token_string_t cmd_avg_pipe_port_string =
|
||||
"port");
|
||||
cmdline_parse_token_num_t cmd_avg_pipe_port_number =
|
||||
TOKEN_NUM_INITIALIZER(struct cmd_avg_pipe_result, port_number,
|
||||
UINT8);
|
||||
UINT16);
|
||||
cmdline_parse_token_string_t cmd_avg_pipe_subport_string =
|
||||
TOKEN_STRING_INITIALIZER(struct cmd_avg_pipe_result, subport_string,
|
||||
"subport");
|
||||
@ -506,7 +506,7 @@ cmdline_parse_inst_t cmd_avg_pipe = {
|
||||
struct cmd_avg_tcsubport_result {
|
||||
cmdline_fixed_string_t qavg_string;
|
||||
cmdline_fixed_string_t port_string;
|
||||
uint8_t port_number;
|
||||
uint16_t port_number;
|
||||
cmdline_fixed_string_t subport_string;
|
||||
uint32_t subport_number;
|
||||
cmdline_fixed_string_t tc_string;
|
||||
@ -531,7 +531,7 @@ cmdline_parse_token_string_t cmd_avg_tcsubport_port_string =
|
||||
"port");
|
||||
cmdline_parse_token_num_t cmd_avg_tcsubport_port_number =
|
||||
TOKEN_NUM_INITIALIZER(struct cmd_avg_tcsubport_result, port_number,
|
||||
UINT8);
|
||||
UINT16);
|
||||
cmdline_parse_token_string_t cmd_avg_tcsubport_subport_string =
|
||||
TOKEN_STRING_INITIALIZER(struct cmd_avg_tcsubport_result, subport_string,
|
||||
"subport");
|
||||
@ -565,7 +565,7 @@ cmdline_parse_inst_t cmd_avg_tcsubport = {
|
||||
struct cmd_avg_subport_result {
|
||||
cmdline_fixed_string_t qavg_string;
|
||||
cmdline_fixed_string_t port_string;
|
||||
uint8_t port_number;
|
||||
uint16_t port_number;
|
||||
cmdline_fixed_string_t subport_string;
|
||||
uint32_t subport_number;
|
||||
};
|
||||
@ -588,7 +588,7 @@ cmdline_parse_token_string_t cmd_avg_subport_port_string =
|
||||
"port");
|
||||
cmdline_parse_token_num_t cmd_avg_subport_port_number =
|
||||
TOKEN_NUM_INITIALIZER(struct cmd_avg_subport_result, port_number,
|
||||
UINT8);
|
||||
UINT16);
|
||||
cmdline_parse_token_string_t cmd_avg_subport_subport_string =
|
||||
TOKEN_STRING_INITIALIZER(struct cmd_avg_subport_result, subport_string,
|
||||
"subport");
|
||||
|
@ -73,7 +73,7 @@ static struct rte_eth_fc_conf fc_conf = {
|
||||
};
|
||||
|
||||
|
||||
void configure_eth_port(uint8_t port_id)
|
||||
void configure_eth_port(uint16_t port_id)
|
||||
{
|
||||
int ret;
|
||||
uint16_t nb_rxd = RX_DESC_PER_QUEUE;
|
||||
@ -135,7 +135,7 @@ init_dpdk(void)
|
||||
rte_exit(EXIT_FAILURE, "Not enough ethernet port available\n");
|
||||
}
|
||||
|
||||
void init_ring(int lcore_id, uint8_t port_id)
|
||||
void init_ring(int lcore_id, uint16_t port_id)
|
||||
{
|
||||
struct rte_ring *ring;
|
||||
char ring_name[RTE_RING_NAMESIZE];
|
||||
|
@ -34,9 +34,9 @@
|
||||
#ifndef _INIT_H_
|
||||
#define _INIT_H_
|
||||
|
||||
void configure_eth_port(uint8_t port_id);
|
||||
void configure_eth_port(uint16_t port_id);
|
||||
void init_dpdk(void);
|
||||
void init_ring(int lcore_id, uint8_t port_id);
|
||||
void init_ring(int lcore_id, uint16_t port_id);
|
||||
void pair_ports(void);
|
||||
void setup_shared_variables(void);
|
||||
|
||||
|
@ -69,13 +69,13 @@ int *quota;
|
||||
unsigned int *low_watermark;
|
||||
unsigned int *high_watermark;
|
||||
|
||||
uint8_t port_pairs[RTE_MAX_ETHPORTS];
|
||||
uint16_t port_pairs[RTE_MAX_ETHPORTS];
|
||||
|
||||
struct rte_ring *rings[RTE_MAX_LCORE][RTE_MAX_ETHPORTS];
|
||||
struct rte_mempool *mbuf_pool;
|
||||
|
||||
|
||||
static void send_pause_frame(uint8_t port_id, uint16_t duration)
|
||||
static void send_pause_frame(uint16_t port_id, uint16_t duration)
|
||||
{
|
||||
struct rte_mbuf *mbuf;
|
||||
struct ether_fc_frame *pause_frame;
|
||||
|
@ -45,7 +45,7 @@ extern int *quota;
|
||||
extern unsigned int *low_watermark;
|
||||
extern unsigned int *high_watermark;
|
||||
|
||||
extern uint8_t port_pairs[RTE_MAX_ETHPORTS];
|
||||
extern uint16_t port_pairs[RTE_MAX_ETHPORTS];
|
||||
|
||||
extern struct rte_ring *rings[RTE_MAX_LCORE][RTE_MAX_ETHPORTS];
|
||||
extern struct rte_mempool *mbuf_pool;
|
||||
|
@ -159,7 +159,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
|
||||
static __attribute__((noreturn)) void
|
||||
lcore_main(void)
|
||||
{
|
||||
uint8_t port;
|
||||
uint16_t port;
|
||||
|
||||
for (port = 0; port < nb_ports; port++)
|
||||
if (rte_eth_dev_socket_id(port) > 0 &&
|
||||
|
@ -77,7 +77,7 @@ static uint8_t node_id;
|
||||
#define MBQ_CAPACITY 32
|
||||
|
||||
/* maps input ports to output ports for packets */
|
||||
static uint8_t output_ports[RTE_MAX_ETHPORTS];
|
||||
static uint16_t output_ports[RTE_MAX_ETHPORTS];
|
||||
|
||||
/* buffers up a set of packet that are ready to send */
|
||||
struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS];
|
||||
@ -154,7 +154,7 @@ static void
|
||||
flush_tx_error_callback(struct rte_mbuf **unsent, uint16_t count,
|
||||
void *userdata) {
|
||||
int i;
|
||||
uint8_t port_id = (uintptr_t)userdata;
|
||||
uint16_t port_id = (uintptr_t)userdata;
|
||||
|
||||
tx_stats->tx_drop[port_id] += count;
|
||||
|
||||
@ -165,7 +165,7 @@ flush_tx_error_callback(struct rte_mbuf **unsent, uint16_t count,
|
||||
}
|
||||
|
||||
static void
|
||||
configure_tx_buffer(uint8_t port_id, uint16_t size)
|
||||
configure_tx_buffer(uint16_t port_id, uint16_t size)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -174,16 +174,17 @@ configure_tx_buffer(uint8_t port_id, uint16_t size)
|
||||
RTE_ETH_TX_BUFFER_SIZE(size), 0,
|
||||
rte_eth_dev_socket_id(port_id));
|
||||
if (tx_buffer[port_id] == NULL)
|
||||
rte_exit(EXIT_FAILURE, "Cannot allocate buffer for tx "
|
||||
"on port %u\n", (unsigned int) port_id);
|
||||
rte_exit(EXIT_FAILURE,
|
||||
"Cannot allocate buffer for tx on port %u\n", port_id);
|
||||
|
||||
rte_eth_tx_buffer_init(tx_buffer[port_id], size);
|
||||
|
||||
ret = rte_eth_tx_buffer_set_err_callback(tx_buffer[port_id],
|
||||
flush_tx_error_callback, (void *)(intptr_t)port_id);
|
||||
if (ret < 0)
|
||||
rte_exit(EXIT_FAILURE, "Cannot set error callback for "
|
||||
"tx buffer on port %u\n", (unsigned int) port_id);
|
||||
rte_exit(EXIT_FAILURE,
|
||||
"Cannot set error callback for tx buffer on port %u\n",
|
||||
port_id);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -282,8 +283,8 @@ static inline void
|
||||
transmit_packet(struct rte_mbuf *buf)
|
||||
{
|
||||
int sent;
|
||||
const uint8_t in_port = buf->port;
|
||||
const uint8_t out_port = output_ports[in_port];
|
||||
const uint16_t in_port = buf->port;
|
||||
const uint16_t out_port = output_ports[in_port];
|
||||
struct rte_eth_dev_tx_buffer *buffer = tx_buffer[out_port];
|
||||
|
||||
sent = rte_eth_tx_buffer(out_port, node_id, buffer, buf);
|
||||
@ -381,7 +382,7 @@ main(int argc, char *argv[])
|
||||
|
||||
for (;;) {
|
||||
uint16_t rx_pkts = PKT_READ_SIZE;
|
||||
uint8_t port;
|
||||
uint16_t port;
|
||||
|
||||
/*
|
||||
* Try dequeuing max possible packets first, if that fails,
|
||||
|
@ -121,7 +121,7 @@ init_mbuf_pools(void)
|
||||
* - start the port and report its status to stdout
|
||||
*/
|
||||
static int
|
||||
init_port(uint8_t port_num)
|
||||
init_port(uint16_t port_num)
|
||||
{
|
||||
/* for port configuration all features are off by default */
|
||||
const struct rte_eth_conf port_conf = {
|
||||
@ -136,7 +136,7 @@ init_port(uint8_t port_num)
|
||||
uint16_t q;
|
||||
int retval;
|
||||
|
||||
printf("Port %u init ... ", (unsigned int)port_num);
|
||||
printf("Port %u init ... ", port_num);
|
||||
fflush(stdout);
|
||||
|
||||
/*
|
||||
@ -255,11 +255,12 @@ populate_efd_table(void)
|
||||
|
||||
/* Check the link status of all ports in up to 9s, and print them finally */
|
||||
static void
|
||||
check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
|
||||
{
|
||||
#define CHECK_INTERVAL 100 /* 100ms */
|
||||
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
|
||||
uint8_t portid, count, all_ports_up, print_flag = 0;
|
||||
uint8_t count, all_ports_up, print_flag = 0;
|
||||
uint16_t portid;
|
||||
struct rte_eth_link link;
|
||||
|
||||
printf("\nChecking link status");
|
||||
@ -274,14 +275,15 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
|
||||
/* print link status if flag set */
|
||||
if (print_flag == 1) {
|
||||
if (link.link_status)
|
||||
printf("Port %d Link Up - speed %u "
|
||||
"Mbps - %s\n", info->id[portid],
|
||||
(unsigned int)link.link_speed,
|
||||
printf(
|
||||
"Port%d Link Up. Speed %u Mbps - %s\n",
|
||||
info->id[portid],
|
||||
link.link_speed,
|
||||
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
|
||||
("full-duplex") : ("half-duplex\n"));
|
||||
else
|
||||
printf("Port %d Link Down\n",
|
||||
(uint8_t)info->id[portid]);
|
||||
info->id[portid]);
|
||||
continue;
|
||||
}
|
||||
/* clear all_ports_up flag if any link down */
|
||||
|
@ -98,7 +98,7 @@
|
||||
#define MBUF_HEADROOM_UINT32(mbuf) (*(uint32_t *)((uint8_t *)(mbuf) \
|
||||
+ sizeof(struct rte_mbuf)))
|
||||
|
||||
#define INVALID_PORT_ID 0xFF
|
||||
#define INVALID_PORT_ID 0xFFFF
|
||||
|
||||
/* Size of buffers used for snprintfs. */
|
||||
#define MAX_PRINT_BUFF 6072
|
||||
@ -184,7 +184,7 @@ static uint32_t burst_rx_retry_num = BURST_RX_RETRIES;
|
||||
static char dev_basename[MAX_BASENAME_SZ] = "vhost-net";
|
||||
|
||||
static unsigned lcore_ids[RTE_MAX_LCORE];
|
||||
uint8_t ports[RTE_MAX_ETHPORTS];
|
||||
uint16_t ports[RTE_MAX_ETHPORTS];
|
||||
|
||||
static unsigned nb_ports; /**< The number of ports specified in command line */
|
||||
|
||||
@ -1161,7 +1161,7 @@ main(int argc, char *argv[])
|
||||
unsigned lcore_id, core_id = 0;
|
||||
unsigned nb_ports, valid_nb_ports;
|
||||
int ret;
|
||||
uint8_t portid;
|
||||
uint16_t portid;
|
||||
uint16_t queue_id;
|
||||
static pthread_t tid;
|
||||
char thread_name[RTE_MAX_THREAD_NAME_LEN];
|
||||
|
@ -129,7 +129,7 @@ const uint16_t tenant_id_conf[] = {
|
||||
* coming from the mbuf_pool passed as parameter
|
||||
*/
|
||||
int
|
||||
vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool)
|
||||
vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)
|
||||
{
|
||||
int retval;
|
||||
uint16_t q;
|
||||
@ -202,7 +202,7 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool)
|
||||
rte_eth_macaddr_get(port, &ports_eth_addr[port]);
|
||||
RTE_LOG(INFO, PORT, "Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8
|
||||
" %02"PRIx8" %02"PRIx8" %02"PRIx8"\n",
|
||||
(unsigned)port,
|
||||
port,
|
||||
ports_eth_addr[port].addr_bytes[0],
|
||||
ports_eth_addr[port].addr_bytes[1],
|
||||
ports_eth_addr[port].addr_bytes[2],
|
||||
@ -414,7 +414,7 @@ vxlan_unlink(struct vhost_dev *vdev)
|
||||
|
||||
/* Transmit packets after encapsulating */
|
||||
int
|
||||
vxlan_tx_pkts(uint8_t port_id, uint16_t queue_id,
|
||||
vxlan_tx_pkts(uint16_t port_id, uint16_t queue_id,
|
||||
struct rte_mbuf **tx_pkts, uint16_t nb_pkts) {
|
||||
int ret = 0;
|
||||
uint16_t i;
|
||||
|
@ -37,14 +37,14 @@
|
||||
extern uint16_t nb_devices;
|
||||
extern uint16_t udp_port;
|
||||
extern uint8_t filter_idx;
|
||||
extern uint8_t ports[RTE_MAX_ETHPORTS];
|
||||
extern uint16_t ports[RTE_MAX_ETHPORTS];
|
||||
extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
|
||||
extern uint32_t enable_stats;
|
||||
extern struct device_statistics dev_statistics[MAX_DEVICES];
|
||||
extern uint8_t rx_decap;
|
||||
extern uint8_t tx_encap;
|
||||
|
||||
typedef int (*ol_port_configure_t)(uint8_t port,
|
||||
typedef int (*ol_port_configure_t)(uint16_t port,
|
||||
struct rte_mempool *mbuf_pool);
|
||||
|
||||
typedef int (*ol_tunnel_setup_t)(struct vhost_dev *vdev,
|
||||
@ -52,7 +52,7 @@ typedef int (*ol_tunnel_setup_t)(struct vhost_dev *vdev,
|
||||
|
||||
typedef void (*ol_tunnel_destroy_t)(struct vhost_dev *vdev);
|
||||
|
||||
typedef int (*ol_tx_handle_t)(uint8_t port_id, uint16_t queue_id,
|
||||
typedef int (*ol_tx_handle_t)(uint16_t port_id, uint16_t queue_id,
|
||||
struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
|
||||
|
||||
typedef int (*ol_rx_handle_t)(int vid, struct rte_mbuf **pkts,
|
||||
@ -70,7 +70,7 @@ struct ol_switch_ops {
|
||||
};
|
||||
|
||||
int
|
||||
vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool);
|
||||
vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool);
|
||||
|
||||
int
|
||||
vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m);
|
||||
@ -79,7 +79,7 @@ void
|
||||
vxlan_unlink(struct vhost_dev *vdev);
|
||||
|
||||
int
|
||||
vxlan_tx_pkts(uint8_t port_id, uint16_t queue_id,
|
||||
vxlan_tx_pkts(uint16_t port_id, uint16_t queue_id,
|
||||
struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
|
||||
int
|
||||
vxlan_rx_pkts(int vid, struct rte_mbuf **pkts, uint32_t count);
|
||||
|
@ -121,7 +121,7 @@ static const struct rte_eth_conf vmdq_conf_default = {
|
||||
};
|
||||
|
||||
static unsigned lcore_ids[RTE_MAX_LCORE];
|
||||
static uint8_t ports[RTE_MAX_ETHPORTS];
|
||||
static uint16_t ports[RTE_MAX_ETHPORTS];
|
||||
static unsigned num_ports; /**< The number of ports specified in command line */
|
||||
|
||||
/* array used for printing out statistics */
|
||||
@ -186,7 +186,7 @@ get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools)
|
||||
* coming from the mbuf_pool passed as parameter
|
||||
*/
|
||||
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_dev_info dev_info;
|
||||
struct rte_eth_rxconf *rxconf;
|
||||
@ -583,7 +583,7 @@ main(int argc, char *argv[])
|
||||
unsigned lcore_id, core_id = 0;
|
||||
int ret;
|
||||
unsigned nb_ports, valid_num_ports;
|
||||
uint8_t portid;
|
||||
uint16_t portid;
|
||||
|
||||
signal(SIGHUP, sighup_handler);
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
||||
|
||||
/* mask of enabled ports */
|
||||
static uint32_t enabled_port_mask;
|
||||
static uint8_t ports[RTE_MAX_ETHPORTS];
|
||||
static uint16_t ports[RTE_MAX_ETHPORTS];
|
||||
static unsigned num_ports;
|
||||
|
||||
/* number of pools (if user does not specify any, 32 by default */
|
||||
@ -220,7 +220,7 @@ get_eth_conf(struct rte_eth_conf *eth_conf)
|
||||
* coming from the mbuf_pool passed as parameter
|
||||
*/
|
||||
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_dev_info dev_info;
|
||||
struct rte_eth_conf port_conf = {0};
|
||||
@ -646,7 +646,7 @@ main(int argc, char *argv[])
|
||||
uintptr_t i;
|
||||
int ret;
|
||||
unsigned nb_ports, valid_num_ports;
|
||||
uint8_t portid;
|
||||
uint16_t portid;
|
||||
|
||||
signal(SIGHUP, sighup_handler);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user