Skip to content

Commit

Permalink
Merge pull request #3597 from mjstapp/dplane_return_prov
Browse files Browse the repository at this point in the history
zebra: return dataplane provider plugin handle
  • Loading branch information
donaldsharp committed Jan 11, 2019
2 parents e8aa58a + 1ff8a24 commit bae61ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 7 additions & 3 deletions zebra/zebra_dplane.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -991,7 +991,8 @@ int dplane_provider_register(const char *name,
int (*fp)(struct zebra_dplane_provider *), int (*fp)(struct zebra_dplane_provider *),
int (*fini_fp)(struct zebra_dplane_provider *, int (*fini_fp)(struct zebra_dplane_provider *,
bool early), bool early),
void *data) void *data,
struct zebra_dplane_provider **prov_p)
{ {
int ret = 0; int ret = 0;
struct zebra_dplane_provider *p, *last; struct zebra_dplane_provider *p, *last;
Expand Down Expand Up @@ -1055,6 +1056,9 @@ int dplane_provider_register(const char *name,
p->dp_name, p->dp_id, p->dp_priority); p->dp_name, p->dp_id, p->dp_priority);


done: done:
if (prov_p)
*prov_p = p;

return ret; return ret;
} }


Expand Down Expand Up @@ -1349,7 +1353,7 @@ static void dplane_provider_init(void)
DPLANE_PROV_FLAGS_DEFAULT, DPLANE_PROV_FLAGS_DEFAULT,
kernel_dplane_process_func, kernel_dplane_process_func,
NULL, NULL,
NULL); NULL, NULL);


if (ret != AOK) if (ret != AOK)
zlog_err("Unable to register kernel dplane provider: %d", zlog_err("Unable to register kernel dplane provider: %d",
Expand All @@ -1362,7 +1366,7 @@ static void dplane_provider_init(void)
DPLANE_PROV_FLAGS_DEFAULT, DPLANE_PROV_FLAGS_DEFAULT,
test_dplane_process_func, test_dplane_process_func,
test_dplane_shutdown_func, test_dplane_shutdown_func,
NULL /* data */); NULL /* data */, NULL);


if (ret != AOK) if (ret != AOK)
zlog_err("Unable to register test dplane provider: %d", zlog_err("Unable to register test dplane provider: %d",
Expand Down
6 changes: 4 additions & 2 deletions zebra/zebra_dplane.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ enum dplane_provider_prio {




/* Provider registration: ordering or priority value, callbacks, and optional /* Provider registration: ordering or priority value, callbacks, and optional
* opaque data value. * opaque data value. If 'prov_p', return the newly-allocated provider object
* on success.
*/ */


/* Providers offer an entry-point for incoming work, called in the context of /* Providers offer an entry-point for incoming work, called in the context of
Expand All @@ -279,7 +280,8 @@ int dplane_provider_register(const char *name,
int (*fp)(struct zebra_dplane_provider *), int (*fp)(struct zebra_dplane_provider *),
int (*fini_fp)(struct zebra_dplane_provider *, int (*fini_fp)(struct zebra_dplane_provider *,
bool early), bool early),
void *data); void *data,
struct zebra_dplane_provider **prov_p);


/* Accessors for provider attributes */ /* Accessors for provider attributes */
const char *dplane_provider_get_name(const struct zebra_dplane_provider *prov); const char *dplane_provider_get_name(const struct zebra_dplane_provider *prov);
Expand Down

0 comments on commit bae61ac

Please sign in to comment.