Skip to content

Commit

Permalink
linux-gen: cls: implement odp_cls_cos_create_multi() function
Browse files Browse the repository at this point in the history
Implement new odp_cls_cos_create_multi() function for creating multiple
class-of-services with a single call.

Signed-off-by: Matias Elo <matias.elo@nokia.com>
  • Loading branch information
MatiasElo committed Sep 22, 2023
1 parent 57a205f commit 1f14712
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions platform/linux-generic/odp_classification.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,28 @@ odp_cos_t odp_cls_cos_create(const char *name, const odp_cls_cos_param_t *param_
return ODP_COS_INVALID;
}

int odp_cls_cos_create_multi(const char *name[], const odp_cls_cos_param_t param[],
odp_cos_t cos[], int num)
{
int i;

_ODP_ASSERT(param != NULL);
_ODP_ASSERT(cos != NULL);

for (i = 0; i < num; i++) {
const char *cur_name = name != NULL ? name[i] : NULL;
odp_cos_t new_cos = odp_cls_cos_create(cur_name, &param[i]);

if (odp_unlikely(new_cos == ODP_COS_INVALID)) {
if (i == 0)
return -1;
break;
}
cos[i] = new_cos;
}
return i;
}

/*
* Allocate an odp_pmr_t Handle
*/
Expand Down

0 comments on commit 1f14712

Please sign in to comment.