aboutsummaryrefslogtreecommitdiffstats
path: root/net/802/tr.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/802/tr.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/802/tr.c')
-rw-r--r--net/802/tr.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/net/802/tr.c b/net/802/tr.c
index aa3c2e936abc..a2bd0f2e3af8 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -100,7 +100,7 @@ static inline unsigned long rif_hash(const unsigned char *addr)
100 100
101static int tr_header(struct sk_buff *skb, struct net_device *dev, 101static int tr_header(struct sk_buff *skb, struct net_device *dev,
102 unsigned short type, 102 unsigned short type,
103 void *daddr, void *saddr, unsigned len) 103 const void *daddr, const void *saddr, unsigned len)
104{ 104{
105 struct trh_hdr *trh; 105 struct trh_hdr *trh;
106 int hdr_len; 106 int hdr_len;
@@ -142,7 +142,7 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev,
142 if(daddr) 142 if(daddr)
143 { 143 {
144 memcpy(trh->daddr,daddr,dev->addr_len); 144 memcpy(trh->daddr,daddr,dev->addr_len);
145 tr_source_route(skb,trh,dev); 145 tr_source_route(skb, trh, dev);
146 return(hdr_len); 146 return(hdr_len);
147 } 147 }
148 148
@@ -247,7 +247,8 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev)
247 * We try to do source routing... 247 * We try to do source routing...
248 */ 248 */
249 249
250void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev) 250void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,
251 struct net_device *dev)
251{ 252{
252 int slack; 253 int slack;
253 unsigned int hash; 254 unsigned int hash;
@@ -592,14 +593,18 @@ static const struct file_operations rif_seq_fops = {
592 593
593#endif 594#endif
594 595
596static const struct header_ops tr_header_ops = {
597 .create = tr_header,
598 .rebuild= tr_rebuild_header,
599};
600
595static void tr_setup(struct net_device *dev) 601static void tr_setup(struct net_device *dev)
596{ 602{
597 /* 603 /*
598 * Configure and register 604 * Configure and register
599 */ 605 */
600 606
601 dev->hard_header = tr_header; 607 dev->header_ops = &tr_header_ops;
602 dev->rebuild_header = tr_rebuild_header;
603 608
604 dev->type = ARPHRD_IEEE802_TR; 609 dev->type = ARPHRD_IEEE802_TR;
605 dev->hard_header_len = TR_HLEN; 610 dev->hard_header_len = TR_HLEN;