[PATCH v6 07/13] ethdev: add port mirroring feature
Stephen Hemminger
stephen at networkplumber.org
Wed Jul 23 17:26:37 CEST 2025
On Wed, 23 Jul 2025 06:13:27 +0400 (+04)
Ivan Malov <ivan.malov at arknetworks.am> wrote:
> +static inline void
> > +eth_dev_mirror(uint16_t port_id, uint16_t queue_id, uint8_t direction,
> > + struct rte_mbuf **pkts, uint16_t nb_pkts,
> > + const struct rte_eth_mirror_conf *conf)
> > +{
> > + struct rte_mbuf *tosend[RTE_MIRROR_BURST_SIZE];
> > + unsigned int count = 0;
> > + unsigned int i;
> > +
> > + for (i = 0; i < nb_pkts; i++) {
> > + struct rte_mbuf *m = pkts[i];
> > + struct rte_mbuf *mc;
> > +
> > + if (conf->flags & RTE_ETH_MIRROR_INDIRECT_FLAG) {
> > + mc = rte_pktmbuf_alloc(conf->mp);
>
> Can 'rte_pktmbuf_alloc_bulk' be used prior to the 'for' loop? I do not insist.
>
> > + if (unlikely(mc == NULL))
> > + continue;
> > +
> > + /* Make both mbuf's point to the same data */
> > + rte_pktmbuf_attach(mc, m);
> > + } else {
> > + mc = rte_pktmbuf_copy(m, conf->mp, 0, conf->snaplen);
> > + /* TODO: dropped stats? */
> > + if (unlikely(mc == NULL))
> > + continue;
> > + }
> >
Both sides could use a bulk allocated array, but would need new variant
of rte_pktmbuf_copy for that.
More information about the dev
mailing list