From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb0-f177.google.com (mail-yb0-f177.google.com [209.85.213.177]) by dpdk.org (Postfix) with ESMTP id 1CEBE558C for ; Thu, 10 Nov 2016 10:20:31 +0100 (CET) Received: by mail-yb0-f177.google.com with SMTP id d128so86336120ybh.2 for ; Thu, 10 Nov 2016 01:20:31 -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=jxRYBAro8P2hHB0FZgeB2gNixPMQH9Ej9rmzMO889GU=; b=c0BodXfGIpgB/gXdviGEykmlE8Ri40NYzS1phhZZSxthe8RbWr7vcf0EBNAQvkoual BMYducXLTAvuld4Ya73WCyAKrvVRb9r47fGdmQKcgz1/V6ktqlgXs46xYuOrAbTDsQGw 6GJ7Kg5qvbbWWT0UMJUvRJEza1yxAjm5BNvAE= 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=jxRYBAro8P2hHB0FZgeB2gNixPMQH9Ej9rmzMO889GU=; b=kXGXzjAPdiNG/car38SceIegSdky2myy8HWbv2Tf7RrXr5J+odeq3U17sBHfcaoOvI V6LYrDTWoGHc3HEUngT36YNu/QQUJuy6ltXA8AdpnGo27brkoSEM0fDGMMDUieusT5py ir/AEL1ETUbOFd4cqEq13ITMBbGUXekVlFtTYMewPqWgC4IAE/6gzXf3CeRolwwbRtnp 8jY3NyovFdNz+nxmSINhG1q37BaMejNQ7Z0hYIXzTshu9nvhS67pFhX9lcg1XHlubJGB JjdmtcsaK3MzaxPEdj/9h41nVZ53f4tqIw5uNVuP52B7tNQsxGaIbQTXkvO9295KGaUQ BP0w== X-Gm-Message-State: ABUngvdtbmF+Km0kCxhpXAOctio241rRVGcWZMpCQQ6Jlr4gRUEsCJT0pK88PENoKdfYyTlXws+KRtn5vrIS74AJ X-Received: by 10.37.56.82 with SMTP id f79mr3904686yba.94.1478769630482; Thu, 10 Nov 2016 01:20:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.171.48 with HTTP; Thu, 10 Nov 2016 01:20:30 -0800 (PST) In-Reply-To: <1707413.bZtX9g6zPm@xps13> References: <26890399.yRKBLeyzpS@xps13> <1707413.bZtX9g6zPm@xps13> From: Jianbo Liu Date: Thu, 10 Nov 2016 17:20:30 +0800 Message-ID: To: Thomas Monjalon Cc: Shreyansh Jain , dev@dpdk.org, David Marchand 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 09:20:31 -0000 Hi Thomas, On 10 November 2016 at 16:58, Thomas Monjalon wrote: > 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. Indeed, no need as I checked the code. It's not even a issue if using David's design. Thanks! Jianbo