On Fri, 19 Mar 2021 08:02:06 -0400
Venkata Suresh Kumar P <venkata.suresh.kuma...@intel.com> wrote:

> +/*
> + * FD Reader
> + */
> +struct reader {
> +     struct {
> +             int fd;
> +             uint32_t mtu;
> +             uint32_t burst_size;
> +             struct rte_mempool *mempool;
> +     } params;
> +
> +     struct rte_swx_port_in_stats stats;
> +     struct rte_mbuf **pkts;
> +     uint32_t n_pkts;
> +     uint32_t pos;
> +};
> +

You could save one allocation (and get better cache locality)
by using a dynamic array here.

struct reader {
        struct {
                int fd;
                uint32_t mtu;
                uint32_t burst_size;
                struct rte_mempool *mempool;
        } params;

        struct rte_swx_port_in_stats stats;

        uint32_t n_pkts;
        uint32_t pos;
        struct rte_mbuf *pkts[];
};

Then change the allocation to size it based on number of packets.

Reply via email to