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 7148AA00C2; Mon, 2 Jan 2023 17:25:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 422DA40693; Mon, 2 Jan 2023 17:25:29 +0100 (CET) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by mails.dpdk.org (Postfix) with ESMTP id 026D540689 for ; Mon, 2 Jan 2023 17:25:26 +0100 (CET) Received: by mail-qt1-f174.google.com with SMTP id jr11so22724822qtb.7 for ; Mon, 02 Jan 2023 08:25:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=is+q+TG7ppkZD9qvwc7nI3GZkXHXynO4Svqbr8x3NMM=; b=ZBLDiVw6BOj+RLukjyr17R/7f2umOa6Ri+fe/wtiCzFzYz0ojVqMFRnIJxhhJF/3TB 30We8wbNUl9K3X01P05JMz++ACBvx586/WKj/2GVcIzu7+yRLJ3cSRzOL21mRtMG9Ic1 7RSr79hNDQqjutmfhpIsMyNSimO8V7xR5/mXH+XEo7AQ3svA784rv1pn0TkHataMRPOx pDHd10/KZTg7T4S8y63BP7lnZ9Nk//M+iouvwvauVgjt/lJqGhdvnURC6vLpFHvkFNNt jzdzX1KJUjlIyTMB8Tl+2ut8YlZpjAjJXZTguF3liG9RMIRpZRSBlpZq+SF7qbJqqgDT IqVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=is+q+TG7ppkZD9qvwc7nI3GZkXHXynO4Svqbr8x3NMM=; b=sZ5uswcDIOgY0+5+UI5uz/c4MHAAOH5hccp9BMflWoIZ59/CEf5TlnZqlFUkfT1Xzi YnD1vIbRbRdT7KbZ/kZXF5817H05Ita1cWGUTOquUeH980F2xhJwCXdKd13dmxn/pnW3 QrxqKYEjKnO54KWGLsJHIji5tY6W83W4peervRvYmDrGhc/alc7tsCm8B5xUHrZWebzg GSCRCJK/BX4Ki6M2ibMFgTy9s57mtjXB+GkAuvQrGwMdIcx0i2LbWOhcyvUwK2mmKBOk Zca2iF9ueJiHocXmP9uVAkXrxitqOyfD8iJPEsCVwT4T9wlLiyG4GK0ZjkiGtQS/DdR+ q6lA== X-Gm-Message-State: AFqh2kogK6NRkzh4GbISYz8HGhqChdGgQunlq6u9RO2F2w14Oruw7503 LXCvWPCCDuNDuQz4tYCJKvlW8UUYgAQ= X-Google-Smtp-Source: AMrXdXupI9jjurggTOZaYFcbh5JAdl+8EY+LB1vsq8NF5e9x+c4m33nb8xqgd47Od7YXOB5Xti7dfQ== X-Received: by 2002:a05:622a:90e:b0:3a9:7332:3f75 with SMTP id bx14-20020a05622a090e00b003a973323f75mr59119214qtb.47.1672676725900; Mon, 02 Jan 2023 08:25:25 -0800 (PST) Received: from lvdi-01-iad-l.blue.trinitycyber.com ([38.142.224.194]) by smtp.gmail.com with ESMTPSA id u2-20020ac80502000000b003a81eef14efsm17678091qtg.45.2023.01.02.08.25.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jan 2023 08:25:25 -0800 (PST) From: Ben Magistro To: dev@dpdk.org, stephen@networkplumber.org Cc: ben.magistro@trinitycyber.com, Ben Magistro Subject: [PATCH 1/6] app/dumpcap: add additional dump info Date: Mon, 2 Jan 2023 16:24:36 +0000 Message-Id: <20230102162441.6205-1-koncept1@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 change increases the information returned when listing interfaces to include link state and promiscuous mode. Additionally, the information is formatted to be easily consumed by a machine or a person. This change is/was utilized while troubleshooting and developing the subsequent patches to address the issues identified on the mailing list [1]. [1] http://mails.dpdk.org/archives/dev/2022-December/258317.html Signed-off-by: Ben Magistro --- app/dumpcap/main.c | 27 ++++++++++++++++++++++++++- doc/guides/tools/dumpcap.rst | 9 ++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index 2eb8414efa..b9096f050c 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -266,11 +266,36 @@ static void dump_interfaces(void) { char name[RTE_ETH_NAME_MAX_LEN]; uint16_t p; + struct rte_eth_link link_info; + char link_state[8]; + char promisc_mode[9]; + printf("%-4s\t%-40s\t%-8s\t%-12s\n", + "Port", "Name", "Link", "Promiscuous"); RTE_ETH_FOREACH_DEV(p) { if (rte_eth_dev_get_name_by_port(p, name) < 0) continue; - printf("%u. %s\n", p, name); + + if (rte_eth_link_get_nowait(p, &link_info) < 0) { + rte_strscpy(link_state, "Unknown", sizeof(link_state)); + } + else if (link_info.link_status == RTE_ETH_LINK_UP) { + rte_strscpy(link_state, "Up", sizeof(link_state)); + } + else { + rte_strscpy(link_state, "Down", sizeof(link_state)); + } + + // not checking error here; should only error if given an invalid port id + if (rte_eth_promiscuous_get(p) == 1) { + rte_strscpy(promisc_mode, "Enabled", sizeof(promisc_mode)); + } + else { + rte_strscpy(promisc_mode, "Disabled", sizeof(promisc_mode)); + } + + printf("%-4u\t%-40s\t%-8s\t%-12s\n", + p, name, link_state, promisc_mode); } exit(0); diff --git a/doc/guides/tools/dumpcap.rst b/doc/guides/tools/dumpcap.rst index d8a137b1cd..0f89e6c5ca 100644 --- a/doc/guides/tools/dumpcap.rst +++ b/doc/guides/tools/dumpcap.rst @@ -39,7 +39,7 @@ If ``-w`` option is specified, then that file is used. Running the Application ----------------------- -To list interfaces available for capture, use ``--list-interfaces``. +To list interfaces available for capture, use ``-D`` or ``--list-interfaces``. To filter packets in style of *tshark*, use the ``-f`` flag. @@ -52,8 +52,11 @@ Example .. code-block:: console # /app/dpdk-dumpcap --list-interfaces - 0. 000:00:03.0 - 1. 000:00:03.1 + Port Name Link Promiscuous + 0 0000:00:03.0 Up Enabled + 1 0000:00:03.1 Up Disabled + 2 0000:00:03.2 Down Disabled + 3 0000:00:03.3 Down Disabled # /app/dpdk-dumpcap -i 0000:00:03.0 -c 6 -w /tmp/sample.pcapng Packets captured: 6 -- 2.27.0