Re: [vpp-dev] Checking for enabled feature
Seems like your code is OK, see also vnet_interface_features_show(...) in .../src/vnet/feature/feature.c. We could add per-interface, per-feature arc "feature X is enabled" bitmaps to speed up this sort of processing, but there has to be a compelling reason to do so. What problem are you trying to solve? Thanks... Dave -Original Message- From: vpp-dev@lists.fd.io On Behalf Of Raj Sent: Friday, June 28, 2019 9:00 AM To: vpp-dev Subject: [vpp-dev] Checking for enabled feature Hello all, I am in need to find out whether a particular feature is enabled on an interface during run time. So if I understand correctly we have to get the corresponding 'feature arc index '. Then get the config index by using 'config_index_by_sw_if_index' then get the config_pool and then iterate through the features list to check whether the given feature is there or not. What I would like to know, is this is the correct approach or is there any optimized and a better performing alternative for achieving the same current_config_index = vec_elt (cm[feature_arc].config_index_by_sw_if_index, sw_if_index); cfg_index = vcm->config_pool_index_by_user_index[current_config_index]; cfg = pool_elt_at_index (vcm->config_pool, cfg_index); for (i = 0; i < vec_len (cfg->features); i++) { feat = cfg->features + i; node_index = feat->node_index; n = vlib_get_node (vm, node_index); if (0 == memcmp (n->name, input_feat, sizeof("ip4-policer-classify") - 1)) return 1; } Thanks and Regards, Raj -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#13395): https://lists.fd.io/g/vpp-dev/message/13395 Mute This Topic: https://lists.fd.io/mt/32241517/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [vpp-dev] Checking for enabled feature
Hi Raj, There's no good way to do it, there's also no notification should the feature be disabled or enabled. Instead I'd suggest you 'listen' to the entity enabling/disabling the feature. Or maybe you can configure your feature to run before this one, then it's not important whether it's enable or not. Regards, neale -Message d'origine- De : au nom de Raj Date : vendredi 28 juin 2019 à 15:01 À : vpp-dev Objet : [vpp-dev] Checking for enabled feature Hello all, I am in need to find out whether a particular feature is enabled on an interface during run time. So if I understand correctly we have to get the corresponding 'feature arc index '. Then get the config index by using 'config_index_by_sw_if_index' then get the config_pool and then iterate through the features list to check whether the given feature is there or not. What I would like to know, is this is the correct approach or is there any optimized and a better performing alternative for achieving the same current_config_index = vec_elt (cm[feature_arc].config_index_by_sw_if_index, sw_if_index); cfg_index = vcm->config_pool_index_by_user_index[current_config_index]; cfg = pool_elt_at_index (vcm->config_pool, cfg_index); for (i = 0; i < vec_len (cfg->features); i++) { feat = cfg->features + i; node_index = feat->node_index; n = vlib_get_node (vm, node_index); if (0 == memcmp (n->name, input_feat, sizeof("ip4-policer-classify") - 1)) return 1; } Thanks and Regards, Raj -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#13394): https://lists.fd.io/g/vpp-dev/message/13394 Mute This Topic: https://lists.fd.io/mt/32241517/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-