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 DB6A3A0542; Tue, 6 Sep 2022 12:18:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7C8C840143; Tue, 6 Sep 2022 12:18:45 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2078.outbound.protection.outlook.com [40.107.223.78]) by mails.dpdk.org (Postfix) with ESMTP id E0DE8400D6 for ; Tue, 6 Sep 2022 12:18:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cih8eTh9uG4egZGVSMTxdnr8LqvZ6JlgoKo6g5zo2oj+j7LaZbTdfYr4N+UPzjpnIJcYGvD7LaSPyxOwNlTeBt74EkdUwqzTW5rSrQftJkSatroxTb3ttVw5KIGdZqeqwfPnVFYgyrIuJHoZUGx2DAPdE19dkQ5cRbZoAfxwtmC+Sz15RUlEmQFx2Eyp3RCRwUfSF1rFjYxSgRdQNKAnvyv9G0hjl7eW5oWivxNQ1xx+kfREBqmigmxnAaB8mwThudMkBwnMSAmQObd9Mkx7GSORGlYLBlr1z4A+MUnQp/q05IzzU/hGd7449jSz0Sej5jbHSOwhnQkx1JLwn+K/FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P2QQ7zRwbyC/iPJoZtrHr0rGxvvAMbsaTByeFkefroo=; b=b+ZY3hKyfNk76VAvHSMLuIlz2Zz/2qrjXsXTw5bw7SRRpiJ6Vc45nu1guBdLG3ewSzeXqGIga1y/3awqOwv6aV0b/63D+hpCjBei3IsSM3jzTgUqUq0sjbVj9SZ1XoGACalL27TEL8z8nLogeyqNJimp7i1VrW7wJoB2hxLA7g2xMkd3Jf5BZCT3/KFMDUdu7hriG9ReXEquqnbLEqO+lDEkTuTTyc8qbCAHc3ehAQkqnOpsmfbAzM3bUAWKHPa5nVZ8qSfgKW6HLs4LBaddEoc6nmljaFNlb5YwhumeM9AGfUUoB8APSrcuo3/47eWQA5UXyZNE+2YEfMv2BEdKQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=corigine.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P2QQ7zRwbyC/iPJoZtrHr0rGxvvAMbsaTByeFkefroo=; b=Z23m3rgGSBb6XnaHE7KOBB3RWQC1rptliZI3yjaC2y/DCVqUaDbWrw/4PeTuI1atg6onLOqWgEWrtJVb/p2eRBZDWSIhGQUkJUKcYunNW4aBopuvI3saptsLI5K+FyB7zPuwV3oyZYyyrV76sRwOcWQAMvUZWPMc3gfFTDzTGBI= Received: from SA1PR03CA0007.namprd03.prod.outlook.com (2603:10b6:806:2d3::16) by DM6PR02MB6075.namprd02.prod.outlook.com (2603:10b6:5:1f8::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.14; Tue, 6 Sep 2022 10:18:41 +0000 Received: from SN1NAM02FT0055.eop-nam02.prod.protection.outlook.com (2603:10b6:806:2d3:cafe::96) by SA1PR03CA0007.outlook.office365.com (2603:10b6:806:2d3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 10:18:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch02.xlnx.xilinx.com; pr=C Received: from xir-pvapexch02.xlnx.xilinx.com (149.199.80.198) by SN1NAM02FT0055.mail.protection.outlook.com (10.97.5.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 10:18:41 +0000 Received: from xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 6 Sep 2022 11:18:40 +0100 Received: from smtp.xilinx.com (172.21.105.198) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2375.24 via Frontend Transport; Tue, 6 Sep 2022 11:18:40 +0100 Envelope-to: chaoyong.he@corigine.com, dev@dpdk.org, andrew.rybchenko@oktetlabs.ru, oss-drivers@corigine.com, niklas.soderlund@corigine.com Received: from [10.71.194.74] (port=53282) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oVVfD-0007Yw-KF; Tue, 06 Sep 2022 11:18:39 +0100 Message-ID: <8a38e1ca-ecae-0a38-9d06-841fb29387e6@xilinx.com> Date: Tue, 6 Sep 2022 11:18:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH v7 05/12] net/nfp: add flower PF setup and mempool init logic Content-Language: en-US To: Chaoyong He , "dev@dpdk.org" , Andrew Rybchenko CC: oss-drivers , Niklas Soderlund References: <1660299750-10668-1-git-send-email-chaoyong.he@corigine.com> <1660299750-10668-6-git-send-email-chaoyong.he@corigine.com> <39c13f4a-8122-5b72-b909-0a9197acff89@xilinx.com> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a22429f0-1e8d-4910-4441-08da8ff12c05 X-MS-TrafficTypeDiagnostic: DM6PR02MB6075:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: owfLx/8w+QxbXqDIjBvSQBOBJ9PwwLdsPg+lL2uOfjx0VMn7w7z71mVNvXeZ8YqEu7Cql0fG2fCyABQWPgJR5owKpXftj7Wp+OuXDek4jRi62052gk++a36Y2catPmtrJwBtxRN7Wc8brT6XHQc4pQy+6IPG8UWU0ur6R0QAPVY56+KA/OMn0L4pTwgYT1KFCU5A+10xZ8s08C5sSllA1wSbeHidPuIKoVgJw/EP5aryn+1sE15Vrdafv2Ul/7FYpVYWYXda6wsbjQaVGnnlHD1QecnowNKO3+oIiWR2QeabknBwSXM7ldfS4A5uupn2i02k9Q6KDX76gK8dls2ggy6sniFbWzLc4CHfKlCwyoDTrhjNXpw9n0/DKnsXyO2Gil7xQNoL4gUCa8dLVTpbgKeYuAn+6fYTqWTqy2g7BUvm6+fM3pIA2riYq4jX9/p6LGsi4jBmwk244PEe70yiwy5i9l71PDYBw8Zf4VfTiRn3p9Cpk9Izo/EHQin7YvoIGTddTSAfIbeQWWuE8+lRFQ5wh/jQ6jF7qHVkNVGkyWUugqzNyP/rgwQKpsV2uRuKLP7SnpfhT++dtCVv4mFgz0Z5vpImVuedhML4BR8d3oDuGhSsRcEVLC8nmciwj36L8DdwJL0C43FHgb9FGsLD1lBC62JDhmpJXB7QHYtxHBTACbocaNFJGiGMrQ8SwRvjYgimbohUV3cIsYegQJa4+MRN4A+rI4gwB6r59IuwyXLKkuPn/YneuIAdk/i3r5WqPmvRtkaBL01Riy9+xnX7Npv0i+YSAczXtBx7geYoHVPGti9nn+7qglRRGnPCkTNHXxxxbBYpVUt2gor7VeOiWw== X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch02.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(376002)(136003)(346002)(39860400002)(396003)(40470700004)(46966006)(36840700001)(70206006)(8936002)(54906003)(110136005)(9786002)(26005)(53546011)(41300700001)(44832011)(31686004)(82740400003)(7636003)(356005)(316002)(478600001)(70586007)(36756003)(2616005)(40460700003)(36860700001)(47076005)(2906002)(83380400001)(40480700001)(31696002)(82310400005)(5660300002)(186003)(336012)(426003)(8676002)(4326008)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2022 10:18:41.2123 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a22429f0-1e8d-4910-4441-08da8ff12c05 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0055.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6075 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 On 9/6/2022 9:45 AM, Chaoyong He wrote: > CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email. > > >> -----Original Message----- >> From: Ferruh Yigit >> Sent: Monday, September 5, 2022 11:42 PM >> To: Chaoyong He ; dev@dpdk.org >> Cc: oss-drivers ; Niklas Soderlund >> >> Subject: Re: [PATCH v7 05/12] net/nfp: add flower PF setup and mempool >> init logic >> >> On 8/12/2022 11:22 AM, Chaoyong He wrote: >>> Adds the vNIC initialization logic for the flower PF vNIC. The flower >>> firmware exposes this vNIC for the purposes of fallback traffic in the >>> switchdev use-case. The logic of setting up this vNIC is similar to >>> the logic seen in nfp_net_init() and nfp_net_start(). >>> >>> Adds minimal dev_ops for this PF device. Because the device is being >>> exposed externally to DPDK it should also be configured using DPDK >>> helpers like rte_eth_configure(). For these helpers to work the flower >>> logic needs to implements a minimal set of dev_ops. The Rx and Tx >>> logic for this vNIC will be added in a subsequent commit. >>> >>> OVS expects incoming packets coming into the OVS datapath to be >>> allocated from a mempool that contains objects of type "struct >>> dp_packet". For the PF handling the slowpath into OVS it should use a >>> mempool that is compatible with OVS. This commit adds the logic to >>> create the OVS compatible mempool. It adds certain OVS specific >>> structs to be able to instantiate the mempool. >>> >> >> Can you please elaborate what is OVS compatible mempool? >> >> <...> >> >>> +static inline struct nfp_app_flower * nfp_app_flower_priv_get(struct >>> +nfp_pf_dev *pf_dev) { >>> + if (pf_dev == NULL) >>> + return NULL; >>> + else if (pf_dev->app_id != NFP_APP_FLOWER_NIC) >>> + return NULL; >>> + else >>> + return (struct nfp_app_flower *)pf_dev->app_priv; } >>> + >> >> What do you think to unify functions to get private data, instead of having a >> function for each FW, it can be possible to have single one? >> > > At first, we use two macros for this, and Andrew advice change them to functions. > ``` > #define NFP_APP_PRIV_TO_APP_NIC(app_priv)\ > ((struct nfp_app_nic *)app_priv) > > #define NFP_APP_PRIV_TO_APP_FLOWER(app_priv)\ > ((struct nfp_app_flower *)app_priv) > ``` > So your advice is we unify the functions into: > ``` > static inline struct nfp_app_nic * > nfp_app_priv_get(struct nfp_pf_dev *pf_dev) > { > if (pf_dev == NULL) > return NULL; > else if (pf_dev->app_id == NFP_APP_CORE_NIC || > pf_dev->app_id == NFP_APP_FLOWER_NIC) > return pf_dev->app_priv; > else > return NULL; > } > ``` > and convert the pointer type at where this function been called? Since return pointer types are different, it should return "void *", ``` static inline void * nfp_app_priv_get(struct nfp_pf_dev *pf_dev) { if (pf_dev == NULL) return NULL; else if (pf_dev->app_id == NFP_APP_CORE_NIC || pf_dev->app_id == NFP_APP_FLOWER_NIC) return pf_dev->app_priv; else return NULL; } ``` And when assigning a pointer from "void *", no explicit cast is required. ``` struct nfp_app_flower *app_flower; app_flower = nfp_app_priv_get(pf_dev); ``` I think this is better to have single function, instead of different helper function for each FW, but I would like to get @Andrew's comment too. Btw, since 'nfp_app_nic*_priv_get' return 'NULL' now, should callers check for NULL, this may introduce too many checks, and if checks are not necessary, what is the benefit of the function against macro?