On Tue, Sep 26, 2017 at 10:58 AM, Amine Kherbouche <amine.kherbou...@6wind.com> wrote: > Hi Roopa, > > Thanks for the feedback, I have just one question: > > > On 09/26/2017 05:15 PM, Roopa Prabhu wrote: >>> >>> +static int ipgre_tunnel_encap_add_mpls_ops(void) >>> > +{ >>> > + int ret = -1; >>> > + >>> > +#if IS_ENABLED(CONFIG_NET_IP_TUNNEL) >>> > + ret = ip_tunnel_encap_add_ops(&mpls_iptun_ops, >>> > TUNNEL_ENCAP_MPLS); >>> > +#endif >>> > + >>> > + return ret; >>> > +} >>> > + >>> > +static void ipgre_tunnel_encap_del_mpls_ops(void) >>> > +{ >>> > +#if IS_ENABLED(CONFIG_NET_IP_TUNNEL) >>> > + ip_tunnel_encap_del_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS); >>> > +#endif >>> > +} >>> > + >>> > static void rtmsg_lfib(int event, u32 label, struct mpls_route *rt, >>> > struct nlmsghdr *nlh, struct net *net, u32 >>> > portid, >>> > unsigned int nlm_flags); >>> > @@ -2486,6 +2521,10 @@ static int __init mpls_init(void) >>> > 0); >>> > rtnl_register(PF_MPLS, RTM_GETNETCONF, >>> > mpls_netconf_get_devconf, >>> > mpls_netconf_dump_devconf, 0); >>> > + err = ipgre_tunnel_encap_add_mpls_ops(); >>> > + if (err) >>> > + pr_err("Can't add mpls over gre tunnel ops\n"); >>> > + >> >> This will throw an error if CONFIG_NET_IP_TUNNEL is not enabled. >> Can you pls put the CONFIG_NET_IP_TUNNEL around >> ipgre_tunnel_encap_add_mpls_ops ? > > > You want the CONFIG_NET_IP_TUNNEL definition around the declaration of the > function or when it's called ? or both ? (I can adjust the code for any > case).
around the declaration like below...., #if IS_ENABLED(CONFIG_NET_IP_TUNNEL) static int ipgre_tunnel_encap_add_mpls_ops(void) { return ip_tunnel_encap_add_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS); } static void ipgre_tunnel_encap_del_mpls_ops(void) { ip_tunnel_encap_del_ops(&mpls_iptun_ops, TUNNEL_ENCAP_MPLS); } #else static int ipgre_tunnel_encap_add_mpls_ops(void) { return 0 } static void ipgre_tunnel_encap_del_mpls_ops(void) { } #endif thanks.