[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250316132204.GB4159220@kernel.org>
Date: Sun, 16 Mar 2025 13:22:04 +0000
From: Simon Horman <horms@...nel.org>
To: Mengyuan Lou <mengyuanlou@...-swift.com>
Cc: netdev@...r.kernel.org, kuba@...nel.org, jiawenwu@...stnetic.com,
duanqiangwen@...-swift.com
Subject: Re: [PATCH net-next v8 2/6] net: libwx: Add sriov api for wangxun
nics
On Sun, Mar 09, 2025 at 11:42:48PM +0800, Mengyuan Lou wrote:
> Implement sriov_configure interface for wangxun nics in libwx.
> Enable VT mode and initialize vf control structure, when sriov
> is enabled. Do not be allowed to disable sriov when vfs are
> assigned.
>
> Signed-off-by: Mengyuan Lou <mengyuanlou@...-swift.com>
...
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_sriov.c b/drivers/net/ethernet/wangxun/libwx/wx_sriov.c
> new file mode 100644
> index 000000000000..2392df341ad1
> --- /dev/null
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_sriov.c
> @@ -0,0 +1,201 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2015 - 2025 Beijing WangXun Technology Co., Ltd. */
> +
> +#include <linux/etherdevice.h>
> +#include <linux/pci.h>
> +
> +#include "wx_type.h"
> +#include "wx_mbx.h"
> +#include "wx_sriov.h"
> +
> +static void wx_vf_configuration(struct pci_dev *pdev, int event_mask)
> +{
> + unsigned int vfn = (event_mask & GENMASK(5, 0));
> + struct wx *wx = pci_get_drvdata(pdev);
> +
> + bool enable = ((event_mask & BIT(31)) != 0);
Sorry to nit-pick, and I'd be happy for this to be addressed as a
follow-up, but I think that it would be nice to:
1. Both use some #defines and FIELD_GET() for the masking above.
2. Use !! in place of != 0
3. Arrange local variable declarations in reverse xmas tree order.
> +
> + if (enable)
> + eth_zero_addr(wx->vfinfo[vfn].vf_mac_addr);
> +}
...
Powered by blists - more mailing lists