aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
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/core
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/core')
-rw-r--r--net/core/dev.c16
-rw-r--r--net/core/neighbour.c11
2 files changed, 6 insertions, 21 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 3923d513305..d9986466258 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -967,14 +967,6 @@ void dev_load(struct net *net, const char *name)
967 request_module("%s", name); 967 request_module("%s", name);
968} 968}
969 969
970static int default_rebuild_header(struct sk_buff *skb)
971{
972 printk(KERN_DEBUG "%s: default_rebuild_header called -- BUG!\n",
973 skb->dev ? skb->dev->name : "NULL!!!");
974 kfree_skb(skb);
975 return 1;
976}
977
978/** 970/**
979 * dev_open - prepare an interface for use. 971 * dev_open - prepare an interface for use.
980 * @dev: device to open 972 * @dev: device to open
@@ -3561,14 +3553,6 @@ int register_netdevice(struct net_device *dev)
3561 } 3553 }
3562 } 3554 }
3563 3555
3564 /*
3565 * nil rebuild_header routine,
3566 * that should be never called and used as just bug trap.
3567 */
3568
3569 if (!dev->rebuild_header)
3570 dev->rebuild_header = default_rebuild_header;
3571
3572 ret = netdev_register_kobject(dev); 3556 ret = netdev_register_kobject(dev);
3573 if (ret) 3557 if (ret)
3574 goto err_uninit; 3558 goto err_uninit;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 10bcb9f8da5..c52df858d0b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -897,8 +897,8 @@ out_unlock_bh:
897static void neigh_update_hhs(struct neighbour *neigh) 897static void neigh_update_hhs(struct neighbour *neigh)
898{ 898{
899 struct hh_cache *hh; 899 struct hh_cache *hh;
900 void (*update)(struct hh_cache*, struct net_device*, unsigned char *) = 900 void (*update)(struct hh_cache*, const struct net_device*, const unsigned char *)
901 neigh->dev->header_cache_update; 901 = neigh->dev->header_ops->cache_update;
902 902
903 if (update) { 903 if (update) {
904 for (hh = neigh->hh; hh; hh = hh->hh_next) { 904 for (hh = neigh->hh; hh; hh = hh->hh_next) {
@@ -1095,7 +1095,8 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
1095 hh->hh_type = protocol; 1095 hh->hh_type = protocol;
1096 atomic_set(&hh->hh_refcnt, 0); 1096 atomic_set(&hh->hh_refcnt, 0);
1097 hh->hh_next = NULL; 1097 hh->hh_next = NULL;
1098 if (dev->hard_header_cache(n, hh)) { 1098
1099 if (dev->header_ops->cache(n, hh)) {
1099 kfree(hh); 1100 kfree(hh);
1100 hh = NULL; 1101 hh = NULL;
1101 } else { 1102 } else {
@@ -1127,7 +1128,7 @@ int neigh_compat_output(struct sk_buff *skb)
1127 1128
1128 if (dev_hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, 1129 if (dev_hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL,
1129 skb->len) < 0 && 1130 skb->len) < 0 &&
1130 dev->rebuild_header(skb)) 1131 dev->header_ops->rebuild(skb))
1131 return 0; 1132 return 0;
1132 1133
1133 return dev_queue_xmit(skb); 1134 return dev_queue_xmit(skb);
@@ -1149,7 +1150,7 @@ int neigh_resolve_output(struct sk_buff *skb)
1149 if (!neigh_event_send(neigh, skb)) { 1150 if (!neigh_event_send(neigh, skb)) {
1150 int err; 1151 int err;
1151 struct net_device *dev = neigh->dev; 1152 struct net_device *dev = neigh->dev;
1152 if (dev->hard_header_cache && !dst->hh) { 1153 if (dev->header_ops->cache && !dst->hh) {
1153 write_lock_bh(&neigh->lock); 1154 write_lock_bh(&neigh->lock);
1154 if (!dst->hh) 1155 if (!dst->hh)
1155 neigh_hh_init(neigh, dst, dst->ops->protocol); 1156 neigh_hh_init(neigh, dst, dst->ops->protocol);