DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Raslan Darawsheh <rasland@mellanox.com>, keith.wiles@intel.com
Cc: thomas@monjalon.net, dev@dpdk.org, shahafs@mellanox.com,
	orika@mellanox.com
Subject: Re: [dpdk-dev] [PATCH v7 3/3] net/tap: allow secondary process to access primary device queues
Date: Wed, 17 Oct 2018 13:06:44 +0100	[thread overview]
Message-ID: <b5a320eb-b46a-f021-716c-c73f671d2018@intel.com> (raw)
In-Reply-To: <1539766564-9433-3-git-send-email-rasland@mellanox.com>

On 10/17/2018 9:56 AM, Raslan Darawsheh wrote:
> @@ -2082,6 +2214,16 @@ 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++;
>  	ret = eth_dev_tap_create(dev, tap_name, remote_iface, &user_mac,
>  		ETH_TUNTAP_TYPE_TAP);
>  
> @@ -2089,6 +2231,9 @@ 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)
> +			rte_mp_action_unregister(TAP_MP_KEY);
> +		tap_devices_count--;
>  		tap_unit--;		/* Restore the unit number */
>  	}
>  	rte_kvargs_free(kvlist);
Fail recovery part seems broken, it can be like [1] or [2], but both requires a
new variable.
I double checked the logic in prev version of the patch that uses EEXIST return
values, that is also broken. Overall the challenge is in error recovery part we
don't know if we enter there before or after increasing dev_count, that is why a
local variable required.

If you can fix the error recovery path using EEXIST without needing a new
variable, I think that is better, but if not I suggest following [2] since the
logic of increase the dev_count after device successfully created makes sense to
me, but both works.

Thanks,
ferruh


[1]
         /* 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);

 leave:
         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 == 1)
                                 rte_mp_action_unregister(TAP_MP_KEY);
                         tap_devices_count--;
                 }
                 tap_unit--;             /* Restore the unit number */
         }
         rte_kvargs_free(kvlist);



[2]

         /* 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;
                 }
                 mp_action_registered = 1;
         }
         ret = eth_dev_tap_create(dev, tap_name, remote_iface, &user_mac,
                 ETH_TUNTAP_TYPE_TAP);


 leave:
         if (ret == -1) {
                 TAP_LOG(ERR, "Failed to create pmd for %s as %s",
                         name, tap_name);
                 if (mp_action_registered == 1)
                         rte_mp_action_unregister(TAP_MP_KEY);
                 tap_unit--;             /* Restore the unit number */
         } else {
                 tap_devices_count++;
         }
         rte_kvargs_free(kvlist);

  reply	other threads:[~2018-10-17 12:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 14:39 [dpdk-dev] [PATCH v6 1/3] net/tap: add queue and port ids in Rx/Tx queues structures Raslan Darawsheh
2018-10-10 14:39 ` [dpdk-dev] [PATCH v6 2/3] net/tap: move fds of Rx/Tx queues to be in process private Raslan Darawsheh
2018-10-11 16:19   ` Ferruh Yigit
2018-10-16 10:07     ` Raslan Darawsheh
2018-10-16 11:24       ` Ferruh Yigit
2018-10-17  8:56   ` [dpdk-dev] [PATCH v7 1/3] net/tap: add queue and port ids in Rx/Tx queues structures Raslan Darawsheh
2018-10-17  8:56     ` [dpdk-dev] [PATCH v7 2/3] net/tap: move fds of Rx/Tx queues to be in process private Raslan Darawsheh
2018-10-17  8:56     ` [dpdk-dev] [PATCH v7 3/3] net/tap: allow secondary process to access primary device queues Raslan Darawsheh
2018-10-17 12:06       ` Ferruh Yigit [this message]
2018-10-17 14:46         ` Raslan Darawsheh
2018-10-17 14:45   ` [dpdk-dev] [PATCH v8 1/3] net/tap: add queue and port ids in Rx/Tx queues structures Raslan Darawsheh
2018-10-17 14:45     ` [dpdk-dev] [PATCH v8 2/3] net/tap: move fds of Rx/Tx queues to be in process private Raslan Darawsheh
2018-10-17 14:45     ` [dpdk-dev] [PATCH v8 3/3] net/tap: allow secondary process to access primary device queues Raslan Darawsheh
2018-10-17 16:02       ` Ferruh Yigit
2018-10-18  8:11         ` Raslan Darawsheh
2018-10-18  8:15   ` [dpdk-dev] [PATCH v9 1/3] net/tap: add queue and port ids in Rx/Tx queues structures Raslan Darawsheh
2018-10-18  8:15     ` [dpdk-dev] [PATCH v9 2/3] net/tap: move fds of Rx/Tx queues to be in process private Raslan Darawsheh
2018-10-18  8:15     ` [dpdk-dev] [PATCH v9 3/3] net/tap: allow secondary process to access primary device queues Raslan Darawsheh
2018-10-18 10:09       ` Ferruh Yigit
2018-10-18 10:17   ` [dpdk-dev] [PATCH v10 1/3] net/tap: add queue and port ids in Rx/Tx queues structures Raslan Darawsheh
2018-10-18 10:17     ` [dpdk-dev] [PATCH v10 2/3] net/tap: move fds of Rx/Tx queues to be in process private Raslan Darawsheh
2018-10-18 10:17     ` [dpdk-dev] [PATCH v10 3/3] net/tap: allow secondary process to access primary device queues Raslan Darawsheh
2018-10-18 11:22     ` [dpdk-dev] [PATCH v10 1/3] net/tap: add queue and port ids in Rx/Tx queues structures Ferruh Yigit
2018-10-18 12:56     ` Ferruh Yigit
2018-10-10 14:39 ` [dpdk-dev] [PATCH v6 3/3] net/tap: allow secondary process to access primary device queues Raslan Darawsheh
2018-10-11 16:32   ` Ferruh Yigit
2018-10-16 10:06     ` Raslan Darawsheh
2018-10-16 11:27       ` Ferruh Yigit
2018-10-17  6:54         ` Raslan Darawsheh
2018-10-17  7:59           ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5a320eb-b46a-f021-716c-c73f671d2018@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.com \
    --cc=orika@mellanox.com \
    --cc=rasland@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).