netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Mengyuan Lou <mengyuanlou@net-swift.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v5 08/10] net: libwx: add eswitch switch api for devlink ops
Date: Mon, 5 Aug 2024 17:43:50 +0100	[thread overview]
Message-ID: <20240805164350.GK2636630@kernel.org> (raw)
In-Reply-To: <5DD6E0A4F173D3D3+20240804124841.71177-9-mengyuanlou@net-swift.com>

On Sun, Aug 04, 2024 at 08:48:39PM +0800, Mengyuan Lou wrote:

Each patch needs a patch description describing not just what is done
but why.

Also, please seed the CC list for patch submissions
using get_maintainer this.patch. I believe that b4
will do that for you.

> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>

...

>  static void wx_devlink_free(void *devlink_ptr)
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_eswitch.c b/drivers/net/ethernet/wangxun/libwx/wx_eswitch.c
> new file mode 100644
> index 000000000000..a426a352bf96
> --- /dev/null
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_eswitch.c
> @@ -0,0 +1,53 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (C) 2019-2021, Intel Corporation. */

Are you sure Intel holds the copyright on this code?

> +
> +#include <linux/pci.h>
> +
> +#include "wx_type.h"
> +#include "wx_eswitch.h"
> +#include "wx_devlink.h"
> +
> +int wx_eswitch_mode_set(struct devlink *devlink, u16 mode,
> +			struct netlink_ext_ack *extack)
> +{
> +	struct wx_dl_priv *dl_priv = devlink_priv(devlink);
> +	struct wx *wx = dl_priv->priv_wx;
> +
> +	if (wx->eswitch_mode == mode)
> +		return 0;
> +
> +	if (wx->num_vfs) {
> +		dev_info(&(wx)->pdev->dev,
> +			 "Change eswitch mode is allowed if there is no VFs.");

maybe: Changing eswitch mode is only allowed if there are no VFs.

> +		return -EOPNOTSUPP;
> +	}
> +
> +	switch (mode) {
> +	case DEVLINK_ESWITCH_MODE_LEGACY:
> +		dev_info(&(wx)->pdev->dev,
> +			 "PF%d changed eswitch mode to legacy",
> +			 wx->bus.func);
> +		NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to legacy");
> +		break;
> +	case DEVLINK_ESWITCH_MODE_SWITCHDEV:
> +		dev_info(&(wx)->pdev->dev,
> +			 "Do not support switchdev in eswitch mode.");
> +		NL_SET_ERR_MSG_MOD(extack, "Do not support switchdev mode.");

maybe: eswitch mode switchdev is not supported

I am curious to know if you are planning to implement eswitch mode in the
near future.  If not, is wx_eswitch_mode_set() needed: it seems unused in
this patchset: it should probably be added in a patchset that uses it.

> +		return -EINVAL;
> +	default:
> +		NL_SET_ERR_MSG_MOD(extack, "Unknown eswitch mode");
> +		return -EINVAL;
> +	}
> +
> +	wx->eswitch_mode = mode;
> +	return 0;
> +}
> +
> +int wx_eswitch_mode_get(struct devlink *devlink, u16 *mode)
> +{
> +	struct wx_dl_priv *dl_priv = devlink_priv(devlink);
> +	struct wx *wx = dl_priv->priv_wx;
> +
> +	*mode = wx->eswitch_mode;
> +	return 0;
> +}

...

  reply	other threads:[~2024-08-05 16:43 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
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 [this message]
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=20240805164350.GK2636630@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).