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: <20240805164114.GI2636630@kernel.org>
Date: Mon, 5 Aug 2024 17:41:14 +0100
From: Simon Horman <horms@...nel.org>
To: Mengyuan Lou <mengyuanlou@...-swift.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next v5 07/10] net: libwx: allocate devlink for
 devlink port

On Sun, Aug 04, 2024 at 08:48:38PM +0800, Mengyuan Lou wrote:
> Make devlink allocation function generic to use it for PF and for VF.
> 
> Add function for PF/VF devlink port creation. It will be used in
> wangxun NICs.
> 
> Signed-off-by: Mengyuan Lou <mengyuanlou@...-swift.com>

...

> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_devlink.c b/drivers/net/ethernet/wangxun/libwx/wx_devlink.c
> new file mode 100644
> index 000000000000..b39da37c0842
> --- /dev/null
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_devlink.c
> @@ -0,0 +1,208 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2015 - 2024 Beijing WangXun Technology Co., Ltd. */
> +
> +#include <linux/vmalloc.h>
> +#include <linux/pci.h>
> +
> +#include "wx_type.h"
> +#include "wx_sriov.h"
> +#include "wx_devlink.h"
> +
> +static const struct devlink_ops wx_pf_devlink_ops = {
> +};
> +
> +static void wx_devlink_free(void *devlink_ptr)
> +{
> +	devlink_unregister((struct devlink *)devlink_ptr);
> +	devlink_free((struct devlink *)devlink_ptr);
> +}
> +
> +struct wx_dl_priv *wx_create_devlink(struct device *dev)
> +{
> +	struct devlink *devlink;
> +
> +	devlink = devlink_alloc(&wx_pf_devlink_ops, sizeof(devlink), dev);

Perhaps this should be sizeof(wx_dl_priv *) ?

Flagged by Coccinelle.

> +	if (!devlink)
> +		return NULL;
> +
> +	/* Add an action to teardown the devlink when unwinding the driver */
> +	if (devm_add_action_or_reset(dev, wx_devlink_free, devlink))
> +		return NULL;
> +
> +	devlink_register(devlink);
> +
> +	return devlink_priv(devlink);
> +}
> +EXPORT_SYMBOL(wx_create_devlink);

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ