From: Simon Horman <horms@kernel.org>
To: Mengyuan Lou <mengyuanlou@net-swift.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v5 07/10] net: libwx: allocate devlink for devlink port
Date: Mon, 5 Aug 2024 17:41:14 +0100 [thread overview]
Message-ID: <20240805164114.GI2636630@kernel.org> (raw)
In-Reply-To: <5CCBD90FF2823C29+20240804124841.71177-8-mengyuanlou@net-swift.com>
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@net-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);
...
next prev parent reply other threads:[~2024-08-05 16:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240804124841.71177-1-mengyuanlou@net-swift.com>
2024-08-04 12:48 ` [PATCH net-next v5 01/10] net: libwx: Add malibox api for wangxun pf drivers Mengyuan Lou
2024-08-05 16:41 ` Simon Horman
2024-08-06 13:20 ` Przemek Kitszel
2024-08-04 12:48 ` [PATCH net-next v5 02/10] net: libwx: Add sriov api for wangxun nics Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 03/10] net: libwx: Redesign flow when sriov is enabled Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 04/10] net: libwx: Add msg task func Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 05/10] net: ngbe: add sriov function support Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 06/10] net: txgbe: " Mengyuan Lou
2024-08-04 12:48 ` [PATCH net-next v5 07/10] net: libwx: allocate devlink for devlink port Mengyuan Lou
2024-08-05 6:40 ` kernel test robot
2024-08-05 16:41 ` Simon Horman [this message]
2024-08-06 11:37 ` Jiri Pirko
2024-08-04 12:48 ` [PATCH net-next v5 08/10] net: libwx: add eswitch switch api for devlink ops Mengyuan Lou
2024-08-05 16:43 ` Simon Horman
2024-08-06 11:42 ` Jiri Pirko
2024-08-07 7:41 ` mengyuanlou
2024-08-07 11:43 ` Jiri Pirko
2024-08-05 17:03 ` kernel test robot
2024-08-04 12:48 ` [PATCH net-next v5 09/10] net: txgbe: add devlink and devlink port created Mengyuan Lou
2024-08-06 7:27 ` kernel test robot
2024-08-04 12:48 ` [PATCH net-next v5 10/10] net: ngbe: " Mengyuan Lou
2024-08-06 11:43 ` Jiri Pirko
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=20240805164114.GI2636630@kernel.org \
--to=horms@kernel.org \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.