diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-10-09 04:40:57 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:52:52 -0400 |
commit | 3b04ddde02cf1b6f14f2697da5c20eca5715017f (patch) | |
tree | 9da1341a5a399a507b5ea6bf5a3047506b8d8f8f /net/rose | |
parent | b95cce3576813ac3f86bafa6b5daaaaf7574b0fe (diff) |
[NET]: Move hardware header operations out of netdevice.
Since hardware header operations are part of the protocol class
not the device instance, make them into a separate object and
save memory.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rose')
-rw-r--r-- | net/rose/rose_dev.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c index 8d88795dc663..1b6741f1d746 100644 --- a/net/rose/rose_dev.c +++ b/net/rose/rose_dev.c | |||
@@ -35,8 +35,9 @@ | |||
35 | #include <net/ax25.h> | 35 | #include <net/ax25.h> |
36 | #include <net/rose.h> | 36 | #include <net/rose.h> |
37 | 37 | ||
38 | static int rose_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | 38 | static int rose_header(struct sk_buff *skb, struct net_device *dev, |
39 | void *daddr, void *saddr, unsigned len) | 39 | unsigned short type, |
40 | const void *daddr, const void *saddr, unsigned len) | ||
40 | { | 41 | { |
41 | unsigned char *buff = skb_push(skb, ROSE_MIN_LEN + 2); | 42 | unsigned char *buff = skb_push(skb, ROSE_MIN_LEN + 2); |
42 | 43 | ||
@@ -148,6 +149,11 @@ static struct net_device_stats *rose_get_stats(struct net_device *dev) | |||
148 | return netdev_priv(dev); | 149 | return netdev_priv(dev); |
149 | } | 150 | } |
150 | 151 | ||
152 | static const struct header_ops rose_header_ops = { | ||
153 | .create = rose_header, | ||
154 | .rebuild= rose_rebuild_header, | ||
155 | }; | ||
156 | |||
151 | void rose_setup(struct net_device *dev) | 157 | void rose_setup(struct net_device *dev) |
152 | { | 158 | { |
153 | dev->mtu = ROSE_MAX_PACKET_SIZE - 2; | 159 | dev->mtu = ROSE_MAX_PACKET_SIZE - 2; |
@@ -155,11 +161,10 @@ void rose_setup(struct net_device *dev) | |||
155 | dev->open = rose_open; | 161 | dev->open = rose_open; |
156 | dev->stop = rose_close; | 162 | dev->stop = rose_close; |
157 | 163 | ||
158 | dev->hard_header = rose_header; | 164 | dev->header_ops = &rose_header_ops; |
159 | dev->hard_header_len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN; | 165 | dev->hard_header_len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN; |
160 | dev->addr_len = ROSE_ADDR_LEN; | 166 | dev->addr_len = ROSE_ADDR_LEN; |
161 | dev->type = ARPHRD_ROSE; | 167 | dev->type = ARPHRD_ROSE; |
162 | dev->rebuild_header = rose_rebuild_header; | ||
163 | dev->set_mac_address = rose_set_mac_address; | 168 | dev->set_mac_address = rose_set_mac_address; |
164 | 169 | ||
165 | /* New-style flags. */ | 170 | /* New-style flags. */ |