From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5D2A1A034F; Tue, 11 Jan 2022 14:41:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 512504270F; Tue, 11 Jan 2022 14:41:55 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id F1B1941143; Tue, 11 Jan 2022 14:41:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641908513; x=1673444513; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uLS6kz0NEeD9xqA2Bpcqnu94bW5O2uph9CG6Q8zn5b4=; b=AUidnZoDrdH9TTh/N4/w05XXJPIBI/6B9t7vgTe+JaWL5qAsQF3hbxFa VUF3lK6yXHvmtvyiY9bQHA+tLBsT8CqE3T5iOWwgvM0ANtbKo87k2rrtB 7LIOmNGrEHLauusRgZFBGZ/MIS2EIVjjZ4pkpDJeUZH9TXxI13uOkQCrZ 0nZEayGo6w9TTz6G16jq72NFfDDlj4S2bHwLarp68LcRZgNYLXt7sIBmQ sEMv5SldKhB4lUZ1SvppBtfU+OBC1taBYUmBhEZNYoc8S0IVi0RvtqcI7 9q7wncR0UvH2H6D4ESEu0f3FzHhN+k7ih9Ldjfae87zzUEkOyrPlF9G+g Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10223"; a="306836040" X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="306836040" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2022 05:41:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="690997178" Received: from silpixa00399126.ir.intel.com ([10.237.223.86]) by orsmga005.jf.intel.com with ESMTP; 11 Jan 2022 05:41:50 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , stable@dpdk.org, Kevin Laatz , Radu Nicolau Subject: [PATCH v2 2/4] dma/idxd: fix paths to driver sysfs directory Date: Tue, 11 Jan 2022 13:41:03 +0000 Message-Id: <20220111134105.1007191-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220111134105.1007191-1-bruce.richardson@intel.com> References: <20211220170514.736732-1-bruce.richardson@intel.com> <20220111134105.1007191-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Recent kernel changes[1][2] mean that we cannot guarantee that the paths in sysfs used for creating/binding a DSA or workqueue instance will be as given in the utility script, since they are now "compatibility-mode only". Update script to support both new paths and compatibility ones. [1] https://lore.kernel.org/all/162637445139.744545.6008938867943724701.stgit@djiang5-desk3.ch.intel.com/ [2] https://lore.kernel.org/all/162637468705.744545.4399080971745974435.stgit@djiang5-desk3.ch.intel.com/ Fixes: 01863b9d2354 ("raw/ioat: include example configuration script") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- drivers/dma/idxd/dpdk_idxd_cfg.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/dma/idxd/dpdk_idxd_cfg.py b/drivers/dma/idxd/dpdk_idxd_cfg.py index fcc27822ef..34537cb980 100755 --- a/drivers/dma/idxd/dpdk_idxd_cfg.py +++ b/drivers/dma/idxd/dpdk_idxd_cfg.py @@ -29,9 +29,17 @@ def write_values(self, values): f.write(str(contents)) +def get_drv_dir(dtype): + "Get the sysfs path for the driver, either 'idxd' or 'user'" + drv_dir = "/sys/bus/dsa/drivers/" + dtype + if not os.path.exists(drv_dir): + return "/sys/bus/dsa/drivers/dsa" + return drv_dir + + def reset_device(dsa_id): "Reset the DSA device and all its queues" - drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa") + drv_dir = SysfsDir(get_drv_dir("idxd")) drv_dir.write_values({"unbind": f"dsa{dsa_id}"}) @@ -58,7 +66,6 @@ def get_dsa_id(pci): def configure_dsa(dsa_id, queues, prefix): "Configure the DSA instance with appropriate number of queues" dsa_dir = SysfsDir(f"/sys/bus/dsa/devices/dsa{dsa_id}") - drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa") max_groups = dsa_dir.read_int("max_groups") max_engines = dsa_dir.read_int("max_engines") @@ -85,9 +92,12 @@ def configure_dsa(dsa_id, queues, prefix): "size": int(max_work_queues_size / nb_queues)}) # enable device and then queues - drv_dir.write_values({"bind": f"dsa{dsa_id}"}) + idxd_dir = SysfsDir(get_drv_dir("idxd")) + idxd_dir.write_values({"bind": f"dsa{dsa_id}"}) + + user_dir = SysfsDir(get_drv_dir("user")) for q in range(nb_queues): - drv_dir.write_values({"bind": f"wq{dsa_id}.{q}"}) + user_dir.write_values({"bind": f"wq{dsa_id}.{q}"}) def main(args): -- 2.32.0