netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Luis Rodriguez <Luis.Rodriguez@atheros.com>,
	Hauke Mehrtens <hauke@hauke-m.de>,
	David Miller <davem@davemloft.net>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"mcgrof@kernel.org" <mcgrof@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH] compat-wireless: updates for orinoco
Date: Tue, 4 May 2010 18:47:54 -0700	[thread overview]
Message-ID: <z2s43e72e891005041847g6147acfdm1efc8c752dbe94c@mail.gmail.com> (raw)
In-Reply-To: <20100505001830.GO2624@tux>

On Tue, May 4, 2010 at 5:18 PM, Luis R. Rodriguez
<lrodriguez@atheros.com> wrote:
> On Tue, May 04, 2010 at 05:04:09PM -0700, Stephen Hemminger wrote:
>> On Tue, 4 May 2010 16:26:53 -0700
>> "Luis R. Rodriguez" <lrodriguez@atheros.com> wrote:
>>
>> > First of all, thanks a lot! Some comments below.
>> >
>> > On Tue, May 4, 2010 at 3:40 PM, Hauke Mehrtens <hauke@hauke-m.de> wrote:
>> > > * Make all the patches apply again.
>> > > * rename read_pda to avoid conflicts with definitions in kernel <= 2.6.29
>> >
>> > I'm going to apply these two changes, if you get time can you send a
>> > patch to rename read_pda upstream as well, that way we don't have to
>> > carry this?
>> >
>> > > * add orinoco usb
>> >
>> > Thanks for this but I've grown tired of updating these netdev ops and
>> > I think we can do better. I'll add a netdev_attach_ops() which would
>> > simply do all the backport stuff for us, this way for backporting
>> > purposes all we have to do is replace the old lines with a
>> > netdev_attach_ops() call. In fact if we *really* wanted to we could
>> > add a dummy netdev_attach_ops() upstream and just backport that on
>> > older kernels, this would mean 0 line changes to backport a newer
>> > driver.
>> >
>> > Something like this maybe on the generic compat module, it builds for
>> > me, will commit soon.
>> >
>> > /*
>> >  * Expand this as drivers require more ops, for now this
>> >  * only sets the ones we need.
>> >  */
>> > void netdev_attach_ops(struct net_device *dev,
>> >                       const struct net_device_ops *ops)
>> > {
>> > #define SET_NETDEVOP(_op) (_op ? _op : NULL)
>> >        dev->open = SET_NETDEVOP(ops->ndo_open);
>> >        dev->stop = SET_NETDEVOP(ops->ndo_stop);
>> >        dev->hard_start_xmit = SET_NETDEVOP(ops->ndo_start_xmit);
>> >        dev->set_multicast_list = SET_NETDEVOP(ops->ndo_set_multicast_list);
>> >        dev->change_mtu = SET_NETDEVOP(ops->ndo_change_mtu);
>> >        dev->set_mac_address = SET_NETDEVOP(ops->ndo_set_mac_address);
>> >        dev->tx_timeout = SET_NETDEVOP(ops->ndo_tx_timeout);
>> >        dev->get_stats = SET_NETDEVOP(ops->ndo_get_stats);
>> > #undef SET_NETDEVOP
>> > }
>> > EXPORT_SYMBOL(netdev_attach_ops);
>> >
>> > For newer kernels then this would just be:
>> >
>> > static inline void netdev_attach_ops(struct net_device *dev,
>> >                       const struct net_device_ops *ops)
>> > {
>> >        dev->netdev_ops = ops;
>> > }
>> >
>> > Stephen, would the above be acceptable upstream on netdevice.h ? It
>> > would eliminate all needs from having to #ifdef network drivers when
>> > backporting. If so I can send a respective patch and spatch all the
>> > setters I think. An example of the nasty ifdef crap we have to do for
>> > the current backport of netdevop'able drivers is below.
>> >
>>
>> No. supporting backporting is not part of the upstream kernel
>> mission. Honestly, we try for forward compatibility but intentionally
>> ignore carrying extra backport baggage.
>
> Sure, understood, just had to try :), if only I could find a *good*
> non-backport reason to have the netdev_attach_ops()...

FWIW, it helped a lot, porting an Ethernet driver for example consists
of a 1 line change to the driver, this goes down to 2.6.21 even. With
a netdev_attach_ops() upstream this would require 0 lines of code
changes. But --- I understand, I'll try to find a real value for it on
existing kernels.

 patches/01-netdev.patch |  625 ++++++-----------------------------------------
 1 files changed, 75 insertions(+), 550 deletions(-)

  Luis

      reply	other threads:[~2010-05-05  1:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1273012850-8359-1-git-send-email-hauke@hauke-m.de>
2010-05-04 23:26 ` [PATCH] compat-wireless: updates for orinoco Luis R. Rodriguez
2010-05-05  0:04   ` Stephen Hemminger
2010-05-05  0:18     ` Luis R. Rodriguez
2010-05-05  1:47       ` Luis R. Rodriguez [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=z2s43e72e891005041847g6147acfdm1efc8c752dbe94c@mail.gmail.com \
    --to=lrodriguez@atheros.com \
    --cc=Luis.Rodriguez@atheros.com \
    --cc=davem@davemloft.net \
    --cc=hauke@hauke-m.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).