On Tue, Oct 26, 2021 at 7:10 PM Ananyev, Konstantin <konstantin.anan...@intel.com> wrote: > > static uint16_t > > -dummy_eth_rx_burst(__rte_unused void *rxq, > > +dummy_eth_rx_burst(void *rxq, > > __rte_unused struct rte_mbuf **rx_pkts, > > __rte_unused uint16_t nb_pkts) > > { > > - RTE_ETHDEV_LOG(ERR, "rx_pkt_burst for not ready port\n"); > > + struct dummy_queue *q = rxq; > > + > > LGTM in general, just one thing: > I think we'd better add extra check that rxq really points to dummy queues > before de-referencing it. > Something like: > > uintptr_t port_id; > .... > port_id = q - dummy_queues; > if (port_id < RTE_DIM(dummy_queues) && !q->rx_warn_once) { > .... > } > > Same for tx.
Yep, will add. > > > + if (!q->rx_warn_once) { > > + uint16_t port_id = q - dummy_queues; > > + > > + RTE_ETHDEV_LOG(ERR, "lcore %u called rx_pkt_burst for not > > ready port %"PRIu16"\n", > > + rte_lcore_id(), port_id); > > + rte_dump_stack(); > > + q->rx_warn_once = true; > > + } > > rte_errno = ENOTSUP; > > return 0; > > } > > > > static uint16_t > > -dummy_eth_tx_burst(__rte_unused void *txq, > > +dummy_eth_tx_burst(void *txq, > > __rte_unused struct rte_mbuf **tx_pkts, > > __rte_unused uint16_t nb_pkts) > > { > > - RTE_ETHDEV_LOG(ERR, "tx_pkt_burst for not ready port\n"); > > + struct dummy_queue *q = txq; > > + > > + if (!q->tx_warn_once) { > > + uint16_t port_id = q - dummy_queues; > > + > > + RTE_ETHDEV_LOG(ERR, "lcore %u called tx_pkt_burst for not > > ready port %"PRIu16"\n", > > + rte_lcore_id(), port_id); > > + rte_dump_stack(); > > + q->tx_warn_once = true; > > + } > > rte_errno = ENOTSUP; > > return 0; > > } > > @@ -199,14 +236,22 @@ void > > eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo) > > { > > static void *dummy_data[RTE_MAX_QUEUES_PER_PORT]; > > - static const struct rte_eth_fp_ops dummy_ops = { > > + uint16_t port_id = fpo - rte_eth_fp_ops; > > + > > + dummy_queues[port_id].rx_warn_once = false; > > + dummy_queues[port_id].tx_warn_once = false; > > + *fpo = (struct rte_eth_fp_ops) { > > .rx_pkt_burst = dummy_eth_rx_burst, > > .tx_pkt_burst = dummy_eth_tx_burst, > > - .rxq = {.data = dummy_data, .clbk = dummy_data,}, > > - .txq = {.data = dummy_data, .clbk = dummy_data,}, > > + .rxq = (struct rte_ethdev_qdata) { > > Here and for txq, do we need to explicitly specify type? > Wouldn't: > .rxq = {.data=..., .clbk=...,}, > be enough here? Well, same question from Thomas. It seems to work without it. -- David Marchand