net: Push protocol type directly down to header_ops->cache()
authorDavid S. Miller <davem@davemloft.net>
Wed, 13 Jul 2011 06:28:12 +0000 (23:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 Jul 2011 09:29:59 +0000 (02:29 -0700)
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/firewire/net.c
drivers/isdn/i4l/isdn_net.c
drivers/net/plip.c
include/linux/etherdevice.h
include/linux/netdevice.h
net/core/neighbour.c
net/ethernet/eth.c

index b9762d07198d3a6fb4383ebc3fcc60c17c4a17c0..eced1c25bf586c07114133d23454fd7a4ff9c395 100644 (file)
@@ -261,16 +261,16 @@ static int fwnet_header_rebuild(struct sk_buff *skb)
 }
 
 static int fwnet_header_cache(const struct neighbour *neigh,
-                             struct hh_cache *hh)
+                             struct hh_cache *hh, __be16 type)
 {
        struct net_device *net;
        struct fwnet_header *h;
 
-       if (hh->hh_type == cpu_to_be16(ETH_P_802_3))
+       if (type == cpu_to_be16(ETH_P_802_3))
                return -1;
        net = neigh->dev;
        h = (struct fwnet_header *)((u8 *)hh->hh_data + 16 - sizeof(*h));
-       h->h_proto = hh->hh_type;
+       h->h_proto = type;
        memcpy(h->h_dest, neigh->ha, net->addr_len);
        hh->hh_len = FWNET_HLEN;
 
index 97988111e45a9e8659c8c41ba2a8d31d953d9ff1..48e9cc0369b10214d798b4a857248340e444a7b3 100644 (file)
@@ -1983,13 +1983,14 @@ isdn_net_rebuild_header(struct sk_buff *skb)
        return ret;
 }
 
-static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
+static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
+                            __be16 type)
 {
        const struct net_device *dev = neigh->dev;
        isdn_net_local *lp = netdev_priv(dev);
 
        if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
-               return eth_header_cache(neigh, hh);
+               return eth_header_cache(neigh, hh, type);
        return -1;
 }
 
index ca4df7f4cf21df0099c883a2484c482e202246b0..a9e9ca8a86edbe2c4d7e7c9f7718420842e8aa6c 100644 (file)
@@ -152,7 +152,7 @@ static int plip_hard_header(struct sk_buff *skb, struct net_device *dev,
                             unsigned short type, const void *daddr,
                            const void *saddr, unsigned len);
 static int plip_hard_header_cache(const struct neighbour *neigh,
-                                  struct hh_cache *hh);
+                                  struct hh_cache *hh, __be16 type);
 static int plip_open(struct net_device *dev);
 static int plip_close(struct net_device *dev);
 static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
@@ -1026,11 +1026,11 @@ plip_hard_header(struct sk_buff *skb, struct net_device *dev,
 }
 
 static int plip_hard_header_cache(const struct neighbour *neigh,
-                                 struct hh_cache *hh)
+                                 struct hh_cache *hh, __be16 type)
 {
        int ret;
 
-       ret = eth_header_cache(neigh, hh);
+       ret = eth_header_cache(neigh, hh, type);
        if (ret == 0) {
                struct ethhdr *eth;
 
index ab68f785fd196fb73ef062a67b9ad195d84bcd13..05955cf09937c17e0db7584275168485008b7a0d 100644 (file)
@@ -38,7 +38,7 @@ extern int eth_header(struct sk_buff *skb, struct net_device *dev,
                      const void *daddr, const void *saddr, unsigned len);
 extern int eth_rebuild_header(struct sk_buff *skb);
 extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
-extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
+extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
 extern void eth_header_cache_update(struct hh_cache *hh,
                                    const struct net_device *dev,
                                    const unsigned char *haddr);
index 30f17e42c30402a67f635212ffabf7164ef12a4c..564d89fdddda9d6bfa95ecb2b8e5af8939dbadee 100644 (file)
@@ -308,7 +308,7 @@ struct header_ops {
                           const void *saddr, unsigned len);
        int     (*parse)(const struct sk_buff *skb, unsigned char *haddr);
        int     (*rebuild)(struct sk_buff *skb);
-       int     (*cache)(const struct neighbour *neigh, struct hh_cache *hh);
+       int     (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
        void    (*cache_update)(struct hh_cache *hh,
                                const struct net_device *dev,
                                const unsigned char *haddr);
index 50bd960983e0e23d196b6ab50775cfcd7844acf7..8f7e1d8d92a00c41c82477aaaf8efcfdbf2e3dc0 100644 (file)
@@ -1247,7 +1247,7 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
        hh->hh_type = protocol;
        atomic_set(&hh->hh_refcnt, 2);
 
-       if (dev->header_ops->cache(n, hh)) {
+       if (dev->header_ops->cache(n, hh, protocol)) {
                kfree(hh);
                return;
        }
index 44d2b42fda5616017c14f1db3caf23dd3a39935c..5cffb63f481a9a43f8af4c7f5e69e26e45a7aa06 100644 (file)
@@ -233,9 +233,8 @@ EXPORT_SYMBOL(eth_header_parse);
  * @hh: destination cache entry
  * Create an Ethernet header template from the neighbour.
  */
-int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
+int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type)
 {
-       __be16 type = hh->hh_type;
        struct ethhdr *eth;
        const struct net_device *dev = neigh->dev;