lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210115154742.GB2064789@shredder.lan>
Date:   Fri, 15 Jan 2021 17:47:42 +0200
From:   Ido Schimmel <idosch@...sch.org>
To:     Jiri Pirko <jiri@...nulli.us>
Cc:     netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
        jacob.e.keller@...el.com, roopa@...dia.com, mlxsw@...dia.com
Subject: Re: [patch net-next RFC 01/10] devlink: add support to create line
 card and expose to user

On Wed, Jan 13, 2021 at 01:12:13PM +0100, Jiri Pirko wrote:
> diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
> index cf89c318f2ac..e5ed0522591f 100644
> --- a/include/uapi/linux/devlink.h
> +++ b/include/uapi/linux/devlink.h
> @@ -126,6 +126,11 @@ enum devlink_command {
>  
>  	DEVLINK_CMD_HEALTH_REPORTER_TEST,
>  
> +	DEVLINK_CMD_LINECARD_GET,		/* can dump */
> +	DEVLINK_CMD_LINECARD_SET,

Never used (but should)

> +	DEVLINK_CMD_LINECARD_NEW,
> +	DEVLINK_CMD_LINECARD_DEL,
> +
>  	/* add new commands above here */
>  	__DEVLINK_CMD_MAX,
>  	DEVLINK_CMD_MAX = __DEVLINK_CMD_MAX - 1
> @@ -529,6 +534,8 @@ enum devlink_attr {
>  	DEVLINK_ATTR_RELOAD_ACTION_INFO,        /* nested */
>  	DEVLINK_ATTR_RELOAD_ACTION_STATS,       /* nested */
>  
> +	DEVLINK_ATTR_LINECARD_INDEX,		/* u32 */
> +
>  	/* add new attributes above here, update the policy in devlink.c */
>  
>  	__DEVLINK_ATTR_MAX,

[...]

>  
> +/**
> + *	devlink_linecard_register - Register devlink linecard

Does not match function name

> + *
> + *	@devlink: devlink
> + *	@devlink_linecard: devlink linecard
> + *	@linecard_index: driver-specific numerical identifier of the linecard
> + *
> + *	Create devlink linecard instance with provided linecard index.
> + *	Caller can use any indexing, even hw-related one.
> + */
> +struct devlink_linecard *devlink_linecard_create(struct devlink *devlink,
> +						 unsigned int linecard_index)
> +{
> +	struct devlink_linecard *linecard;
> +
> +	mutex_lock(&devlink->lock);
> +	if (devlink_linecard_index_exists(devlink, linecard_index)) {
> +		mutex_unlock(&devlink->lock);
> +		return ERR_PTR(-EEXIST);
> +	}
> +
> +	linecard = kzalloc(sizeof(*linecard), GFP_KERNEL);
> +	if (!linecard)
> +		return ERR_PTR(-ENOMEM);
> +
> +	linecard->devlink = devlink;
> +	linecard->index = linecard_index;
> +	list_add_tail(&linecard->list, &devlink->linecard_list);
> +	mutex_unlock(&devlink->lock);
> +	devlink_linecard_notify(linecard, DEVLINK_CMD_LINECARD_NEW);
> +	return linecard;
> +}
> +EXPORT_SYMBOL_GPL(devlink_linecard_create);
> +
> +/**
> + *	devlink_linecard_destroy - Destroy devlink linecard
> + *
> + *	@devlink_linecard: devlink linecard
> + */
> +void devlink_linecard_destroy(struct devlink_linecard *linecard)
> +{
> +	struct devlink *devlink = linecard->devlink;
> +
> +	devlink_linecard_notify(linecard, DEVLINK_CMD_LINECARD_DEL);
> +	mutex_lock(&devlink->lock);
> +	list_del(&linecard->list);
> +	mutex_unlock(&devlink->lock);
> +}
> +EXPORT_SYMBOL_GPL(devlink_linecard_create);
> +
>  int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
>  			u32 size, u16 ingress_pools_count,
>  			u16 egress_pools_count, u16 ingress_tc_count,
> -- 
> 2.26.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ