Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp461810pxb; Thu, 9 Sep 2021 05:08:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOcrXW9MEt6FFIZYJky//ssm8o4lsYUHtKvtkRJJZ/QnceProE+JtLenNFm48BzfJqC7rm X-Received: by 2002:adf:db83:: with SMTP id u3mr3245026wri.363.1631189280590; Thu, 09 Sep 2021 05:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631189280; cv=none; d=google.com; s=arc-20160816; b=TSi9CjR3ue17fwWcx4MQZkrPhtjmIutAQIQPQ03acipFdGViA0Yale1m7pb4/mJuTC nzYoKLr2Gs2mKOc3w/tuK+FSIuxm+V0y8NgJ8WMtmPZC0NutnfND96R1v32sI9QCybxC 4OXu/OLCuYXNEzvPo72eLE1/MfbbG7k9YPg117v6m1kPhKwYA/xdgF9MWtaubitLrMgz 6exz+DYa3wnAjU/ivUvhOEDY0BlLNZF8//qPuZ+IFEIzsmdC16wJKcaCw49EDTalY7IV FXlAAoIjpKY4F31EkhiaZl0GmDqGhh5YWGM2nRK+4a7Hz3phLERmxbEHc+WurP1jiDTZ v6OA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=G/PgwW/EQyPu9zyusIt1he0xn9CpQvoLGkQSrF1ofAE=; b=zzOCttNqWRbIfL1+mypbdPKITiVp1sGyYbQMFDzEjuaNt5uG8EebSQo4tIWSBzNzEC zUQLpyXnSV6hMKfi7MDm9p/7kirfLHfBFpnWJyoSO+r5bvlQ2Co3KxTRIOpEOYs2U1Y7 prgbNGJDOK6e75dTGZkYrgSejProbirSXEpwxpHUq9Ci8v+4VsRK3+WCEzxadS2tSG9H P6T6tEYoNK1J356D10ryvQ6769Hus8q9d7lsySrEWjVU8KQ0MvMR4gt6fC9GhYcSyyz7 ykVsFrKu68hVYA969COEwMECxYQE+bicyj71idoWyn4wLmbGZur0GYEKoV5OfNaaAVUk aUfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PrA+kbop; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck29si1606750edb.350.2021.09.09.05.07.29; Thu, 09 Sep 2021 05:08:00 -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=@kernel.org header.s=k20201202 header.b=PrA+kbop; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240488AbhIIMCr (ORCPT + 99 others); Thu, 9 Sep 2021 08:02:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:34406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343992AbhIIL6d (ORCPT ); Thu, 9 Sep 2021 07:58:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2B6AD611CA; Thu, 9 Sep 2021 11:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187943; bh=YEC4jJ1LBWD3tQ8++dMqLrxnkDQeusqtbuXxD3bYWI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PrA+kbopEdXrOyXCBrLrwDGv06scEIrZ7GjDpx0B/+BBtfPuWvWHdYu+IDEy67gZA I+yRSf0/9f6Ipywuaw/1u29JcFJkLEIl8qeUV5mXNzYxf+tmjMY9pK2AgAc5YzAuUG 29wwSMVl67kL7+bB4jrX+zVqXkEkdIExKw7a2vkd1HjMpsslz8DNAULBLbj+SPwVkX BaImHxa+FfoDaOOgzp9t8PepLriWpktxzFyf+v5UKlq3q/HUcR+dZNY55vHhQ6jdl3 RBeiN/fKc5j53gbLJLa1fpX5+K+GrugDLFdKxrmVL0mvQCNtWAp/+9Ct6Mg1Hyu360 FUaurScIFJz6w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Juhee Kang , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 5.14 213/252] samples: pktgen: fix to print when terminated normally Date: Thu, 9 Sep 2021 07:40:27 -0400 Message-Id: <20210909114106.141462-213-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 ab87de440277..8bf2fdffba16 100755 --- a/samples/pktgen/pktgen_sample03_burst_single_flow.sh +++ b/samples/pktgen/pktgen_sample03_burst_single_flow.sh @@ -85,7 +85,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} @@ -94,11 +94,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