aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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 /drivers
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 'drivers')
-rw-r--r--drivers/ieee1394/eth1394.c40
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c8
-rw-r--r--drivers/isdn/i4l/isdn_net.c105
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.c9
-rw-r--r--drivers/net/appletalk/cops.c20
-rw-r--r--drivers/net/appletalk/ltpc.c10
-rw-r--r--drivers/net/arcnet/arcnet.c18
-rw-r--r--drivers/net/hamradio/6pack.c13
-rw-r--r--drivers/net/hamradio/baycom_epp.c3
-rw-r--r--drivers/net/hamradio/bpqether.c3
-rw-r--r--drivers/net/hamradio/dmascc.c3
-rw-r--r--drivers/net/hamradio/hdlcdrv.c3
-rw-r--r--drivers/net/hamradio/mkiss.c14
-rw-r--r--drivers/net/hamradio/scc.c4
-rw-r--r--drivers/net/hamradio/yam.c3
-rw-r--r--drivers/net/loopback.c8
-rw-r--r--drivers/net/macvlan.c15
-rw-r--r--drivers/net/myri_sbus.c28
-rw-r--r--drivers/net/plip.c50
-rw-r--r--drivers/net/shaper.c61
-rw-r--r--drivers/net/skfp/skfddi.c1
-rw-r--r--drivers/net/wan/cycx_x25.c31
-rw-r--r--drivers/net/wan/dlci.c10
-rw-r--r--drivers/net/wan/hdlc.c10
-rw-r--r--drivers/net/wan/hdlc_cisco.c10
-rw-r--r--drivers/net/wan/hdlc_ppp.c2
-rw-r--r--drivers/net/wan/lmc/lmc_proto.c2
-rw-r--r--drivers/net/wan/syncppp.c19
-rw-r--r--drivers/net/wireless/airo.c6
-rw-r--r--drivers/net/wireless/hostap/hostap.h3
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c3
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c5
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c47
-rw-r--r--drivers/net/wireless/hostap/hostap_wlan.h2
-rw-r--r--drivers/net/wireless/strip.c13
-rw-r--r--drivers/s390/net/qeth.h3
-rw-r--r--drivers/s390/net/qeth_main.c44
37 files changed, 298 insertions, 331 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
161static int ether1394_header(struct sk_buff *skb, struct net_device *dev, 161static 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);
164static int ether1394_rebuild_header(struct sk_buff *skb); 164static int ether1394_rebuild_header(struct sk_buff *skb);
165static int ether1394_header_parse(const struct sk_buff *skb, 165static int ether1394_header_parse(const struct sk_buff *skb,
166 unsigned char *haddr); 166 unsigned char *haddr);
167static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh); 167static int ether1394_header_cache(const struct neighbour *neigh,
168 struct hh_cache *hh);
168static void ether1394_header_cache_update(struct hh_cache *hh, 169static 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);
171static int ether1394_tx(struct sk_buff *skb, struct net_device *dev); 172static int ether1394_tx(struct sk_buff *skb, struct net_device *dev);
172static void ether1394_iso(struct hpsb_iso *iso); 173static 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
511static 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
510static void ether1394_init_dev(struct net_device *dev) 519static 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 = &ether1394_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, &ethtool_ops); 530 SET_ETHTOOL_OPS(dev, &ethtool_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). */
713static int ether1394_header(struct sk_buff *skb, struct net_device *dev, 718static 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
762static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh) 767static 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. */
780static void ether1394_header_cache_update(struct hh_cache *hh, 786static 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;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index b1c3d6cd8eba..2bd76ef57154 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -780,7 +780,7 @@ static void ipoib_timeout(struct net_device *dev)
780static int ipoib_hard_header(struct sk_buff *skb, 780static int ipoib_hard_header(struct sk_buff *skb,
781 struct net_device *dev, 781 struct net_device *dev,
782 unsigned short type, 782 unsigned short type,
783 void *daddr, void *saddr, unsigned len) 783 const void *daddr, const void *saddr, unsigned len)
784{ 784{
785 struct ipoib_header *header; 785 struct ipoib_header *header;
786 786
@@ -940,6 +940,10 @@ void ipoib_dev_cleanup(struct net_device *dev)
940 priv->tx_ring = NULL; 940 priv->tx_ring = NULL;
941} 941}
942 942
943static const struct header_ops ipoib_header_ops = {
944 .create = ipoib_hard_header,
945};
946
943static void ipoib_setup(struct net_device *dev) 947static void ipoib_setup(struct net_device *dev)
944{ 948{
945 struct ipoib_dev_priv *priv = netdev_priv(dev); 949 struct ipoib_dev_priv *priv = netdev_priv(dev);
@@ -950,7 +954,7 @@ static void ipoib_setup(struct net_device *dev)
950 dev->hard_start_xmit = ipoib_start_xmit; 954 dev->hard_start_xmit = ipoib_start_xmit;
951 dev->get_stats = ipoib_get_stats; 955 dev->get_stats = ipoib_get_stats;
952 dev->tx_timeout = ipoib_timeout; 956 dev->tx_timeout = ipoib_timeout;
953 dev->hard_header = ipoib_hard_header; 957 dev->header_ops = &ipoib_header_ops;
954 dev->set_multicast_list = ipoib_set_mcast_list; 958 dev->set_multicast_list = ipoib_set_mcast_list;
955 dev->neigh_setup = ipoib_neigh_setup_dev; 959 dev->neigh_setup = ipoib_neigh_setup_dev;
956 960
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index aa83277aba74..54546604656d 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1873,54 +1873,14 @@ isdn_net_rcv_skb(int idx, struct sk_buff *skb)
1873 return 0; 1873 return 0;
1874} 1874}
1875 1875
1876static int
1877my_eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
1878 void *daddr, void *saddr, unsigned len)
1879{
1880 struct ethhdr *eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
1881
1882 /*
1883 * Set the protocol type. For a packet of type ETH_P_802_3 we
1884 * put the length here instead. It is up to the 802.2 layer to
1885 * carry protocol information.
1886 */
1887
1888 if (type != ETH_P_802_3)
1889 eth->h_proto = htons(type);
1890 else
1891 eth->h_proto = htons(len);
1892
1893 /*
1894 * Set the source hardware address.
1895 */
1896 if (saddr)
1897 memcpy(eth->h_source, saddr, dev->addr_len);
1898 else
1899 memcpy(eth->h_source, dev->dev_addr, dev->addr_len);
1900
1901 /*
1902 * Anyway, the loopback-device should never use this function...
1903 */
1904
1905 if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
1906 memset(eth->h_dest, 0, dev->addr_len);
1907 return ETH_HLEN /*(dev->hard_header_len)*/;
1908 }
1909 if (daddr) {
1910 memcpy(eth->h_dest, daddr, dev->addr_len);
1911 return ETH_HLEN /*dev->hard_header_len*/;
1912 }
1913 return -ETH_HLEN /*dev->hard_header_len*/;
1914}
1915
1916/* 1876/*
1917 * build an header 1877 * build an header
1918 * depends on encaps that is being used. 1878 * depends on encaps that is being used.
1919 */ 1879 */
1920 1880
1921static int 1881static int isdn_net_header(struct sk_buff *skb, struct net_device *dev,
1922isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 1882 unsigned short type,
1923 void *daddr, void *saddr, unsigned plen) 1883 const void *daddr, const void *saddr, unsigned plen)
1924{ 1884{
1925 isdn_net_local *lp = dev->priv; 1885 isdn_net_local *lp = dev->priv;
1926 unsigned char *p; 1886 unsigned char *p;
@@ -1928,7 +1888,7 @@ isdn_net_header(struct sk_buff *skb, struct net_device *dev, unsigned short type
1928 1888
1929 switch (lp->p_encap) { 1889 switch (lp->p_encap) {
1930 case ISDN_NET_ENCAP_ETHER: 1890 case ISDN_NET_ENCAP_ETHER:
1931 len = my_eth_header(skb, dev, type, daddr, saddr, plen); 1891 len = eth_header(skb, dev, type, daddr, saddr, plen);
1932 break; 1892 break;
1933#ifdef CONFIG_ISDN_PPP 1893#ifdef CONFIG_ISDN_PPP
1934 case ISDN_NET_ENCAP_SYNCPPP: 1894 case ISDN_NET_ENCAP_SYNCPPP:
@@ -2005,6 +1965,32 @@ isdn_net_rebuild_header(struct sk_buff *skb)
2005 return ret; 1965 return ret;
2006} 1966}
2007 1967
1968static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
1969{
1970 const struct net_device *dev = neigh->dev;
1971 isdn_net_local *lp = dev->priv;
1972
1973 if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
1974 return eth_header_cache(neigh, hh);
1975 return -1;
1976}
1977
1978static void isdn_header_cache_update(struct hh_cache *hh,
1979 const struct net_device *dev,
1980 const unsigned char *haddr)
1981{
1982 isdn_net_local *lp = dev->priv;
1983 if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
1984 return eth_header_cache_update(hh, dev, haddr);
1985}
1986
1987static const struct header_ops isdn_header_ops = {
1988 .create = isdn_net_header,
1989 .rebuild = isdn_net_rebuild_header,
1990 .cache = isdn_header_cache,
1991 .cache_update = isdn_header_cache_update,
1992};
1993
2008/* 1994/*
2009 * Interface-setup. (just after registering a new interface) 1995 * Interface-setup. (just after registering a new interface)
2010 */ 1996 */
@@ -2012,18 +1998,12 @@ static int
2012isdn_net_init(struct net_device *ndev) 1998isdn_net_init(struct net_device *ndev)
2013{ 1999{
2014 ushort max_hlhdr_len = 0; 2000 ushort max_hlhdr_len = 0;
2015 isdn_net_local *lp = (isdn_net_local *) ndev->priv; 2001 int drvidx;
2016 int drvidx, i;
2017 2002
2018 ether_setup(ndev); 2003 ether_setup(ndev);
2019 lp->org_hhc = ndev->hard_header_cache; 2004 ndev->header_ops = NULL;
2020 lp->org_hcu = ndev->header_cache_update;
2021 2005
2022 /* Setup the generic properties */ 2006 /* Setup the generic properties */
2023
2024 ndev->hard_header = NULL;
2025 ndev->hard_header_cache = NULL;
2026 ndev->header_cache_update = NULL;
2027 ndev->mtu = 1500; 2007 ndev->mtu = 1500;
2028 ndev->flags = IFF_NOARP|IFF_POINTOPOINT; 2008 ndev->flags = IFF_NOARP|IFF_POINTOPOINT;
2029 ndev->type = ARPHRD_ETHER; 2009 ndev->type = ARPHRD_ETHER;
@@ -2032,9 +2012,6 @@ isdn_net_init(struct net_device *ndev)
2032 /* for clients with MPPP maybe higher values better */ 2012 /* for clients with MPPP maybe higher values better */
2033 ndev->tx_queue_len = 30; 2013 ndev->tx_queue_len = 30;
2034 2014
2035 for (i = 0; i < ETH_ALEN; i++)
2036 ndev->broadcast[i] = 0xff;
2037
2038 /* The ISDN-specific entries in the device structure. */ 2015 /* The ISDN-specific entries in the device structure. */
2039 ndev->open = &isdn_net_open; 2016 ndev->open = &isdn_net_open;
2040 ndev->hard_start_xmit = &isdn_net_start_xmit; 2017 ndev->hard_start_xmit = &isdn_net_start_xmit;
@@ -2052,7 +2029,6 @@ isdn_net_init(struct net_device *ndev)
2052 ndev->hard_header_len = ETH_HLEN + max_hlhdr_len; 2029 ndev->hard_header_len = ETH_HLEN + max_hlhdr_len;
2053 ndev->stop = &isdn_net_close; 2030 ndev->stop = &isdn_net_close;
2054 ndev->get_stats = &isdn_net_get_stats; 2031 ndev->get_stats = &isdn_net_get_stats;
2055 ndev->rebuild_header = &isdn_net_rebuild_header;
2056 ndev->do_ioctl = NULL; 2032 ndev->do_ioctl = NULL;
2057 return 0; 2033 return 0;
2058} 2034}
@@ -2861,21 +2837,14 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
2861 } 2837 }
2862 if (cfg->p_encap != lp->p_encap) { 2838 if (cfg->p_encap != lp->p_encap) {
2863 if (cfg->p_encap == ISDN_NET_ENCAP_RAWIP) { 2839 if (cfg->p_encap == ISDN_NET_ENCAP_RAWIP) {
2864 p->dev.hard_header = NULL; 2840 p->dev.header_ops = NULL;
2865 p->dev.hard_header_cache = NULL;
2866 p->dev.header_cache_update = NULL;
2867 p->dev.flags = IFF_NOARP|IFF_POINTOPOINT; 2841 p->dev.flags = IFF_NOARP|IFF_POINTOPOINT;
2868 } else { 2842 } else {
2869 p->dev.hard_header = isdn_net_header; 2843 p->dev.header_ops = &isdn_header_ops;
2870 if (cfg->p_encap == ISDN_NET_ENCAP_ETHER) { 2844 if (cfg->p_encap == ISDN_NET_ENCAP_ETHER)
2871 p->dev.hard_header_cache = lp->org_hhc;
2872 p->dev.header_cache_update = lp->org_hcu;
2873 p->dev.flags = IFF_BROADCAST | IFF_MULTICAST; 2845 p->dev.flags = IFF_BROADCAST | IFF_MULTICAST;
2874 } else { 2846 else
2875 p->dev.hard_header_cache = NULL;
2876 p->dev.header_cache_update = NULL;
2877 p->dev.flags = IFF_NOARP|IFF_POINTOPOINT; 2847 p->dev.flags = IFF_NOARP|IFF_POINTOPOINT;
2878 }
2879 } 2848 }
2880 } 2849 }
2881 lp->p_encap = cfg->p_encap; 2850 lp->p_encap = cfg->p_encap;
@@ -3127,8 +3096,6 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
3127 ((isdn_net_local *) (p->local->master->priv))->slave = p->local->slave; 3096 ((isdn_net_local *) (p->local->master->priv))->slave = p->local->slave;
3128 } else { 3097 } else {
3129 /* Unregister only if it's a master-device */ 3098 /* Unregister only if it's a master-device */
3130 p->dev.hard_header_cache = p->local->org_hhc;
3131 p->dev.header_cache_update = p->local->org_hcu;
3132 unregister_netdev(&p->dev); 3099 unregister_netdev(&p->dev);
3133 } 3100 }
3134 /* Unlink device from chain */ 3101 /* Unlink device from chain */
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index bdd797071cb0..06800e5a0770 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -1225,10 +1225,17 @@ static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
1225 return &((struct dvb_net_priv*) dev->priv)->stats; 1225 return &((struct dvb_net_priv*) dev->priv)->stats;
1226} 1226}
1227 1227
1228static const struct header_ops dvb_header_ops = {
1229 .create = eth_header,
1230 .parse = eth_header_parse,
1231 .rebuild = eth_rebuild_header,
1232};
1233
1228static void dvb_net_setup(struct net_device *dev) 1234static void dvb_net_setup(struct net_device *dev)
1229{ 1235{
1230 ether_setup(dev); 1236 ether_setup(dev);
1231 1237
1238 dev->header_ops = &dvb_header_ops;
1232 dev->open = dvb_net_open; 1239 dev->open = dvb_net_open;
1233 dev->stop = dvb_net_stop; 1240 dev->stop = dvb_net_stop;
1234 dev->hard_start_xmit = dvb_net_tx; 1241 dev->hard_start_xmit = dvb_net_tx;
@@ -1237,7 +1244,7 @@ static void dvb_net_setup(struct net_device *dev)
1237 dev->set_mac_address = dvb_net_set_mac; 1244 dev->set_mac_address = dvb_net_set_mac;
1238 dev->mtu = 4096; 1245 dev->mtu = 4096;
1239 dev->mc_count = 0; 1246 dev->mc_count = 0;
1240 dev->hard_header_cache = NULL; 1247
1241 dev->flags |= IFF_NOARP; 1248 dev->flags |= IFF_NOARP;
1242} 1249}
1243 1250
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index c4b560d42a67..92c3a4cf0bb1 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -194,10 +194,6 @@ static void cops_timeout(struct net_device *dev);
194static void cops_rx (struct net_device *dev); 194static void cops_rx (struct net_device *dev);
195static int cops_send_packet (struct sk_buff *skb, struct net_device *dev); 195static int cops_send_packet (struct sk_buff *skb, struct net_device *dev);
196static void set_multicast_list (struct net_device *dev); 196static void set_multicast_list (struct net_device *dev);
197static int cops_hard_header (struct sk_buff *skb, struct net_device *dev,
198 unsigned short type, void *daddr, void *saddr,
199 unsigned len);
200
201static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); 197static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
202static int cops_close (struct net_device *dev); 198static int cops_close (struct net_device *dev);
203static struct net_device_stats *cops_get_stats (struct net_device *dev); 199static struct net_device_stats *cops_get_stats (struct net_device *dev);
@@ -331,7 +327,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
331 dev->base_addr = ioaddr; 327 dev->base_addr = ioaddr;
332 328
333 lp = netdev_priv(dev); 329 lp = netdev_priv(dev);
334 memset(lp, 0, sizeof(struct cops_local));
335 spin_lock_init(&lp->lock); 330 spin_lock_init(&lp->lock);
336 331
337 /* Copy local board variable to lp struct. */ 332 /* Copy local board variable to lp struct. */
@@ -340,7 +335,7 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
340 dev->hard_start_xmit = cops_send_packet; 335 dev->hard_start_xmit = cops_send_packet;
341 dev->tx_timeout = cops_timeout; 336 dev->tx_timeout = cops_timeout;
342 dev->watchdog_timeo = HZ * 2; 337 dev->watchdog_timeo = HZ * 2;
343 dev->hard_header = cops_hard_header; 338
344 dev->get_stats = cops_get_stats; 339 dev->get_stats = cops_get_stats;
345 dev->open = cops_open; 340 dev->open = cops_open;
346 dev->stop = cops_close; 341 dev->stop = cops_close;
@@ -945,19 +940,6 @@ static void set_multicast_list(struct net_device *dev)
945} 940}
946 941
947/* 942/*
948 * Another Dummy function to keep the Appletalk layer happy.
949 */
950
951static int cops_hard_header(struct sk_buff *skb, struct net_device *dev,
952 unsigned short type, void *daddr, void *saddr,
953 unsigned len)
954{
955 if(cops_debug >= 3)
956 printk("%s: cops_hard_header executed. Wow!\n", dev->name);
957 return 0;
958}
959
960/*
961 * System ioctls for the COPS LocalTalk card. 943 * System ioctls for the COPS LocalTalk card.
962 */ 944 */
963 945
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index cb4744e56905..6ab2c2d4d673 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -870,15 +870,6 @@ static void set_multicast_list(struct net_device *dev)
870 /* Actually netatalk needs fixing! */ 870 /* Actually netatalk needs fixing! */
871} 871}
872 872
873static int ltpc_hard_header (struct sk_buff *skb, struct net_device *dev,
874 unsigned short type, void *daddr, void *saddr, unsigned len)
875{
876 if(debug & DEBUG_VERBOSE)
877 printk("ltpc_hard_header called for device %s\n",
878 dev->name);
879 return 0;
880}
881
882static int ltpc_poll_counter; 873static int ltpc_poll_counter;
883 874
884static void ltpc_poll(unsigned long l) 875static void ltpc_poll(unsigned long l)
@@ -1141,7 +1132,6 @@ struct net_device * __init ltpc_probe(void)
1141 1132
1142 /* Fill in the fields of the device structure with ethernet-generic values. */ 1133 /* Fill in the fields of the device structure with ethernet-generic values. */
1143 dev->hard_start_xmit = ltpc_xmit; 1134 dev->hard_start_xmit = ltpc_xmit;
1144 dev->hard_header = ltpc_hard_header;
1145 dev->get_stats = ltpc_get_stats; 1135 dev->get_stats = ltpc_get_stats;
1146 1136
1147 /* add the ltpc-specific things */ 1137 /* add the ltpc-specific things */
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c
index 681e20b8466f..c59c8067de99 100644
--- a/drivers/net/arcnet/arcnet.c
+++ b/drivers/net/arcnet/arcnet.c
@@ -102,8 +102,8 @@ static int arcnet_close(struct net_device *dev);
102static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev); 102static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev);
103static void arcnet_timeout(struct net_device *dev); 103static void arcnet_timeout(struct net_device *dev);
104static int arcnet_header(struct sk_buff *skb, struct net_device *dev, 104static int arcnet_header(struct sk_buff *skb, struct net_device *dev,
105 unsigned short type, void *daddr, void *saddr, 105 unsigned short type, const void *daddr,
106 unsigned len); 106 const void *saddr, unsigned len);
107static int arcnet_rebuild_header(struct sk_buff *skb); 107static int arcnet_rebuild_header(struct sk_buff *skb);
108static struct net_device_stats *arcnet_get_stats(struct net_device *dev); 108static struct net_device_stats *arcnet_get_stats(struct net_device *dev);
109static int go_tx(struct net_device *dev); 109static int go_tx(struct net_device *dev);
@@ -317,11 +317,17 @@ static int choose_mtu(void)
317 return mtu == 65535 ? XMTU : mtu; 317 return mtu == 65535 ? XMTU : mtu;
318} 318}
319 319
320static const struct header_ops arcnet_header_ops = {
321 .create = arcnet_header,
322 .rebuild = arcnet_rebuild_header,
323};
324
320 325
321/* Setup a struct device for ARCnet. */ 326/* Setup a struct device for ARCnet. */
322static void arcdev_setup(struct net_device *dev) 327static void arcdev_setup(struct net_device *dev)
323{ 328{
324 dev->type = ARPHRD_ARCNET; 329 dev->type = ARPHRD_ARCNET;
330 dev->header_ops = &arcnet_header_ops;
325 dev->hard_header_len = sizeof(struct archdr); 331 dev->hard_header_len = sizeof(struct archdr);
326 dev->mtu = choose_mtu(); 332 dev->mtu = choose_mtu();
327 333
@@ -342,8 +348,6 @@ static void arcdev_setup(struct net_device *dev)
342 dev->hard_start_xmit = arcnet_send_packet; 348 dev->hard_start_xmit = arcnet_send_packet;
343 dev->tx_timeout = arcnet_timeout; 349 dev->tx_timeout = arcnet_timeout;
344 dev->get_stats = arcnet_get_stats; 350 dev->get_stats = arcnet_get_stats;
345 dev->hard_header = arcnet_header;
346 dev->rebuild_header = arcnet_rebuild_header;
347} 351}
348 352
349struct net_device *alloc_arcdev(char *name) 353struct net_device *alloc_arcdev(char *name)
@@ -488,10 +492,10 @@ static int arcnet_close(struct net_device *dev)
488 492
489 493
490static int arcnet_header(struct sk_buff *skb, struct net_device *dev, 494static int arcnet_header(struct sk_buff *skb, struct net_device *dev,
491 unsigned short type, void *daddr, void *saddr, 495 unsigned short type, const void *daddr,
492 unsigned len) 496 const void *saddr, unsigned len)
493{ 497{
494 struct arcnet_local *lp = dev->priv; 498 const struct arcnet_local *lp = netdev_priv(dev);
495 uint8_t _daddr, proto_num; 499 uint8_t _daddr, proto_num;
496 struct ArcProto *proto; 500 struct ArcProto *proto;
497 501
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 0a847326a5e4..ecd156def039 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -288,7 +288,8 @@ static int sp_close(struct net_device *dev)
288 288
289/* Return the frame type ID */ 289/* Return the frame type ID */
290static int sp_header(struct sk_buff *skb, struct net_device *dev, 290static int sp_header(struct sk_buff *skb, struct net_device *dev,
291 unsigned short type, void *daddr, void *saddr, unsigned len) 291 unsigned short type, const void *daddr,
292 const void *saddr, unsigned len)
292{ 293{
293#ifdef CONFIG_INET 294#ifdef CONFIG_INET
294 if (type != htons(ETH_P_AX25)) 295 if (type != htons(ETH_P_AX25))
@@ -323,6 +324,11 @@ static int sp_rebuild_header(struct sk_buff *skb)
323#endif 324#endif
324} 325}
325 326
327static const struct header_ops sp_header_ops = {
328 .create = sp_header,
329 .rebuild = sp_rebuild_header,
330};
331
326static void sp_setup(struct net_device *dev) 332static void sp_setup(struct net_device *dev)
327{ 333{
328 /* Finish setting up the DEVICE info. */ 334 /* Finish setting up the DEVICE info. */
@@ -331,14 +337,15 @@ static void sp_setup(struct net_device *dev)
331 dev->open = sp_open_dev; 337 dev->open = sp_open_dev;
332 dev->destructor = free_netdev; 338 dev->destructor = free_netdev;
333 dev->stop = sp_close; 339 dev->stop = sp_close;
334 dev->hard_header = sp_header; 340
335 dev->get_stats = sp_get_stats; 341 dev->get_stats = sp_get_stats;
336 dev->set_mac_address = sp_set_mac_address; 342 dev->set_mac_address = sp_set_mac_address;
337 dev->hard_header_len = AX25_MAX_HEADER_LEN; 343 dev->hard_header_len = AX25_MAX_HEADER_LEN;
344 dev->header_ops = &sp_header_ops;
345
338 dev->addr_len = AX25_ADDR_LEN; 346 dev->addr_len = AX25_ADDR_LEN;
339 dev->type = ARPHRD_AX25; 347 dev->type = ARPHRD_AX25;
340 dev->tx_queue_len = 10; 348 dev->tx_queue_len = 10;
341 dev->rebuild_header = sp_rebuild_header;
342 dev->tx_timeout = NULL; 349 dev->tx_timeout = NULL;
343 350
344 /* Only activated in AX.25 mode */ 351 /* Only activated in AX.25 mode */
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 355c6cf3d112..1a5a75acf73e 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -1159,8 +1159,7 @@ static void baycom_probe(struct net_device *dev)
1159 /* Fill in the fields of the device structure */ 1159 /* Fill in the fields of the device structure */
1160 bc->skb = NULL; 1160 bc->skb = NULL;
1161 1161
1162 dev->hard_header = ax25_hard_header; 1162 dev->header_ops = &ax25_header_ops;
1163 dev->rebuild_header = ax25_rebuild_header;
1164 dev->set_mac_address = baycom_set_mac_address; 1163 dev->set_mac_address = baycom_set_mac_address;
1165 1164
1166 dev->type = ARPHRD_AX25; /* AF_AX25 device */ 1165 dev->type = ARPHRD_AX25; /* AF_AX25 device */
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 4bff23e3b970..5ddf8b0c34f9 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -483,8 +483,7 @@ static void bpq_setup(struct net_device *dev)
483 dev->flags = 0; 483 dev->flags = 0;
484 484
485#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 485#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
486 dev->hard_header = ax25_hard_header; 486 dev->header_ops = &ax25_header_ops;
487 dev->rebuild_header = ax25_rebuild_header;
488#endif 487#endif
489 488
490 dev->type = ARPHRD_AX25; 489 dev->type = ARPHRD_AX25;
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index 205f09672492..bc02e4694804 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -581,8 +581,7 @@ static int __init setup_adapter(int card_base, int type, int n)
581 dev->do_ioctl = scc_ioctl; 581 dev->do_ioctl = scc_ioctl;
582 dev->hard_start_xmit = scc_send_packet; 582 dev->hard_start_xmit = scc_send_packet;
583 dev->get_stats = scc_get_stats; 583 dev->get_stats = scc_get_stats;
584 dev->hard_header = ax25_hard_header; 584 dev->header_ops = &ax25_header_ops;
585 dev->rebuild_header = ax25_rebuild_header;
586 dev->set_mac_address = scc_set_mac_address; 585 dev->set_mac_address = scc_set_mac_address;
587 } 586 }
588 if (register_netdev(info->dev[0])) { 587 if (register_netdev(info->dev[0])) {
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index b33adc6a340b..ae9629fa6882 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -682,8 +682,7 @@ static void hdlcdrv_setup(struct net_device *dev)
682 682
683 s->skb = NULL; 683 s->skb = NULL;
684 684
685 dev->hard_header = ax25_hard_header; 685 dev->header_ops = &ax25_header_ops;
686 dev->rebuild_header = ax25_rebuild_header;
687 dev->set_mac_address = hdlcdrv_set_mac_address; 686 dev->set_mac_address = hdlcdrv_set_mac_address;
688 687
689 dev->type = ARPHRD_AX25; /* AF_AX25 device */ 688 dev->type = ARPHRD_AX25; /* AF_AX25 device */
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index d08fbc396648..9e43c47691ca 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -578,8 +578,9 @@ static int ax_open_dev(struct net_device *dev)
578#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 578#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
579 579
580/* Return the frame type ID */ 580/* Return the frame type ID */
581static int ax_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 581static int ax_header(struct sk_buff *skb, struct net_device *dev,
582 void *daddr, void *saddr, unsigned len) 582 unsigned short type, const void *daddr,
583 const void *saddr, unsigned len)
583{ 584{
584#ifdef CONFIG_INET 585#ifdef CONFIG_INET
585 if (type != htons(ETH_P_AX25)) 586 if (type != htons(ETH_P_AX25))
@@ -670,6 +671,11 @@ static struct net_device_stats *ax_get_stats(struct net_device *dev)
670 return &ax->stats; 671 return &ax->stats;
671} 672}
672 673
674static const struct header_ops ax_header_ops = {
675 .create = ax_header,
676 .rebuild = ax_rebuild_header,
677};
678
673static void ax_setup(struct net_device *dev) 679static void ax_setup(struct net_device *dev)
674{ 680{
675 /* Finish setting up the DEVICE info. */ 681 /* Finish setting up the DEVICE info. */
@@ -683,8 +689,8 @@ static void ax_setup(struct net_device *dev)
683 dev->addr_len = 0; 689 dev->addr_len = 0;
684 dev->type = ARPHRD_AX25; 690 dev->type = ARPHRD_AX25;
685 dev->tx_queue_len = 10; 691 dev->tx_queue_len = 10;
686 dev->hard_header = ax_header; 692 dev->header_ops = &ax_header_ops;
687 dev->rebuild_header = ax_rebuild_header; 693
688 694
689 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); 695 memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
690 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); 696 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index 39b3b82aa4a4..353d13e543ce 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1551,8 +1551,8 @@ static void scc_net_setup(struct net_device *dev)
1551 dev->stop = scc_net_close; 1551 dev->stop = scc_net_close;
1552 1552
1553 dev->hard_start_xmit = scc_net_tx; 1553 dev->hard_start_xmit = scc_net_tx;
1554 dev->hard_header = ax25_hard_header; 1554 dev->header_ops = &ax25_header_ops;
1555 dev->rebuild_header = ax25_rebuild_header; 1555
1556 dev->set_mac_address = scc_net_set_mac_address; 1556 dev->set_mac_address = scc_net_set_mac_address;
1557 dev->get_stats = scc_net_get_stats; 1557 dev->get_stats = scc_net_get_stats;
1558 dev->do_ioctl = scc_net_ioctl; 1558 dev->do_ioctl = scc_net_ioctl;
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 401724ddafcd..1c942862a3f4 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -1097,8 +1097,7 @@ static void yam_setup(struct net_device *dev)
1097 1097
1098 skb_queue_head_init(&yp->send_queue); 1098 skb_queue_head_init(&yp->send_queue);
1099 1099
1100 dev->hard_header = ax25_hard_header; 1100 dev->header_ops = &ax25_header_ops;
1101 dev->rebuild_header = ax25_rebuild_header;
1102 1101
1103 dev->set_mac_address = yam_set_mac_address; 1102 dev->set_mac_address = yam_set_mac_address;
1104 1103
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index f11120b7a3b2..b6d4ae3ad506 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -221,22 +221,17 @@ static void loopback_dev_free(struct net_device *dev)
221} 221}
222 222
223/* 223/*
224 * The loopback device is special. There is only one instance and 224 * The loopback device is special. There is only one instance.
225 * it is statically allocated. Don't do this for other devices.
226 */ 225 */
227static void loopback_setup(struct net_device *dev) 226static void loopback_setup(struct net_device *dev)
228{ 227{
229 dev->get_stats = &get_stats; 228 dev->get_stats = &get_stats;
230 dev->mtu = (16 * 1024) + 20 + 20 + 12; 229 dev->mtu = (16 * 1024) + 20 + 20 + 12;
231 dev->hard_start_xmit = loopback_xmit; 230 dev->hard_start_xmit = loopback_xmit;
232 dev->hard_header = eth_header;
233 dev->hard_header_cache = eth_header_cache;
234 dev->header_cache_update = eth_header_cache_update;
235 dev->hard_header_len = ETH_HLEN; /* 14 */ 231 dev->hard_header_len = ETH_HLEN; /* 14 */
236 dev->addr_len = ETH_ALEN; /* 6 */ 232 dev->addr_len = ETH_ALEN; /* 6 */
237 dev->tx_queue_len = 0; 233 dev->tx_queue_len = 0;
238 dev->type = ARPHRD_LOOPBACK; /* 0x0001*/ 234 dev->type = ARPHRD_LOOPBACK; /* 0x0001*/
239 dev->rebuild_header = eth_rebuild_header;
240 dev->flags = IFF_LOOPBACK; 235 dev->flags = IFF_LOOPBACK;
241 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST 236 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST
242#ifdef LOOPBACK_TSO 237#ifdef LOOPBACK_TSO
@@ -247,6 +242,7 @@ static void loopback_setup(struct net_device *dev)
247 | NETIF_F_LLTX 242 | NETIF_F_LLTX
248 | NETIF_F_NETNS_LOCAL, 243 | NETIF_F_NETNS_LOCAL,
249 dev->ethtool_ops = &loopback_ethtool_ops; 244 dev->ethtool_ops = &loopback_ethtool_ops;
245 dev->header_ops = &eth_header_ops;
250 dev->init = loopback_dev_init; 246 dev->init = loopback_dev_init;
251 dev->destructor = loopback_dev_free; 247 dev->destructor = loopback_dev_free;
252} 248}
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index a22087ca968d..b7c81c874f7a 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -164,8 +164,8 @@ static int macvlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
164} 164}
165 165
166static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev, 166static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev,
167 unsigned short type, void *daddr, void *saddr, 167 unsigned short type, const void *daddr,
168 unsigned len) 168 const void *saddr, unsigned len)
169{ 169{
170 const struct macvlan_dev *vlan = netdev_priv(dev); 170 const struct macvlan_dev *vlan = netdev_priv(dev);
171 struct net_device *lowerdev = vlan->lowerdev; 171 struct net_device *lowerdev = vlan->lowerdev;
@@ -174,6 +174,15 @@ static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev,
174 saddr ? : dev->dev_addr, len); 174 saddr ? : dev->dev_addr, len);
175} 175}
176 176
177static const struct header_ops macvlan_hard_header_ops = {
178 .create = macvlan_hard_header,
179 .rebuild = eth_rebuild_header,
180 .parse = eth_header_parse,
181 .rebuild = eth_rebuild_header,
182 .cache = eth_header_cache,
183 .cache_update = eth_header_cache_update,
184};
185
177static int macvlan_open(struct net_device *dev) 186static int macvlan_open(struct net_device *dev)
178{ 187{
179 struct macvlan_dev *vlan = netdev_priv(dev); 188 struct macvlan_dev *vlan = netdev_priv(dev);
@@ -295,9 +304,9 @@ static void macvlan_setup(struct net_device *dev)
295 dev->change_mtu = macvlan_change_mtu; 304 dev->change_mtu = macvlan_change_mtu;
296 dev->change_rx_flags = macvlan_change_rx_flags; 305 dev->change_rx_flags = macvlan_change_rx_flags;
297 dev->set_multicast_list = macvlan_set_multicast_list; 306 dev->set_multicast_list = macvlan_set_multicast_list;
298 dev->hard_header = macvlan_hard_header;
299 dev->hard_start_xmit = macvlan_hard_start_xmit; 307 dev->hard_start_xmit = macvlan_hard_start_xmit;
300 dev->destructor = free_netdev; 308 dev->destructor = free_netdev;
309 dev->header_ops = &macvlan_hard_header_ops,
301 dev->ethtool_ops = &macvlan_ethtool_ops; 310 dev->ethtool_ops = &macvlan_ethtool_ops;
302 dev->tx_queue_len = 0; 311 dev->tx_queue_len = 0;
303} 312}
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index d68ee51c095f..8d29319cc5cb 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -676,8 +676,9 @@ static int myri_start_xmit(struct sk_buff *skb, struct net_device *dev)
676 * saddr=NULL means use device source address 676 * saddr=NULL means use device source address
677 * daddr=NULL means leave destination address (eg unresolved arp) 677 * daddr=NULL means leave destination address (eg unresolved arp)
678 */ 678 */
679static int myri_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, 679static int myri_header(struct sk_buff *skb, struct net_device *dev,
680 void *daddr, void *saddr, unsigned len) 680 unsigned short type, const void *daddr,
681 const void *saddr, unsigned len)
681{ 682{
682 struct ethhdr *eth = (struct ethhdr *) skb_push(skb, ETH_HLEN); 683 struct ethhdr *eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
683 unsigned char *pad = (unsigned char *) skb_push(skb, MYRI_PAD_LEN); 684 unsigned char *pad = (unsigned char *) skb_push(skb, MYRI_PAD_LEN);
@@ -759,18 +760,18 @@ static int myri_rebuild_header(struct sk_buff *skb)
759 return 0; 760 return 0;
760} 761}
761 762
762int myri_header_cache(struct neighbour *neigh, struct hh_cache *hh) 763static int myri_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
763{ 764{
764 unsigned short type = hh->hh_type; 765 unsigned short type = hh->hh_type;
765 unsigned char *pad; 766 unsigned char *pad;
766 struct ethhdr *eth; 767 struct ethhdr *eth;
767 struct net_device *dev = neigh->dev; 768 const struct net_device *dev = neigh->dev;
768 769
769 pad = ((unsigned char *) hh->hh_data) + 770 pad = ((unsigned char *) hh->hh_data) +
770 HH_DATA_OFF(sizeof(*eth) + MYRI_PAD_LEN); 771 HH_DATA_OFF(sizeof(*eth) + MYRI_PAD_LEN);
771 eth = (struct ethhdr *) (pad + MYRI_PAD_LEN); 772 eth = (struct ethhdr *) (pad + MYRI_PAD_LEN);
772 773
773 if (type == __constant_htons(ETH_P_802_3)) 774 if (type == htons(ETH_P_802_3))
774 return -1; 775 return -1;
775 776
776 /* Refill MyriNet padding identifiers, this is just being anal. */ 777 /* Refill MyriNet padding identifiers, this is just being anal. */
@@ -786,7 +787,9 @@ int myri_header_cache(struct neighbour *neigh, struct hh_cache *hh)
786 787
787 788
788/* Called by Address Resolution module to notify changes in address. */ 789/* Called by Address Resolution module to notify changes in address. */
789void myri_header_cache_update(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr) 790void myri_header_cache_update(struct hh_cache *hh,
791 const struct net_device *dev,
792 const unsigned char * haddr)
790{ 793{
791 memcpy(((u8*)hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)), 794 memcpy(((u8*)hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
792 haddr, dev->addr_len); 795 haddr, dev->addr_len);
@@ -881,6 +884,13 @@ static void dump_eeprom(struct myri_eth *mp)
881} 884}
882#endif 885#endif
883 886
887static const struct header_ops myri_header_ops = {
888 .create = myri_header,
889 .rebuild = myri_rebuild_header,
890 .cache = myri_header_cache,
891 .cache_update = myri_header_cache_update,
892};
893
884static int __devinit myri_ether_init(struct sbus_dev *sdev) 894static int __devinit myri_ether_init(struct sbus_dev *sdev)
885{ 895{
886 static int num; 896 static int num;
@@ -1065,11 +1075,9 @@ static int __devinit myri_ether_init(struct sbus_dev *sdev)
1065 1075
1066 dev->mtu = MYRINET_MTU; 1076 dev->mtu = MYRINET_MTU;
1067 dev->change_mtu = myri_change_mtu; 1077 dev->change_mtu = myri_change_mtu;
1068 dev->hard_header = myri_header; 1078 dev->header_ops = &myri_header_ops;
1069 dev->rebuild_header = myri_rebuild_header; 1079
1070 dev->hard_header_len = (ETH_HLEN + MYRI_PAD_LEN); 1080 dev->hard_header_len = (ETH_HLEN + MYRI_PAD_LEN);
1071 dev->hard_header_cache = myri_header_cache;
1072 dev->header_cache_update= myri_header_cache_update;
1073 1081
1074 /* Load code onto the LANai. */ 1082 /* Load code onto the LANai. */
1075 DET(("Loading LANAI firmware\n")); 1083 DET(("Loading LANAI firmware\n"));
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index c17d9ac9ff30..b5e9981d1060 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -148,9 +148,9 @@ static void plip_interrupt(int irq, void *dev_id);
148/* Functions for DEV methods */ 148/* Functions for DEV methods */
149static int plip_tx_packet(struct sk_buff *skb, struct net_device *dev); 149static int plip_tx_packet(struct sk_buff *skb, struct net_device *dev);
150static int plip_hard_header(struct sk_buff *skb, struct net_device *dev, 150static int plip_hard_header(struct sk_buff *skb, struct net_device *dev,
151 unsigned short type, void *daddr, 151 unsigned short type, const void *daddr,
152 void *saddr, unsigned len); 152 const void *saddr, unsigned len);
153static int plip_hard_header_cache(struct neighbour *neigh, 153static int plip_hard_header_cache(const struct neighbour *neigh,
154 struct hh_cache *hh); 154 struct hh_cache *hh);
155static int plip_open(struct net_device *dev); 155static int plip_open(struct net_device *dev);
156static int plip_close(struct net_device *dev); 156static int plip_close(struct net_device *dev);
@@ -219,11 +219,6 @@ struct net_local {
219 int is_deferred; 219 int is_deferred;
220 int port_owner; 220 int port_owner;
221 int should_relinquish; 221 int should_relinquish;
222 int (*orig_hard_header)(struct sk_buff *skb, struct net_device *dev,
223 unsigned short type, void *daddr,
224 void *saddr, unsigned len);
225 int (*orig_hard_header_cache)(struct neighbour *neigh,
226 struct hh_cache *hh);
227 spinlock_t lock; 222 spinlock_t lock;
228 atomic_t kill_timer; 223 atomic_t kill_timer;
229 struct semaphore killed_timer_sem; 224 struct semaphore killed_timer_sem;
@@ -265,6 +260,11 @@ static inline unsigned char read_status (struct net_device *dev)
265 return port->ops->read_status (port); 260 return port->ops->read_status (port);
266} 261}
267 262
263static const struct header_ops plip_header_ops = {
264 .create = plip_hard_header,
265 .cache = plip_hard_header_cache,
266};
267
268/* Entry point of PLIP driver. 268/* Entry point of PLIP driver.
269 Probe the hardware, and register/initialize the driver. 269 Probe the hardware, and register/initialize the driver.
270 270
@@ -284,17 +284,12 @@ plip_init_netdev(struct net_device *dev)
284 dev->open = plip_open; 284 dev->open = plip_open;
285 dev->stop = plip_close; 285 dev->stop = plip_close;
286 dev->do_ioctl = plip_ioctl; 286 dev->do_ioctl = plip_ioctl;
287 dev->header_cache_update = NULL; 287
288 dev->tx_queue_len = 10; 288 dev->tx_queue_len = 10;
289 dev->flags = IFF_POINTOPOINT|IFF_NOARP; 289 dev->flags = IFF_POINTOPOINT|IFF_NOARP;
290 memset(dev->dev_addr, 0xfc, ETH_ALEN); 290 memset(dev->dev_addr, 0xfc, ETH_ALEN);
291 291
292 /* Set the private structure */ 292 dev->header_ops = &plip_header_ops;
293 nl->orig_hard_header = dev->hard_header;
294 dev->hard_header = plip_hard_header;
295
296 nl->orig_hard_header_cache = dev->hard_header_cache;
297 dev->hard_header_cache = plip_hard_header_cache;
298 293
299 294
300 nl->port_owner = 0; 295 nl->port_owner = 0;
@@ -993,14 +988,14 @@ plip_tx_packet(struct sk_buff *skb, struct net_device *dev)
993} 988}
994 989
995static void 990static void
996plip_rewrite_address(struct net_device *dev, struct ethhdr *eth) 991plip_rewrite_address(const struct net_device *dev, struct ethhdr *eth)
997{ 992{
998 struct in_device *in_dev; 993 const struct in_device *in_dev = dev->ip_ptr;
999 994
1000 if ((in_dev=dev->ip_ptr) != NULL) { 995 if (in_dev) {
1001 /* Any address will do - we take the first */ 996 /* Any address will do - we take the first */
1002 struct in_ifaddr *ifa=in_dev->ifa_list; 997 const struct in_ifaddr *ifa = in_dev->ifa_list;
1003 if (ifa != NULL) { 998 if (ifa) {
1004 memcpy(eth->h_source, dev->dev_addr, 6); 999 memcpy(eth->h_source, dev->dev_addr, 6);
1005 memset(eth->h_dest, 0xfc, 2); 1000 memset(eth->h_dest, 0xfc, 2);
1006 memcpy(eth->h_dest+2, &ifa->ifa_address, 4); 1001 memcpy(eth->h_dest+2, &ifa->ifa_address, 4);
@@ -1010,26 +1005,25 @@ plip_rewrite_address(struct net_device *dev, struct ethhdr *eth)
1010 1005
1011static int 1006static int
1012plip_hard_header(struct sk_buff *skb, struct net_device *dev, 1007plip_hard_header(struct sk_buff *skb, struct net_device *dev,
1013 unsigned short type, void *daddr, 1008 unsigned short type, const void *daddr,
1014 void *saddr, unsigned len) 1009 const void *saddr, unsigned len)
1015{ 1010{
1016 struct net_local *nl = netdev_priv(dev);
1017 int ret; 1011 int ret;
1018 1012
1019 if ((ret = nl->orig_hard_header(skb, dev, type, daddr, saddr, len)) >= 0) 1013 ret = eth_header(skb, dev, type, daddr, saddr, len);
1014 if (ret >= 0)
1020 plip_rewrite_address (dev, (struct ethhdr *)skb->data); 1015 plip_rewrite_address (dev, (struct ethhdr *)skb->data);
1021 1016
1022 return ret; 1017 return ret;
1023} 1018}
1024 1019
1025int plip_hard_header_cache(struct neighbour *neigh, 1020int plip_hard_header_cache(const struct neighbour *neigh,
1026 struct hh_cache *hh) 1021 struct hh_cache *hh)
1027{ 1022{
1028 struct net_local *nl = neigh->dev->priv;
1029 int ret; 1023 int ret;
1030 1024
1031 if ((ret = nl->orig_hard_header_cache(neigh, hh)) == 0) 1025 ret = eth_header_cache(neigh, hh);
1032 { 1026 if (ret == 0) {
1033 struct ethhdr *eth; 1027 struct ethhdr *eth;
1034 1028
1035 eth = (struct ethhdr*)(((u8*)hh->hh_data) + 1029 eth = (struct ethhdr*)(((u8*)hh->hh_data) +
diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c
index 315feba7dacc..228f650250f6 100644
--- a/drivers/net/shaper.c
+++ b/drivers/net/shaper.c
@@ -331,15 +331,16 @@ static int shaper_close(struct net_device *dev)
331 */ 331 */
332 332
333static int shaper_header(struct sk_buff *skb, struct net_device *dev, 333static int shaper_header(struct sk_buff *skb, struct net_device *dev,
334 unsigned short type, void *daddr, void *saddr, unsigned len) 334 unsigned short type,
335 const void *daddr, const void *saddr, unsigned len)
335{ 336{
336 struct shaper *sh=dev->priv; 337 struct shaper *sh=dev->priv;
337 int v; 338 int v;
338 if(sh_debug) 339 if(sh_debug)
339 printk("Shaper header\n"); 340 printk("Shaper header\n");
340 skb->dev=sh->dev; 341 skb->dev = sh->dev;
341 v=sh->hard_header(skb,sh->dev,type,daddr,saddr,len); 342 v = dev_hard_header(skb, sh->dev, type, daddr, saddr, len);
342 skb->dev=dev; 343 skb->dev = dev;
343 return v; 344 return v;
344} 345}
345 346
@@ -351,7 +352,7 @@ static int shaper_rebuild_header(struct sk_buff *skb)
351 if(sh_debug) 352 if(sh_debug)
352 printk("Shaper rebuild header\n"); 353 printk("Shaper rebuild header\n");
353 skb->dev=sh->dev; 354 skb->dev=sh->dev;
354 v=sh->rebuild_header(skb); 355 v = sh->dev->header_ops->rebuild(skb);
355 skb->dev=dev; 356 skb->dev=dev;
356 return v; 357 return v;
357} 358}
@@ -415,51 +416,17 @@ static int shaper_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p)
415 416
416#endif 417#endif
417 418
419static const struct header_ops shaper_ops = {
420 .create = shaper_header,
421 .rebuild = shaper_rebuild_header,
422};
423
418static int shaper_attach(struct net_device *shdev, struct shaper *sh, struct net_device *dev) 424static int shaper_attach(struct net_device *shdev, struct shaper *sh, struct net_device *dev)
419{ 425{
420 sh->dev = dev; 426 sh->dev = dev;
421 sh->hard_start_xmit=dev->hard_start_xmit;
422 sh->get_stats=dev->get_stats; 427 sh->get_stats=dev->get_stats;
423 if(dev->hard_header)
424 {
425 sh->hard_header=dev->hard_header;
426 shdev->hard_header = shaper_header;
427 }
428 else
429 shdev->hard_header = NULL;
430 428
431 if(dev->rebuild_header)
432 {
433 sh->rebuild_header = dev->rebuild_header;
434 shdev->rebuild_header = shaper_rebuild_header;
435 }
436 else
437 shdev->rebuild_header = NULL;
438
439#if 0
440 if(dev->hard_header_cache)
441 {
442 sh->hard_header_cache = dev->hard_header_cache;
443 shdev->hard_header_cache= shaper_cache;
444 }
445 else
446 {
447 shdev->hard_header_cache= NULL;
448 }
449
450 if(dev->header_cache_update)
451 {
452 sh->header_cache_update = dev->header_cache_update;
453 shdev->header_cache_update = shaper_cache_update;
454 }
455 else
456 shdev->header_cache_update= NULL;
457#else
458 shdev->header_cache_update = NULL;
459 shdev->hard_header_cache = NULL;
460#endif
461 shdev->neigh_setup = shaper_neigh_setup_dev; 429 shdev->neigh_setup = shaper_neigh_setup_dev;
462
463 shdev->hard_header_len=dev->hard_header_len; 430 shdev->hard_header_len=dev->hard_header_len;
464 shdev->type=dev->type; 431 shdev->type=dev->type;
465 shdev->addr_len=dev->addr_len; 432 shdev->addr_len=dev->addr_len;
@@ -542,12 +509,6 @@ static void __init shaper_setup(struct net_device *dev)
542 * Handlers for when we attach to a device. 509 * Handlers for when we attach to a device.
543 */ 510 */
544 511
545 dev->hard_header = shaper_header;
546 dev->rebuild_header = shaper_rebuild_header;
547#if 0
548 dev->hard_header_cache = shaper_cache;
549 dev->header_cache_update= shaper_cache_update;
550#endif
551 dev->neigh_setup = shaper_neigh_setup_dev; 512 dev->neigh_setup = shaper_neigh_setup_dev;
552 dev->do_ioctl = shaper_ioctl; 513 dev->do_ioctl = shaper_ioctl;
553 dev->hard_header_len = 0; 514 dev->hard_header_len = 0;
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index ca508708229d..7cf9b9f35dee 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -260,7 +260,6 @@ static int skfp_init_one(struct pci_dev *pdev,
260 dev->set_multicast_list = &skfp_ctl_set_multicast_list; 260 dev->set_multicast_list = &skfp_ctl_set_multicast_list;
261 dev->set_mac_address = &skfp_ctl_set_mac_address; 261 dev->set_mac_address = &skfp_ctl_set_mac_address;
262 dev->do_ioctl = &skfp_ioctl; 262 dev->do_ioctl = &skfp_ioctl;
263 dev->header_cache_update = NULL; /* not supported */
264 263
265 SET_NETDEV_DEV(dev, &pdev->dev); 264 SET_NETDEV_DEV(dev, &pdev->dev);
266 265
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c
index 46e053106d4d..8a1778cf98d1 100644
--- a/drivers/net/wan/cycx_x25.c
+++ b/drivers/net/wan/cycx_x25.c
@@ -131,14 +131,15 @@ static int cycx_wan_update(struct wan_device *wandev),
131 cycx_wan_del_if(struct wan_device *wandev, struct net_device *dev); 131 cycx_wan_del_if(struct wan_device *wandev, struct net_device *dev);
132 132
133/* Network device interface */ 133/* Network device interface */
134static int cycx_netdevice_init(struct net_device *dev), 134static int cycx_netdevice_init(struct net_device *dev);
135 cycx_netdevice_open(struct net_device *dev), 135static int cycx_netdevice_open(struct net_device *dev);
136 cycx_netdevice_stop(struct net_device *dev), 136static int cycx_netdevice_stop(struct net_device *dev);
137 cycx_netdevice_hard_header(struct sk_buff *skb, 137static int cycx_netdevice_hard_header(struct sk_buff *skb,
138 struct net_device *dev, u16 type, 138 struct net_device *dev, u16 type,
139 void *daddr, void *saddr, unsigned len), 139 const void *daddr, const void *saddr,
140 cycx_netdevice_rebuild_header(struct sk_buff *skb), 140 unsigned len);
141 cycx_netdevice_hard_start_xmit(struct sk_buff *skb, 141static int cycx_netdevice_rebuild_header(struct sk_buff *skb);
142static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
142 struct net_device *dev); 143 struct net_device *dev);
143 144
144static struct net_device_stats * 145static struct net_device_stats *
@@ -468,7 +469,14 @@ static int cycx_wan_del_if(struct wan_device *wandev, struct net_device *dev)
468 return 0; 469 return 0;
469} 470}
470 471
472
471/* Network Device Interface */ 473/* Network Device Interface */
474
475static const struct header_ops cycx_header_ops = {
476 .create = cycx_netdevice_hard_header,
477 .rebuild = cycx_netdevice_rebuild_header,
478};
479
472/* Initialize Linux network interface. 480/* Initialize Linux network interface.
473 * 481 *
474 * This routine is called only once for each interface, during Linux network 482 * 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)
483 /* Initialize device driver entry points */ 491 /* Initialize device driver entry points */
484 dev->open = cycx_netdevice_open; 492 dev->open = cycx_netdevice_open;
485 dev->stop = cycx_netdevice_stop; 493 dev->stop = cycx_netdevice_stop;
486 dev->hard_header = cycx_netdevice_hard_header; 494 dev->header_ops = &cycx_header_ops;
487 dev->rebuild_header = cycx_netdevice_rebuild_header; 495
488 dev->hard_start_xmit = cycx_netdevice_hard_start_xmit; 496 dev->hard_start_xmit = cycx_netdevice_hard_start_xmit;
489 dev->get_stats = cycx_netdevice_get_stats; 497 dev->get_stats = cycx_netdevice_get_stats;
490 498
@@ -554,7 +562,8 @@ static int cycx_netdevice_stop(struct net_device *dev)
554 * Return: media header length. */ 562 * Return: media header length. */
555static int cycx_netdevice_hard_header(struct sk_buff *skb, 563static int cycx_netdevice_hard_header(struct sk_buff *skb,
556 struct net_device *dev, u16 type, 564 struct net_device *dev, u16 type,
557 void *daddr, void *saddr, unsigned len) 565 const void *daddr, const void *saddr,
566 unsigned len)
558{ 567{
559 skb->protocol = type; 568 skb->protocol = type;
560 569
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
index bc12810157e0..96b232446c0b 100644
--- a/drivers/net/wan/dlci.c
+++ b/drivers/net/wan/dlci.c
@@ -66,8 +66,8 @@ static void dlci_setup(struct net_device *);
66 */ 66 */
67 67
68static int dlci_header(struct sk_buff *skb, struct net_device *dev, 68static int dlci_header(struct sk_buff *skb, struct net_device *dev,
69 unsigned short type, void *daddr, void *saddr, 69 unsigned short type, const void *daddr,
70 unsigned len) 70 const void *saddr, unsigned len)
71{ 71{
72 struct frhdr hdr; 72 struct frhdr hdr;
73 struct dlci_local *dlp; 73 struct dlci_local *dlp;
@@ -485,6 +485,10 @@ static int dlci_ioctl(unsigned int cmd, void __user *arg)
485 return(err); 485 return(err);
486} 486}
487 487
488static const struct header_ops dlci_header_ops = {
489 .create = dlci_header,
490};
491
488static void dlci_setup(struct net_device *dev) 492static void dlci_setup(struct net_device *dev)
489{ 493{
490 struct dlci_local *dlp = dev->priv; 494 struct dlci_local *dlp = dev->priv;
@@ -494,7 +498,7 @@ static void dlci_setup(struct net_device *dev)
494 dev->stop = dlci_close; 498 dev->stop = dlci_close;
495 dev->do_ioctl = dlci_dev_ioctl; 499 dev->do_ioctl = dlci_dev_ioctl;
496 dev->hard_start_xmit = dlci_transmit; 500 dev->hard_start_xmit = dlci_transmit;
497 dev->hard_header = dlci_header; 501 dev->header_ops = &dlci_header_ops;
498 dev->get_stats = dlci_get_stats; 502 dev->get_stats = dlci_get_stats;
499 dev->change_mtu = dlci_change_mtu; 503 dev->change_mtu = dlci_change_mtu;
500 dev->destructor = free_netdev; 504 dev->destructor = free_netdev;
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index ee23b91f23d9..d553e6f32851 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -232,6 +232,8 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
232 return -EINVAL; 232 return -EINVAL;
233} 233}
234 234
235static const struct header_ops hdlc_null_ops;
236
235static void hdlc_setup_dev(struct net_device *dev) 237static void hdlc_setup_dev(struct net_device *dev)
236{ 238{
237 /* Re-init all variables changed by HDLC protocol drivers, 239 /* Re-init all variables changed by HDLC protocol drivers,
@@ -243,13 +245,9 @@ static void hdlc_setup_dev(struct net_device *dev)
243 dev->type = ARPHRD_RAWHDLC; 245 dev->type = ARPHRD_RAWHDLC;
244 dev->hard_header_len = 16; 246 dev->hard_header_len = 16;
245 dev->addr_len = 0; 247 dev->addr_len = 0;
246 dev->hard_header = NULL; 248 dev->header_ops = &hdlc_null_ops;
247 dev->rebuild_header = NULL; 249
248 dev->set_mac_address = NULL;
249 dev->hard_header_cache = NULL;
250 dev->header_cache_update = NULL;
251 dev->change_mtu = hdlc_change_mtu; 250 dev->change_mtu = hdlc_change_mtu;
252 dev->hard_header_parse = NULL;
253} 251}
254 252
255static void hdlc_setup(struct net_device *dev) 253static void hdlc_setup(struct net_device *dev)
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index 9ec6cf2e510e..038a6e748bbf 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -74,7 +74,7 @@ static inline struct cisco_state * state(hdlc_device *hdlc)
74 74
75 75
76static int cisco_hard_header(struct sk_buff *skb, struct net_device *dev, 76static int cisco_hard_header(struct sk_buff *skb, struct net_device *dev,
77 u16 type, void *daddr, void *saddr, 77 u16 type, const void *daddr, const void *saddr,
78 unsigned int len) 78 unsigned int len)
79{ 79{
80 struct hdlc_header *data; 80 struct hdlc_header *data;
@@ -309,7 +309,6 @@ static void cisco_stop(struct net_device *dev)
309} 309}
310 310
311 311
312
313static struct hdlc_proto proto = { 312static struct hdlc_proto proto = {
314 .start = cisco_start, 313 .start = cisco_start,
315 .stop = cisco_stop, 314 .stop = cisco_stop,
@@ -317,7 +316,10 @@ static struct hdlc_proto proto = {
317 .ioctl = cisco_ioctl, 316 .ioctl = cisco_ioctl,
318 .module = THIS_MODULE, 317 .module = THIS_MODULE,
319}; 318};
320 319
320static const struct header_ops cisco_header_ops = {
321 .create = cisco_hard_header,
322};
321 323
322static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr) 324static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
323{ 325{
@@ -365,7 +367,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
365 367
366 memcpy(&state(hdlc)->settings, &new_settings, size); 368 memcpy(&state(hdlc)->settings, &new_settings, size);
367 dev->hard_start_xmit = hdlc->xmit; 369 dev->hard_start_xmit = hdlc->xmit;
368 dev->hard_header = cisco_hard_header; 370 dev->header_ops = &cisco_header_ops;
369 dev->type = ARPHRD_CISCO; 371 dev->type = ARPHRD_CISCO;
370 netif_dormant_on(dev); 372 netif_dormant_on(dev);
371 return 0; 373 return 0;
diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index 4591437dd2f3..3caeb528eace 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -73,7 +73,7 @@ static void ppp_close(struct net_device *dev)
73 73
74 sppp_close(dev); 74 sppp_close(dev);
75 sppp_detach(dev); 75 sppp_detach(dev);
76 dev->rebuild_header = NULL; 76
77 dev->change_mtu = state(hdlc)->old_change_mtu; 77 dev->change_mtu = state(hdlc)->old_change_mtu;
78 dev->mtu = HDLC_MAX_MTU; 78 dev->mtu = HDLC_MAX_MTU;
79 dev->hard_header_len = 16; 79 dev->hard_header_len = 16;
diff --git a/drivers/net/wan/lmc/lmc_proto.c b/drivers/net/wan/lmc/lmc_proto.c
index 31e1799571ad..426c0678d983 100644
--- a/drivers/net/wan/lmc/lmc_proto.c
+++ b/drivers/net/wan/lmc/lmc_proto.c
@@ -111,7 +111,7 @@ void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
111 * They set a few basics because they don't use sync_ppp 111 * They set a few basics because they don't use sync_ppp
112 */ 112 */
113 dev->flags |= IFF_POINTOPOINT; 113 dev->flags |= IFF_POINTOPOINT;
114 dev->hard_header = NULL; 114
115 dev->hard_header_len = 0; 115 dev->hard_header_len = 0;
116 dev->addr_len = 0; 116 dev->addr_len = 0;
117 } 117 }
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index 5c71af6ea3a5..232ecba5340f 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -359,8 +359,10 @@ done:
359 * Handle transmit packets. 359 * Handle transmit packets.
360 */ 360 */
361 361
362static int sppp_hard_header(struct sk_buff *skb, struct net_device *dev, __u16 type, 362static int sppp_hard_header(struct sk_buff *skb,
363 void *daddr, void *saddr, unsigned int len) 363 struct net_device *dev, __u16 type,
364 const void *daddr, const void *saddr,
365 unsigned int len)
364{ 366{
365 struct sppp *sp = (struct sppp *)sppp_of(dev); 367 struct sppp *sp = (struct sppp *)sppp_of(dev);
366 struct ppp_header *h; 368 struct ppp_header *h;
@@ -392,10 +394,9 @@ static int sppp_hard_header(struct sk_buff *skb, struct net_device *dev, __u16 t
392 return sizeof(struct ppp_header); 394 return sizeof(struct ppp_header);
393} 395}
394 396
395static int sppp_rebuild_header(struct sk_buff *skb) 397static const struct header_ops sppp_header_ops = {
396{ 398 .create = sppp_hard_header,
397 return 0; 399};
398}
399 400
400/* 401/*
401 * Send keepalive packets, every 10 seconds. 402 * Send keepalive packets, every 10 seconds.
@@ -1098,8 +1099,8 @@ void sppp_attach(struct ppp_device *pd)
1098 * hard_start_xmit. 1099 * hard_start_xmit.
1099 */ 1100 */
1100 1101
1101 dev->hard_header = sppp_hard_header; 1102 dev->header_ops = &sppp_header_ops;
1102 dev->rebuild_header = sppp_rebuild_header; 1103
1103 dev->tx_queue_len = 10; 1104 dev->tx_queue_len = 10;
1104 dev->type = ARPHRD_HDLC; 1105 dev->type = ARPHRD_HDLC;
1105 dev->addr_len = 0; 1106 dev->addr_len = 0;
@@ -1115,8 +1116,6 @@ void sppp_attach(struct ppp_device *pd)
1115 dev->stop = sppp_close; 1116 dev->stop = sppp_close;
1116#endif 1117#endif
1117 dev->change_mtu = sppp_change_mtu; 1118 dev->change_mtu = sppp_change_mtu;
1118 dev->hard_header_cache = NULL;
1119 dev->header_cache_update = NULL;
1120 dev->flags = IFF_MULTICAST|IFF_POINTOPOINT|IFF_NOARP; 1119 dev->flags = IFF_MULTICAST|IFF_POINTOPOINT|IFF_NOARP;
1121} 1120}
1122 1121
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index cd03a61359aa..074055e18c5c 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2696,9 +2696,13 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci)
2696 return rc; 2696 return rc;
2697} 2697}
2698 2698
2699static const struct header_ops airo_header_ops = {
2700 .parse = wll_header_parse,
2701};
2702
2699static void wifi_setup(struct net_device *dev) 2703static void wifi_setup(struct net_device *dev)
2700{ 2704{
2701 dev->hard_header_parse = wll_header_parse; 2705 dev->header_ops = &airo_header_ops;
2702 dev->hard_start_xmit = &airo_start_xmit11; 2706 dev->hard_start_xmit = &airo_start_xmit11;
2703 dev->get_stats = &airo_get_stats; 2707 dev->get_stats = &airo_get_stats;
2704 dev->set_mac_address = &airo_set_mac_address; 2708 dev->set_mac_address = &airo_set_mac_address;
diff --git a/drivers/net/wireless/hostap/hostap.h b/drivers/net/wireless/hostap/hostap.h
index ef37a75d550b..951df83702f9 100644
--- a/drivers/net/wireless/hostap/hostap.h
+++ b/drivers/net/wireless/hostap/hostap.h
@@ -30,8 +30,7 @@ void hostap_dump_rx_header(const char *name,
30 const struct hfa384x_rx_frame *rx); 30 const struct hfa384x_rx_frame *rx);
31void hostap_dump_tx_header(const char *name, 31void hostap_dump_tx_header(const char *name,
32 const struct hfa384x_tx_frame *tx); 32 const struct hfa384x_tx_frame *tx);
33int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr); 33extern const struct header_ops hostap_80211_ops;
34int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr);
35int hostap_80211_get_hdrlen(u16 fc); 34int hostap_80211_get_hdrlen(u16 fc);
36struct net_device_stats *hostap_get_stats(struct net_device *dev); 35struct net_device_stats *hostap_get_stats(struct net_device *dev);
37void hostap_setup_dev(struct net_device *dev, local_info_t *local, 36void hostap_setup_dev(struct net_device *dev, local_info_t *local,
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index 7fa7ab0a4b23..b20bb013d57e 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -3258,11 +3258,10 @@ while (0)
3258 INIT_LIST_HEAD(&local->bss_list); 3258 INIT_LIST_HEAD(&local->bss_list);
3259 3259
3260 hostap_setup_dev(dev, local, 1); 3260 hostap_setup_dev(dev, local, 1);
3261 local->saved_eth_header_parse = dev->hard_header_parse;
3262 3261
3263 dev->hard_start_xmit = hostap_master_start_xmit; 3262 dev->hard_start_xmit = hostap_master_start_xmit;
3264 dev->type = ARPHRD_IEEE80211; 3263 dev->type = ARPHRD_IEEE80211;
3265 dev->hard_header_parse = hostap_80211_header_parse; 3264 dev->header_ops = &hostap_80211_ops;
3266 3265
3267 rtnl_lock(); 3266 rtnl_lock();
3268 ret = dev_alloc_name(dev, "wifi%d"); 3267 ret = dev_alloc_name(dev, "wifi%d");
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 7036ecff5ec1..40f516d42c5e 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -897,11 +897,8 @@ static void hostap_monitor_set_type(local_info_t *local)
897 if (local->monitor_type == PRISM2_MONITOR_PRISM || 897 if (local->monitor_type == PRISM2_MONITOR_PRISM ||
898 local->monitor_type == PRISM2_MONITOR_CAPHDR) { 898 local->monitor_type == PRISM2_MONITOR_CAPHDR) {
899 dev->type = ARPHRD_IEEE80211_PRISM; 899 dev->type = ARPHRD_IEEE80211_PRISM;
900 dev->hard_header_parse =
901 hostap_80211_prism_header_parse;
902 } else { 900 } else {
903 dev->type = ARPHRD_IEEE80211; 901 dev->type = ARPHRD_IEEE80211;
904 dev->hard_header_parse = hostap_80211_header_parse;
905 } 902 }
906} 903}
907 904
@@ -1141,7 +1138,7 @@ static int hostap_monitor_mode_disable(local_info_t *local)
1141 1138
1142 printk(KERN_DEBUG "%s: Disabling monitor mode\n", dev->name); 1139 printk(KERN_DEBUG "%s: Disabling monitor mode\n", dev->name);
1143 dev->type = ARPHRD_ETHER; 1140 dev->type = ARPHRD_ETHER;
1144 dev->hard_header_parse = local->saved_eth_header_parse; 1141
1145 if (local->func->cmd(dev, HFA384X_CMDCODE_TEST | 1142 if (local->func->cmd(dev, HFA384X_CMDCODE_TEST |
1146 (HFA384X_TEST_STOP << 8), 1143 (HFA384X_TEST_STOP << 8),
1147 0, NULL, NULL)) 1144 0, NULL, NULL))
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 4cb09d81b404..b75cf9205ce0 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -594,24 +594,27 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
594} 594}
595 595
596 596
597int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr) 597int hostap_80211_header_parse(const struct sk_buff *skb, unsigned char *haddr)
598{ 598{
599 memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ 599 struct hostap_interface *iface = netdev_priv(skb->dev);
600 return ETH_ALEN; 600 local_info_t *local = iface->local;
601} 601
602 602 if (local->monitor_type == PRISM2_MONITOR_PRISM ||
603 local->monitor_type == PRISM2_MONITOR_CAPHDR) {
604 const unsigned char *mac = skb_mac_header(skb);
605
606 if (*(u32 *)mac == LWNG_CAP_DID_BASE) {
607 memcpy(haddr,
608 mac + sizeof(struct linux_wlan_ng_prism_hdr) + 10,
609 ETH_ALEN); /* addr2 */
610 } else { /* (*(u32 *)mac == htonl(LWNG_CAPHDR_VERSION)) */
611 memcpy(haddr,
612 mac + sizeof(struct linux_wlan_ng_cap_hdr) + 10,
613 ETH_ALEN); /* addr2 */
614 }
615 } else
616 memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */
603 617
604int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr)
605{
606 const unsigned char *mac = skb_mac_header(skb);
607
608 if (*(u32 *)mac == LWNG_CAP_DID_BASE) {
609 memcpy(haddr, mac + sizeof(struct linux_wlan_ng_prism_hdr) + 10,
610 ETH_ALEN); /* addr2 */
611 } else { /* (*(u32 *)mac == htonl(LWNG_CAPHDR_VERSION)) */
612 memcpy(haddr, mac + sizeof(struct linux_wlan_ng_cap_hdr) + 10,
613 ETH_ALEN); /* addr2 */
614 }
615 return ETH_ALEN; 618 return ETH_ALEN;
616} 619}
617 620
@@ -843,6 +846,15 @@ static void prism2_tx_timeout(struct net_device *dev)
843 local->func->schedule_reset(local); 846 local->func->schedule_reset(local);
844} 847}
845 848
849const struct header_ops hostap_80211_ops = {
850 .create = eth_header,
851 .rebuild = eth_rebuild_header,
852 .cache = eth_header_cache,
853 .cache_update = eth_header_cache_update,
854
855 .parse = hostap_80211_header_parse,
856};
857EXPORT_SYMBOL(hostap_80211_ops);
846 858
847void hostap_setup_dev(struct net_device *dev, local_info_t *local, 859void hostap_setup_dev(struct net_device *dev, local_info_t *local,
848 int main_dev) 860 int main_dev)
@@ -883,7 +895,6 @@ void hostap_setup_dev(struct net_device *dev, local_info_t *local,
883 netif_stop_queue(dev); 895 netif_stop_queue(dev);
884} 896}
885 897
886
887static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked) 898static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked)
888{ 899{
889 struct net_device *dev = local->dev; 900 struct net_device *dev = local->dev;
@@ -901,7 +912,7 @@ static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked)
901 912
902 local->apdev->hard_start_xmit = hostap_mgmt_start_xmit; 913 local->apdev->hard_start_xmit = hostap_mgmt_start_xmit;
903 local->apdev->type = ARPHRD_IEEE80211; 914 local->apdev->type = ARPHRD_IEEE80211;
904 local->apdev->hard_header_parse = hostap_80211_header_parse; 915 local->apdev->header_ops = &hostap_80211_ops;
905 916
906 return 0; 917 return 0;
907} 918}
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
index a42325c145b4..c27b2c1c06af 100644
--- a/drivers/net/wireless/hostap/hostap_wlan.h
+++ b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -736,8 +736,6 @@ struct local_info {
736 PRISM2_MONITOR_80211 = 0, PRISM2_MONITOR_PRISM = 1, 736 PRISM2_MONITOR_80211 = 0, PRISM2_MONITOR_PRISM = 1,
737 PRISM2_MONITOR_CAPHDR = 2 737 PRISM2_MONITOR_CAPHDR = 2
738 } monitor_type; 738 } monitor_type;
739 int (*saved_eth_header_parse)(struct sk_buff *skb,
740 unsigned char *haddr);
741 int monitor_allow_fcserr; 739 int monitor_allow_fcserr;
742 740
743 int hostapd; /* whether user space daemon, hostapd, is used for AP 741 int hostapd; /* whether user space daemon, hostapd, is used for AP
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 404cd1512312..4bd14b331862 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -1631,8 +1631,8 @@ static void strip_IdleTask(unsigned long parameter)
1631 */ 1631 */
1632 1632
1633static int strip_header(struct sk_buff *skb, struct net_device *dev, 1633static int strip_header(struct sk_buff *skb, struct net_device *dev,
1634 unsigned short type, void *daddr, void *saddr, 1634 unsigned short type, const void *daddr,
1635 unsigned len) 1635 const void *saddr, unsigned len)
1636{ 1636{
1637 struct strip *strip_info = netdev_priv(dev); 1637 struct strip *strip_info = netdev_priv(dev);
1638 STRIP_Header *header = (STRIP_Header *) skb_push(skb, sizeof(STRIP_Header)); 1638 STRIP_Header *header = (STRIP_Header *) skb_push(skb, sizeof(STRIP_Header));
@@ -2497,6 +2497,11 @@ static int strip_close_low(struct net_device *dev)
2497 return 0; 2497 return 0;
2498} 2498}
2499 2499
2500static const struct header_ops strip_header_ops = {
2501 .create = strip_header,
2502 .rebuild = strip_rebuild_header,
2503};
2504
2500/* 2505/*
2501 * This routine is called by DDI when the 2506 * This routine is called by DDI when the
2502 * (dynamically assigned) device is registered 2507 * (dynamically assigned) device is registered
@@ -2531,8 +2536,8 @@ static void strip_dev_setup(struct net_device *dev)
2531 dev->open = strip_open_low; 2536 dev->open = strip_open_low;
2532 dev->stop = strip_close_low; 2537 dev->stop = strip_close_low;
2533 dev->hard_start_xmit = strip_xmit; 2538 dev->hard_start_xmit = strip_xmit;
2534 dev->hard_header = strip_header; 2539 dev->header_ops = &strip_header_ops;
2535 dev->rebuild_header = strip_rebuild_header; 2540
2536 dev->set_mac_address = strip_set_mac_address; 2541 dev->set_mac_address = strip_set_mac_address;
2537 dev->get_stats = strip_get_stats; 2542 dev->get_stats = strip_get_stats;
2538 dev->change_mtu = strip_change_mtu; 2543 dev->change_mtu = strip_change_mtu;
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
index 6d4959807abc..8c6b72d05b1d 100644
--- a/drivers/s390/net/qeth.h
+++ b/drivers/s390/net/qeth.h
@@ -833,8 +833,7 @@ struct qeth_card {
833 struct qeth_qdio_info qdio; 833 struct qeth_qdio_info qdio;
834 struct qeth_perf_stats perf_stats; 834 struct qeth_perf_stats perf_stats;
835 int use_hard_stop; 835 int use_hard_stop;
836 int (*orig_hard_header)(struct sk_buff *,struct net_device *, 836 const struct header_ops *orig_header_ops;
837 unsigned short,void *,void *,unsigned);
838 struct qeth_osn_info osn_info; 837 struct qeth_osn_info osn_info;
839 atomic_t force_alloc_skb; 838 atomic_t force_alloc_skb;
840}; 839};
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index 65225b3989dd..778ddfb99077 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -160,6 +160,9 @@ qeth_set_multicast_list(struct net_device *);
160static void 160static void
161qeth_setadp_promisc_mode(struct qeth_card *); 161qeth_setadp_promisc_mode(struct qeth_card *);
162 162
163static int
164qeth_hard_header_parse(const struct sk_buff *skb, unsigned char *haddr);
165
163static void 166static void
164qeth_notify_processes(void) 167qeth_notify_processes(void)
165{ 168{
@@ -3787,8 +3790,8 @@ qeth_get_netdevice(enum qeth_card_types type, enum qeth_link_types linktype)
3787/*hard_header fake function; used in case fake_ll is set */ 3790/*hard_header fake function; used in case fake_ll is set */
3788static int 3791static int
3789qeth_fake_header(struct sk_buff *skb, struct net_device *dev, 3792qeth_fake_header(struct sk_buff *skb, struct net_device *dev,
3790 unsigned short type, void *daddr, void *saddr, 3793 unsigned short type, const void *daddr, const void *saddr,
3791 unsigned len) 3794 unsigned len)
3792{ 3795{
3793 if(dev->type == ARPHRD_IEEE802_TR){ 3796 if(dev->type == ARPHRD_IEEE802_TR){
3794 struct trh_hdr *hdr; 3797 struct trh_hdr *hdr;
@@ -3811,6 +3814,11 @@ qeth_fake_header(struct sk_buff *skb, struct net_device *dev,
3811 } 3814 }
3812} 3815}
3813 3816
3817static const struct header_ops qeth_fake_ops = {
3818 .create = qeth_fake_header,
3819 .parse = qeth_hard_header_parse,
3820};
3821
3814static int 3822static int
3815qeth_send_packet(struct qeth_card *, struct sk_buff *); 3823qeth_send_packet(struct qeth_card *, struct sk_buff *);
3816 3824
@@ -4649,7 +4657,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb)
4649 [qeth_get_priority_queue(card, skb, ipv, cast_type)]; 4657 [qeth_get_priority_queue(card, skb, ipv, cast_type)];
4650 if (!card->options.layer2) { 4658 if (!card->options.layer2) {
4651 ipv = qeth_get_ip_version(skb); 4659 ipv = qeth_get_ip_version(skb);
4652 if ((card->dev->hard_header == qeth_fake_header) && ipv) { 4660 if ((card->dev->header_ops == &qeth_fake_ops) && ipv) {
4653 new_skb = qeth_pskb_unshare(skb, GFP_ATOMIC); 4661 new_skb = qeth_pskb_unshare(skb, GFP_ATOMIC);
4654 if (!new_skb) 4662 if (!new_skb)
4655 return -ENOMEM; 4663 return -ENOMEM;
@@ -6566,6 +6574,9 @@ qeth_hard_header_parse(const struct sk_buff *skb, unsigned char *haddr)
6566 const struct qeth_card *card; 6574 const struct qeth_card *card;
6567 const struct ethhdr *eth; 6575 const struct ethhdr *eth;
6568 6576
6577 if (dev->type != ARPHRD_IEEE802_TR)
6578 return 0;
6579
6569 card = qeth_get_card_from_dev(skb->dev); 6580 card = qeth_get_card_from_dev(skb->dev);
6570 if (card->options.layer2) 6581 if (card->options.layer2)
6571 goto haveheader; 6582 goto haveheader;
@@ -6596,6 +6607,10 @@ haveheader:
6596 return ETH_ALEN; 6607 return ETH_ALEN;
6597} 6608}
6598 6609
6610static const struct header_ops qeth_null_ops = {
6611 .parse = qeth_hard_header_parse,
6612};
6613
6599static int 6614static int
6600qeth_netdev_init(struct net_device *dev) 6615qeth_netdev_init(struct net_device *dev)
6601{ 6616{
@@ -6620,12 +6635,8 @@ qeth_netdev_init(struct net_device *dev)
6620 dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid; 6635 dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid;
6621 dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid; 6636 dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid;
6622#endif 6637#endif
6623 if (qeth_get_netdev_flags(card) & IFF_NOARP) { 6638 dev->header_ops = &qeth_null_ops;
6624 dev->rebuild_header = NULL; 6639
6625 dev->hard_header = NULL;
6626 dev->header_cache_update = NULL;
6627 dev->hard_header_cache = NULL;
6628 }
6629#ifdef CONFIG_QETH_IPV6 6640#ifdef CONFIG_QETH_IPV6
6630 /*IPv6 address autoconfiguration stuff*/ 6641 /*IPv6 address autoconfiguration stuff*/
6631 if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD)) 6642 if (!(card->info.unique_id & UNIQUE_ID_NOT_BY_CARD))
@@ -6633,11 +6644,8 @@ qeth_netdev_init(struct net_device *dev)
6633#endif 6644#endif
6634 if (card->options.fake_ll && 6645 if (card->options.fake_ll &&
6635 (qeth_get_netdev_flags(card) & IFF_NOARP)) 6646 (qeth_get_netdev_flags(card) & IFF_NOARP))
6636 dev->hard_header = qeth_fake_header; 6647 dev->header_ops = &qeth_fake_ops;
6637 if (dev->type == ARPHRD_IEEE802_TR) 6648
6638 dev->hard_header_parse = NULL;
6639 else
6640 dev->hard_header_parse = qeth_hard_header_parse;
6641 dev->set_mac_address = qeth_layer2_set_mac_address; 6649 dev->set_mac_address = qeth_layer2_set_mac_address;
6642 dev->flags |= qeth_get_netdev_flags(card); 6650 dev->flags |= qeth_get_netdev_flags(card);
6643 if ((card->options.fake_broadcast) || 6651 if ((card->options.fake_broadcast) ||
@@ -6740,10 +6748,10 @@ retry:
6740 } 6748 }
6741 /*network device will be recovered*/ 6749 /*network device will be recovered*/
6742 if (card->dev) { 6750 if (card->dev) {
6743 card->dev->hard_header = card->orig_hard_header; 6751 card->dev->header_ops = card->orig_header_ops;
6744 if (card->options.fake_ll && 6752 if (card->options.fake_ll &&
6745 (qeth_get_netdev_flags(card) & IFF_NOARP)) 6753 (qeth_get_netdev_flags(card) & IFF_NOARP))
6746 card->dev->hard_header = qeth_fake_header; 6754 card->dev->header_ops = &qeth_fake_ops;
6747 return 0; 6755 return 0;
6748 } 6756 }
6749 /* at first set_online allocate netdev */ 6757 /* at first set_online allocate netdev */
@@ -6757,7 +6765,7 @@ retry:
6757 goto out; 6765 goto out;
6758 } 6766 }
6759 card->dev->priv = card; 6767 card->dev->priv = card;
6760 card->orig_hard_header = card->dev->hard_header; 6768 card->orig_header_ops = card->dev->header_ops;
6761 card->dev->type = qeth_get_arphdr_type(card->info.type, 6769 card->dev->type = qeth_get_arphdr_type(card->info.type,
6762 card->info.link_type); 6770 card->info.link_type);
6763 card->dev->init = qeth_netdev_init; 6771 card->dev->init = qeth_netdev_init;
@@ -8308,7 +8316,7 @@ qeth_arp_constructor(struct neighbour *neigh)
8308 if (card == NULL) 8316 if (card == NULL)
8309 goto out; 8317 goto out;
8310 if((card->options.layer2) || 8318 if((card->options.layer2) ||
8311 (card->dev->hard_header == qeth_fake_header)) 8319 (card->dev->header_ops == &qeth_fake_ops))
8312 goto out; 8320 goto out;
8313 8321
8314 rcu_read_lock(); 8322 rcu_read_lock();