Re: [PATCH net-next v2 2/9] net: ipmr: always define mroute_reg_vif_num
On 11/23/2015 06:23 AM, Cong Wang wrote: > On Sat, Nov 21, 2015 at 6:57 AM, Nikolay Aleksandrov > wrote: >> From: Nikolay Aleksandrov >> >> Before mroute_reg_vif_num was defined only if any of the CONFIG_PIMSM_ >> options were set, but that's not really necessary as the size of the >> struct is the same in both cases (checked with pahole, both cases size >> is 3256 bytes) and we can remove some unnecessary ifdefs to simplify the >> code. >> > > Not sure if this really simplifies the code, since now > mroute_reg_vif_num is hidden > deeper after your patch and there are still some code under CONFIG_IP_PIMSM. > CONFIG_IP_PIMSM is removed in the next patch, and it's not "hidden" anymore than it was before. > If you really care about it, how about introducing a helper function > to set and get > mrt->mroute_reg_vif_num? > Patches are welcome, if you don't get to it then I will with the next set. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next v2 2/9] net: ipmr: always define mroute_reg_vif_num
On Sat, Nov 21, 2015 at 6:57 AM, Nikolay Aleksandrov wrote: > From: Nikolay Aleksandrov > > Before mroute_reg_vif_num was defined only if any of the CONFIG_PIMSM_ > options were set, but that's not really necessary as the size of the > struct is the same in both cases (checked with pahole, both cases size > is 3256 bytes) and we can remove some unnecessary ifdefs to simplify the > code. > Not sure if this really simplifies the code, since now mroute_reg_vif_num is hidden deeper after your patch and there are still some code under CONFIG_IP_PIMSM. If you really care about it, how about introducing a helper function to set and get mrt->mroute_reg_vif_num? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH net-next v2 2/9] net: ipmr: always define mroute_reg_vif_num
From: Nikolay Aleksandrov Before mroute_reg_vif_num was defined only if any of the CONFIG_PIMSM_ options were set, but that's not really necessary as the size of the struct is the same in both cases (checked with pahole, both cases size is 3256 bytes) and we can remove some unnecessary ifdefs to simplify the code. Signed-off-by: Nikolay Aleksandrov --- net/ipv4/ipmr.c | 8 1 file changed, 8 deletions(-) diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 5271e2eee110..dd2462f70d34 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -84,9 +84,7 @@ struct mr_table { atomic_tcache_resolve_queue_len; boolmroute_do_assert; boolmroute_do_pim; -#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2) int mroute_reg_vif_num; -#endif }; struct ipmr_rule { @@ -347,9 +345,7 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id) setup_timer(&mrt->ipmr_expire_timer, ipmr_expire_process, (unsigned long)mrt); -#ifdef CONFIG_IP_PIMSM mrt->mroute_reg_vif_num = -1; -#endif #ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES list_add_tail_rcu(&mrt->list, &net->ipv4.mr_tables); #endif @@ -584,10 +580,8 @@ static int vif_delete(struct mr_table *mrt, int vifi, int notify, return -EADDRNOTAVAIL; } -#ifdef CONFIG_IP_PIMSM if (vifi == mrt->mroute_reg_vif_num) mrt->mroute_reg_vif_num = -1; -#endif if (vifi + 1 == mrt->maxvif) { int tmp; @@ -824,10 +818,8 @@ static int vif_add(struct net *net, struct mr_table *mrt, /* And finish update writing critical data */ write_lock_bh(&mrt_lock); v->dev = dev; -#ifdef CONFIG_IP_PIMSM if (v->flags & VIFF_REGISTER) mrt->mroute_reg_vif_num = vifi; -#endif if (vifi+1 > mrt->maxvif) mrt->maxvif = vifi+1; write_unlock_bh(&mrt_lock); -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html