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 /drivers/ieee1394/eth1394.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 'drivers/ieee1394/eth1394.c')
| -rw-r--r-- | drivers/ieee1394/eth1394.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index b31f90082e35..dc9dce22f6a8 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
| @@ -159,15 +159,16 @@ MODULE_PARM_DESC(max_partial_datagrams, | |||
| 159 | 159 | ||
| 160 | 160 | ||
| 161 | static int ether1394_header(struct sk_buff *skb, struct net_device *dev, | 161 | static int ether1394_header(struct sk_buff *skb, struct net_device *dev, |
| 162 | unsigned short type, void *daddr, void *saddr, | 162 | unsigned short type, const void *daddr, |
| 163 | unsigned len); | 163 | const void *saddr, unsigned len); |
| 164 | static int ether1394_rebuild_header(struct sk_buff *skb); | 164 | static int ether1394_rebuild_header(struct sk_buff *skb); |
| 165 | static int ether1394_header_parse(const struct sk_buff *skb, | 165 | static int ether1394_header_parse(const struct sk_buff *skb, |
| 166 | unsigned char *haddr); | 166 | unsigned char *haddr); |
| 167 | static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh); | 167 | static int ether1394_header_cache(const struct neighbour *neigh, |
| 168 | struct hh_cache *hh); | ||
| 168 | static void ether1394_header_cache_update(struct hh_cache *hh, | 169 | static void ether1394_header_cache_update(struct hh_cache *hh, |
| 169 | struct net_device *dev, | 170 | const struct net_device *dev, |
| 170 | unsigned char *haddr); | 171 | const unsigned char *haddr); |
| 171 | static int ether1394_tx(struct sk_buff *skb, struct net_device *dev); | 172 | static int ether1394_tx(struct sk_buff *skb, struct net_device *dev); |
| 172 | static void ether1394_iso(struct hpsb_iso *iso); | 173 | static void ether1394_iso(struct hpsb_iso *iso); |
| 173 | 174 | ||
| @@ -507,6 +508,14 @@ static void ether1394_reset_priv(struct net_device *dev, int set_mtu) | |||
| 507 | spin_unlock_irqrestore(&priv->lock, flags); | 508 | spin_unlock_irqrestore(&priv->lock, flags); |
| 508 | } | 509 | } |
| 509 | 510 | ||
| 511 | static const struct header_ops ether1394_header_ops = { | ||
| 512 | .create = ether1394_header, | ||
| 513 | .rebuild = ether1394_rebuild_header, | ||
| 514 | .cache = ether1394_header_cache, | ||
| 515 | .cache_update = ether1394_header_cache_update, | ||
| 516 | .parse = ether1394_header_parse, | ||
| 517 | }; | ||
| 518 | |||
| 510 | static void ether1394_init_dev(struct net_device *dev) | 519 | static void ether1394_init_dev(struct net_device *dev) |
| 511 | { | 520 | { |
| 512 | dev->open = ether1394_open; | 521 | dev->open = ether1394_open; |
| @@ -516,11 +525,7 @@ static void ether1394_init_dev(struct net_device *dev) | |||
| 516 | dev->tx_timeout = ether1394_tx_timeout; | 525 | dev->tx_timeout = ether1394_tx_timeout; |
| 517 | dev->change_mtu = ether1394_change_mtu; | 526 | dev->change_mtu = ether1394_change_mtu; |
| 518 | 527 | ||
| 519 | dev->hard_header = ether1394_header; | 528 | dev->header_ops = ðer1394_header_ops; |
| 520 | dev->rebuild_header = ether1394_rebuild_header; | ||
| 521 | dev->hard_header_cache = ether1394_header_cache; | ||
| 522 | dev->header_cache_update= ether1394_header_cache_update; | ||
| 523 | dev->hard_header_parse = ether1394_header_parse; | ||
| 524 | 529 | ||
| 525 | SET_ETHTOOL_OPS(dev, ðtool_ops); | 530 | SET_ETHTOOL_OPS(dev, ðtool_ops); |
| 526 | 531 | ||
| @@ -711,8 +716,8 @@ static void ether1394_host_reset(struct hpsb_host *host) | |||
| 711 | * saddr=NULL means use device source address | 716 | * saddr=NULL means use device source address |
| 712 | * daddr=NULL means leave destination address (eg unresolved arp). */ | 717 | * daddr=NULL means leave destination address (eg unresolved arp). */ |
| 713 | static int ether1394_header(struct sk_buff *skb, struct net_device *dev, | 718 | static int ether1394_header(struct sk_buff *skb, struct net_device *dev, |
| 714 | unsigned short type, void *daddr, void *saddr, | 719 | unsigned short type, const void *daddr, |
| 715 | unsigned len) | 720 | const void *saddr, unsigned len) |
| 716 | { | 721 | { |
| 717 | struct eth1394hdr *eth = | 722 | struct eth1394hdr *eth = |
| 718 | (struct eth1394hdr *)skb_push(skb, ETH1394_HLEN); | 723 | (struct eth1394hdr *)skb_push(skb, ETH1394_HLEN); |
| @@ -759,7 +764,8 @@ static int ether1394_header_parse(const struct sk_buff *skb, | |||
| 759 | return ETH1394_ALEN; | 764 | return ETH1394_ALEN; |
| 760 | } | 765 | } |
| 761 | 766 | ||
| 762 | static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh) | 767 | static int ether1394_header_cache(const struct neighbour *neigh, |
| 768 | struct hh_cache *hh) | ||
| 763 | { | 769 | { |
| 764 | unsigned short type = hh->hh_type; | 770 | unsigned short type = hh->hh_type; |
| 765 | struct net_device *dev = neigh->dev; | 771 | struct net_device *dev = neigh->dev; |
| @@ -778,8 +784,8 @@ static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh) | |||
| 778 | 784 | ||
| 779 | /* Called by Address Resolution module to notify changes in address. */ | 785 | /* Called by Address Resolution module to notify changes in address. */ |
| 780 | static void ether1394_header_cache_update(struct hh_cache *hh, | 786 | static void ether1394_header_cache_update(struct hh_cache *hh, |
| 781 | struct net_device *dev, | 787 | const struct net_device *dev, |
| 782 | unsigned char * haddr) | 788 | const unsigned char * haddr) |
| 783 | { | 789 | { |
| 784 | memcpy((u8 *)hh->hh_data + 16 - ETH1394_HLEN, haddr, dev->addr_len); | 790 | memcpy((u8 *)hh->hh_data + 16 - ETH1394_HLEN, haddr, dev->addr_len); |
| 785 | } | 791 | } |
| @@ -899,8 +905,8 @@ static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev, | |||
| 899 | } | 905 | } |
| 900 | 906 | ||
| 901 | /* Now add the ethernet header. */ | 907 | /* Now add the ethernet header. */ |
| 902 | if (dev->hard_header(skb, dev, ntohs(ether_type), &dest_hw, NULL, | 908 | if (dev_hard_header(skb, dev, ntohs(ether_type), &dest_hw, NULL, |
| 903 | skb->len) >= 0) | 909 | skb->len) >= 0) |
| 904 | ret = ether1394_type_trans(skb, dev); | 910 | ret = ether1394_type_trans(skb, dev); |
| 905 | 911 | ||
| 906 | return ret; | 912 | return ret; |
