Netdev List
 help / color / mirror / Atom feed
From: Krzysztof Halasa <khc@pm.waw.pl>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] hdlc: fix compile problem
Date: Thu, 08 Jan 2009 02:00:00 +0100	[thread overview]
Message-ID: <m3tz8atxwv.fsf@maximus.localdomain> (raw)
In-Reply-To: <20090107152858.6fb8ac5d@extreme> (Stephen Hemminger's message of "Wed\, 7 Jan 2009 15\:28\:58 -0800")

Stephen Hemminger <shemminger@vyatta.com> writes:

> It was introduced (by me) in previous patch. Since that isn't applied yet,
> I'll go back and fix.

I can see it now, I must have missed it because of the "synclink"
subject.

@@ -106,7 +98,7 @@ static int hdlc_device_event(struct noti
        if (dev_net(dev) != &init_net)
                return NOTIFY_DONE;
 
-       if (dev->get_stats != hdlc_get_stats)
+       if (dev->header_ops != &hdlc_null_ops)
                return NOTIFY_DONE; /* not an HDLC device */

This won't work because hdlc_null_ops may be substituted by
cisco_header_ops or ppp_header_ops. Current test works for now but is
wrong, too, at least for wanxl driver (it tries to use its
get_stats()).

Perhaps some
+       if (dev->header_ops->something != &something)
would do? Alternatively we can return to hdlc_carrier_on|off() and
hdlc_device_event() won't be needed.

Essentially, it's a bit hard to check if the device is one of ours if
we are the middle layer.


There are two layers here:
- hardware drivers (10+)
- protocol drivers (5 - hdlc* files)

Protocol drivers want to define things like:
- dev->header_ops (no problem)
- dev->change_mtu (perhaps)
- dev->hard_start_xmit

Hardware drivers need to define the rest of NDO.

Hmm, not much, only hard_start_xmit() is really problematic. I think
we need a trampoline: hw driver will define the NDO and set
hard_start_xmit and possibly change_mtu to (exported by hdlc.c)
hdlc_xmit (hdlc_change_mtu), and hdlc_start_xmit will just call
protocol's xmit().
We could also use it for the test in hdlc_device_event:
	if (dev->netdev_ops->start_hard_xmit != hdlc_xmit)

If we could then get rid of this special xmit() and do all header and
TX preparations in hard_header(), it would be even better (cleaner)
though IIRC it requires some changes to Ethernet(?) code.


The changes have to be applied to the 4 synclink drivers and to most
.c files in drivers/net/wan simultaneously, perhaps it's more practical
if I do it?
-- 
Krzysztof Halasa

  reply	other threads:[~2009-01-08  1:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07 22:13 [PATCH] hdlc: fix compile problem Stephen Hemminger
2009-01-07 23:21 ` Krzysztof Halasa
2009-01-07 23:28   ` Stephen Hemminger
2009-01-08  1:00     ` Krzysztof Halasa [this message]
2009-01-08  1:08       ` Stephen Hemminger
2009-01-08  1:26         ` Krzysztof Halasa
2009-01-08  2:13           ` David Miller
2009-01-08 15:40         ` Krzysztof Halasa

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=m3tz8atxwv.fsf@maximus.localdomain \
    --to=khc@pm.waw.pl \
    --cc=davem@davemloft.net \
    --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