From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id B1CE31B203 for ; Thu, 5 Oct 2017 16:26:58 +0200 (CEST) Received: by mail-wr0-f195.google.com with SMTP id z1so9710421wre.1 for ; Thu, 05 Oct 2017 07:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=T7u21+ezWNsBCMbBz5dvKo3UzECRay7gvTcblRC4ELw=; b=LE7/yPImM5CGlMcy60Fg4fOcDfAn/2ZMV5gALT8DMc2Ufyf+wrmPw/12plvKFEx5Eg pW3wRwAdyk9smLHGAdcFiNH64urGSYMtTSKPxhKO6Nwp6z230b+Y3/XdagMczxSYGfpz CSLQ53op+SkQUoXYEfY/+us3Z4mZLaz1yLoyuG7xuYjblGxULyrPxblYbU+T+SUKaFqL sAdATkTwqXcw9pOMpSdm7wSVUd7eAsRl+h9oE10gXQ0/ImJNcdOwR1dWzfOqbcfTuMWj Eiv8qqwgKFEneafwU34yTy33o0VLMpd+bUEvNggBOngI8it3lJxMDB1H/TTsUR/j2K7p I06g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=T7u21+ezWNsBCMbBz5dvKo3UzECRay7gvTcblRC4ELw=; b=LMQaj3zNSMx4ObMcXW65o/omJzAlq3QIaetr1nBVP1TwiICe9wPNssmAZMdvVOYZ3W n31zdGNy6T7pX+5jT3DCaYShyLiYyb/I+z9EoCn4HStYi+ySeGyLiKhRcKXmIoG4r33z pluoUEmA5JzvHMVNLBpioxo6aXCC0N/G1Ei+eswmouFXoA//OwX8QqzKNOfGv8hSgCd0 vrpjlqUTSD2yAeQYh7kYvO49XWShZF8VdcyVAX6tRL3CJUCEZzgrEo5iYSdVNnA1q1YX D5B/Gbp/jWZx94ZRajL0inH4fOKxQ9oanDRxtUQXtyFGNa+uBpEFWnqIyIbrAU0lVYQk WEdA== X-Gm-Message-State: AMCzsaXhnvUzlmwx24LwLq/ZkGp+QDPZvn9hqbwQBdf7cZRey+CCxwV+ AVApKSXe1cPYZtqJIGp5SyXOJ07xLwQg6wUF+e8= X-Google-Smtp-Source: AOwi7QDIZEcOhX9yxcab1xSlWDwbUJIdZ4xjtnx2Tzt9pLKDVj7pIPTfZlqZXk4MhmAgpv3RmJO9af2E+W6hd+E9Tgs= X-Received: by 10.223.184.15 with SMTP id h15mr12497489wrf.123.1507213618374; Thu, 05 Oct 2017 07:26:58 -0700 (PDT) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.140.196 with HTTP; Thu, 5 Oct 2017 07:26:57 -0700 (PDT) In-Reply-To: <1506606959-76230-10-git-send-email-jianfeng.tan@intel.com> References: <1503654052-84730-1-git-send-email-jianfeng.tan@intel.com> <1506606959-76230-1-git-send-email-jianfeng.tan@intel.com> <1506606959-76230-10-git-send-email-jianfeng.tan@intel.com> From: Jan Blunck Date: Thu, 5 Oct 2017 16:26:57 +0200 X-Google-Sender-Auth: cHaJzukmv1FJ-Ue7rB9Lxaz3VqY Message-ID: To: Jianfeng Tan Cc: dev , Bruce Richardson , "Ananyev, Konstantin" , "De Lara Guarch, Pablo" , Thomas Monjalon , yliu@fridaylinux.org, Maxime Coquelin , Tetsuya Mukawa , Ferruh Yigit Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2 09/12] ethdev: support attach vdev in secondary process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Oct 2017 14:26:58 -0000 On Thu, Sep 28, 2017 at 3:55 PM, Jianfeng Tan wrote: > When vdev driver requests an ethdev entry in secondary process, > we will identify the correct entry in rte_eth_dev_data array > and return the correct entry in the rte_eth_devices arrays. > > Signed-off-by: Jianfeng Tan > --- > lib/librte_ether/rte_ethdev_vdev.h | 26 +++++++++++++++----------- > 1 file changed, 15 insertions(+), 11 deletions(-) > > diff --git a/lib/librte_ether/rte_ethdev_vdev.h b/lib/librte_ether/rte_ethdev_vdev.h > index 4d2c3e2..460749b 100644 > --- a/lib/librte_ether/rte_ethdev_vdev.h > +++ b/lib/librte_ether/rte_ethdev_vdev.h > @@ -58,25 +58,29 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size) > struct rte_eth_dev *eth_dev; > const char *name = rte_vdev_device_name(dev); > > - eth_dev = rte_eth_dev_allocate(name); > - if (!eth_dev) > - return NULL; > - > - if (private_data_size) { > - eth_dev->data->dev_private = rte_zmalloc_socket(name, > - private_data_size, RTE_CACHE_LINE_SIZE, > - dev->device.numa_node); > - if (!eth_dev->data->dev_private) { > - rte_eth_dev_release_port(eth_dev); > + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { > + eth_dev = rte_eth_dev_allocate(name); > + if (!eth_dev) > return NULL; > + > + if (private_data_size) { > + eth_dev->data->dev_private = rte_zmalloc_socket(name, > + private_data_size, RTE_CACHE_LINE_SIZE, > + dev->device.numa_node); > + if (!eth_dev->data->dev_private) { > + rte_eth_dev_release_port(eth_dev); > + return NULL; > + } > } > + } else { > + eth_dev = rte_eth_dev_attach_secondary(name); I don't see the point why the secondary process should call rte_eth_vdev_allocate() in the first place. The driver needs to setup the IPC anyway so it should just call rte_eth_dev_attach_secondary() instead. > } > > eth_dev->device = &dev->device; > eth_dev->intr_handle = NULL; > - > eth_dev->data->kdrv = RTE_KDRV_NONE; > eth_dev->data->numa_node = dev->device.numa_node; > + > return eth_dev; > } > > -- > 2.7.4 >