From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4842A0C47; Tue, 5 Oct 2021 13:37:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 386EE4132D; Tue, 5 Oct 2021 13:37:34 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 9DB3E4132B for ; Tue, 5 Oct 2021 13:37:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633433852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Gt24BMmTp9IaGiH167ofz2AGPw7JGpAFOx+FpRZNCvk=; b=Pwfg0n8unj7ENahru16ixnQ5NVDdt6tpNrSZx5gj1lXFNCD7DaYD4Bclx3AqRyezDDnY13 tXKMa3uhMPOxZXE3cfgjLR42eFZnxfG+orh11BhmWu95yd6sF9hN0rOagdwRwJqt1Xr6RK 9ruufIwaVp+3Z9v5W9/Z3OthLeghtSM= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-c9mlEi4rPymrpqUxfID4Dg-1; Tue, 05 Oct 2021 07:37:28 -0400 X-MC-Unique: c9mlEi4rPymrpqUxfID4Dg-1 Received: by mail-lf1-f70.google.com with SMTP id x7-20020a056512130700b003fd1a7424a8so11213532lfu.5 for ; Tue, 05 Oct 2021 04:37:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gt24BMmTp9IaGiH167ofz2AGPw7JGpAFOx+FpRZNCvk=; b=MypCHjAokMMbywdSlexGKCSRUAvl4E6RvqG+k7LU0tTnU2rWnlPKu1wKdIycZLudwX toB6Mtq7WGg8UNXIslg8xkWrTADvfmTUO5blzwPxLyouaTX3/DOKiLg4hs8uw4gFi+Gz 6PyORmEminfJ4F3t0YoEL9bCukqwU71W33anNakeE/RHyi3cPsCrB3LUnNm4gFxZ+nZr lRcOdVKc8P4cjT1/L/5K137R5cnz+ymsIJmEoksexozIlSDlfhqtx1iVJTiL9ItWucXS hPKfK6Wu0lt3ASvSXKe5iG9Nyw5hLLmzsf77p2QaHfQFSESU1bKvBqf8qoem1nDeWD6h /u0Q== X-Gm-Message-State: AOAM531dWaO9DeXj10GkuXEZYcjtg2gq3DCC5WqUS71SFPKRVBuBRvqp TRNfiA/6yD6dF3WsGl6YBVdNh50KfQt2fRBxV0E7GNJOSTxtlySg4JuABcNc3WoEP6L/C01wSIr /NS++dPlEopFEY9JeaTo= X-Received: by 2002:a2e:b707:: with SMTP id j7mr21396660ljo.297.1633433847431; Tue, 05 Oct 2021 04:37:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh+b/HpVNzW8XBucZPkkm9Hq9QEg7aQsuYI9YaL+HRgWGwGXakoNAPMCdAMxlttdNLg0cAEgyAD+nwwXBlA6g= X-Received: by 2002:a2e:b707:: with SMTP id j7mr21396619ljo.297.1633433847167; Tue, 05 Oct 2021 04:37:27 -0700 (PDT) MIME-Version: 1.0 References: <20211001140255.5726-1-konstantin.ananyev@intel.com> <20211004135603.20593-1-konstantin.ananyev@intel.com> <20211004135603.20593-8-konstantin.ananyev@intel.com> In-Reply-To: From: David Marchand Date: Tue, 5 Oct 2021 13:37:15 +0200 Message-ID: To: Ferruh Yigit Cc: Konstantin Ananyev , Thomas Monjalon , dev , Xiaoyun Li , Anoob Joseph , Jerin Jacob Kollanukkaran , Nithin Dabilpuram , Ankur Dwivedi , Shepard Siegel , Ed Czeck , John Miller , Igor Russkikh , Ajit Khaparde , Somnath Kotur , Rahul Lakkireddy , Hemant Agrawal , Sachin Saxena , "Wang, Haiyue" , John Daley , Hyong Youb Kim , Qi Zhang , Xiao Wang , "humin (Q)" , Yisen Zhuang , oulijun , Beilei Xing , Jingjing Wu , Qiming Yang , Matan Azrad , Slava Ovsiienko , Stephen Hemminger , Long Li , heinrich.kuhn@corigine.com, Kiran Kumar Kokkilagadda , Andrew Rybchenko , Maciej Czekaj , Jiawen Wu , Jian Wang , Maxime Coquelin , "Xia, Chenbo" , Ray Kinsella , "Jayatheerthan, Jay" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v4 7/7] ethdev: hide eth dev related structures X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Oct 5, 2021 at 12:43 PM Ferruh Yigit wrote: > > This change is going to hurt a lot of people :-). > > But this is a necessary move. > > > > +1 that it is necessary move, but I am surprised to see how much 'rte_eth_devices' > is accessed directly. > > Do you have any idea/suggestion on how can we reduce the pain for them? >From what I see, ethdev iterators are probably something that is not known enough. rte_eth_dev_info_get() also fills some other spots. I don't have a magic answer, people need to look at existing API. But I just scratched the surface, looking at rte_eth_devices[] accesses. There might be other rte_eth_dev object dereferences (you get one point calling rte_eth_dev_info_get) that my grep did not catch. Details: > > > $ git grep-all -lw rte_eth_devices |grep -v \\.patch$ > > ANS/ans/ans_main.c I think this code is just lagging behind what ethdev currently provides/does wrt default offload config. This code probably does not need to dereference rte_eth_devices[] to query offloads configuration. > > BESS/core/drivers/pmd.cc ethdev iterators can replace those accesses. > > dma_ip_drivers/QDMA/DPDK/drivers/net/qdma/qdma_xdebug.c > > dma_ip_drivers/QDMA/DPDK/drivers/net/qdma/rte_pmd_qdma.c > > dma_ip_drivers/QDMA/DPDK/examples/qdma_testapp/pcierw.c > > dma_ip_drivers/QDMA/DPDK/examples/qdma_testapp/testapp.c This is a DPDK clone, with an additional driver, so irrelevant. > > FD.io-VPP/src/plugins/dpdk/device/format.c rte_eth_rx_burst_mode_get() and rte_eth_tx_burst_mode_get() should do the job. I wonder if those APIs were introduced in DPDK for VPP.. ? > > lagopus/src/dataplane/dpdk/dpdk_io.c Idem, ethdev iterators and rte_eth_dev_info_get() instead of direct access for dev_flags. > > OVS/lib/netdev-dpdk.c For OVS, it was ethdev iterators + rte_eth_dev_info_get() where necessary. > > packet-journey/app/kni.c There might be something missing in current ethdev API. This app wants to know if device is started... but on the other hand, that's probably something the app tracks itself. > > pktgen-dpdk/app/pktgen-port-cfg.c > > pktgen-dpdk/app/pktgen-port-cfg.h > > pktgen-dpdk/app/pktgen-stats.c Accesses to offload configuration which I think are unneeded (like ANS). Direct access for dev_flags, can be replaced with rte_eth_dev_info_get. Direct access for name, can be replaced with rte_eth_dev_info_get. > > Trex/src/dpdk_funcs.c > > Trex/src/drivers/trex_i40e_fdir.c > > Trex/src/drivers/trex_ixgbe_fdir.c Here, there is some horror. Directly casting and accessing hardware: struct rte_eth_dev *dev = &rte_eth_devices[repid]; struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); I40E_WRITE_REG(hw, I40E_GLQF_ORT(12), 0x00000062); I40E_WRITE_REG(hw, I40E_GLQF_PIT(2), 0x000024A0); I40E_WRITE_REG(hw, I40E_PRTQF_FD_INSET(I40E_FILTER_PCTYPE_NONF_IPV4_UDP, 0), 0); etc... This code probably bypasses too much of dpdk API, I stopped at this. > > TungstenFabric-vRouter/gdb/vr_dpdk.gdb Mm, interesting, this part displays DPDK internals from gdb. That's something I have in my todolist for a long time, providing some common gdb scripts in DPDK... -- David Marchand