From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2159943D0D; Thu, 21 Mar 2024 05:40:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E173E4028B; Thu, 21 Mar 2024 05:40:07 +0100 (CET) Received: from smtp.cecloud.com (unknown [1.203.97.246]) by mails.dpdk.org (Postfix) with ESMTP id C7CE940265 for ; Thu, 21 Mar 2024 05:40:05 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by smtp.cecloud.com (Postfix) with ESMTP id B2A367C0113 for ; Thu, 21 Mar 2024 12:40:03 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ANTISPAM-LEVEL: 2 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 Received: from desktop-db736ns (unknown [111.48.58.10]) by smtp.cecloud.com (postfix) whith ESMTP id P235493T281472459862384S1710996002890763_; Thu, 21 Mar 2024 12:40:03 +0800 (CST) X-IP-DOMAINF: 1 X-RL-SENDER: junwang01@cestc.cn X-SENDER: junwang01@cestc.cn X-LOGIN-NAME: junwang01@cestc.cn X-FST-TO: stephen@networkplumber.org X-RCPT-COUNT: 2 X-LOCAL-RCPT-COUNT: 0 X-MUTI-DOMAIN-COUNT: 0 X-SENDER-IP: 111.48.58.10 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: <2a8bdf50a4904148d4e3cdb5235e5084> X-System-Flag: 0 Date: Thu, 21 Mar 2024 12:39:52 +0800 From: "junwang01@cestc.cn" To: "Stephen Hemminger" , dev Cc: "Stephen Hemminger" Subject: Re: [PATCH] net/ixgbe: do not update link status in secondary process References: <1710865092-2796-1-git-send-email-junwang01@cestc.cn>, <20240320173407.216307-1-stephen@networkplumber.org> X-Priority: 3 X-GUID: 301CF6F8-991F-4B50-A349-FD323C300557 X-Has-Attach: no X-Mailer: Foxmail 7, 1, 3, 52[cn] Mime-Version: 1.0 Message-ID: <202403211239522709132@cestc.cn> Content-Type: multipart/alternative; boundary="----=_001_NextPart568011621506_=----" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This is a multi-part message in MIME format. ------=_001_NextPart568011621506_=---- Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 SSB0cmllZCB0aGlzIG1vZGlmaWNhdGlvbiBhbmQgaXQgd29ya3MgYXMgd2VsbC4NCg0KW3Jvb3RA Y29tcHV0ZTMgL10jIC9kcGRrL2FwcC9kcGRrLWR1bXBjYXAgLWkgMDAwMDoxODowMC4wDQpGaWxl OiAvdG1wL2RwZGstZHVtcGNhcF8wXzAwMDA6MTg6MDAuMF8yMDI0MDMyMTA0MzQ1MS5wY2FwbmcN CkNhcHR1cmluZyBvbiAnMDAwMDoxODowMC4wJw0KUGFja2V0cyBjYXB0dXJlZDogNDk5IF5DDQpQ YWNrZXRzIHJlY2VpdmVkL2Ryb3BwZWQgb24gaW50ZXJmYWNlICcwMDAwOjE4OjAwLjAnOiA0OTkv MCAoMTAwLjApDQoNCmRpZmYgLS1naXQgYS9kcml2ZXJzL25ldC9peGdiZS9peGdiZV9ldGhkZXYu YyBiL2RyaXZlcnMvbmV0L2l4Z2JlL2l4Z2JlX2V0aGRldi5jDQppbmRleCBjNjFjNTJiMjk2NmIu Ljg2Y2NiZGQ3ODI5MiAxMDA2NDQNCi0tLSBhL2RyaXZlcnMvbmV0L2l4Z2JlL2l4Z2JlX2V0aGRl di5jDQorKysgYi9kcml2ZXJzL25ldC9peGdiZS9peGdiZV9ldGhkZXYuYw0KQEAgLTQyOTMsNiAr NDI5Myw5IEBAIGl4Z2JlX2Rldl9saW5rX3VwZGF0ZV9zaGFyZShzdHJ1Y3QgcnRlX2V0aF9kZXYg KmRldiwNCmludCB3YWl0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XhnYmVfZXRoZGV2LmMgfCAzICsrKw0KMSBmaWxlIGNoYW5nZWQsIDMg aW5zZXJ0aW9ucygrKQ0KDQpkaWZmIC0tZ2l0IGEvZHJpdmVycy9uZXQvaXhnYmUvaXhnYmVfZXRo ZGV2LmMgYi9kcml2ZXJzL25ldC9peGdiZS9peGdiZV9ldGhkZXYuYw0KaW5kZXggYzYxYzUyYjI5 NjZiLi44NmNjYmRkNzgyOTIgMTAwNjQ0DQotLS0gYS9kcml2ZXJzL25ldC9peGdiZS9peGdiZV9l dGhkZXYuYw0KKysrIGIvZHJpdmVycy9uZXQvaXhnYmUvaXhnYmVfZXRoZGV2LmMNCkBAIC00Mjkz LDYgKzQyOTMsOSBAQCBpeGdiZV9kZXZfbGlua191cGRhdGVfc2hhcmUoc3RydWN0IHJ0ZV9ldGhf ZGV2ICpkZXYsDQppbnQgd2FpdCA9IDE7DQp1MzIgZXNkcF9yZWc7DQorIGlmIChydGVfZWFsX3By b2Nlc3NfdHlwZSgpICE9IFJURV9QUk9DX1BSSU1BUlkpDQorIHJldHVybiAtMTsNCisNCm1lbXNl dCgmbGluaywgMCwgc2l6ZW9mKGxpbmspKTsNCmxpbmsubGlua19zdGF0dXMgPSBSVEVfRVRIX0xJ TktfRE9XTjsNCmxpbmsubGlua19zcGVlZCA9IFJURV9FVEhfU1BFRURfTlVNX05PTkU7DQotLSAN CjIuNDMuMA== ------=_001_NextPart568011621506_=---- Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable =EF=BB=BF
I=20 tried this modification and it works as well.
 
junwang01@cestc.cn
 
Date: 2024-03-21 01:33
To: dev
CC: junwang01; = Stephen Hemminger
Subject: [PATCH] net/ixgbe: do not update link status in=20 secondary process
The code to update link status is not safe in secondary process.
If called from secondary it will crash, example from dumpcap:
ixgbe_dev_link_update_share()
ixgbe_dev_link_update()
rte_eth_link_get()
 
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reported-by: Jun Wang <junwang01@cestc.cn>
---
Simpler version of earlier patch, and add explanation.
 
drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c=20 b/drivers/net/ixgbe/ixgbe_ethdev.c
index c61c52b2966b..86ccbdd78292 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4293,6 +4293,9 @@ ixgbe_dev_link_update_share(struct rte_eth_dev=20 *dev,
int wait =3D 1;
u32 esdp_reg;
+ if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY)
+ return -1;
+
memset(&link, 0, sizeof(link));
link.link_status =3D RTE_ETH_LINK_DOWN;
link.link_speed =3D RTE_ETH_SPEED_NUM_NONE;
--
2.43.0
 
 
 
------=_001_NextPart568011621506_=------