mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 18:11:20 +00:00
[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:
parent
b95cce3576
commit
3b04ddde02
65 changed files with 479 additions and 473 deletions
|
@ -164,8 +164,8 @@ static int macvlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
}
|
||||
|
||||
static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type, void *daddr, void *saddr,
|
||||
unsigned len)
|
||||
unsigned short type, const void *daddr,
|
||||
const void *saddr, unsigned len)
|
||||
{
|
||||
const struct macvlan_dev *vlan = netdev_priv(dev);
|
||||
struct net_device *lowerdev = vlan->lowerdev;
|
||||
|
@ -174,6 +174,15 @@ static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev,
|
|||
saddr ? : dev->dev_addr, len);
|
||||
}
|
||||
|
||||
static const struct header_ops macvlan_hard_header_ops = {
|
||||
.create = macvlan_hard_header,
|
||||
.rebuild = eth_rebuild_header,
|
||||
.parse = eth_header_parse,
|
||||
.rebuild = eth_rebuild_header,
|
||||
.cache = eth_header_cache,
|
||||
.cache_update = eth_header_cache_update,
|
||||
};
|
||||
|
||||
static int macvlan_open(struct net_device *dev)
|
||||
{
|
||||
struct macvlan_dev *vlan = netdev_priv(dev);
|
||||
|
@ -295,9 +304,9 @@ static void macvlan_setup(struct net_device *dev)
|
|||
dev->change_mtu = macvlan_change_mtu;
|
||||
dev->change_rx_flags = macvlan_change_rx_flags;
|
||||
dev->set_multicast_list = macvlan_set_multicast_list;
|
||||
dev->hard_header = macvlan_hard_header;
|
||||
dev->hard_start_xmit = macvlan_hard_start_xmit;
|
||||
dev->destructor = free_netdev;
|
||||
dev->header_ops = &macvlan_hard_header_ops,
|
||||
dev->ethtool_ops = &macvlan_ethtool_ops;
|
||||
dev->tx_queue_len = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue