From patchwork Mon Nov 11 15:01:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1192971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47BYxM27SYz9sNx for ; Tue, 12 Nov 2019 02:01:42 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 43AF9CDB; Mon, 11 Nov 2019 15:01:41 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 910DACBE for ; Mon, 11 Nov 2019 15:01:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id CD22B12E for ; Mon, 11 Nov 2019 15:01:38 +0000 (UTC) X-Originating-IP: 90.177.210.238 Received: from localhost.localdomain (238.210.broadband10.iol.cz [90.177.210.238]) (Authenticated sender: i.maximets@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 728921C0007; Mon, 11 Nov 2019 15:01:35 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 11 Nov 2019 16:01:29 +0100 Message-Id: <20191111150129.22847-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets , David Marchand Subject: [ovs-dev] [PATCH v3] dpdk: Migrate to the new pdump API. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org DPDK commit 660098d61f57 ("pdump: use generic multi-process channel") switched pdump to use generic DPDK IPC instead of sockets. Old API was deprecated and removed. Updating OVS code accordingly. Signed-off-by: Ilya Maximets Acked-by: David Marchand --- Version 3: * Added note about XDG_RUNTIME_DIR. Version 2: * Removed unneeded deinitialization on error. * Docs updated. Documentation/topics/dpdk/pdump.rst | 13 +++++++------ lib/dpdk.c | 11 +---------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Documentation/topics/dpdk/pdump.rst b/Documentation/topics/dpdk/pdump.rst index 7bd1d3e9f..affd98371 100644 --- a/Documentation/topics/dpdk/pdump.rst +++ b/Documentation/topics/dpdk/pdump.rst @@ -41,8 +41,7 @@ To use pdump, simply launch OVS as usual, then navigate to the ``app/pdump`` directory in DPDK, ``make`` the application and run like so:: $ sudo ./build/app/dpdk-pdump -- \ - --pdump port=0,queue=0,rx-dev=/tmp/pkts.pcap \ - --server-socket-path=/usr/local/var/run/openvswitch + --pdump port=0,queue=0,rx-dev=/tmp/pkts.pcap The above command captures traffic received on queue 0 of port 0 and stores it in ``/tmp/pkts.pcap``. Other combinations of port numbers, queues numbers and @@ -50,11 +49,13 @@ pcap locations are of course also available to use. For example, to capture all packets that traverse port 0 in a single pcap file:: $ sudo ./build/app/dpdk-pdump -- \ - --pdump 'port=0,queue=*,rx-dev=/tmp/pkts.pcap,tx-dev=/tmp/pkts.pcap' \ - --server-socket-path=/usr/local/var/run/openvswitch + --pdump 'port=0,queue=*,rx-dev=/tmp/pkts.pcap,tx-dev=/tmp/pkts.pcap' -``server-socket-path`` must be set to the value of ``ovs_rundir()`` which -typically resolves to ``/usr/local/var/run/openvswitch``. +.. note:: + + ``XDG_RUNTIME_DIR`` environment variable might need to be adjusted to + OVS runtime directory (``/var/run/openvswitch`` in most cases) for + ``dpdk-pdump`` utility if OVS started by non-root user. Many tools are available to view the contents of the pcap file. Once example is tcpdump. Issue the following command to view the contents of ``pkts.pcap``:: diff --git a/lib/dpdk.c b/lib/dpdk.c index f90cda75a..748f63d31 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -27,7 +27,6 @@ #include #include #ifdef DPDK_PDUMP -#include #include #endif @@ -434,17 +433,9 @@ dpdk_init__(const struct smap *ovs_other_config) #ifdef DPDK_PDUMP VLOG_INFO("DPDK pdump packet capture enabled"); - err = rte_pdump_init(ovs_rundir()); + err = rte_pdump_init(); if (err) { VLOG_INFO("Error initialising DPDK pdump"); - rte_pdump_uninit(); - } else { - char *server_socket_path; - - server_socket_path = xasprintf("%s/%s", ovs_rundir(), - "pdump_server_socket"); - fatal_signal_add_file_to_unlink(server_socket_path); - free(server_socket_path); } #endif