[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <6B4E9B01-A3CF-4860-8A38-229AC8AA07B5@net-swift.com>
Date: Mon, 17 Mar 2025 14:34:40 +0800
From: "mengyuanlou@...-swift.com" <mengyuanlou@...-swift.com>
To: Simon Horman <horms@...nel.org>
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
> 2025年3月16日 21:22,Simon Horman <horms@...nel.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@...-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?
>
> 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