diff options
65 files changed, 481 insertions, 475 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; |
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) | |||
780 | static int ipoib_hard_header(struct sk_buff *skb, | 780 | static 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 | ||
943 | static const struct header_ops ipoib_header_ops = { | ||
944 | .create = ipoib_hard_header, | ||
945 | }; | ||
946 | |||
943 | static void ipoib_setup(struct net_device *dev) | 947 | static 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 | ||
1876 | static int | ||
1877 | my_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 | ||
1921 | static int | 1881 | static int isdn_net_header(struct sk_buff *skb, struct net_device *dev, |
1922 | isdn_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 | ||
1968 | static 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 | |||
1978 | static 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 | |||
1987 | static 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 | |||
2012 | isdn_net_init(struct net_device *ndev) | 1998 | isdn_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 | ||
1228 | static const struct header_ops dvb_header_ops = { | ||
1229 | .create = eth_header, | ||
1230 | .parse = eth_header_parse, | ||
1231 | .rebuild = eth_rebuild_header, | ||
1232 | }; | ||
1233 | |||
1228 | static void dvb_net_setup(struct net_device *dev) | 1234 | static 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); | |||
194 | static void cops_rx (struct net_device *dev); | 194 | static void cops_rx (struct net_device *dev); |
195 | static int cops_send_packet (struct sk_buff *skb, struct net_device *dev); | 195 | static int cops_send_packet (struct sk_buff *skb, struct net_device *dev); |
196 | static void set_multicast_list (struct net_device *dev); | 196 | static void set_multicast_list (struct net_device *dev); |
197 | static int cops_hard_header (struct sk_buff *skb, struct net_device *dev, | ||
198 | unsigned short type, void *daddr, void *saddr, | ||
199 | unsigned len); | ||
200 | |||
201 | static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); | 197 | static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); |
202 | static int cops_close (struct net_device *dev); | 198 | static int cops_close (struct net_device *dev); |
203 | static struct net_device_stats *cops_get_stats (struct net_device *dev); | 199 | static 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 | |||
951 | static 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 | ||
873 | static 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 | |||
882 | static int ltpc_poll_counter; | 873 | static int ltpc_poll_counter; |
883 | 874 | ||
884 | static void ltpc_poll(unsigned long l) | 875 | static 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); | |||
102 | static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev); | 102 | static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev); |
103 | static void arcnet_timeout(struct net_device *dev); | 103 | static void arcnet_timeout(struct net_device *dev); |
104 | static int arcnet_header(struct sk_buff *skb, struct net_device *dev, | 104 | static 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); |
107 | static int arcnet_rebuild_header(struct sk_buff *skb); | 107 | static int arcnet_rebuild_header(struct sk_buff *skb); |
108 | static struct net_device_stats *arcnet_get_stats(struct net_device *dev); | 108 | static struct net_device_stats *arcnet_get_stats(struct net_device *dev); |
109 | static int go_tx(struct net_device *dev); | 109 | static 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 | ||
320 | static 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. */ |
322 | static void arcdev_setup(struct net_device *dev) | 327 | static 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 | ||
349 | struct net_device *alloc_arcdev(char *name) | 353 | struct net_device *alloc_arcdev(char *name) |
@@ -488,10 +492,10 @@ static int arcnet_close(struct net_device *dev) | |||
488 | 492 | ||
489 | 493 | ||
490 | static int arcnet_header(struct sk_buff *skb, struct net_device *dev, | 494 | static 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 */ |
290 | static int sp_header(struct sk_buff *skb, struct net_device *dev, | 290 | static 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 | ||
327 | static const struct header_ops sp_header_ops = { | ||
328 | .create = sp_header, | ||
329 | .rebuild = sp_rebuild_header, | ||
330 | }; | ||
331 | |||
326 | static void sp_setup(struct net_device *dev) | 332 | static 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 */ |
581 | static int ax_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | 581 | static 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 | ||
674 | static const struct header_ops ax_header_ops = { | ||
675 | .create = ax_header, | ||
676 | .rebuild = ax_rebuild_header, | ||
677 | }; | ||
678 | |||
673 | static void ax_setup(struct net_device *dev) | 679 | static 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 | */ |
227 | static void loopback_setup(struct net_device *dev) | 226 | static 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 = ð_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 | ||
166 | static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev, | 166 | static 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 | ||
177 | static 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 | |||
177 | static int macvlan_open(struct net_device *dev) | 186 | static 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 | */ |
679 | static int myri_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | 679 | static 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 | ||
762 | int myri_header_cache(struct neighbour *neigh, struct hh_cache *hh) | 763 | static 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. */ |
789 | void myri_header_cache_update(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr) | 790 | void 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 | ||
887 | static 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 | |||
884 | static int __devinit myri_ether_init(struct sbus_dev *sdev) | 894 | static 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 */ |
149 | static int plip_tx_packet(struct sk_buff *skb, struct net_device *dev); | 149 | static int plip_tx_packet(struct sk_buff *skb, struct net_device *dev); |
150 | static int plip_hard_header(struct sk_buff *skb, struct net_device *dev, | 150 | static 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); |
153 | static int plip_hard_header_cache(struct neighbour *neigh, | 153 | static int plip_hard_header_cache(const struct neighbour *neigh, |
154 | struct hh_cache *hh); | 154 | struct hh_cache *hh); |
155 | static int plip_open(struct net_device *dev); | 155 | static int plip_open(struct net_device *dev); |
156 | static int plip_close(struct net_device *dev); | 156 | static 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 | ||
263 | static 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 | ||
995 | static void | 990 | static void |
996 | plip_rewrite_address(struct net_device *dev, struct ethhdr *eth) | 991 | plip_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 | ||
1011 | static int | 1006 | static int |
1012 | plip_hard_header(struct sk_buff *skb, struct net_device *dev, | 1007 | plip_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 | ||
1025 | int plip_hard_header_cache(struct neighbour *neigh, | 1020 | int 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 | ||
333 | static int shaper_header(struct sk_buff *skb, struct net_device *dev, | 333 | static 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 | ||
419 | static const struct header_ops shaper_ops = { | ||
420 | .create = shaper_header, | ||
421 | .rebuild = shaper_rebuild_header, | ||
422 | }; | ||
423 | |||
418 | static int shaper_attach(struct net_device *shdev, struct shaper *sh, struct net_device *dev) | 424 | static 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 */ |
134 | static int cycx_netdevice_init(struct net_device *dev), | 134 | static int cycx_netdevice_init(struct net_device *dev); |
135 | cycx_netdevice_open(struct net_device *dev), | 135 | static int cycx_netdevice_open(struct net_device *dev); |
136 | cycx_netdevice_stop(struct net_device *dev), | 136 | static int cycx_netdevice_stop(struct net_device *dev); |
137 | cycx_netdevice_hard_header(struct sk_buff *skb, | 137 | static 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, | 141 | static int cycx_netdevice_rebuild_header(struct sk_buff *skb); |
142 | static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb, | ||
142 | struct net_device *dev); | 143 | struct net_device *dev); |
143 | 144 | ||
144 | static struct net_device_stats * | 145 | static 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 | |||
475 | static 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. */ |
555 | static int cycx_netdevice_hard_header(struct sk_buff *skb, | 563 | static 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 | ||
68 | static int dlci_header(struct sk_buff *skb, struct net_device *dev, | 68 | static 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 | ||
488 | static const struct header_ops dlci_header_ops = { | ||
489 | .create = dlci_header, | ||
490 | }; | ||
491 | |||
488 | static void dlci_setup(struct net_device *dev) | 492 | static 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 | ||
235 | static const struct header_ops hdlc_null_ops; | ||
236 | |||
235 | static void hdlc_setup_dev(struct net_device *dev) | 237 | static 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 | ||
255 | static void hdlc_setup(struct net_device *dev) | 253 | static 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 | ||
76 | static int cisco_hard_header(struct sk_buff *skb, struct net_device *dev, | 76 | static 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 | |||
313 | static struct hdlc_proto proto = { | 312 | static 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 | ||
320 | static const struct header_ops cisco_header_ops = { | ||
321 | .create = cisco_hard_header, | ||
322 | }; | ||
321 | 323 | ||
322 | static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr) | 324 | static 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 | ||
362 | static int sppp_hard_header(struct sk_buff *skb, struct net_device *dev, __u16 type, | 362 | static 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 | ||
395 | static int sppp_rebuild_header(struct sk_buff *skb) | 397 | static 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 | ||
2699 | static const struct header_ops airo_header_ops = { | ||
2700 | .parse = wll_header_parse, | ||
2701 | }; | ||
2702 | |||
2699 | static void wifi_setup(struct net_device *dev) | 2703 | static 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); |
31 | void hostap_dump_tx_header(const char *name, | 31 | void hostap_dump_tx_header(const char *name, |
32 | const struct hfa384x_tx_frame *tx); | 32 | const struct hfa384x_tx_frame *tx); |
33 | int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr); | 33 | extern const struct header_ops hostap_80211_ops; |
34 | int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr); | ||
35 | int hostap_80211_get_hdrlen(u16 fc); | 34 | int hostap_80211_get_hdrlen(u16 fc); |
36 | struct net_device_stats *hostap_get_stats(struct net_device *dev); | 35 | struct net_device_stats *hostap_get_stats(struct net_device *dev); |
37 | void hostap_setup_dev(struct net_device *dev, local_info_t *local, | 36 | void 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 | ||
597 | int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr) | 597 | int 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 | ||
604 | int 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 | ||
849 | const 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 | }; | ||
857 | EXPORT_SYMBOL(hostap_80211_ops); | ||
846 | 858 | ||
847 | void hostap_setup_dev(struct net_device *dev, local_info_t *local, | 859 | void 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 | |||
887 | static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked) | 898 | static 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 | ||
1633 | static int strip_header(struct sk_buff *skb, struct net_device *dev, | 1633 | static 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 | ||
2500 | static 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 *); | |||
160 | static void | 160 | static void |
161 | qeth_setadp_promisc_mode(struct qeth_card *); | 161 | qeth_setadp_promisc_mode(struct qeth_card *); |
162 | 162 | ||
163 | static int | ||
164 | qeth_hard_header_parse(const struct sk_buff *skb, unsigned char *haddr); | ||
165 | |||
163 | static void | 166 | static void |
164 | qeth_notify_processes(void) | 167 | qeth_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 */ |
3788 | static int | 3791 | static int |
3789 | qeth_fake_header(struct sk_buff *skb, struct net_device *dev, | 3792 | qeth_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 | ||
3817 | static const struct header_ops qeth_fake_ops = { | ||
3818 | .create = qeth_fake_header, | ||
3819 | .parse = qeth_hard_header_parse, | ||
3820 | }; | ||
3821 | |||
3814 | static int | 3822 | static int |
3815 | qeth_send_packet(struct qeth_card *, struct sk_buff *); | 3823 | qeth_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 | ||
6610 | static const struct header_ops qeth_null_ops = { | ||
6611 | .parse = qeth_hard_header_parse, | ||
6612 | }; | ||
6613 | |||
6599 | static int | 6614 | static int |
6600 | qeth_netdev_init(struct net_device *dev) | 6615 | qeth_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(); |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 6cdb97365e47..b7558ec81ed5 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -29,15 +29,19 @@ | |||
29 | #include <linux/random.h> | 29 | #include <linux/random.h> |
30 | 30 | ||
31 | #ifdef __KERNEL__ | 31 | #ifdef __KERNEL__ |
32 | extern int eth_header(struct sk_buff *skb, struct net_device *dev, | ||
33 | unsigned short type, void *daddr, | ||
34 | void *saddr, unsigned len); | ||
35 | extern int eth_rebuild_header(struct sk_buff *skb); | ||
36 | extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); | 32 | extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); |
37 | extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, | 33 | extern const struct header_ops eth_header_ops; |
38 | unsigned char * haddr); | 34 | |
39 | extern int eth_header_cache(struct neighbour *neigh, | 35 | extern int eth_header(struct sk_buff *skb, struct net_device *dev, |
40 | struct hh_cache *hh); | 36 | unsigned short type, |
37 | const void *daddr, const void *saddr, unsigned len); | ||
38 | extern int eth_rebuild_header(struct sk_buff *skb); | ||
39 | extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); | ||
40 | extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh); | ||
41 | extern void eth_header_cache_update(struct hh_cache *hh, | ||
42 | const struct net_device *dev, | ||
43 | const unsigned char *haddr); | ||
44 | |||
41 | 45 | ||
42 | extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); | 46 | extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); |
43 | #define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) | 47 | #define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 0e791e2c0c5a..5f9297793661 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -117,6 +117,8 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) | |||
117 | return (struct ethhdr *)skb_mac_header(skb); | 117 | return (struct ethhdr *)skb_mac_header(skb); |
118 | } | 118 | } |
119 | 119 | ||
120 | int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); | ||
121 | |||
120 | #ifdef CONFIG_SYSCTL | 122 | #ifdef CONFIG_SYSCTL |
121 | extern struct ctl_table ether_table[]; | 123 | extern struct ctl_table ether_table[]; |
122 | #endif | 124 | #endif |
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h index 51574743aa1b..3b1b7ba19825 100644 --- a/include/linux/if_shaper.h +++ b/include/linux/if_shaper.h | |||
@@ -25,17 +25,6 @@ struct shaper | |||
25 | an empty queue */ | 25 | an empty queue */ |
26 | spinlock_t lock; | 26 | spinlock_t lock; |
27 | struct net_device *dev; | 27 | struct net_device *dev; |
28 | int (*hard_start_xmit) (struct sk_buff *skb, | ||
29 | struct net_device *dev); | ||
30 | int (*hard_header) (struct sk_buff *skb, | ||
31 | struct net_device *dev, | ||
32 | unsigned short type, | ||
33 | void *daddr, | ||
34 | void *saddr, | ||
35 | unsigned len); | ||
36 | int (*rebuild_header)(struct sk_buff *skb); | ||
37 | int (*hard_header_cache)(struct neighbour *neigh, struct hh_cache *hh); | ||
38 | void (*header_cache_update)(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr); | ||
39 | struct net_device_stats* (*get_stats)(struct net_device *dev); | 28 | struct net_device_stats* (*get_stats)(struct net_device *dev); |
40 | struct timer_list timer; | 29 | struct timer_list timer; |
41 | }; | 30 | }; |
diff --git a/include/linux/isdn.h b/include/linux/isdn.h index 3c7875b7ab5b..a6fb366748bb 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h | |||
@@ -353,13 +353,6 @@ typedef struct isdn_net_local_s { | |||
353 | /* a particular channel (including */ | 353 | /* a particular channel (including */ |
354 | /* the frame_cnt */ | 354 | /* the frame_cnt */ |
355 | 355 | ||
356 | int (*org_hhc)( | ||
357 | struct neighbour *neigh, | ||
358 | struct hh_cache *hh); | ||
359 | /* Ptr to orig. header_cache_update */ | ||
360 | void (*org_hcu)(struct hh_cache *, | ||
361 | struct net_device *, | ||
362 | unsigned char *); | ||
363 | int pppbind; /* ippp device for bindings */ | 356 | int pppbind; /* ippp device for bindings */ |
364 | int dialtimeout; /* How long shall we try on dialing? (jiffies) */ | 357 | int dialtimeout; /* How long shall we try on dialing? (jiffies) */ |
365 | int dialwait; /* How long shall we wait after failed attempt? (jiffies) */ | 358 | int dialwait; /* How long shall we wait after failed attempt? (jiffies) */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index aae9ec367f5d..91cd3f3db507 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -250,6 +250,19 @@ struct hh_cache | |||
250 | #define LL_RESERVED_SPACE_EXTRA(dev,extra) \ | 250 | #define LL_RESERVED_SPACE_EXTRA(dev,extra) \ |
251 | ((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) | 251 | ((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD) |
252 | 252 | ||
253 | struct header_ops { | ||
254 | int (*create) (struct sk_buff *skb, struct net_device *dev, | ||
255 | unsigned short type, const void *daddr, | ||
256 | const void *saddr, unsigned len); | ||
257 | int (*parse)(const struct sk_buff *skb, unsigned char *haddr); | ||
258 | int (*rebuild)(struct sk_buff *skb); | ||
259 | #define HAVE_HEADER_CACHE | ||
260 | int (*cache)(const struct neighbour *neigh, struct hh_cache *hh); | ||
261 | void (*cache_update)(struct hh_cache *hh, | ||
262 | const struct net_device *dev, | ||
263 | const unsigned char *haddr); | ||
264 | }; | ||
265 | |||
253 | /* These flag bits are private to the generic network queueing | 266 | /* These flag bits are private to the generic network queueing |
254 | * layer, they may not be explicitly referenced by any other | 267 | * layer, they may not be explicitly referenced by any other |
255 | * code. | 268 | * code. |
@@ -492,6 +505,9 @@ struct net_device | |||
492 | #endif | 505 | #endif |
493 | const struct ethtool_ops *ethtool_ops; | 506 | const struct ethtool_ops *ethtool_ops; |
494 | 507 | ||
508 | /* Hardware header description */ | ||
509 | const struct header_ops *header_ops; | ||
510 | |||
495 | /* | 511 | /* |
496 | * This marks the end of the "visible" part of the structure. All | 512 | * This marks the end of the "visible" part of the structure. All |
497 | * fields hereafter are internal to the system, and may change at | 513 | * fields hereafter are internal to the system, and may change at |
@@ -615,13 +631,6 @@ struct net_device | |||
615 | int (*open)(struct net_device *dev); | 631 | int (*open)(struct net_device *dev); |
616 | int (*stop)(struct net_device *dev); | 632 | int (*stop)(struct net_device *dev); |
617 | #define HAVE_NETDEV_POLL | 633 | #define HAVE_NETDEV_POLL |
618 | int (*hard_header) (struct sk_buff *skb, | ||
619 | struct net_device *dev, | ||
620 | unsigned short type, | ||
621 | void *daddr, | ||
622 | void *saddr, | ||
623 | unsigned len); | ||
624 | int (*rebuild_header)(struct sk_buff *skb); | ||
625 | #define HAVE_CHANGE_RX_FLAGS | 634 | #define HAVE_CHANGE_RX_FLAGS |
626 | void (*change_rx_flags)(struct net_device *dev, | 635 | void (*change_rx_flags)(struct net_device *dev, |
627 | int flags); | 636 | int flags); |
@@ -638,12 +647,6 @@ struct net_device | |||
638 | #define HAVE_SET_CONFIG | 647 | #define HAVE_SET_CONFIG |
639 | int (*set_config)(struct net_device *dev, | 648 | int (*set_config)(struct net_device *dev, |
640 | struct ifmap *map); | 649 | struct ifmap *map); |
641 | #define HAVE_HEADER_CACHE | ||
642 | int (*hard_header_cache)(struct neighbour *neigh, | ||
643 | struct hh_cache *hh); | ||
644 | void (*header_cache_update)(struct hh_cache *hh, | ||
645 | struct net_device *dev, | ||
646 | unsigned char * haddr); | ||
647 | #define HAVE_CHANGE_MTU | 650 | #define HAVE_CHANGE_MTU |
648 | int (*change_mtu)(struct net_device *dev, int new_mtu); | 651 | int (*change_mtu)(struct net_device *dev, int new_mtu); |
649 | 652 | ||
@@ -657,8 +660,6 @@ struct net_device | |||
657 | void (*vlan_rx_kill_vid)(struct net_device *dev, | 660 | void (*vlan_rx_kill_vid)(struct net_device *dev, |
658 | unsigned short vid); | 661 | unsigned short vid); |
659 | 662 | ||
660 | int (*hard_header_parse)(const struct sk_buff *skb, | ||
661 | unsigned char *haddr); | ||
662 | int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); | 663 | int (*neigh_setup)(struct net_device *dev, struct neigh_parms *); |
663 | #ifdef CONFIG_NETPOLL | 664 | #ifdef CONFIG_NETPOLL |
664 | struct netpoll_info *npinfo; | 665 | struct netpoll_info *npinfo; |
@@ -802,11 +803,13 @@ extern int netpoll_trap(void); | |||
802 | 803 | ||
803 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 804 | static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
804 | unsigned short type, | 805 | unsigned short type, |
805 | void *daddr, void *saddr, unsigned len) | 806 | const void *daddr, const void *saddr, |
807 | unsigned len) | ||
806 | { | 808 | { |
807 | if (!dev->hard_header) | 809 | if (!dev->header_ops) |
808 | return 0; | 810 | return 0; |
809 | return dev->hard_header(skb, dev, type, daddr, saddr, len); | 811 | |
812 | return dev->header_ops->create(skb, dev, type, daddr, saddr, len); | ||
810 | } | 813 | } |
811 | 814 | ||
812 | static inline int dev_parse_header(const struct sk_buff *skb, | 815 | static inline int dev_parse_header(const struct sk_buff *skb, |
@@ -814,9 +817,9 @@ static inline int dev_parse_header(const struct sk_buff *skb, | |||
814 | { | 817 | { |
815 | const struct net_device *dev = skb->dev; | 818 | const struct net_device *dev = skb->dev; |
816 | 819 | ||
817 | if (!dev->hard_header_parse) | 820 | if (!dev->header_ops->parse) |
818 | return 0; | 821 | return 0; |
819 | return dev->hard_header_parse(skb, haddr); | 822 | return dev->header_ops->parse(skb, haddr); |
820 | } | 823 | } |
821 | 824 | ||
822 | typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); | 825 | typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len); |
diff --git a/include/net/ax25.h b/include/net/ax25.h index 99a4e364c74a..4e3cd93f81fc 100644 --- a/include/net/ax25.h +++ b/include/net/ax25.h | |||
@@ -363,8 +363,11 @@ extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *); | |||
363 | extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); | 363 | extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); |
364 | 364 | ||
365 | /* ax25_ip.c */ | 365 | /* ax25_ip.c */ |
366 | extern int ax25_hard_header(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int); | 366 | extern int ax25_hard_header(struct sk_buff *, struct net_device *, |
367 | unsigned short, const void *, | ||
368 | const void *, unsigned int); | ||
367 | extern int ax25_rebuild_header(struct sk_buff *); | 369 | extern int ax25_rebuild_header(struct sk_buff *); |
370 | extern const struct header_ops ax25_header_ops; | ||
368 | 371 | ||
369 | /* ax25_out.c */ | 372 | /* ax25_out.c */ |
370 | extern ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct net_device *); | 373 | extern ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct net_device *); |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 9e22526e80e7..ab61809a9616 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -97,10 +97,9 @@ extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, | |||
97 | /* Calculate maximal size of packet seen by hard_start_xmit | 97 | /* Calculate maximal size of packet seen by hard_start_xmit |
98 | routine of this device. | 98 | routine of this device. |
99 | */ | 99 | */ |
100 | static inline unsigned psched_mtu(struct net_device *dev) | 100 | static inline unsigned psched_mtu(const struct net_device *dev) |
101 | { | 101 | { |
102 | unsigned mtu = dev->mtu; | 102 | return dev->mtu + dev->hard_header_len; |
103 | return dev->hard_header ? mtu + dev->hard_header_len : mtu; | ||
104 | } | 103 | } |
105 | 104 | ||
106 | #endif | 105 | #endif |
diff --git a/net/802/fc.c b/net/802/fc.c index 675d9ba8e591..cb3475ea6fda 100644 --- a/net/802/fc.c +++ b/net/802/fc.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | static int fc_header(struct sk_buff *skb, struct net_device *dev, | 36 | static int fc_header(struct sk_buff *skb, struct net_device *dev, |
37 | unsigned short type, | 37 | unsigned short type, |
38 | void *daddr, void *saddr, unsigned len) | 38 | const void *daddr, const void *saddr, unsigned len) |
39 | { | 39 | { |
40 | struct fch_hdr *fch; | 40 | struct fch_hdr *fch; |
41 | int hdr_len; | 41 | int hdr_len; |
@@ -95,11 +95,14 @@ static int fc_rebuild_header(struct sk_buff *skb) | |||
95 | #endif | 95 | #endif |
96 | } | 96 | } |
97 | 97 | ||
98 | static const struct header_ops fc_header_ops = { | ||
99 | .create = fc_header, | ||
100 | .rebuild = fc_rebuild_header, | ||
101 | }; | ||
102 | |||
98 | static void fc_setup(struct net_device *dev) | 103 | static void fc_setup(struct net_device *dev) |
99 | { | 104 | { |
100 | dev->hard_header = fc_header; | 105 | dev->header_ops = &fc_header_ops; |
101 | dev->rebuild_header = fc_rebuild_header; | ||
102 | |||
103 | dev->type = ARPHRD_IEEE802; | 106 | dev->type = ARPHRD_IEEE802; |
104 | dev->hard_header_len = FC_HLEN; | 107 | dev->hard_header_len = FC_HLEN; |
105 | dev->mtu = 2024; | 108 | dev->mtu = 2024; |
diff --git a/net/802/fddi.c b/net/802/fddi.c index 91dde41b5481..0549317b9356 100644 --- a/net/802/fddi.c +++ b/net/802/fddi.c | |||
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | static int fddi_header(struct sk_buff *skb, struct net_device *dev, | 53 | static int fddi_header(struct sk_buff *skb, struct net_device *dev, |
54 | unsigned short type, | 54 | unsigned short type, |
55 | void *daddr, void *saddr, unsigned len) | 55 | const void *daddr, const void *saddr, unsigned len) |
56 | { | 56 | { |
57 | int hl = FDDI_K_SNAP_HLEN; | 57 | int hl = FDDI_K_SNAP_HLEN; |
58 | struct fddihdr *fddi; | 58 | struct fddihdr *fddi; |
@@ -175,11 +175,15 @@ static int fddi_change_mtu(struct net_device *dev, int new_mtu) | |||
175 | return(0); | 175 | return(0); |
176 | } | 176 | } |
177 | 177 | ||
178 | static const struct header_ops fddi_header_ops = { | ||
179 | .create = fddi_header, | ||
180 | .rebuild = fddi_rebuild_header, | ||
181 | }; | ||
182 | |||
178 | static void fddi_setup(struct net_device *dev) | 183 | static void fddi_setup(struct net_device *dev) |
179 | { | 184 | { |
180 | dev->change_mtu = fddi_change_mtu; | 185 | dev->change_mtu = fddi_change_mtu; |
181 | dev->hard_header = fddi_header; | 186 | dev->header_ops = &fddi_header_ops; |
182 | dev->rebuild_header = fddi_rebuild_header; | ||
183 | 187 | ||
184 | dev->type = ARPHRD_FDDI; | 188 | dev->type = ARPHRD_FDDI; |
185 | dev->hard_header_len = FDDI_K_SNAP_HLEN+3; /* Assume 802.2 SNAP hdr len + 3 pad bytes */ | 189 | dev->hard_header_len = FDDI_K_SNAP_HLEN+3; /* Assume 802.2 SNAP hdr len + 3 pad bytes */ |
diff --git a/net/802/hippi.c b/net/802/hippi.c index 87ffc12b6891..e35dc1e0915d 100644 --- a/net/802/hippi.c +++ b/net/802/hippi.c | |||
@@ -45,8 +45,8 @@ | |||
45 | */ | 45 | */ |
46 | 46 | ||
47 | static int hippi_header(struct sk_buff *skb, struct net_device *dev, | 47 | static int hippi_header(struct sk_buff *skb, struct net_device *dev, |
48 | unsigned short type, void *daddr, void *saddr, | 48 | unsigned short type, |
49 | unsigned len) | 49 | const void *daddr, const void *saddr, unsigned len) |
50 | { | 50 | { |
51 | struct hippi_hdr *hip = (struct hippi_hdr *)skb_push(skb, HIPPI_HLEN); | 51 | struct hippi_hdr *hip = (struct hippi_hdr *)skb_push(skb, HIPPI_HLEN); |
52 | struct hippi_cb *hcb = (struct hippi_cb *) skb->cb; | 52 | struct hippi_cb *hcb = (struct hippi_cb *) skb->cb; |
@@ -182,16 +182,18 @@ static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p) | |||
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
184 | 184 | ||
185 | static const struct header_ops hippi_header_ops = { | ||
186 | .create = hippi_header, | ||
187 | .rebuild = hippi_rebuild_header, | ||
188 | }; | ||
189 | |||
190 | |||
185 | static void hippi_setup(struct net_device *dev) | 191 | static void hippi_setup(struct net_device *dev) |
186 | { | 192 | { |
187 | dev->set_multicast_list = NULL; | 193 | dev->set_multicast_list = NULL; |
188 | dev->change_mtu = hippi_change_mtu; | 194 | dev->change_mtu = hippi_change_mtu; |
189 | dev->hard_header = hippi_header; | 195 | dev->header_ops = &hippi_header_ops; |
190 | dev->rebuild_header = hippi_rebuild_header; | ||
191 | dev->set_mac_address = hippi_mac_addr; | 196 | dev->set_mac_address = hippi_mac_addr; |
192 | dev->hard_header_parse = NULL; | ||
193 | dev->hard_header_cache = NULL; | ||
194 | dev->header_cache_update = NULL; | ||
195 | dev->neigh_setup = hippi_neigh_setup_dev; | 197 | dev->neigh_setup = hippi_neigh_setup_dev; |
196 | 198 | ||
197 | /* | 199 | /* |
diff --git a/net/802/tr.c b/net/802/tr.c index aa3c2e936abc..a2bd0f2e3af8 100644 --- a/net/802/tr.c +++ b/net/802/tr.c | |||
@@ -100,7 +100,7 @@ static inline unsigned long rif_hash(const unsigned char *addr) | |||
100 | 100 | ||
101 | static int tr_header(struct sk_buff *skb, struct net_device *dev, | 101 | static int tr_header(struct sk_buff *skb, struct net_device *dev, |
102 | unsigned short type, | 102 | unsigned short type, |
103 | void *daddr, void *saddr, unsigned len) | 103 | const void *daddr, const void *saddr, unsigned len) |
104 | { | 104 | { |
105 | struct trh_hdr *trh; | 105 | struct trh_hdr *trh; |
106 | int hdr_len; | 106 | int hdr_len; |
@@ -142,7 +142,7 @@ static int tr_header(struct sk_buff *skb, struct net_device *dev, | |||
142 | if(daddr) | 142 | if(daddr) |
143 | { | 143 | { |
144 | memcpy(trh->daddr,daddr,dev->addr_len); | 144 | memcpy(trh->daddr,daddr,dev->addr_len); |
145 | tr_source_route(skb,trh,dev); | 145 | tr_source_route(skb, trh, dev); |
146 | return(hdr_len); | 146 | return(hdr_len); |
147 | } | 147 | } |
148 | 148 | ||
@@ -247,7 +247,8 @@ __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
247 | * We try to do source routing... | 247 | * We try to do source routing... |
248 | */ | 248 | */ |
249 | 249 | ||
250 | void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh,struct net_device *dev) | 250 | void tr_source_route(struct sk_buff *skb,struct trh_hdr *trh, |
251 | struct net_device *dev) | ||
251 | { | 252 | { |
252 | int slack; | 253 | int slack; |
253 | unsigned int hash; | 254 | unsigned int hash; |
@@ -592,14 +593,18 @@ static const struct file_operations rif_seq_fops = { | |||
592 | 593 | ||
593 | #endif | 594 | #endif |
594 | 595 | ||
596 | static const struct header_ops tr_header_ops = { | ||
597 | .create = tr_header, | ||
598 | .rebuild= tr_rebuild_header, | ||
599 | }; | ||
600 | |||
595 | static void tr_setup(struct net_device *dev) | 601 | static void tr_setup(struct net_device *dev) |
596 | { | 602 | { |
597 | /* | 603 | /* |
598 | * Configure and register | 604 | * Configure and register |
599 | */ | 605 | */ |
600 | 606 | ||
601 | dev->hard_header = tr_header; | 607 | dev->header_ops = &tr_header_ops; |
602 | dev->rebuild_header = tr_rebuild_header; | ||
603 | 608 | ||
604 | dev->type = ARPHRD_IEEE802_TR; | 609 | dev->type = ARPHRD_IEEE802_TR; |
605 | dev->hard_header_len = TR_HLEN; | 610 | dev->hard_header_len = TR_HLEN; |
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 4d003e391754..f2bee234d361 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -314,6 +314,12 @@ int unregister_vlan_device(struct net_device *dev) | |||
314 | */ | 314 | */ |
315 | static struct lock_class_key vlan_netdev_xmit_lock_key; | 315 | static struct lock_class_key vlan_netdev_xmit_lock_key; |
316 | 316 | ||
317 | static const struct header_ops vlan_header_ops = { | ||
318 | .create = vlan_dev_hard_header, | ||
319 | .rebuild = vlan_dev_rebuild_header, | ||
320 | .parse = eth_header_parse, | ||
321 | }; | ||
322 | |||
317 | static int vlan_dev_init(struct net_device *dev) | 323 | static int vlan_dev_init(struct net_device *dev) |
318 | { | 324 | { |
319 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; | 325 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; |
@@ -331,18 +337,14 @@ static int vlan_dev_init(struct net_device *dev) | |||
331 | memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len); | 337 | memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len); |
332 | 338 | ||
333 | if (real_dev->features & NETIF_F_HW_VLAN_TX) { | 339 | if (real_dev->features & NETIF_F_HW_VLAN_TX) { |
334 | dev->hard_header = real_dev->hard_header; | 340 | dev->header_ops = real_dev->header_ops; |
335 | dev->hard_header_len = real_dev->hard_header_len; | 341 | dev->hard_header_len = real_dev->hard_header_len; |
336 | dev->hard_start_xmit = vlan_dev_hwaccel_hard_start_xmit; | 342 | dev->hard_start_xmit = vlan_dev_hwaccel_hard_start_xmit; |
337 | dev->rebuild_header = real_dev->rebuild_header; | ||
338 | } else { | 343 | } else { |
339 | dev->hard_header = vlan_dev_hard_header; | 344 | dev->header_ops = &vlan_header_ops; |
340 | dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN; | 345 | dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN; |
341 | dev->hard_start_xmit = vlan_dev_hard_start_xmit; | 346 | dev->hard_start_xmit = vlan_dev_hard_start_xmit; |
342 | dev->rebuild_header = vlan_dev_rebuild_header; | ||
343 | } | 347 | } |
344 | dev->hard_header_parse = real_dev->hard_header_parse; | ||
345 | dev->hard_header_cache = NULL; | ||
346 | 348 | ||
347 | lockdep_set_class(&dev->_xmit_lock, &vlan_netdev_xmit_lock_key); | 349 | lockdep_set_class(&dev->_xmit_lock, &vlan_netdev_xmit_lock_key); |
348 | return 0; | 350 | return 0; |
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 7df5b2935579..cf4a80d06b35 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -53,8 +53,8 @@ int vlan_dev_rebuild_header(struct sk_buff *skb); | |||
53 | int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | 53 | int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, |
54 | struct packet_type *ptype, struct net_device *orig_dev); | 54 | struct packet_type *ptype, struct net_device *orig_dev); |
55 | int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 55 | int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
56 | unsigned short type, void *daddr, void *saddr, | 56 | unsigned short type, const void *daddr, |
57 | unsigned len); | 57 | const void *saddr, unsigned len); |
58 | int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); | 58 | int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); |
59 | int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); | 59 | int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device *dev); |
60 | int vlan_dev_change_mtu(struct net_device *dev, int new_mtu); | 60 | int vlan_dev_change_mtu(struct net_device *dev, int new_mtu); |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index ca8090fdabbb..1a1740aa9a8b 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -343,8 +343,8 @@ static inline unsigned short vlan_dev_get_egress_qos_mask(struct net_device* dev | |||
343 | * physical devices. | 343 | * physical devices. |
344 | */ | 344 | */ |
345 | int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | 345 | int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, |
346 | unsigned short type, void *daddr, void *saddr, | 346 | unsigned short type, |
347 | unsigned len) | 347 | const void *daddr, const void *saddr, unsigned len) |
348 | { | 348 | { |
349 | struct vlan_hdr *vhdr; | 349 | struct vlan_hdr *vhdr; |
350 | unsigned short veth_TCI = 0; | 350 | unsigned short veth_TCI = 0; |
diff --git a/net/appletalk/dev.c b/net/appletalk/dev.c index 9e4dffc1e423..d856a62ab50f 100644 --- a/net/appletalk/dev.c +++ b/net/appletalk/dev.c | |||
@@ -24,11 +24,7 @@ static void ltalk_setup(struct net_device *dev) | |||
24 | /* Fill in the fields of the device structure with localtalk-generic values. */ | 24 | /* Fill in the fields of the device structure with localtalk-generic values. */ |
25 | 25 | ||
26 | dev->change_mtu = ltalk_change_mtu; | 26 | dev->change_mtu = ltalk_change_mtu; |
27 | dev->hard_header = NULL; | ||
28 | dev->rebuild_header = NULL; | ||
29 | dev->set_mac_address = ltalk_mac_addr; | 27 | dev->set_mac_address = ltalk_mac_addr; |
30 | dev->hard_header_cache = NULL; | ||
31 | dev->header_cache_update= NULL; | ||
32 | 28 | ||
33 | dev->type = ARPHRD_LOCALTLK; | 29 | dev->type = ARPHRD_LOCALTLK; |
34 | dev->hard_header_len = LTALK_HLEN; | 30 | dev->hard_header_len = LTALK_HLEN; |
diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c index 930e4918037f..f047a57aa95c 100644 --- a/net/ax25/ax25_ip.c +++ b/net/ax25/ax25_ip.c | |||
@@ -46,7 +46,9 @@ | |||
46 | 46 | ||
47 | #ifdef CONFIG_INET | 47 | #ifdef CONFIG_INET |
48 | 48 | ||
49 | int ax25_hard_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) | 49 | int ax25_hard_header(struct sk_buff *skb, struct net_device *dev, |
50 | unsigned short type, const void *daddr, | ||
51 | const void *saddr, unsigned len) | ||
50 | { | 52 | { |
51 | unsigned char *buff; | 53 | unsigned char *buff; |
52 | 54 | ||
@@ -215,7 +217,9 @@ put: | |||
215 | 217 | ||
216 | #else /* INET */ | 218 | #else /* INET */ |
217 | 219 | ||
218 | int ax25_hard_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) | 220 | int ax25_hard_header(struct sk_buff *skb, struct net_device *dev, |
221 | unsigned short type, const void *daddr, | ||
222 | const void *saddr, unsigned len) | ||
219 | { | 223 | { |
220 | return -AX25_HEADER_LEN; | 224 | return -AX25_HEADER_LEN; |
221 | } | 225 | } |
@@ -227,5 +231,12 @@ int ax25_rebuild_header(struct sk_buff *skb) | |||
227 | 231 | ||
228 | #endif | 232 | #endif |
229 | 233 | ||
234 | const struct header_ops ax25_header_ops = { | ||
235 | .create = ax25_hard_header, | ||
236 | .rebuild = ax25_rebuild_header, | ||
237 | }; | ||
238 | |||
230 | EXPORT_SYMBOL(ax25_hard_header); | 239 | EXPORT_SYMBOL(ax25_hard_header); |
231 | EXPORT_SYMBOL(ax25_rebuild_header); | 240 | EXPORT_SYMBOL(ax25_rebuild_header); |
241 | EXPORT_SYMBOL(ax25_header_ops); | ||
242 | |||
diff --git a/net/core/dev.c b/net/core/dev.c index 3923d5133050..d99864662582 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -967,14 +967,6 @@ void dev_load(struct net *net, const char *name) | |||
967 | request_module("%s", name); | 967 | request_module("%s", name); |
968 | } | 968 | } |
969 | 969 | ||
970 | static int default_rebuild_header(struct sk_buff *skb) | ||
971 | { | ||
972 | printk(KERN_DEBUG "%s: default_rebuild_header called -- BUG!\n", | ||
973 | skb->dev ? skb->dev->name : "NULL!!!"); | ||
974 | kfree_skb(skb); | ||
975 | return 1; | ||
976 | } | ||
977 | |||
978 | /** | 970 | /** |
979 | * dev_open - prepare an interface for use. | 971 | * dev_open - prepare an interface for use. |
980 | * @dev: device to open | 972 | * @dev: device to open |
@@ -3561,14 +3553,6 @@ int register_netdevice(struct net_device *dev) | |||
3561 | } | 3553 | } |
3562 | } | 3554 | } |
3563 | 3555 | ||
3564 | /* | ||
3565 | * nil rebuild_header routine, | ||
3566 | * that should be never called and used as just bug trap. | ||
3567 | */ | ||
3568 | |||
3569 | if (!dev->rebuild_header) | ||
3570 | dev->rebuild_header = default_rebuild_header; | ||
3571 | |||
3572 | ret = netdev_register_kobject(dev); | 3556 | ret = netdev_register_kobject(dev); |
3573 | if (ret) | 3557 | if (ret) |
3574 | goto err_uninit; | 3558 | goto err_uninit; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 10bcb9f8da5c..c52df858d0be 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -897,8 +897,8 @@ out_unlock_bh: | |||
897 | static void neigh_update_hhs(struct neighbour *neigh) | 897 | static void neigh_update_hhs(struct neighbour *neigh) |
898 | { | 898 | { |
899 | struct hh_cache *hh; | 899 | struct hh_cache *hh; |
900 | void (*update)(struct hh_cache*, struct net_device*, unsigned char *) = | 900 | void (*update)(struct hh_cache*, const struct net_device*, const unsigned char *) |
901 | neigh->dev->header_cache_update; | 901 | = neigh->dev->header_ops->cache_update; |
902 | 902 | ||
903 | if (update) { | 903 | if (update) { |
904 | for (hh = neigh->hh; hh; hh = hh->hh_next) { | 904 | for (hh = neigh->hh; hh; hh = hh->hh_next) { |
@@ -1095,7 +1095,8 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst, | |||
1095 | hh->hh_type = protocol; | 1095 | hh->hh_type = protocol; |
1096 | atomic_set(&hh->hh_refcnt, 0); | 1096 | atomic_set(&hh->hh_refcnt, 0); |
1097 | hh->hh_next = NULL; | 1097 | hh->hh_next = NULL; |
1098 | if (dev->hard_header_cache(n, hh)) { | 1098 | |
1099 | if (dev->header_ops->cache(n, hh)) { | ||
1099 | kfree(hh); | 1100 | kfree(hh); |
1100 | hh = NULL; | 1101 | hh = NULL; |
1101 | } else { | 1102 | } else { |
@@ -1127,7 +1128,7 @@ int neigh_compat_output(struct sk_buff *skb) | |||
1127 | 1128 | ||
1128 | if (dev_hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, | 1129 | if (dev_hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, |
1129 | skb->len) < 0 && | 1130 | skb->len) < 0 && |
1130 | dev->rebuild_header(skb)) | 1131 | dev->header_ops->rebuild(skb)) |
1131 | return 0; | 1132 | return 0; |
1132 | 1133 | ||
1133 | return dev_queue_xmit(skb); | 1134 | return dev_queue_xmit(skb); |
@@ -1149,7 +1150,7 @@ int neigh_resolve_output(struct sk_buff *skb) | |||
1149 | if (!neigh_event_send(neigh, skb)) { | 1150 | if (!neigh_event_send(neigh, skb)) { |
1150 | int err; | 1151 | int err; |
1151 | struct net_device *dev = neigh->dev; | 1152 | struct net_device *dev = neigh->dev; |
1152 | if (dev->hard_header_cache && !dst->hh) { | 1153 | if (dev->header_ops->cache && !dst->hh) { |
1153 | write_lock_bh(&neigh->lock); | 1154 | write_lock_bh(&neigh->lock); |
1154 | if (!dst->hh) | 1155 | if (!dst->hh) |
1155 | neigh_hh_init(neigh, dst, dst->ops->protocol); | 1156 | neigh_hh_init(neigh, dst, dst->ops->protocol); |
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index bdeb2f0ace32..ed8a3d49487d 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -75,8 +75,9 @@ __setup("ether=", netdev_boot_setup); | |||
75 | * Set the protocol type. For a packet of type ETH_P_802_3 we put the length | 75 | * Set the protocol type. For a packet of type ETH_P_802_3 we put the length |
76 | * in here instead. It is up to the 802.2 layer to carry protocol information. | 76 | * in here instead. It is up to the 802.2 layer to carry protocol information. |
77 | */ | 77 | */ |
78 | int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | 78 | int eth_header(struct sk_buff *skb, struct net_device *dev, |
79 | void *daddr, void *saddr, unsigned len) | 79 | unsigned short type, |
80 | const void *daddr, const void *saddr, unsigned len) | ||
80 | { | 81 | { |
81 | struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); | 82 | struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); |
82 | 83 | ||
@@ -109,6 +110,7 @@ int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | |||
109 | 110 | ||
110 | return -ETH_HLEN; | 111 | return -ETH_HLEN; |
111 | } | 112 | } |
113 | EXPORT_SYMBOL(eth_header); | ||
112 | 114 | ||
113 | /** | 115 | /** |
114 | * eth_rebuild_header- rebuild the Ethernet MAC header. | 116 | * eth_rebuild_header- rebuild the Ethernet MAC header. |
@@ -141,6 +143,7 @@ int eth_rebuild_header(struct sk_buff *skb) | |||
141 | 143 | ||
142 | return 0; | 144 | return 0; |
143 | } | 145 | } |
146 | EXPORT_SYMBOL(eth_rebuild_header); | ||
144 | 147 | ||
145 | /** | 148 | /** |
146 | * eth_type_trans - determine the packet's protocol ID. | 149 | * eth_type_trans - determine the packet's protocol ID. |
@@ -207,12 +210,13 @@ EXPORT_SYMBOL(eth_type_trans); | |||
207 | * @skb: packet to extract header from | 210 | * @skb: packet to extract header from |
208 | * @haddr: destination buffer | 211 | * @haddr: destination buffer |
209 | */ | 212 | */ |
210 | static int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr) | 213 | int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr) |
211 | { | 214 | { |
212 | const struct ethhdr *eth = eth_hdr(skb); | 215 | const struct ethhdr *eth = eth_hdr(skb); |
213 | memcpy(haddr, eth->h_source, ETH_ALEN); | 216 | memcpy(haddr, eth->h_source, ETH_ALEN); |
214 | return ETH_ALEN; | 217 | return ETH_ALEN; |
215 | } | 218 | } |
219 | EXPORT_SYMBOL(eth_header_parse); | ||
216 | 220 | ||
217 | /** | 221 | /** |
218 | * eth_header_cache - fill cache entry from neighbour | 222 | * eth_header_cache - fill cache entry from neighbour |
@@ -220,11 +224,11 @@ static int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr) | |||
220 | * @hh: destination cache entry | 224 | * @hh: destination cache entry |
221 | * Create an Ethernet header template from the neighbour. | 225 | * Create an Ethernet header template from the neighbour. |
222 | */ | 226 | */ |
223 | int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh) | 227 | int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh) |
224 | { | 228 | { |
225 | __be16 type = hh->hh_type; | 229 | __be16 type = hh->hh_type; |
226 | struct ethhdr *eth; | 230 | struct ethhdr *eth; |
227 | struct net_device *dev = neigh->dev; | 231 | const struct net_device *dev = neigh->dev; |
228 | 232 | ||
229 | eth = (struct ethhdr *) | 233 | eth = (struct ethhdr *) |
230 | (((u8 *) hh->hh_data) + (HH_DATA_OFF(sizeof(*eth)))); | 234 | (((u8 *) hh->hh_data) + (HH_DATA_OFF(sizeof(*eth)))); |
@@ -238,6 +242,7 @@ int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh) | |||
238 | hh->hh_len = ETH_HLEN; | 242 | hh->hh_len = ETH_HLEN; |
239 | return 0; | 243 | return 0; |
240 | } | 244 | } |
245 | EXPORT_SYMBOL(eth_header_cache); | ||
241 | 246 | ||
242 | /** | 247 | /** |
243 | * eth_header_cache_update - update cache entry | 248 | * eth_header_cache_update - update cache entry |
@@ -247,12 +252,14 @@ int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh) | |||
247 | * | 252 | * |
248 | * Called by Address Resolution module to notify changes in address. | 253 | * Called by Address Resolution module to notify changes in address. |
249 | */ | 254 | */ |
250 | void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, | 255 | void eth_header_cache_update(struct hh_cache *hh, |
251 | unsigned char *haddr) | 256 | const struct net_device *dev, |
257 | const unsigned char *haddr) | ||
252 | { | 258 | { |
253 | memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)), | 259 | memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)), |
254 | haddr, ETH_ALEN); | 260 | haddr, ETH_ALEN); |
255 | } | 261 | } |
262 | EXPORT_SYMBOL(eth_header_cache_update); | ||
256 | 263 | ||
257 | /** | 264 | /** |
258 | * eth_mac_addr - set new Ethernet hardware address | 265 | * eth_mac_addr - set new Ethernet hardware address |
@@ -291,6 +298,14 @@ static int eth_change_mtu(struct net_device *dev, int new_mtu) | |||
291 | return 0; | 298 | return 0; |
292 | } | 299 | } |
293 | 300 | ||
301 | const struct header_ops eth_header_ops ____cacheline_aligned = { | ||
302 | .create = eth_header, | ||
303 | .parse = eth_header_parse, | ||
304 | .rebuild = eth_rebuild_header, | ||
305 | .cache = eth_header_cache, | ||
306 | .cache_update = eth_header_cache_update, | ||
307 | }; | ||
308 | |||
294 | /** | 309 | /** |
295 | * ether_setup - setup Ethernet network device | 310 | * ether_setup - setup Ethernet network device |
296 | * @dev: network device | 311 | * @dev: network device |
@@ -298,13 +313,10 @@ static int eth_change_mtu(struct net_device *dev, int new_mtu) | |||
298 | */ | 313 | */ |
299 | void ether_setup(struct net_device *dev) | 314 | void ether_setup(struct net_device *dev) |
300 | { | 315 | { |
316 | dev->header_ops = ð_header_ops; | ||
317 | |||
301 | dev->change_mtu = eth_change_mtu; | 318 | dev->change_mtu = eth_change_mtu; |
302 | dev->hard_header = eth_header; | ||
303 | dev->rebuild_header = eth_rebuild_header; | ||
304 | dev->set_mac_address = eth_mac_addr; | 319 | dev->set_mac_address = eth_mac_addr; |
305 | dev->hard_header_cache = eth_header_cache; | ||
306 | dev->header_cache_update= eth_header_cache_update; | ||
307 | dev->hard_header_parse = eth_header_parse; | ||
308 | 320 | ||
309 | dev->type = ARPHRD_ETHER; | 321 | dev->type = ARPHRD_ETHER; |
310 | dev->hard_header_len = ETH_HLEN; | 322 | dev->hard_header_len = ETH_HLEN; |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 5b24c65b13c6..d8248198bcd7 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -253,7 +253,7 @@ static int arp_constructor(struct neighbour *neigh) | |||
253 | neigh->parms = neigh_parms_clone(parms); | 253 | neigh->parms = neigh_parms_clone(parms); |
254 | rcu_read_unlock(); | 254 | rcu_read_unlock(); |
255 | 255 | ||
256 | if (dev->hard_header == NULL) { | 256 | if (!dev->header_ops) { |
257 | neigh->nud_state = NUD_NOARP; | 257 | neigh->nud_state = NUD_NOARP; |
258 | neigh->ops = &arp_direct_ops; | 258 | neigh->ops = &arp_direct_ops; |
259 | neigh->output = neigh->ops->queue_xmit; | 259 | neigh->output = neigh->ops->queue_xmit; |
@@ -310,10 +310,12 @@ static int arp_constructor(struct neighbour *neigh) | |||
310 | neigh->nud_state = NUD_NOARP; | 310 | neigh->nud_state = NUD_NOARP; |
311 | memcpy(neigh->ha, dev->broadcast, dev->addr_len); | 311 | memcpy(neigh->ha, dev->broadcast, dev->addr_len); |
312 | } | 312 | } |
313 | if (dev->hard_header_cache) | 313 | |
314 | if (dev->header_ops->cache) | ||
314 | neigh->ops = &arp_hh_ops; | 315 | neigh->ops = &arp_hh_ops; |
315 | else | 316 | else |
316 | neigh->ops = &arp_generic_ops; | 317 | neigh->ops = &arp_generic_ops; |
318 | |||
317 | if (neigh->nud_state&NUD_VALID) | 319 | if (neigh->nud_state&NUD_VALID) |
318 | neigh->output = neigh->ops->connected_output; | 320 | neigh->output = neigh->ops->connected_output; |
319 | else | 321 | else |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index ffa9f1c9dcbb..f151900efaf9 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -684,7 +684,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
684 | goto tx_error; | 684 | goto tx_error; |
685 | } | 685 | } |
686 | 686 | ||
687 | if (dev->hard_header) { | 687 | if (dev->header_ops) { |
688 | gre_hlen = 0; | 688 | gre_hlen = 0; |
689 | tiph = (struct iphdr*)skb->data; | 689 | tiph = (struct iphdr*)skb->data; |
690 | } else { | 690 | } else { |
@@ -1063,8 +1063,9 @@ static int ipgre_tunnel_change_mtu(struct net_device *dev, int new_mtu) | |||
1063 | 1063 | ||
1064 | */ | 1064 | */ |
1065 | 1065 | ||
1066 | static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | 1066 | static int ipgre_header(struct sk_buff *skb, struct net_device *dev, |
1067 | void *daddr, void *saddr, unsigned len) | 1067 | unsigned short type, |
1068 | const void *daddr, const void *saddr, unsigned len) | ||
1068 | { | 1069 | { |
1069 | struct ip_tunnel *t = netdev_priv(dev); | 1070 | struct ip_tunnel *t = netdev_priv(dev); |
1070 | struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); | 1071 | struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen); |
@@ -1091,6 +1092,10 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, unsigned sh | |||
1091 | return -t->hlen; | 1092 | return -t->hlen; |
1092 | } | 1093 | } |
1093 | 1094 | ||
1095 | static const struct header_ops ipgre_header_ops = { | ||
1096 | .create = ipgre_header, | ||
1097 | }; | ||
1098 | |||
1094 | static int ipgre_open(struct net_device *dev) | 1099 | static int ipgre_open(struct net_device *dev) |
1095 | { | 1100 | { |
1096 | struct ip_tunnel *t = netdev_priv(dev); | 1101 | struct ip_tunnel *t = netdev_priv(dev); |
@@ -1187,7 +1192,7 @@ static int ipgre_tunnel_init(struct net_device *dev) | |||
1187 | if (!iph->saddr) | 1192 | if (!iph->saddr) |
1188 | return -EINVAL; | 1193 | return -EINVAL; |
1189 | dev->flags = IFF_BROADCAST; | 1194 | dev->flags = IFF_BROADCAST; |
1190 | dev->hard_header = ipgre_header; | 1195 | dev->header_ops = &ipgre_header_ops; |
1191 | dev->open = ipgre_open; | 1196 | dev->open = ipgre_open; |
1192 | dev->stop = ipgre_close; | 1197 | dev->stop = ipgre_close; |
1193 | } | 1198 | } |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 77f67b7cb9bf..699f06781fd8 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -169,7 +169,7 @@ static inline int ip_finish_output2(struct sk_buff *skb) | |||
169 | IP_INC_STATS(IPSTATS_MIB_OUTBCASTPKTS); | 169 | IP_INC_STATS(IPSTATS_MIB_OUTBCASTPKTS); |
170 | 170 | ||
171 | /* Be paranoid, rather than too clever. */ | 171 | /* Be paranoid, rather than too clever. */ |
172 | if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) { | 172 | if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { |
173 | struct sk_buff *skb2; | 173 | struct sk_buff *skb2; |
174 | 174 | ||
175 | skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); | 175 | skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 7ea5a502ca08..b761dbed8cec 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -354,7 +354,7 @@ static int ndisc_constructor(struct neighbour *neigh) | |||
354 | rcu_read_unlock(); | 354 | rcu_read_unlock(); |
355 | 355 | ||
356 | neigh->type = is_multicast ? RTN_MULTICAST : RTN_UNICAST; | 356 | neigh->type = is_multicast ? RTN_MULTICAST : RTN_UNICAST; |
357 | if (dev->hard_header == NULL) { | 357 | if (!dev->header_ops) { |
358 | neigh->nud_state = NUD_NOARP; | 358 | neigh->nud_state = NUD_NOARP; |
359 | neigh->ops = &ndisc_direct_ops; | 359 | neigh->ops = &ndisc_direct_ops; |
360 | neigh->output = neigh->ops->queue_xmit; | 360 | neigh->output = neigh->ops->queue_xmit; |
@@ -371,7 +371,7 @@ static int ndisc_constructor(struct neighbour *neigh) | |||
371 | neigh->nud_state = NUD_NOARP; | 371 | neigh->nud_state = NUD_NOARP; |
372 | memcpy(neigh->ha, dev->broadcast, dev->addr_len); | 372 | memcpy(neigh->ha, dev->broadcast, dev->addr_len); |
373 | } | 373 | } |
374 | if (dev->hard_header_cache) | 374 | if (dev->header_ops->cache) |
375 | neigh->ops = &ndisc_hh_ops; | 375 | neigh->ops = &ndisc_hh_ops; |
376 | else | 376 | else |
377 | neigh->ops = &ndisc_generic_ops; | 377 | neigh->ops = &ndisc_generic_ops; |
@@ -807,7 +807,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
807 | neigh_update(neigh, lladdr, NUD_STALE, | 807 | neigh_update(neigh, lladdr, NUD_STALE, |
808 | NEIGH_UPDATE_F_WEAK_OVERRIDE| | 808 | NEIGH_UPDATE_F_WEAK_OVERRIDE| |
809 | NEIGH_UPDATE_F_OVERRIDE); | 809 | NEIGH_UPDATE_F_OVERRIDE); |
810 | if (neigh || !dev->hard_header) { | 810 | if (neigh || !dev->header_ops) { |
811 | ndisc_send_na(dev, neigh, saddr, &msg->target, | 811 | ndisc_send_na(dev, neigh, saddr, &msg->target, |
812 | is_router, | 812 | is_router, |
813 | 1, (ifp != NULL && inc), inc); | 813 | 1, (ifp != NULL && inc), inc); |
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 0cdcf0d0c6ca..57ec8880bb1a 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -228,7 +228,6 @@ void ieee80211_if_mgmt_setup(struct net_device *dev) | |||
228 | dev->open = ieee80211_mgmt_open; | 228 | dev->open = ieee80211_mgmt_open; |
229 | dev->stop = ieee80211_mgmt_stop; | 229 | dev->stop = ieee80211_mgmt_stop; |
230 | dev->type = ARPHRD_IEEE80211_PRISM; | 230 | dev->type = ARPHRD_IEEE80211_PRISM; |
231 | dev->hard_header_parse = header_parse_80211; | ||
232 | dev->uninit = ieee80211_if_reinit; | 231 | dev->uninit = ieee80211_if_reinit; |
233 | dev->destructor = ieee80211_if_free; | 232 | dev->destructor = ieee80211_if_free; |
234 | } | 233 | } |
@@ -546,10 +545,19 @@ static void ieee80211_set_multicast_list(struct net_device *dev) | |||
546 | netif_tx_unlock(local->mdev); | 545 | netif_tx_unlock(local->mdev); |
547 | } | 546 | } |
548 | 547 | ||
548 | static const struct header_ops ieee80211_header_ops = { | ||
549 | .create = eth_header, | ||
550 | .parse = header_parse_80211, | ||
551 | .rebuild = eth_rebuild_header, | ||
552 | .cache = eth_header_cache, | ||
553 | .cache_update = eth_header_cache_update, | ||
554 | }; | ||
555 | |||
549 | /* Must not be called for mdev and apdev */ | 556 | /* Must not be called for mdev and apdev */ |
550 | void ieee80211_if_setup(struct net_device *dev) | 557 | void ieee80211_if_setup(struct net_device *dev) |
551 | { | 558 | { |
552 | ether_setup(dev); | 559 | ether_setup(dev); |
560 | dev->header_ops = &ieee80211_header_ops; | ||
553 | dev->hard_start_xmit = ieee80211_subif_start_xmit; | 561 | dev->hard_start_xmit = ieee80211_subif_start_xmit; |
554 | dev->wireless_handlers = &ieee80211_iw_handler_def; | 562 | dev->wireless_handlers = &ieee80211_iw_handler_def; |
555 | dev->set_multicast_list = ieee80211_set_multicast_list; | 563 | dev->set_multicast_list = ieee80211_set_multicast_list; |
@@ -1197,7 +1205,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, | |||
1197 | mdev->open = ieee80211_master_open; | 1205 | mdev->open = ieee80211_master_open; |
1198 | mdev->stop = ieee80211_master_stop; | 1206 | mdev->stop = ieee80211_master_stop; |
1199 | mdev->type = ARPHRD_IEEE80211; | 1207 | mdev->type = ARPHRD_IEEE80211; |
1200 | mdev->hard_header_parse = header_parse_80211; | 1208 | mdev->header_ops = &ieee80211_header_ops; |
1201 | 1209 | ||
1202 | sdata->type = IEEE80211_IF_TYPE_AP; | 1210 | sdata->type = IEEE80211_IF_TYPE_AP; |
1203 | sdata->dev = mdev; | 1211 | sdata->dev = mdev; |
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index c7b5d930e732..8c68da5ef0a1 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c | |||
@@ -95,8 +95,9 @@ static int nr_rebuild_header(struct sk_buff *skb) | |||
95 | 95 | ||
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | static int nr_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | 98 | static int nr_header(struct sk_buff *skb, struct net_device *dev, |
99 | void *daddr, void *saddr, unsigned len) | 99 | unsigned short type, |
100 | const void *daddr, const void *saddr, unsigned len) | ||
100 | { | 101 | { |
101 | unsigned char *buff = skb_push(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN); | 102 | unsigned char *buff = skb_push(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN); |
102 | 103 | ||
@@ -193,6 +194,12 @@ static struct net_device_stats *nr_get_stats(struct net_device *dev) | |||
193 | return &nr->stats; | 194 | return &nr->stats; |
194 | } | 195 | } |
195 | 196 | ||
197 | static const struct header_ops nr_header_ops = { | ||
198 | .create = nr_header, | ||
199 | .rebuild= nr_rebuild_header, | ||
200 | }; | ||
201 | |||
202 | |||
196 | void nr_setup(struct net_device *dev) | 203 | void nr_setup(struct net_device *dev) |
197 | { | 204 | { |
198 | dev->mtu = NR_MAX_PACKET_SIZE; | 205 | dev->mtu = NR_MAX_PACKET_SIZE; |
@@ -200,11 +207,10 @@ void nr_setup(struct net_device *dev) | |||
200 | dev->open = nr_open; | 207 | dev->open = nr_open; |
201 | dev->stop = nr_close; | 208 | dev->stop = nr_close; |
202 | 209 | ||
203 | dev->hard_header = nr_header; | 210 | dev->header_ops = &nr_header_ops; |
204 | dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; | 211 | dev->hard_header_len = NR_NETWORK_LEN + NR_TRANSPORT_LEN; |
205 | dev->addr_len = AX25_ADDR_LEN; | 212 | dev->addr_len = AX25_ADDR_LEN; |
206 | dev->type = ARPHRD_NETROM; | 213 | dev->type = ARPHRD_NETROM; |
207 | dev->rebuild_header = nr_rebuild_header; | ||
208 | dev->set_mac_address = nr_set_mac_address; | 214 | dev->set_mac_address = nr_set_mac_address; |
209 | 215 | ||
210 | /* New-style flags. */ | 216 | /* New-style flags. */ |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index c9ee343c2a6c..e11000a8e950 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -389,7 +389,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, | |||
389 | skb_reset_network_header(skb); | 389 | skb_reset_network_header(skb); |
390 | 390 | ||
391 | /* Try to align data part correctly */ | 391 | /* Try to align data part correctly */ |
392 | if (dev->hard_header) { | 392 | if (dev->header_ops) { |
393 | skb->data -= dev->hard_header_len; | 393 | skb->data -= dev->hard_header_len; |
394 | skb->tail -= dev->hard_header_len; | 394 | skb->tail -= dev->hard_header_len; |
395 | if (len < dev->hard_header_len) | 395 | if (len < dev->hard_header_len) |
@@ -466,7 +466,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
466 | 466 | ||
467 | skb->dev = dev; | 467 | skb->dev = dev; |
468 | 468 | ||
469 | if (dev->hard_header) { | 469 | if (dev->header_ops) { |
470 | /* The device has an explicit notion of ll header, | 470 | /* The device has an explicit notion of ll header, |
471 | exported to higher levels. | 471 | exported to higher levels. |
472 | 472 | ||
@@ -581,7 +581,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
581 | sk = pt->af_packet_priv; | 581 | sk = pt->af_packet_priv; |
582 | po = pkt_sk(sk); | 582 | po = pkt_sk(sk); |
583 | 583 | ||
584 | if (dev->hard_header) { | 584 | if (dev->header_ops) { |
585 | if (sk->sk_type != SOCK_DGRAM) | 585 | if (sk->sk_type != SOCK_DGRAM) |
586 | skb_push(skb, skb->data - skb_mac_header(skb)); | 586 | skb_push(skb, skb->data - skb_mac_header(skb)); |
587 | else if (skb->pkt_type == PACKET_OUTGOING) { | 587 | else if (skb->pkt_type == PACKET_OUTGOING) { |
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c index 8d88795dc663..1b6741f1d746 100644 --- a/net/rose/rose_dev.c +++ b/net/rose/rose_dev.c | |||
@@ -35,8 +35,9 @@ | |||
35 | #include <net/ax25.h> | 35 | #include <net/ax25.h> |
36 | #include <net/rose.h> | 36 | #include <net/rose.h> |
37 | 37 | ||
38 | static int rose_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, | 38 | static int rose_header(struct sk_buff *skb, struct net_device *dev, |
39 | void *daddr, void *saddr, unsigned len) | 39 | unsigned short type, |
40 | const void *daddr, const void *saddr, unsigned len) | ||
40 | { | 41 | { |
41 | unsigned char *buff = skb_push(skb, ROSE_MIN_LEN + 2); | 42 | unsigned char *buff = skb_push(skb, ROSE_MIN_LEN + 2); |
42 | 43 | ||
@@ -148,6 +149,11 @@ static struct net_device_stats *rose_get_stats(struct net_device *dev) | |||
148 | return netdev_priv(dev); | 149 | return netdev_priv(dev); |
149 | } | 150 | } |
150 | 151 | ||
152 | static const struct header_ops rose_header_ops = { | ||
153 | .create = rose_header, | ||
154 | .rebuild= rose_rebuild_header, | ||
155 | }; | ||
156 | |||
151 | void rose_setup(struct net_device *dev) | 157 | void rose_setup(struct net_device *dev) |
152 | { | 158 | { |
153 | dev->mtu = ROSE_MAX_PACKET_SIZE - 2; | 159 | dev->mtu = ROSE_MAX_PACKET_SIZE - 2; |
@@ -155,11 +161,10 @@ void rose_setup(struct net_device *dev) | |||
155 | dev->open = rose_open; | 161 | dev->open = rose_open; |
156 | dev->stop = rose_close; | 162 | dev->stop = rose_close; |
157 | 163 | ||
158 | dev->hard_header = rose_header; | 164 | dev->header_ops = &rose_header_ops; |
159 | dev->hard_header_len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN; | 165 | dev->hard_header_len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN; |
160 | dev->addr_len = ROSE_ADDR_LEN; | 166 | dev->addr_len = ROSE_ADDR_LEN; |
161 | dev->type = ARPHRD_ROSE; | 167 | dev->type = ARPHRD_ROSE; |
162 | dev->rebuild_header = rose_rebuild_header; | ||
163 | dev->set_mac_address = rose_set_mac_address; | 168 | dev->set_mac_address = rose_set_mac_address; |
164 | 169 | ||
165 | /* New-style flags. */ | 170 | /* New-style flags. */ |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index d13970f3c7b1..be57cf317a7f 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -249,10 +249,10 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device * | |||
249 | return (skb_res == NULL) ? -EAGAIN : 1; | 249 | return (skb_res == NULL) ? -EAGAIN : 1; |
250 | } | 250 | } |
251 | 251 | ||
252 | static __inline__ int | 252 | static inline int teql_resolve(struct sk_buff *skb, |
253 | teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *dev) | 253 | struct sk_buff *skb_res, struct net_device *dev) |
254 | { | 254 | { |
255 | if (dev->hard_header == NULL || | 255 | if (dev->header_ops == NULL || |
256 | skb->dst == NULL || | 256 | skb->dst == NULL || |
257 | skb->dst->neighbour == NULL) | 257 | skb->dst->neighbour == NULL) |
258 | return 0; | 258 | return 0; |