From: Joe Perches <joe@perches.com>
To: Mike Ximing Chen <mike.ximing.chen@intel.com>,
linux-kernel@vger.kernel.org
Cc: arnd@arndb.de, gregkh@linuxfoundation.org,
dan.j.williams@intel.com, pierre-louis.bossart@linux.intel.com,
netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org
Subject: Re: [RFC PATCH v12 17/17] dlb: add basic sysfs interfaces
Date: Mon, 20 Dec 2021 23:20:21 -0800 [thread overview]
Message-ID: <4c0ec417457a16fd437f39e9b6d5bd7057aef028.camel@perches.com> (raw)
In-Reply-To: <20211221065047.290182-18-mike.ximing.chen@intel.com>
On Tue, 2021-12-21 at 00:50 -0600, Mike Ximing Chen wrote:
> The dlb sysfs interfaces include files for reading the total and
> available device resources, and reading the device ID and version. The
> interfaces are used for device level configurations and resource
> inquiries.
[]
> diff --git a/drivers/misc/dlb/dlb_args.h b/drivers/misc/dlb/dlb_args.h
[]
> @@ -58,6 +58,40 @@ struct dlb_create_sched_domain_args {
> __u32 num_dir_credits;
> };
>
> +/*
> + * dlb_get_num_resources_args: Used to get the number of available resources
> + * (queues, ports, etc.) that this device owns.
> + *
> + * Output parameters:
> + * @response.status: Detailed error code. In certain cases, such as if the
> + * request arg is invalid, the driver won't set status.
> + * @num_domains: Number of available scheduling domains.
> + * @num_ldb_queues: Number of available load-balanced queues.
> + * @num_ldb_ports: Total number of available load-balanced ports.
> + * @num_dir_ports: Number of available directed ports. There is one directed
> + * queue for every directed port.
> + * @num_atomic_inflights: Amount of available temporary atomic QE storage.
> + * @num_hist_list_entries: Amount of history list storage.
> + * @max_contiguous_hist_list_entries: History list storage is allocated in
> + * a contiguous chunk, and this return value is the longest available
> + * contiguous range of history list entries.
> + * @num_ldb_credits: Amount of available load-balanced QE storage.
> + * @num_dir_credits: Amount of available directed QE storage.
> + */
Is this supposed to be kernel-doc format with /** as the comment initiator ?
> +struct dlb_get_num_resources_args {
> + /* Output parameters */
> + struct dlb_cmd_response response;
> + __u32 num_sched_domains;
> + __u32 num_ldb_queues;
> + __u32 num_ldb_ports;
> + __u32 num_dir_ports;
> + __u32 num_atomic_inflights;
> + __u32 num_hist_list_entries;
> + __u32 max_contiguous_hist_list_entries;
> + __u32 num_ldb_credits;
> + __u32 num_dir_credits;
__u32 is used when visible to user-space.
Do these really need to use __u32 and not u32 ?
> diff --git a/drivers/misc/dlb/dlb_pf_ops.c b/drivers/misc/dlb/dlb_pf_ops.c
[]
> @@ -102,3 +102,198 @@ void dlb_pf_init_hardware(struct dlb *dlb)
[]
> +#define DLB_TOTAL_SYSFS_SHOW(name, macro) \
> +static ssize_t total_##name##_show( \
> + struct device *dev, \
> + struct device_attribute *attr, \
> + char *buf) \
> +{ \
> + int val = DLB_MAX_NUM_##macro; \
> + \
> + return scnprintf(buf, PAGE_SIZE, "%d\n", val); \
Use sysfs_emit rather than scnprintf
maybe:
return sysfs_emit(buf, "%u\n", DLB_MAX_NUM_##macro);
> +#define DLB_AVAIL_SYSFS_SHOW(name) \
> +static ssize_t avail_##name##_show( \
> + struct device *dev, \
> + struct device_attribute *attr, \
> + char *buf) \
> +{ \
> + struct dlb *dlb = dev_get_drvdata(dev); \
> + struct dlb_get_num_resources_args arg; \
> + struct dlb_hw *hw = &dlb->hw; \
> + int val; \
u32 val?
> + \
> + mutex_lock(&dlb->resource_mutex); \
> + \
> + val = dlb_hw_get_num_resources(hw, &arg); \
> + \
> + mutex_unlock(&dlb->resource_mutex); \
> + \
> + if (val) \
> + return -1; \
> + \
> + val = arg.name; \
> + \
> + return scnprintf(buf, PAGE_SIZE, "%d\n", val); \
sysfs_emit, etc...
next prev parent reply other threads:[~2021-12-21 7:20 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-21 6:50 [RFC PATCH v12 00/17] dlb: introduce DLB device driver Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 01/17] dlb: add skeleton for DLB driver Mike Ximing Chen
2021-12-21 7:00 ` Joe Perches
2021-12-21 23:22 ` Chen, Mike Ximing
2021-12-22 2:02 ` Joe Perches
2021-12-21 7:12 ` Greg KH
2021-12-21 8:57 ` Greg KH
2021-12-21 14:25 ` Chen, Mike Ximing
2021-12-21 14:42 ` Chen, Mike Ximing
2021-12-21 15:02 ` Greg KH
2021-12-21 14:05 ` Chen, Mike Ximing
2021-12-21 9:53 ` Andrew Lunn
2021-12-21 20:56 ` Chen, Mike Ximing
2021-12-21 21:39 ` Andrew Lunn
2021-12-21 23:05 ` Chen, Mike Ximing
2021-12-22 21:26 ` Andrew Lunn
2021-12-23 5:15 ` Chen, Mike Ximing
2021-12-23 10:22 ` Andrew Lunn
2021-12-27 0:40 ` Chen, Mike Ximing
[not found] ` <20211222194746.3480dea8@hermes.local>
2021-12-23 5:39 ` Dan Williams
2021-12-21 6:50 ` [RFC PATCH v12 02/17] dlb: initialize DLB device Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 03/17] dlb: add resource and device initialization Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 04/17] dlb: add configfs interface and scheduling domain directory Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 05/17] dlb: add scheduling domain configuration Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 06/17] dlb: add domain software reset Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 07/17] dlb: add low-level register reset operations Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 08/17] dlb: add runtime power-management support Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 09/17] dlb: add queue create, reset, get-depth configfs interface Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 10/17] dlb: add register operations for queue management Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 11/17] dlb: add configfs interface to configure ports Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 12/17] dlb: add register operations for port management Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 13/17] dlb: add port mmap support Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 14/17] dlb: add start domain configfs attribute Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 15/17] dlb: add queue map, unmap, and pending unmap Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 16/17] dlb: add static queue map register operations Mike Ximing Chen
2021-12-21 6:50 ` [RFC PATCH v12 17/17] dlb: add basic sysfs interfaces Mike Ximing Chen
2021-12-21 7:20 ` Joe Perches [this message]
2021-12-21 23:18 ` Chen, Mike Ximing
2021-12-21 8:56 ` Greg KH
2021-12-21 14:07 ` Chen, Mike Ximing
2021-12-21 23:34 ` Stephen Hemminger
2021-12-22 4:21 ` Chen, Mike Ximing
2021-12-21 7:09 ` [RFC PATCH v12 00/17] dlb: introduce DLB device driver Greg KH
2021-12-21 14:03 ` Chen, Mike Ximing
2021-12-21 14:31 ` Greg KH
2021-12-21 18:44 ` Dan Williams
2021-12-21 19:57 ` Andrew Lunn
2021-12-22 8:01 ` Christoph Hellwig
2021-12-21 9:40 ` Andrew Lunn
2021-12-22 4:37 ` Chen, Mike Ximing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c0ec417457a16fd437f39e9b6d5bd7057aef028.camel@perches.com \
--to=joe@perches.com \
--cc=arnd@arndb.de \
--cc=dan.j.williams@intel.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.ximing.chen@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®