Re: [PATCH][net-next] ipv6: drop container_of when convert dst to rt6_info

2018-09-30 Thread David Ahern
On 9/30/18 3:38 AM, Li RongQing wrote: >> >> I don't understand why you are doing this? It is not going to be >> faster (or safer) than container_of. container_of provides the >> same functionality and is safe against position of the member >> in the structure. >> > > In fact, most places are conv

Re: [PATCH][net-next] ipv6: drop container_of when convert dst to rt6_info

2018-09-30 Thread Li RongQing
> > I don't understand why you are doing this? It is not going to be > faster (or safer) than container_of. container_of provides the > same functionality and is safe against position of the member > in the structure. > In fact, most places are converting dst to rt6_info directly, and only few pla

Re: [PATCH][net-next] ipv6: drop container_of when convert dst to rt6_info

2018-09-30 Thread Stephen Hemminger
On Sun, 30 Sep 2018 13:02:52 +0800 Li RongQing wrote: > we can save container_of computation and return dst directly, > since dst is always first member of struct rt6_info > > Add a BUILD_BUG_ON() to catch any change that could break this > assertion. > > Signed-off-by: Li RongQing I don't un

Re: [PATCH][net-next] ipv6: drop container_of when convert dst to rt6_info

2018-09-30 Thread Li RongQing
> + BUILD_BUG_ON(offsetof(struct rt6_info, dst) != 0); > + please drop this patch, thanks since BUILD_BUG_ON has been added in ip6_fib.h include/net/ip6_fib.h: BUILD_BUG_ON(offsetof(struct rt6_info, dst) != 0); -Li

[PATCH][net-next] ipv6: drop container_of when convert dst to rt6_info

2018-09-29 Thread Li RongQing
we can save container_of computation and return dst directly, since dst is always first member of struct rt6_info Add a BUILD_BUG_ON() to catch any change that could break this assertion. Signed-off-by: Li RongQing --- include/net/ip6_route.h | 4 +++- net/ipv6/route.c| 6 +++--- 2 file