From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
 [209.85.212.181]) by dpdk.org (Postfix) with ESMTP id 856C2C394
 for <dev@dpdk.org>; Thu, 23 Jul 2015 17:44:11 +0200 (CEST)
Received: by wicmv11 with SMTP id mv11so29755016wic.0
 for <dev@dpdk.org>; Thu, 23 Jul 2015 08:44:11 -0700 (PDT)
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:mime-version:content-transfer-encoding:content-type;
 bh=R6QuQhUiVIJATPcZMZXv3ZUuuHXVYpm2/lsQCm6zDqQ=;
 b=hQ4qMoCGboDPoJE35523kMPtpG1qUITUZM8HvtVPygmYJQrxHyiieGHmr8z/Ag+Urs
 B8ZaOK9zJc3zGkXDUKv1u2kDDr66jzqYcsi9cJP7ykRwSy/uy9uQJHBPXLT2ANgbGF8K
 C2dY31QCTZeA6xtEuYR+hOCwsVv4Da03Kzduabwh1Y5cj1kpE2+6Q4Bc31UFjN3EY0Oe
 EDuzVOuGFWEj5HR+BBQeHgz9zw87hUSjEx6g1ttcs1BHnT/zJJSxj0V3hvMowqEKo+Bh
 nkAR7Ca7YND04M3ZR3xgpf4sBW8lB7RlQKXBRGDXJyGN3reU5++4JVtCSEL8oDmdkG+0
 G/SQ==
X-Gm-Message-State: ALoCoQnFxFGxlDZMe33NgZetMYddoH0KPfiFOPlljy3WJSPr2NCuSPL4hCAhu6xpvf3UBroV4BRs
X-Received: by 10.180.77.129 with SMTP id s1mr18533479wiw.67.1437666251178;
 Thu, 23 Jul 2015 08:44:11 -0700 (PDT)
Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136])
 by smtp.gmail.com with ESMTPSA id i6sm8108196wje.33.2015.07.23.08.44.09
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 23 Jul 2015 08:44:10 -0700 (PDT)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: dev@dpdk.org
Date: Thu, 23 Jul 2015 17:42:58 +0200
Message-ID: <2330484.OMtusG3QG9@xps13>
Organization: 6WIND
User-Agent: KMail/4.14.8 (Linux/4.0.4-2-ARCH; KDE/4.14.8; x86_64; ; )
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: [dpdk-dev] management of non-PCI devices
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 23 Jul 2015 15:44:11 -0000

As noticed when reviewing the changes for hotplugging ring PMD,
	http://dpdk.org/ml/archives/dev/2015-July/021872.html
a driver is considered in ethdev and EAL as a PCI driver:

 * Each Ethernet driver acts as a PCI driver and is represented by a generic
 * *eth_driver* structure that holds:
 * - An *rte_pci_driver* structure (which must be the first field).
 * - The *eth_dev_init* function invoked for each matching PCI device.
 * - The *eth_dev_uninit* function invoked for each matching PCI device.
 * - The size of the private data to allocate for each matching device.
 */
struct eth_driver {                                                                                              
    struct rte_pci_driver pci_drv;    /**< The PMD is also a PCI driver. */
    eth_dev_init_t eth_dev_init;      /**< Device init function. */
    eth_dev_uninit_t eth_dev_uninit;  /**< Device uninit function. */
    unsigned int dev_private_size;    /**< Size of device private data. */
};

So the non PCI drivers don't use rte_eth_driver_register().
Then a difference is made with these flags:
enum pmd_type {
    PMD_VDEV = 0,
    PMD_PDEV = 1,
};

With this kind of weird things:
static struct rte_driver rte_virtio_driver = {
    .type = PMD_PDEV,                                                                                            
    .init = rte_virtio_pmd_init,
};
Because virtio is a virtual device with a virtual PCI address.

All these things are not normal and make EAL code more and more difficult to
maintain. That's why we must stop accepting new code using these workarounds
and start working on a refactoring.

Comments welcome