| Message ID | 57e248d7f09560f7e7ddd2791269830cedc2a7d6.1762950453.git.echaudro@redhat.com |
|---|---|
| State | Changes Requested |
| Headers | show |
| Series | Architectural refactoring of hardware offload infrastructure | expand |
| Context | Check | Description |
|---|---|---|
| ovsrobot/apply-robot | success | apply and check: success |
| ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
| ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
git sha: 57e248d7f09560f7e7ddd2791269830cedc2a7d6 Author: Eelco Chaudron <echaudro@redhat.com> dpif-netdev: Add full name to the dp_netdev structure. This patch adds a full_name field to the dp_netdev structure to store the datapath name in "type@name" format. The full name is allocated during datapath creation and freed during cleanup. > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c > index 2aeef471f..6324cfb7a 100644 > --- a/lib/dpif-netdev.c > +++ b/lib/dpif-netdev.c > @@ -271,6 +271,7 @@ enum sched_assignment_type { > struct dp_netdev { > const struct dpif_class *const class; > const char *const name; > + const char *const full_name; > struct ovs_refcount ref_cnt; > atomic_flag destroyed; > > @@ -1886,6 +1887,8 @@ create_dp_netdev(const char *name, const struct dpif_class *class, > > *CONST_CAST(const struct dpif_class **, &dp->class) = class; > *CONST_CAST(const char **, &dp->name) = xstrdup(name); > + *CONST_CAST(const char **, &dp->full_name) = xasprintf("%s@%s", > + class->type, name); Could xasprintf fail and return NULL here? The allocation happens early in the datapath creation without any NULL check on the result. > @@ -2054,6 +2057,7 @@ dp_netdev_free(struct dp_netdev *dp) > free(dp->max_sleep_list); > free(dp->pmd_cmask); > free(CONST_CAST(char *, dp->name)); > + free(CONST_CAST(char *, dp->full_name)); > free(dp); > }
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 2aeef471f..6324cfb7a 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -271,6 +271,7 @@ enum sched_assignment_type { struct dp_netdev { const struct dpif_class *const class; const char *const name; + const char *const full_name; struct ovs_refcount ref_cnt; atomic_flag destroyed; @@ -1886,6 +1887,8 @@ create_dp_netdev(const char *name, const struct dpif_class *class, *CONST_CAST(const struct dpif_class **, &dp->class) = class; *CONST_CAST(const char **, &dp->name) = xstrdup(name); + *CONST_CAST(const char **, &dp->full_name) = xasprintf("%s@%s", + class->type, name); ovs_refcount_init(&dp->ref_cnt); atomic_flag_clear(&dp->destroyed); @@ -2054,6 +2057,7 @@ dp_netdev_free(struct dp_netdev *dp) free(dp->max_sleep_list); free(dp->pmd_cmask); free(CONST_CAST(char *, dp->name)); + free(CONST_CAST(char *, dp->full_name)); free(dp); }
This change adds the full name to the dp_netdev structure, required by the next patch. Signed-off-by: Eelco Chaudron <echaudro@redhat.com> --- lib/dpif-netdev.c | 4 ++++ 1 file changed, 4 insertions(+)