example/traffic_mgmt/odp_traffic_mgmt.c
static uint32_t init_profile_sets(void)
{
	uint32_t class_shaper_scale, class_threshold_scale, user_shaper_scale;
	uint32_t user_threshold_scale, err_cnt, app_idx;

	class_shaper_scale    = TM_QUEUES_PER_CLASS / 2;
	class_threshold_scale = TM_QUEUES_PER_CLASS;
	user_shaper_scale     = TM_QUEUES_PER_USER / 2;
	user_threshold_scale  = TM_QUEUES_PER_USER;
	err_cnt               = 0;

	err_cnt += create_profile_set(&COMPANY_PROFILE_PARAMS,
				      &COMPANY_PROFILE_SET,
				      "CompanyProfiles", 0, 1, 1);

	err_cnt += create_profile_set(&COS0_PROFILE_PARAMS,
				      &COS_PROFILE_SETS[0], "ServiceClass0", 0,
				      class_shaper_scale,
				      class_threshold_scale);
	err_cnt += create_profile_set(&COS1_PROFILE_PARAMS,
				      &COS_PROFILE_SETS[1], "ServiceClass1", 0,
				      class_shaper_scale,
				      class_threshold_scale);
	err_cnt += create_profile_set(&COS2_PROFILE_PARAMS,
				      &COS_PROFILE_SETS[2], "ServiceClass2", 0,
				      class_shaper_scale,
				      class_threshold_scale);
	err_cnt += create_profile_set(&COS3_PROFILE_PARAMS,
				      &COS_PROFILE_SETS[3], "ServiceClass3", 0,
				      class_shaper_scale,
				      class_threshold_scale);

	err_cnt += create_profile_set(&COS0_PROFILE_PARAMS,
				      &USER_PROFILE_SETS[0], "UserSvc0", 0,
				      user_shaper_scale, user_threshold_scale);
	err_cnt += create_profile_set(&COS1_PROFILE_PARAMS,
				      &USER_PROFILE_SETS[1], "UserSvc1", 0,
				      user_shaper_scale, user_threshold_scale);
	err_cnt += create_profile_set(&COS2_PROFILE_PARAMS,
				      &USER_PROFILE_SETS[2], "UserSvc2", 0,
				      user_shaper_scale, user_threshold_scale);
	err_cnt += create_profile_set(&COS3_PROFILE_PARAMS,
				      &USER_PROFILE_SETS[3], "UserSvc3", 0,
				      user_shaper_scale, user_threshold_scale);

	for (app_idx = 0; app_idx < APPS_PER_USER; app_idx++) {
		err_cnt += create_profile_set(&COS0_PROFILE_PARAMS,
					      &APP_PROFILE_SETS[0][app_idx],
					      "AppSvc0", app_idx + 1, 1, 1);
		err_cnt += create_profile_set(&COS1_PROFILE_PARAMS,
					      &APP_PROFILE_SETS[1][app_idx],
					      "AppSvc1", app_idx + 1, 1, 1);
		err_cnt += create_profile_set(&COS2_PROFILE_PARAMS,
					      &APP_PROFILE_SETS[2][app_idx],
					      "AppSvc2", app_idx + 1, 1, 1);
		err_cnt += create_profile_set(&COS3_PROFILE_PARAMS,
					      &APP_PROFILE_SETS[3][app_idx],
					      "AppSvc3", app_idx + 1, 1, 1);
	}

	return err_cnt;
}
/* Returns the number of errors encountered. */
Returns the number of errors encountered.
Returns the number of errors encountered .
static uint32_t init_profile_sets(void)
{
	uint32_t class_shaper_scale, class_threshold_scale, user_shaper_scale;
	uint32_t user_threshold_scale, err_cnt, app_idx;
	class_shaper_scale    = TM_QUEUES_PER_CLASS / 2;
	class_threshold_scale = TM_QUEUES_PER_CLASS;
	user_shaper_scale     = TM_QUEUES_PER_USER / 2;
	user_threshold_scale  = TM_QUEUES_PER_USER;
	err_cnt               = 0;
	err_cnt += create_profile_set(&COMPANY_PROFILE_PARAMS,
				      &COMPANY_PROFILE_SET,
				      "CompanyProfiles", 0, 1, 1);
	err_cnt += create_profile_set(&COS0_PROFILE_PARAMS,
				      &COS_PROFILE_SETS[0], "ServiceClass0", 0,
				      class_shaper_scale,
				      class_threshold_scale);
	err_cnt += create_profile_set(&COS1_PROFILE_PARAMS,
				      &COS_PROFILE_SETS[1], "ServiceClass1", 0,
				      class_shaper_scale,
				      class_threshold_scale);
	err_cnt += create_profile_set(&COS2_PROFILE_PARAMS,
				      &COS_PROFILE_SETS[2], "ServiceClass2", 0,
				      class_shaper_scale,
				      class_threshold_scale);
	err_cnt += create_profile_set(&COS3_PROFILE_PARAMS,
				      &COS_PROFILE_SETS[3], "ServiceClass3", 0,
				      class_shaper_scale,
				      class_threshold_scale);
	err_cnt += create_profile_set(&COS0_PROFILE_PARAMS,
				      &USER_PROFILE_SETS[0], "UserSvc0", 0,
				      user_shaper_scale, user_threshold_scale);
	err_cnt += create_profile_set(&COS1_PROFILE_PARAMS,
				      &USER_PROFILE_SETS[1], "UserSvc1", 0,
				      user_shaper_scale, user_threshold_scale);
	err_cnt += create_profile_set(&COS2_PROFILE_PARAMS,
				      &USER_PROFILE_SETS[2], "UserSvc2", 0,
				      user_shaper_scale, user_threshold_scale);
	err_cnt += create_profile_set(&COS3_PROFILE_PARAMS,
				      &USER_PROFILE_SETS[3], "UserSvc3", 0,
				      user_shaper_scale, user_threshold_scale);
	for (app_idx = 0; app_idx < APPS_PER_USER; app_idx++) {
		err_cnt += create_profile_set(&COS0_PROFILE_PARAMS,
					      &APP_PROFILE_SETS[0][app_idx],
					      "AppSvc0", app_idx + 1, 1, 1);
		err_cnt += create_profile_set(&COS1_PROFILE_PARAMS,
					      &APP_PROFILE_SETS[1][app_idx],
					      "AppSvc1", app_idx + 1, 1, 1);
		err_cnt += create_profile_set(&COS2_PROFILE_PARAMS,
					      &APP_PROFILE_SETS[2][app_idx],
					      "AppSvc2", app_idx + 1, 1, 1);
		err_cnt += create_profile_set(&COS3_PROFILE_PARAMS,
					      &APP_PROFILE_SETS[3][app_idx],
					      "AppSvc3", app_idx + 1, 1, 1);
	}
	return err_cnt;
}
static uint32_t init_profile_sets ( void ) { uint32_t class_shaper_scale , class_threshold_scale , user_shaper_scale ; uint32_t user_threshold_scale , err_cnt , app_idx ; class_shaper_scale = TM_QUEUES_PER_CLASS / 2 ; class_threshold_scale = TM_QUEUES_PER_CLASS ; user_shaper_scale = TM_QUEUES_PER_USER / 2 ; user_threshold_scale = TM_QUEUES_PER_USER ; err_cnt = 0 ; err_cnt += create_profile_set ( & COMPANY_PROFILE_PARAMS , & COMPANY_PROFILE_SET , " " , 0 , 1 , 1 ) ; err_cnt += create_profile_set ( & COS0_PROFILE_PARAMS , & COS_PROFILE_SETS [ 0 ] , " " , 0 , class_shaper_scale , class_threshold_scale ) ; err_cnt += create_profile_set ( & COS1_PROFILE_PARAMS , & COS_PROFILE_SETS [ 1 ] , " " , 0 , class_shaper_scale , class_threshold_scale ) ; err_cnt += create_profile_set ( & COS2_PROFILE_PARAMS , & COS_PROFILE_SETS [ 2 ] , " " , 0 , class_shaper_scale , class_threshold_scale ) ; err_cnt += create_profile_set ( & COS3_PROFILE_PARAMS , & COS_PROFILE_SETS [ 3 ] , " " , 0 , class_shaper_scale , class_threshold_scale ) ; err_cnt += create_profile_set ( & COS0_PROFILE_PARAMS , & USER_PROFILE_SETS [ 0 ] , " " , 0 , user_shaper_scale , user_threshold_scale ) ; err_cnt += create_profile_set ( & COS1_PROFILE_PARAMS , & USER_PROFILE_SETS [ 1 ] , " " , 0 , user_shaper_scale , user_threshold_scale ) ; err_cnt += create_profile_set ( & COS2_PROFILE_PARAMS , & USER_PROFILE_SETS [ 2 ] , " " , 0 , user_shaper_scale , user_threshold_scale ) ; err_cnt += create_profile_set ( & COS3_PROFILE_PARAMS , & USER_PROFILE_SETS [ 3 ] , " " , 0 , user_shaper_scale , user_threshold_scale ) ; for ( app_idx = 0 ; app_idx < APPS_PER_USER ; app_idx ++ ) { err_cnt += create_profile_set ( & COS0_PROFILE_PARAMS , & APP_PROFILE_SETS [ 0 ] [ app_idx ] , " " , app_idx + 1 , 1 , 1 ) ; err_cnt += create_profile_set ( & COS1_PROFILE_PARAMS , & APP_PROFILE_SETS [ 1 ] [ app_idx ] , " " , app_idx + 1 , 1 , 1 ) ; err_cnt += create_profile_set ( & COS2_PROFILE_PARAMS , & APP_PROFILE_SETS [ 2 ] [ app_idx ] , " " , app_idx + 1 , 1 , 1 ) ; err_cnt += create_profile_set ( & COS3_PROFILE_PARAMS , & APP_PROFILE_SETS [ 3 ] [ app_idx ] , " " , app_idx + 1 , 1 , 1 ) ; } return err_cnt ; }
Returns the number of errors encountered.
Returns the number of errors encountered .