Re: [PATCH next v2 0/3] ethtool: Add ethtool_puts()

2023-10-26 Thread Andrew Lunn
> Changes in v2: > - wrap lines better in replacement (thanks Joe, Kees) > - add --fix to checkpatch (thanks Joe) > - clean up checkpatch formatting (thanks Joe, et al.) > - rebase against next Please could you explain the rebase against next? As Vladimir pointed out, all the patches are to driver

Re: [PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-26 Thread Joe Perches
On Thu, 2023-10-26 at 21:56 +, Justin Stitt wrote: > Add some warnings for using ethtool_sprintf() where a simple > ethtool_puts() would suffice. [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -7011,6 +7011,25 @@ sub process { >"Prefer strscp

Re: [PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-26 Thread Vladimir Oltean
On Thu, Oct 26, 2023 at 03:24:54PM -0700, Justin Stitt wrote: > There was some discussion here [1] but AFAICT I need to use EMACS > or configure my vim in a very particular way to get the same formatting > > But yeah, look around line 7000 -- lots of this pattern matching code is > pretty hard to

Re: [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-26 Thread Vladimir Oltean
On Thu, Oct 26, 2023 at 03:09:59PM -0700, Justin Stitt wrote: > Should I undo this? I want my patch against next since it's targeting > some stuff in-flight over there. BUT, I also want ethtool_puts() to be > directly below ethtool_sprintf() in the source code. What to do? (removing everyone excep

Re: [PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-26 Thread Justin Stitt
On Thu, Oct 26, 2023 at 3:12 PM Vladimir Oltean wrote: > > On Thu, Oct 26, 2023 at 09:56:08PM +, Justin Stitt wrote: > > Add some warnings for using ethtool_sprintf() where a simple > > ethtool_puts() would suffice. > > > > The two cases are: > > > > 1) Use ethtool_sprintf() with just two argu

Re: [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-26 Thread Vladimir Oltean
On Thu, Oct 26, 2023 at 03:11:28PM -0700, Justin Stitt wrote: > On Thu, Oct 26, 2023 at 3:09 PM Justin Stitt wrote: > > On Thu, Oct 26, 2023 at 3:02 PM Vladimir Oltean wrote: > > > Maybe this is due to an incorrect rebase conflict resolution, but you > > > shouldn't have touched any of the ethtoo

Re: [PATCH next v2 3/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-26 Thread Vladimir Oltean
On Thu, Oct 26, 2023 at 09:56:09PM +, Justin Stitt wrote: > This patch converts some basic cases of ethtool_sprintf() to > ethtool_puts(). > > The conversions are used in cases where ethtool_sprintf() was being used > with just two arguments: > | ethtool_sprintf(&data, buffer[i].name); >

Re: [PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-26 Thread Vladimir Oltean
On Thu, Oct 26, 2023 at 09:56:08PM +, Justin Stitt wrote: > Add some warnings for using ethtool_sprintf() where a simple > ethtool_puts() would suffice. > > The two cases are: > > 1) Use ethtool_sprintf() with just two arguments: > | ethtool_sprintf(&data, driver[i].name); > or > 2) Use

Re: [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-26 Thread Justin Stitt
On Thu, Oct 26, 2023 at 3:09 PM Justin Stitt wrote: > > On Thu, Oct 26, 2023 at 3:02 PM Vladimir Oltean wrote: > > > > Hi Justin, > > > > On Thu, Oct 26, 2023 at 09:56:07PM +, Justin Stitt wrote: > > > Use strscpy() to implement ethtool_puts(). > > > > > > Functionally the same as ethtool_spr

Re: [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-26 Thread Justin Stitt
On Thu, Oct 26, 2023 at 3:02 PM Vladimir Oltean wrote: > > Hi Justin, > > On Thu, Oct 26, 2023 at 09:56:07PM +, Justin Stitt wrote: > > Use strscpy() to implement ethtool_puts(). > > > > Functionally the same as ethtool_sprintf() when it's used with two > > arguments or with just "%s" format s

Re: [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-26 Thread Vladimir Oltean
Hi Justin, On Thu, Oct 26, 2023 at 09:56:07PM +, Justin Stitt wrote: > Use strscpy() to implement ethtool_puts(). > > Functionally the same as ethtool_sprintf() when it's used with two > arguments or with just "%s" format specifier. > > Signed-off-by: Justin Stitt > --- > include/linux/eth

[PATCH next v2 3/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-26 Thread Justin Stitt
This patch converts some basic cases of ethtool_sprintf() to ethtool_puts(). The conversions are used in cases where ethtool_sprintf() was being used with just two arguments: | ethtool_sprintf(&data, buffer[i].name); or when it's used with format string: "%s" | ethtool_sprintf(&data, "

[PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-26 Thread Justin Stitt
Use strscpy() to implement ethtool_puts(). Functionally the same as ethtool_sprintf() when it's used with two arguments or with just "%s" format specifier. Signed-off-by: Justin Stitt --- include/linux/ethtool.h | 34 +++--- net/ethtool/ioctl.c | 7 +++ 2 fi

[PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-26 Thread Justin Stitt
Add some warnings for using ethtool_sprintf() where a simple ethtool_puts() would suffice. The two cases are: 1) Use ethtool_sprintf() with just two arguments: | ethtool_sprintf(&data, driver[i].name); or 2) Use ethtool_sprintf() with a standalone "%s" fmt string: | ethtool_sprintf(&d

[PATCH next v2 0/3] ethtool: Add ethtool_puts()

2023-10-26 Thread Justin Stitt
Hi, This series aims to implement ethtool_puts() and send out a wave 1 of conversions from ethtool_sprintf(). There's also a checkpatch patch included to check for the cases listed below. This was sparked from recent discussion here [1] The conversions are used in cases where ethtool_sprintf() w

[PATCH net,v2] hv_netvsc: fix race of netvsc and VF register_netdevice

2023-10-26 Thread Haiyang Zhang
The rtnl lock also needs to be held before rndis_filter_device_add() which advertises nvsp_2_vsc_capability / sriov bit, and triggers VF NIC offering and registering. If VF NIC finished register_netdev() earlier it may cause name based config failure. To fix this issue, move the call to rtnl_lock(

RE: [PATCH] hv_netvsc: Mark VF as slave before exposing it to user-mode

2023-10-26 Thread Long Li
> Subject: Re: [PATCH] hv_netvsc: Mark VF as slave before exposing it to > user-mode > > On Wed, 25 Oct 2023 15:50:50 -0700 > lon...@linuxonhyperv.com wrote: > > > @@ -2347,6 +2342,12 @@ static int netvsc_register_vf(struct net_device > *vf_netdev) > > if (!ndev) > > return NOTIF

RE: [PATCH] hv_netvsc: Mark VF as slave before exposing it to user-mode

2023-10-26 Thread Long Li
> Subject: Re: [PATCH] hv_netvsc: Mark VF as slave before exposing it to > user-mode > > On Wed, 25 Oct 2023 15:50:50 -0700 > lon...@linuxonhyperv.com wrote: > > > list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { > > ndev = hv_get_drvdata(ndev_ctx->device_ctx); > > -

Re: [PATCH 0/3] ethtool: Add ethtool_puts()

2023-10-26 Thread Joe Perches
On Thu, 2023-10-26 at 10:49 -0700, Kees Cook wrote: > On Thu, Oct 26, 2023 at 09:33:17AM -0700, Joe Perches wrote: > > On Thu, 2023-10-26 at 08:47 -0700, Kees Cook wrote: > > > On Wed, Oct 25, 2023 at 11:40:31PM +, Justin Stitt wrote: > > > > @replace_2_args@ > > > > identifier BUF; > > > > exp

Re: [PATCH 0/3] ethtool: Add ethtool_puts()

2023-10-26 Thread Kees Cook
On Thu, Oct 26, 2023 at 09:33:17AM -0700, Joe Perches wrote: > On Thu, 2023-10-26 at 08:47 -0700, Kees Cook wrote: > > On Wed, Oct 25, 2023 at 11:40:31PM +, Justin Stitt wrote: > > > @replace_2_args@ > > > identifier BUF; > > > expression VAR; > > > @@ > > > > > > - ethtool_sprintf > > >

Re: [PATCH 3/3] checkpatch: add ethtool_sprintf rules

2023-10-26 Thread Joe Perches
On Wed, 2023-10-25 at 23:40 +, Justin Stitt wrote: > Add some warnings for using ethtool_sprintf() where a simple > ethtool_puts() would suffice. Hi again Justin. After I read patch 1/3 I don't object at all. spatch/cocci will always be a better option than checkpatch for conversions like th

Re: [PATCH] hv_netvsc: Mark VF as slave before exposing it to user-mode

2023-10-26 Thread Stephen Hemminger
On Wed, 25 Oct 2023 15:50:50 -0700 lon...@linuxonhyperv.com wrote: > @@ -2347,6 +2342,12 @@ static int netvsc_register_vf(struct net_device > *vf_netdev) > if (!ndev) > return NOTIFY_DONE; > > + if (event == NETDEV_POST_INIT) { > + /* set slave flag before op

Re: [PATCH] hv_netvsc: Mark VF as slave before exposing it to user-mode

2023-10-26 Thread Stephen Hemminger
On Wed, 25 Oct 2023 15:50:50 -0700 lon...@linuxonhyperv.com wrote: > list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { > ndev = hv_get_drvdata(ndev_ctx->device_ctx); > - if (ether_addr_equal(vf_netdev->perm_addr, ndev->perm_addr)) { > - net

Re: [PATCH 0/3] ethtool: Add ethtool_puts()

2023-10-26 Thread Joe Perches
On Thu, 2023-10-26 at 08:47 -0700, Kees Cook wrote: > On Wed, Oct 25, 2023 at 11:40:31PM +, Justin Stitt wrote: > > @replace_2_args@ > > identifier BUF; > > expression VAR; > > @@ > > > > - ethtool_sprintf > > + ethtool_puts > > (&BUF, VAR) > > I think cocci will do a bett

Re: [PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-26 Thread Nelson, Shannon
On 10/25/2023 4:40 PM, Justin Stitt wrote: This patch converts some basic cases of ethtool_sprintf() to ethtool_puts(). The conversions are used in cases where ethtool_sprintf() was being used with just two arguments: | ethtool_sprintf(&data, buffer[i].name); or when it's used with format

Re: [PATCH 0/3] ethtool: Add ethtool_puts()

2023-10-26 Thread Kees Cook
On Wed, Oct 25, 2023 at 11:40:31PM +, Justin Stitt wrote: > @replace_2_args@ > identifier BUF; > expression VAR; > @@ > > - ethtool_sprintf > + ethtool_puts > (&BUF, VAR) I think cocci will do a better job at line folding if we adjust this rule like I had to adjust the nex

Re: [PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-26 Thread Joe Perches
On Thu, 2023-10-26 at 16:48 +0200, Louis Peens wrote: > On Wed, Oct 25, 2023 at 11:40:33PM +, Justin Stitt wrote: > > This patch converts some basic cases of ethtool_sprintf() to > > ethtool_puts(). [30k of quoted content] > Thanks Justin. From my perspective the series looks good, though I'v

RE: [PATCH net] hv_netvsc: fix race of netvsc and VF register_netdevice

2023-10-26 Thread Haiyang Zhang
> -Original Message- > From: Wojciech Drewek > Sent: Thursday, October 26, 2023 6:48 AM > To: Haiyang Zhang ; linux-hyperv@vger.kernel.org; > net...@vger.kernel.org > Cc: KY Srinivasan ; wei@kernel.org; Dexuan Cui > ; eduma...@google.com; k...@kernel.org; > pab...@redhat.com; da...@

Re: [PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-26 Thread Louis Peens
On Wed, Oct 25, 2023 at 11:40:33PM +, Justin Stitt wrote: > This patch converts some basic cases of ethtool_sprintf() to > ethtool_puts(). > > The conversions are used in cases where ethtool_sprintf() was being used > with just two arguments: > | ethtool_sprintf(&data, buffer[i].name); >

Re: [PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-26 Thread Jakub Kicinski
On Thu, 26 Oct 2023 11:23:37 +0200 Przemek Kitszel wrote: > this would now fit into one line > (perhaps it's the same in other cases, I just checked this one manually) I think cocci would fold lines automatically? Could be worth trying spatch to do the conversion for that reason, if you aren't alr

Re: [PATCH net] hv_netvsc: fix race of netvsc and VF register_netdevice

2023-10-26 Thread Wojciech Drewek
On 25.10.2023 23:16, Haiyang Zhang wrote: > The rtnl lock also needs to be held before rndis_filter_device_add() > which advertises nvsp_2_vsc_capability / sriov bit, and triggers > VF NIC offering and registering. If VF NIC finished register_netdev() > earlier it may cause name based config fai

RE: [PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-26 Thread Kiyanovski, Arthur
> -Original Message- > From: Przemek Kitszel > Sent: Thursday, October 26, 2023 12:24 PM > To: Justin Stitt ; David S. Miller > ; Eric Dumazet ; Jakub > Kicinski ; Paolo Abeni ; Agroskin, Shay > ; Kiyanovski, Arthur ; Arinzon, > David ; Dagan, Noam ; > Bshara, Saeed ; Rasesh Mody ; > Sudar

Re: [PATCH 3/3] checkpatch: add ethtool_sprintf rules

2023-10-26 Thread Przemek Kitszel
On 10/26/23 01:40, Justin Stitt wrote: Add some warnings for using ethtool_sprintf() where a simple ethtool_puts() would suffice. The two cases are: 1) Use ethtool_sprintf() with just two arguments: | ethtool_sprintf(&data, driver[i].name); or 2) Use ethtool_sprintf() with a standalone "%

Re: [PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-26 Thread Przemek Kitszel
On 10/26/23 01:40, Justin Stitt wrote: This patch converts some basic cases of ethtool_sprintf() to ethtool_puts(). The conversions are used in cases where ethtool_sprintf() was being used with just two arguments: | ethtool_sprintf(&data, buffer[i].name); or when it's used with format stri