<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Wf_Segoe-Ui_Normal;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Thank you, Alexander.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The patch looks good to me. With this patch, do you see other problems with VPP?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’d like to get a review from <a id="OWAAMD37C4E80B84A4DBE873F70413713DBD3" href="mailto:samandrew@microsoft.com">
<span style="font-family:"Aptos",sans-serif;text-decoration:none">@Sam Andrew</span></a>.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Acked-by: Long Li <longli@microsoft.com><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Alexander Skorichenko <askorichenko@netgate.com>
<br>
<b>Sent:</b> Tuesday, July 2, 2024 1:49 AM<br>
<b>To:</b> stephen@networkplumber.org<br>
<b>Cc:</b> Sam Andrew <samandrew@microsoft.com>; ferruh.yigit@amd.com; andrew.rybchenko@oktetlabs.ru; Long Li <longli@microsoft.com>; Wei Hu <weh@microsoft.com>; dev@dpdk.org; Matthew Smith <mgsmith@netgate.com><br>
<b>Subject:</b> Re: [PATCH] net/netvsc: fix mtu_set in netvsc devices<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width:100.0%">
<tbody>
<tr>
<td style="background:#A6A6A6;padding:5.25pt 1.5pt 5.25pt 1.5pt"></td>
<td width="100%" style="width:100.0%;background:#EAEAEA;padding:5.25pt 3.75pt 5.25pt 11.25pt">
<div>
<p class="MsoNormal" style="mso-element:frame;mso-element-frame-hspace:2.25pt;mso-element-wrap:around;mso-element-anchor-vertical:paragraph;mso-element-anchor-horizontal:column;mso-height-rule:exactly">
<span style="font-size:9.0pt;font-family:Wf_Segoe-Ui_Normal;color:#212121">You don't often get email from
</span><span style="color:black"><a href="mailto:askorichenko@netgate.com"><span style="font-size:9.0pt;font-family:Wf_Segoe-Ui_Normal">askorichenko@netgate.com</span></a></span><span style="font-size:9.0pt;font-family:Wf_Segoe-Ui_Normal;color:#212121">.
</span><span style="color:black"><a href="https://aka.ms/LearnAboutSenderIdentification"><span style="font-size:9.0pt;font-family:Wf_Segoe-Ui_Normal">Learn why this is important</span></a></span><span style="font-size:9.0pt;font-family:Wf_Segoe-Ui_Normal;color:#212121"><o:p></o:p></span></p>
</div>
</td>
<td width="75" style="width:56.25pt;background:#EAEAEA;padding:5.25pt 3.75pt 5.25pt 3.75pt;align:left">
</td>
</tr>
</tbody>
</table>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">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<o:p></o:p></p>
</div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</body>
</html>