aboutsummaryrefslogtreecommitdiffstats
path: root/net/netrom/nr_dev.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-10-09 04:40:57 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:52 -0400
commit3b04ddde02cf1b6f14f2697da5c20eca5715017f (patch)
tree9da1341a5a399a507b5ea6bf5a3047506b8d8f8f /net/netrom/nr_dev.c
parentb95cce3576813ac3f86bafa6b5daaaaf7574b0fe (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/netrom/nr_dev.c')
-rw-r--r--net/netrom/nr_dev.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index c7b5d930e732..8c68da5ef0a1 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -95,8 +95,9 @@ static int nr_rebuild_header(struct sk_buff *skb)
95 95
96#endif 96#endif
97 97
98static int nr_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 98static int nr_header(struct sk_buff *skb, struct net_device *dev,
99 void *daddr, void *saddr, unsigned len) 99 unsigned short type,
100 const void *daddr, const void *saddr, unsigned len)
100{ 101{
101 unsigned char *buff = skb_push(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN); 102 unsigned char *buff = skb_push(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN);
102 103
@@ -193,6 +194,12 @@ static struct net_device_stats *nr_get_stats(struct net_device *dev)
193 return &nr->stats; 194 return &nr->stats;
194} 195}
195 196
197static const struct header_ops nr_header_ops = {
198 .create = nr_header,
199 .rebuild= nr_rebuild_header,
200};
201
202
196void nr_setup(struct net_device *dev) 203void nr_setup(struct net_device *dev)
197{ 204{
198 dev->mtu = NR_MAX_PACKET_SIZE; 205 dev->mtu = NR_MAX_PACKET_SIZE;
@@ -200,11 +207,10 @@ void nr_setup(struct net_device *dev)
200 dev->open = nr_open; 207 dev->open = nr_open;
201 dev->stop = nr_close; 208 dev->stop = nr_close;
202 209
203 dev->hard_header = nr_header; 210 dev->header_ops = &nr_header_ops;
204 dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; 211 dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN;
205 dev->addr_len = AX25_ADDR_LEN; 212 dev->addr_len = AX25_ADDR_LEN;
206 dev->type = ARPHRD_NETROM; 213 dev->type = ARPHRD_NETROM;
207 dev->rebuild_header = nr_rebuild_header;
208 dev->set_mac_address = nr_set_mac_address; 214 dev->set_mac_address = nr_set_mac_address;
209 215
210 /* New-style flags. */ 216 /* New-style flags. */