Thanks you two for the help~ Now we knew that plugins startup maybe has no 
order , due to reading plugins by "readdir" 。

And the function which defined in other plugin.so could not be called in our 
plugin,  so vlib_call_init_function maybe can not works.

We have reconsidered the dependencies between plugins, and ajust that.



















王辉 wanghui






IT开发工程师 IT Development
Engineer
虚拟化南京四部/无线研究院/无线产品经营部 NIV Nanjing Dept. IV/Wireless Product R&D 
Institute/Wireless Product Operation Division











原始邮件



发件人: <damar...@cisco.com>
收件人:王辉10067165
抄送人: <vpp-dev@lists.fd.io>赵清凌10066964吴兵10040069顾剑10036178董娟00096251 
<dbar...@cisco.com>
日 期 :2017年08月30日 23:35
主 题 :Re: [vpp-dev] About the order of  VLIB_INIT_FUNCTION called between 
different plugins





Yes, also please note that you can at any time use vlib_get_plugin_symbol(..) 
function to get pointer to symbol in another plugin. If you get NULL then 
another plugin is not loaded.

So something like this should work, assuming that you want to go that way...

static clib_error_t *
bar_init (vlib_main_t * vm)
 {
    clib_error_t *error = 0
    if (vlib_get_plugin_symbol (“foo_plugin.so”, “foo_init”) == 0)
    {
      clib_warning ( “foo plugin not loaded. bar disabled”)
      bar_main.disabled = 1
      return 0
    }

    if ((error = vlib_call_init_function (vm, foo_init)))
     return error

  // continue with bar init…
}



> On 30 Aug 2017, at 12:37, Dave Barach (dbarach) <dbar...@cisco.com> wrote:
> 
> Explicit dependencies between plugins is probably not a good idea. There is 
> little to guarantee that both A and B will be loaded.
>  
> Please describe the use-case in more detail.  
>  
> Thanks… Dave
>  
> From: vpp-dev-boun...@lists.fd.io [mailto:vpp-dev-boun...@lists.fd.io] On 
> Behalf Of wang.hu...@zte.com.cn
> Sent: Wednesday, August 30, 2017 4:01 AM
> To: vpp-dev@lists.fd.io
> Cc: zhao.qingl...@zte.com.cn wu.bi...@zte.com.cn gu.ji...@zte.com.cn 
> dong.ju...@zte.com.cn
> Subject: [vpp-dev] About the order of  VLIB_INIT_FUNCTION called between 
> different plugins
>  
> Hi all:
> 
> How to control the order of  VLIB_INIT_FUNCTION (user xxx_init function) 
> called between Different plugins?
> 
> It depends on plugin name?or the sequence of loading plugin ?
> 
>  or is there any other way to adjust the order?
> 
>  
> 
> Thanks~
> 
>  
> 
>  
> 
>  
> 
> 王辉 wanghui
> 
>  
> 
> IT开发工程师 IT Development Engineer
> 虚拟化南京四部/无线研究院/无线产品经营部 NIV Nanjing Dept. IV/Wireless Product R&D 
> Institute/Wireless Product Operation Division
> 
>  
> 
> _______________________________________________
> vpp-dev mailing list
> vpp-dev@lists.fd.io
> https://lists.fd.io/mailman/listinfo/vpp-dev
_______________________________________________
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Reply via email to