From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: Clarification for eth_driver changes Date: Thu, 10 Nov 2016 00:58:01 -0800 (PST) Message-ID: <1707413.bZtX9g6zPm@xps13> References: <26890399.yRKBLeyzpS@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: Jianbo Liu , dev@dpdk.org, David Marchand To: Shreyansh Jain Return-path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id CE62C2BD0 for ; Thu, 10 Nov 2016 09:58:02 +0100 (CET) Received: by mail-wm0-f52.google.com with SMTP id f82so17034709wmf.1 for ; Thu, 10 Nov 2016 00:58:02 -0800 (PST) In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2016-11-10 14:12, Shreyansh Jain: > On Thursday 10 November 2016 01:33 PM, Thomas Monjalon wrote: > > 2016-11-10 15:51, Jianbo Liu: > >> On 10 November 2016 at 15:26, Shreyansh Jain wrote: > >>> 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. > > > > Why do you need any bus information at ethdev level? > > AFAIK, we don't need it. Above text is not stating anything on that > grounds either, I think. Isn't it? No, I was replying to Jianbo. Anyway, David made a more interesting comment.