On 10/18/2018 9:15 AM, Raslan Darawsheh wrote:
> @@ -2082,6 +2215,17 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
>       TAP_LOG(NOTICE, "Initializing pmd_tap for %s as %s",
>               name, tap_name);
>  
> +     /* Register IPC feed callback */
> +     if (!tap_devices_count) {
> +             ret = rte_mp_action_register(TAP_MP_KEY, tap_mp_sync_queues);
> +             if (ret < 0) {
> +                     TAP_LOG(ERR, "%s: Failed to register IPC callback: %s",
> +                             tuntap_name, strerror(rte_errno));
> +                     goto leave;
> +             }
> +     }
> +     tap_devices_count++;
> +     tap_devices_count_increased = 1;
>       ret = eth_dev_tap_create(dev, tap_name, remote_iface, &user_mac,
>               ETH_TUNTAP_TYPE_TAP);
>  
> @@ -2089,6 +2233,11 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
>       if (ret == -1) {
>               TAP_LOG(ERR, "Failed to create pmd for %s as %s",
>                       name, tap_name);
> +             if (tap_devices_count_increased == 1) {
> +                     if (!tap_devices_count)
> +                             rte_mp_action_unregister(TAP_MP_KEY);
> +                     tap_devices_count--;
> +             }
>               tap_unit--;             /* Restore the unit number */
>       }
>       rte_kvargs_free(kvlist);

Hi Raslan,

This is still wrong, please check the code snippet I have shared.

For first probe, if rte_mp_action_register() run successfully:
  tap_devices_count++;
  tap_devices_count_increased = 1;

later if eth_dev_tap_create() fails, following won't unregister:
  if (!tap_devices_count)
    rte_mp_action_unregister(TAP_MP_KEY);

Reply via email to