<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:等线;
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:"\@等线";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:等线;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
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 for your reply. Personally, I think that when disabling promiscuous/all-multicast mode, the corresponding flag should be set based on the return value. This is because, at the driver implementation level, the driver may check
the flag to determine whether the corresponding disable operation needs to be executed. If the flag is set before the operation is completed, the driver will not execute the operation when it checks the flag, as it will find that the flag has already been
set.<span style="font-family:等线"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:等线"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="ZH-CN" style="font-family:等线">发件人</span></b><b><span style="font-family:等线">:</span></b><span style="font-family:等线"> Stephen Hemminger <stephen@networkplumber.org>
<br>
<b><span lang="ZH-CN">发送时间</span>:</b> 2025<span lang="ZH-CN">年</span>5<span lang="ZH-CN">月</span>8<span lang="ZH-CN">日</span> 13:35<br>
<b><span lang="ZH-CN">收件人</span>:</b> Sunyang Wu <sunyang.wu@jaguarmicro.com><br>
<b><span lang="ZH-CN">抄送</span>:</b> dev <dev@dpdk.org>; Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@amd.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru><br>
<b><span lang="ZH-CN">主题</span>:</b> Re: [PATCH] ethdev: optimize how the values of the flag variables are assigned<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:red;padding:5.0pt 2.0pt 5.0pt 2.0pt"></td>
<td width="100%" style="width:100.0%;background:#FFD4D4;padding:5.0pt 4.0pt 5.0pt 12.0pt;wrap:break-word">
<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">
<b><span style="font-size:10.0pt;color:#222222">External Mail: </span></b><span style="font-size:10.0pt;color:#222222">This email originated from
<b>OUTSIDE</b> of the organization! <br>
<b>Do not click</b> links, open attachments or provide <b>ANY</b> information unless you recognize the sender and know the content is safe.
<o:p></o:p></span></p>
</div>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Why bother? This is not critical path. <o:p></o:p></p>
<div>
<p class="MsoNormal">Original code looked fine <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Thu, May 8, 2025, 11:34 Sunyang Wu <<a href="mailto:sunyang.wu@jaguarmicro.com">sunyang.wu@jaguarmicro.com</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Set the values of the promiscuous and all_multicast variables<br>
according to the return value.<br>
<br>
Signed-off-by: Sunyang Wu <<a href="mailto:sunyang.wu@jaguarmicro.com" target="_blank">sunyang.wu@jaguarmicro.com</a>><br>
---<br>
lib/ethdev/rte_ethdev.c | 9 +++------<br>
1 file changed, 3 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c<br>
index d4197322a0..b1f593edc4 100644<br>
--- a/lib/ethdev/rte_ethdev.c<br>
+++ b/lib/ethdev/rte_ethdev.c<br>
@@ -3044,10 +3044,8 @@ rte_eth_promiscuous_disable(uint16_t port_id)<br>
if (dev->dev_ops->promiscuous_disable == NULL)<br>
return -ENOTSUP;<br>
<br>
- dev->data->promiscuous = 0;<br>
diag = dev->dev_ops->promiscuous_disable(dev);<br>
- if (diag != 0)<br>
- dev->data->promiscuous = 1;<br>
+ dev->data->promiscuous = (diag == 0) ? 0 : 1;<br>
<br>
diag = eth_err(port_id, diag);<br>
<br>
@@ -3112,10 +3110,9 @@ rte_eth_allmulticast_disable(uint16_t port_id)<br>
<br>
if (dev->dev_ops->allmulticast_disable == NULL)<br>
return -ENOTSUP;<br>
- dev->data->all_multicast = 0;<br>
+<br>
diag = dev->dev_ops->allmulticast_disable(dev);<br>
- if (diag != 0)<br>
- dev->data->all_multicast = 1;<br>
+ dev->data->all_multicast = (diag == 0) ? 0 : 1;<br>
<br>
diag = eth_err(port_id, diag);<br>
<br>
-- <br>
2.19.0.rc0.windows.1<o:p></o:p></p>
</div>
</body>
</html>