From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A43D5C2B9F7 for ; Fri, 28 May 2021 13:19:26 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 38CF261183 for ; Fri, 28 May 2021 13:19:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38CF261183 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 27A9E41105; Fri, 28 May 2021 15:19:16 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id DE0AA40040 for ; Fri, 28 May 2021 15:19:12 +0200 (CEST) IronPort-SDR: XnC2+mxl7NOK7Dglrf2iDqHbvZwLivasK+J6xK6QfuUWw4PzykLgM67EbO4CSeikThqsYy7lRG lamhmJPZQBKg== X-IronPort-AV: E=McAfee;i="6200,9189,9997"; a="266840453" X-IronPort-AV: E=Sophos;i="5.83,229,1616482800"; d="scan'208";a="266840453" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2021 06:19:12 -0700 IronPort-SDR: pWPt1syFNKAxKCszAJxl1jS+jL0DaKJjEdLIGfNfpBgxu67wLDUxcyn67fBIDzQ9AygLy3UKrX cn1yJHlMCijQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,229,1616482800"; d="scan'208";a="477925117" Received: from silpixa00401026.ir.intel.com ([10.243.23.108]) by orsmga001.jf.intel.com with ESMTP; 28 May 2021 06:19:11 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, Kevin Laatz Date: Fri, 28 May 2021 14:19:02 +0100 Message-Id: <20210528131902.344423-3-kevin.laatz@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210528131902.344423-1-kevin.laatz@intel.com> References: <20210527132646.3565721-1-kevin.laatz@intel.com> <20210528131902.344423-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/2] raw/ioat: add device reset to python script 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 Sender: "dev" Currently once a device is configured, the user does not have the ability to reset the device via the script. This patch adds a device reset option to the script. For example "$dpdk_idxd_cfg.py 0 --reset" would reset device 0. Signed-off-by: Kevin Laatz --- drivers/raw/ioat/dpdk_idxd_cfg.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/raw/ioat/dpdk_idxd_cfg.py b/drivers/raw/ioat/dpdk_idxd_cfg.py index ad8393a645..138b555040 100755 --- a/drivers/raw/ioat/dpdk_idxd_cfg.py +++ b/drivers/raw/ioat/dpdk_idxd_cfg.py @@ -29,6 +29,12 @@ def write_values(self, values): f.write(str(contents)) +def reset_device(dsa_id): + "Reset the DSA device and all its queues" + drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa") + drv_dir.write_values({"unbind": f"dsa{dsa_id}"}) + + def get_pci_dir(pci): "Search for the sysfs directory of the PCI device" base_dir = '/sys/bus/pci/devices/' @@ -95,11 +101,18 @@ def main(args): arg_p.add_argument('--name-prefix', metavar='prefix', dest='prefix', default="dpdk", help="Prefix for workqueue name to mark for DPDK use [default: 'dpdk']") + arg_p.add_argument('--reset', action='store_true', + help="Reset DSA device and its queues") parsed_args = arg_p.parse_args(args[1:]) dsa_id = parsed_args.dsa_id dsa_id = get_dsa_id(dsa_id) if ':' in dsa_id else dsa_id - configure_dsa(dsa_id, parsed_args.q, parsed_args.prefix) + if parsed_args.reset: + print(f"Resetting DSA instance {dsa_id}") + reset_device(dsa_id) + else: + print(f"Configuring DSA instance {dsa_id}") + configure_dsa(dsa_id, parsed_args.q, parsed_args.prefix) if __name__ == "__main__": -- 2.30.2