Yes, generally you want to put as less as possible into plugin init code and
simply initialise data structures at the moment when feature is 
configured/enabled.

If you have process node, it should be disabled and later enabled by using 
event message...

Please note that there is also a way to skip loading a plugin as result of 
failure in plugin early init code.
I.e. you can skip loading plugin if dlopen() of some library fails or some 
permissions are missing.

-- 
Damjan

> On 19 Oct 2018, at 21:41, Rui Cai via Lists.Fd.Io 
> <rucai=microsoft....@lists.fd.io> wrote:
> 
> Dear Dave:
>  
> Thanks a lot for the information! I have a follow up question with regard to 
> when a plugin should allocate its global resources.
>  
> Plugins doesn’t unload/reload during VPP process looks like the expectation 
> for a plugin to not allocate any resources during its plugin_init function 
> since it will not have an opportunity to free it. The plugin should rather 
> have some API to “enable feature” where it does the bulk of allocation and 
> free the resources in its “disable feature” API. With the sample plugin 
> example, what I see is that the plugin_init just hooks up APIs (init with the 
> VPP framework), but the actual “feature enable” API modifies the graph (init 
> sample plugin).
>  
> In general, what’s the responsibility of initialization for plugin init vs a 
> separate API to enable the feature? Should plugin init just do some 
> minimal/basic registration related work with VPP framework and leave plugin 
> specific work during “feature enable”?
>  
> Thanks,
> -Ray
>  
> From: Dave Barach (dbarach) <dbar...@cisco.com <mailto:dbar...@cisco.com>> 
> Sent: Friday, October 19, 2018 4:35 AM
> To: Ray Cai <ru...@microsoft.com <mailto:ru...@microsoft.com>>; 
> vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io>
> Subject: RE: Question about VPP plugin/node's life cycle
>  
> Dear Ray,
>  
> As you probably suspect: plugins are neither unloaded nor reloaded.
>  
> HTH... Dave 
>  
> From: vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> <vpp-dev@lists.fd.io 
> <mailto:vpp-dev@lists.fd.io>> On Behalf Of Rui Cai via Lists.Fd.Io
> Sent: Thursday, October 18, 2018 9:43 PM
> To: vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io>
> Cc: vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io>
> Subject: [SUSPICIOUS] [vpp-dev] Question about VPP plugin/node's life cycle
>  
> Hello vpp experts:
>  
> I’m trying to figure out a plugin/node’s life cycle with in VPP process. 
> There is very rich code/documentation talking about plugin 
> registration/initialization and node registration. I understand that nodes 
> are created during node graph build up and during plugin init function I can 
> further manipulate the edges of my nodes. However, I’m having trouble finding 
> the code that handles node tear down/plugin un-initialization. Does VPP have 
> a notion of plugin/node un-initialization? For example, if my plugin 
> allocated some object during init, I would expect to free it in un-init. If 
> there is such concept, what should I search to find them? Or pretty much the 
> node/plugin lives as long as the VPP process is running and the plugin/node 
> life cycle is never going to be shorter than VPP process?
>  
> Thanks a lot!
> -Ray
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> 
> View/Reply Online (#10882): https://lists.fd.io/g/vpp-dev/message/10882 
> <https://lists.fd.io/g/vpp-dev/message/10882>
> Mute This Topic: https://lists.fd.io/mt/27411530/675642 
> <https://lists.fd.io/mt/27411530/675642>
> Group Owner: vpp-dev+ow...@lists.fd.io <mailto:vpp-dev+ow...@lists.fd.io>
> Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub 
> <https://lists.fd.io/g/vpp-dev/unsub>  [dmar...@me.com 
> <mailto:dmar...@me.com>]
> -=-=-=-=-=-=-=-=-=-=-=-

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#10890): https://lists.fd.io/g/vpp-dev/message/10890
Mute This Topic: https://lists.fd.io/mt/27411530/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to