[PATCH] ath10k: allocate dummy net_device dynamically

2024-03-19 Thread Breno Leitao
Embedding net_device into structures prohibits the usage of flexible arrays in the net_device structure. For more details, see the discussion at [1]. Un-embed the net_device from struct ath10k by converting it into a pointer. Then use the leverage alloc_netdev() to allocate the net_device object a

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-19 Thread Jeff Johnson
On 3/19/2024 3:47 AM, Breno Leitao wrote: > Embedding net_device into structures prohibits the usage of flexible > arrays in the net_device structure. For more details, see the discussion > at [1]. > > Un-embed the net_device from struct ath10k by converting it > into a pointer. Then use the lever

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-19 Thread Breno Leitao
On Tue, Mar 19, 2024 at 09:05:24AM -0700, Jeff Johnson wrote: > On 3/19/2024 3:47 AM, Breno Leitao wrote: > > @@ -3687,6 +3690,8 @@ struct ath10k *ath10k_core_create(size_t priv_size, > > struct device *dev, > > > > err_free_coredump: > > ath10k_coredump_destroy(ar); > > +err_free_netdev: >

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-19 Thread Jeff Johnson
On 3/19/2024 10:15 AM, Breno Leitao wrote: > On Tue, Mar 19, 2024 at 09:05:24AM -0700, Jeff Johnson wrote: >> On 3/19/2024 3:47 AM, Breno Leitao wrote: >>> @@ -3687,6 +3690,8 @@ struct ath10k *ath10k_core_create(size_t priv_size, >>> struct device *dev, >>> >>> err_free_coredump: >>> ath10k

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-20 Thread Jeff Johnson
On 3/19/2024 3:47 AM, Breno Leitao wrote: > Embedding net_device into structures prohibits the usage of flexible > arrays in the net_device structure. For more details, see the discussion > at [1]. > > Un-embed the net_device from struct ath10k by converting it > into a pointer. Then use the lever

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-20 Thread Kalle Valo
Jeff Johnson writes: > On 3/19/2024 3:47 AM, Breno Leitao wrote: >> Embedding net_device into structures prohibits the usage of flexible >> arrays in the net_device structure. For more details, see the discussion >> at [1]. >> >> Un-embed the net_device from struct ath10k by converting it >> int

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-20 Thread Breno Leitao
On Wed, Mar 20, 2024 at 05:25:52PM +0200, Kalle Valo wrote: > Jeff Johnson writes: > > > On 3/19/2024 3:47 AM, Breno Leitao wrote: > >> Embedding net_device into structures prohibits the usage of flexible > >> arrays in the net_device structure. For more details, see the discussion > >> at [1]. >

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-21 Thread Jakub Kicinski
On Wed, 20 Mar 2024 08:12:46 -0700 Jeff Johnson wrote: > NAK this based upon the ath11k patch results. The ath11 patch is much more complex, I'd wager this one is fine. > As suggested there we should just use kmalloc/kfree to match the existing > logic. Please no. There is no magic here. alloc

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-21 Thread Jeff Johnson
On 3/21/2024 7:28 AM, Jakub Kicinski wrote: > On Wed, 20 Mar 2024 08:12:46 -0700 Jeff Johnson wrote: >> NAK this based upon the ath11k patch results. > > The ath11 patch is much more complex, I'd wager this one is fine. > >> As suggested there we should just use kmalloc/kfree to match the existin

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-21 Thread Jakub Kicinski
On Thu, 21 Mar 2024 15:02:39 -0700 Jeff Johnson wrote: > >> As suggested there we should just use kmalloc/kfree to match the existing > >> logic. > > > > Please no. There is no magic here. alloc + free must match whether > > you're using magic object alloc wrapper (alloc_netdev()) or straight >

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-22 Thread Breno Leitao
Hello Jakub, On Thu, Mar 21, 2024 at 03:17:44PM -0700, Jakub Kicinski wrote: > On Thu, 21 Mar 2024 15:02:39 -0700 Jeff Johnson wrote: > > >> As suggested there we should just use kmalloc/kfree to match the > > >> existing logic. > > > > > > Please no. There is no magic here. alloc + free must

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-22 Thread Jakub Kicinski
On Fri, 22 Mar 2024 07:58:02 -0700 Breno Leitao wrote: > > Looks like init_dummy_netdev wipes the netdev structure clean, so I > > don't think we can use it directly as the setup function, Breno :( > > Before my patch, init_dummy_netdev was being also used. The patch was > basically replacing t

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-27 Thread Breno Leitao
Hello Jakub, On Fri, Mar 22, 2024 at 08:23:36AM -0700, Jakub Kicinski wrote: > > > Maybe we should add a new helper to "alloc dummy netdev" which can > > > call alloc_netdev() with right arguments and do necessary init? > > > > What are the right arguments in this case? > > I'm not sure we hav

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-27 Thread Jakub Kicinski
On Wed, 27 Mar 2024 07:38:05 -0700 Breno Leitao wrote: > -void init_dummy_netdev(struct net_device *dev) > +void init_dummy_netdev_core(struct net_device *dev) Can init_dummy_netdev_core() be a static function (and no export)? alloc_netdev_dummy() is probably going to be the only user. I'd al

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-27 Thread Kalle Valo
Jakub Kicinski writes: > On Fri, 22 Mar 2024 07:58:02 -0700 Breno Leitao wrote: >> > Looks like init_dummy_netdev wipes the netdev structure clean, so I >> > don't think we can use it directly as the setup function, Breno :( >> >> Before my patch, init_dummy_netdev was being also used. The pa

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-27 Thread Jakub Kicinski
On Wed, 27 Mar 2024 08:42:55 -0700 Jeff Johnson wrote: > On 3/27/2024 7:45 AM, Jakub Kicinski wrote: > > On Wed, 27 Mar 2024 07:38:05 -0700 Breno Leitao wrote: > >> -void init_dummy_netdev(struct net_device *dev) > >> +void init_dummy_netdev_core(struct net_device *dev) > > > > Can init_du

Re: [PATCH] ath10k: allocate dummy net_device dynamically

2024-03-27 Thread Jeff Johnson
On 3/27/2024 7:45 AM, Jakub Kicinski wrote: > On Wed, 27 Mar 2024 07:38:05 -0700 Breno Leitao wrote: >> -void init_dummy_netdev(struct net_device *dev) >> +void init_dummy_netdev_core(struct net_device *dev) > > Can init_dummy_netdev_core() be a static function (and no export)? > alloc_netdev_