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 CE679A0032; Fri, 21 Oct 2022 10:02:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF47942BCD; Fri, 21 Oct 2022 10:02:32 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2120.outbound.protection.outlook.com [40.107.94.120]) by mails.dpdk.org (Postfix) with ESMTP id 414EF400D6 for ; Fri, 21 Oct 2022 10:02:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a7T2OkAkTKDjejsgZkgp1IExsuVr+CUaj2oo4+NPKfFpMX0TyRfmM7J6OHfStMJoS6nvb0shIOUn8gq2YVAH/egwOqsiZaW1MIbNuQZsiovnCB1aKbjRiAgitas9FPOe3BUmVuFnj5pK8BwXWYJRvmDfi0pCVn1ii/VcIWxzUCoeFFclTDo8InhIu25nJMhL71fR7M+Z5tnpg5Db2MKvY0oPawvYV+7tGysuhsCkUM6GYtWZLdoctXCqHBv2oZZuE2Zp9h2LyZVQ3Jtsq3nuItQIYoAxIYfpZr7WSz7Zhue7bNGk2nlNo3bcdNeofgE/+lI5EmGY0inj5y8ARHu31g== 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=0+rLBr6vWMZEX/APMW0fyY6mtoRpSyLwAgCQgWK9bCw=; b=obkqKWFoxI8vvYbaI+NobQwdvkuWHGJbQkA+np9Qzps9wG4QS7F9tDbnFZ/PvQZ0tcJDkwf98PFvCuTwTIRaZx5Pdsib2TGcIg2aWRKoNZ6KZr/YilpB4F5NfmAkHm2+1rE4fHODMRbF/mjzj4ypga8gpc0+JZ6+4SHDxQbMUiyIyhASUweNhndvilJkQf5FRsE6HJNX5qefWkXnPiO/ZS/bQlDIPVGOT/lfa/grcP5UnI5TiX0hg2lPt9gCEdSCa3Qx8a3EDpLyIzY1A8itzKY1TTdTRKXRPCjVu6WWwmAwo2V5x+GGNGXu9HRv5lRrm6EeJlnu3XLKfxvKfVv7tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0+rLBr6vWMZEX/APMW0fyY6mtoRpSyLwAgCQgWK9bCw=; b=lPr4cCHxhUyCYHoYGd+XBKdwhrqmCcfFZzSc6BjuYRfZxngQcajUku2P53IrbYzp/VFfWbAaa/zWJpzhR4ftBMtYk16l3Z3i5RNP/4K+iw1kjplctxYvsYk83LDeux56MZwTp1cWGUZvgi+Gh36aeub23HjAUR0jTYrzWW1S4A8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by DM6PR13MB4493.namprd13.prod.outlook.com (2603:10b6:5:1b9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.22; Fri, 21 Oct 2022 08:02:27 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b%4]) with mapi id 15.20.5723.014; Fri, 21 Oct 2022 08:02:27 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 03/27] net/nfp: fix the service stuck the app end Date: Fri, 21 Oct 2022 16:01:39 +0800 Message-Id: <1666339323-24016-4-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> References: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0051.apcprd01.prod.exchangelabs.com (2603:1096:4:193::6) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM6PR13MB4493:EE_ X-MS-Office365-Filtering-Correlation-Id: e8b7b9e4-7b80-42f0-527d-08dab33a986b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yV6STrWdgCYUIGcGy/yC1HmWIaIwwURHTuFQ41bFAahu1SB5yXKdLMhd3q2bPx9PHlDsX1aWTlfgKH5dJZm/zmIwiyL5Yun+ixe6UEEly4T0XhfqDfxil4SqHcrsv96kcBCTrSlgaRqLjPgjk4pHHZS8afnfV+2t/jz+cV58ZVNMdg/UXZWb1abhkW4JUm9JJndPyf7Vo76JwPijnDqEBXvft+QWj3JzHhtxnf/UemMqx5Qjjlx9f0y7qzgJytGFS6AE3doF3nB9wVN2vF5WX/R2vtah4oUwqxGjXh4tlGoqZzSVlQ/B2nkpZwpzywBzu2pJz45lSQiKA70MoZeqUWdQSGh26rbiRBRVFxRFX+MKA8BoxBD8sl6si+Sq/4UKYAyZIObZ8uJu6oN6uBgCZVKtU3ZnzDfqYFY+3Pd9OaW7ZEdeSbY0BDu8AcsWCLx/jjEjN5nd10kTcIo+nZfOr/GJJJUMT0o+UdwrJvIYcLojrCsf5ahNCj6v3kUkHKFSuxhk6rdUYq7tcX6bFma5dtkRuIRK23dMrcBeOszr5a8NDSoSYEqAvXWFU5Q5lj2Jh2PtspNoo6BGE4ZxL0iDC9fT10CuYqI1aWqOyNbEI0GzrlRRrdJ3dWkM4c2v10K2ENM/xgGGG06xCPJf2Og9Ku5sYnyPv3DDhY+A1C/mQlEQfM6F2EXxTIgxz7zfQ4II8R3+dSzDijsr2nTzbcp7lcd6UXtstv4VZwRfNvMXD4j3+Ic/0VJ2EkdiVRgIjvJJCJjIrsmzocJBYKnswLeW4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(346002)(366004)(136003)(396003)(376002)(39830400003)(451199015)(36756003)(8936002)(66556008)(86362001)(41300700001)(478600001)(83380400001)(2906002)(5660300002)(186003)(6916009)(38350700002)(2616005)(4326008)(6512007)(66476007)(52116002)(66946007)(316002)(8676002)(6666004)(6506007)(26005)(107886003)(38100700002)(6486002)(44832011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XvwUkuogmprv7nc4lcxv6ET6S0CYeOCH1P+frL3oJZMDV4f3Np3ksTg/LAE/?= =?us-ascii?Q?2A+3ddzRhU4gPCbkcQYmafqSPjBaI8srYMi52a21/6UczemlqVJEUqkE4bSy?= =?us-ascii?Q?km8yy4K/zP3AoBVat0Ra7EpISd89telWori1B3yr0tfJ1pLvBJJgg2GDCzgM?= =?us-ascii?Q?QbVbon9VT8JJfu8ewaFVfw5p3zB/Q7Y6MQcVxskjjfsAgyIrGmVeg/7M2zvd?= =?us-ascii?Q?1iWG/AlmvxlcHYSGeSwmmFwCyblbt2uNVuln+dCW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S8nRBE3Bv4RLOP1VY4Oj3wx5GyRndFkp1ajR?= =?us-ascii?Q?b4AGKrVcNYwQucGSNc5YSXhxK8zyLMTtmrE/4jDBW/Y5P1hUecuSZcBsNkSt?= =?us-ascii?Q?oqoqPatdx1IHg5lKH1XlxHGexkBSUgBoBhGeCJv7pt85Fu6+wPiSo5nFOyxb?= =?us-ascii?Q?hCMNIgPuatppScOTf0P929KCDOT0NqSPMDtyLaLwgYopd7+MWR2AvqcPQ298?= =?us-ascii?Q?sYnKGehLBP7g/OacTwzmRPrX1voSA9narPX7lITgjOSo0peU7ORI2nL4cWhU?= =?us-ascii?Q?5ZPFI+0Udky+hZ6lALsMyiJRqEC63pnTMdH/HcBBdiN5y9Kn0EjPugWsMkOT?= =?us-ascii?Q?W59yT6ogljMexA2ZKyFqLZuKHoXeLgkfd/DbPSS/p/1BgFjyjtjWSHWB0ArF?= =?us-ascii?Q?LRQQq5vUfgjz8+xHr9aPmupUj1WFimJmf7eO6aDJEYhuYhsR/UhIXI9vYeuk?= =?us-ascii?Q?GQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8b7b9e4-7b80-42f0-527d-08dab33a986b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 08:02:27.5960 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0ebcD7Y67AppIb1ezEV8gUkn5xvUetudRCiedMB/ZqIpxboyQ3XFX6OrqcDN/qvdaLxfN5c7O3S7xIy1F5YXrlM6FiLD9IGfj7LC25gk3/8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB4493 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 The services don't have a method to break the infinite loop, and this will cause the DPDK app can't end normally. Fixes: a36634e87e16 ("net/nfp: add flower ctrl VNIC Rx/Tx") Signed-off-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower.c | 1 + drivers/net/nfp/flower/nfp_flower.h | 3 +++ drivers/net/nfp/flower/nfp_flower_ctrl.c | 3 ++- drivers/net/nfp/nfp_common.h | 3 +++ drivers/net/nfp/nfp_cpp_bridge.c | 12 ++++++++---- drivers/net/nfp/nfp_cpp_bridge.h | 2 +- drivers/net/nfp/nfp_ethdev.c | 2 +- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 3e97f5c..1db085e 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -1056,6 +1056,7 @@ return -EINVAL; } + app_fw_flower->ctrl_vnic_id = service_id; PMD_INIT_LOG(INFO, "%s registered", flower_service.name); /* Map them to available service cores*/ diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h index 48f597a..8521ae4 100644 --- a/drivers/net/nfp/flower/nfp_flower.h +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -51,6 +51,9 @@ struct nfp_app_fw_flower { /* PF representor */ struct nfp_flower_representor *pf_repr; + + /* service id of ctrl vnic service */ + uint32_t ctrl_vnic_id; }; int nfp_init_app_fw_flower(struct nfp_pf_dev *pf_dev); diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index df908ef..53ca710 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -4,6 +4,7 @@ */ #include +#include #include #include "../nfp_common.h" @@ -238,7 +239,7 @@ /* ctrl vNIC only has a single Rx queue */ rxq = ctrl_eth_dev->data->rx_queues[0]; - while (true) { + while (rte_service_runstate_get(app_fw_flower->ctrl_vnic_id) != 0) { count = nfp_flower_ctrl_vnic_recv(rxq, pkts_burst, MAX_PKT_BURST); if (count != 0) { app_fw_flower->ctrl_vnic_rx_count += count; diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index d7861a2..36c19b4 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -171,6 +171,9 @@ struct nfp_pf_dev { struct nfp_hwinfo *hwinfo; struct nfp_rtsym_table *sym_tbl; + + /* service id of cpp bridge service */ + uint32_t cpp_bridge_id; }; struct nfp_app_fw_nic { diff --git a/drivers/net/nfp/nfp_cpp_bridge.c b/drivers/net/nfp/nfp_cpp_bridge.c index 155628d..db4b781 100644 --- a/drivers/net/nfp/nfp_cpp_bridge.c +++ b/drivers/net/nfp/nfp_cpp_bridge.c @@ -80,7 +80,7 @@ } int -nfp_enable_cpp_service(struct nfp_cpp *cpp) +nfp_enable_cpp_service(struct nfp_pf_dev *pf_dev) { int ret; uint32_t service_id = 0; @@ -89,7 +89,7 @@ .callback = nfp_cpp_bridge_service_func, }; - cpp_service.callback_userdata = (void *)cpp; + cpp_service.callback_userdata = (void *)pf_dev; /* Register the cpp service */ ret = rte_service_component_register(&cpp_service, &service_id); @@ -98,6 +98,7 @@ return -EINVAL; } + pf_dev->cpp_bridge_id = service_id; PMD_INIT_LOG(INFO, "NFP cpp service registered"); /* Map it to available service core*/ @@ -375,7 +376,8 @@ nfp_cpp_bridge_service_func(void *args) { struct sockaddr address; - struct nfp_cpp *cpp = args; + struct nfp_cpp *cpp; + struct nfp_pf_dev *pf_dev; int sockfd, datafd, op, ret; unlink("/tmp/nfp_cpp"); @@ -408,7 +410,9 @@ return ret; } - for (;;) { + pf_dev = args; + cpp = pf_dev->cpp; + while (rte_service_runstate_get(pf_dev->cpp_bridge_id) != 0) { datafd = accept(sockfd, NULL, NULL); if (datafd < 0) { RTE_LOG(ERR, PMD, "%s: accept call error (%d)\n", diff --git a/drivers/net/nfp/nfp_cpp_bridge.h b/drivers/net/nfp/nfp_cpp_bridge.h index 7fee3a9..8ff7a22 100644 --- a/drivers/net/nfp/nfp_cpp_bridge.h +++ b/drivers/net/nfp/nfp_cpp_bridge.h @@ -26,7 +26,7 @@ #define NFP_IOCTL 'n' #define NFP_IOCTL_CPP_IDENTIFICATION _IOW(NFP_IOCTL, 0x8f, uint32_t) -int nfp_enable_cpp_service(struct nfp_cpp *cpp); +int nfp_enable_cpp_service(struct nfp_pf_dev *pf_dev); int nfp_map_service(uint32_t service_id); #endif /* _NFP_CPP_BRIDGE_H_ */ diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index f25d6a1..77aac2e 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1065,7 +1065,7 @@ } /* register the CPP bridge service here for primary use */ - ret = nfp_enable_cpp_service(pf_dev->cpp); + ret = nfp_enable_cpp_service(pf_dev); if (ret != 0) PMD_INIT_LOG(INFO, "Enable cpp service failed."); -- 1.8.3.1