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/ipv4/ip_gre.c | |
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/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index ffa9f1c9dcbb..f151900efaf9 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -684,7 +684,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
684 | goto tx_error; | 684 | goto tx_error; |
685 | } | 685 | } |
686 | 686 | ||
687 | if (dev->hard_header) { | 687 | if (dev->header_ops) { |
688 | gre_hlen = 0; | 688 | gre_hlen = 0; |
689 | tiph = (struct iphdr*)skb->data; | 689 | tiph = (struct iphdr*)skb->data; |
690 | } else { | 690 | } else { |
@@ -1063,8 +1063,9 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) | |||
1063 | 1063 | ||
1064 | */ | 1064 | */ |
1065 | 1065 | ||
1066 | static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | 1066 | static int ipgre_header(struct sk_buff *skb, struct net_device *dev, |
1067 | void *daddr, void *saddr, unsigned len) | 1067 | unsigned short type, |
1068 | const void *daddr, const void *saddr, unsigned len) | ||
1068 | { | 1069 | { |
1069 | struct ip_tunnel *t = netdev_priv(dev); | 1070 | struct ip_tunnel *t = netdev_priv(dev); |
1070 | struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); | 1071 | struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); |
@@ -1091,6 +1092,10 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh | |||
1091 | return -t->hlen; | 1092 | return -t->hlen; |
1092 | } | 1093 | } |
1093 | 1094 | ||
1095 | static const struct header_ops ipgre_header_ops = { | ||
1096 | .create = ipgre_header, | ||
1097 | }; | ||
1098 | |||
1094 | static int ipgre_open(struct net_device *dev) | 1099 | static int ipgre_open(struct net_device *dev) |
1095 | { | 1100 | { |
1096 | struct ip_tunnel *t = netdev_priv(dev); | 1101 | struct ip_tunnel *t = netdev_priv(dev); |
@@ -1187,7 +1192,7 @@ static int ipgre_tunnel_init(struct net_device *dev) | |||
1187 | if (!iph->saddr) | 1192 | if (!iph->saddr) |
1188 | return -EINVAL; | 1193 | return -EINVAL; |
1189 | dev->flags = IFF_BROADCAST; | 1194 | dev->flags = IFF_BROADCAST; |
1190 | dev->hard_header = ipgre_header; | 1195 | dev->header_ops = &ipgre_header_ops; |
1191 | dev->open = ipgre_open; | 1196 | dev->open = ipgre_open; |
1192 | dev->stop = ipgre_close; | 1197 | dev->stop = ipgre_close; |
1193 | } | 1198 | } |