On 11/15/2017 09:59 AM, Jakub Kicinski wrote:
> On Tue, 14 Nov 2017 17:18:43 +0100, Jiri Pirko wrote:
>> From: Arkadi Sharshevsky <[email protected]>
>>
>> Add support for hardware resource abstraction over devlink. Each resource
>> is identified via id, furthermore it contains information regarding its
>> size and its related sub resources. Each resource can also provide its
>> current occupancy.
>>
>> In some cases the sizes of some resources can be changed, yet for those
>> changes to take place a hot driver reload may be needed. The reload
>> capability will be introduced in the next patch.
>>
>> Signed-off-by: Arkadi Sharshevsky <[email protected]>
>> Signed-off-by: Jiri Pirko <[email protected]>
>> ---
>> include/net/devlink.h | 80 +++++++++++
>> include/uapi/linux/devlink.h | 10 ++
>> net/core/devlink.c | 330
>> +++++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 420 insertions(+)
>>
>> diff --git a/include/net/devlink.h b/include/net/devlink.h
>> index 4d2c6fc..960e80a 100644
>> --- a/include/net/devlink.h
>> +++ b/include/net/devlink.h
>> @@ -224,6 +225,45 @@ struct devlink_dpipe_headers {
>> unsigned int headers_count;
>> };
>>
>> +/**
>> + * struct devlink_resource_ops - resource ops
>> + * @occ_get - get the occupied size
>> + * @size_validate - validate the size of the resource before update, reload
>
> nit:
> @member: is more common and used throughout this file, rather than
> @member -
>
Will fix, thanks for the review.
>> + * is needed for changes to take place
>> + */
>> +struct devlink_resource_ops {
>> + u64 (*occ_get)(struct devlink *devlink);
>> + int (*size_validate)(struct devlink *devlink, u64 size,
>> + struct list_head *resource_list,
>> + struct netlink_ext_ack *extack);
>> +};