Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1901176pxb; Thu, 16 Sep 2021 19:37:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3D6rRsmHNlNK527rHrhs/KM39BUGvIOuX+rFqVq09oV/v3aOgsyNa4nNPVwhBtzIKtT/E X-Received: by 2002:a05:6638:14cf:: with SMTP id l15mr6802957jak.8.1631846246181; Thu, 16 Sep 2021 19:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631846246; cv=none; d=google.com; s=arc-20160816; b=lz9Sv+TrN1vVBS8B0oQ0oSlXmbdTEl+wZAPrfyHHLLD1sm1KIA60zA+wg2AoAc9To+ 9nFK5KU4FZYbgSZXq3KRGTR7dK3Gh8qxTPQUeNYEse9S/7OKYTJ4c3NhFbwPdgOLVqSQ vnMDrQPt1D4r8iyXwIf5m3ErWgYup8X4kxiCH4YE6+Ogrc7bUoBDWA9s/EVOALxP+Tca fxIAtZibDqjVdTkbjebn5/uPsLTtfped00StCQvUGvh+w2Qx6tt6ib7tb3ApsgwV39gj pRwGRclbRziSVhcDrbIiuvrQgzv5sVx/gZNfXLgexyLDkFLsih7HrA//YgBCdIbBeIon MI2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qyFQJ25GsVWhB6/B2rhnQtu7kEiCzB95cKo4n2PAiHs=; b=HaVLuo2gBleYdkyJ5vyw8iMXiqqdsZ7VjroWG0fHUwi10J/T+ETO2wTHK4d/mgdG03 ygfLS37wssn8SnWys2d76T7zw61pVzUzhvH+h6QIlJ/QJ5jJmmuKVG6tZJ+D3oqSUEEA PxzON3ffm5Pn0c6WIqBD7O96KpXNego+lK7n1wzs8ov0gZokABHFUorjWbWK/kMhaY+7 iHZWW/yRl28ye1qR3uYdiZ+B+U5+HynijVbT+6tsD+b5iau3pHQz6rJZsjWYdO12UhXc uGkjyvQrWf6yC5x1O5q+aLjVXFsWaw7dmpEjjnp6YFzo9h1vD+mSvu2UgYNJ0lZ1LK2U asZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f70xF9Xq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s63si3691104jaa.30.2021.09.16.19.37.14; Thu, 16 Sep 2021 19:37:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f70xF9Xq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348288AbhIPR2Q (ORCPT + 99 others); Thu, 16 Sep 2021 13:28:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:51642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346977AbhIPQ4o (ORCPT ); Thu, 16 Sep 2021 12:56:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 54EA061ABC; Thu, 16 Sep 2021 16:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809869; bh=w3XAvsaR0o1QNo5DOEbGOAEHTIFUhQqye8XazM8jHMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f70xF9XqYQI9Krd5ptJidyN7YV4An5K5LPiaAbcof3RSmCmUMfGnOUE2BcWPj//a9 Hddc2DbrwpbondRaQ8QeZIFysc2s8YRFiQrjgRKBFWUVOYvA/8j0yYov0h1S6Hq3Df favcNMu8EaCytZn1mOt9gN9jQv6D3bDWmmYnn8c0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juhee Kang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.13 312/380] samples: pktgen: fix to print when terminated normally Date: Thu, 16 Sep 2021 18:01:09 +0200 Message-Id: <20210916155814.675170687@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Juhee Kang [ Upstream commit c0e9422c4e6ca9abd4bd6e1598400c7231eb600b ] Currently, most pktgen samples print the execution result when the program is terminated normally. However, sample03 doesn't work appropriately. This is results of samples: # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample04_many_flows.sh -n 1 Running... ctrl^C to stop Device: eth0@0 Result: OK: 19(c5+d13) usec, 1 (60byte,0frags) 51762pps 24Mb/sec (24845760bps) errors: 0 # DEV=eth0 DEST_IP=10.1.0.1 DST_MAC=00:11:22:33:44:55 ./pktgen_sample03_burst_single_flow.sh -n 1 Running... ctrl^C to stop The reason why it doesn't print the execution result when the program is terminated usually is that sample03 doesn't call the function which prints the result, unlike other samples. So, this commit solves this issue by calling the function before termination. Also, this commit changes control_c function to print_result to maintain consistency with other samples. Signed-off-by: Juhee Kang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- samples/pktgen/pktgen_sample03_burst_single_flow.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/pktgen/pktgen_sample03_burst_single_flow.sh b/samples/pktgen/pktgen_sample03_burst_single_flow.sh index 5adcf954de73..c12198d5bbe5 100755 --- a/samples/pktgen/pktgen_sample03_burst_single_flow.sh +++ b/samples/pktgen/pktgen_sample03_burst_single_flow.sh @@ -83,7 +83,7 @@ for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do done # Run if user hits control-c -function control_c() { +function print_result() { # Print results for ((thread = $F_THREAD; thread <= $L_THREAD; thread++)); do dev=${DEV}@${thread} @@ -92,11 +92,13 @@ function control_c() { done } # trap keyboard interrupt (Ctrl-C) -trap control_c SIGINT +trap true SIGINT if [ -z "$APPEND" ]; then echo "Running... ctrl^C to stop" >&2 pg_ctrl "start" + + print_result else echo "Append mode: config done. Do more or use 'pg_ctrl start' to run" fi -- 2.30.2