From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb0-f178.google.com (mail-yb0-f178.google.com [209.85.213.178]) by dpdk.org (Postfix) with ESMTP id 7C75A201 for ; Thu, 10 Nov 2016 08:51:19 +0100 (CET) Received: by mail-yb0-f178.google.com with SMTP id d128so85780329ybh.2 for ; Wed, 09 Nov 2016 23:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cDszeI9W3TQRoeONcJ1qhlURMKZOUkWDwXj7Y7RGVl8=; b=A9xjwwlLtoTUhQNBAI2iw9lzL5k0u6/frFZRxLPIs9p+DolyI8UZRZY0bns50jbq1S c3PMfvITaXho0W56U6C1R/I4jd6uf1clC6ooPzhQRwc+c5UlUxwcHsImgf7Gr/jcFS+5 +bR3DZG2PzEnPVk3BSHcxWKlkRUdOdm1vzl50= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cDszeI9W3TQRoeONcJ1qhlURMKZOUkWDwXj7Y7RGVl8=; b=ZccK+fyTHTtFd6RMjp7hCgXQ5ZkHxMkWXeDN5IrTPPNenD+5rIYwL0Sn9JGhqV7bK7 ywSyeE03b8aJ216tB5whzsfRsuIhHdfvBb0UI0OPvGtjs7Qyz95WTr2iHe3BDC3BO1gz u5ygEEdNjRS95bscthYUwDPfObq5STP9OPK/e5JkFR8Uuu6jocMszhA4pdbsBY1RxxXr 9rH+Ix6sIPrdfZm6eWfwiVzlbI02Rov92uix31fEs7TXeNgpAYg3US2wNE4U5zz2pALf Pgzq+PB93eNewdsTJhXjmGvDwcq+jYe4yKZwUMk4K+ncI7XfWFLlzgTtfbEG0De2L2z9 CWYQ== X-Gm-Message-State: ABUngvf+292ywWXGA9hjVUY4crAGcp5U6fehvum1u+7BGKrgWTKA8zNLn+WfMtXNtaNDkE5BZy//NXHWkq6yFHs/ X-Received: by 10.37.161.234 with SMTP id a97mr3949994ybi.119.1478764278768; Wed, 09 Nov 2016 23:51:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.171.48 with HTTP; Wed, 9 Nov 2016 23:51:18 -0800 (PST) In-Reply-To: References: From: Jianbo Liu Date: Thu, 10 Nov 2016 15:51:18 +0800 Message-ID: To: Shreyansh Jain Cc: David Marchand , "dev@dpdk.org" Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] Clarification for eth_driver changes 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: Thu, 10 Nov 2016 07:51:19 -0000 On 10 November 2016 at 15:26, Shreyansh Jain wrote: > Hello David, list, > > I need some help and clarification regarding some changes I am doing to > cleanup the EAL code. > > There are some changes which should be done for eth_driver/rte_eth_device > structures: > > 1. most obvious, eth_driver should be renamed to rte_eth_driver. > 2. eth_driver currently has rte_pci_driver embedded in it > - there can be ethernet devices which are _not_ PCI > - in which case, this structure should be removed. > 3. Similarly, rte_eth_dev has rte_pci_device which should be replaced with > rte_device. > > This is what the current outline of eth_driver is: > > +------------------------+ > | eth_driver | > | +---------------------+| > | | rte_pci_driver || > | | +------------------+|| > | | | rte_driver ||| > | | | name[] ||| > | | | ... ||| > | | +------------------+|| > | | .probe || > | | .remove || > | | ... || > | +---------------------+| > | .eth_dev_init | > | .eth_dev_uninit | > +------------------------+ > > This is what I was thinking: > > +---------------------+ +----------------------+ > | rte_pci_driver | |eth_driver | > | +------------------+| _|_struct rte_driver *p | > | | rte_driver <-------/ | .eth_dev_init | > | | ... || | .eth_dev_uninit | > | | name || +----------------------+ > | | || > | +------------------+| > | | > +---------------------+ > > ::Impact:: > Various drivers use the rte_pci_driver embedded in the eth_driver object for > device initialization. > == They assume that rte_pci_driver is directly embedded and hence simply > dereference. > == e.g. eth_igb_dev_init() in drivers/net/e1000/igb_ethdev.c file > > With the above change, such drivers would have to access rte_driver and then > perform container_of to obtain their respective rte_xxx_driver. > == this would be useful in case there is a non-PCI driver > > ::Problem:: > I am not sure of reason as to why eth_driver embedded rte_pci_driver in > first place - other than a convenient way to define it before PCI driver > registration. > > As all the existing PMDs are impacted - am I missing something here in > making the above change? > How do you know eth_driver->p is pointing to a rte_pci_driver or rte_soc_driver? Maybe you need to add a type/flag in rte_driver. > Probably, similar is the case for rte_eth_dev. > > - > Shreyansh