[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>
This commit is contained in:
committed by
David S. Miller
parent
b95cce3576
commit
3b04ddde02
@ -897,8 +897,8 @@ out_unlock_bh:
|
||||
static void neigh_update_hhs(struct neighbour *neigh)
|
||||
{
|
||||
struct hh_cache *hh;
|
||||
void (*update)(struct hh_cache*, struct net_device*, unsigned char *) =
|
||||
neigh->dev->header_cache_update;
|
||||
void (*update)(struct hh_cache*, const struct net_device*, const unsigned char *)
|
||||
= neigh->dev->header_ops->cache_update;
|
||||
|
||||
if (update) {
|
||||
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,
|
||||
hh->hh_type = protocol;
|
||||
atomic_set(&hh->hh_refcnt, 0);
|
||||
hh->hh_next = NULL;
|
||||
if (dev->hard_header_cache(n, hh)) {
|
||||
|
||||
if (dev->header_ops->cache(n, hh)) {
|
||||
kfree(hh);
|
||||
hh = NULL;
|
||||
} else {
|
||||
@ -1127,7 +1128,7 @@ int neigh_compat_output(struct sk_buff *skb)
|
||||
|
||||
if (dev_hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL,
|
||||
skb->len) < 0 &&
|
||||
dev->rebuild_header(skb))
|
||||
dev->header_ops->rebuild(skb))
|
||||
return 0;
|
||||
|
||||
return dev_queue_xmit(skb);
|
||||
@ -1149,7 +1150,7 @@ int neigh_resolve_output(struct sk_buff *skb)
|
||||
if (!neigh_event_send(neigh, skb)) {
|
||||
int err;
|
||||
struct net_device *dev = neigh->dev;
|
||||
if (dev->hard_header_cache && !dst->hh) {
|
||||
if (dev->header_ops->cache && !dst->hh) {
|
||||
write_lock_bh(&neigh->lock);
|
||||
if (!dst->hh)
|
||||
neigh_hh_init(neigh, dst, dst->ops->protocol);
|
||||
|
Reference in New Issue
Block a user