examples/vmdq: fix code style
Signed-off-by: Huawei Xie <huawei.xie@intel.com> Acked-by: Jing Chen <jing.d.chen@intel.com>
This commit is contained in:
parent
2a13a5a08d
commit
b30eb1d26e
@ -92,7 +92,7 @@
|
|||||||
#define INVALID_PORT_ID 0xFF
|
#define INVALID_PORT_ID 0xFF
|
||||||
|
|
||||||
/* mask of enabled ports */
|
/* mask of enabled ports */
|
||||||
static uint32_t enabled_port_mask = 0;
|
static uint32_t enabled_port_mask;
|
||||||
|
|
||||||
/* number of pools (if user does not specify any, 8 by default */
|
/* number of pools (if user does not specify any, 8 by default */
|
||||||
static uint32_t num_queues = 8;
|
static uint32_t num_queues = 8;
|
||||||
@ -129,7 +129,7 @@ static const struct rte_eth_conf vmdq_conf_default = {
|
|||||||
|
|
||||||
static unsigned lcore_ids[RTE_MAX_LCORE];
|
static unsigned lcore_ids[RTE_MAX_LCORE];
|
||||||
static uint8_t ports[RTE_MAX_ETHPORTS];
|
static uint8_t ports[RTE_MAX_ETHPORTS];
|
||||||
static unsigned num_ports = 0; /**< The number of ports specified in command line */
|
static unsigned num_ports; /**< The number of ports specified in command line */
|
||||||
|
|
||||||
/* array used for printing out statistics */
|
/* array used for printing out statistics */
|
||||||
volatile unsigned long rxPackets[MAX_QUEUES] = {0};
|
volatile unsigned long rxPackets[MAX_QUEUES] = {0};
|
||||||
@ -161,8 +161,11 @@ static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS];
|
|||||||
#define MAX_POOL_MAP_NUM_1G 32
|
#define MAX_POOL_MAP_NUM_1G 32
|
||||||
#define MAX_POOL_NUM_10G 64
|
#define MAX_POOL_NUM_10G 64
|
||||||
#define MAX_POOL_NUM_1G 8
|
#define MAX_POOL_NUM_1G 8
|
||||||
/* Builds up the correct configuration for vmdq based on the vlan tags array
|
/*
|
||||||
* given above, and determine the queue number and pool map number according to valid pool number */
|
* Builds up the correct configuration for vmdq based on the vlan tags array
|
||||||
|
* given above, and determine the queue number and pool map number according to
|
||||||
|
* valid pool number
|
||||||
|
*/
|
||||||
static inline int
|
static inline int
|
||||||
get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools)
|
get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools)
|
||||||
{
|
{
|
||||||
@ -202,7 +205,10 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
|
|||||||
uint16_t queues_per_pool;
|
uint16_t queues_per_pool;
|
||||||
uint32_t max_nb_pools;
|
uint32_t max_nb_pools;
|
||||||
|
|
||||||
/* The max pool number from dev_info will be used to validate the pool number specified in cmd line */
|
/*
|
||||||
|
* The max pool number from dev_info will be used to validate the pool
|
||||||
|
* number specified in cmd line
|
||||||
|
*/
|
||||||
rte_eth_dev_info_get(port, &dev_info);
|
rte_eth_dev_info_get(port, &dev_info);
|
||||||
max_nb_pools = (uint32_t)dev_info.max_vmdq_pools;
|
max_nb_pools = (uint32_t)dev_info.max_vmdq_pools;
|
||||||
/*
|
/*
|
||||||
@ -234,7 +240,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
|
|||||||
num_pf_queues, num_pools, queues_per_pool);
|
num_pf_queues, num_pools, queues_per_pool);
|
||||||
printf("vmdq queue base: %d pool base %d\n",
|
printf("vmdq queue base: %d pool base %d\n",
|
||||||
vmdq_queue_base, vmdq_pool_base);
|
vmdq_queue_base, vmdq_pool_base);
|
||||||
if (port >= rte_eth_dev_count()) return -1;
|
if (port >= rte_eth_dev_count())
|
||||||
|
return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Though in this example, we only receive packets from the first queue
|
* Though in this example, we only receive packets from the first queue
|
||||||
@ -380,7 +387,8 @@ vmdq_parse_args(int argc, char **argv)
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Parse command line */
|
/* Parse command line */
|
||||||
while ((opt = getopt_long(argc, argv, "p:",long_option,&option_index)) != EOF) {
|
while ((opt = getopt_long(argc, argv, "p:", long_option,
|
||||||
|
&option_index)) != EOF) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
/* portmask */
|
/* portmask */
|
||||||
case 'p':
|
case 'p':
|
||||||
@ -498,7 +506,7 @@ lcore_main(__attribute__((__unused__)) void* dummy)
|
|||||||
|
|
||||||
if (startQueue == endQueue) {
|
if (startQueue == endQueue) {
|
||||||
printf("lcore %u has nothing to do\n", lcore_id);
|
printf("lcore %u has nothing to do\n", lcore_id);
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -507,8 +515,8 @@ lcore_main(__attribute__((__unused__)) void* dummy)
|
|||||||
|
|
||||||
for (p = 0; p < num_ports; p++) {
|
for (p = 0; p < num_ports; p++) {
|
||||||
const uint8_t sport = ports[p];
|
const uint8_t sport = ports[p];
|
||||||
const uint8_t dport = ports[p ^ 1]; /* 0 <-> 1, 2 <-> 3 etc */
|
/* 0 <-> 1, 2 <-> 3 etc */
|
||||||
|
const uint8_t dport = ports[p ^ 1];
|
||||||
if ((sport == INVALID_PORT_ID) || (dport == INVALID_PORT_ID))
|
if ((sport == INVALID_PORT_ID) || (dport == INVALID_PORT_ID))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user