perfmon: check bundle is supported
Add a check bundle is supported before futher activation. Enable different bundles with same name, supported on different platforms. Type: improvement Signed-off-by: Ray Kinsella <mdr@ashroe.eu> Change-Id: I73e8bbd1e07c05ebccd9146d48a234eb598a2388
This commit is contained in:
		 Ray Kinsella
					Ray Kinsella
				
			
				
					committed by
					
						 Damjan Marion
						Damjan Marion
					
				
			
			
				
	
			
			
			 Damjan Marion
						Damjan Marion
					
				
			
						parent
						
							0d3914c026
						
					
				
				
					commit
					ce45b16156
				
			| @@ -288,6 +288,21 @@ perfmon_stop (vlib_main_t *vm) | |||||||
|   return 0; |   return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static_always_inline u8 | ||||||
|  | is_bundle_supported (perfmon_bundle_t *b) | ||||||
|  | { | ||||||
|  |   perfmon_cpu_supports_t *supports = b->cpu_supports; | ||||||
|  |  | ||||||
|  |   if (!b->cpu_supports) | ||||||
|  |     return 1; | ||||||
|  |  | ||||||
|  |   for (int i = 0; i < b->n_cpu_supports; ++i) | ||||||
|  |     if (supports[i].cpu_supports ()) | ||||||
|  |       return 1; | ||||||
|  |  | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
| static clib_error_t * | static clib_error_t * | ||||||
| perfmon_init (vlib_main_t *vm) | perfmon_init (vlib_main_t *vm) | ||||||
| { | { | ||||||
| @@ -320,6 +335,14 @@ perfmon_init (vlib_main_t *vm) | |||||||
|     { |     { | ||||||
|       clib_error_t *err; |       clib_error_t *err; | ||||||
|       uword *p; |       uword *p; | ||||||
|  |  | ||||||
|  |       if (!is_bundle_supported (b)) | ||||||
|  | 	{ | ||||||
|  | 	  log_warn ("skipping bundle '%s' - not supported", b->name); | ||||||
|  | 	  b = b->next; | ||||||
|  | 	  continue; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|       if (hash_get_mem (pm->bundle_by_name, b->name) != 0) |       if (hash_get_mem (pm->bundle_by_name, b->name) != 0) | ||||||
| 	clib_panic ("duplicate bundle name '%s'", b->name); | 	clib_panic ("duplicate bundle name '%s'", b->name); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user