DPDK patches and discussions
 help / color / mirror / Atom feed
From: "junwang01@cestc.cn" <junwang01@cestc.cn>
To: "Stephen Hemminger" <stephen@networkplumber.org>,  dev <dev@dpdk.org>
Cc: "Stephen Hemminger" <stephen@networkplumber.org>
Subject: Re: [PATCH] net/ixgbe: do not update link status in secondary process
Date: Thu, 21 Mar 2024 12:39:52 +0800	[thread overview]
Message-ID: <202403211239522709132@cestc.cn> (raw)
In-Reply-To: <20240320173407.216307-1-stephen@networkplumber.org>

[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]

I tried this modification and it works as well.

[root@compute3 /]# /dpdk/app/dpdk-dumpcap -i 0000:18:00.0
File: /tmp/dpdk-dumpcap_0_0000:18:00.0_20240321043451.pcapng
Capturing on '0000:18:00.0'
Packets captured: 499 ^C
Packets received/dropped on interface '0000:18:00.0': 499/0 (100.0)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c 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 *dev,
int wait = 1;
u32 esdp_reg;
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -1;
+
memset(&link, 0, sizeof(link));
link.link_status = RTE_ETH_LINK_DOWN;
link.link_speed = RTE_ETH_SPEED_NUM_NONE;




junwang01@cestc.cn

From: Stephen Hemminger
Date: 2024-03-21 01:33
To: dev
CC: junwang01; Stephen Hemminger
Subject: [PATCH] net/ixgbe: do not update link status in 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 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 *dev,
int wait = 1;
u32 esdp_reg;
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return -1;
+
memset(&link, 0, sizeof(link));
link.link_status = RTE_ETH_LINK_DOWN;
link.link_speed = RTE_ETH_SPEED_NUM_NONE;
-- 
2.43.0

[-- Attachment #2: Type: text/html, Size: 9736 bytes --]

  reply	other threads:[~2024-03-21  4:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19 16:18 [PATCH] net/ixgbe: using dpdk-dumpcap capture packet coredump Jun Wang
2024-03-20 17:33 ` [PATCH] net/ixgbe: do not update link status in secondary process Stephen Hemminger
2024-03-21  4:39   ` junwang01 [this message]
2024-04-04 14:56   ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202403211239522709132@cestc.cn \
    --to=junwang01@cestc.cn \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).