On Tue, Sep 24, 2019 at 3:12 PM <pbhagavat...@marvell.com> wrote:
>
> From: Sunil Kumar Kori <sk...@marvell.com>
>
> Add the default l2fwd poll mode routines similar to examples/l2fwd.
>
> Signed-off-by: Sunil Kumar Kori <sk...@marvell.com>
> ---

> +#ifndef __L2FWD_COMMON_H__
> +#define __L2FWD_COMMON_H__
> +
> +#define MAX_PKT_BURST 32
> +#define MAX_RX_QUEUE_PER_LCORE 16
> +#define MAX_TX_QUEUE_PER_PORT 16
> +
> +#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1

IMO, Application does not need log type, normal printf will be enough
as it is not a subsystem.


> +
> +#define RTE_TEST_RX_DESC_DEFAULT 1024
> +#define RTE_TEST_TX_DESC_DEFAULT 1024
> +
> +/* Per-port statistics struct */
> +struct l2fwd_port_statistics {
> +       uint64_t dropped;
> +       uint64_t tx;
> +       uint64_t rx;
> +} __rte_cache_aligned;
> +
> +void print_stats(void);
> +
> +#endif /* __L2FWD_COMMON_H__ */
> diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
> new file mode 100644
> index 000000000..cc47fa203
> --- /dev/null
> +++ b/examples/l2fwd-event/main.c
> @@ -0,0 +1,737 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2019 Marvell International Ltd.
> + */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <stdint.h>
> +#include <inttypes.h>
> +#include <sys/types.h>
> +#include <sys/queue.h>
> +#include <netinet/in.h>
> +#include <setjmp.h>
> +#include <stdarg.h>
> +#include <ctype.h>
> +#include <errno.h>
> +#include <getopt.h>
> +#include <signal.h>
> +#include <stdbool.h>
> +
> +#include <rte_common.h>
> +#include <rte_log.h>
> +#include <rte_malloc.h>
> +#include <rte_memory.h>
> +#include <rte_memcpy.h>
> +#include <rte_eal.h>
> +#include <rte_launch.h>
> +#include <rte_atomic.h>
> +#include <rte_cycles.h>
> +#include <rte_prefetch.h>
> +#include <rte_lcore.h>
> +#include <rte_per_lcore.h>
> +#include <rte_branch_prediction.h>
> +#include <rte_interrupts.h>
> +#include <rte_random.h>
> +#include <rte_debug.h>
> +#include <rte_ether.h>
> +#include <rte_ethdev.h>
> +#include <rte_eventdev.h>
> +#include <rte_mempool.h>
> +#include <rte_mbuf.h>
> +#include <rte_spinlock.h>

Sort in alphabetical order.


> +
> +#include "l2fwd_common.h"
> +
> +static volatile bool force_quit;
> +
> +/* MAC updating enabled by default */
> +static int mac_updating = 1;
> +
> +#define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */
> +#define MEMPOOL_CACHE_SIZE 256
> +
> +/*
> + * Configurable number of RX/TX ring descriptors
> + */
> +static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
> +static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
> +
> +/* ethernet addresses of ports */
> +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS];
> +
> +/* mask of enabled ports */
> +static uint32_t l2fwd_enabled_port_mask;
> +
> +/* list of enabled ports */
> +static uint32_t l2fwd_dst_ports[RTE_MAX_ETHPORTS];
> +
> +static unsigned int l2fwd_rx_queue_per_lcore = 1;

I think, we move this global variable to structures.

Reply via email to