netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: "mengyuanlou@net-swift.com" <mengyuanlou@net-swift.com>
Cc: netdev@vger.kernel.org, kuba@kernel.org, jiawenwu@trustnetic.com,
	duanqiangwen@net-swift.com
Subject: Re: [PATCH net-next v8 2/6] net: libwx: Add sriov api for wangxun nics
Date: Mon, 17 Mar 2025 17:08:32 +0000	[thread overview]
Message-ID: <20250317170832.GG688833@kernel.org> (raw)
In-Reply-To: <6B4E9B01-A3CF-4860-8A38-229AC8AA07B5@net-swift.com>

On Mon, Mar 17, 2025 at 02:34:40PM +0800, mengyuanlou@net-swift.com wrote:
> 
> 
> > 2025年3月16日 21:22,Simon Horman <horms@kernel.org> 写道:
> > 
> > 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@net-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
> 
> #define VF_ENABLE_CHECK(_m) FIELD_GET(BIT(31), (_m))
> 
> bool enable = !!VF_ENABLE_CHECK(event_mask);
> 
> Is that the way to do it?

Thanks, I think that would work.

> 
> 
> > 
> > 3. Arrange local variable declarations in reverse xmas tree order.
> > 
> 
> 
> 
> >> +
> >> + if (enable)
> >> + eth_zero_addr(wx->vfinfo[vfn].vf_mac_addr);
> >> +}
> > 
> > ...
> > 
> > 
> 

  reply	other threads:[~2025-03-17 17:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-09 15:42 [PATCH net-next v8 0/6] add sriov support for wangxun NICs Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 1/6] net: libwx: Add mailbox api for wangxun pf drivers Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 2/6] net: libwx: Add sriov api for wangxun nics Mengyuan Lou
2025-03-16 13:22   ` Simon Horman
2025-03-17  6:34     ` mengyuanlou
2025-03-17 17:08       ` Simon Horman [this message]
2025-03-18  9:36   ` Jiawen Wu
2025-03-09 15:42 ` [PATCH net-next v8 3/6] net: libwx: Redesign flow when sriov is enabled Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 4/6] net: libwx: Add msg task func Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 5/6] net: ngbe: add sriov function support Mengyuan Lou
2025-03-09 15:42 ` [PATCH net-next v8 6/6] net: txgbe: " Mengyuan Lou

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=20250317170832.GG688833@kernel.org \
    --to=horms@kernel.org \
    --cc=duanqiangwen@net-swift.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=kuba@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).