<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE>
BLOCKQUOTE {
        MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px; MARGIN-LEFT: 2em
}
OL {
        MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px
}
UL {
        MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px
}
P {
        MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px
}
BODY {
        FONT-SIZE: 10.5pt; FONT-FAMILY: Microsoft YaHei UI; COLOR: #000000; LINE-HEIGHT: 1.5
}
</STYLE>

<META name=GENERATOR content="MSHTML 11.00.10570.1001"></HEAD>
<BODY style="MARGIN: 10px">
<DIV>
<DIV>
<DIV class="flex-1 overflow-hidden" 
style="BOX-SIZING: border-box; OVERFLOW: hidden; BORDER-TOP: rgb(227,227,227) 0px solid; BORDER-RIGHT: rgb(227,227,227) 0px solid; BORDER-BOTTOM: rgb(227,227,227) 0px solid; BORDER-LEFT: rgb(227,227,227) 0px solid; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-pan-x: ; --tw-pan-y: ; --tw-pinch-zoom: ; --tw-scroll-snap-strictness: proximity; --tw-gradient-from-position: ; --tw-gradient-via-position: ; --tw-gradient-to-position: ; --tw-ordinal: ; --tw-slashed-zero: ; --tw-numeric-figure: ; --tw-numeric-spacing: ; --tw-numeric-fraction: ; --tw-ring-inset: ; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; --tw-blur: ; --tw-brightness: ; --tw-contrast: ; --tw-grayscale: ; --tw-hue-rotate: ; --tw-invert: ; --tw-saturate: ; --tw-sepia: ; --tw-drop-shadow: ; --tw-backdrop-blur: ; --tw-backdrop-brightness: ; --tw-backdrop-contrast: ; --tw-backdrop-grayscale: ; --tw-backdrop-hue-rotate: ; --tw-backdrop-invert: ; --tw-backdrop-opacity: ; --tw-backdrop-saturate: ; --tw-backdrop-sepia: ; flex: 1 1 0%"><SPAN 
style='FONT-SIZE: 16px; FONT-FAMILY: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; WHITE-SPACE: pre-wrap; WORD-SPACING: 0px; TEXT-TRANSFORM: none; FLOAT: none; FONT-WEIGHT: 400; COLOR: rgb(13,13,13); FONT-STYLE: normal; ORPHANS: 2; WIDOWS: 2; DISPLAY: inline !important; LETTER-SPACING: normal; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial'>I 
tried this modification and it works as well.</SPAN></DIV>
<DIV class="flex-1 overflow-hidden" 
style="BOX-SIZING: border-box; OVERFLOW: hidden; BORDER-TOP: rgb(227,227,227) 0px solid; BORDER-RIGHT: rgb(227,227,227) 0px solid; BORDER-BOTTOM: rgb(227,227,227) 0px solid; BORDER-LEFT: rgb(227,227,227) 0px solid; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-pan-x: ; --tw-pan-y: ; --tw-pinch-zoom: ; --tw-scroll-snap-strictness: proximity; --tw-gradient-from-position: ; --tw-gradient-via-position: ; --tw-gradient-to-position: ; --tw-ordinal: ; --tw-slashed-zero: ; --tw-numeric-figure: ; --tw-numeric-spacing: ; --tw-numeric-fraction: ; --tw-ring-inset: ; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; --tw-blur: ; --tw-brightness: ; --tw-contrast: ; --tw-grayscale: ; --tw-hue-rotate: ; --tw-invert: ; --tw-saturate: ; --tw-sepia: ; --tw-drop-shadow: ; --tw-backdrop-blur: ; --tw-backdrop-brightness: ; --tw-backdrop-contrast: ; --tw-backdrop-grayscale: ; --tw-backdrop-hue-rotate: ; --tw-backdrop-invert: ; --tw-backdrop-opacity: ; --tw-backdrop-saturate: ; --tw-backdrop-sepia: ; flex: 1 1 0%"><SPAN 
style='FONT-SIZE: 16px; FONT-FAMILY: Söhne, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; WHITE-SPACE: pre-wrap; WORD-SPACING: 0px; TEXT-TRANSFORM: none; FLOAT: none; FONT-WEIGHT: 400; COLOR: rgb(13,13,13); FONT-STYLE: normal; ORPHANS: 2; WIDOWS: 2; DISPLAY: inline !important; LETTER-SPACING: normal; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial'></SPAN> </DIV>
<DIV class="flex-1 overflow-hidden" 
style="BOX-SIZING: border-box; OVERFLOW: hidden; BORDER-TOP: rgb(227,227,227) 0px solid; BORDER-RIGHT: rgb(227,227,227) 0px solid; BORDER-BOTTOM: rgb(227,227,227) 0px solid; BORDER-LEFT: rgb(227,227,227) 0px solid; --tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; --tw-rotate: 0; --tw-skew-x: 0; --tw-skew-y: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-pan-x: ; --tw-pan-y: ; --tw-pinch-zoom: ; --tw-scroll-snap-strictness: proximity; --tw-gradient-from-position: ; --tw-gradient-via-position: ; --tw-gradient-to-position: ; --tw-ordinal: ; --tw-slashed-zero: ; --tw-numeric-figure: ; --tw-numeric-spacing: ; --tw-numeric-fraction: ; --tw-ring-inset: ; --tw-ring-offset-width: 0px; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(69,89,164,.5); --tw-ring-offset-shadow: 0 0 transparent; --tw-ring-shadow: 0 0 transparent; --tw-shadow: 0 0 transparent; --tw-shadow-colored: 0 0 transparent; --tw-blur: ; --tw-brightness: ; --tw-contrast: ; --tw-grayscale: ; --tw-hue-rotate: ; --tw-invert: ; --tw-saturate: ; --tw-sepia: ; --tw-drop-shadow: ; --tw-backdrop-blur: ; --tw-backdrop-brightness: ; --tw-backdrop-contrast: ; --tw-backdrop-grayscale: ; --tw-backdrop-hue-rotate: ; --tw-backdrop-invert: ; --tw-backdrop-opacity: ; --tw-backdrop-saturate: ; --tw-backdrop-sepia: ; flex: 1 1 0%">[root@compute3 
/]# /dpdk/app/dpdk-dumpcap -i 0000:18:00.0</DIV></DIV>
<DIV>File: /tmp/dpdk-dumpcap_0_0000:18:00.0_20240321043451.pcapng</DIV>
<DIV>Capturing on '0000:18:00.0'</DIV>
<DIV>Packets captured: 499 ^C</DIV>
<DIV>Packets received/dropped on interface '0000:18:00.0': 499/0 
(100.0)</DIV></DIV>
<DIV> </DIV>
<DIV>
<DIV>diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c 
b/drivers/net/ixgbe/ixgbe_ethdev.c</DIV>
<DIV>index c61c52b2966b..86ccbdd78292 100644</DIV>
<DIV>--- a/drivers/net/ixgbe/ixgbe_ethdev.c</DIV>
<DIV>+++ b/drivers/net/ixgbe/ixgbe_ethdev.c</DIV>
<DIV>@@ -4293,6 +4293,9 @@ ixgbe_dev_link_update_share(struct rte_eth_dev 
*dev,</DIV>
<DIV>int wait = 1;</DIV>
<DIV>u32 esdp_reg;</DIV>
<DIV></DIV>
<DIV>+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)</DIV>
<DIV>+ return -1;</DIV>
<DIV>+</DIV>
<DIV>memset(&link, 0, sizeof(link));</DIV>
<DIV>link.link_status = RTE_ETH_LINK_DOWN;</DIV>
<DIV>link.link_speed = RTE_ETH_SPEED_NUM_NONE;</DIV></DIV>
<DIV> </DIV>
<HR style="HEIGHT: 1px; WIDTH: 210px" align=left color=#b5c4df SIZE=1>

<DIV><SPAN>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: verdana; MARGIN: 10px">
<DIV>junwang01@cestc.cn</DIV></DIV></SPAN></DIV>
<DIV> </DIV>
<DIV 
style="BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; BORDER-BOTTOM: medium none; PADDING-BOTTOM: 0cm; PADDING-TOP: 3pt; PADDING-LEFT: 0cm; BORDER-LEFT: medium none; PADDING-RIGHT: 0cm">
<DIV 
style="FONT-SIZE: 12px; FONT-FAMILY: tahoma; BACKGROUND: #efefef; COLOR: #000000; PADDING-BOTTOM: 8px; PADDING-TOP: 8px; PADDING-LEFT: 8px; PADDING-RIGHT: 8px">
<DIV><B>From:</B> <A href="mailto:stephen@networkplumber.org">Stephen 
Hemminger</A></DIV>
<DIV><B>Date:</B> 2024-03-21 01:33</DIV>
<DIV><B>To:</B> <A href="mailto:dev@dpdk.org">dev</A></DIV>
<DIV><B>CC:</B> <A href="mailto:junwang01@cestc.cn">junwang01</A>; <A 
href="mailto:stephen@networkplumber.org">Stephen Hemminger</A></DIV>
<DIV><B>Subject:</B> [PATCH] net/ixgbe: do not update link status in 
secondary process</DIV></DIV></DIV>
<DIV>
<DIV>The code to update link status is not safe in secondary process.</DIV>
<DIV>If called from secondary it will crash, example from dumpcap:</DIV>
<DIV>ixgbe_dev_link_update_share()</DIV>
<DIV>ixgbe_dev_link_update()</DIV>
<DIV>rte_eth_link_get()</DIV>
<DIV> </DIV>
<DIV>Signed-off-by: Stephen Hemminger <stephen@networkplumber.org></DIV>
<DIV>Reported-by: Jun Wang <junwang01@cestc.cn></DIV>
<DIV>---</DIV>
<DIV>Simpler version of earlier patch, and add explanation.</DIV>
<DIV> </DIV>
<DIV>drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++</DIV>
<DIV>1 file changed, 3 insertions(+)</DIV>
<DIV> </DIV>
<DIV>diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c 
b/drivers/net/ixgbe/ixgbe_ethdev.c</DIV>
<DIV>index c61c52b2966b..86ccbdd78292 100644</DIV>
<DIV>--- a/drivers/net/ixgbe/ixgbe_ethdev.c</DIV>
<DIV>+++ b/drivers/net/ixgbe/ixgbe_ethdev.c</DIV>
<DIV>@@ -4293,6 +4293,9 @@ ixgbe_dev_link_update_share(struct rte_eth_dev 
*dev,</DIV>
<DIV>int wait = 1;</DIV>
<DIV>u32 esdp_reg;</DIV>
<DIV></DIV>
<DIV>+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)</DIV>
<DIV>+ return -1;</DIV>
<DIV>+</DIV>
<DIV>memset(&link, 0, sizeof(link));</DIV>
<DIV>link.link_status = RTE_ETH_LINK_DOWN;</DIV>
<DIV>link.link_speed = RTE_ETH_SPEED_NUM_NONE;</DIV>
<DIV>-- </DIV>
<DIV>2.43.0</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV></DIV></DIV></BODY></HTML>