git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ethdev: increase port id range
[dpdk.git]
/
examples
/
l3fwd
/
main.c
diff --git
a/examples/l3fwd/main.c
b/examples/l3fwd/main.c
index
a50d628
..
a5e55ba
100644
(file)
--- a/
examples/l3fwd/main.c
+++ b/
examples/l3fwd/main.c
@@
-52,7
+52,6
@@
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_eal.h>
#include <rte_memcpy.h>
#include <rte_memzone.h>
#include <rte_eal.h>
-#include <rte_per_lcore.h>
#include <rte_launch.h>
#include <rte_atomic.h>
#include <rte_cycles.h>
#include <rte_launch.h>
#include <rte_atomic.h>
#include <rte_cycles.h>
@@
-125,7
+124,7
@@
uint32_t hash_entry_number = HASH_ENTRY_NUMBER_DEFAULT;
struct lcore_conf lcore_conf[RTE_MAX_LCORE];
struct lcore_params {
struct lcore_conf lcore_conf[RTE_MAX_LCORE];
struct lcore_params {
- uint
8
_t port_id;
+ uint
16
_t port_id;
uint8_t queue_id;
uint8_t lcore_id;
} __rte_cache_aligned;
uint8_t queue_id;
uint8_t lcore_id;
} __rte_cache_aligned;
@@
-156,7
+155,7
@@
static struct rte_eth_conf port_conf = {
.hw_ip_checksum = 1, /**< IP checksum offload enabled */
.hw_vlan_filter = 0, /**< VLAN filtering disabled */
.jumbo_frame = 0, /**< Jumbo Frame Support disabled */
.hw_ip_checksum = 1, /**< IP checksum offload enabled */
.hw_vlan_filter = 0, /**< VLAN filtering disabled */
.jumbo_frame = 0, /**< Jumbo Frame Support disabled */
- .hw_strip_crc =
0
, /**< CRC stripped by hardware */
+ .hw_strip_crc =
1
, /**< CRC stripped by hardware */
},
.rx_adv_conf = {
.rss_conf = {
},
.rx_adv_conf = {
.rss_conf = {
@@
-246,7
+245,7
@@
check_lcore_params(void)
static int
check_port_config(const unsigned nb_ports)
{
static int
check_port_config(const unsigned nb_ports)
{
- u
nsigned
portid;
+ u
int16_t
portid;
uint16_t i;
for (i = 0; i < nb_lcore_params; ++i) {
uint16_t i;
for (i = 0; i < nb_lcore_params; ++i) {
@@
-264,7
+263,7
@@
check_port_config(const unsigned nb_ports)
}
static uint8_t
}
static uint8_t
-get_port_n_rx_queues(const uint
8
_t port)
+get_port_n_rx_queues(const uint
16
_t port)
{
int queue = -1;
uint16_t i;
{
int queue = -1;
uint16_t i;
@@
-446,7
+445,7
@@
parse_config(const char *q_arg)
static void
parse_eth_dest(const char *optarg)
{
static void
parse_eth_dest(const char *optarg)
{
- uint
8
_t portid;
+ uint
16
_t portid;
char *port_end;
uint8_t c, *dest, peer_addr[6];
char *port_end;
uint8_t c, *dest, peer_addr[6];
@@
-522,10
+521,10
@@
static const struct option lgopts[] = {
* value of 8192
*/
#define NB_MBUF RTE_MAX( \
* value of 8192
*/
#define NB_MBUF RTE_MAX( \
- (nb_ports*nb_rx_queue*
RTE_TEST_RX_DESC_DEFAULT +
\
- nb_ports*nb_lcores*MAX_PKT_BURST +
\
- nb_ports*n_tx_queue*
RTE_TEST_TX_DESC_DEFAULT +
\
- nb_lcores*MEMPOOL_CACHE_SIZE),
\
+ (nb_ports*nb_rx_queue*
nb_rxd +
\
+ nb_ports*nb_lcores*MAX_PKT_BURST + \
+ nb_ports*n_tx_queue*
nb_txd +
\
+ nb_lcores*MEMPOOL_CACHE_SIZE), \
(unsigned)8192)
/* Parse the argument given in the command line of the application */
(unsigned)8192)
/* Parse the argument given in the command line of the application */
@@
-688,7
+687,7
@@
parse_args(int argc, char **argv)
argv[optind-1] = prgname;
ret = optind-1;
argv[optind-1] = prgname;
ret = optind-1;
- optind =
0
; /* reset getopt lib */
+ optind =
1
; /* reset getopt lib */
return ret;
}
return ret;
}
@@
-751,11
+750,12
@@
init_mem(unsigned nb_mbuf)
/* Check the link status of all ports in up to 9s, and print them finally */
static void
/* Check the link status of all ports in up to 9s, and print them finally */
static void
-check_all_ports_link_status(uint
8
_t port_num, uint32_t port_mask)
+check_all_ports_link_status(uint
16
_t port_num, uint32_t port_mask)
{
#define CHECK_INTERVAL 100 /* 100ms */
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
{
#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");
struct rte_eth_link link;
printf("\nChecking link status");
@@
-774,14
+774,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)
/* 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
(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 */
continue;
}
/* clear all_ports_up flag if any link down */
@@
-819,7
+818,7
@@
signal_handler(int signum)
}
static int
}
static int
-prepare_ptype_parser(uint
8
_t portid, uint16_t queueid)
+prepare_ptype_parser(uint
16
_t portid, uint16_t queueid)
{
if (parse_ptype) {
printf("Port %d: softly parse packet type info\n", portid);
{
if (parse_ptype) {
printf("Port %d: softly parse packet type info\n", portid);
@@
-848,10
+847,10
@@
main(int argc, char **argv)
struct rte_eth_txconf *txconf;
int ret;
unsigned nb_ports;
struct rte_eth_txconf *txconf;
int ret;
unsigned nb_ports;
- uint16_t queueid;
+ uint16_t queueid
, portid
;
unsigned lcore_id;
uint32_t n_tx_queue, nb_lcores;
unsigned lcore_id;
uint32_t n_tx_queue, nb_lcores;
- uint8_t
portid,
nb_rx_queue, queue, socketid;
+ uint8_t nb_rx_queue, queue, socketid;
/* init EAL */
ret = rte_eal_init(argc, argv);
/* init EAL */
ret = rte_eal_init(argc, argv);
@@
-918,6
+917,13
@@
main(int argc, char **argv)
"Cannot configure device: err=%d, port=%d\n",
ret, portid);
"Cannot configure device: err=%d, port=%d\n",
ret, portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors: err=%d, "
+ "port=%d\n", ret, portid);
+
rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
@@
-1042,7
+1048,7
@@
main(int argc, char **argv)
}
}
- check_all_ports_link_status(
(uint8_t)
nb_ports, enabled_port_mask);
+ check_all_ports_link_status(nb_ports, enabled_port_mask);
ret = 0;
/* launch per-lcore init on every lcore */
ret = 0;
/* launch per-lcore init on every lcore */