aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-07-13 02:28:12 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-13 05:29:59 -0400
commite69dd336ee3a05a589629b505b18ba5e7a5b4c54 (patch)
treece221d370029164d5ea498ab0da50672d03a5b0e
parent3769cffb1c48f64640ffab7ce3bffe867342c0f0 (diff)
net: Push protocol type directly down to header_ops->cache()
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/firewire/net.c6
-rw-r--r--drivers/isdn/i4l/isdn_net.c5
-rw-r--r--drivers/net/plip.c6
-rw-r--r--include/linux/etherdevice.h2
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/ethernet/eth.c3
7 files changed, 13 insertions, 13 deletions
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index b9762d07198d..eced1c25bf58 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -261,16 +261,16 @@ static int fwnet_header_rebuild(struct sk_buff *skb)
261} 261}
262 262
263static int fwnet_header_cache(const struct neighbour *neigh, 263static int fwnet_header_cache(const struct neighbour *neigh,
264 struct hh_cache *hh) 264 struct hh_cache *hh, __be16 type)
265{ 265{
266 struct net_device *net; 266 struct net_device *net;
267 struct fwnet_header *h; 267 struct fwnet_header *h;
268 268
269 if (hh->hh_type == cpu_to_be16(ETH_P_802_3)) 269 if (type == cpu_to_be16(ETH_P_802_3))
270 return -1; 270 return -1;
271 net = neigh->dev; 271 net = neigh->dev;
272 h = (struct fwnet_header *)((u8 *)hh->hh_data + 16 - sizeof(*h)); 272 h = (struct fwnet_header *)((u8 *)hh->hh_data + 16 - sizeof(*h));
273 h->h_proto = hh->hh_type; 273 h->h_proto = type;
274 memcpy(h->h_dest, neigh->ha, net->addr_len); 274 memcpy(h->h_dest, neigh->ha, net->addr_len);
275 hh->hh_len = FWNET_HLEN; 275 hh->hh_len = FWNET_HLEN;
276 276
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 97988111e45a..48e9cc0369b1 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1983,13 +1983,14 @@ isdn_net_rebuild_header(struct sk_buff *skb)
1983 return ret; 1983 return ret;
1984} 1984}
1985 1985
1986static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh) 1986static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
1987 __be16 type)
1987{ 1988{
1988 const struct net_device *dev = neigh->dev; 1989 const struct net_device *dev = neigh->dev;
1989 isdn_net_local *lp = netdev_priv(dev); 1990 isdn_net_local *lp = netdev_priv(dev);
1990 1991
1991 if (lp->p_encap == ISDN_NET_ENCAP_ETHER) 1992 if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
1992 return eth_header_cache(neigh, hh); 1993 return eth_header_cache(neigh, hh, type);
1993 return -1; 1994 return -1;
1994} 1995}
1995 1996
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index ca4df7f4cf21..a9e9ca8a86ed 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -152,7 +152,7 @@ static int plip_hard_header(struct sk_buff *skb, struct net_device *dev,
152 unsigned short type, const void *daddr, 152 unsigned short type, const void *daddr,
153 const void *saddr, unsigned len); 153 const void *saddr, unsigned len);
154static int plip_hard_header_cache(const struct neighbour *neigh, 154static int plip_hard_header_cache(const struct neighbour *neigh,
155 struct hh_cache *hh); 155 struct hh_cache *hh, __be16 type);
156static int plip_open(struct net_device *dev); 156static int plip_open(struct net_device *dev);
157static int plip_close(struct net_device *dev); 157static int plip_close(struct net_device *dev);
158static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); 158static 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,
1026} 1026}
1027 1027
1028static int plip_hard_header_cache(const struct neighbour *neigh, 1028static int plip_hard_header_cache(const struct neighbour *neigh,
1029 struct hh_cache *hh) 1029 struct hh_cache *hh, __be16 type)
1030{ 1030{
1031 int ret; 1031 int ret;
1032 1032
1033 ret = eth_header_cache(neigh, hh); 1033 ret = eth_header_cache(neigh, hh, type);
1034 if (ret == 0) { 1034 if (ret == 0) {
1035 struct ethhdr *eth; 1035 struct ethhdr *eth;
1036 1036
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index ab68f785fd19..05955cf09937 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -38,7 +38,7 @@ extern int eth_header(struct sk_buff *skb, struct net_device *dev,
38 const void *daddr, const void *saddr, unsigned len); 38 const void *daddr, const void *saddr, unsigned len);
39extern int eth_rebuild_header(struct sk_buff *skb); 39extern int eth_rebuild_header(struct sk_buff *skb);
40extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 40extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
41extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh); 41extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
42extern void eth_header_cache_update(struct hh_cache *hh, 42extern void eth_header_cache_update(struct hh_cache *hh,
43 const struct net_device *dev, 43 const struct net_device *dev,
44 const unsigned char *haddr); 44 const unsigned char *haddr);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 30f17e42c304..564d89fdddda 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -308,7 +308,7 @@ struct header_ops {
308 const void *saddr, unsigned len); 308 const void *saddr, unsigned len);
309 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 309 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
310 int (*rebuild)(struct sk_buff *skb); 310 int (*rebuild)(struct sk_buff *skb);
311 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh); 311 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
312 void (*cache_update)(struct hh_cache *hh, 312 void (*cache_update)(struct hh_cache *hh,
313 const struct net_device *dev, 313 const struct net_device *dev,
314 const unsigned char *haddr); 314 const unsigned char *haddr);
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 50bd960983e0..8f7e1d8d92a0 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1247,7 +1247,7 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
1247 hh->hh_type = protocol; 1247 hh->hh_type = protocol;
1248 atomic_set(&hh->hh_refcnt, 2); 1248 atomic_set(&hh->hh_refcnt, 2);
1249 1249
1250 if (dev->header_ops->cache(n, hh)) { 1250 if (dev->header_ops->cache(n, hh, protocol)) {
1251 kfree(hh); 1251 kfree(hh);
1252 return; 1252 return;
1253 } 1253 }
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 44d2b42fda56..5cffb63f481a 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -233,9 +233,8 @@ EXPORT_SYMBOL(eth_header_parse);
233 * @hh: destination cache entry 233 * @hh: destination cache entry
234 * Create an Ethernet header template from the neighbour. 234 * Create an Ethernet header template from the neighbour.
235 */ 235 */
236int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh) 236int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type)
237{ 237{
238 __be16 type = hh->hh_type;
239 struct ethhdr *eth; 238 struct ethhdr *eth;
240 const struct net_device *dev = neigh->dev; 239 const struct net_device *dev = neigh->dev;
241 240