From patchwork Tue May 30 19:08:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 127731 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 00A1542BE6; Tue, 30 May 2023 21:08:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC0E1410EE; Tue, 30 May 2023 21:08:41 +0200 (CEST) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id 3048F410DD for ; Tue, 30 May 2023 21:08:40 +0200 (CEST) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-64d341bdedcso3561722b3a.3 for ; Tue, 30 May 2023 12:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1685473719; x=1688065719; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kJOES0VUdHwZDAEYCqf1WucvGh0e/pACypJ+ZGcruUw=; b=kV2pz49fRZJUV8DA4I93p56OWal03ZB92StrWVJcMDlonvnqgoWj4zxvwhoe//+wfV AzHau6buX+ZfeLROUPVFaTmyhhB3Y0Zt0mdvkLWm6xCPNYADk+aXLJJthWMa0fT/CFiN C0ju0lh35u3TWaCsKQsqYYJXg2AdJ2KXzXz93B0nF2yOy48iUMuT6CYQSW1LzsRhMYCN R4h6SKOdMl4C3NaYBZz4ZUcccMO59us4wwCYxV/l9yyZsToAFM8ZaKkGyWsop60OR0O1 bX9DLKXUPK2jF8DX8TwzGDylR0JkSyZl+eAec++LLO3Z82eHLCGjOPW/GzpSMiqx4qZb x1aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685473719; x=1688065719; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kJOES0VUdHwZDAEYCqf1WucvGh0e/pACypJ+ZGcruUw=; b=BhTRP1tgFgrIslQBf5/2n8cy0ZsU+aLD6ssnjF1Z+NkKh3WtA50luu2EJwOm1UYKaU W+yj/lOKkrRWH5GRHYZXIOYhm9aFzl1IiEqeWf1uNQsGeiFJv9T+unqSvqbmAwVVydqi H8oz4VULhoV9LlbkJsSyp+uz+bcCWqRHJMtgBDW5eS2hsuf9vQv+fYDPm+Vbspwsz2m9 QDz2dzu7Fa9phLk2eEzUs2JbatysOZ3OPS2ruKQcFVWpRWD9UYy/uaMYVPWGRE5HoWw1 eWZL3frEyOPLtx6EqCFXTY+A0rH9CDA1nobMEfiSqQq5tqFrKcd54VTAVTT8HEyx7drP CaAQ== X-Gm-Message-State: AC+VfDxxKAKgzEHCke8sJsQL1SVejaEp2otYHu031ulczKc4J9ekWAve YQgB0PFu7ZQ7XxUcT+N4eD1EDEbIEoFt7HUKPUsxCQ== X-Google-Smtp-Source: ACHHUZ5t0mFZ6JVOvD7LQ+ApCgr+9H5Z5vVJx+dU4YgTD8JKFDtBK8pgyLSfbrnAEebN7AyySYimqA== X-Received: by 2002:a05:6a20:734c:b0:10e:43e:e223 with SMTP id v12-20020a056a20734c00b0010e043ee223mr3900910pzc.1.1685473718950; Tue, 30 May 2023 12:08:38 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id a9-20020aa78649000000b0064f83595bbcsm1968516pfo.58.2023.05.30.12.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 12:08:37 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram Subject: [RFT] graph: fix pcapng file support Date: Tue, 30 May 2023 12:08:34 -0700 Message-Id: <20230530190834.142932-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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 The interface to rte_pcapng changed in last release so that the interfaces used need to be added to the pcapng file via the API. If this step is missing the pcapng file will not be valid and can't be read by wireshark etc. I don't have setup to test graph, so needs a validation test. Fixes: d1da6d0d04c7 ("pcapng: require per-interface information") Signed-off-by: Stephen Hemminger Acked-by: Amit Prakash Shukla --- lib/graph/graph_pcap.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/graph/graph_pcap.c b/lib/graph/graph_pcap.c index 6c433300290b..eff7b2d060ed 100644 --- a/lib/graph/graph_pcap.c +++ b/lib/graph/graph_pcap.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -80,7 +81,8 @@ graph_pcap_default_path_get(char **dir_path) int graph_pcap_file_open(const char *filename) { - int fd; + int fd, ret; + uint16_t portid; char file_name[RTE_GRAPH_PCAP_FILE_SZ]; char *pcap_dir; @@ -114,6 +116,18 @@ graph_pcap_file_open(const char *filename) return -1; } + /* Add the configured interfaces as possible capture ports */ + RTE_ETH_FOREACH_DEV(portid) { + ret = rte_pcapng_add_interface(pcapng_fd, portid, + NULL, NULL, NULL); + if (ret < 0) { + graph_err("Graph rte_pcapng_add_interface failed: %d", + ret); + close(fd); + return -1; + } + } + done: return 0; }