Actually, that’s not quite right... Here’s a bit of code from 
.../vlib/unix/plugin.c:

  /*
   * Sort the plugins by name. This is important.
   * API traces contain absolute message numbers.
   * Loading plugins in directory (vs. alphabetical) order
   * makes trace replay incredibly fragile.
   */
  vec_sort_with_function (pm->plugin_info, plugin_name_sort_cmp);

You can assume that AAA will start before AAB, etc.

Thanks… Dave

From: wang.hu...@zte.com.cn [mailto:wang.hu...@zte.com.cn]
Sent: Wednesday, August 30, 2017 9:39 PM
To: Damjan Marion (damarion) <damar...@cisco.com>
Cc: vpp-dev@lists.fd.io; zhao.qingl...@zte.com.cn; wu.bi...@zte.com.cn; 
gu.ji...@zte.com.cn; dong.ju...@zte.com.cn; Dave Barach (dbarach) 
<dbar...@cisco.com>
Subject: 答复: Re: [vpp-dev] About the order of  VLIB_INIT_FUNCTION called 
between different plugins


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<mailto:damar...@cisco.com>>;
收件人:王辉10067165;
抄送人: 
<vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>>;赵清凌10066964;吴兵10040069;顾剑10036178;董娟00096251;
 <dbar...@cisco.com<mailto: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<mailto: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> 
> [mailto:vpp-dev-boun...@lists.fd.io] On Behalf Of 
> wang.hu...@zte.com.cn<mailto:wang.hu...@zte.com.cn>
> Sent: Wednesday, August 30, 2017 4:01 AM
> To: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>
> Cc: zhao.qingl...@zte.com.cn<mailto:zhao.qingl...@zte.com.cn>; 
> wu.bi...@zte.com.cn<mailto:wu.bi...@zte.com.cn>; 
> gu.ji...@zte.com.cn<mailto:gu.ji...@zte.com.cn>; 
> dong.ju...@zte.com.cn<mailto: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<mailto: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