From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id A62059621 for ; Tue, 1 Mar 2016 08:18:28 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id n186so22100566wmn.1 for ; Mon, 29 Feb 2016 23:18:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=pQfI5NvYggZzd6DTxLADGzPGE29p7k/Gaiw9uZZfVi4=; b=T3gXa8ZUf3NDE7R1FKK9Lhu/xoIqip8CiYEysYg7/q1JopWsS2aYTBKz8jL/knaS1W 9JSvge53XYvBkSAp4p9fmdb1hNQK5uYsRb6SmrDH6qJK8XktSmGAY1KEVVpePYaHB7w6 PBp7y05pRDs+HOFCAZzovPH0sDVG+RY8uCTGTNp0kdBSm8J58MxdWOM5ycQZy3RpuSnC i0MnmuVNoo43INSDugIho6yx5JRK2M43Vb5UTtv9yKmnG/8WHplZcGZeK6hwMoVv8eZm LuBpI9UK9x89YJSbgUx0rd4AX+B72ORlakVok7JOa6BIfbTxwRExEod6JGCFX6Jxvil4 dWJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding; bh=pQfI5NvYggZzd6DTxLADGzPGE29p7k/Gaiw9uZZfVi4=; b=aHP767CmGjlZCkJhHM0qeYilmDs67JJeBG93TSI8FodYOE6RtCb2RZPHFWq82XFp/z iXIAGH2+G8L99KVnf0q3eGcSoT7GjG7NdIJ8AnpfmH5w5fUpT9/9pWf6p7hco7CgKsHc 7QwbEY4anFlX2D15nWAv8fBJp+SGT/hEalAwnX8mtVwUhZhuaQHPz+xw+gh6ZmueEYyN ZqCQfEUnJEiMHiFO7zppBvuxTl0xcaAJZ3luG7izbSs3Nmwp6ndNAgfyLSqNhtefM58L GMdJP5AudZRQS9F5SpLekt38hhpluhXxrqa2oIjoA5bswQWL9a0kCYOEI7dqS+Sa1FQE F6jQ== X-Gm-Message-State: AD7BkJIhOA8fR3Fv0SmR7zsMPsULeulRO0r2nLnsoP7/t2eOl9VrnJWWPnFK+P84HhXcZEcW X-Received: by 10.194.57.244 with SMTP id l20mr18124909wjq.45.1456816708521; Mon, 29 Feb 2016 23:18:28 -0800 (PST) Received: from xps13.localnet (180.20.90.92.rev.sfr.net. [92.90.20.180]) by smtp.gmail.com with ESMTPSA id gb9sm29437041wjb.26.2016.02.29.23.18.27 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Feb 2016 23:18:27 -0800 (PST) From: Thomas Monjalon To: Huawei Xie Date: Tue, 01 Mar 2016 08:16:51 +0100 Message-ID: <1870056.1ZGr9B153f@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <1456451636-118476-5-git-send-email-huawei.xie@intel.com> References: <20151222035041.GA7532@pxdev.xzpeter.org> <1456451636-118476-1-git-send-email-huawei.xie@intel.com> <1456451636-118476-5-git-send-email-huawei.xie@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org, nikita.troitsky@intel.com Subject: Re: [dpdk-dev] [PATCH v4 4/4] virtio: return 1 to tell the upper layer we don't take over this device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2016 07:18:28 -0000 Hi Huawei, 2016-02-26 09:53, Huawei Xie: > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -1,4 +1,5 @@ > /*- > + This new line seems useless :) > * BSD LICENSE > * [...] > @@ -1037,8 +1039,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) > > pci_dev = eth_dev->pci_dev; > > - if (vtpci_init(pci_dev, hw) < 0) > - return -1; > + ret = vtpci_init(pci_dev, hw); > + if (ret) { > + rte_free(eth_dev->data->mac_addrs); The freeing seems not related to this patch. > + return ret; > + } [...] > PMD_INIT_LOG(INFO, "trying with legacy virtio pci."); > - if (legacy_virtio_resource_init(dev, hw) < 0) > + if (legacy_virtio_resource_init(dev, hw) < 0) { > + if (dev->kdrv == RTE_KDRV_UNKNOWN) { > + PMD_INIT_LOG(INFO, > + "skip kernel managed virtio device."); > + return 1; > + } > return -1; > + } You cannot skip a device if it was whitelisted. I think you should check RTE_DEVTYPE_WHITELISTED_PCI and throw an error in this case.