Re: [PATCH 1/2] netdevice: add netdev_pub helper function

From: Jason A. Donenfeld
Date: Mon Jul 10 2017 - 07:52:53 EST


On Mon, Jul 10, 2017 at 10:04 AM, David Miller <davem@xxxxxxxxxxxxx> wrote:
> I disagree. Assuming one can go from the driver private to the netdev
> object trivially is a worse assumption than the other way around, and
> locks us into the current implementation of how the netdev and driver
> private memory is allocated.
>
> If you want to style your driver such that the private is passed
> around instead of the netdev, put a pointer back to the netdev object
> in your private data structure.

I'm surprised you're okay with the memory waste of that, but you bring
up the ability to change the interface later, which is a great point.
I'll submit a patch for that random driver, and I'll also refactor
WireGuard to do the same. Thanks for the guidance.

Jason