[ovs-dev] [PATCHv2 1/2] netdev: Refactor destruction of netdev_ports.
Greg Rose
gvrose8192 at gmail.com
Thu Aug 10 17:05:43 UTC 2017
On 08/08/2017 11:23 AM, Joe Stringer wrote:
> An upcoming patch will reuse this from elsewhere.
>
> Signed-off-by: Joe Stringer <joe at ovn.org>
> ---
> lib/netdev.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/lib/netdev.c b/lib/netdev.c
> index 7e9896b82928..3e8b211857d7 100644
> --- a/lib/netdev.c
> +++ b/lib/netdev.c
> @@ -2255,6 +2255,15 @@ netdev_ports_get(odp_port_t port_no, const struct dpif_class *dpif_class)
> return ret;
> }
>
> +static void
> +netdev_port_data_destroy(struct port_to_netdev_data *data)
> +{
> + dpif_port_destroy(&data->dpif_port);
> + netdev_close(data->netdev); /* unref and possibly close */
> + hmap_remove(&port_to_netdev, &data->node);
> + free(data);
> +}
> +
> int
> netdev_ports_remove(odp_port_t port_no, const struct dpif_class *dpif_class)
> {
> @@ -2266,10 +2275,7 @@ netdev_ports_remove(odp_port_t port_no, const struct dpif_class *dpif_class)
> data = netdev_ports_lookup(port_no, dpif_class);
>
> if (data) {
> - dpif_port_destroy(&data->dpif_port);
> - netdev_close(data->netdev); /* unref and possibly close */
> - hmap_remove(&port_to_netdev, &data->node);
> - free(data);
> + netdev_port_data_destroy(data);
> ret = 0;
> }
>
>
LGTM
Reviewed-by: Greg Rose <gvrose8192 at gmail.com>
More information about the dev
mailing list