<div dir="ltr"><div dir="ltr">Hello,<br>The failure happens when running under VPP. In terms of dpdk calls the following sequence of events occurs for a NetVSC device:<br><br>Durung device probing stage of VPP<br>   1. eth_hn_dev_init() memory for a single primary rx_queue is allocated<br>            dev->data->rx_queues[0] = 0, allocated, but not set yet<br>            no allocation happened for tx_queues[i] and non-primary rx_queues[i]<br><br>During device setup stage of VPP from VPP's own generic dpdk_device_setup():<br>   2.  rte_eth_dev_set_mtu()<br>            currently it segfaults in hn_reinit() when trying to reach into<br>            dev->data->rx_queues[i], dev->data->tx_queues[i]<br>   3.  rte_eth_tx_queue_setup()<br>            dev->data->tx_queues[i] are being allocated and set<br>   4.  rte_eth_rx_queue_setup()<br>            dev->data->rx_queues[i] get allocated (i > 0) and set<br><br>So rx_queues[0] could be set in step 1, but rx_queues[i] and tx_queues[i] are still NULL. <br>Allocating all the remaining rx/tx queues in step 1 would prevent the crash, but then in steps 3-4 would go through releasing and allocating all of the queues again. <br><br>Another comment regarding the uniform condition introduced in hn_reinit() in the patch:<br>        if (dev->data->rx_queues[0] != NULL) ...<br>Because of the difference between rx/tx queues described above, it's probably safer to extend the condition to check both rx and tx separately<br>        if (dev->data->rx_queues[0] != NULL && dev->data->tx_queues[0] != NULL)<br>        <br>- Alexander Skorichenko<br><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 30, 2024 at 5:40 PM Stephen Hemminger <<a href="mailto:stephen@networkplumber.org">stephen@networkplumber.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 28 Jun 2024 18:35:03 +0200<br>
Alexander Skorichenko <<a href="mailto:askorichenko@netgate.com" target="_blank">askorichenko@netgate.com</a>> wrote:<br>
<br>
> Prevent segfault in hn_reinit() caused by changing the MTU for<br>
> an incompletely initialized device.<br>
> <br>
> Signed-off-by: Alexander Skorichenko <<a href="mailto:askorichenko@netgate.com" target="_blank">askorichenko@netgate.com</a>><br>
<br>
How do you get in that state?<br>
Maybe the init code should set up these pointers and avoid the problem.<br>
</blockquote></div></div>