Re: [PATCH for-next 10/10] IB/hfi1: Rework AIP and VNIC dummy netdev usage

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

 



On Mon, Mar 29, 2021 at 09:54:16AM -0400, dennis.dalessandro@xxxxxxxxxxxxxxxxxxxx wrote:
> From: Mike Marciniszyn <mike.marciniszyn@xxxxxxxxxxxxxxxxxxxx>
> 
> All other users of the dummy netdevice embed the netdev in other
> structures:
> 
> init_dummy_netdev(&mal->dummy_dev);
> init_dummy_netdev(&eth->dummy_dev);
> init_dummy_netdev(&ar->napi_dev);
> init_dummy_netdev(&irq_grp->napi_ndev);
> init_dummy_netdev(&wil->napi_ndev);
> init_dummy_netdev(&trans_pcie->napi_dev);
> init_dummy_netdev(&dev->napi_dev);
> init_dummy_netdev(&bus->mux_dev);
> 
> The AIP and VNIC implementation turns that model inside out and used a
> kfree() to free what appears to be a netdev struct when in reality, it is
> a struct that enbodies the rx state as well as the dummy netdev used to
> support napi_poll across disparate receive contexts.  The relationship is
> infered by the odd allocation:
> 
> 	const int netdev_size = sizeof(*dd->dummy_netdev) +
> 		sizeof(struct hfi1_netdev_priv);
> 	<snip>
> 	dd->dummy_netdev = kcalloc_node(1, netdev_size, GFP_KERNEL, dd->node);
> 
> 
> Correct the issue by:
> - Correctly naming the alloc and free functions
> - Renaming hfi1_netdev_priv to hfi1_netdev_rx
> - Replacing dd dummy_netdev with a netdev_rx pointer
> - Embedding the net_device in hfi1_netdev_rx
> - Moving the init_dummy_netdev to the alloc routine
> - Adjusting wrappers to fit the new model
> 
> Fixes: 6991abcb993c ("IB/hfi1: Add functions to receive accelerated ipoib packets")
> Reviewed-by: Kaike Wan <kaike.wan@xxxxxxxxx>
> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/infiniband/hw/hfi1/chip.c      |   6 +-
>  drivers/infiniband/hw/hfi1/hfi.h       |   4 +-
>  drivers/infiniband/hw/hfi1/init.c      |   2 +-
>  drivers/infiniband/hw/hfi1/netdev.h    |  39 +++-----
>  drivers/infiniband/hw/hfi1/netdev_rx.c | 177 +++++++++++++++++----------------
>  5 files changed, 108 insertions(+), 120 deletions(-)

Applied to for-next

Thanks,
Jason



[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