[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:
Stephen Hemminger
2007-10-09 01:40:57 -07:00
committed by David S. Miller
parent b95cce3576
commit 3b04ddde02
65 changed files with 479 additions and 473 deletions

View File

@@ -131,14 +131,15 @@ static int cycx_wan_update(struct wan_device *wandev),
cycx_wan_del_if(struct wan_device *wandev, struct net_device *dev);
/* Network device interface */
static int cycx_netdevice_init(struct net_device *dev),
cycx_netdevice_open(struct net_device *dev),
cycx_netdevice_stop(struct net_device *dev),
cycx_netdevice_hard_header(struct sk_buff *skb,
struct net_device *dev, u16 type,
void *daddr, void *saddr, unsigned len),
cycx_netdevice_rebuild_header(struct sk_buff *skb),
cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
static int cycx_netdevice_init(struct net_device *dev);
static int cycx_netdevice_open(struct net_device *dev);
static int cycx_netdevice_stop(struct net_device *dev);
static int cycx_netdevice_hard_header(struct sk_buff *skb,
struct net_device *dev, u16 type,
const void *daddr, const void *saddr,
unsigned len);
static int cycx_netdevice_rebuild_header(struct sk_buff *skb);
static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev);
static struct net_device_stats *
@@ -468,7 +469,14 @@ static int cycx_wan_del_if(struct wan_device *wandev, struct net_device *dev)
return 0;
}
/* Network Device Interface */
static const struct header_ops cycx_header_ops = {
.create = cycx_netdevice_hard_header,
.rebuild = cycx_netdevice_rebuild_header,
};
/* Initialize Linux network interface.
*
* This routine is called only once for each interface, during Linux network
@@ -483,8 +491,8 @@ static int cycx_netdevice_init(struct net_device *dev)
/* Initialize device driver entry points */
dev->open = cycx_netdevice_open;
dev->stop = cycx_netdevice_stop;
dev->hard_header = cycx_netdevice_hard_header;
dev->rebuild_header = cycx_netdevice_rebuild_header;
dev->header_ops = &cycx_header_ops;
dev->hard_start_xmit = cycx_netdevice_hard_start_xmit;
dev->get_stats = cycx_netdevice_get_stats;
@@ -554,7 +562,8 @@ static int cycx_netdevice_stop(struct net_device *dev)
* Return: media header length. */
static int cycx_netdevice_hard_header(struct sk_buff *skb,
struct net_device *dev, u16 type,
void *daddr, void *saddr, unsigned len)
const void *daddr, const void *saddr,
unsigned len)
{
skb->protocol = type;