Re: [PATCH net-next] IB/hfi1: allocate dummy net_device dynamically

From: Leon Romanovsky
Date: Mon Mar 11 2024 - 08:17:30 EST


On Mon, Mar 11, 2024 at 08:05:45AM -0400, Dennis Dalessandro wrote:
> On 3/8/24 1:29 PM, 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 iwl_trans_pcie by converting it
> > into a pointer. Then use the leverage alloc_netdev() to allocate the
> > net_device object at iwl_trans_pcie_alloc.
>
> What does an Omni-Path Architecture driver from Cornelis Networks have to do
> with an Intel wireless driver?
>
> > The private data of net_device becomes a pointer for the struct
> > iwl_trans_pcie, so, it is easy to get back to the iwl_trans_pcie parent
> > given the net_device object.
> >
> > [1] https://lore.kernel.org/all/20240229225910.79e224cf@xxxxxxxxxx/
> >
> > Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> > ---
> > drivers/infiniband/hw/hfi1/netdev.h | 2 +-
> > drivers/infiniband/hw/hfi1/netdev_rx.c | 9 +++++++--
> > 2 files changed, 8 insertions(+), 3 deletions(-)

<...>

>
> Leon, please don't accept this until the author resubmits a patch that I either
> Ack or Test.

Sure, I will wait for your response.

Thanks

>
> Thanks
>
> -Denny