From: Alexander Aring Date: Wed, 15 Jun 2016 19:20:20 +0000 (+0200) Subject: ndisc: add __ndisc_opt_addr_data function X-Git-Tag: v4.14-rc1~2816^2~338^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f36ce84c54c971cd67c882035d9bde7b1a2ee53;p=platform%2Fkernel%2Flinux-rpi.git ndisc: add __ndisc_opt_addr_data function This patch adds __ndisc_opt_addr_data as low-level function for ndisc_opt_addr_data which doesn't depend on net_device parameter. Cc: David S. Miller Cc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Acked-by: YOSHIFUJI Hideaki Reviewed-by: Stefan Schmidt Signed-off-by: Alexander Aring Signed-off-by: David S. Miller --- diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 4cee826..c8962ad 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -138,17 +138,23 @@ static inline int ndisc_opt_addr_space(struct net_device *dev) ndisc_addr_option_pad(dev->type)); } -static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p, - struct net_device *dev) +static inline u8 *__ndisc_opt_addr_data(struct nd_opt_hdr *p, + unsigned char addr_len, int prepad) { u8 *lladdr = (u8 *)(p + 1); int lladdrlen = p->nd_opt_len << 3; - int prepad = ndisc_addr_option_pad(dev->type); - if (lladdrlen != ndisc_opt_addr_space(dev)) + if (lladdrlen != __ndisc_opt_addr_space(addr_len, prepad)) return NULL; return lladdr + prepad; } +static inline u8 *ndisc_opt_addr_data(struct nd_opt_hdr *p, + struct net_device *dev) +{ + return __ndisc_opt_addr_data(p, dev->addr_len, + ndisc_addr_option_pad(dev->type)); +} + static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, __u32 *hash_rnd) { const u32 *p32 = pkey;