Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1684034

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

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] netdevice: add netdev_pub helper function
Date 2017-07-10 10:10 +0200
Message-ID <u1BVv-2uD-1@gated-at.bofh.it> (permalink)
References <pAEGt-R7-1@gated-at.bofh.it> <u1xyy-83Y-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Mon, 10 Jul 2017 05:19:58 +0200

> Being able to utilize this makes code a lot simpler and cleaner. It's
> easier in many cases for drivers to pass around their private data
> structure, while occationally needing to dip into net_device, rather
> than the other way around, which results in tons of calls to netdev_priv
> in the top of every single function, which makes everything confusing
> and less clear. Additionally, this enables a "correct" way of doing such
> a thing, instead of having drivers attempt to reinvent the wheel and
> screw it up.
> 
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

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.

Which is exactly what the ioc3-eth driver ought to be doing.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] netdevice: add netdev_pub helper function "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-07-10 05:30 +0200
  Re: [PATCH 1/2] netdevice: add netdev_pub helper function David Miller <davem@davemloft.net> - 2017-07-10 10:10 +0200
    Re: [PATCH 1/2] netdevice: add netdev_pub helper function "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-07-10 14:00 +0200

csiph-web