From patchwork Sun Apr 29 13:17:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nogah Frankel X-Patchwork-Id: 10370545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2781D60540 for ; Sun, 29 Apr 2018 13:25:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0800F285FF for ; Sun, 29 Apr 2018 13:25:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CAD52892A; Sun, 29 Apr 2018 13:25:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 67EDC2624A for ; Sun, 29 Apr 2018 13:24:49 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40YpLR16ZyzF26D for ; Sun, 29 Apr 2018 23:24:47 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=193.47.165.129; helo=mellanox.co.il; envelope-from=nogahf@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com X-Greylist: delayed 398 seconds by postgrey-1.36 at bilbo; Sun, 29 Apr 2018 23:24:40 AEST Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by lists.ozlabs.org (Postfix) with ESMTP id 40YpLJ3NJWzF267 for ; Sun, 29 Apr 2018 23:24:38 +1000 (AEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from nogahf@mellanox.com) with ESMTPS (AES256-SHA encrypted); 29 Apr 2018 16:19:24 +0300 Received: from dev-r-vrt-156.mtr.labs.mlnx (dev-r-vrt-156.mtr.labs.mlnx [10.212.156.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w3TDHqkP013944; Sun, 29 Apr 2018 16:17:52 +0300 From: Nogah Frankel To: linux-mlxsw@lists.ozlabs.org Subject: [PATCH LNST internal] recipes: switchdev: RedTestLib: Check actual send rate Date: Sun, 29 Apr 2018 16:17:32 +0300 Message-Id: <1525007852-35182-1-git-send-email-nogahf@mellanox.com> X-Mailer: git-send-email 2.4.11 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mlxsw@mellanox.com MIME-Version: 1.0 Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org Sender: "Linux-mlxsw" X-Virus-Scanned: ClamAV using ClamSMTP Check the actual send rate when sending traffic. If it is much lower than the wanted one, fail the test. Note that this fail means that the setup isn't strong enough to run the RED tests, not that they found a problem. Signed-off-by: Nogah Frankel --- recipes/switchdev/RedTestLib.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/recipes/switchdev/RedTestLib.py b/recipes/switchdev/RedTestLib.py index 56fad43..45ac907 100644 --- a/recipes/switchdev/RedTestLib.py +++ b/recipes/switchdev/RedTestLib.py @@ -9,6 +9,7 @@ nogahf@mellanox.com (Nogah Frankel) """ from time import sleep +import datetime import logging from lnst.Controller.Task import ctl @@ -201,8 +202,16 @@ class RedTestLib: if self.router: args["dst"] = self.links[self.egress_port].get_ip() args["dst_mac"] = self.ingress_port.get_hwaddr() + start_time = datetime.datetime.now() self.tl.pktgen(self.links[self.ingress_port], self.links[self.egress_port], pkt_size, **args) + end_time = datetime.datetime.now() + # Approximate rate in mega bits per second + actual_rate = int(pkt_size) * 8./(end_time - start_time).total_seconds() + if actual_rate < self.rate * 0.8: + raise Exception("Actual send rate %d is much lower then asked for %d\n" + "Please run on stronger machine" % (actual_rate, + self.rate)) sleep(3) rx_after = self.ingress_port.link_stats()["rx_packets"]