From patchwork Mon May 21 11:48:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 917560 X-Patchwork-Delegate: akodanev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="j1ERMODx"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40qGyd1P8Kz9s33 for ; Mon, 21 May 2018 21:39:21 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 97A253E63D7 for ; Mon, 21 May 2018 13:39:17 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id 667573E640A for ; Mon, 21 May 2018 13:39:04 +0200 (CEST) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 98A95600A5D for ; Mon, 21 May 2018 13:39:03 +0200 (CEST) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4LBUliL014794 for ; Mon, 21 May 2018 11:39:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=24eggk8qnHBF6+2WdBeVZgod+Vz5KyeB68p355lfK5U=; b=j1ERMODx+6oRphI1pp4SpP1mBkIisgeVPDF1wugz6WFgycT3w26M803X9u9y9fJYblfU 3MlgvspvQWe87b4nu2tYEZwTSo8pO7un0RaCpG89qO3jfaMeRndCG0owom9L3B4Bp0Aq L3R/v7D+5IHnrXJKEVPViHTWHc8wIVIIk5mA06UZk6gqxOn34h5Z4NnulVQK06YVjwTv DPHE4dfqxD7tXEK4JA+i/BwQHHNdk1asAHqz0Bf/MuYLzyMnOG0BQMtoS4pBgIU54bdU KJn9GVik9hRgnUFfVLN7hVVdgWVPMvxSVBd0ZkzDtI47OTaMPa2i6MrjH5i/9D8vEJqw iA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2j2bw83tua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 May 2018 11:39:02 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4LBd16N028529 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 May 2018 11:39:01 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4LBd1Z9011960 for ; Mon, 21 May 2018 11:39:01 GMT Received: from ak.ru.oracle.com (/10.162.80.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 May 2018 04:39:01 -0700 From: Alexey Kodanev To: ltp@lists.linux.it Date: Mon, 21 May 2018 14:48:28 +0300 Message-Id: <1526903310-2833-5-git-send-email-alexey.kodanev@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1526903310-2833-1-git-send-email-alexey.kodanev@oracle.com> References: <1526903310-2833-1-git-send-email-alexey.kodanev@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8899 signatures=668700 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=378 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805210139 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH 4/6] network/tcp_cc/lib: add a function to set qdisc and txqueuelen X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev Acked-by: Petr Vorel Acked-by: Petr Vorel --- testcases/network/tcp_cc/tcp_cc_lib.sh | 34 ++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/testcases/network/tcp_cc/tcp_cc_lib.sh b/testcases/network/tcp_cc/tcp_cc_lib.sh index b96c8af..7e93e1d 100755 --- a/testcases/network/tcp_cc/tcp_cc_lib.sh +++ b/testcases/network/tcp_cc/tcp_cc_lib.sh @@ -9,6 +9,8 @@ TST_NEEDS_CMDS="sysctl tc" . tst_net.sh def_alg="cubic" +prev_qlen= +prev_queue= prev_alg= set_cong_alg() @@ -21,8 +23,16 @@ set_cong_alg() tcp_cc_cleanup() { + local rmt_dev="dev $(tst_iface rhost)" + [ "$prev_cong_ctl" ] && \ tst_set_sysctl net.ipv4.tcp_congestion_control $prev_alg + + [ "$prev_qlen" ] && \ + tst_rhost_run -c "ip li set txqueuelen $prev_qlen $rmt_dev" + + [ "$prev_queue" ] && \ + tst_rhost_run -c "tc qdisc replace $rmt_dev root $prev_queue" } tcp_cc_setup() @@ -30,6 +40,30 @@ tcp_cc_setup() prev_alg="$(sysctl -n net.ipv4.tcp_congestion_control)" } +qdisc_list="pfifo_fast codel pfifo fq hfsc hhf htb pie prio sfb sfq" + +tcp_cc_set_qdisc() +{ + local qdisc="$1" + local qlen="${2:-1000}" + local cmd="tc qdisc replace" + local rmt_dev="$(tst_iface rhost)" + + tst_res TINFO "set qdisc on $(tst_iface rhost) to $qdisc len $qlen" + + [ -z "$prev_qlen" ] && \ + prev_qlen=$(tst_rhost_run -s -c \ + "cat /sys/class/net/$rmt_dev/tx_queue_len") + + [ -z "$prev_queue" ] && \ + prev_queue=$(tst_rhost_run -s -c \ + "tc qdisc show dev $rmt_dev | head -1" | \ + cut -f2 -d' ') + + tst_rhost_run -s -c "ip li set txqueuelen $qlen dev $rmt_dev" + tst_rhost_run -s -c "$cmd dev $rmt_dev root $qdisc" +} + tcp_cc_test01() { local alg=$1