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 7BA8E42495; Thu, 26 Jan 2023 18:21:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53FD140143; Thu, 26 Jan 2023 18:21:03 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6A65B400D7 for ; Thu, 26 Jan 2023 18:21:01 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id B144F20E658C; Thu, 26 Jan 2023 09:21:00 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B144F20E658C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674753660; bh=xhdRX+uQUhPLxBjODvSTpsrjb0KzvLo+Zkz8K9SVGAU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hfvfs+EtP+cX7Ze/MTeWr3PLTlXXqUgN4L6PeTu9jLkKj01ErrIJ3sSeANQOdxZSG WKcORUiVCKtw43meOEnhpyvkY9YXJVsvILqUAYi8lniLFlJJqHOz6IzrKoBrGJMw9g I1lG6cmUykhQnL6IIT2I5hNIeGM2QM4Ws5vPkl1Q= Date: Thu, 26 Jan 2023 09:21:00 -0800 From: Tyler Retzlaff To: Tomasz Duszynski Cc: Thomas Monjalon , "dev@dpdk.org" , Jerin Jacob Kollanukkaran , "stephen@networkplumber.org" , "chenbo.xia@intel.com" , "david.marchand@redhat.com" , "bruce.richardson@intel.com" Subject: Re: [EXT] Re: [PATCH 1/2] lib: add helper to read strings from sysfs files Message-ID: <20230126172100.GA13258@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20230110234642.1188550-1-tduszynski@marvell.com> <20230125103311.1249988-1-tduszynski@marvell.com> <20230125103311.1249988-2-tduszynski@marvell.com> <73101748.RN2Pgac3cq@thomas> <20230125161606.GA7184@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Thu, Jan 26, 2023 at 08:30:01AM +0000, Tomasz Duszynski wrote: > > >-----Original Message----- > >From: Tyler Retzlaff > >Sent: Wednesday, January 25, 2023 5:16 PM > >To: Thomas Monjalon > >Cc: Tomasz Duszynski ; dev@dpdk.org; Jerin Jacob Kollanukkaran > >; stephen@networkplumber.org; chenbo.xia@intel.com; david.marchand@redhat.com; > >bruce.richardson@intel.com > >Subject: [EXT] Re: [PATCH 1/2] lib: add helper to read strings from sysfs files > > > >External Email > > > >---------------------------------------------------------------------- > >On Wed, Jan 25, 2023 at 11:39:30AM +0100, Thomas Monjalon wrote: > >> 25/01/2023 11:33, Tomasz Duszynski: > >> > Reading strings from sysfs files is a re-occurring pattern hence add > >> > helper for doing that. > >> > >> In general it would be to nice to clean sysfs parsing in libs and > >> drivers, so they all use some functions from EAL. > > > >maybe there should be a general utility library for dealing with sysfs separate from the core EAL > >that drivers / platform specific libs can share? > > reading/writing of sysfs files is scattered around the codebase and this has been piling up > with each and and every new pmd/lib that requires it. So generally a few simple utility functions > in one place may be a good idea. i'm an advocate of smaller libraries that tackle a subject area and do so well. even better if they can be unit tested without dragging in a lot of dependencies or bootstrapping other unrelated subsystems. it is also in alignment with trying to de-bloat eal which i think there is increasing interest in. > > Would following make sense? > > rte_sysfs_write_int() > rte_sysfs_write_string() > rte_sysfs_read_int() > rte_sysfs_read_string() > > Also seems that pattern where file gets opened once and keeps being written to until closed is > reoccurring as well. So there might be some utils for that as well. Thoughts? i guess the answer here is whatever makes a simple intuitive api for sysfs access, i don't contribute much on the linux side to dpdk so can't speak to what makes a good api here, but i imagine others can in review. thanks