Commit e69dd336ee3a05a589629b505b18ba5e7a5b4c54

Authored by David S. Miller
1 parent 3769cffb1c

net: Push protocol type directly down to header_ops->cache()

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 7 changed files with 13 additions and 13 deletions Side-by-side Diff

drivers/firewire/net.c
... ... @@ -261,16 +261,16 @@
261 261 }
262 262  
263 263 static int fwnet_header_cache(const struct neighbour *neigh,
264   - struct hh_cache *hh)
  264 + struct hh_cache *hh, __be16 type)
265 265 {
266 266 struct net_device *net;
267 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 270 return -1;
271 271 net = neigh->dev;
272 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 274 memcpy(h->h_dest, neigh->ha, net->addr_len);
275 275 hh->hh_len = FWNET_HLEN;
276 276  
drivers/isdn/i4l/isdn_net.c
... ... @@ -1983,13 +1983,14 @@
1983 1983 return ret;
1984 1984 }
1985 1985  
1986   -static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
  1986 +static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
  1987 + __be16 type)
1987 1988 {
1988 1989 const struct net_device *dev = neigh->dev;
1989 1990 isdn_net_local *lp = netdev_priv(dev);
1990 1991  
1991 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 1994 return -1;
1994 1995 }
1995 1996  
... ... @@ -152,7 +152,7 @@
152 152 unsigned short type, const void *daddr,
153 153 const void *saddr, unsigned len);
154 154 static int plip_hard_header_cache(const struct neighbour *neigh,
155   - struct hh_cache *hh);
  155 + struct hh_cache *hh, __be16 type);
156 156 static int plip_open(struct net_device *dev);
157 157 static int plip_close(struct net_device *dev);
158 158 static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
159 159  
... ... @@ -1026,11 +1026,11 @@
1026 1026 }
1027 1027  
1028 1028 static int plip_hard_header_cache(const struct neighbour *neigh,
1029   - struct hh_cache *hh)
  1029 + struct hh_cache *hh, __be16 type)
1030 1030 {
1031 1031 int ret;
1032 1032  
1033   - ret = eth_header_cache(neigh, hh);
  1033 + ret = eth_header_cache(neigh, hh, type);
1034 1034 if (ret == 0) {
1035 1035 struct ethhdr *eth;
1036 1036  
include/linux/etherdevice.h
... ... @@ -38,7 +38,7 @@
38 38 const void *daddr, const void *saddr, unsigned len);
39 39 extern int eth_rebuild_header(struct sk_buff *skb);
40 40 extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
41   -extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
  41 +extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
42 42 extern void eth_header_cache_update(struct hh_cache *hh,
43 43 const struct net_device *dev,
44 44 const unsigned char *haddr);
include/linux/netdevice.h
... ... @@ -308,7 +308,7 @@
308 308 const void *saddr, unsigned len);
309 309 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
310 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 312 void (*cache_update)(struct hh_cache *hh,
313 313 const struct net_device *dev,
314 314 const unsigned char *haddr);
net/core/neighbour.c
... ... @@ -1247,7 +1247,7 @@
1247 1247 hh->hh_type = protocol;
1248 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 1251 kfree(hh);
1252 1252 return;
1253 1253 }
... ... @@ -233,9 +233,8 @@
233 233 * @hh: destination cache entry
234 234 * Create an Ethernet header template from the neighbour.
235 235 */
236   -int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
  236 +int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type)
237 237 {
238   - __be16 type = hh->hh_type;
239 238 struct ethhdr *eth;
240 239 const struct net_device *dev = neigh->dev;
241 240