Re: [PATCH v2] IB/hfi1: allocate dummy net_device dynamically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/13/24 6:33 AM, Breno Leitao wrote:
> struct net_device shouldn't be embedded into any structure, instead,
> the owner should use the priv space to embed their state into net_device.
> 
> 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 hfi1_netdev_rx by converting it
> into a pointer. Then use the leverage alloc_netdev() to allocate the
> net_device object at hfi1_alloc_rx().
> 
> [1] https://lore.kernel.org/all/20240229225910.79e224cf@xxxxxxxxxx/
> 
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> 
> ----
> PS: this diff needs d160c66cda0ac8614 ("net: Do not return value from
> init_dummy_netdev()") in order to apply and build cleanly.
> ---
> Changelog:
> 
> v2:
> 	* Free struct hfi1_netdev_rx allocation if alloc_netdev() fails
> 	* Pass zero as the private size for alloc_netdev().
> 	* Remove wrong reference for iwl in the comments
> ---

Very lightly tested, but interface came up and I could send traffic. Code seems
OK too.

I'd prefer to at least remove the first sentence of the commit message. It makes
it sound like hfi1 was doing something incorrectly when it was using the
interface as it was designed. Instead it should read more like this is an
enhancement.


Regardless, we can call this one acked.


Acked-by: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxxxxxxxxxxxxx>




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux