From patchwork Mon Sep 12 12:43:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kaur, Arshdeep" X-Patchwork-Id: 116184 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 2B982A0032; Mon, 12 Sep 2022 14:43:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C70E6400D4; Mon, 12 Sep 2022 14:43:16 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 1F78540042 for ; Mon, 12 Sep 2022 14:43:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662986595; x=1694522595; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Taqlbr8/vAZfTa9p45VYLnepLSej2Jy9/4CmETP7P1A=; b=j6UW63UG1yt3A396jL6Bf5jghg5fc28qsDfAlasDTFjqxC4uyWKwMrkj mNSON4r4DzSYOXPZFjY1Z0SWXbZR3h6eP3mXb6DoQmxP4RsuUxJHhYLF8 ct+bZdB+zmrTnlY8oon/qk1IZSBeQN1/Ko+MiqB6RyK1WgR56bKXHgjs6 NjlF5uTqz9DdCsHLRZAWLoxed7rcpOztvNrzJEE7bUDaIWqqeRu0cMnXG Eq5ojGVkDUXACQjXk+m4EWTsfkrwP9gkEJd1XntiX2DdCcl333LyCgRXN CojK9C6y3TFJmqfvobFl2FPV1qNHXej5jRs79Xv0CGo+IN7Ef4akMM/5g A==; X-IronPort-AV: E=McAfee;i="6500,9779,10468"; a="284874852" X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="284874852" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 05:43:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="593479803" Received: from unknown (HELO skx-5gnr-sd6.localdomain) ([10.233.180.92]) by orsmga006.jf.intel.com with ESMTP; 12 Sep 2022 05:43:13 -0700 From: Arshdeep Kaur To: dev@dpdk.org Subject: [PATCH v2] dumpcap: add the mutiprocess fileprefix support. Date: Mon, 12 Sep 2022 05:43:09 -0700 Message-Id: <20220912124309.233363-1-arshdeep.kaur@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220829074821.283063-1-arshdeep.kaur@intel.com> References: <20220829074821.283063-1-arshdeep.kaur@intel.com> 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 New optional parameter "-m " added. It will update the mp_socket path for multiprocess communication. Default : '/var/run/dpdk/rte/mp_socket' Updated : '/var/run/dpdk//mp_socket' Note: Give -m as first argument. Signed-off-by: Arshdeep Kaur --- app/dumpcap/main.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index 8972c45a71..1aa43ad9c1 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -323,7 +323,7 @@ static void parse_opts(int argc, char **argv) int option_index, c; for (;;) { - c = getopt_long(argc, argv, "a:b:c:dDf:ghi:nN:pPqs:vw:", + c = getopt_long(argc, argv, "a:b:c:dDf:ghi:nN:m:pPqs:vw:", long_options, &option_index); if (c == -1) break; @@ -392,6 +392,9 @@ static void parse_opts(int argc, char **argv) case 'v': printf("%s\n", version()); exit(0); + case 'm': + /* Handled before dpdk_init */ + break; default: fprintf(stderr, "Invalid option: %s\n", argv[optind - 1]); @@ -507,10 +510,10 @@ report_packet_stats(dumpcap_out_t out) * typical EAL command line arguments. * We don't want to expose all the DPDK internals to the user. */ -static void dpdk_init(void) +static void dpdk_init(const char * const prefix) { - static const char * const args[] = { - "dumpcap", "--proc-type", "secondary", + const char * const args[] = { + "dumpcap", "--proc-type", "secondary", "--file-prefix", prefix, "--log-level", "notice" }; @@ -787,7 +790,17 @@ int main(int argc, char **argv) progname = argv[0]; parse_opts(argc, argv); - dpdk_init(); + char prefix[256]; + strcpy(prefix, "rte"); + + printf("\nIMP:: Please provide -m file_prefix as first argument in case non-default mp_socket path is to be setup (e.g. ./dpdk-dumpcap -m wls_0)\n\n"); + /* In order to use mp_socket path other than default, give -m as first argument. */ + if (argc >= 3) { + if (strncmp(argv[1], "-m", 2) == 0) + strncpy(prefix, argv[2], sizeof(prefix)); + } + + dpdk_init(prefix); if (filter_str) compile_filter();