From patchwork Thu Aug 1 10:52:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142821 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1743A45710; Thu, 1 Aug 2024 12:53:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA6F543366; Thu, 1 Aug 2024 12:53:33 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012024.outbound.protection.outlook.com [52.101.66.24]) by mails.dpdk.org (Postfix) with ESMTP id 7CE4742FE7; Thu, 1 Aug 2024 12:53:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=W1HtL0+f9O6wGnVAu0yiY/eaLJFq8BbGGNQwqBjkBBQNZ8FbEsGLPCAvr1WaQ//n4iwQMnBl2BUwzBlRk5FoS6c+SiCbcj3IOQkmnDjRj/XtEjsJekwz95JM98c1ifsbFCXIf1f6Fo/4nV22f1BTeXVQDVUnAnrdtrVW1fla13b3qrTMFfxXWQe5i3y33i9Uk4JieyiLmrxS3xXBphbjx4Y+CpS6l6UzfFukkdZJu/C+yOtwrQqJb/tJi11FnY23awXU1xLINjyK4YUM953ZWrHMWwrzkdEi3oKiPzrc7eoZb425PyU8qj+N06d9TrdcPBEwCm4k+fKGzqpqwqzs8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=VQTBFf6iffqhdrfBDCMQV7dbsStZ0GSTY+9yhr9iFJw=; b=f/I15r4bl4w9S9NHALJ5Wl7UAdQbbyEv36wyTlgcSGoIPOB/1QgI0hnHhHyN87kuLZpotwcy1tSaHAb/cBul/XHL6DNf7YpYaWpSTMGo7IFr6HL5o2cTizIEnf2wjvOps7bIknChVsjuqnyiqtkI2hoTH5BwEA31W3giHCMfpmHnWX93qGdjUo0Drtg3IJO/CZOd6BPNjFv+1bfnKRMLKEwVMt3GboMHWNmnWFyXXqrctzcC/j3UV2M5fSMcg0O/I5XCTrjiJMUhnIXgLL3SQ7IVKklhHBWDAjBHbi/YLuJUN/AvtkIUPJFgY2XGr6tFnfhLfVfgsttj0ZgBst4RMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VQTBFf6iffqhdrfBDCMQV7dbsStZ0GSTY+9yhr9iFJw=; b=Hu6iZgkRj3Ywu9kxq18GCa44uIhOQlhZsZfDlt5syIK6o/4o6pZe/lmZLoibNVD4WtOuvPwMQPZJQWaTqQ77+EbL5b4dlfEAqImoa9UMcLlmSoNplOVo1qRurC4e0NUgXEsXj1WKnaZ6x1OGA+RuthaMpIc9GvaEvvrQ+/QqqW/SkJY3tH6/3T+AJ8p9e5nc98bID3I3K5Yj2H+NrkQHVBNtuL1sWuqRSbWDwfmpmLGuIrDHXML3B/LVZo8oq2WshaAzPCvUO/tbmDXqIpJob7tXgmjvF40qnWBrX0GYSPbdFz8K/NR6Q1pjzKpCjJJlKYnbXXPkkNgxRo2fg07epg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:29 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:29 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Gagandeep Singh , stable@dpdk.org Subject: [PATCH 01/17] bus/dpaa: fix PFDRs leaks due to FQRNIs Date: Thu, 1 Aug 2024 16:22:57 +0530 Message-Id: <20240801105313.630280-2-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 40a0fb83-7e4e-417a-a219-08dcb2182d6e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: f8bWwlH3M6FNbHiGtsvYWxhwi6KI+FeWjlHgbrkKEce2421/BETP070bTeKjMpqUN8Ovk023VcxE/DCSxQM39g/rNBlmFGAZQbyzxecus7UNmEI2VOoGHaFlD1aGDVuox1Slp7njgrrsohkevSUjzjsilMjJKUfsI6gC/AH0uzCZ/Fc3TJvtCAjM8OPfrgXWBOzf8eoqiWAcjIffYiBIfQlDjpG3BeqMYqBIoeGxOxbts/5t4U89qbmM7b9Xp1rhrlrnUXe2YvQ/06z8xWASODvHyqgWwqmJtUirphkmv36GfoqA2Yp5MBWb5XFfwVfXusMbFSjE2/phwLMffkj9TeHNr4EPE1QmBBkibw/PdwizzSZuYmE8FNA/SvUaXAKQdiBGIG3OBnht1ACXLLuIc1u72d/EuKwaZm1VJPVvWZIgnjh2IOYOIAhS8a0INRlfPFDG5zL4o/ukpIDfQm+xpdcPDnBizBPPpNkvvG9KjVSgOPA3WDS0ljhJZrbSPAz7a0YJPgf6O2UGGqddBV3vFN+PZmbEnNoplFZAvN2GIH/Ua+9wTYwSyzATMXbDFpj/HSGlVitrzvrD56S9ol/Q/q/l4nTQInIJsT2dvJJOyyD3DiekQiZAwaGjsrtFDgRO4kN6sYilCIaPO+LxPWsZZLbrB0AWasjmjuYXwW2PzUl/TA5jkrDt0AjdvxvdouamMgwpmCMJqAYiirEZFTTesInwAgMgg2n27Syf+PZ46bic2Rqae5XTmvWV/a82pLwXhoRlE9KDq59UBtU14+SGcIMrO+RIRlfsn5DzIq/xRqEwIubD3LpxfCAg09E3Hv+7UBoYh3ZG38umoD+lagWpfmtbnmBHsl0Eho4quLkJJpL1pRFN+H+MCgb4pdJ3016oQ0eaZYSa7jpJWrqxsFnB0D1YEb9X3ak65BBTnYpJ0fYBfappoBfqXEfVkB/mm4GErOi/nKuRIkr+wPOoyNRk2bshzV+l/1KKttR/eByUYNK6iFhFGxl5a7PyxmUmUmXU+t7PUDlLVy77lP6b6hjduw7x3EnZkJp0yRwq+Yw2xFl6alvSsT2eKAExNVDIjjWcLOQDnntLmWPkknRl4uVkKPKSTBAnb9ULf19KYp2xjimAnAzJFLjC5ZAQbDYLda1IYtioeMJMC6wSTrv96pa6IjKnhCK5NRxrs/LA9uab9C4umD9HNFj+fmATGaaC81XAPc8axYakKhcSJF5CiTDXu+wtnf1nrUrqXx9DWxFHakLfLHCOFqTqWg5KSbAUrKpgPPPNqFLm3JMUrOLN7+PuKhKQtANxNP/0zQL1gcIiqncqMzp1IknnqIiAXyn8VYzvJM6QnnsbgfS6m+87lpMmJm4pBNhIf7ypQ3Y6h+bL+r24rFMb6T9B3aynq+dOZ+Ml7USTgv8p+sbWP5/gcfH50Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: haom1nVf3tf7ur0IwxFtDz37EcWmNBifqPI9gnTIN7AzHVavQAcYgLqJ/CsvngxJ8DxaIdUl8b9lK6zCihxX9AV6fwFLkhrfUOaRderB4NawitVpaSPMUJqj189FrAMQUXY/U8YivIw7yh7iw0q2lbPVRubLHVP6fqDnpeg9C+XqPAEl6s9zm8RPn9MRBqUzUoHQJk0GIecMoPkzhtFIOP1lBZnuJkQhlv0bbB7C5LvBiGJIbigKoEUn3EDnBEkEIuzuF18rZItJkKRoM0GGoaWlzY9OnFj8NYbYbznf3t5mg3EdCCtS8O0nkoxPrHTNe06PE+6orD6L9ceLeL5P08uRLWCHDlg7ofYi1jUiiH4oxEeva3nfUjGWSTtrwZXa1C7Gp4gn+HBF1m/n0hIMI+oEcBquExDglYuP7AiYpeoBXtYR5vGGqFfzBPB/IBizkVD1E+/i9P2BQ4p5ltbxf7SJ+H3agsnTo1f91iAX8FgaYx04pihyrhaqYUyYi0sYknHgveM38+RXrrsMMvwgPwwXLAGWUTgwbOFU5ht+uYK3QE4p/bDgbXOeweALfYKApAHeV77J9m5QgDKqlikmN6GMEqf4RxmmOR7FOd+OAahtN/RmYebDjHzyyf7ZZz7JyeAsQEqIbbZHvxak9oWR4eSdMOL6ndYBDdANUSHzV0LAyKj0OWstAlTX8fdF+nA4Msy52+DpxFsEYI/sLEXAhS4Puv0JkfupvMqUOn2IL3yHDfF6O5BoGS46MiNzUd5u0rNNCHoKawOWb1oofE0LBHF3fiSqMS7d81MEh1pPuiUmJ/oeOKqZqOBMrWKt5mv7RHpXldNgPF5wr/DUOFHz6sH8wfCcrA2U7zqcdVPkWXWU72+DbEqhs4kCJMQx5kWlZy7bgoROv4DCJTPO0NHD/oPxw5vo1Nl/G2qVYHb393l0ID9VBsKHvaWLYXXlZXnC2B69TSVo90mWiqrvqk57NlZiv4yh3zQRBTbPjEPb6npCHTHqDuiUmeDvL8YwkO4/9up+9Set9M720zaO93xsNo3yK4Mx1wMKvliikHppyT31HgOTuXOq0o36kFodJPTz7ALxtL2878TmVEEPNU1BEkpQBjbonqNnr95V4iFtZC3CbrzgZRAno9X5RIbh9zS6DQz4kLv+QAacp6fpkfGAGfTZaQsuLbb8ra3KhS0IVdwr15JWxb5cClsnU0Ole6b2fULrKl1WMyNsxULU2kOpPJQEZ0jn5VeNE5pfxStOiFVj6MpQnHHvi6rLjFvtbNvJo6EHJcUJ0wdJ7AZSBOzfAuvCDyKUauFhsxzzXtVpGljkYHGzEPfncN09mSL5371FT1p0vzQVQ+Q8+49sIvRvz+mh8k+EdclrjohoKl9zkhx2KTbyc3TH+fOHzPq9SrQZkU4PTH3ZjLi5DHeV7hRM1DKmd1Q2414HxCv2ESs3jsA3SoQ4yad/uxRKXiDsvqWuO06X6ZpwQJECWq6y81lGIYO/DFSPeMl+lxVs1hf3y0CHC1aCvc8/eHWI6leKzkWgOZebUgo699EuuDF13xiN9uZ5Y7HEcDds55/ytxqMZ2YSAEVhBNZLWrxwDimczKgg66YK64Z7Z1TD7PCy31jAQw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40a0fb83-7e4e-417a-a219-08dcb2182d6e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:29.2638 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: i8u1bchJNR+FKQuEUGnqKkNeuyKTy8iZ76UzjrrhGN1LPoVKXwtJGMB3sdVKfSfGYVHw9BgBSWyVkXvG901EDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Gagandeep Singh When a Retire FQ command is executed on a FQ in the Tentatively Scheduled or Parked states, in that case FQ is retired immediately and a FQRNI (Frame Queue Retirement Notification Immediate) message is generated. Software must read this message from MR and consume it to free the memory used by it. Although it is not mentioned about which memory to be used by FQRNIs in the RM but through experiments it is proven that it can use PFDRs. So if these messages are allowed to build up indefinitely then PFDR resources can become exhausted and cause enqueues to stall. Therefore software must consume these MR messages on a regular basis to avoid depleting the available PFDR resources. This is the PFDRs leak issue which user can experienace while using the DPDK crypto driver and creating and destroying the sessions multiple times. On a session destroy, DPDK calls the qman_retire_fq() for each FQ used by the session, but it does not handle the FQRNIs generated and allowed them to build up indefinitely in MR. This patch fixes this issue by consuming the FQRNIs received from MR immediately after FQ retire by calling drain_mr_fqrni(). Please note that this drain_mr_fqrni() only look for FQRNI type messages to consume. If there are other type of messages like FQRN, FQRL, FQPN, ERN etc. also coming on MR then those messages need to be handled separately. Fixes: c47ff048b99a ("bus/dpaa: add QMAN driver core routines") Cc: stable@dpdk.org Signed-off-by: Gagandeep Singh --- drivers/bus/dpaa/base/qbman/qman.c | 46 ++++++++++++++++-------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c index 301057723e..9c90ee25a6 100644 --- a/drivers/bus/dpaa/base/qbman/qman.c +++ b/drivers/bus/dpaa/base/qbman/qman.c @@ -292,10 +292,32 @@ static inline void qman_stop_dequeues_ex(struct qman_portal *p) qm_dqrr_set_maxfill(&p->p, 0); } +static inline void qm_mr_pvb_update(struct qm_portal *portal) +{ + register struct qm_mr *mr = &portal->mr; + const struct qm_mr_entry *res = qm_cl(mr->ring, mr->pi); + +#ifdef RTE_LIBRTE_DPAA_HWDEBUG + DPAA_ASSERT(mr->pmode == qm_mr_pvb); +#endif + /* when accessing 'verb', use __raw_readb() to ensure that compiler + * inlining doesn't try to optimise out "excess reads". + */ + if ((__raw_readb(&res->ern.verb) & QM_MR_VERB_VBIT) == mr->vbit) { + mr->pi = (mr->pi + 1) & (QM_MR_SIZE - 1); + if (!mr->pi) + mr->vbit ^= QM_MR_VERB_VBIT; + mr->fill++; + res = MR_INC(res); + } + dcbit_ro(res); +} + static int drain_mr_fqrni(struct qm_portal *p) { const struct qm_mr_entry *msg; loop: + qm_mr_pvb_update(p); msg = qm_mr_current(p); if (!msg) { /* @@ -317,6 +339,7 @@ static int drain_mr_fqrni(struct qm_portal *p) do { now = mfatb(); } while ((then + 10000) > now); + qm_mr_pvb_update(p); msg = qm_mr_current(p); if (!msg) return 0; @@ -479,27 +502,6 @@ static inline int qm_mr_init(struct qm_portal *portal, return 0; } -static inline void qm_mr_pvb_update(struct qm_portal *portal) -{ - register struct qm_mr *mr = &portal->mr; - const struct qm_mr_entry *res = qm_cl(mr->ring, mr->pi); - -#ifdef RTE_LIBRTE_DPAA_HWDEBUG - DPAA_ASSERT(mr->pmode == qm_mr_pvb); -#endif - /* when accessing 'verb', use __raw_readb() to ensure that compiler - * inlining doesn't try to optimise out "excess reads". - */ - if ((__raw_readb(&res->ern.verb) & QM_MR_VERB_VBIT) == mr->vbit) { - mr->pi = (mr->pi + 1) & (QM_MR_SIZE - 1); - if (!mr->pi) - mr->vbit ^= QM_MR_VERB_VBIT; - mr->fill++; - res = MR_INC(res); - } - dcbit_ro(res); -} - struct qman_portal * qman_init_portal(struct qman_portal *portal, const struct qm_portal_config *c, @@ -1794,6 +1796,8 @@ int qman_retire_fq(struct qman_fq *fq, u32 *flags) } out: FQUNLOCK(fq); + /* Draining FQRNIs, if any */ + drain_mr_fqrni(&p->p); return rval; } From patchwork Thu Aug 1 10:52:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142822 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4425545710; Thu, 1 Aug 2024 12:53:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 356404336F; Thu, 1 Aug 2024 12:53:35 +0200 (CEST) Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011019.outbound.protection.outlook.com [52.101.65.19]) by mails.dpdk.org (Postfix) with ESMTP id B4BAA432B0; Thu, 1 Aug 2024 12:53:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c1K6XUj62b+4wpn8IXeyGkp4Aa8QWoClYwPrYdblas2BLnV3bH3kjNVSpvYZwTCL9YkNmvluyfrmJ7a6iTixK+BcpRBCx48JmLxmkdSKRQ/AbIn7wJsaneAeeybFQZIYEqnZOAiyCDNvsV/xkqYky7IxQU+PyA1HsFeWX2J8PcRBIcs2urCVnIHxyTA3k3VCaoiR7aNcZxIb41xwReMcGF6NhNWk70aW5aeP1uRNywoTCIxdeqkO4nNR4Hrn9SDVKxO4kg27G25RDYzeGEvc9x0DY7/XPSpsQG/AOkyvu7yZA8ZFG2zzKqcOR5JTS54nA5POI0J8I8wmBNh3h9px6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=3Lb8EfqZZPQm/j9MCtAb8D8Yrh/1MKk2R2FaQFsqf08=; b=soeECz0KBoxfBlob0IUbCd9CakEGFR0fukyxuupPQgT0qGmCf6bFU+SFeNKVbF2wZ+Os2Ev2CvcfjlTNpT5ltjDefqSupeOjDCrD6lbpE1sPFEtAuq/kiR9tYMdscwi6TUP3fvYXmvvMnscp0bqceIdSs5vyP63F5Ad5HrSweKPxQZuf7E65wYrGJhaRgz9CiIb7jmNx/jU8N9iuhp349HSxiTc7mqLVw4heV7RCaS0P/3w9hzWY868Y75XjEN4qOpt6DkuAHvHfdyFdkvWW1Gwfk8OEp2edSnbFaIkTHxu8yIk34FaEXsuZG4Z/38Tn0O49+MZ8irwYiQ4CzC2RYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3Lb8EfqZZPQm/j9MCtAb8D8Yrh/1MKk2R2FaQFsqf08=; b=a3KFbpqrCRoWG03xyCRfQ7O/Mil3SKb6ve5kc+apMih7pjm089krGL/7EjvJLytVJSYurRetI5e11Jop+N/PZLKOK1T24qwqgUyOMf+xcqqE/acHINBKQ3vwqYOXvQeKc29Yg/VJ2NJQBBUHqzLlz9bmfESNOy7kl56y3sb3w6YZhoo0vO2tMswLYVedHb5ibCv42iRLJQTWrevu3gksN3LiD5JM9rlev7wcKOGb1ZSbiPRbZO6CfMJynuoMThi8W64butctB3fREh4RgoBF1WorxXB7ne8GQG3oufyR3Mxi1c6htIowaFgHa/08iho+aussQNCGuulE5He79HVzUw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:31 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:31 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Rohit Raj , hemant.agrawal@nxp.com, stable@dpdk.org Subject: [PATCH 02/17] net/dpaa: fix typecasting ch ID to u32 Date: Thu, 1 Aug 2024 16:22:58 +0530 Message-Id: <20240801105313.630280-3-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: ac2a31b1-c511-4844-fedb-08dcb2182e77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: xGfZ56J5hyx18dOr33GiB/E/Me9LkyFuWvVrAo+rLtM8SUnWfN7h9hP5UyUkZEWcYH7uPTQnbKmzG6H5n25yJwprNcfCScQtBGrFahw/xE4Sd3Kg2hvI112Irkb24RoizXoTumBQ0EoGZKRx3H31YcqtpK0zpiCwPp57NOqdDhER4QIi3e0fLDzpqdcHqgudwHxxIzwdMNcsbKcf3kvyRmibN4MhhA3jNG2cb2iJDotNXdpqHlAbV6yopcIZ7kbu+2Ajq1fQHy9eFCM7V07iyoWtDCVIwuBFpWTJnn5XKp05ptltAWxKcgZ+wtPH7KpcReMGvcLuKRFRY39kkvlNx9YyeQIHGq51krWZDx3IPyy4LhAwRjMMWAvvKEEnLZVBh4yfufhJIE3J6VI4MLnDYmBGmraBVg9ETEd9X6DJcsgEZxa3ZPj06hu7hPndFb4n13zLbkLl9EOyMNWIPVDA3P4RWhYTo3Hm+MWeuweywFchzxNm1SCKR5tgnnxlf+//QBjUh1B01RFIj5oo9lR7/WwpLVD/pzKKfKppspTZrY0NBaOhxE6NVs2XaLWxSUvKkPtr8lQTvNjEsEHUgDvtHA4CJuLbWOUrNmmqwWWYNrweUdQcE5k4TUgUbBXY4i9vIRkhaCJYev9KMcctZmbPLmTP9Tgpk6o2WkErdv2LXCSkFmJM2MqDQbzeVWRUntZ8L1ckCSAlswvcSHbCV1vDXy+RasJE2BacfPTenx9UB5jNUcixWqjU4qKjVBiRR/cqzs1OClpxyI//tPoYjsMFa0m4eO9hcdRKMgr5We334+qEuAcicj1CW811cRQ9PflpWuwHqERndNPmx3g7D4jRgCXc7xtwFWSJM+3IhlZrRt+QfkcoS2NFT3Br0m4FBJBCVmfCffx3p6IAm5luE3d65H+frUA0/NFFXBT9iqwrGJVCfSlZ9UBoFQgh4sTG6vUtNV6XYn63aSVFuG+QJWAbWO6pyQ4DXgprI3gd3SK8frqN0iWlX+em7LaT3bLARTlvYAlwA5lVLQ4GYY+rS+ieqnNCQjegRbjx38Sr0jKbh3EBF4AsXMDUBbT2md7dD48qlYBCi6KGhEa0yLrvWxljyXi3ltbt4KRSPrnBxfKgdRaMiD4D1vjp4laVT2nwKP3wiLITUAB5W8cwVmDwQc52wLJi5fpqSFpm1EBmeHKF01srmSq+naxFco4Kg7lmiavlMLdZu3/W5Hx0FgR4UHDOgmkCgqKKuwXPhphJ4dzfdXeikaKikJGsSHK9cIJNwHFvBS44Sjyvek8DNVEhTd5of3p4yGrNl6DAE/39roOZOqjNc4sB7bmREbFwHyKYYzVBdQysAAZkPq8G72rRQbsfmgNNAp1KuaTfPOpbNQGpCfNHCf78mgjGtRLbUmDCFJO+Na7kMdLaxUBXOzTFO1RIug== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F+sj2+O56YK6MF4J0Bf8nrES+m6+1qGoCs76q5YZfXhLBypwN0IT7fVyzhWYxxa/cnqCIjkh9CKOxQicn/bMD+HqCkP4E7OPN0BXkhll5eM2iXGoiLAb52Ud0VZLED7zGu4hyNaefjzC1/1fHCupILG/A4r9EIwkLFTdzXUJusRyJUOdhGLe42cqPngjSdunmye313eDrDAMSKO9G/la8zIGNEhpxDFBHPk9C4xLLYzphqJC8CkQfVdP7QQgUTz18fYyrAXUj5IwGpsXS0JOJm6K6fgKJGW9fC88Q/+SL4ehzphLT6H9mxMv/qw/Q27JeDTFWsPUUqJLFlukIGU298UTv0m9H7wO76CIbhkVKJXh8sFDOHjlfqAVuPisRWOA58a77N5olTQA7CCHCJ3aJb7u0x61odZwdm677X3DQGA0vQ8pDQoTQRqurWXN0bMJGZJQxfrG+4cSlSMQsMxRvazdHbfTWzB9rU59NT/cWfgEjDFN2ST2bTmJbh4YhP7nIhc5DyAOsYtrWEyyys/OA8+v7Z5p6nm9H+PybqyB3s8PlysxiLTe/jioOLwdMg5FK5tZZyIp6nu3wz5a4FjxJzfTsmG0Lhvs382WsqulZwK8xWXM7Nv7HvrX8npq52c9InEM8CIcAXnoM+JwGe2p/we49Oaodwr03+UhvOxM+9PFt2KjNawVTcAoWwO8UNy3z4xanW7+9E0lRaEubJWhgwy8fXGhgeeKA8J6j2AOfAf9LatvrWpB5qiLzBIGfmXaPsx5j6vOW9DLaDkLVPBYGfJVpLulKM39bd1mYAtxgBbnr97WyjqKrLM+Km66Ft14BmO3bAt09Rf4w6NwQfOSakp6O+a4k1envmzyrB26ET4GWmvnyMUYVL5QLRXf4FyBUASvfMINWikN/4aEWy8tzrH5q3aNaPlWDXWqRnrRmib1+8g/7V4fIFPP+FHlX+cZSCHCi2aShKYJNJy1RWwRibI+93yhapVBpN4Kyc1nTjCxksHtMbNfYF6tzfC/RaIVpSPsuNqDNK5DL8Jej1NGw6K6FTiio6AL0W4BTTwzs01+RIYFPBMsqSRrwG0L8w1sUrGJCbho/HUKtJoHNYNOmU9qnodPzJAaB9+wsPFmmCbRFDL9j5YScphXJa19cSNsGgXzrKCM9LSPoHh1UDzkKbmNSkgTdRQxirbpGwyJdcaT23Ug3o0pkiolDSZiYBcTgcvmthRwLg/yPRdWUbtaTzWU6CpMzNU0QuUCm/PA8Yco0hjN/V6wZWTcBHdetuWXxCU83+FELImlWVXSnTaCUCBICPklhy6+Cu1fwY//v3Fj2SHXQTg3s8g/WkmyaqwDjV7Pf3DJHGHzdzqYaJjuDemeExQ1g5W9wNEH3YBD3OcT3CGYEkSw15Ov4xqk7wwyPSsHOBQYpt29d9NBEWn9CZFrvz5D+0/1nyEKWWBBi0l++W7ArQdAQ88b3VJpTSx0+o7C2mstlzWft7LefeUqfJRlAB7yIhVefX73TsIVULIjB+CsfHVLgHzvJDkoei512AWdOb3t8wDZBcIVB8e8EO4bNT0U874SR0eJ3Qi46FglELXyKBEXEtJeHzStdBi5tFwwraAiMe7zD5T5UDXH0g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac2a31b1-c511-4844-fedb-08dcb2182e77 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:30.9888 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dCoEgHbwena2b25rxSHrFtpP9d9ehYQSHTxJwLXU7yJss6jrHDHPTlYpp8ZJGWIAALRLwsPFLNcOHvhdiK1pRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Rohit Raj Avoid typecasting ch_id to u32 and passing it to another API since it can corrupt other data. Instead, create new u32 variable and typecase it back to u16 after it gets updated by the API. NXP CID: 27996293 Fixes: 0c504f6950b6 ("net/dpaa: support push mode") Cc: hemant.agrawal@nxp.com Cc: stable@dpdk.org Signed-off-by: Rohit Raj --- drivers/net/dpaa/dpaa_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 060b8c678f..1a2de5240f 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -972,7 +972,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, struct fman_if *fif = dev->process_private; struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_idx]; struct qm_mcc_initfq opts = {0}; - u32 flags = 0; + u32 ch_id, flags = 0; int ret; u32 buffsz = rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM; uint32_t max_rx_pktlen; @@ -1096,7 +1096,9 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, DPAA_IF_RX_CONTEXT_STASH; /*Create a channel and associate given queue with the channel*/ - qman_alloc_pool_range((u32 *)&rxq->ch_id, 1, 1, 0); + qman_alloc_pool_range(&ch_id, 1, 1, 0); + rxq->ch_id = (u16)ch_id; + opts.we_mask = opts.we_mask | QM_INITFQ_WE_DESTWQ; opts.fqd.dest.channel = rxq->ch_id; opts.fqd.dest.wq = DPAA_IF_RX_PRIORITY; From patchwork Thu Aug 1 10:52:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142823 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 367CB45710; Thu, 1 Aug 2024 12:53:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE7164339F; Thu, 1 Aug 2024 12:53:36 +0200 (CEST) Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011005.outbound.protection.outlook.com [52.101.65.5]) by mails.dpdk.org (Postfix) with ESMTP id C627B432DC; Thu, 1 Aug 2024 12:53:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TFuQIkeRZ6C3p0/UfvsfxxvrjVYunQZbtMay1CZ9mWzRnxxO3S6lYGrHYpIaPT1bBs+Onz0sbR1eOwmFk8yF9uuA+aIxmBlhK6I53clW4HqmIaYt/Ul+KB+uO57qct+in9XYn/ASJ3KgQlE+VKkRB100gMBubruNW5rNTQqyDIroHfPKahlzCuViV9+pb/K26H+G/RwF8qZoOBriS3eChGZKe8hjZUXxiQQbJj5ouHX4bKiSQbD+BCP8eN0pngRUfuR1uFtKm2022szKX7JK0JWGk4Cjibopi/kW8WQwYKybkXmYK3TwS0jERUdLrKQ7nRn6/Qd9eqoTY/HvFXt/6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=WjGGmro/aRuvNLmTXSwdJWsHOH3VYM85bCfyXfV7lOM=; b=rUw7oXMmV+4IKHaf8q5FvvgD+sSAfTKncKZ4WE5/fcNt3PVa+uNAQ9QhhA1lMaW1lvtGYPKa4SSxszkH9Mc24EHN0E7uOHv2oWItb3LggwOKC1oKhBpKlbIG0LuJ77tmoLmN+Q6nBJfuio7AEC3pZLyPFlWrxMCgeHO82xz2/VY+zgX0bWR/+iMorP5/+rJpkOb3i7giWKbec2APjZI9xbasjRwmARUs4syeEAjVB8rGC3Rfwhz+5RdiLA/K2uY/PBt05EnAhg6sCvrJekskCXQwo99l8cIe7YwnoIaMksMuQawMSqFZv3YYT472cRmPJZPA4gtYNH5wclduMnSLgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WjGGmro/aRuvNLmTXSwdJWsHOH3VYM85bCfyXfV7lOM=; b=e8hCceLxhuU1zipYUfmYiReXwq7tP8ujJa1qja13zRhuUmoVrGPPZFrePgCauwxseTcOYiLk9C/nPWwWVTNhB2X3ZdMKIvs8GZRmjgG1F8a94lNY/K+XM6ysAH+3aO86WbBnWAKsZupxLgckOvqfjIvqc0PhLwRly7M76Om3Ekld84G3ROpUXGIiPhexVCRGHGZx77Qdvkt24WvjfHdev9wP7z/XF6EkN7/xGZvRbQ7AST4qibOTV9RerfaZiHAjPHv4KU4HkUcclX7XAMZBQOOWjq2bVf3AGsRKq+tdnVmHjfUyU7PNAoJHsjGJl7Wggki4R87OfCR0G5hrmsfYag== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:32 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:32 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, stable@dpdk.org Subject: [PATCH 03/17] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Date: Thu, 1 Aug 2024 16:22:59 +0530 Message-Id: <20240801105313.630280-4-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: a8473538-72d8-4a04-a097-08dcb2182f48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: jB7Oja0MWQzyClr9/3fe5wDqbSPGC7jyiIqDzOlYruck0rKPOS5yuHfdYVgA7IgKP4a03WXWbLQdLpzuqRUV1voEDDpJwLBizXGQ3hqtwh/sGvtpIVDMje4JIVgpXoz3HR1ylGKahx5HYaONdzzjDrwkOlkpfh72w7+PZ5pOpK1Y19VKeZdJDelVqLwWcLOeLPFE12koba28M1TL3gpmT0Z8/kGitHRGQ7E2vnSyOW+vPAYzFL0Hk7iWr6si4OW0Ed0+gPSYLY7zaIoZ4N0EmxU64rAnX1F+sG+jqvzWqsJR1UEkBBPt2d4uufjQyVXXxUAEC4YRYzllEmgnQi9V4kVP600sYPAsjUrqZ+gVypfeL7YL/lrThFtDDa362cuUyxrP2Sjbr5Eg+kuaf9xB5APktjJF8kT3rr/vLWJsfvhuiMekae4U/dvCUeLESGgubRgqQvxyaioDjYfmTQsbbA7vmM2LkI82rwSdWHUg8v+VOGXXeArOWwDx/3y/4i17cFYbm6aZ/Kc+y9GS9PC52IP+fN16B6nGtB24vtsxvb+wbyjphZAKCH0X3bdq3X190sQ5KCFHBNCwQ0QhaiSAvhM7qewK0X3J0OWNfa7tFG75hzUdEwWfflnlne5eptJMXc7A8dX8917OmPVq1uvzyTMQxl/qze89mBb+xd4AM1H5/2WFMsEj0GJPam/fwZqGg9NeiuOBXC+f4ED2kDXONV6HieYMpZbMgYoqpiYz0qLStzjmwsgBRBSYGjIo1vAgvgt3IVRQ1Wg7o78qlOA4YM6F1fZN9czePkz0M1pTsccakglG/Yl6HZCjrdGQmXaCMNfcQp36dROE+xyOKIlfIdDxhcapxWnPo0FlukeFSR6VKTdzhjpUcDGdNNp8WbDe53cQBR5vaeJ9IlF8GzxXgVF4D2vh8hpRah602V6meMsKQTpcAH0otGdeXt4yLgIuGXI9LzPcXyC2RY/t1yp3UEp4k+bik79hC6UtPJ59S47F166L9Dzb4I+M7TCV66bODnmsvQLWOMux76mm3Kuyi/1/rDh+7IXBDMWdeVNW2nPf3y7cOWTJaKw5LGdlAr0BhHGZ5yIarirzuDkwyYZkEESA6/pmp7Zx4kpxx8xnQ8n4OKogp9DYski3/HPqcBoHFksmdZYFDfZcKzndwVjan8oEQiy73ZcAxN7bLju1CtGv9ds/7HeKYOtBkAo0sJXW5I5NJ6dgKBsfUv+QdEgVHi2A+pJqaxEAIwe9g+q6YgfJX08FnqnGfXI6Wj+bCJZxa/hTcAqb6NlBZC7YAAYcicKnlniw0Y/H6953F2I2b2J1bbE5noaToO06MtmrntrPWi0iillu+Kyrv8iCOX6EspigRwN1BkMy1C8weaWw/fmM5MYq4BUlgCOx2gCK8umYtvEnH+YoHPCDAaynK8kcMg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OgPGBW5lNC+pOPiThyxroF/iTQpUc7TM2OGlJN/da6jaYE4Xk36OR0XNR/9eSW/5q0QOW4DofopXwNCi25odXtNYTpg0rW2RpygxBe3/ePKMtuMYw4H3TuYugY9nMiqs4j9sXcz6kUvTvJsLMBSeO/zxDHDCSr78W3RIPZ/GYHnNrGo3utBHO4RpoVhaFQzI1pAOtm9BneGvGQJX9r5al09+YJkJBVqPnoWlgEj0Bj9Of8QV4e9ix5GqKu9q8tnfSTRzuE6RS0W/z/5sOVAl4kcb/KjQMW7vI4NF6o6GvBA3dFmN21lJmN+IBghL5t/cdCKaqARlpjP9y+vW2k1n+6r4JYlkTn2xz0d0PqP/nONGF5bncviXT6j4VX9gppxPhDFVFdecUGoE2WSSqtreUA+0fj6O0ZYpo/BQ4YAFuneychJFGiOXUDOQ2GYijKGsByLZy8npO2pLJzEGMyfJeLjke9F+72hTAODqLjaleDDnAqQm2b2m//fBKEGLcQsO511seco6kY4T4sbBOIfsF7D4h3GTuOEw1GXtKlodxfKS1Z+utYqBozL83o6NUFttc6qrRcFi1KjMiLNuIQ8TUfOYmTBy62hmq/FEkX6WOmXog1kgfIvcXuuKPEGCT9aDK9ptgnV5T3UZCAGK6NTaGbvLLGNnNLsYuQxlslJd5LCBIAkpJz/4QPTlkzG8qpwTNZPXmiYoXIxq01GK+OSGNhCgIkYTB8GMAn6UjZm4PH6ecCjVxgmioljS/v0eZRve/dgrItnd+NiCiPip7vNYalQfBvyohEC3dXhX+4h1Y5YTSw4Tm2Nk5K0bgdxPSCr2vgYV2A36lfg8QZhM+vWgxjEzCU4Yl3R1ASigObRSK1AQ5WcfseIP9JQ5s9oDBMfN0sW+dubmCYqF2We5xfNW3S5LaaQAOToKkfuVK402DLjfexmYwiC1hidQTkue1iVJsF6mxlwVNh80wtpGtZwGE6PL7Nrrb23YBzFAXJklsfVj3pLo4svmcj9yA+WgLXxMQFt5MC9Or2T2xb0ugZxvI4m3HBPd/mqivEqwcFKlEvO3Q+pe9RgkNMSxfJsyxuFQ8JhirRrAn6886YkCn/g13DdwOseQ/VIp1eiffBNVDOY/OdXrJSKGdihYkQvbGcPayx6u4jFt+6BCmqyJ6IgexnwmA88SCRpaj/77dD1MqK/BihYmPd/ul24iYdtQd1T16Ia67ikm1iKlw4TelfL4En1lLf5GiomWI5/2TYzJGB+RMmlPGB9b0zl+M9AkDsb0fVCq+Ig9EMGplLOul4myqs1FWbxNwv4fYW54vjF7D9RublzJHs/goCZlq1i0sFMrvqYNgnR/UT+NmRaFEI7kyhN0uuXua20wwJqYacSdVVb3ZHlgMEphVIZnEwSa+3pGzJ+SpcUNXxZQKcp0E/ouI8iHyd12nJPtF2OR4X187DU7kXfPzmRNGLBABLn3oZr5yqHTfAAP8r5bNc1dfXolfTY67Kq4wNS0WMVPYyp2+m+wSmoSQjAD/vz2NOjwiEC09z1iYJ9mGump5Lvtx5tkHROGfPFOi9vhjWfBJYpjjqvZMDVxS1x3++EAvyvb6PaF05HLlCb+MLGn2nlJVO0UFw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8473538-72d8-4a04-a097-08dcb2182f48 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:32.3259 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: t6BHbvO5wFy7Kvh13f+gLcqPx7tblfMDCP4apHR6KifWgpgStn5tAs1xfOfSefdqZX585WIPvqBYVnPZJQDukA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 No need to classify interface separately for 1G and 10G Fixes: e0718bb2ca95 ("bus/dpaa: add virtual storage profile port init") Cc: stable@dpdk.org Signed-off-by: Hemant Agrawal --- drivers/bus/dpaa/base/fman/fman.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 41195eb0a7..beeb03dbf2 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -153,7 +153,7 @@ static void fman_if_vsp_init(struct __fman_if *__if) size_t lenp; const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; - if (__if->__if.mac_type == fman_mac_1g) { + if (__if->__if.mac_idx <= 8) { for_each_compatible_node(dev, NULL, "fsl,fman-port-1g-rx-extended-args") { prop = of_get_property(dev, "cell-index", &lenp); @@ -176,7 +176,32 @@ static void fman_if_vsp_init(struct __fman_if *__if) } } } - } else if (__if->__if.mac_type == fman_mac_10g) { + + for_each_compatible_node(dev, NULL, + "fsl,fman-port-op-extended-args") { + prop = of_get_property(dev, "cell-index", &lenp); + + if (prop) { + cell_index = of_read_number(&prop[0], + lenp / sizeof(phandle)); + + if (cell_index == __if->__if.mac_idx) { + prop = of_get_property(dev, + "vsp-window", + &lenp); + + if (prop) { + __if->__if.num_profiles = + of_read_number(&prop[0], + 1); + __if->__if.base_profile_id = + of_read_number(&prop[1], + 1); + } + } + } + } + } else { for_each_compatible_node(dev, NULL, "fsl,fman-port-10g-rx-extended-args") { prop = of_get_property(dev, "cell-index", &lenp); From patchwork Thu Aug 1 10:53:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142824 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DF45145710; Thu, 1 Aug 2024 12:54:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2050B433AE; Thu, 1 Aug 2024 12:53:38 +0200 (CEST) Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011018.outbound.protection.outlook.com [52.101.65.18]) by mails.dpdk.org (Postfix) with ESMTP id 8619C43371 for ; Thu, 1 Aug 2024 12:53:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gHPKFqXMNpMitrsQSjLVhqh2G51gtYxIeOCOjENq3+TLByq721+4xJGkk/rqCT1ghzS6qc74Cp55vQR61JegzoID0uHfrkdm3Y/RI7oPeqteQM0+POUX1F1SHBIA4X3H4x7d32lQCAmuXnKwy/fCh1KCV5ZgdVJx0wycq47NEmFT9hxx7ZeUOdAhGExcdKMDR1TGB7+I9LUDDEUflFvhyyen++wE6bBlyysi8z47ZtBxzIC04N+GT5aOyFZP95T6XB9qYWm+1kvwgovEFF45sTzOZJUoEZBMxJtZbUhpk6JABbBx9LuJQ8MlGpJ0pmznR4LNEgFL6qYOoeAw6DMPYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=iOmAsUlJpHkZN1+6/zUiCie5ZII/DoOIJ09ObKD9G8s=; b=riNqtYDl+0gcZil318BuF7WUfXcN1hCKP3fqSYqoSucvxh+Pwlgs4iesfmPh8aj0Ap/NfFK7AJ4MtuvW0uaPW85E/aXKNphe7B3GAko6wz7IX9oTempoPmQqF9aWHbv/xHCn84SJqhNefxNM5hv4BynlDCB6iDi9+KFIGS+zVrvt4JidVp75/u0b7zndSUyhdG2ZTif8m2+eOz0SAon0TQJr4tWuOavnB3v7fmksLzLzZ0lROlLsyB8ywbf8jMXDFWnjMOdQ9h8fT7b0yeuJc6XiGZQnaIX/87kET+DLhyn7KBo9jDK723Rx4IZLbCH1BQDZNoydc00AuKR1ysg7HA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iOmAsUlJpHkZN1+6/zUiCie5ZII/DoOIJ09ObKD9G8s=; b=TZUZUbsOZbPUZ08O8GA8rmru70fbkxECrIiKbMJ5gWKJRCzG6KFZDqhB+iTv9voUDKcq1evs32G/OOotN/zgTYSxVOS0XuPXKaWZe0bvL4Ead4aA6eWt2KaW0zVuwx/s94bAYNeCyE8PNCsT8FWktZ3aH9UNxlb1AFXa+Fm8cXocXicJPM2gfWrkdZ6BoemDcRlamfFC2pykwY1/BVMMsLwwhl1QOXxGVie9D+7Gzkd3vXXnOPyPTBoq09ZQ9G/sWRXt0bth/igt1vVccAm+SJ3uwcGk2yL1uzcfeBKEKQ793aLN3AiMK8ldxPYOyu4E2c8oB8P9RKKo9xDjIundfg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:33 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:33 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Gagandeep Singh Subject: [PATCH 04/17] bus/dpaa: add port buffer manager stats Date: Thu, 1 Aug 2024 16:23:00 +0530 Message-Id: <20240801105313.630280-5-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: c5e8d204-2062-434e-e772-08dcb2183013 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: Qxpw1wd4Y2flRrPccBa3d0NXoflxJPdXkZJavQ+SuHqPyq8Ix8AJ+jSHg4HayD6ZllYCq1q6nSL0odRgDo7oE99MqRGemGCLhceSYDTaNudbkQW7HnDWkcagtaTTCcsDR0u8ZAbpYyOu/XWHIfHs5JYR9liXy6BJ3croDEiI3+9mSKKIizk0HlIy+xhB+F6R4SOdANG9/Rwyvw/aEvLLqraobvVM9gH8xdMGS9Vj57ubrn3nHk59v5qXEuSp/XmJdcNZjz8AFgTOMtjjrRz3ErRqrXUVPFbnNf5SbgsHs78ZOemiBddeZvlernOPiifd2opGqUwzakz9V+6jOzIh3UpzAj1mGgdxOLBObT1wBkWDQuDGnyOd51swqy6dZf+k01b5FIdcF9IiOuLkUt5ccsyXr8byoZvq9PjjatpE8kOg4grQCgd1qYyDLcR0Afeyaq6Z75+2i+bDbfDyDxHI8dWsHivNCUPZ342Iachm9XIeCkpaCMmDUe6pUWVt9UJjg0Qv6MbaeWUXekATOrJl4MoP954EfAqGyhH3fpG7X9f9onr9SPTooKMHRpfTCGEbXLqab8DEL0HYp5DviwcDmFbNKZ4pPZ4/i0KoxJWmlinZ47S+9NqOTXWcGSjFY1/7n0cvo05eaqQJgIc4Aq24TZZIWr9ufL99nS33tog2PsthW4sfr6Xi4FznYK4D2Gf0cWhIPZP1I55va6Wg7FhK/bVbWVOkPbwqJNDu2DE/HhYR90kdHeBw8/ZM39KnZ0kuDABHzXFkCmeOfE2JFlPd137U3xgdtjml+jGRCZD4Zr5J70cQMWuiSSTThnxVTqGEWwtek4j1aQCteH3URW+mMe4mkuhRWfkaoXSFU8xX5W6LNuBG6GfJ3eesn6mWHkJzRMM3IpQbokjwmXOyBmaRnK1tlp2fVvAjnoDMTEJq0zBzdcVOiQSnRNLEv2+3f3+U1XQC/71LFEYBNYDJeMGdoo5eAwHAdGRHgltWWp2S72M3UTmNzP6pB+uhpyGpMIxdGy23yHQErD4RtkzyiBUiveRBz6LmPPVbhxJjjMr6RSzjr5DhaZcxLNc9ocIEBTZeHFfOSFlCsdWQcn8YgSYPEtsakCDLY7c4YKYfKEPNtSuAXYfJVu8lEeLROh0eThV6C+p/8vvtEqCBgziOuu+aCkR5iTZNabQau2j28uSuXfp/gNKYToR6Avl+GTeLzkdpnhnKJ4anF28xf4TTpsF/VLCJEyypFuBqRHUlvKZS0cZCYfMPAcbRhuxXUjSHASCvTFltsPKH22xfgYDV016hzei0P6APUdG2UYjDsmR6ky6SdUqFD3820LYK2fFFob7K5PVHGob0PNEN7BsMAima9g5fSHC7hAw3RZrk/0lOy4iVCjve6GgSfchM8+TVNneNoG6qChs8d3qimT40rQtJTg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o7kVqckHkJBlxcYGeLs15SujXnvcKvrTzexFoWgPXR+hSOkpD4gsw8P6+vHi6K1LOXnxDwk8lqrXDWI68P/HDIa+ZfJ/ss8GhJkHXfpylJfY4M0m6Uou/nkSl/MH7rfjclLHfT2XcvaUHSteem7Ivy7fTJSpg12FpupVkvH8vBd/eQezW98cG69NmqPIZ5WOPLFoOtiv7WKRqL08vOvX7GomurLhdz3PHok+MEEw9CJbeFDMt8R086iTMJ/10O64l0vbldfsHtk3CCZQlJkMrGcFcmOwSnbVM21BufoPZQKUKS5zc1NHCMes8yfWs6sdjt5xqlv8VsBLc9+2fBYyvZ964ky8ykm4/i4uOJSNfFr1UudlBBmKSj6KAwmHWYrK7wF0v00m8xQW25mCSUqoKr8eBxk7Z4uidDy8vRPBA0PgoV8oAKbUNHrLxmBOjX0O7RavGLmx6sPp3WrWNDYm8tVGefevaqleRYUrnPMSPXB3sD25iDyTF38LdTaa/y5zKKtSDVWfvDUlYgo1ILnDG6qb4CgbFvJLVggMfAyKNDM3Hu8uIx0kidmA8wO7yKFG3lPnbkru4vnr5Bdepm0I9CKnMzAMtNzb653nscsOm7/SJuokQpA++Lnc2nco+XmVpzf45eZqZ/UW4MkVscTjfWoL5gUfgbNXFzFe100JSQM5NVdeafmbxvq8G140Fd1HyYgP9DBSB8Tai0/vu8U8oU5E99RDcV1iCPldEGm0nHodJ8TLYYr0qtyX5PAGGmrIBRzyHH7MzYbTrYthirwTFlh1h9gIG6oPaVq7dSj3Hn51WhK6pQ4WnnbT3BUKNQdfuLMlw71z48wQsQ3yBycOaCXJUxpnxwdMsFraOxbhCRKkzdWpx0DvzyBvHoZC1GRSnu5eNtahAH38g976DjKa6H4H8ken8lvQ0EgEWicm5QYWgRVEsnxYYjxdPw7uvTcyEvvfzwJmI5efowhjPybDcj9aavzG9TZTeFqROWHxgIFwezQAJY0tB+HlD637fcfv1L6zZ2E7zBxl9+SYisDdPmjZN8qme7DSfbMfTlyiY9CNmcjjk+hJ0OXlnpcBxwrLgChTEvIFuvTTY87y9Hp/praWYE4MjnxKaSmPgxexic6rFpfDZAzUSlxCOtIG05vMCDc/Epqs47lErH/OeFulL4qftxkcam6KrhV5EyRsBkguxbECLnLCykUwlTcPa/D+VSj/jqPZoqoTZWHjt+ngxmZiwBWBqdrEfrfGx8ZhsCMQrJ+H1t+fPEp1mJxf6TZbvD7pb+53etBAQg7s4OK8gBBQtMzaYbRMCSwP5PrV1788xm5EQgsk48bWzg/ydncwhI6KrkyzNHVt4LUjcPQok4+/jarED/C09n+N8ZRD5oMvVrvFTr12NmNghAxLoFd4+LLGdPKDpC1MoCOfhjGrg+nrNwVckRfrlH+1IbT8qV0x+vWWTTbUQqGc50CB9f2Ex/D1esP8QnbAhDESBnX68IsiPGI002XUeg6rjTFLLdR1ueuUwdLsn8krEm5Z6DOYpDMMk8eXY6wcjpVUtZygUX3vxXINeIYo92rcHViNEyBQEwPxTbKDBrg2PbiUKQ6n+R8w/PRIJhdcDZtyTN6vRw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5e8d204-2062-434e-e772-08dcb2183013 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:33.8157 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0i2ThOqm0xhxzwEKNj6eWKluIWgiDS4o1OhataPPgEvcgAZLkzIdzfQqHcPmACu7SUHPbDUa/w4i1e+4DTl9IQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 Add BMI statistics and improving the existing extended statistics Signed-off-by: Hemant Agrawal Signed-off-by: Gagandeep Singh --- drivers/bus/dpaa/base/fman/fman_hw.c | 65 +++++++++++++++++++++++++++- drivers/bus/dpaa/include/fman.h | 4 +- drivers/bus/dpaa/include/fsl_fman.h | 12 +++++ drivers/bus/dpaa/version.map | 4 ++ drivers/net/dpaa/dpaa_ethdev.c | 46 +++++++++++++++++--- drivers/net/dpaa/dpaa_ethdev.h | 12 +++++ 6 files changed, 134 insertions(+), 9 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index 24a99f7235..27b39a4975 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -244,8 +244,8 @@ fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n) uint64_t base_offset = offsetof(struct memac_regs, reoct_l); for (i = 0; i < n; i++) - value[i] = (((u64)in_be32((char *)regs + base_offset + 8 * i) | - (u64)in_be32((char *)regs + base_offset + + value[i] = ((u64)in_be32((char *)regs + base_offset + 8 * i) | + ((u64)in_be32((char *)regs + base_offset + 8 * i + 4)) << 32); } @@ -266,6 +266,67 @@ fman_if_stats_reset(struct fman_if *p) ; } +void +fman_if_bmi_stats_enable(struct fman_if *p) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + uint32_t tmp; + + tmp = in_be32(®s->fmbm_rstc); + + tmp |= FMAN_BMI_COUNTERS_EN; + + out_be32(®s->fmbm_rstc, tmp); +} + +void +fman_if_bmi_stats_disable(struct fman_if *p) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + uint32_t tmp; + + tmp = in_be32(®s->fmbm_rstc); + + tmp &= ~FMAN_BMI_COUNTERS_EN; + + out_be32(®s->fmbm_rstc, tmp); +} + +void +fman_if_bmi_stats_get_all(struct fman_if *p, uint64_t *value) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + int i = 0; + + value[i++] = (u32)in_be32(®s->fmbm_rfrc); + value[i++] = (u32)in_be32(®s->fmbm_rfbc); + value[i++] = (u32)in_be32(®s->fmbm_rlfc); + value[i++] = (u32)in_be32(®s->fmbm_rffc); + value[i++] = (u32)in_be32(®s->fmbm_rfdc); + value[i++] = (u32)in_be32(®s->fmbm_rfldec); + value[i++] = (u32)in_be32(®s->fmbm_rodc); + value[i++] = (u32)in_be32(®s->fmbm_rbdc); +} + +void +fman_if_bmi_stats_reset(struct fman_if *p) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + + out_be32(®s->fmbm_rfrc, 0); + out_be32(®s->fmbm_rfbc, 0); + out_be32(®s->fmbm_rlfc, 0); + out_be32(®s->fmbm_rffc, 0); + out_be32(®s->fmbm_rfdc, 0); + out_be32(®s->fmbm_rfldec, 0); + out_be32(®s->fmbm_rodc, 0); + out_be32(®s->fmbm_rbdc, 0); +} + void fman_if_promiscuous_enable(struct fman_if *p) { diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 3a6dd555a7..60681068ea 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -56,6 +56,8 @@ #define FMAN_PORT_BMI_FIFO_UNITS 0x100 #define FMAN_PORT_IC_OFFSET_UNITS 0x10 +#define FMAN_BMI_COUNTERS_EN 0x80000000 + #define FMAN_ENABLE_BPOOL_DEPLETION 0xF00000F0 #define HASH_CTRL_MCAST_EN 0x00000100 @@ -260,7 +262,7 @@ struct rx_bmi_regs { /**< Buffer Manager pool Information-*/ uint32_t fmbm_acnt[FMAN_PORT_MAX_EXT_POOLS_NUM]; /**< Allocate Counter-*/ - uint32_t reserved0130[8]; + uint32_t reserved0120[16]; /**< 0x130/0x140 - 0x15F reserved -*/ uint32_t fmbm_rcgm[FMAN_PORT_CG_MAP_NUM]; /**< Congestion Group Map*/ diff --git a/drivers/bus/dpaa/include/fsl_fman.h b/drivers/bus/dpaa/include/fsl_fman.h index 20690f8329..5a9750ad0c 100644 --- a/drivers/bus/dpaa/include/fsl_fman.h +++ b/drivers/bus/dpaa/include/fsl_fman.h @@ -60,6 +60,18 @@ void fman_if_stats_reset(struct fman_if *p); __rte_internal void fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n); +__rte_internal +void fman_if_bmi_stats_enable(struct fman_if *p); + +__rte_internal +void fman_if_bmi_stats_disable(struct fman_if *p); + +__rte_internal +void fman_if_bmi_stats_get_all(struct fman_if *p, uint64_t *value); + +__rte_internal +void fman_if_bmi_stats_reset(struct fman_if *p); + /* Set ignore pause option for a specific interface */ void fman_if_set_rx_ignore_pause_frames(struct fman_if *p, bool enable); diff --git a/drivers/bus/dpaa/version.map b/drivers/bus/dpaa/version.map index 3f547f75cf..a17d57632e 100644 --- a/drivers/bus/dpaa/version.map +++ b/drivers/bus/dpaa/version.map @@ -24,6 +24,10 @@ INTERNAL { fman_dealloc_bufs_mask_hi; fman_dealloc_bufs_mask_lo; fman_if_add_mac_addr; + fman_if_bmi_stats_enable; + fman_if_bmi_stats_disable; + fman_if_bmi_stats_get_all; + fman_if_bmi_stats_reset; fman_if_clear_mac_addr; fman_if_disable_rx; fman_if_discard_rx_errors; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 1a2de5240f..90b34e42f2 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -131,6 +131,22 @@ static const struct rte_dpaa_xstats_name_off dpaa_xstats_strings[] = { offsetof(struct dpaa_if_stats, tvlan)}, {"rx_undersized", offsetof(struct dpaa_if_stats, tund)}, + {"rx_frame_counter", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfrc)}, + {"rx_bad_frames_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfbc)}, + {"rx_large_frames_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rlfc)}, + {"rx_filter_frames_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rffc)}, + {"rx_frame_discrad_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfdc)}, + {"rx_frame_list_dma_err_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfldec)}, + {"rx_out_of_buffer_discard ", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rodc)}, + {"rx_buf_diallocate", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rbdc)}, }; static struct rte_dpaa_driver rte_dpaa_pmd; @@ -430,6 +446,7 @@ static void dpaa_interrupt_handler(void *param) static int dpaa_eth_dev_start(struct rte_eth_dev *dev) { struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct fman_if *fif = dev->process_private; uint16_t i; PMD_INIT_FUNC_TRACE(); @@ -443,7 +460,9 @@ static int dpaa_eth_dev_start(struct rte_eth_dev *dev) else dev->tx_pkt_burst = dpaa_eth_queue_tx; - fman_if_enable_rx(dev->process_private); + fman_if_bmi_stats_enable(fif); + fman_if_bmi_stats_reset(fif); + fman_if_enable_rx(fif); for (i = 0; i < dev->data->nb_rx_queues; i++) dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; @@ -461,8 +480,10 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); dev->data->dev_started = 0; - if (!fif->is_shared_mac) + if (!fif->is_shared_mac) { + fman_if_bmi_stats_disable(fif); fman_if_disable_rx(fif); + } dev->tx_pkt_burst = dpaa_eth_tx_drop_all; for (i = 0; i < dev->data->nb_rx_queues; i++) @@ -769,6 +790,7 @@ static int dpaa_eth_stats_reset(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); fman_if_stats_reset(dev->process_private); + fman_if_bmi_stats_reset(dev->process_private); return 0; } @@ -777,8 +799,9 @@ static int dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, unsigned int n) { - unsigned int i = 0, num = RTE_DIM(dpaa_xstats_strings); + unsigned int i = 0, j, num = RTE_DIM(dpaa_xstats_strings); uint64_t values[sizeof(struct dpaa_if_stats) / 8]; + unsigned int bmi_count = sizeof(struct dpaa_if_rx_bmi_stats) / 4; if (n < num) return num; @@ -789,10 +812,16 @@ dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, fman_if_stats_get_all(dev->process_private, values, sizeof(struct dpaa_if_stats) / 8); - for (i = 0; i < num; i++) { + for (i = 0; i < num - (bmi_count - 1); i++) { xstats[i].id = i; xstats[i].value = values[dpaa_xstats_strings[i].offset / 8]; } + fman_if_bmi_stats_get_all(dev->process_private, values); + for (j = 0; i < num; i++, j++) { + xstats[i].id = i; + xstats[i].value = values[j]; + } + return i; } @@ -819,8 +848,9 @@ static int dpaa_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, uint64_t *values, unsigned int n) { - unsigned int i, stat_cnt = RTE_DIM(dpaa_xstats_strings); + unsigned int i, j, stat_cnt = RTE_DIM(dpaa_xstats_strings); uint64_t values_copy[sizeof(struct dpaa_if_stats) / 8]; + unsigned int bmi_count = sizeof(struct dpaa_if_rx_bmi_stats) / 4; if (!ids) { if (n < stat_cnt) @@ -832,10 +862,14 @@ dpaa_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, fman_if_stats_get_all(dev->process_private, values_copy, sizeof(struct dpaa_if_stats) / 8); - for (i = 0; i < stat_cnt; i++) + for (i = 0; i < stat_cnt - (bmi_count - 1); i++) values[i] = values_copy[dpaa_xstats_strings[i].offset / 8]; + fman_if_bmi_stats_get_all(dev->process_private, values); + for (j = 0; i < stat_cnt; i++, j++) + values[i] = values_copy[j]; + return stat_cnt; } diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index b6c61b8b6b..261a5a3ca7 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -212,6 +212,18 @@ dpaa_rx_cb_atomic(void *event, const struct qm_dqrr_entry *dqrr, void **bufs); +struct dpaa_if_rx_bmi_stats { + uint32_t fmbm_rstc; /**< Rx Statistics Counters*/ + uint32_t fmbm_rfrc; /**< Rx Frame Counter*/ + uint32_t fmbm_rfbc; /**< Rx Bad Frames Counter*/ + uint32_t fmbm_rlfc; /**< Rx Large Frames Counter*/ + uint32_t fmbm_rffc; /**< Rx Filter Frames Counter*/ + uint32_t fmbm_rfdc; /**< Rx Frame Discard Counter*/ + uint32_t fmbm_rfldec; /**< Rx Frames List DMA Error Counter*/ + uint32_t fmbm_rodc; /**< Rx Out of Buffers Discard nntr*/ + uint32_t fmbm_rbdc; /**< Rx Buffers Deallocate Counter*/ +}; + /* PMD related logs */ extern int dpaa_logtype_pmd; #define RTE_LOGTYPE_DPAA_PMD dpaa_logtype_pmd From patchwork Thu Aug 1 10:53:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142825 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E6D5C45710; Thu, 1 Aug 2024 12:54:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 463E6433A5; Thu, 1 Aug 2024 12:53:39 +0200 (CEST) Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011025.outbound.protection.outlook.com [52.101.65.25]) by mails.dpdk.org (Postfix) with ESMTP id 0D7C4433A4 for ; Thu, 1 Aug 2024 12:53:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a7iPiafPbk2GEmidt2ztSHGKu/djjz1/B3U0sk9LJGl3pIal9XmmwsKh9a4zeONiKjPis4ttJxTTjX8Dy2+BncXXztoaVHJIBtuIrqB+kkVt+8msywE3xO5qajWZc6lMMfFGEQmV16c227ElCQBy1fLauecicJOks03xHoiF+RBXlfguwntI5gTlmvBDDIlQ1oD0B/seZSBUEtbnqIs5ZsSlhVKPj6xCdaZn0dOZcGJ0/7aOBTiBTcuEgvco6sdOQwGoT04lfPdIUtCOTNryLSp5HJhnOm+Dt2gRkPLVngZJYJ+XlvLuiKZ3/ckl3TIfmx9F8HBVlZEA1hjIpSUHwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/GO86gKT/3toxGxo54TpeNb/URjZ8J6EZlEB6PiMPSY=; b=Kidtsx0RNoYzEzDl6rlUGsh6Bl0UHx/xBHG7c2K5tzdxc3TB7XQSdYkds1cFWzMnjKtM5fEJHbqQfPdgiJ2izBu6YyF8valO9cHm8nhyGyVcqnyAB6+wxRrognPeckvRtoH/Y8mU7pLYjKZEgEh5XHESAVSjPTqs9Md9mvImtjaUepjQUlaqcjHenT1Xw8YTC5K+Bscy2V1f5MAA7Mqx6qhQLz12EdKJRelKGa8TuL2Ffov3cQFc0JiaWtCVZLqFH5yzhO4HqA96aLDvhnaxAYJ3eqFmEt93TxaPt9QkNvS2vawslj8z2KSm1pJiQ7nfacHTm1FEMVW9YfF5Hcj/0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/GO86gKT/3toxGxo54TpeNb/URjZ8J6EZlEB6PiMPSY=; b=LiSMlAkQPGkjZcxrZQuvY0pHItighMpkkZz7S9YUCt7FUtYoRSOcdMN3P9wGU58T6oxZk9lB6WXrT7LHhzX3V5yStCxOntuRg6baI6UkmYU8YYDg976rYFMvM9XJfmFjHyaOTERr7qKQHlQgE0uilxRkMpRaHFJtvvNNB96toQ4r9wEfcI+VSaxhTEejiUA3BO2hPOof6etUlfF5kxTgrgSbJc1pwnNzpecQZDn/j3lIrR+B247blLWoueQE9hkuSJV9siXuhHExU/YjKWrjM8EtZDl4aZ4MJg6vI5zLK5MjwYO9H3MWsSJmrUHU1DOp9jA3rkVszW2Aq6rV23PMpw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:35 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:35 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Vanshika Shukla Subject: [PATCH 05/17] net/dpaa: support Tx confirmation to enable PTP Date: Thu, 1 Aug 2024 16:23:01 +0530 Message-Id: <20240801105313.630280-6-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fb82040-5c75-4d56-274e-08dcb21830f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: er4SGo62bGpj8FFceHvXlycs778Q1oj3HzGiMeUjPnY6THgb+H3w11N/Jug97NVmEqRbrvQ+3BTtLaHr00V0/naEnbsuxkkQgRP4D/fGi0xa+B+Z9YhMb0dNZ64n+413lR3xiHJXl5O9EQF1uHAnZAHgYwQ/m2/W8MJ3hKEaMxeyCJNvDj89QhkZeWCg8CE5E+qZyErUCcYGcmP1DPtq6lylBYK/Kdlu/alnIrUcjOiLE4ruOLaRr5AIgkoOguJZvBJ5HnxjY9uyWWzjTfJOrDie9CXBgDCjWlELPVvrTbxAzdMRS1pWFncxM/GsbvI4dp5yBtyyMoIpTrjkfad321tojXqCSCkWARL78w60nMBct+hEqKAyJ3iOaAaqoy9dZ/xP8lYDZtcHUjsbaPIEGszxaUVRkAAgqBdXTagXji0CJmf+pjirgrOwSu74k+bk84U+qh4+4pBTT3npTSMlmyxbzA0NE3yRrPOIxrevzV76EgGOV9hD3ZAlZl29Q8KnvLa/w1Fu9oZmrf2E5Ih2r54wfiR2F6/v/HdJd1/lg+aDuF0YCtxJc8/5l4bVRfA7V/IxJYrnHmZQW2y7dwbTHNjjmqqO/0NI5clctvRg35veuA42zzg+lnix+BZ5JNW7FA+tqmFUeKbtRq7onVI6BO9ZLOQ0KQmL+jeySJ5dUuvRIDQrw/52nrKNMQ2nLOq13tu1Sey3ha51+zQ2u4kKDYcYUeSROxmRPvK5gV4mv6SsmwjV5TB+NJ6hkemqfFYfdrBaZiWEeLWeimiEMeEulpYdWPRRT4CL3a1fVQD2KlF9deHKjSX7/6wIhHdpAfJDHZIo3zMk15KRBEhtfdhl4fyw9vV0KopIQiO5lOTCD3VEElV8LqIscIYKMzGS8cGqcoIGDhb2rtqipqob92Ja2mO9nscFyUunNpblCICRV0JBxVKyTmWfmJxTIsIPfXXGJ6mY7fnUzUwNBjMszVE3W8kK9MDAHnogqVadf+t48X7MTeVosU45n8+My0oG4Hmnp0ERMDAaflnF51al1hSZ2fHs0GFlJ1+f1nVm8YBc5kVIh0VdW6AMT5mhmfqVfbYBT8OaWyaywdHYjqy6LEez/i2dGXJ9xhG6QMDdBdYltmUpjIDQkZw/NRvFqWK5LN+zFPs0984qPutxKGkfglt8hTOfE9XR+I3RT+eEAskdPpV++HgGeKtNi54OLFoPanbQBpuGi8ic6F7HvQlDtzAKxKdAB0YdQEafhxItk6nbQLzPpk1g90n8v3OfVl2ci6cupeiBui0RQTr9ZhRIIrSntri/63R7FRjC3xl/MFILQufbD0jWXyeVa+iIwZKjyYN7XoWIbBIVkB6p7IsavnVMax8CJKyDwQJ57XfMGJuqgDH7gBHn6/jsrd64XBYmA9bpb3kCmRXua5YVjnJW//dWNw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r8I52CIaOxE09EpfQfsRtYuPvKy4ooQ+XDypMr2iQvrbr6S2GruWauscPKlmmG5m+oM+o6D9z0SgQAQvw3FVMry3aled897dPNglqEHo03zh+vdbqaBxtX+CqHOWk62paNnjgiFhFjaDuNxKEaaGMVDmX56Pzj+STJaXp+mmuGs81ijphIRlUdDQWQF2RdLComj4GBilgR+V2QRgs0oGwNKFVk8hwJx97Y5qwC4C6AvhU4Zj3y+nosIKvXH0M3Gahn7orWfRI9xOSr3vf1xo7X8gYHbzLLHEPWPq0payhtczOLXwFpPHGFfgUSRXUfA7XspxWNdnEfl1tVUrOSEdekFFcVO/6EExId7hTkwnYncY5k0z/H4veDLQ/9stsYSlUZwn2VuOLzEegBstDWw4Mi5hMhP8AQhXPhPICVs4Spvvp52ATvfn8mEniok/LFuLLcQdz5kVFBwyZ+OJlcxRN9GfJ+kQAsTiNCdTFUeZm689Hbrp2hekDlEmg8JwBJ85B7CRSlhr5rYrRWO3BEFEFya3NdRwKiyYN/A5x3RUupUShZjOSUA+TzDDkxfbj9UpeubqijBG92PvscQvh04J8WNaB9nwdpRiiqsMawHNXUIVTzQV45ylw7huZUPDxj2clc7Ks7Zys/j1JEBPrgzrqNVIw8/zTyddbhI4ZonOjnADLDGinMoxrJtnFJCc+2ye3iTAx4E645vhowTsxXtmZAFu2oerJK/P/p8P6QBUnEd3XvtMjUa6VZq6M8g7a1nTuP8ZF3sk/djgYWpgkQTnX4mLG44RrJHP1olxlhfLb5Dye6Y20dWQ2zk/KJzi5WJzyHTZXjWFnaMzS+Zbr8aKdy7tdo6h8uc9v+H9a4oepEwRPYaEjP6UsaEmwnxbmB20d4MFq6NX/STtqqzKOFcalH7JLhq364fTfhH9p/QKoTqVCiFPOJ5uY6TgoNcSeZ4/5z8PsNJoHIXhJf1Gvi+L1PLBj7Pu9dIMwwGB6aHfWELBzBgBs4OUQE+DvcrwZuz0Qyp/YxNr5fVu0nV9Zb5Gj8DVKttWkHLt31ARuNX6kkAkT79GWyPbgYji7SRkPZvDdgjTh7RAmRU4gcmc043MndbINNahHU5jMoRUtweFdLO6YkmoVYvIDd3XuABAZBb0O3ZjSBYChvfp2JVllLL1mlzaRwpQVZru30F0qwmffMn4OvBXVj9yqVhwwwE0UV/hHWo/lrMtICVepcFglYplmjSZZ8rJUri5+U0aaffYuPswcq9lo9VgQ8+UId3eBtVuhdJdxFGDoIM1aRZ9JhPWyyWMmm1JejuDXRtufSmOwnNjtgts7TVY2o72QcbC8aXtt4yTWYgqURRNgU4iJumKjDsqNZaCgNI8n35uPVbgGk9Xyqx1MZub7VdBDoJ8e60UZmO6XsIHqkJrvrZuJsOObe1j9NtCfcXnHAnMD0VNLc4X8y/fn2+GKgbS7RBGnwnH69kz7eI3zEvhZrGvN6KXViY823IGKBExb4BYAK+8iuvnRvV0DvsSWvPK9rIiSwdTSUgwnwdpxSewV1kFYlvkBQERlBWLmikL+wwCSIIQ+h5TqFpac0pBi5Hog5njaJj6u/CYOcy/1Z/kxp8Jyh22wQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8fb82040-5c75-4d56-274e-08dcb21830f6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:35.1990 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: B0D2JJKMOJVACYR6XXkhDY+VPheA6glO4Q6irG93G0QsTLbqv8mATO7S9q1NLv3/E5CCCqK3P/8V3tAGPrMnDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Vanshika Shukla TX confirmation provides dedicated confirmation queues for transmitted packets. These queues are used by software to get the status and release transmitted packets buffers. Signed-off-by: Vanshika Shukla Acked-by: Hemant Agrawal --- drivers/net/dpaa/dpaa_ethdev.c | 45 ++++++++++++++++++++++------- drivers/net/dpaa/dpaa_ethdev.h | 3 +- drivers/net/dpaa/dpaa_rxtx.c | 52 ++++++++++++++++++++++++++++++++++ drivers/net/dpaa/dpaa_rxtx.h | 2 ++ 4 files changed, 90 insertions(+), 12 deletions(-) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 90b34e42f2..9ffb8c578c 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1826,9 +1826,15 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, opts.fqd.dest.wq = DPAA_IF_TX_PRIORITY; opts.fqd.fq_ctrl = QM_FQCTRL_PREFERINCACHE; opts.fqd.context_b = 0; +#if defined(RTE_LIBRTE_IEEE1588) + opts.fqd.context_a.lo = 0; + opts.fqd.context_a.hi = fman_dealloc_bufs_mask_hi; +#else /* no tx-confirmation */ - opts.fqd.context_a.hi = 0x80000000 | fman_dealloc_bufs_mask_hi; opts.fqd.context_a.lo = 0 | fman_dealloc_bufs_mask_lo; + opts.fqd.context_a.hi = 0x80000000 | fman_dealloc_bufs_mask_hi; +#endif + if (fman_ip_rev >= FMAN_V3) { /* Set B0V bit in contextA to set ASPID to 0 */ opts.fqd.context_a.hi |= 0x04000000; @@ -1861,9 +1867,11 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, return ret; } -#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER -/* Initialise a DEBUG FQ ([rt]x_error, rx_default). */ -static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid) +#if defined(RTE_LIBRTE_DPAA_DEBUG_DRIVER) || defined(RTE_LIBRTE_IEEE1588) +/* Initialise a DEBUG FQ ([rt]x_error, rx_default) and DPAA TX CONFIRM queue + * to support PTP + */ +static int dpaa_def_queue_init(struct qman_fq *fq, uint32_t fqid) { struct qm_mcc_initfq opts = {0}; int ret; @@ -1872,15 +1880,15 @@ static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid) ret = qman_reserve_fqid(fqid); if (ret) { - DPAA_PMD_ERR("Reserve debug fqid %d failed with ret: %d", + DPAA_PMD_ERR("Reserve fqid %d failed with ret: %d", fqid, ret); return -EINVAL; } /* "map" this Rx FQ to one of the interfaces Tx FQID */ - DPAA_PMD_DEBUG("Creating debug fq %p, fqid %d", fq, fqid); + DPAA_PMD_DEBUG("Creating fq %p, fqid %d", fq, fqid); ret = qman_create_fq(fqid, QMAN_FQ_FLAG_NO_ENQUEUE, fq); if (ret) { - DPAA_PMD_ERR("create debug fqid %d failed with ret: %d", + DPAA_PMD_ERR("create fqid %d failed with ret: %d", fqid, ret); return ret; } @@ -1888,7 +1896,7 @@ static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid) opts.fqd.dest.wq = DPAA_IF_DEBUG_PRIORITY; ret = qman_init_fq(fq, 0, &opts); if (ret) - DPAA_PMD_ERR("init debug fqid %d failed with ret: %d", + DPAA_PMD_ERR("init fqid %d failed with ret: %d", fqid, ret); return ret; } @@ -2079,6 +2087,14 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) goto free_rx; } + dpaa_intf->tx_conf_queues = rte_zmalloc(NULL, sizeof(struct qman_fq) * + MAX_DPAA_CORES, MAX_CACHELINE); + if (!dpaa_intf->tx_conf_queues) { + DPAA_PMD_ERR("Failed to alloc mem for TX conf queues\n"); + ret = -ENOMEM; + goto free_rx; + } + /* If congestion control is enabled globally*/ if (td_tx_threshold) { dpaa_intf->cgr_tx = rte_zmalloc(NULL, @@ -2115,21 +2131,28 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) } dpaa_intf->nb_tx_queues = MAX_DPAA_CORES; -#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER - ret = dpaa_debug_queue_init(&dpaa_intf->debug_queues +#if defined(RTE_LIBRTE_DPAA_DEBUG_DRIVER) || defined(RTE_LIBRTE_IEEE1588) + ret = dpaa_def_queue_init(&dpaa_intf->debug_queues [DPAA_DEBUG_FQ_RX_ERROR], fman_intf->fqid_rx_err); if (ret) { DPAA_PMD_ERR("DPAA RX ERROR queue init failed!"); goto free_tx; } dpaa_intf->debug_queues[DPAA_DEBUG_FQ_RX_ERROR].dpaa_intf = dpaa_intf; - ret = dpaa_debug_queue_init(&dpaa_intf->debug_queues + ret = dpaa_def_queue_init(&dpaa_intf->debug_queues [DPAA_DEBUG_FQ_TX_ERROR], fman_intf->fqid_tx_err); if (ret) { DPAA_PMD_ERR("DPAA TX ERROR queue init failed!"); goto free_tx; } dpaa_intf->debug_queues[DPAA_DEBUG_FQ_TX_ERROR].dpaa_intf = dpaa_intf; + ret = dpaa_def_queue_init(dpaa_intf->tx_conf_queues, + fman_intf->fqid_tx_confirm); + if (ret) { + DPAA_PMD_ERR("DPAA TX CONFIRM queue init failed!"); + goto free_tx; + } + dpaa_intf->tx_conf_queues->dpaa_intf = dpaa_intf; #endif DPAA_PMD_DEBUG("All frame queues created"); diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index 261a5a3ca7..6aced9d5e9 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2014-2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017-2019 NXP + * Copyright 2017-2021 NXP * */ #ifndef __DPAA_ETHDEV_H__ @@ -131,6 +131,7 @@ struct dpaa_if { struct qman_fq *rx_queues; struct qman_cgr *cgr_rx; struct qman_fq *tx_queues; + struct qman_fq *tx_conf_queues; struct qman_cgr *cgr_tx; struct qman_fq debug_queues[2]; uint16_t nb_rx_queues; diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index c2579d65ee..189af748e9 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -1082,6 +1082,11 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) uint32_t seqn, index, flags[DPAA_TX_BURST_SIZE] = {0}; struct dpaa_sw_buf_free buf_to_free[DPAA_MAX_SGS * DPAA_MAX_DEQUEUE_NUM_FRAMES]; uint32_t free_count = 0; +#if defined(RTE_LIBRTE_IEEE1588) + struct qman_fq *fq = q; + struct dpaa_if *dpaa_intf = fq->dpaa_intf; + struct qman_fq *fq_txconf = dpaa_intf->tx_conf_queues; +#endif if (unlikely(!DPAA_PER_LCORE_PORTAL)) { ret = rte_dpaa_portal_init((void *)0); @@ -1162,6 +1167,10 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) mbuf = temp_mbuf; realloc_mbuf = 0; } + +#if defined(RTE_LIBRTE_IEEE1588) + fd_arr[loop].cmd |= DPAA_FD_CMD_FCO | qman_fq_fqid(fq_txconf); +#endif indirect_buf: state = tx_on_dpaa_pool(mbuf, bp_info, &fd_arr[loop], @@ -1190,6 +1199,10 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) sent += frames_to_send; } +#if defined(RTE_LIBRTE_IEEE1588) + dpaa_eth_tx_conf(fq_txconf); +#endif + DPAA_DP_LOG(DEBUG, "Transmitted %d buffers on queue: %p", sent, q); for (loop = 0; loop < free_count; loop++) { @@ -1200,6 +1213,45 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) return sent; } +void +dpaa_eth_tx_conf(void *q) +{ + struct qman_fq *fq = q; + struct qm_dqrr_entry *dq; + int num_tx_conf, ret, dq_num; + uint32_t vdqcr_flags = 0; + + if (unlikely(rte_dpaa_bpid_info == NULL && + rte_eal_process_type() == RTE_PROC_SECONDARY)) + rte_dpaa_bpid_info = fq->bp_array; + + if (unlikely(!DPAA_PER_LCORE_PORTAL)) { + ret = rte_dpaa_portal_init((void *)0); + if (ret) { + DPAA_PMD_ERR("Failure in affining portal"); + return; + } + } + + num_tx_conf = DPAA_MAX_DEQUEUE_NUM_FRAMES - 2; + + do { + dq_num = 0; + ret = qman_set_vdq(fq, num_tx_conf, vdqcr_flags); + if (ret) + return; + do { + dq = qman_dequeue(fq); + if (!dq) + continue; + dq_num++; + dpaa_display_frame_info(&dq->fd, fq->fqid, true); + qman_dqrr_consume(fq, dq); + dpaa_free_mbuf(&dq->fd); + } while (fq->flags & QMAN_FQ_STATE_VDQCR); + } while (dq_num == num_tx_conf); +} + uint16_t dpaa_eth_queue_tx_slow(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) { diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h index b2d7c0f2a3..042602e087 100644 --- a/drivers/net/dpaa/dpaa_rxtx.h +++ b/drivers/net/dpaa/dpaa_rxtx.h @@ -281,6 +281,8 @@ uint16_t dpaa_eth_queue_tx_slow(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs); uint16_t dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs); +void dpaa_eth_tx_conf(void *q); + uint16_t dpaa_eth_tx_drop_all(void *q __rte_unused, struct rte_mbuf **bufs __rte_unused, uint16_t nb_bufs __rte_unused); From patchwork Thu Aug 1 10:53:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142826 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 235DB45710; Thu, 1 Aug 2024 12:54:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D7EE0433B4; Thu, 1 Aug 2024 12:53:41 +0200 (CEST) Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011044.outbound.protection.outlook.com [52.101.65.44]) by mails.dpdk.org (Postfix) with ESMTP id 248F14337C for ; Thu, 1 Aug 2024 12:53:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LC0Th3uWd3sKayUU6LvZv2Nmv6+XxAUHY1Q1C7oAbDeRkvGTy5g0d9hQ6EjimQPR60H9Yf7A8MtuGBmdzzkF3jVXctVSgC78gPs5SIk+ESiX7IN8cod1ALyMrguabzEOsqW2epBxhdUwEmE2Pv5iEdWdVbukkX3LhH3rZqOPSCVEb0mjpwMqZrInPE9qMmEH5pX8nKUMRYno3fIKaKIO6ksz53HusbKTFNqU8lJUnQ7nt7Z0SxOx0t8ss5wR3QdvBAz2/hd4LSpF/a4FpY5BCbqqcKVSWt73pfoTv+niRvokSV1ON1gTIL4E/awdtsKx03+zTD8W/0CdZ6MkH9vn5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=lrbUZZkubGz/OXDLUMBW6aQOgG3c1OGgL6EpmRJID6M=; b=V9Wh4MNe3ny+QQ4VAmIIzwAUlKLQXmdSvCqphY+MTLJnxmO64cyJsh12ti3wAGlTbt+I9madzBwFjU+R1b5BaVId0QoRbrqUl16OqGeLTzkdTE0/YSkIUlFr3x/BQ4D6t03ikiwhb5+HBBcjT+7UaqYHu+1Z+LdJQIbSeHUJtAOlpn8PG7TqwnNophu5R2kAp7emPrvLRZY/bF9GC8H4AT7sVKYqV/LQhx1u0fjOj+Rk7l4QaTCBu89lAdaGbvEl+0gYUM8JuWyA8Gt4eYNO0Q+8KhsGmCkeOtt31L7gWy0XcOHxHE7Oj91RCgGFCvnfxyGD9s2FV6Q4HEW7eQr2kA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lrbUZZkubGz/OXDLUMBW6aQOgG3c1OGgL6EpmRJID6M=; b=XfDqWxw0j9XU4bQKl8U3+Ts0EUXpfzmNs9eI6Bp1i1YhpS6gFZLp0Vo9FjcuRp6VcZAW1wj8CDfhkjlvQoLBfKwxQLSlm+ueKszN4xfYGDW8NbD/pKUZzgEkAnOK3/jr87dwyNZ4Ff6Nj87QkcE8104ty15wpDRbCvoAjwOy1OkF64NHRID8JmBIZ7hC/BPEXVLiPTg6JzpaIRZFja1YBWNSH4ni1Yrlhvj+UrGoBWYdaE7ZVOWc/sGsFLPRrmQdEoEtNLRMjOb4DOm/ZIBz8jqTKZ049JN5no4cUzYRtBbXg/tI86TvckGgEPniHCz+pWgvsv6N/kAQlqYrrPA/tA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:36 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:36 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Vanshika Shukla Subject: [PATCH 06/17] net/dpaa: add support to separate Tx conf queues Date: Thu, 1 Aug 2024 16:23:02 +0530 Message-Id: <20240801105313.630280-7-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 643c06d8-738e-4655-0be9-08dcb21831c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: IqQ2e0IOrRYBD5w6TirMO3nx+V9LRRcdwJhCmN66KjZKp41XLctsXwRyXoGpGxE2LOvpQ7GCyrNHeJzVv6m9dQYiRn9EInBL1nunhBSt0jA12mNFGwyREFAsFBGWgHIP8J/TkooPKLsyDmKe0nBWlcTlviTa6DPnuK6Dpt9Q/BDBCtGZgJf3ZzsFaZpnei6mvodJE8QxnpiJPtXYTJmBUUUdBnzk0lFauKzA+vzauh76+gufYlY0ne1ITT31XZ6JY7zbwD+UFEreNoyUHjMoHs23wKkVBHxl7RULa/VfpaynEeS/eSLVWAQIowIRFvi/rH4eD9Yr0VOpy2GtyDFmnLnNudf3XmTXMDsfLNkdPTIo4jnQQzL/mlDCR86dr1auX1h/wapAMzlYQNlGzLthdWiLQfdRIqjJLMIrVJ8JAiYV7kLafVP8AdjuB9VFSuEXvTJLQBv8WAJBM+Tr3bhXhpvBVCmDrYnMiZWH0pRMOoE02IswfieKN/GCInAp8UkbNCsfF8jaFc9LHhfEl37B+vwgt3Pzz+t0O9zoLjevz1JN6IOBuET+NROEwt+RSDt7Gk6SGyCH+yVYYImiFmKrxXHA1a2U/rWjnJlIdzP8ooJoh7kZNVM18lITOzIC0lxF2Shp0Jt8tAGuz8R9tschlhALm+CRWyczbcBu4ZBQTPTj3AuM8/SWejNwNqoWz261VsTfyLuaQLcvpkOO/yItR2JxfK+E6qkSAjVf5CihypnIF8dHjtQ+pcAPkQ2FIPDoyTUNiLL1ILBH1Cvfqg0OtvrFGRA0UodfY/Ui/FVZJRSPdExs9tle09UGXff3CHAfLB2h/by4vytggonYiDJmbYywGdD/soChwHVhUK+fCXYYU4lNvjs2ML1SivxEqcftfliVb07WgDxCmndRx4dXYHinBQWzb2hygDCt9H17UMBD8SIJnfEdpav8vmqHaGcNJaXTgIgkgV1szLyFUvqo5cct5+lCWQ7pgGdMhQGv02tSac7NB6leHVOawBup0zoC+QWRIPUcrB5safOcC27NK3LLGOrB18XMrioOnGjIJUxtZ2GikZKdql+IV6jWQBCuS6T1Vz9H15y03Mg4TMPqKLnS7U1HSX97n+wqPGYp4ZFtHlP/I3d7kTi5oHAtY3Zf0RR3KmOSip4rLMxkGIgX/JveEaGyHDVBl8MUPRE1YP4tBWeDmh5Plf/YoZ4KqS/6OP1RleUEXb89vswz+l0iomW/iQBHXRMIWPVZupcvVIkC0jXvPNSFPEiJd/D/hpO0NzYT4VvZmqdcAEGhdA2B08VyIPYs6SqssbR39XzU/1jWtDtmip5MPAaGMmg+s9ipebOWJHSnKwKiay2T7HaML3/QCTQGgWUiDC08e/BBd/mnrwjukH4uSV/xvgL7jbY9o88F1OxWb4XZarc2hF8JXQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NO7P+e1Tac9VW7ql5NyMRn6HSe/Xr3Jo4sff2zeZN5ZPtMVdDeual5GlNcY8HBy+cBVbROweXOETxUlQTHhGxuSMZqr4su9P7uzeOTnV44qhD4H+vPPjNUd6uCGzSIaUor45e4hOEyNGma0DD/UI6FRSGmSRKplMGN3k8V1A6EsjkzUArcjTho/pYvdvhHYkPRlvOnDG+vlRqpoCTHFpjbJizMph8sXd+NtrPD0OyeOhk43EeJEmjKla2YnlMRU1x2DbM2+4jstwBZBM2sfJ8iSBnPDec7Eekj12d4yJ9LqBW6ue52MEk11C7DEOD+p09itXKB13HFTdEnTvCZD9L4qmM3iiUk2xvEcKjBWw1aXsEMXyMwrXW5Jh9YzfCHOFwucl1FgYhLZEiYgFIk8LbQKZ6xXy04SckTMYcoKBMKgnN5rJuQdu88MzisNNzuBs0DSum8haWVsHh+sv5r3qDebws/YwJ9Ux2r2zMBtpxdpIRA3D+cL8tuq3bzd1K6ztKbFNcI9tvHIVDJIEw6z8JeH839+DEf4VIn0NZZZ4vZkzoAeC6lCCONbl2VBOQWIduEcPc0BFgf2sGu6suOkDDPw9GIZPF4EMb9Wc/JXUFI9LeTQtqVdxV49O7tO356Lau3xAWZAVn3EeR9TvSVEAUeAvH0QUIgMhwmmR4ujcCPGLKARWyy5dPFlOk+HI79+aZffK6hJ0FQA5Q2zTk+3l2IT/TZp//6zPOVx5FogIe/4h1Es+uaMdqqdxtjGAPctuqB2EZ/TKMdN/uO7QCXiPnvb4VZuGcLnuUrmJhok4+dRvitiYFBwC5QbUZ4+JNWXb17ypyi7OYOcIqKBTXDBob0YT5Ad2tHt2yxej/1AwpS3YaKrRcsOY1ES4PqTSdVVTBYVC97jqW6VstXATVE/gOecJVeM27Ooxi/RO/ilJGqt36IBbe+GGIy3Lj/hl8t6ABMvJ+p/AebQRUqwLdj5Ybdu2ajhgfVijFbM05NlbnLIExdrK1nFsICTK4u1vaz54kCiomAeiu5E+KWbmCHmJgadTCkK+hRY6CerJtE5Gj9j/WBcR1T/DKkQ30T4wHAAjL0IjMDs792C5GsltXHbiKmP1eJkfqejprKJlnsL4XEHZSK3H3QJOFrDbG7kBkStLoEQphPaMghdWa+6iI4h13Ml7ZY6DOSyosDUukPt50ReE8lDj1NtSqFDTGVnU5HmqpGMEbx6zBvQZWKLMzNy3lVeHLBvmqOcIytO6f2JxzrwwzaYtqFjsPbqEDCYpf/l8ZtJjkWZb4tosQdjV4KYN1qnguzw/T6zikrUgqPh+MYpH2XySmF2ThMe+pEw6+zauUZnJyDIcjmylmJNs7Z7XfG7WGPzhNeroyTg7p1up6PFuFuIwcBr/AASKREHnZQiROV8aDTeHEHikufEhAuREODEybEBxruewRgfOdWxIutobn4d0agyYbVKCQdTUcti4nS72AzHFjv6J869HwNF8TgEkSUYrEG+paepAtgNKk4xr59vxebRi+1mbiWibDH8ffrNQPeaNzXoEnIZEAhpeF/oNpCxJjrn1G6A79Cclpx5uMJ1/rLixFTUWg49hvuAKcDWIPtId81odc86xzNuN7w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 643c06d8-738e-4655-0be9-08dcb21831c9 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:36.5148 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bYdLL1kWxRC7oEmC19C51AwvxxrENgO0e62exsUUUDaNTf1HZUGAnD68zDnklIfxCw4b6Xpvp8yhyv7/gpcB3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Vanshika Shukla This patch separates Tx confirmation queues for kernel and DPDK so as to support the VSP case. Signed-off-by: Vanshika Shukla Acked-by: Hemant Agrawal --- drivers/bus/dpaa/include/fsl_qman.h | 4 ++- drivers/net/dpaa/dpaa_ethdev.c | 47 +++++++++++++++++++++-------- drivers/net/dpaa/dpaa_rxtx.c | 2 +- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h index c0677976e8..db14dfb839 100644 --- a/drivers/bus/dpaa/include/fsl_qman.h +++ b/drivers/bus/dpaa/include/fsl_qman.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2008-2012 Freescale Semiconductor, Inc. - * Copyright 2019 NXP + * Copyright 2019-2022 NXP * */ @@ -1237,6 +1237,8 @@ struct qman_fq { /* DPDK Interface */ void *dpaa_intf; + /*to store tx_conf_queue corresponding to tx_queue*/ + struct qman_fq *tx_conf_queue; struct rte_event ev; /* affined portal in case of static queue */ diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 9ffb8c578c..17058d762c 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1867,10 +1867,33 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, return ret; } -#if defined(RTE_LIBRTE_DPAA_DEBUG_DRIVER) || defined(RTE_LIBRTE_IEEE1588) -/* Initialise a DEBUG FQ ([rt]x_error, rx_default) and DPAA TX CONFIRM queue - * to support PTP - */ +#if defined(RTE_LIBRTE_IEEE1588) +static int +dpaa_tx_conf_queue_init(struct qman_fq *fq) +{ + struct qm_mcc_initfq opts = {0}; + int ret; + + PMD_INIT_FUNC_TRACE(); + + ret = qman_create_fq(0, QMAN_FQ_FLAG_DYNAMIC_FQID, fq); + if (ret) { + DPAA_PMD_ERR("create Tx_conf failed with ret: %d", ret); + return ret; + } + + opts.we_mask = QM_INITFQ_WE_DESTWQ | QM_INITFQ_WE_FQCTRL; + opts.fqd.dest.wq = DPAA_IF_DEBUG_PRIORITY; + ret = qman_init_fq(fq, 0, &opts); + if (ret) + DPAA_PMD_ERR("init Tx_conf fqid %d failed with ret: %d", + fq->fqid, ret); + return ret; +} +#endif + +#if defined(RTE_LIBRTE_DPAA_DEBUG_DRIVER) +/* Initialise a DEBUG FQ ([rt]x_error, rx_default) */ static int dpaa_def_queue_init(struct qman_fq *fq, uint32_t fqid) { struct qm_mcc_initfq opts = {0}; @@ -2128,6 +2151,14 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) if (ret) goto free_tx; dpaa_intf->tx_queues[loop].dpaa_intf = dpaa_intf; + +#if defined(RTE_LIBRTE_IEEE1588) + ret = dpaa_tx_conf_queue_init(&dpaa_intf->tx_conf_queues[loop]); + if (ret) + goto free_tx; + dpaa_intf->tx_conf_queues[loop].dpaa_intf = dpaa_intf; + dpaa_intf->tx_queues[loop].tx_conf_queue = &dpaa_intf->tx_conf_queues[loop]; +#endif } dpaa_intf->nb_tx_queues = MAX_DPAA_CORES; @@ -2145,14 +2176,6 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_ERR("DPAA TX ERROR queue init failed!"); goto free_tx; } - dpaa_intf->debug_queues[DPAA_DEBUG_FQ_TX_ERROR].dpaa_intf = dpaa_intf; - ret = dpaa_def_queue_init(dpaa_intf->tx_conf_queues, - fman_intf->fqid_tx_confirm); - if (ret) { - DPAA_PMD_ERR("DPAA TX CONFIRM queue init failed!"); - goto free_tx; - } - dpaa_intf->tx_conf_queues->dpaa_intf = dpaa_intf; #endif DPAA_PMD_DEBUG("All frame queues created"); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 189af748e9..c15538116d 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -1085,7 +1085,7 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) #if defined(RTE_LIBRTE_IEEE1588) struct qman_fq *fq = q; struct dpaa_if *dpaa_intf = fq->dpaa_intf; - struct qman_fq *fq_txconf = dpaa_intf->tx_conf_queues; + struct qman_fq *fq_txconf = fq->tx_conf_queue; #endif if (unlikely(!DPAA_PER_LCORE_PORTAL)) { From patchwork Thu Aug 1 10:53:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142827 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A71D345710; Thu, 1 Aug 2024 12:54:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 27AA4433BF; Thu, 1 Aug 2024 12:53:43 +0200 (CEST) Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011015.outbound.protection.outlook.com [52.101.65.15]) by mails.dpdk.org (Postfix) with ESMTP id E4596433B4 for ; Thu, 1 Aug 2024 12:53:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TQrK4VH4Y9wkRO6ILbQ+jRX4rhuCKKemThFunYkGnCWMtDLtcHTxCrlvYw8z7i2Hz5XTRNaME8AENbV3ERe6A9QTOdRqB6/96eGy3mWXHr5+VtJw5zDk1J2GvU3L9rfcmFej/QSSQrrBmwAwp5iRIGJrD8sp/1KdvpZLvDzv+B/P4UzRIiYsGcao4uM5jeQQ4cz1RfEM04UThyLYfjkOeyKCsG9lPWQ5oGWQpOF9AhiW4VW13ezrsS4vaKV56ZOgHFb1OE5KDhBfXOGmaWCnb2KyK1vMNMxWWUtXbMRj999vpvqiIJSc9/zk3/BHTtZ3FIyJYpWTKE94sWeESVYYCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=mdeZ1JSkEYxdQjPcWPjvLWfCV2G/0CgIutvRbyYfy6A=; b=s3IJIbiV8jiuOaSch11tgIsJGFBgoosJ5IHONdjO9VYP3fETcfRldilo96PQFRY01RjHxUgopbgK367wWGvsrMa4CjOu25/eg9+3OwyeZIeXZ8GZRnIOQyG5+v1O/W8JkuNJAfbN44Gi31Cx/ah7sRYnjJNxrHQlwA0eX4qz0WU8KZnYy98xXrPQH0dWfNBsi+v0FrUj0FV7C5eBM/L71RgZgApI2gdClhVDvkNxW+vSEp4fMsdS7GlWkVKPM6RVig7bCzN8Ey7DVCrvgJ95SArYGMJV0ca2ef31i+natkDRqOQ9aOSJyzsCOmR5P1l50ea90SaWc9xCABhG4AJ99Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mdeZ1JSkEYxdQjPcWPjvLWfCV2G/0CgIutvRbyYfy6A=; b=WtDo0pxRC7ewqZjwfZCTrLou9PWs4AAtMFc/Mh4BuqSSHEeU0Qkb/hylptBRnk54zbCgdJb4VQOteOltyBylqIp8WvvVoU5evFgMBgdN1YxH4xM9lIzKn1QDQM/TvYG4RIfxS1F+fkLy98IznqNuhP2d7PBMcG1q6SoOA1RUmuiLAfJO3Oecma4RqE6blOHriwFTG6LKMT50IlFeDZbQbOdxWJlKQGd+QCxOHHq78QjJLUmH1ppzkNoG5rRGPvYjaVdsdP7vxBlMoJpfIkOGx8Frp++30zAXLoQ4ATmlqbWWNp+qZWSkdsPk5yUhMAMMGUSkEmOHY7+WsNjpfrAyWg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:39 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:39 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Jun Yang Subject: [PATCH 07/17] net/dpaa: share MAC FMC scheme and CC parse Date: Thu, 1 Aug 2024 16:23:03 +0530 Message-Id: <20240801105313.630280-8-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f2ebb8c-1c91-4bfc-5db8-08dcb2183291 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: seJpXJpPaAJVcKBCwa/Iy+WSl0e2W+c69G3LEU1ve7JCcPHkaB2zje98+guCdUe19/6DClAaX7g69UD+4A9xAo3cfeNigkDYnfzQxRnmTFECnkG07twQoZg9hlfDFdnqLvucv8CpR/H3kC0vFoHHK1zYr3CmtTY8Gy7dSd+sAZo5fJaGCi38nGkTukXYuj0cimufPVoIiSPaECPzJ3psMlsB5wDFaZMJtrYAWwjs9LJSTJXSwO9Dgf1UQiqxEdujqjSuHuiORRnUT/GqltHTBFk6I9t90xClm7pN0aq8PYJkay3hIabl7zKbu0418wM5jd7kUEk32CZd7zWDQh0L7imVGY/LIhRZYenPXqxqSGThnh+jOwB+njAiNWEkaNRsYrHJ34bihc5oSpBrnIuWOqSIUae1a1/SPlgP00UYDfPufTFAO9LU+PNzVLxa3pak2GcvbRapXDYfi6nrKv46NDL0UjwtAOuT4WCyBwuVxMsYG5PRiwBz91z58saxZwiDMQEjeeMjIU7N3ZpG+ahg8iJlwKY+ulbmEuED+wDUl3xkY5HxE+VamPC2aaNP89QAVKBR1N901Z0uBqKcuulrOSfvYT10AJLBgXU2u2wqHm0lF6T80++1di0wJkp1RLEquCfa/x7asZcBCgURSXGGC4ioPz9Jef6zJwv9axciWQ+0KUL5jZSV7J5UueqxSztE9MuBT64EV63TMcB+HyH+SNbunZaikyj2wSYbCqKXyH4FqIQT+U/Iyns95c8h5U3py+dEADV9SVMsaIuea1gJJOGrNjzcNAszOA6mtVkr7b9sjBL7rf9W010SNMNAGKpxQc3iqbe7z6aHZj5TX1NRvdgWy3vfDofonWk0H1Y2rBvqd9Nw4BEiyORj39dR1hAZIBssKZfqElNni66drxf3ARP/TmEdii4TAO8dppJX8y3SKJBsI5TPlsB0q0WHXXmMh93YxSql0B0BjyqOwXVi224wyrTgSe49kjpyO92Fx2DOgVfOxfDzfHtFti4bAq4TZGYhxrcqEAX+/+1oXCcRuE16TQJQrCmWzP1dRIlSR0RJcfPtoQa3FpA3ELe/3GQGTRjqWec9rQjAcKvITDeKg2D2lJjz4DLz4SpaBcVUVKjLmCbI+JG1u8GEssy9JnulgQUsvurwD45gW32PfDbr90Cyb5m/t53jEdY3iTvzAAp4teQFRQ8WfMWPOSiMWDGxIVucm0X6USYrigVIhdeWLCr716riF8fp4SZcbhyvE8f3V4p0PGvzTZLZpDJkoAKtiA1nsgrOdQuM2TmmOolp/QI1ifNpknZaZxdZi1jQ32Q2jOKP3b/yl+9vZmEQXcGkO0YJySzBBPk2IYKLmqDpIEfejvCkujVuKXXb2iDtuG7ctTuEd4yzF4mP+e+diFNpiaV3vujShHTDW3gm0cxT2g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Go9fLGYt161Y/PyLV/5KvkALtqKdxqs9VYFQwr6uVHWhh09tgF1jSptRIHNZcy9C+koLrr5azCfOTyE320MNeZ3CkOg938zLHxuPbr7j2ODtZKp3Wuz088aEnKfHhMGzMcSx36aWlXjQL5utXY6MLppsEUE9fnVupTFm0BdRzX0ikfQkJ3smenX6MSmsdeO5zPFhpZkgNIxLUUrfAm3Uoxj8QC8u74F13UeGOId6B+QPxxH7ESFcpYI0mWpHvdOjglwhrXxnMCFmSSqt1eEPUfQinUpkYyNGMmwDmFmYd/TDfyIeh0QzeHfjMOIGkMwHmetNdizHqxLi+lSfDddgHPVTcfFQyAZr6t1Z6yZzZG21tz5yH1YLfoJCtImIb0VQayCgp9Q07WV6DaOVHCqqqo+R0Rox7jwreJdO+GrejjgzgZvTItQRO17229N44yBCWBk+Efasie6BBZnOJeF4b3kkgiPUM93CACYABK5JH7YVe1eAMkk6XqaCZ95BDXfEmQiDePWqxxvazxgAXLFd6mBsR7m8/Q1pBkrtKPw2+A0bEnquA6BLS5k5pGxWjYgr7CMODgC1hVM5W2z8pD6yVSJCROgEM1MJ8sGAsNk4l9PHW+TN30uIQKlODp8FmTVyHwXeN9xDIbLXW+37twCd76QB59KJWXu716hBz5ZA9CWgyi2N+xS0VfU1GYhjJkiIPVQWCYTaNF+m9oujGYIs6Chf3Zd0mywWXQPj8RwKG785Pq0JzIUbmwCCExMf1htB11Snc5NSiUvpBKL/7FyEQ8i0hxf1tb8LGVrj1qIx2yCMG2u4ve+wYfyhwWNpWpswV+QFxUMcSaGCeskz/Ff1koUfBeBgEGDkAjHiQ6EWM2nobG5wvSH82Umj8l79LF7CQNjq0CmU771WUnjPOsxF1mdP8C53G5Ghn4AyA54dC89zRs0LGouzYhXpY5bDWuiFd+PAvIXwp8c8//NY89kTwiL9YTO5ypGc21XvABsPZXWlj7wemh3559sYvPETeDffEw5s1P0F4hN2ERlmt78uXTDH2vMITRjPYdwzXb+YI3s2fEmEccTdJv7KfCf4FjXPQLGDwg8Yxx+mqTbtMfwAZ7m9DHpIvQ0aYmi6MmjeYxIR/oS3vDK4FQNFlPQxG2EbdhsviASCuiW3hEVuLYTBk6IQrgxILVFbDJndgvLk1sytRo3IwTnm1DSqfTs21PE+E9ABcpklTLRqYErgyFzDgEr6ZhtlJKHE6oBLE4sdOZqZE4qbDx14ChCXFnb6Tgdo9J/bFiGgYP/qCoA21OcNF/Elt59HA4BJn9eSoLTG6S0DPuvK0XqFrhSo3zSaZUVSDdmzS6LAMnAy0bRuZ6rwPLuATpJySkKkM0fOta15tTyZmRa6vKJaj8tWFQswvXoBYEPhEbUJpKdk56UQbBygGPOFOlvt6tvxcUg3flja7q6JR4eURxa8HWjXkuGCZxo5jbI3whchNlbUTm1g8XZ/UIyo6FoVP1buvWdexYdwUYGtSaTXYSSLlwVpvhUvt+BEudj5VWEgoj9c2gTdroDyE7EUoFWk/iOChKrdzSgfLpy8QA/Q0V8wWuPfl7RZ9LqtmbbLpLrhBLUiWJxlTUuYeQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f2ebb8c-1c91-4bfc-5db8-08dcb2183291 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:37.8918 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0HBvS6+4d4Ifscfqq6XaPUzhYrBjAV5HeT6BA9ceIH4KOeXKVGtjpRJdq2AI3BTz3l97hw1U1oORlEcSdURIuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Jun Yang For Shared MAC: 1) Allocate RXQ from VSP scheme. 2) Allocate RXQ from CC directed to VSP. 2) Remove RXQ allocated which is reconfigured without VSP. 3) Don't alloc default queue and err queues. Signed-off-by: Jun Yang Acked-by: Hemant Agrawal --- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/include/fman.h | 3 +- drivers/net/dpaa/dpaa_ethdev.c | 53 ++-- drivers/net/dpaa/dpaa_ethdev.h | 13 +- drivers/net/dpaa/dpaa_flow.c | 8 +- drivers/net/dpaa/dpaa_fmc.c | 421 +++++++++++++++++++----------- drivers/net/dpaa/dpaa_rxtx.c | 20 +- 7 files changed, 345 insertions(+), 175 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index beeb03dbf2..bf41a3ed96 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -42,7 +42,7 @@ if_destructor(struct __fman_if *__if) if (!__if) return; - if (__if->__if.mac_type == fman_offline) + if (__if->__if.mac_type == fman_offline_internal) goto cleanup; list_for_each_entry_safe(bp, tmpbp, &__if->__if.bpool_list, node) { diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 60681068ea..3642b43be7 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -72,10 +72,11 @@ TAILQ_HEAD(rte_fman_if_list, __fman_if); /* Represents the different flavour of network interface */ enum fman_mac_type { - fman_offline = 0, + fman_offline_internal = 0, fman_mac_1g, fman_mac_10g, fman_mac_2_5g, + fman_onic, }; struct mac_addr { diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 17058d762c..e3cb15cad5 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -252,7 +252,6 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) DPAA_PMD_ERR("Cannot open IF socket"); return -errno; } - strncpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ - 1); if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) { @@ -1958,6 +1957,41 @@ dpaa_dev_init_secondary(struct rte_eth_dev *eth_dev) return 0; } +#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER +static int +dpaa_error_queue_init(struct dpaa_if *dpaa_intf, + struct fman_if *fman_intf) +{ + int i, ret; + struct qman_fq *err_queues = dpaa_intf->debug_queues; + uint32_t err_fqid = 0; + + if (fman_intf->is_shared_mac) { + DPAA_PMD_DEBUG("Shared MAC's err queues are handled in kernel"); + return 0; + } + + for (i = 0; i < DPAA_DEBUG_FQ_MAX_NUM; i++) { + if (i == DPAA_DEBUG_FQ_RX_ERROR) + err_fqid = fman_intf->fqid_rx_err; + else if (i == DPAA_DEBUG_FQ_TX_ERROR) + err_fqid = fman_intf->fqid_tx_err; + else + continue; + ret = dpaa_def_queue_init(&err_queues[i], err_fqid); + if (ret) { + DPAA_PMD_ERR("DPAA %s ERROR queue init failed!", + i == DPAA_DEBUG_FQ_RX_ERROR ? + "RX" : "TX"); + return ret; + } + err_queues[i].dpaa_intf = dpaa_intf; + } + + return 0; +} +#endif + /* Initialise a network interface */ static int dpaa_dev_init(struct rte_eth_dev *eth_dev) @@ -2162,22 +2196,11 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) } dpaa_intf->nb_tx_queues = MAX_DPAA_CORES; -#if defined(RTE_LIBRTE_DPAA_DEBUG_DRIVER) || defined(RTE_LIBRTE_IEEE1588) - ret = dpaa_def_queue_init(&dpaa_intf->debug_queues - [DPAA_DEBUG_FQ_RX_ERROR], fman_intf->fqid_rx_err); - if (ret) { - DPAA_PMD_ERR("DPAA RX ERROR queue init failed!"); - goto free_tx; - } - dpaa_intf->debug_queues[DPAA_DEBUG_FQ_RX_ERROR].dpaa_intf = dpaa_intf; - ret = dpaa_def_queue_init(&dpaa_intf->debug_queues - [DPAA_DEBUG_FQ_TX_ERROR], fman_intf->fqid_tx_err); - if (ret) { - DPAA_PMD_ERR("DPAA TX ERROR queue init failed!"); +#if defined(RTE_LIBRTE_DPAA_DEBUG_DRIVER) + ret = dpaa_error_queue_init(dpaa_intf, fman_intf); + if (ret) goto free_tx; - } #endif - DPAA_PMD_DEBUG("All frame queues created"); /* Get the initial configuration for flow control */ diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index 6aced9d5e9..df179b18e8 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -78,8 +78,11 @@ #define DPAA_IF_RX_CONTEXT_STASH 0 /* Each "debug" FQ is represented by one of these */ -#define DPAA_DEBUG_FQ_RX_ERROR 0 -#define DPAA_DEBUG_FQ_TX_ERROR 1 +enum { + DPAA_DEBUG_FQ_RX_ERROR, + DPAA_DEBUG_FQ_TX_ERROR, + DPAA_DEBUG_FQ_MAX_NUM +}; #define DPAA_RSS_OFFLOAD_ALL ( \ RTE_ETH_RSS_L2_PAYLOAD | \ @@ -107,6 +110,10 @@ #define DPAA_FD_CMD_CFQ 0x00ffffff /**< Confirmation Frame Queue */ +#define DPAA_1G_MAC_START_IDX 1 +#define DPAA_10G_MAC_START_IDX 9 +#define DPAA_2_5G_MAC_START_IDX DPAA_10G_MAC_START_IDX + #define DPAA_DEFAULT_RXQ_VSP_ID 1 #define FMC_FILE "/tmp/fmc.bin" @@ -133,7 +140,7 @@ struct dpaa_if { struct qman_fq *tx_queues; struct qman_fq *tx_conf_queues; struct qman_cgr *cgr_tx; - struct qman_fq debug_queues[2]; + struct qman_fq debug_queues[DPAA_DEBUG_FQ_MAX_NUM]; uint16_t nb_rx_queues; uint16_t nb_tx_queues; uint32_t ifid; diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c index 02aca78d05..082bd5d014 100644 --- a/drivers/net/dpaa/dpaa_flow.c +++ b/drivers/net/dpaa/dpaa_flow.c @@ -651,7 +651,13 @@ static inline int set_pcd_netenv_scheme(struct dpaa_if *dpaa_intf, static inline int get_port_type(struct fman_if *fif) { - if (fif->mac_type == fman_mac_1g) + /* For 1G fm-mac9 and fm-mac10 ports, configure the VSP as 10G + * ports so that kernel can configure correct port. + */ + if (fif->mac_type == fman_mac_1g && + fif->mac_idx >= DPAA_10G_MAC_START_IDX) + return e_FM_PORT_TYPE_RX_10G; + else if (fif->mac_type == fman_mac_1g) return e_FM_PORT_TYPE_RX; else if (fif->mac_type == fman_mac_2_5g) return e_FM_PORT_TYPE_RX_2_5G; diff --git a/drivers/net/dpaa/dpaa_fmc.c b/drivers/net/dpaa/dpaa_fmc.c index f8c9360311..30f10fae33 100644 --- a/drivers/net/dpaa/dpaa_fmc.c +++ b/drivers/net/dpaa/dpaa_fmc.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2017-2021 NXP + * Copyright 2017-2023 NXP */ /* System headers */ @@ -204,139 +204,258 @@ struct fmc_model_t { struct fmc_model_t *g_fmc_model; -static int dpaa_port_fmc_port_parse(struct fman_if *fif, - const struct fmc_model_t *fmc_model, - int apply_idx) +static int +dpaa_port_fmc_port_parse(struct fman_if *fif, + const struct fmc_model_t *fmc_model, + int apply_idx) { int current_port = fmc_model->apply_order[apply_idx].index; const fmc_port *pport = &fmc_model->port[current_port]; - const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; - const uint8_t mac_type[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2}; + uint32_t num; + + if (pport->type == e_FM_PORT_TYPE_OH_OFFLINE_PARSING && + pport->number == fif->mac_idx && + (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic)) + return current_port; + + if (fif->mac_type == fman_mac_1g) { + if (pport->type != e_FM_PORT_TYPE_RX) + return -ENODEV; + num = pport->number + DPAA_1G_MAC_START_IDX; + if (fif->mac_idx == num) + return current_port; + + return -ENODEV; + } + + if (fif->mac_type == fman_mac_2_5g) { + if (pport->type != e_FM_PORT_TYPE_RX_2_5G) + return -ENODEV; + num = pport->number + DPAA_2_5G_MAC_START_IDX; + if (fif->mac_idx == num) + return current_port; + + return -ENODEV; + } + + if (fif->mac_type == fman_mac_10g) { + if (pport->type != e_FM_PORT_TYPE_RX_10G) + return -ENODEV; + num = pport->number + DPAA_10G_MAC_START_IDX; + if (fif->mac_idx == num) + return current_port; + + return -ENODEV; + } + + DPAA_PMD_ERR("Invalid MAC(mac_idx=%d) type(%d)", + fif->mac_idx, fif->mac_type); + + return -EINVAL; +} + +static int +dpaa_fq_is_in_kernel(uint32_t fqid, + struct fman_if *fif) +{ + if (!fif->is_shared_mac) + return false; + + if ((fqid == fif->fqid_rx_def || + (fqid >= fif->fqid_rx_pcd && + fqid < (fif->fqid_rx_pcd + fif->fqid_rx_pcd_count)) || + fqid == fif->fqid_rx_err || + fqid == fif->fqid_tx_err)) + return true; + + return false; +} + +static int +dpaa_vsp_id_is_in_kernel(uint8_t vsp_id, + struct fman_if *fif) +{ + if (!fif->is_shared_mac) + return false; + + if (vsp_id == fif->base_profile_id) + return true; + + return false; +} + +static uint8_t +dpaa_enqueue_vsp_id(struct fman_if *fif, + const struct ioc_fm_pcd_cc_next_enqueue_params_t *eq_param) +{ + if (eq_param->override_fqid) + return eq_param->new_relative_storage_profile_id; + + return fif->base_profile_id; +} - if (mac_idx[fif->mac_idx] != pport->number || - mac_type[fif->mac_idx] != pport->type) - return -1; +static int +dpaa_kg_storage_is_in_kernel(struct fman_if *fif, + const struct ioc_fm_pcd_kg_storage_profile_t *kg_storage) +{ + if (!fif->is_shared_mac) + return false; + + if (!kg_storage->direct || + (kg_storage->direct && + kg_storage->profile_select.direct_relative_profile_id == + fif->base_profile_id)) + return true; - return current_port; + return false; } -static int dpaa_port_fmc_scheme_parse(struct fman_if *fif, - const struct fmc_model_t *fmc, - int apply_idx, - uint16_t *rxq_idx, int max_nb_rxq, - uint32_t *fqids, int8_t *vspids) +static void +dpaa_fmc_remove_fq_from_allocated(uint32_t *fqids, + uint16_t *rxq_idx, uint32_t rm_fqid) { - int idx = fmc->apply_order[apply_idx].index; uint32_t i; - if (!fmc->scheme[idx].override_storage_profile && - fif->is_shared_mac) { - DPAA_PMD_WARN("No VSP assigned to scheme %d for sharemac %d!", - idx, fif->mac_idx); - DPAA_PMD_WARN("Risk to receive pkts from skb pool to CRASH!"); + for (i = 0; i < (*rxq_idx); i++) { + if (fqids[i] != rm_fqid) + continue; + DPAA_PMD_WARN("Remove fq(0x%08x) allocated.", + rm_fqid); + if ((*rxq_idx) > (i + 1)) { + memmove(&fqids[i], &fqids[i + 1], + ((*rxq_idx) - (i + 1)) * sizeof(uint32_t)); + } + (*rxq_idx)--; + break; } +} - if (e_IOC_FM_PCD_DONE == - fmc->scheme[idx].next_engine) { - for (i = 0; i < fmc->scheme[idx] - .key_ext_and_hash.hash_dist_num_of_fqids; i++) { - uint32_t fqid = fmc->scheme[idx].base_fqid + i; - int k, found = 0; - - if (fqid == fif->fqid_rx_def || - (fqid >= fif->fqid_rx_pcd && - fqid < (fif->fqid_rx_pcd + - fif->fqid_rx_pcd_count))) { - if (fif->is_shared_mac && - fmc->scheme[idx].override_storage_profile && - fmc->scheme[idx].storage_profile.direct && - fmc->scheme[idx].storage_profile - .profile_select.direct_relative_profile_id != - fif->base_profile_id) { - DPAA_PMD_ERR("Def RXQ must be associated with def VSP on sharemac!"); - - return -1; - } - continue; +static int +dpaa_port_fmc_scheme_parse(struct fman_if *fif, + const struct fmc_model_t *fmc, + int apply_idx, + uint16_t *rxq_idx, int max_nb_rxq, + uint32_t *fqids, int8_t *vspids) +{ + int scheme_idx = fmc->apply_order[apply_idx].index; + int k, found = 0; + uint32_t i, num_rxq, fqid, rxq_idx_start = *rxq_idx; + const struct fm_pcd_kg_scheme_params_t *scheme; + const struct ioc_fm_pcd_kg_key_extract_and_hash_params_t *params; + const struct ioc_fm_pcd_kg_storage_profile_t *kg_storage; + uint8_t vsp_id; + + scheme = &fmc->scheme[scheme_idx]; + params = &scheme->key_ext_and_hash; + num_rxq = params->hash_dist_num_of_fqids; + kg_storage = &scheme->storage_profile; + + if (scheme->override_storage_profile && kg_storage->direct) + vsp_id = kg_storage->profile_select.direct_relative_profile_id; + else + vsp_id = fif->base_profile_id; + + if (dpaa_kg_storage_is_in_kernel(fif, kg_storage)) { + DPAA_PMD_WARN("Scheme[%d]'s VSP is in kernel", + scheme_idx); + /** The FQ may be allocated from previous CC or scheme, + * find and remove it. + */ + for (i = 0; i < num_rxq; i++) { + fqid = scheme->base_fqid + i; + DPAA_PMD_WARN("Removed fqid(0x%08x) of Scheme[%d]", + fqid, scheme_idx); + dpaa_fmc_remove_fq_from_allocated(fqids, + rxq_idx, fqid); + if (!dpaa_fq_is_in_kernel(fqid, fif)) { + char reason_msg[128]; + char result_msg[128]; + + sprintf(reason_msg, + "NOT handled in kernel"); + sprintf(result_msg, + "will DRAIN kernel pool!"); + DPAA_PMD_WARN("Traffic to FQ(%08x)(%s) %s", + fqid, reason_msg, result_msg); } + } - if (fif->is_shared_mac && - !fmc->scheme[idx].override_storage_profile) { - DPAA_PMD_ERR("RXQ to DPDK must be associated with VSP on sharemac!"); - return -1; - } + return 0; + } - if (fif->is_shared_mac && - fmc->scheme[idx].override_storage_profile && - fmc->scheme[idx].storage_profile.direct && - fmc->scheme[idx].storage_profile - .profile_select.direct_relative_profile_id == - fif->base_profile_id) { - DPAA_PMD_ERR("RXQ can't be associated with default VSP on sharemac!"); + if (e_IOC_FM_PCD_DONE != scheme->next_engine) { + /** Do nothing.*/ + DPAA_PMD_DEBUG("Will parse scheme[%d]'s next engine(%d)", + scheme_idx, scheme->next_engine); + return 0; + } - return -1; - } + for (i = 0; i < num_rxq; i++) { + fqid = scheme->base_fqid + i; + found = 0; - if ((*rxq_idx) >= max_nb_rxq) { - DPAA_PMD_DEBUG("Too many queues in FMC policy" - "%d overflow %d", - (*rxq_idx), max_nb_rxq); + if (dpaa_fq_is_in_kernel(fqid, fif)) { + DPAA_PMD_WARN("FQ(0x%08x) is handled in kernel.", + fqid); + /** The FQ may be allocated from previous CC or scheme, + * remove it. + */ + dpaa_fmc_remove_fq_from_allocated(fqids, + rxq_idx, fqid); + continue; + } - continue; - } + if ((*rxq_idx) >= max_nb_rxq) { + DPAA_PMD_WARN("Too many queues(%d) >= MAX number(%d)", + (*rxq_idx), max_nb_rxq); - for (k = 0; k < (*rxq_idx); k++) { - if (fqids[k] == fqid) { - found = 1; - break; - } - } + break; + } - if (found) - continue; - fqids[(*rxq_idx)] = fqid; - if (fmc->scheme[idx].override_storage_profile) { - if (fmc->scheme[idx].storage_profile.direct) { - vspids[(*rxq_idx)] = - fmc->scheme[idx].storage_profile - .profile_select - .direct_relative_profile_id; - } else { - vspids[(*rxq_idx)] = -1; - } - } else { - vspids[(*rxq_idx)] = -1; + for (k = 0; k < (*rxq_idx); k++) { + if (fqids[k] == fqid) { + found = 1; + break; } - (*rxq_idx)++; } + + if (found) + continue; + fqids[(*rxq_idx)] = fqid; + vspids[(*rxq_idx)] = vsp_id; + + (*rxq_idx)++; } - return 0; + return (*rxq_idx) - rxq_idx_start; } -static int dpaa_port_fmc_ccnode_parse(struct fman_if *fif, - const struct fmc_model_t *fmc_model, - int apply_idx, - uint16_t *rxq_idx, int max_nb_rxq, - uint32_t *fqids, int8_t *vspids) +static int +dpaa_port_fmc_ccnode_parse(struct fman_if *fif, + const struct fmc_model_t *fmc, + int apply_idx, + uint16_t *rxq_idx, int max_nb_rxq, + uint32_t *fqids, int8_t *vspids) { uint16_t j, k, found = 0; const struct ioc_keys_params_t *keys_params; - uint32_t fqid, cc_idx = fmc_model->apply_order[apply_idx].index; - - keys_params = &fmc_model->ccnode[cc_idx].keys_params; + const struct ioc_fm_pcd_cc_next_engine_params_t *params; + uint32_t fqid, cc_idx = fmc->apply_order[apply_idx].index; + uint32_t rxq_idx_start = *rxq_idx; + uint8_t vsp_id; - if ((*rxq_idx) >= max_nb_rxq) { - DPAA_PMD_WARN("Too many queues in FMC policy %d overflow %d", - (*rxq_idx), max_nb_rxq); - - return 0; - } + keys_params = &fmc->ccnode[cc_idx].keys_params; for (j = 0; j < keys_params->num_of_keys; ++j) { + if ((*rxq_idx) >= max_nb_rxq) { + DPAA_PMD_WARN("Too many queues(%d) >= MAX number(%d)", + (*rxq_idx), max_nb_rxq); + + break; + } found = 0; - fqid = keys_params->key_params[j].cc_next_engine_params - .params.enqueue_params.new_fqid; + params = &keys_params->key_params[j].cc_next_engine_params; /* We read DPDK queue from last classification rule present in * FMC policy file. Hence, this check is required here. @@ -344,15 +463,30 @@ static int dpaa_port_fmc_ccnode_parse(struct fman_if *fif, * have userspace queue so that it can be used by DPDK * application. */ - if (keys_params->key_params[j].cc_next_engine_params - .next_engine != e_IOC_FM_PCD_DONE) { - DPAA_PMD_WARN("FMC CC next engine not support"); + if (params->next_engine != e_IOC_FM_PCD_DONE) { + DPAA_PMD_WARN("CC next engine(%d) not support", + params->next_engine); continue; } - if (keys_params->key_params[j].cc_next_engine_params - .params.enqueue_params.action != + if (params->params.enqueue_params.action != e_IOC_FM_PCD_ENQ_FRAME) continue; + + fqid = params->params.enqueue_params.new_fqid; + vsp_id = dpaa_enqueue_vsp_id(fif, + ¶ms->params.enqueue_params); + if (dpaa_fq_is_in_kernel(fqid, fif) || + dpaa_vsp_id_is_in_kernel(vsp_id, fif)) { + DPAA_PMD_DEBUG("FQ(0x%08x)/VSP(%d) is in kernel.", + fqid, vsp_id); + /** The FQ may be allocated from previous CC or scheme, + * remove it. + */ + dpaa_fmc_remove_fq_from_allocated(fqids, + rxq_idx, fqid); + continue; + } + for (k = 0; k < (*rxq_idx); k++) { if (fqids[k] == fqid) { found = 1; @@ -362,38 +496,22 @@ static int dpaa_port_fmc_ccnode_parse(struct fman_if *fif, if (found) continue; - if ((*rxq_idx) >= max_nb_rxq) { - DPAA_PMD_WARN("Too many queues in FMC policy %d overflow %d", - (*rxq_idx), max_nb_rxq); - - return 0; - } - fqids[(*rxq_idx)] = fqid; - vspids[(*rxq_idx)] = - keys_params->key_params[j].cc_next_engine_params - .params.enqueue_params - .new_relative_storage_profile_id; - - if (vspids[(*rxq_idx)] == fif->base_profile_id && - fif->is_shared_mac) { - DPAA_PMD_ERR("VSP %d can NOT be used on DPDK.", - vspids[(*rxq_idx)]); - DPAA_PMD_ERR("It is associated to skb pool of shared interface."); - return -1; - } + vspids[(*rxq_idx)] = vsp_id; + (*rxq_idx)++; } - return 0; + return (*rxq_idx) - rxq_idx_start; } -int dpaa_port_fmc_init(struct fman_if *fif, - uint32_t *fqids, int8_t *vspids, int max_nb_rxq) +int +dpaa_port_fmc_init(struct fman_if *fif, + uint32_t *fqids, int8_t *vspids, int max_nb_rxq) { int current_port = -1, ret; uint16_t rxq_idx = 0; - const struct fmc_model_t *fmc_model; + const struct fmc_model_t *fmc; uint32_t i; if (!g_fmc_model) { @@ -402,14 +520,14 @@ int dpaa_port_fmc_init(struct fman_if *fif, if (!fp) { DPAA_PMD_ERR("%s not exists", FMC_FILE); - return -1; + return -ENOENT; } g_fmc_model = rte_malloc(NULL, sizeof(struct fmc_model_t), 64); if (!g_fmc_model) { DPAA_PMD_ERR("FMC memory alloc failed"); fclose(fp); - return -1; + return -ENOBUFS; } bytes_read = fread(g_fmc_model, @@ -419,25 +537,28 @@ int dpaa_port_fmc_init(struct fman_if *fif, fclose(fp); rte_free(g_fmc_model); g_fmc_model = NULL; - return -1; + return -EIO; } fclose(fp); } - fmc_model = g_fmc_model; + fmc = g_fmc_model; - if (fmc_model->format_version != FMC_OUTPUT_FORMAT_VER) - return -1; + if (fmc->format_version != FMC_OUTPUT_FORMAT_VER) { + DPAA_PMD_ERR("FMC version(0x%08x) != Supported ver(0x%08x)", + fmc->format_version, FMC_OUTPUT_FORMAT_VER); + return -EINVAL; + } - for (i = 0; i < fmc_model->apply_order_count; i++) { - switch (fmc_model->apply_order[i].type) { + for (i = 0; i < fmc->apply_order_count; i++) { + switch (fmc->apply_order[i].type) { case fmcengine_start: break; case fmcengine_end: break; case fmcport_start: current_port = dpaa_port_fmc_port_parse(fif, - fmc_model, i); + fmc, i); break; case fmcport_end: break; @@ -445,24 +566,24 @@ int dpaa_port_fmc_init(struct fman_if *fif, if (current_port < 0) break; - ret = dpaa_port_fmc_scheme_parse(fif, fmc_model, - i, &rxq_idx, - max_nb_rxq, - fqids, vspids); - if (ret) - return ret; + ret = dpaa_port_fmc_scheme_parse(fif, fmc, + i, &rxq_idx, max_nb_rxq, fqids, vspids); + DPAA_PMD_INFO("%s %d RXQ(s) from scheme[%d]", + ret >= 0 ? "Alloc" : "Remove", + ret >= 0 ? ret : -ret, + fmc->apply_order[i].index); break; case fmcccnode: if (current_port < 0) break; - ret = dpaa_port_fmc_ccnode_parse(fif, fmc_model, - i, &rxq_idx, - max_nb_rxq, fqids, - vspids); - if (ret) - return ret; + ret = dpaa_port_fmc_ccnode_parse(fif, fmc, + i, &rxq_idx, max_nb_rxq, fqids, vspids); + DPAA_PMD_INFO("%s %d RXQ(s) from cc[%d]", + ret >= 0 ? "Alloc" : "Remove", + ret >= 0 ? ret : -ret, + fmc->apply_order[i].index); break; case fmchtnode: diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index c15538116d..bbccd2a89b 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -693,13 +693,26 @@ dpaa_rx_cb_atomic(void *event, } #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER -static inline void dpaa_eth_err_queue(struct dpaa_if *dpaa_intf) +static inline void +dpaa_eth_err_queue(struct qman_fq *fq) { struct rte_mbuf *mbuf; struct qman_fq *debug_fq; int ret, i; struct qm_dqrr_entry *dq; struct qm_fd *fd; + struct dpaa_if *dpaa_intf; + + dpaa_intf = fq->dpaa_intf; + if (fq != &dpaa_intf->rx_queues[0]) { + /** Associate error queues to the first RXQ.*/ + return; + } + + if (dpaa_intf->cfg->fman_if->is_shared_mac) { + /** Error queues of shared MAC are handled in kernel. */ + return; + } if (unlikely(!RTE_PER_LCORE(dpaa_io))) { ret = rte_dpaa_portal_init((void *)0); @@ -708,7 +721,7 @@ static inline void dpaa_eth_err_queue(struct dpaa_if *dpaa_intf) return; } } - for (i = 0; i <= DPAA_DEBUG_FQ_TX_ERROR; i++) { + for (i = 0; i < DPAA_DEBUG_FQ_MAX_NUM; i++) { debug_fq = &dpaa_intf->debug_queues[i]; ret = qman_set_vdq(debug_fq, 4, QM_VDQCR_EXACT); if (ret) @@ -751,8 +764,7 @@ uint16_t dpaa_eth_queue_rx(void *q, rte_dpaa_bpid_info = fq->bp_array; #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER - if (fq->fqid == ((struct dpaa_if *)fq->dpaa_intf)->rx_queues[0].fqid) - dpaa_eth_err_queue((struct dpaa_if *)fq->dpaa_intf); + dpaa_eth_err_queue(fq); #endif if (likely(fq->is_static)) From patchwork Thu Aug 1 10:53:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142828 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BCF7E45710; Thu, 1 Aug 2024 12:54:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 29C16433C9; Thu, 1 Aug 2024 12:53:45 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012045.outbound.protection.outlook.com [52.101.66.45]) by mails.dpdk.org (Postfix) with ESMTP id 07A2B4337C for ; Thu, 1 Aug 2024 12:53:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bcwcUzkL9OrPXOpWks2cs34f/2dmXDVmEiys+Qxyyu9mLdNXHriEE1sumWTgSBs92HjyNFLZLFQ+QABBrHCfD2jTngYgyWCdorPVtmHkUOoNQnZA3kJdnMFfSEAlgZ0w2vog4cJgxM7Fv8kJqbQIEs6hrSfNdLcDXdeYdSy7SxkMMiLIJAbBf23h8JevzhEejQx3kU1apkWPpeeg6MTPerLM4GOgP+C6SDGisrdvxWE6df/221fBefb5+PrXulk5nKGWtzmOGr7vx1iXNdQch+mQYrnFO2Z5U46Q9tAYw7VTsjeC2EYX8JLHsJdMxsQ+S+vIBu//pB+5M+A8dISXvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=6v9BuGIO0WhlUeIA/ERmblOVPAQjM+MK8dftwF7SJWg=; b=i1bSXD1bQPW7dbZvnfeGnPCTxH0S4VK/dUtaS3WgeboQkgxp2fMToZNIfykKgOw/7GXdCowJABbdBTUHTnjoqc7luknnSBl82rNSjlSKid+K+BE1hhW5jp8xCdVzB50+s0cVYhSbQ7gUVn7YH71jCNueWyXAM9P9uXvLxRUYlVIrl9lz5Xy7HRoLfwvYp+5RYosKo02S4l8KBw4lV3+FGYCh4ogq1FNfh/3ZNdT3Qqd0rAV8I3xGjLWoQscf+2cuKXbpQYyKLTmz0gZWCmWgHtDcNBpEIjDjQeEnNck9KKBIEXNkLZ02WFHWWykdx8kpOwokIIOTIByAxVSgNdnUqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6v9BuGIO0WhlUeIA/ERmblOVPAQjM+MK8dftwF7SJWg=; b=G5MlS52LZtK6/kmpEoLpGtbxVF94VR7BVUZqw/w5UKm49TvGP1kb8oNnIgfv3BcCK3ZON44d2/avVQzjCT8DP5Z59COtTuKJrbIYU+KdpPJHBzIKoT3POKk4E05RCjm214Kz8fnPqEal7XjG5ABr943fx5jz6Q200FZwDeOZ1JSmMXy/zEJHejbHLZPUsXabgYrt2I+LvEfwWYjaOQ4JN5wdEei+HetbbFEw/ZIPi1b4XeTphoDDWIETxxw70nZFBWlPvYfEbhJ/+sFhkFuXNoRjJL7zDssjGGeDbh8DjsUqlNQgRetUvyTCEqlU7M4BD3Kz/qDpDlEw4nP53ERbdg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:39 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:39 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Vanshika Shukla Subject: [PATCH 08/17] net/dpaa: support Rx/Tx timestamp read Date: Thu, 1 Aug 2024 16:23:04 +0530 Message-Id: <20240801105313.630280-9-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 930142ac-052d-4324-d6c0-08dcb2183361 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 4a3VAuXyaMrRqQvTG8JOUsb7iO2qOYtG/iB7pBYvgJ3noo5guZ5dgOkS6Nj0LmQcjccLIp7nv0+M4STyr+QZIPyD8Z78mIY9Ki0VmTOCjCg9Agq/4HT87dj4gchIj/oxLOMZi4iJla1hfjAKsFxkAwQbhLGbaNSy7E3A+C8f2joSlUxX8tIgHE/YEmclE7MXF0nCSW+GfIKwH4yZdQuuB2SWnpIUqmcT8hEjOdlYqh3T/6a80x2F66MV0cmT7k86VrKXw6wdzPvcLPZEhkkg7rvGg6Fyb/6VSY0LbKNq2QWqwhstefAqUdB9ks0byX1oZ9tAgFwG2pv0gucBmtlSGt6NwlTOc8ZlJrFb5XFpviinvvPpeZrWyr/S3HeJ6iEXI0+aCxdWiztUEwRaLEEs6C5cnt/4lcdvftbHK/BLKonU8AEU96GKElJhf3YumLranAfwI2rTSHmA+hdITw6zFib8Y4IwI0igkvPZSh+uu+JHkpv0VGWH92xaQSyvk2RqJKM5UO8jRCM4Ucv2F+P4sVB5Wc/ZP+hI053RgoMxH1gc1zHo2QQQqLsSwNouZRTHH6uFmb0odVj7SdcpZhJZef4/EkcMmHRMYxKezos/uFJpQmSoAlsqDXBnrVebGzm9fOHcUAk67mZZJEk6sqJvVxjuYkKFMRQL9n6WgCpXT0177pU5L7fUZfG2JtWzYtoq7oBx/SuJjtq5NelQmiYxA2uhFNcImqYB0J3a9zdKwx8v5/QAXrM/vz5GeyT8IpTFIHJJ4gLycRFNaC57qgc+i5WA8olC+N8gVL1tvL/6jGDG07/6DPIIp9Q7E9nX59EAb1pFwphUK8kfwrruArmDdonuDSGyM1NUfW6bMg3k906kBY71Cc3v9oguzX3QOWhxfVO6K/98a9DaSGgifl/kfK7G/XYCx7R6gHH8wO/UWa2kHFfAoYhXGINpbvX0YFbuG4yOSTKNVfiQVEb/1tA89Fhp10xrpVQrpaBChp6HTG4aCQOrxWXQYLVukER0QnnJxpFTERPX0vf/G5xrRx7uqTRhdyb2IQPAhDps5j3JMgjfDS6gdyANkXEWizQz7e8tKtenHA7ZjJjK4jBvXjVC3GWj44kcvfqhzzAXKv5bRaBzqVyny4C9kEiBUe3I1dh4XkU2eQEloOHAnhj0G2SUBSMFEFm9fbCT2KBbufdDZ50fpMJ37wvYgvEVeVHeRhBHFNKVrD1db1vIX47Og4CEtty85IikqWgoxNwMdJaVNHcQjsBCuldqkRpnXZgZiEXDjX13lieJ0e3keeiYzY6Kj2CJtIKom1JXOVgvvZjBIDNKZKZ+78pxlOZSeczc5RUO5I2TiyCeZ5j7KuLzaqVPPSlOil0p6aVk2zF3T8Y347s37b9HiQeWrSPgikKPTd77HTg3luYun4IdCm7YgPcNLg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zr4SBFqQfEnHo/EtP9on/yg1rUnZvFLTN0pf52SBX4oAFKZBF5eY1xsz4GLnGC+m+K74TjQHYzRIx8LJvBx5X+QbxQmjoO2Xt4aHPAJCrV+pcuY58QRi0Ok4Iqw2NP/mndKdb4o1rdewVAqupTrBKCapts+pq7B5xqhkzcAH66bfwhxOH3h5TFeXkw2OeFCuPnB0y+MXAzDsldRXJvo4tGYr/q59+1h3bnhXEoaaE124bNOom20v5+IlMLTAd64Pg8A6F3Z8mDzQycyei3iAouIbSZ7zKeEXbg+X/DLHwnGdreGbEWwscsqhn5Zw73lrcgFiG060UYuM9RUR4ikmBFZI620ClTk532oPparNUxQAYbXc9fIBFloBpWNCgr4sih/tLZqZ50w8oyy75oIHKM9du0gYaUCHc7sBSzHY9U0BwxjbWA17BuiGjT0XRAejScdfSehsyOhJuLF+QKof3VBaAB8RTFjg4oMMOGhea0ajgQbabWzEbxBUGdvVwif8lNGt4rFkUL5qWkRJELTUP4RfHLiQkT8ug2oKa289aXXrpsFtK8em6muN2yZyGNXvEaELfWqKz/tPN7I86LkuNN9gAU7KUFHeOw6Dvv1l/r4WdxXPeusyRUdc2nGB2HoJPGYl79m1MdtrfoWyAzeE8sdOa7hwmvbTmh0cRUnTDfpObUO6a4HmyFmwUVxR9l2a+bkT5VsakoarPPjRIdae1QJtLUEq0eiIOvyZg/ZXuZU7fvvP6oO+85lJLONIiE0ucDhJREiYeUo5cZxNQb6pNJkIrWqKcRR881D2MTfbojc/muhTTXI4E+C37Vtic4+VoGuy3RlQ77qiJfLtXsNsvpinJtGge3NSuWC9M24c4X3etgWjEgYmv9Knl3HpMMuWeUEHb3KcvoXZzJi7CSj1JSsDK5awQ2FT0W722BU4CjnBS7dEl8wZdfO5SvZ+5GGiM7jfiY5t1mdQw4mzx2NvBVKFD+Jcnuos64dF8JqvFlQR9KbgIBL46hSDaj5OJmfmJxsmNAPhZJsZUH/ySzIVC2Vlv8X5RsBHhyEdJq/x4A9uOrayUhMZ+tk5ioE+UcJQPaTekfxViHqwnqyDmF63DTkNjv6TEZ/uHgENHDuZlbBTaqJBkscYHXWPoE9wFbo3FfqL0Ii8eKfQ1vJUBdavoc/4giQVMOEieZzLaFLsBF4eXN9NRRRfAF7etdnNt3QT37k71rWdjTKZzX7FNwTPP+nbojO22/61y+kbJhgpVh1IreY/u3t7QtqTr/Af2UWDyQND1qoYZBmTjx87agrfqNkj8ZsC8CfAu0Q5zN2N34UWjk4RhbYmcMu7oFaXFw0fT3iqocvmvp/XNqXVXpcUNxMOQrUls78+dfui6Xh3VtUcfeOgtb73zUJPEfIXp8v1jfvl+SodGdi6avnxwDMYG12XDgGtjAJvKEpEMFFqOMmD5F/C84HToOhHxKpPahFZTNpJ9qPM2T8ZMBQzPFqhTIYeahdmJDJtOGm8bwEcM/52Qpxwh0+HzuglNUKNnmhH8JgTM6iAYrXhZEYOSIFWzknlRZOTVCbZ7P5cbtdAxwAC+ABWTKIlKUY2eNQagJ7nag7F6p6vGNzKWCtqL2CNtQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 930142ac-052d-4324-d6c0-08dcb2183361 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:39.3343 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QJVzD4s6/5ZQ9vopqwbWXlsGObJMgaKMB4vqPnP5odJ8rASW8Q/G80QXCFrXp/ofI+UG2dJRJNXZ/aKhvnucxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Vanshika Shukla This patch implements Rx/Tx timestamp read operations for DPAA1 platform. Signed-off-by: Vanshika Shukla --- drivers/bus/dpaa/base/fman/fman.c | 21 +++++++- drivers/bus/dpaa/base/fman/fman_hw.c | 6 ++- drivers/bus/dpaa/include/fman.h | 18 ++++++- drivers/net/dpaa/dpaa_ethdev.c | 6 ++- drivers/net/dpaa/dpaa_ethdev.h | 19 ++++++- drivers/net/dpaa/dpaa_ptp.c | 43 +++++++++++++++ drivers/net/dpaa/dpaa_rxtx.c | 79 +++++++++++++++++++++++----- drivers/net/dpaa/dpaa_rxtx.h | 4 +- drivers/net/dpaa/meson.build | 1 + 9 files changed, 178 insertions(+), 19 deletions(-) create mode 100644 drivers/net/dpaa/dpaa_ptp.c diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index bf41a3ed96..89786636d9 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2010-2016 Freescale Semiconductor Inc. - * Copyright 2017-2020 NXP + * Copyright 2017-2024 NXP * */ @@ -520,6 +520,25 @@ fman_if_init(const struct device_node *dpa_node) goto err; } + regs_addr = of_get_address(tx_node, 0, &__if->regs_size, NULL); + if (!regs_addr) { + FMAN_ERR(-EINVAL, "of_get_address(%s)\n", mname); + goto err; + } + phys_addr = of_translate_address(tx_node, regs_addr); + if (!phys_addr) { + FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)\n", + mname, regs_addr); + goto err; + } + __if->tx_bmi_map = mmap(NULL, __if->regs_size, + PROT_READ | PROT_WRITE, MAP_SHARED, + fman_ccsr_map_fd, phys_addr); + if (__if->tx_bmi_map == MAP_FAILED) { + FMAN_ERR(-errno, "mmap(0x%"PRIx64")\n", phys_addr); + goto err; + } + /* No channel ID for MAC-less */ assert(lenp == sizeof(*tx_channel_id)); na = of_n_addr_cells(mac_node); diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index 27b39a4975..466709bfc9 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright 2017,2020 NXP + * Copyright 2017,2020,2022 NXP * */ @@ -564,6 +564,10 @@ fman_if_set_ic_params(struct fman_if *fm_if, &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_ricp; out_be32(fmbm_ricp, val); + unsigned int *fmbm_ticp = + &((struct tx_bmi_regs *)__if->tx_bmi_map)->fmbm_ticp; + out_be32(fmbm_ticp, val); + return 0; } diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 3642b43be7..857eef3d2f 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -2,7 +2,7 @@ * * Copyright 2010-2012 Freescale Semiconductor, Inc. * All rights reserved. - * Copyright 2019-2021 NXP + * Copyright 2019-2022 NXP * */ @@ -292,6 +292,21 @@ struct rx_bmi_regs { uint32_t fmbm_rdbg; /**< Rx Debug-*/ }; +struct tx_bmi_regs { + uint32_t fmbm_tcfg; /**< Tx Configuration*/ + uint32_t fmbm_tst; /**< Tx Status*/ + uint32_t fmbm_tda; /**< Tx DMA attributes*/ + uint32_t fmbm_tfp; /**< Tx FIFO Parameters*/ + uint32_t fmbm_tfed; /**< Tx Frame End Data*/ + uint32_t fmbm_ticp; /**< Tx Internal Context Parameters*/ + uint32_t fmbm_tfdne; /**< Tx Frame Dequeue Next Engine*/ + uint32_t fmbm_tfca; /**< Tx Frame Attributes*/ + uint32_t fmbm_tcfqid; /**< Tx Confirmation Frame Queue ID*/ + uint32_t fmbm_tefqid; /**< Tx Error Frame Queue ID*/ + uint32_t fmbm_tfene; /**< Tx Frame Enqueue Next Engine*/ + uint32_t fmbm_trlmts; /**< Tx Rate Limiter Scale*/ + uint32_t fmbm_trlmt; /**< Tx Rate Limiter*/ +}; struct fman_port_qmi_regs { uint32_t fmqm_pnc; /**< PortID n Configuration Register */ uint32_t fmqm_pns; /**< PortID n Status Register */ @@ -380,6 +395,7 @@ struct __fman_if { uint64_t regs_size; void *ccsr_map; void *bmi_map; + void *tx_bmi_map; void *qmi_map; struct list_head node; }; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index e3cb15cad5..f7cd7c0d33 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017-2020 NXP + * Copyright 2017-2020,2022 NXP * */ /* System headers */ @@ -1670,6 +1670,10 @@ static struct eth_dev_ops dpaa_devops = { .rx_queue_intr_disable = dpaa_dev_queue_intr_disable, .rss_hash_update = dpaa_dev_rss_hash_update, .rss_hash_conf_get = dpaa_dev_rss_hash_conf_get, +#if defined(RTE_LIBRTE_IEEE1588) + .timesync_read_rx_timestamp = dpaa_timesync_read_rx_timestamp, + .timesync_read_tx_timestamp = dpaa_timesync_read_tx_timestamp, +#endif }; static bool diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index df179b18e8..389157fa10 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2014-2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017-2021 NXP + * Copyright 2017-2022 NXP * */ #ifndef __DPAA_ETHDEV_H__ @@ -150,6 +150,14 @@ struct dpaa_if { void *netenv_handle; void *scheme_handle[2]; uint32_t scheme_count; + /*stores timestamp of last received packet on dev*/ + uint64_t rx_timestamp; + /*stores timestamp of last received tx confirmation packet on dev*/ + uint64_t tx_timestamp; + /* stores pointer to next tx_conf queue that should be processed, + * it corresponds to last packet transmitted + */ + struct qman_fq *next_tx_conf_queue; void *vsp_handle[DPAA_VSP_PROFILE_MAX_NUM]; uint32_t vsp_bpid[DPAA_VSP_PROFILE_MAX_NUM]; @@ -232,6 +240,15 @@ struct dpaa_if_rx_bmi_stats { uint32_t fmbm_rbdc; /**< Rx Buffers Deallocate Counter*/ }; +int +dpaa_timesync_read_tx_timestamp(struct rte_eth_dev *dev, + struct timespec *timestamp); + +int +dpaa_timesync_read_rx_timestamp(struct rte_eth_dev *dev, + struct timespec *timestamp, + uint32_t flags __rte_unused); + /* PMD related logs */ extern int dpaa_logtype_pmd; #define RTE_LOGTYPE_DPAA_PMD dpaa_logtype_pmd diff --git a/drivers/net/dpaa/dpaa_ptp.c b/drivers/net/dpaa/dpaa_ptp.c new file mode 100644 index 0000000000..df6df1ddf2 --- /dev/null +++ b/drivers/net/dpaa/dpaa_ptp.c @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2022-2024 NXP + */ + +/* System headers */ +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +int dpaa_timesync_read_tx_timestamp(struct rte_eth_dev *dev, + struct timespec *timestamp) +{ + struct dpaa_if *dpaa_intf = dev->data->dev_private; + + if (dpaa_intf->next_tx_conf_queue) { + while (!dpaa_intf->tx_timestamp) + dpaa_eth_tx_conf(dpaa_intf->next_tx_conf_queue); + } else { + return -1; + } + *timestamp = rte_ns_to_timespec(dpaa_intf->tx_timestamp); + + return 0; +} + +int dpaa_timesync_read_rx_timestamp(struct rte_eth_dev *dev, + struct timespec *timestamp, + uint32_t flags __rte_unused) +{ + struct dpaa_if *dpaa_intf = dev->data->dev_private; + *timestamp = rte_ns_to_timespec(dpaa_intf->rx_timestamp); + return 0; +} + diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index bbccd2a89b..44d9bc1adb 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017,2019-2021 NXP + * Copyright 2017,2019-2022 NXP * */ @@ -49,7 +49,6 @@ #define DPAA_MBUF_TO_CONTIG_FD(_mbuf, _fd, _bpid) \ do { \ - (_fd)->cmd = 0; \ (_fd)->opaque_addr = 0; \ (_fd)->opaque = QM_FD_CONTIG << DPAA_FD_FORMAT_SHIFT; \ (_fd)->opaque |= ((_mbuf)->data_off) << DPAA_FD_OFFSET_SHIFT; \ @@ -122,7 +121,10 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) { struct annotations_t *annot = GET_ANNOTATIONS(fd_virt_addr); uint64_t prs = *((uintptr_t *)(&annot->parse)) & DPAA_PARSE_MASK; - +#if defined(RTE_LIBRTE_IEEE1588) + struct rte_ether_hdr *eth_hdr = + rte_pktmbuf_mtod(m, struct rte_ether_hdr *); +#endif DPAA_DP_LOG(DEBUG, " Parsing mbuf: %p with annotations: %p", m, annot); m->ol_flags = RTE_MBUF_F_RX_RSS_HASH | RTE_MBUF_F_RX_IP_CKSUM_GOOD | @@ -241,6 +243,12 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) if (prs & DPAA_PARSE_VLAN_MASK) m->ol_flags |= RTE_MBUF_F_RX_VLAN; /* Packet received without stripping the vlan */ +#if defined(RTE_LIBRTE_IEEE1588) + if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_1588)) { + m->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP; + m->ol_flags |= RTE_MBUF_F_RX_IEEE1588_TMST; + } +#endif } static inline void dpaa_checksum(struct rte_mbuf *mbuf) @@ -317,7 +325,7 @@ static inline void dpaa_checksum_offload(struct rte_mbuf *mbuf, prs->ip_off[0] = mbuf->l2_len; prs->l4_off = mbuf->l3_len + mbuf->l2_len; /* Enable L3 (and L4, if TCP or UDP) HW checksum*/ - fd->cmd = DPAA_FD_CMD_RPD | DPAA_FD_CMD_DTC; + fd->cmd |= DPAA_FD_CMD_RPD | DPAA_FD_CMD_DTC; } static inline void @@ -513,6 +521,9 @@ dpaa_rx_cb_no_prefetch(struct qman_fq **fq, struct qm_dqrr_entry **dqrr, uint16_t offset, i; uint32_t length; uint8_t format; +#if defined(RTE_LIBRTE_IEEE1588) + struct annotations_t *annot; +#endif bp_info = DPAA_BPID_TO_POOL_INFO(dqrr[0]->fd.bpid); ptr = rte_dpaa_mem_ptov(qm_fd_addr(&dqrr[0]->fd)); @@ -554,6 +565,10 @@ dpaa_rx_cb_no_prefetch(struct qman_fq **fq, struct qm_dqrr_entry **dqrr, rte_mbuf_refcnt_set(mbuf, 1); dpaa_eth_packet_info(mbuf, mbuf->buf_addr); dpaa_display_frame_info(fd, fq[0]->fqid, true); +#if defined(RTE_LIBRTE_IEEE1588) + annot = GET_ANNOTATIONS(mbuf->buf_addr); + dpaa_intf->rx_timestamp = rte_cpu_to_be_64(annot->timestamp); +#endif } } @@ -567,6 +582,9 @@ dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry **dqrr, uint16_t offset, i; uint32_t length; uint8_t format; +#if defined(RTE_LIBRTE_IEEE1588) + struct annotations_t *annot; +#endif for (i = 0; i < num_bufs; i++) { fd = &dqrr[i]->fd; @@ -594,6 +612,10 @@ dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry **dqrr, rte_mbuf_refcnt_set(mbuf, 1); dpaa_eth_packet_info(mbuf, mbuf->buf_addr); dpaa_display_frame_info(fd, fq[0]->fqid, true); +#if defined(RTE_LIBRTE_IEEE1588) + annot = GET_ANNOTATIONS(mbuf->buf_addr); + dpaa_intf->rx_timestamp = rte_cpu_to_be_64(annot->timestamp); +#endif } } @@ -758,6 +780,10 @@ uint16_t dpaa_eth_queue_rx(void *q, uint32_t num_rx = 0, ifid = ((struct dpaa_if *)fq->dpaa_intf)->ifid; int num_rx_bufs, ret; uint32_t vdqcr_flags = 0; +#if defined(RTE_LIBRTE_IEEE1588) + struct annotations_t *annot; + struct dpaa_if *dpaa_intf = fq->dpaa_intf; +#endif if (unlikely(rte_dpaa_bpid_info == NULL && rte_eal_process_type() == RTE_PROC_SECONDARY)) @@ -800,6 +826,10 @@ uint16_t dpaa_eth_queue_rx(void *q, continue; bufs[num_rx++] = dpaa_eth_fd_to_mbuf(&dq->fd, ifid); dpaa_display_frame_info(&dq->fd, fq->fqid, true); +#if defined(RTE_LIBRTE_IEEE1588) + annot = GET_ANNOTATIONS(bufs[num_rx - 1]->buf_addr); + dpaa_intf->rx_timestamp = rte_cpu_to_be_64(annot->timestamp); +#endif qman_dqrr_consume(fq, dq); } while (fq->flags & QMAN_FQ_STATE_VDQCR); @@ -1110,6 +1140,12 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) DPAA_DP_LOG(DEBUG, "Transmitting %d buffers on queue: %p", nb_bufs, q); +#if defined(RTE_LIBRTE_IEEE1588) + dpaa_intf->next_tx_conf_queue = fq_txconf; + dpaa_eth_tx_conf(fq_txconf); + dpaa_intf->tx_timestamp = 0; +#endif + while (nb_bufs) { frames_to_send = (nb_bufs > DPAA_TX_BURST_SIZE) ? DPAA_TX_BURST_SIZE : nb_bufs; @@ -1122,6 +1158,14 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) if (dpaa_svr_family == SVR_LS1043A_FAMILY && (mbuf->data_off & 0x7F) != 0x0) realloc_mbuf = 1; + + fd_arr[loop].cmd = 0; +#if defined(RTE_LIBRTE_IEEE1588) + fd_arr[loop].cmd |= DPAA_FD_CMD_FCO | + qman_fq_fqid(fq_txconf); + fd_arr[loop].cmd |= DPAA_FD_CMD_RPD | + DPAA_FD_CMD_UPD; +#endif seqn = *dpaa_seqn(mbuf); if (seqn != DPAA_INVALID_MBUF_SEQN) { index = seqn - 1; @@ -1179,10 +1223,6 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) mbuf = temp_mbuf; realloc_mbuf = 0; } - -#if defined(RTE_LIBRTE_IEEE1588) - fd_arr[loop].cmd |= DPAA_FD_CMD_FCO | qman_fq_fqid(fq_txconf); -#endif indirect_buf: state = tx_on_dpaa_pool(mbuf, bp_info, &fd_arr[loop], @@ -1211,10 +1251,6 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) sent += frames_to_send; } -#if defined(RTE_LIBRTE_IEEE1588) - dpaa_eth_tx_conf(fq_txconf); -#endif - DPAA_DP_LOG(DEBUG, "Transmitted %d buffers on queue: %p", sent, q); for (loop = 0; loop < free_count; loop++) { @@ -1232,6 +1268,12 @@ dpaa_eth_tx_conf(void *q) struct qm_dqrr_entry *dq; int num_tx_conf, ret, dq_num; uint32_t vdqcr_flags = 0; + struct dpaa_if *dpaa_intf = fq->dpaa_intf; + struct qm_dqrr_entry *dqrr; + struct dpaa_bp_info *bp_info; + struct rte_mbuf *mbuf; + void *ptr; + struct annotations_t *annot; if (unlikely(rte_dpaa_bpid_info == NULL && rte_eal_process_type() == RTE_PROC_SECONDARY)) @@ -1256,7 +1298,20 @@ dpaa_eth_tx_conf(void *q) dq = qman_dequeue(fq); if (!dq) continue; + dqrr = dq; dq_num++; + bp_info = DPAA_BPID_TO_POOL_INFO(dqrr->fd.bpid); + ptr = rte_dpaa_mem_ptov(qm_fd_addr(&dqrr->fd)); + rte_prefetch0((void *)((uint8_t *)ptr + + DEFAULT_RX_ICEOF)); + mbuf = (struct rte_mbuf *) + ((char *)ptr - bp_info->meta_data_size); + + if (mbuf->ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST) { + annot = GET_ANNOTATIONS(mbuf->buf_addr); + dpaa_intf->tx_timestamp = + rte_cpu_to_be_64(annot->timestamp); + } dpaa_display_frame_info(&dq->fd, fq->fqid, true); qman_dqrr_consume(fq, dq); dpaa_free_mbuf(&dq->fd); diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h index 042602e087..1048e86d41 100644 --- a/drivers/net/dpaa/dpaa_rxtx.h +++ b/drivers/net/dpaa/dpaa_rxtx.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017,2020-2021 NXP + * Copyright 2017,2020-2022 NXP * */ @@ -260,7 +260,7 @@ struct dpaa_eth_parse_results_t { struct annotations_t { uint8_t reserved[DEFAULT_RX_ICEOF]; struct dpaa_eth_parse_results_t parse; /**< Pointer to Parsed result*/ - uint64_t reserved1; + uint64_t timestamp; uint64_t hash; /**< Hash Result */ }; diff --git a/drivers/net/dpaa/meson.build b/drivers/net/dpaa/meson.build index 42e1f8c2e2..239858adda 100644 --- a/drivers/net/dpaa/meson.build +++ b/drivers/net/dpaa/meson.build @@ -14,6 +14,7 @@ sources = files( 'dpaa_flow.c', 'dpaa_rxtx.c', 'dpaa_fmc.c', + 'dpaa_ptp.c', ) if cc.has_argument('-Wno-pointer-arith') From patchwork Thu Aug 1 10:53:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142829 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9071945710; Thu, 1 Aug 2024 12:54:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55414433B5; Thu, 1 Aug 2024 12:53:46 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012045.outbound.protection.outlook.com [52.101.66.45]) by mails.dpdk.org (Postfix) with ESMTP id 22779433BE for ; Thu, 1 Aug 2024 12:53:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wh3tI66M/Ms2QX5lKky40mMtJUdRAvc/ELz3rWZcrK0izqo4APQq9tjuCz02QXJOn/2oIX78kBex3EJKxdx58ENyo5FObsTux6OZ6lMe0vz5d3NG8/qauG85w+Oa8IocdhazYmvjLL3oQx938cWiWVJRrdlDguuScwlGFCo8ndEVed8rrdtep1tWAaScnUEEVjmb5fqHQTYR9TZ/5uyPZ5oWie0aoxTqxKUjM0owh1DEpMvLUZhLe+YYsziULvoBs7cMCiabX48fwBfPrjiFr7QcSmraeh7c3w1+JatT2JYIlgguhhmr1XwYFx8LLrKlvwcE5ZUKo1uVSW3d7JXRQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=otdhHtYXYXI8rxveH/OmMChJA3xF2P/0K5156ia0rMQ=; b=vErJ6CFIlFPXQ7aKGhdS13pT0uxBxx8CIu7dz7OSrjjAxYp+oAjXivnVY3ny49IiTaOPRxQFHRiG9q+RJgxc2cEZ97Yuh6nK8DixF99NnhRNOuiR05z4+zPVd+GLMMD3PIi2H7PKfZbe73UvJDyDsHKlKON7Du9DRXZP5P3xC6OKZ+y7Qtu6MDtpwR5q2z0fU/Z+hv5XHHm+bnhsA6XI1ii01J8gmbPKFNWgMiktaEZO87EBsMoDmtEA/EL5g67d7jSLEME5vc3DVZdzMG1+wWAaBCmqSG5nChP6aMfPOOUwdeH8JDYKk96TQuZw9TalsyDW8b2q8ogfQV54A5aVlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=otdhHtYXYXI8rxveH/OmMChJA3xF2P/0K5156ia0rMQ=; b=QSSKlA0k7XxYD+5pdaUw6Yd1IhfKCCJa27odlO61rkCHoH/Mm42/3Z7snUSTpxPVEqvU0iclOrvHBEwi1gAeGnM+JahFaFmyutChI1tijadFvvYku66+ebt9gbRFYRTUdcyDmy+46gD5wq/wFMy5kac9FB4AMLQZbur4AIoGXZZrvPl9/gm1ztHpS8ZzMhaY2eKi6Hsb9D+Pj0rs/bP8Tz2PkHqjYjLZIIdDN0rJLA4umP4e4SdFrYN4Z+ecLlxZQRUVMQvIeAg2njB1AAJL7bxM0XfzRoZGGzc41wI43aL2yA3ZvecL/JPOzJcFOxSolGmBB7dnrBhFxdJ6u39eRA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:41 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:41 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Vanshika Shukla Subject: [PATCH 09/17] net/dpaa: support IEEE 1588 PTP Date: Thu, 1 Aug 2024 16:23:05 +0530 Message-Id: <20240801105313.630280-10-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: f4781a87-5c87-4a59-6f89-08dcb218343f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: /w4dXKtmHSY13yPOaApxSdq6ccrowQx5K7+TEw5cZlLoOQ1H2fV9qnyc8bBmMUrs3J3884VOFqv68M4sLAPRQqmMuTHUu+BVX7l2STPtwwkxR/BLyX3y9Yy405k/tj5+mYz3U+CB+8Me7PH7Rl71IEbs05hI/nSau/tBTPjl01+C0ckmLlKrutQwkMoOgIh1JsGD/BGMsW62mo9yb7OaU1XvnXiHvPacdzJ/YkwSpSvds7fi9iZicby5syIUBMKeRHeuqY3CckjQZH3gQHd+QIRFEe6hg4jK5hcSrF45OGMnjJyNrBSd46I0SuJA5LG0MkEJhh8OqDC9p13L47yB8gdVAcXOTmiGOUpzCaHAC0Jgx2CGaj7gpynHp0myYNW0VmPw4rpxHK8swJpP2k40N4xXA83i8YAqJ6DGq0T4V+ocS7TWxVQL4Mocu6FOmzmgQ0WPYvW/U+KDICWluhdKMDDxvXCdrNs69Mz4Hk5EVqw+9SbHnkN6T/t+TPoQgJxaXKMq27QPmCGX+5ThSFS9vcy1uqilPvBjc3M2XDmxdLh5bYFpW5/p/jqpgsjXUt97bq1uLtqN5rdhLQJ+jCN6jYFOA6i5tqFl4VA/SXClPj/KJIViceo8FReLvqZuF2S0RnyEPBvw2FXorMjujxpAPie32E9pWbGx8e8Zm7V5KiLi2oYCOF4ldDYPoJWQK8FkplKPgSo0D6FL8aGK0jMVm5UL66vkVez9dU1TkLVPci30Q3jAlWYmDrvd4kBHDKWJ8tD2PTSEQ2Y8OkOOGlLRrwMeI51P31Kc/P7S/NHYa4b5JDIBE+9Vi1LTWi6wVNMfYCKGV0WC43v2l0Ic6izIOHKUUojCqZ+JrhD+UDmQi4dXFRS49OuLi/PHVC3ELTeKQoj+Bcf0yQlau7DcSIjrO1auePGYNuIxtFhTC8Nd29BtXv17D1vJAKtezUk8vL5+10hSuSVFDyXC8D7bKkxUEmcoUf1bsV0N0nYGqDofcDx9o2HcPhT+motbSy1qx8VDNQPLryOguji5LOkioT+PWoRphfyunUJ212RUaCSgL6ycSSm8dviRf9vyFSkTmDQ84qN5Vc51/in4qzDi2y05lLiLslAcfAHGi4v4741I82pZnH4660Xsvyhtqi56yUVY0SldigqyimGgs5jXYg8TbKFmHmv0tb4mFq1IqiaEU0ClZSsTOM5LKuSYqbCLi9rybecSd/3eP7Bt9TUMQ+QKlzDSCeL+ok6UI+n1ZT8y62K2Xd8+K5lyslX1TRnWNlk5lmdTJ6NKw4C0a2EuO1uhjhtbzLk4pdj6/vYdnInzitQQovTxlSxK37KF9aLs4YF/kHqHethNtQSnGZ9QDwt91a/G8NWcRbFMpMv4vQ76BKw3YR7L7aXqCfN56JxZj+dFVTDRG7n20rhfciuC2Qu13w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GiPHUKIWOhVP26haJwC/HtxsnfuZZLTH06lboTfGNS+6vRVD0M3PzmSEkwWuaCIiDRRKN4TSz2d5KDKA04JmynIekGP9eqh0wLbMWaDAC3urlx6xbYL6gqI5NqjUCMOa92+PbnHVpAFtFL30tVbK2efcuovUfqZiR8E+0YqRIVC6O0Ys4vNZhwijb7evz8rgefDb/lKF/bkpM2P8kPzQxkD5zYQz6+sgWGQdEaqIVcRFOI1TmCL4LqBhr7GWRpZVgFigGZeEcKmha1NWn2KKWTRBA3G5wJX98AGqWWaTkju7n3lxvocroKApN4FuGu87Hs4dhmIh2o2tIJLNvKQrWmDF/LiNhB8WucSSfdDpYF7OvMl0ha3UkX8JPph9NaRIS4k85at5rIywe/Ekm5Y8G+U0pkJ/SB92HuNFv1iNkbH7FGoBed2A89G6p38ElCVuBGrx4PNXKN/gKXB5m2y+lPt6gMzdt23O29miO4q7VKU76N125D8zODWfoxA7KKs1QVwgZEzvN0RRZm97Y0GBpHIuilPt9B2eYi/JfGiAXXtn/AEHkfirznA1L5bc986UM62RwX9IZDwNgIzoj9585EbrvHycg0JBJubN+7tqqI2BobetRkrlCnOb1/UQPCHevjjJ01/VfgFi4okhIGLwfb27c2xVUD86D+DJ0OeLRPaZGh8TC7nJsUzBCnj7BffqU4oIZekqtzTCCM+wwPiu+4rYY1ziowCAPT6fxfEFeYaqRklnRzy6gIcqldVZm+T5I3RkIYjyEERRUtXxQ9267rB4HJXjDTUHHC8ODECHw8pbH4t7bGBsrTh4qGtv8b5T0IsCRPuTYclYyBfICG62jH0vg0JBBwH1BYjKTK0D3YAslWtpuWK+vSZypHapICSHEHa9ftaqCB6FKlYO9l8KPDtiHrs4Ufa3KXh7SegqGFobRjUi4y6fcRtz9CMd3I5upwCmGEJwoIVOyMPyfu1Ul1n8258zkbTUG5vQbYrxQNl1Ilw/O9A7euSXl8ARU0d5QSoBL8MBj5AmgwhnIx9L684DmEkgbySZiOS7xA1VBHmoV/qCxnCt6DHe02mvas7/wqOc8gwN2kuXYgwEHYt/m8RedcZ9IBpBZ3K0AYu03y4fCuzxY+6oJ/S0t6DVEU8Mg2rgHzggourhatNlb61TR1eUosDL003455k3qWaOmRZ3eL3fmcytGGTM9ACUKYrDQvctTiPLndrdIdUa02clvzXDvbkEJ9jJgyqEEPRWTco8c9McXkhDxaDGHaZPx8qY7wkPf+LPkGH6vkuux5kcgcX3tjsjaNL49zWr/jzrOn++DnkoZLpRdPBKeIoqsAHZDMdMOIZKXdzTGBLTZ7y5W0GUIHHUtTZ46iW4EGcDYcHX97BAKuODHDXo5v0B43/FHca8KiZ7FjUX5UIGhThZUkf4Qc+vl8iAfgVcoWOVZTEFyACa2fbH7jYUND1ccNqeu10IGce/0lYFqDBKCcNHVqiY66copMvWhfAgpJIueOvDAWsHKlJSrbvdl+wCHAKG2uzk2FrOcPInI1kQFjx4ntOpwD1Z2wjmShzy6nh6iJe6t1HOXlq7n9/cFyvAzn/nrq/S+j/hiEXrIUag+xERZA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4781a87-5c87-4a59-6f89-08dcb218343f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:40.6683 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vBPggzUczfTKZvPssV1lgbQYbeKFwhhBTCUZrM6S3q80ZwxdAzza6HS23F/KLVdZgSvKD0zRrS4i5QuYpGzi+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Vanshika Shukla This patch adds the support for the ethdev APIs to enable/disable and read/write/adjust IEEE1588 PTP timestamps for DPAA platform. Signed-off-by: Vanshika Shukla --- doc/guides/nics/dpaa.rst | 1 + drivers/bus/dpaa/base/fman/fman.c | 15 ++++++ drivers/bus/dpaa/include/fman.h | 45 +++++++++++++++++ drivers/net/dpaa/dpaa_ethdev.c | 5 ++ drivers/net/dpaa/dpaa_ethdev.h | 16 +++++++ drivers/net/dpaa/dpaa_ptp.c | 80 ++++++++++++++++++++++++++++++- 6 files changed, 160 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst index e8402dff52..580edd9327 100644 --- a/doc/guides/nics/dpaa.rst +++ b/doc/guides/nics/dpaa.rst @@ -148,6 +148,7 @@ Features - Packet type information - Checksum offload - Promiscuous mode + - IEEE1588 PTP DPAA Mempool Driver ~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index 89786636d9..a79b0b75dd 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -28,6 +28,7 @@ u32 fman_dealloc_bufs_mask_lo; int fman_ccsr_map_fd = -1; static COMPAT_LIST_HEAD(__ifs); +void *rtc_map; /* This is the (const) global variable that callers have read-only access to. * Internally, we have read-write access directly to __ifs. @@ -539,6 +540,20 @@ fman_if_init(const struct device_node *dpa_node) goto err; } + if (!rtc_map) { + __if->rtc_map = mmap(NULL, FMAN_IEEE_1588_SIZE, + PROT_READ | PROT_WRITE, MAP_SHARED, + fman_ccsr_map_fd, FMAN_IEEE_1588_OFFSET); + if (__if->rtc_map == MAP_FAILED) { + pr_err("Can not map FMan RTC regs base\n"); + _errno = -EINVAL; + goto err; + } + rtc_map = __if->rtc_map; + } else { + __if->rtc_map = rtc_map; + } + /* No channel ID for MAC-less */ assert(lenp == sizeof(*tx_channel_id)); na = of_n_addr_cells(mac_node); diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 857eef3d2f..109c1a4a22 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -64,6 +64,12 @@ #define GROUP_ADDRESS 0x0000010000000000LL #define HASH_CTRL_ADDR_MASK 0x0000003F +#define FMAN_RTC_MAX_NUM_OF_ALARMS 3 +#define FMAN_RTC_MAX_NUM_OF_PERIODIC_PULSES 4 +#define FMAN_RTC_MAX_NUM_OF_EXT_TRIGGERS 3 +#define FMAN_IEEE_1588_OFFSET 0X1AFE000 +#define FMAN_IEEE_1588_SIZE 4096 + /* Pre definitions of FMAN interface and Bpool structures */ struct __fman_if; struct fman_if_bpool; @@ -307,6 +313,44 @@ struct tx_bmi_regs { uint32_t fmbm_trlmts; /**< Tx Rate Limiter Scale*/ uint32_t fmbm_trlmt; /**< Tx Rate Limiter*/ }; + +/* Description FM RTC timer alarm */ +struct t_tmr_alarm { + uint32_t tmr_alarm_h; + uint32_t tmr_alarm_l; +}; + +/* Description FM RTC timer Ex trigger */ +struct t_tmr_ext_trigger { + uint32_t tmr_etts_h; + uint32_t tmr_etts_l; +}; + +struct rtc_regs { + uint32_t tmr_id; /* 0x000 Module ID register */ + uint32_t tmr_id2; /* 0x004 Controller ID register */ + uint32_t reserved0008[30]; + uint32_t tmr_ctrl; /* 0x0080 timer control register */ + uint32_t tmr_tevent; /* 0x0084 timer event register */ + uint32_t tmr_temask; /* 0x0088 timer event mask register */ + uint32_t reserved008c[3]; + uint32_t tmr_cnt_h; /* 0x0098 timer counter high register */ + uint32_t tmr_cnt_l; /* 0x009c timer counter low register */ + uint32_t tmr_add; /* 0x00a0 timer drift compensation addend register */ + uint32_t tmr_acc; /* 0x00a4 timer accumulator register */ + uint32_t tmr_prsc; /* 0x00a8 timer prescale */ + uint32_t reserved00ac; + uint32_t tmr_off_h; /* 0x00b0 timer offset high */ + uint32_t tmr_off_l; /* 0x00b4 timer offset low */ + struct t_tmr_alarm tmr_alarm[FMAN_RTC_MAX_NUM_OF_ALARMS]; + /* 0x00b8 timer alarm */ + uint32_t tmr_fiper[FMAN_RTC_MAX_NUM_OF_PERIODIC_PULSES]; + /* 0x00d0 timer fixed period interval */ + struct t_tmr_ext_trigger tmr_etts[FMAN_RTC_MAX_NUM_OF_EXT_TRIGGERS]; + /* 0x00e0 time stamp general purpose external */ + uint32_t reserved00f0[4]; +}; + struct fman_port_qmi_regs { uint32_t fmqm_pnc; /**< PortID n Configuration Register */ uint32_t fmqm_pns; /**< PortID n Status Register */ @@ -396,6 +440,7 @@ struct __fman_if { void *ccsr_map; void *bmi_map; void *tx_bmi_map; + void *rtc_map; void *qmi_map; struct list_head node; }; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index f7cd7c0d33..e92f1c25b2 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1671,6 +1671,11 @@ static struct eth_dev_ops dpaa_devops = { .rss_hash_update = dpaa_dev_rss_hash_update, .rss_hash_conf_get = dpaa_dev_rss_hash_conf_get, #if defined(RTE_LIBRTE_IEEE1588) + .timesync_enable = dpaa_timesync_enable, + .timesync_disable = dpaa_timesync_disable, + .timesync_read_time = dpaa_timesync_read_time, + .timesync_write_time = dpaa_timesync_write_time, + .timesync_adjust_time = dpaa_timesync_adjust_time, .timesync_read_rx_timestamp = dpaa_timesync_read_rx_timestamp, .timesync_read_tx_timestamp = dpaa_timesync_read_tx_timestamp, #endif diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index 389157fa10..068c153dc7 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -244,6 +244,22 @@ int dpaa_timesync_read_tx_timestamp(struct rte_eth_dev *dev, struct timespec *timestamp); +int +dpaa_timesync_enable(struct rte_eth_dev *dev); + +int +dpaa_timesync_disable(struct rte_eth_dev *dev); + +int +dpaa_timesync_read_time(struct rte_eth_dev *dev, + struct timespec *timestamp); + +int +dpaa_timesync_write_time(struct rte_eth_dev *dev, + const struct timespec *timestamp); +int +dpaa_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta); + int dpaa_timesync_read_rx_timestamp(struct rte_eth_dev *dev, struct timespec *timestamp, diff --git a/drivers/net/dpaa/dpaa_ptp.c b/drivers/net/dpaa/dpaa_ptp.c index df6df1ddf2..f9337a9468 100644 --- a/drivers/net/dpaa/dpaa_ptp.c +++ b/drivers/net/dpaa/dpaa_ptp.c @@ -16,7 +16,82 @@ #include #include -int dpaa_timesync_read_tx_timestamp(struct rte_eth_dev *dev, +int +dpaa_timesync_enable(struct rte_eth_dev *dev __rte_unused) +{ + return 0; +} + +int +dpaa_timesync_disable(struct rte_eth_dev *dev __rte_unused) +{ + return 0; +} + +int +dpaa_timesync_read_time(struct rte_eth_dev *dev, + struct timespec *timestamp) +{ + uint32_t *tmr_cnt_h, *tmr_cnt_l; + struct __fman_if *__fif; + struct fman_if *fif; + uint64_t time; + + fif = dev->process_private; + __fif = container_of(fif, struct __fman_if, __if); + + tmr_cnt_h = &((struct rtc_regs *)__fif->rtc_map)->tmr_cnt_h; + tmr_cnt_l = &((struct rtc_regs *)__fif->rtc_map)->tmr_cnt_l; + + time = (uint64_t)in_be32(tmr_cnt_l); + time |= ((uint64_t)in_be32(tmr_cnt_h) << 32); + + *timestamp = rte_ns_to_timespec(time); + return 0; +} + +int +dpaa_timesync_write_time(struct rte_eth_dev *dev, + const struct timespec *ts) +{ + uint32_t *tmr_cnt_h, *tmr_cnt_l; + struct __fman_if *__fif; + struct fman_if *fif; + uint64_t time; + + fif = dev->process_private; + __fif = container_of(fif, struct __fman_if, __if); + + tmr_cnt_h = &((struct rtc_regs *)__fif->rtc_map)->tmr_cnt_h; + tmr_cnt_l = &((struct rtc_regs *)__fif->rtc_map)->tmr_cnt_l; + + time = rte_timespec_to_ns(ts); + + out_be32(tmr_cnt_l, (uint32_t)time); + out_be32(tmr_cnt_h, (uint32_t)(time >> 32)); + + return 0; +} + +int +dpaa_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta) +{ + struct timespec ts = {0, 0}, *timestamp = &ts; + uint64_t ns; + + dpaa_timesync_read_time(dev, timestamp); + + ns = rte_timespec_to_ns(timestamp); + ns += delta; + *timestamp = rte_ns_to_timespec(ns); + + dpaa_timesync_write_time(dev, timestamp); + + return 0; +} + +int +dpaa_timesync_read_tx_timestamp(struct rte_eth_dev *dev, struct timespec *timestamp) { struct dpaa_if *dpaa_intf = dev->data->dev_private; @@ -32,7 +107,8 @@ int dpaa_timesync_read_tx_timestamp(struct rte_eth_dev *dev, return 0; } -int dpaa_timesync_read_rx_timestamp(struct rte_eth_dev *dev, +int +dpaa_timesync_read_rx_timestamp(struct rte_eth_dev *dev, struct timespec *timestamp, uint32_t flags __rte_unused) { From patchwork Thu Aug 1 10:53:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142830 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8B5FF45710; Thu, 1 Aug 2024 12:55:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E29E9433DB; Thu, 1 Aug 2024 12:53:48 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013001.outbound.protection.outlook.com [52.101.67.1]) by mails.dpdk.org (Postfix) with ESMTP id 13BB7433C3 for ; Thu, 1 Aug 2024 12:53:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XzqKmoQRXQ7SToWGUsMrezOkzd4EWyi0btv6yDS2QrHvSMKINjvwRJ6vDqtUaxvAuKw+4D7Or/bF3Yd2GMZSe80WzO8XRb5oYBj6bH4qvHJZ/Uof8oW9QK+ZAHusCILkZUGcUlIAn7cJqWy9VlH9ypu5vt2HIHFMWje9+adXa5xrDMJwaxqtInbxqEdFRtiC74jXiINqaQnNoenPDxCNfUvvF2RqGmwk5QFj/tJJ/KXnqZRhf4i6GqwtRnJ+SWqQBNUXAZeKXZikLBW/d4KSAwaGctI3LB3W7wnUOKYK8rLkx2wGwecT0GRvr7SUvk7U0vzk4atEmwz1aNJWAB/s4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=CCZfzuBjKv7VLFWKeaFmIEw1p5M8Pnx/dp0ysrmte3Y=; b=EdD8l5zqzuAWGM3dyveS/4thtmiLfYTbZCDSF/ICZv17Hf7mF7A6eDE4adNxCwNuJQoK8lLDML9Tm6DsIhTppyhXHJiohQ3tgbxn6SYTKqy8R9YZ63QgbOfd1nkLu7Tl2GjL/onA2IbqJyyXy4kiuJARg/XzMI7tDa8wltmFkpGXJgKKuoJ5U9Y9Wgq5kAwGgOBRy7M0DOcGua6SrJwRYV+jngWHwszPlxZaWau0zgikctafqXelhzleWrOfOFmwDMYCaC4PU+I+Rpj/pUkr1YK00CeqD7TkiBQfTMUy3BIzfE0kG3qGhDmU2XC1uPbW2nRcxUWDfD7ES8Ufy4rtOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CCZfzuBjKv7VLFWKeaFmIEw1p5M8Pnx/dp0ysrmte3Y=; b=Mnhgz9jug5+ie8QMOZtXozLCMIWg9NsBMN7XRbB6lHP9ZWJCx2Ahi+oYGgySbPlmKrUzrpAQF3a3QdZOP/B2Z3OvDxk33LwNozFYNWpEbGQ6ecY7mq426A2ux46NG9Sm2h8UBxyoxYGdRbBUQoBFbXZK/McD4lI6YjqVl5QttoXtQEi2iKSF7n+ywCmWJ6LkguOcqzaHTudHVNVNHx93HA/ENVrdhKu4A3KSeurLQM1p00OQVm3i93ZKqw12A9nMHXflsvXktEjohsCuXRUjtVOX/7lPvTkbBY56PfaBr/OMqfZwa8ODZpqWu4DvWiOrTJGpJG14KPPXFFxry1K/sQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:42 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:42 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Jun Yang Subject: [PATCH 10/17] net/dpaa: implement detailed packet parsing Date: Thu, 1 Aug 2024 16:23:06 +0530 Message-Id: <20240801105313.630280-11-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 816df697-e4ab-47ba-fc3d-08dcb2183509 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: gtNx59mcwzC+hdgNLUw0Mzw69yNzvdU5lWMF7Sy3T1552fbAaqc9k1+BuboOLoxc6C04HfKfpq/tO5ULtqfyRMiGbCkIygZMOq52yYAEoGJeGOXghjIOuWIrTKGONFTidhoRW8yocW9vHITE9BE1sJ3Xg8TK/P4ju1cZ2vxWVtFEuxrda5xSqXHVgOYXDrWT6rT3PLoWnvAf2vd1itFAUJZQcTKeKOH3WckBag6iq6y+OROe8T18HWF3J1MHQ6KnAtXf3g04QXpyj+MYIUttBtfD/LMbX1u9abK3EiyPqSekTzb74XIOZunbhm9fmWnsIl41iRpSFnPVMcd7tAkvXQ1JsFi0eFA1aDE6/pCT12+Qvn2enFiyn4vw948oOVG6p9XRx31V4VJ2jPCGjzaZEROC0lV45EoHKnF+BjgiacHl1+WneqB8bKh1zQYXc66NGJD8N/DHzGQiOGWFtYvUsmVhvSYIc07QewlnCKE21fZN65L3A0z23zg1CI2SOHJyC44cbA3pI+I78skOhlyJlND+fW9fEOIKHyC+0BPZJOq2XvNrqwh2s6CQOafbgk84Drfgjc6ecKf3QhIH40v+h8puVyw8dxk17eKWDz3LTP0Q6k4H2GXGak6l133FgyGZyeFIZ7rdDX+P51SmwLEaBX/YEq+HPtadaA9EuyfHv9nGpfinGd49IGnPIXG8zu9RnTEYVetl3+zV39PEHMzm/mZyhtuCJAO6pMybrKFHCBn3lz1cK02WrBiVNy59YmS7MGkI/G5rmH2TZU2uYm54C2b8667RR7fu551PIGjd/zy06JJ50E3LXTAKb+VoeIAZ0Qqay/WAicvDlmcCIZYAqD1CbuSsAINtWeDKCs1JVMBU6dl/UciQpAkIY5z/ITPPozD0oV3bts251WStbLEEFviCQQEDWVltCQmvVjzBIIP4FJ7w7jBCOWIdXUxfkGXxiuIUmvWVi0fZwDxjH24ucHoxB9onIJQC6c8N56lL3x9sem6WF1zN/FV1y3mIVPjyGQqfw0IwVwOvDUUU976lp1JpmuTZZ3VuwTVw+bPh7B72GHWAdVEJ1e9pcyJZPKe2II11hthwdFyBxj9gZEkoPGuih3J3MMBKCf8+2ogril853QZknq8RlhxcNokidu+H6hTbRP8hogW5xgOyVgJLU7XWU+8Ocbgk/Hd7t9eVRa0jEwFBJdOKR+cru6Ncl333djTU1XE789NTUZDSPjid1OPyFQhjAB2jfwFg3MjYH/tdZxEAe51O5UB8MvUkHIx1jr/oHLVCvn/Yv8NLG3CTy4XBWeKpdnjX8x4de5bF8u7tF9F/nAEjpFnA3sapioTVydMz8j+v6OVSX2S7V+LEdoxcZp+lPLTl64uLAR7NnbBP37CmHzqleCmo1fFreHpzFuojX2+VOC77B8/bnoFGGw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3mDLlULftnKNq3TiRXlmSb+OLR/TbhXBRMx4hM7ocCT57tXmOPl4xWEEhKbWusJbrUew427rYkDDkoYtatzTT8pEY7rN0n/BMjtNif2WHfDAokKNem6TXqwf8UNnv4EsZqWPjMA2ysE2cb+wQurssdlqAJDZEczsaqgMC2jxnsEcupewuM7CJd0UDVexN8bDn2z8jGCk7J4sO/IiDP76bNoYiICeQaIf90t8HruZbQiEygywqhEw2Eo9T0dZTlUIqBPGF3BTOBqGV/Bda0UZKO3rP2tLQ7N1rm6OI/4ItapzIkxVbrVr2ssOO2ja+7KNV8tsi5Ter3QxRIQaJZNiZfV4UGzkQtj/upECZ8Mo33/QdIIsw/sTv+bUe5Ud6o6gK3c56u50i6HaYC4Z4KcKtKWlpgBdn2Dnm0LMflKtTIYZkraXOfTRRFfxxqqZ+jGZBID+io+9hoYLG3V/Dm29JS1DVbrKfyhp3jXs9i29husgeMmONQZHi/dRebyCfNQDOyOm2wPdfmTdxVSh1lqZuO3/zcAl0U+zOqyi0aZyo4bbjMpJ/94yBO+1pBltOb7wNFu4/oDy/H56/sdGmVZnnpXfcU/8WKOVig1Lg+B/8t80E7Ik7PNZfiVJkkcee3pt7D7xX65YN/IOJBJJQE/QHjsP7BGwPdZb61o1sWnieZO8v+cvgOHQfW1QBwxhox6WvHVaGG5aY1rp5EJXQjk4ojvbo0+OlSya/mgP+3u50WWKKPV8cmB9tudTGSoWDdZ6jPMBVqsfbE9RUN+J/QgH0RBfvJrhYHqU4p8JDOJz5Y4FOwbBFoN6Ra4h89xWoaL9t1Wmoklid6sCGxQILiNv8xoPFc5vleLfFFjgeEj5VsD2m2DmQS0uiFG5CrWACzf3mmhnys/yvw0vlDhswzpOeVVUaS7c8XcGzXGZnoA6bcmxK5XSpsgg+4Nds7KkawHlgsxaAf6077lokAntGv3O7/Al24FFXKqG0xaXwO6OThM9FygfkMnAFeVqg1fpeQv3l8ZUC2WpbxXWpKjQklKYrlcXz/L6GYkUhPYOnOIB3fOLhcFMowgEnLRZbjMKkkvVQrkBWvelJmqIjxPvSUCLc+TZyMwFv1s4PSdpRXbIKqW4rxem630ji4eQ5ltUam5oNKjodQVf8qeDy/87vyU5EXKY9Nd9AitIFEf/R5VCxeWZKyhaka6vc/zfeSIKazQ5UCcRsUE7fDOkmI6l/sgnQAKglgOCQ7fMEYoLvquS/3nop/mi58/LbyLo+Va/6gjBCmm9v67LQOMGCF1VH/do3kvfnzmhe8jpPe1pQBl7CN+FtEddku2sPDLGtLVDlpUckRshjKjOPU1UrLPVQbm0rGVDbuNxl4aPvCdF+79P9GtHfEzEn1YTJlLfSFWhJRJP7QczgKk4K/hj2FtI43P9ut46jgUFCx00qY0tfJ7h6ccfSIhhDo3JaSQJCKXNveNCx2YKVS5ycj9bV4nDX7vVkDeuuBDsGbVfqaV9wf1IKoYwQ9AwoA0Tz8EFTsM7/onSEKb3BUOkUSjbMwl3Fte14iP7C+TTxpgX4meAf7tIQuTNM0ToMvflukBaZgksZQ+viciYANusztfvP0hppM1Olg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 816df697-e4ab-47ba-fc3d-08dcb2183509 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:41.9702 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k0iWmESFZBU1ed9CQM5nihjtPu45NQVXr8K+hkdGuE3ZLo2F6tb6cKDLhgpw1zjgu+a3IoLprCD+ewbRs/NmSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 This patch implements the detailed packet parsing using the annotation info from the hardware. decode parser to set RX muf packet type by dpaa_slow_parsing. Support to identify the IPSec ESP, GRE and SCTP packets. Signed-off-by: Jun Yang Signed-off-by: Hemant Agrawal --- drivers/net/dpaa/dpaa_rxtx.c | 35 ++++++++- drivers/net/dpaa/dpaa_rxtx.h | 143 +++++++++++++++-------------------- 2 files changed, 92 insertions(+), 86 deletions(-) diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 44d9bc1adb..588a78a50c 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -110,11 +110,38 @@ static void dpaa_display_frame_info(const struct qm_fd *fd, #define dpaa_display_frame_info(a, b, c) #endif -static inline void dpaa_slow_parsing(struct rte_mbuf *m __rte_unused, - uint64_t prs __rte_unused) +static inline void +dpaa_slow_parsing(struct rte_mbuf *m, + const struct annotations_t *annot) { + const struct dpaa_eth_parse_results_t *parse; + DPAA_DP_LOG(DEBUG, "Slow parsing"); - /*TBD:XXX: to be implemented*/ + parse = &annot->parse; + + if (parse->ethernet) + m->packet_type |= RTE_PTYPE_L2_ETHER; + if (parse->vlan) + m->packet_type |= RTE_PTYPE_L2_ETHER_VLAN; + if (parse->first_ipv4) + m->packet_type |= RTE_PTYPE_L3_IPV4; + if (parse->first_ipv6) + m->packet_type |= RTE_PTYPE_L3_IPV6; + if (parse->gre) + m->packet_type |= RTE_PTYPE_TUNNEL_GRE; + if (parse->last_ipv4) + m->packet_type |= RTE_PTYPE_L3_IPV4_EXT; + if (parse->last_ipv6) + m->packet_type |= RTE_PTYPE_L3_IPV6_EXT; + if (parse->l4_type == DPAA_PR_L4_TCP_TYPE) + m->packet_type |= RTE_PTYPE_L4_TCP; + else if (parse->l4_type == DPAA_PR_L4_UDP_TYPE) + m->packet_type |= RTE_PTYPE_L4_UDP; + else if (parse->l4_type == DPAA_PR_L4_IPSEC_TYPE && + !parse->l4_info_err && parse->esp_sum) + m->packet_type |= RTE_PTYPE_TUNNEL_ESP; + else if (parse->l4_type == DPAA_PR_L4_SCTP_TYPE) + m->packet_type |= RTE_PTYPE_L4_SCTP; } static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) @@ -229,7 +256,7 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) break; /* More switch cases can be added */ default: - dpaa_slow_parsing(m, prs); + dpaa_slow_parsing(m, annot); } m->tx_offload = annot->parse.ip_off[0]; diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h index 1048e86d41..215bdeaf7f 100644 --- a/drivers/net/dpaa/dpaa_rxtx.h +++ b/drivers/net/dpaa/dpaa_rxtx.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017,2020-2022 NXP + * Copyright 2017,2020-2024 NXP * */ @@ -162,98 +162,77 @@ #define DPAA_PKT_L3_LEN_SHIFT 7 +enum dpaa_parse_result_l4_type { + DPAA_PR_L4_TCP_TYPE = 1, + DPAA_PR_L4_UDP_TYPE = 2, + DPAA_PR_L4_IPSEC_TYPE = 3, + DPAA_PR_L4_SCTP_TYPE = 4, + DPAA_PR_L4_DCCP_TYPE = 5 +}; + /** * FMan parse result array */ struct dpaa_eth_parse_results_t { - uint8_t lpid; /**< Logical port id */ - uint8_t shimr; /**< Shim header result */ - union { - uint16_t l2r; /**< Layer 2 result */ + uint8_t lpid; /**< Logical port id */ + uint8_t shimr; /**< Shim header result */ + union { + uint16_t l2r; /**< Layer 2 result */ struct { -#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - uint16_t ethernet:1; - uint16_t vlan:1; - uint16_t llc_snap:1; - uint16_t mpls:1; - uint16_t ppoe_ppp:1; - uint16_t unused_1:3; - uint16_t unknown_eth_proto:1; - uint16_t eth_frame_type:2; - uint16_t l2r_err:5; + uint16_t unused_1:3; + uint16_t ppoe_ppp:1; + uint16_t mpls:1; + uint16_t llc_snap:1; + uint16_t vlan:1; + uint16_t ethernet:1; + + uint16_t l2r_err:5; + uint16_t eth_frame_type:2; /*00-unicast, 01-multicast, 11-broadcast*/ -#else - uint16_t l2r_err:5; - uint16_t eth_frame_type:2; - uint16_t unknown_eth_proto:1; - uint16_t unused_1:3; - uint16_t ppoe_ppp:1; - uint16_t mpls:1; - uint16_t llc_snap:1; - uint16_t vlan:1; - uint16_t ethernet:1; -#endif + uint16_t unknown_eth_proto:1; } __rte_packed; - } __rte_packed; - union { - uint16_t l3r; /**< Layer 3 result */ + } __rte_packed; + union { + uint16_t l3r; /**< Layer 3 result */ struct { -#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - uint16_t first_ipv4:1; - uint16_t first_ipv6:1; - uint16_t gre:1; - uint16_t min_enc:1; - uint16_t last_ipv4:1; - uint16_t last_ipv6:1; - uint16_t first_info_err:1;/*0 info, 1 error*/ - uint16_t first_ip_err_code:5; - uint16_t last_info_err:1; /*0 info, 1 error*/ - uint16_t last_ip_err_code:3; -#else - uint16_t last_ip_err_code:3; - uint16_t last_info_err:1; /*0 info, 1 error*/ - uint16_t first_ip_err_code:5; - uint16_t first_info_err:1;/*0 info, 1 error*/ - uint16_t last_ipv6:1; - uint16_t last_ipv4:1; - uint16_t min_enc:1; - uint16_t gre:1; - uint16_t first_ipv6:1; - uint16_t first_ipv4:1; -#endif + uint16_t unused_2:1; + uint16_t l3_err:1; + uint16_t last_ipv6:1; + uint16_t last_ipv4:1; + uint16_t min_enc:1; + uint16_t gre:1; + uint16_t first_ipv6:1; + uint16_t first_ipv4:1; + + uint16_t unused_3:8; } __rte_packed; - } __rte_packed; - union { - uint8_t l4r; /**< Layer 4 result */ + } __rte_packed; + union { + uint8_t l4r; /**< Layer 4 result */ struct{ -#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - uint8_t l4_type:3; - uint8_t l4_info_err:1; - uint8_t l4_result:4; - /* if type IPSec: 1 ESP, 2 AH */ -#else - uint8_t l4_result:4; - /* if type IPSec: 1 ESP, 2 AH */ - uint8_t l4_info_err:1; - uint8_t l4_type:3; -#endif + uint8_t l4cv:1; + uint8_t unused_4:1; + uint8_t ah:1; + uint8_t esp_sum:1; + uint8_t l4_info_err:1; + uint8_t l4_type:3; } __rte_packed; - } __rte_packed; - uint8_t cplan; /**< Classification plan id */ - uint16_t nxthdr; /**< Next Header */ - uint16_t cksum; /**< Checksum */ - uint32_t lcv; /**< LCV */ - uint8_t shim_off[3]; /**< Shim offset */ - uint8_t eth_off; /**< ETH offset */ - uint8_t llc_snap_off; /**< LLC_SNAP offset */ - uint8_t vlan_off[2]; /**< VLAN offset */ - uint8_t etype_off; /**< ETYPE offset */ - uint8_t pppoe_off; /**< PPP offset */ - uint8_t mpls_off[2]; /**< MPLS offset */ - uint8_t ip_off[2]; /**< IP offset */ - uint8_t gre_off; /**< GRE offset */ - uint8_t l4_off; /**< Layer 4 offset */ - uint8_t nxthdr_off; /**< Parser end point */ + } __rte_packed; + uint8_t cplan; /**< Classification plan id */ + uint16_t nxthdr; /**< Next Header */ + uint16_t cksum; /**< Checksum */ + uint32_t lcv; /**< LCV */ + uint8_t shim_off[3]; /**< Shim offset */ + uint8_t eth_off; /**< ETH offset */ + uint8_t llc_snap_off; /**< LLC_SNAP offset */ + uint8_t vlan_off[2]; /**< VLAN offset */ + uint8_t etype_off; /**< ETYPE offset */ + uint8_t pppoe_off; /**< PPP offset */ + uint8_t mpls_off[2]; /**< MPLS offset */ + uint8_t ip_off[2]; /**< IP offset */ + uint8_t gre_off; /**< GRE offset */ + uint8_t l4_off; /**< Layer 4 offset */ + uint8_t nxthdr_off; /**< Parser end point */ } __rte_packed; /* The structure is the Prepended Data to the Frame which is used by FMAN */ From patchwork Thu Aug 1 10:53:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142831 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2157445710; Thu, 1 Aug 2024 12:55:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0BA59433DA; Thu, 1 Aug 2024 12:53:50 +0200 (CEST) Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010018.outbound.protection.outlook.com [52.101.69.18]) by mails.dpdk.org (Postfix) with ESMTP id 8C564433D8 for ; Thu, 1 Aug 2024 12:53:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PSEQd8fQkkB9e9kWIVh0g7i1jDPCZ+qhs/VRSZq+3nMjuZw1BrGjsOqnlDAVqrC5H9SPJp21uSJemVEECPvTbpkPJgV5MT0NZN/2HCyxw7Tqzooe81+tDt5SK8XZ6UkKbfs3+694cwx3id5ZrNnk4enJj14IMqxcqaayhdDBLjcakE1YHWql6Z8x11AwnCRkJGIC1VtWv83YkqDbEmz96MfstU9u0nYE5FzAVRXpgAXw+aR/ICEIPiKHXcU765EhcA3kNlBRJJlSIQ2gmo5wgaxwgWPc+zDJ5VTzB8YsLJD9xlZ3OdVhm6t1z/XgojJw0+6rTP9P4TO4c+cO8TPzSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ghJB9z6pLN1bMW6AgQPAFlHzLxoZhuhAxC93Fb6Og+8=; b=PkMjmeVKGfbirEUK6aG2erPpBIfPMhrOFjdzIGPRa624zZgzDb5hgIUCndhdln8dFgpjz5GmebBKM3ckPGtC9uMltRwCaFf/OtnHbk5lOd5L3oXlvBmnA2rGcww2k+BYpnRCM9lr1aoDvgn6nnml5QLLRFXzhbikBQ0JwbkMPpw1Nl/LyvT1N3dnR9jEIFRWOhvFOIZxhpNFfka9Rx8vITcahPZnX7RqLxU155aGKmvQ/hUKr2YtxwMSJDJN6oSpeM7zNme3WwgUBMWlIxKCcA3lR77xarim9zI1itBHU00hu2q6KDK/bYLwr5WSOGlxTqGtC+b0ISAXNdG2tKR5tA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ghJB9z6pLN1bMW6AgQPAFlHzLxoZhuhAxC93Fb6Og+8=; b=PiHYClj+NSvASFyTn3Pf4SidFPAWI+Vs+l6DuHaoU+oE2dNUQPsL2VqaJAIzvrSidOKzgLZXu2e5RV91CRJHXP1XJuObUoOer1TqIJhBhKApyfJ4HZ4ezTXj3OfxwV14/r/PrwTTiAqHzLoznEPiHb2+dUIyn61NqBZx24JBzOd43VbzAdVcVPKXh1ijDh8J8pC3DB3hiwMwER1Lqr6YNsgtUW5suWK4vDl1eMY997ciSH8B+/QYSnx5tTQy//GZ15EiIXFMq/AHu96aBN4qJRlBdaLRLYHErckWmbQImAV6IYKAqEp4Xbch/vaRoqIlfLlB4s9RfgmYyfGX/Eieeg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:43 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:43 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Jun Yang Subject: [PATCH 11/17] net/dpaa: enhance DPAA frame display Date: Thu, 1 Aug 2024 16:23:07 +0530 Message-Id: <20240801105313.630280-12-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: bd348746-cdb4-4e18-075e-08dcb21835d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: bDCjcuceNFlP0KlbOzPRA5hfVWUIvxTRx8e/oXIclk4xg28eKGcMwohCnrvqLLh+1PF0Cvjcw4GFG+lrgUym6KeXyRbyJHYIcMzv+j6CC8gwT0WqNrne13f55J/rdKK1tmK2e3yQmsxeZ/B2mtfVJ7BhFzAkBxmsL5SIiG/7+oWRUPQigJBg9ik9lhtaavmzwnlpM0T3eD43q4jVXSaPwy8KJoEkDK++eG1Zg6WXnXMgHbyPrlBXLPVGo6k6vfdrff9LhG0iPZkROkYspkLcr9Lf2JPbCDbVry+xOcOZp/OCHe9JJnDpqI33qDxsy0G0tGuPulTztvicv59DQ6b+kl6kiYmIexcK+su/H/FAUSwdAkWOCtCSoeHTBYDAOS/KZ2KTB8NVcgZsKPXtlHIFQd6rNzIHQ3Znivo1YGBtHZvPOwey0bCho1RzYmHhDnmVUPCLFz4GY+1PhMtaLQHl6MzUR1Jniz2U9bKvqAjq1qbaa0WSXMi02pWua7pHOmD63cn5aSLQga8Mk/tdvToOtQLLcC9zngO3StoIPi5mt9XxBrKu+yc4VlmJiJzCmUnL2oCJ3glA8JOG7DyXJeKl+z4DK673x7df/7/N6ZJZDqAKIJrRXKoHZCIEwB5rAUsnTyQTBs0+kX/CK6VmTc422ctOksJ75xq/7g+d8xJEqQSBhh6EFDOpghjUnH5vgQvLnB7ocrp+IC6gBLkEaZ/3PnTXyjUisqthkPjITcnrCoelhRVJt8lRgdh2NkVMGBsUJj9mDC1X83IXljOGakEXRytWR8q2VoHKUOiTBCz4888LmKxKxPGFq+ySBoKpRMxDOQ5BFsmIZUHBeROcxDD6JrWlTtN3JF1Z6Mp36OMnVcIF5qGf9ni8YbdU0BdvsFPMfdOeXgXMUOjr18B1JA0bVjxONgbT0PImUmJdCR1rj3NDSaOzW9PP16v2wOMeI0Fk0z7HeqkN0JcyfecKfMKnooIukBuJUV6EJsN08qhS1pvAYtvenKwWwJrLBjbJ0wzzvgUxfkMQ88Jlom+3GTqKpk/aOA+n/76ZnquVM/DtcPmMG63zjZuu1KrzP2Wc2o+RmQjt5esityoEjrBPpIQ6gpGoaUsj2uIs3JHulYt7lWLA85FYPCf5a5NDIkKPIJ/TorxQAGniGIgXB3RNNY6eVTEaGpFALKj6YYxnt9RflrJavSpcmppUOSWiM0RNWVO28rgxxZOcT9aO+emv4BwobiGvVDvmQL4hSDjqpKwXOEPbOQvgtB2WVTE7wsKLLb0TIoh5NmNXEUiIjqTs8oRSWXNbJgVB20Ok6I3DlwXvKM5A1CJ+tfRmUVvPbOEDKh31adMhnyFtvkV0IGcBgC3SshhnFx5CbNahXOrC16Gjlf7Rcx0qatn67hjDK+51OtVmgYoHQLkCEFDyz0HMFaHXCQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Jth4wBf5RXVIMbAMIsE0ugU0EPZrcOOVlR3HkEz5rStoxpxe6cRHKHM6bSHhcnDz1+/XfqaVb3DYTJ4OpPbClQ3QOsW1gZdp4CoJ7S3AVWL6CULPAUIh66V4PAYMBgc29beiR9hua081/+LVoyNl95XHhDwdIwuFsY123jZOigdk9D9zKcCr3g49b+aR4m4uoGSpI2DZMTQOMdrXN15FUySuUEUlOgSOxiXnc3jjCTTwj5xNO8QoAWbZYC++6lsoau9no8eWmc2uFWw3nRBTE9BSZCOytx33muSGb3INDLPgWuDZs5bTv20mp0jxCq4hrKB3N1upoaJ7XzhOHLoJLwTIbYp58m6KqG/sLcoeZnzOexpBtpYpXdf0slzSAek61bmSNS07p0scRrjY7I1aTULeMhBxdQZzEypFwkqWIf4Re/OagISQzweC/2WX8aLIUZV34WDo+elIFTc8nTVhEfGMaxcNnKYyAsng/FhxxVkY7a17OmWTBNV/EDxJ+Upk61jY5Ia1+ORJvJ1xxYmg7Ub2sxnEfNKSvLA/IyyRWkkTM6+ddbwWD8DIJJYo4+kAoWKwtna0ZOvkY7+V84HKpvFseCFiOF2Z5o9Qf15jet7PFo2wuLIGWWK+t2eVQ5ZOSUz9fdgJDsRHM55qzTWLLaymElRwLwnRdye8PcZp08AL8wt9f2MOFU/X309P2Gwc+0cSDCe4uLvMLmc4ISMR68KXay+6Ttyl7Cusf7IHAMd856e3j6/yxcISxV7uBBA9PUtrSviVE+NDJrP+EWbHdmVV0e8Vmwg+kyaJjnYDZPsnx6kb+5h9kUUgwMO9PzqYqWrnPlH4NGjHd8X1juSlZ8AD3l/cNDRB2Lck9Edb0iM+vx8cOyUWJs5/f6ArYuIEiHsgnbVVScKFFcPBRsodDEny2q8yxeGaQsFSGlIHbzDOYbGKixoibJ7AIcBDUmzxxMef0gsNhHt8Ieg505DJY2qF2VEu17tgPupN41iUTFi3TqucbjPECif9TGL9TrCrMRN1zsyNpsE+25H0xahvLQYNIt/ErOHJjfdAZvkTRNNr6YkJahS4+fqdSVo6y0MHGGdiyUKdt5aVP+Yc83EEYH102nSc/LxH1LQConTn4Wi//i1ZMJZpmdXIXQaCDJ+lIc+96LtkCnlXJJ/viIM2+fsHH7vIKvxN8ctcHWGGqjvCOk8KqNYmaZX8PipA3eecoAJPjkzPSiDCgf6vkRh8q/gwcVTHxSMVcXV6dX1IZTeoBcXtvW1AI0/JKtDhJP2/cU951q9FAH0M8+46mUudBvQ2P5u5eG9dKbvE5AwqrQewIfIqYywqKqDbB7RECzwbkrmbray0514CHmZ+h4bLU1C1RmH/6sI6us2R4brnkCt4O8DS+fJNtKGp0k5HICxi3BaTgMMLOEw+BqyqjhFk8Vw53+wwY2ZHakxcmvUJcyI4xYKWXd3JO+yXArKp4O2Np33tA61ywO5ELh5rbX742r8yEGQPnMajBuW8WvWWxMlI/aagtrBBhybYgWEYCmG0T1QFztmEv/2s2+Mdo0NI4y+nMmsIiBvwcwNroTGAB9ZtOnkZqWcIqLAFNz6fY6KQYIZ6BcQABfsqAHYA+fh8qQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd348746-cdb4-4e18-075e-08dcb21835d2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:43.3001 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HHwc3J3Rx4U6Uu0P6o5hDqCqBnQxL4Ho60mpuzaZt9FXl+Uq9+Dm4WWvlhUpzL/dWKJo9nDaiXlU7KKpMnZWMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 This patch enhances the received packet debugging capability. This help displaying the full packet parsing output. Signed-off-by: Jun Yang Signed-off-by: Hemant Agrawal --- doc/guides/nics/dpaa.rst | 5 ++ drivers/net/dpaa/dpaa_ethdev.c | 6 ++ drivers/net/dpaa/dpaa_rxtx.c | 138 +++++++++++++++++++++++++++------ drivers/net/dpaa/dpaa_rxtx.h | 5 ++ 4 files changed, 130 insertions(+), 24 deletions(-) diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst index 580edd9327..448607e9ac 100644 --- a/doc/guides/nics/dpaa.rst +++ b/doc/guides/nics/dpaa.rst @@ -227,6 +227,11 @@ state during application initialization: application want to use eventdev with DPAA device. Currently these queues are not used for LS1023/LS1043 platform by default. +- ``DPAA_DISPLAY_FRAME_AND_PARSER_RESULT`` (default 0) + + This defines the debug flag, whether to dump the detailed frame and packet + parsing result for the incoming packets. + Driver compilation and testing ------------------------------ diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index e92f1c25b2..979220a700 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -2094,6 +2094,12 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) td_tx_threshold = CGR_RX_PERFQ_THRESH; } +#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER + penv = getenv("DPAA_DISPLAY_FRAME_AND_PARSER_RESULT"); + if (penv) + dpaa_force_display_frame_set(atoi(penv)); +#endif + /* If congestion control is enabled globally*/ if (num_rx_fqs > 0 && td_threshold) { dpaa_intf->cgr_rx = rte_zmalloc(NULL, diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 588a78a50c..56b4ce1056 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -47,6 +47,10 @@ #include #include +#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER +static int s_force_display_frm; +#endif + #define DPAA_MBUF_TO_CONTIG_FD(_mbuf, _fd, _bpid) \ do { \ (_fd)->opaque_addr = 0; \ @@ -58,37 +62,122 @@ } while (0) #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER +void +dpaa_force_display_frame_set(int set) +{ + s_force_display_frm = set; +} + #define DISPLAY_PRINT printf -static void dpaa_display_frame_info(const struct qm_fd *fd, - uint32_t fqid, bool rx) +static void +dpaa_display_frame_info(const struct qm_fd *fd, + uint32_t fqid, bool rx) { - int ii; - char *ptr; + int pos, offset = 0; + char *ptr, info[1024]; struct annotations_t *annot = rte_dpaa_mem_ptov(fd->addr); uint8_t format; + const struct dpaa_eth_parse_results_t *psr; - if (!fd->status) { - /* Do not display correct packets.*/ + if (!fd->status && !s_force_display_frm) { + /* Do not display correct packets unless force display.*/ return; } + psr = &annot->parse; - format = (fd->opaque & DPAA_FD_FORMAT_MASK) >> - DPAA_FD_FORMAT_SHIFT; - - DISPLAY_PRINT("fqid %d bpid %d addr 0x%lx, format %d\r\n", - fqid, fd->bpid, (unsigned long)fd->addr, fd->format); - DISPLAY_PRINT("off %d, len %d stat 0x%x\r\n", - fd->offset, fd->length20, fd->status); + format = (fd->opaque & DPAA_FD_FORMAT_MASK) >> DPAA_FD_FORMAT_SHIFT; + if (format == qm_fd_contig) + sprintf(info, "simple"); + else if (format == qm_fd_sg) + sprintf(info, "sg"); + else + sprintf(info, "unknown format(%d)", format); + + DISPLAY_PRINT("%s: fqid=%08x, bpid=%d, phy addr=0x%lx ", + rx ? "RX" : "TX", fqid, fd->bpid, (unsigned long)fd->addr); + DISPLAY_PRINT("format=%s offset=%d, len=%d, stat=0x%x\r\n", + info, fd->offset, fd->length20, fd->status); if (rx) { - ptr = (char *)&annot->parse; - DISPLAY_PRINT("RX parser result:\r\n"); - for (ii = 0; ii < (int)sizeof(struct dpaa_eth_parse_results_t); - ii++) { - DISPLAY_PRINT("%02x ", ptr[ii]); - if (((ii + 1) % 16) == 0) - DISPLAY_PRINT("\n"); + DISPLAY_PRINT("Display usual RX parser result:\r\n"); + if (psr->eth_frame_type == 0) + offset += sprintf(&info[offset], "unicast"); + else if (psr->eth_frame_type == 1) + offset += sprintf(&info[offset], "multicast"); + else if (psr->eth_frame_type == 3) + offset += sprintf(&info[offset], "broadcast"); + else + offset += sprintf(&info[offset], "unknown eth type(%d)", + psr->eth_frame_type); + if (psr->l2r_err) { + offset += sprintf(&info[offset], " L2 error(%d)", + psr->l2r_err); + } else { + offset += sprintf(&info[offset], " L2 non error"); } - DISPLAY_PRINT("\n"); + DISPLAY_PRINT("L2: %s, %s, ethernet type:%s\r\n", + psr->ethernet ? "is ethernet" : "non ethernet", + psr->vlan ? "is vlan" : "non vlan", info); + + offset = 0; + DISPLAY_PRINT("L3: %s/%s, %s/%s, %s, %s\r\n", + psr->first_ipv4 ? "first IPv4" : "non first IPv4", + psr->last_ipv4 ? "last IPv4" : "non last IPv4", + psr->first_ipv6 ? "first IPv6" : "non first IPv6", + psr->last_ipv6 ? "last IPv6" : "non last IPv6", + psr->gre ? "GRE" : "non GRE", + psr->l3_err ? "L3 has error" : "L3 non error"); + + if (psr->l4_type == DPAA_PR_L4_TCP_TYPE) { + offset += sprintf(&info[offset], "tcp"); + } else if (psr->l4_type == DPAA_PR_L4_UDP_TYPE) { + offset += sprintf(&info[offset], "udp"); + } else if (psr->l4_type == DPAA_PR_L4_IPSEC_TYPE) { + offset += sprintf(&info[offset], "IPSec "); + if (psr->esp_sum) + offset += sprintf(&info[offset], "ESP"); + if (psr->ah) + offset += sprintf(&info[offset], "AH"); + } else if (psr->l4_type == DPAA_PR_L4_SCTP_TYPE) { + offset += sprintf(&info[offset], "sctp"); + } else if (psr->l4_type == DPAA_PR_L4_DCCP_TYPE) { + offset += sprintf(&info[offset], "dccp"); + } else { + offset += sprintf(&info[offset], "unknown l4 type(%d)", + psr->l4_type); + } + DISPLAY_PRINT("L4: type:%s, L4 validation %s\r\n", + info, psr->l4cv ? "Performed" : "NOT performed"); + + offset = 0; + if (psr->ethernet) { + offset += sprintf(&info[offset], + "Eth offset=%d, ethtype offset=%d, ", + psr->eth_off, psr->etype_off); + } + if (psr->vlan) { + offset += sprintf(&info[offset], "vLAN offset=%d, ", + psr->vlan_off[0]); + } + if (psr->first_ipv4 || psr->first_ipv6) { + offset += sprintf(&info[offset], "first IP offset=%d, ", + psr->ip_off[0]); + } + if (psr->last_ipv4 || psr->last_ipv6) { + offset += sprintf(&info[offset], "last IP offset=%d, ", + psr->ip_off[1]); + } + if (psr->gre) { + offset += sprintf(&info[offset], "GRE offset=%d, ", + psr->gre_off); + } + if (psr->l4_type >= DPAA_PR_L4_TCP_TYPE) { + offset += sprintf(&info[offset], "L4 offset=%d, ", + psr->l4_off); + } + offset += sprintf(&info[offset], "Next HDR(0x%04x) offset=%d.", + rte_be_to_cpu_16(psr->nxthdr), psr->nxthdr_off); + + DISPLAY_PRINT("%s\r\n", info); } if (unlikely(format == qm_fd_sg)) { @@ -99,13 +188,14 @@ static void dpaa_display_frame_info(const struct qm_fd *fd, DISPLAY_PRINT("Frame payload:\r\n"); ptr = (char *)annot; ptr += fd->offset; - for (ii = 0; ii < fd->length20; ii++) { - DISPLAY_PRINT("%02x ", ptr[ii]); - if (((ii + 1) % 16) == 0) + for (pos = 0; pos < fd->length20; pos++) { + DISPLAY_PRINT("%02x ", ptr[pos]); + if (((pos + 1) % 16) == 0) DISPLAY_PRINT("\n"); } DISPLAY_PRINT("\n"); } + #else #define dpaa_display_frame_info(a, b, c) #endif diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h index 215bdeaf7f..392926e286 100644 --- a/drivers/net/dpaa/dpaa_rxtx.h +++ b/drivers/net/dpaa/dpaa_rxtx.h @@ -274,4 +274,9 @@ void dpaa_rx_cb_prepare(struct qm_dqrr_entry *dq, void **bufs); void dpaa_rx_cb_no_prefetch(struct qman_fq **fq, struct qm_dqrr_entry **dqrr, void **bufs, int num_bufs); +#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER +void +dpaa_force_display_frame_set(int set); +#endif + #endif From patchwork Thu Aug 1 10:53:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142832 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D4ECD45710; Thu, 1 Aug 2024 12:55:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E822433E0; Thu, 1 Aug 2024 12:53:51 +0200 (CEST) Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010036.outbound.protection.outlook.com [52.101.69.36]) by mails.dpdk.org (Postfix) with ESMTP id AB28D433D9 for ; Thu, 1 Aug 2024 12:53:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EKvIQGL1ziSLrl6fa8FXvufvzJbEounjVCskTUpDZ/U6ciltK6LcLFKDzPyZiT3dz1cwIwkCkAJunMu5IBFoOjc/XAwvL+iTH/BA9k5XEvtfiXqQmp8//WzP2Axeno36jITIhO06TcQgKGxt0gD4okEh4u2k7BeCUCD7C8k92I+kVyoYeJrlEvAqXDd4ZpgsKncXthv3sWrEstF+VdybPx7djag0NsL0GHmwpb6+VEU5wmftsDUYYiZHhOedO/VUG2FGssKHPZz+hpGUxG+zgpIQCHSXoFllVlBUeMqBCFIJI2xEy9Tdwwb56FjgcMTgoLTk2Q3FMq3peJKTPKMvrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=GYdkm2Q9aLtnj2ZcdzP5b/PVOpteD53m9K6G08NFa1M=; b=xej1Tl9F1Vz+i2hehO/ySW/SShKiw4aZfin9QxYaVfO50UMCH2tUJmx2eUCcj9kag5SE+8MNR78osPGa3fe2ZuV6dy+K8klaepYOpMH/fsQ4aYmvS0ZyvgibVi974Q/ZrQD8+4bIXtzAOmeCKB7Wxi0KZZN7ZgvBxGEGidTjH5EB5hFEJSSbv2nWK7T+orlPoxWny46yNK4TFcrC813hSgbeHzAof1IWpkJvPFkawgkCGhOY4Hjt71dq+mDypOqU1VYBZNGjGntzxTY+KntwL3x4jpRXMhjHPWzvJ/K5HoKgBVHH9oNAI9Xqq5cwq7InJIcluNk96BICRrQPEj0YEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GYdkm2Q9aLtnj2ZcdzP5b/PVOpteD53m9K6G08NFa1M=; b=MpJmEpnx1p/7xKbJtuWrRXXDVeY3enNBGRXKNn1Q3dm9PNBDkkAKoWhQJdeyuib5oZMJ9rs63xIL+1678rSHdHtuIEAH4dgoN2oW5LjzfhljScFF57Sp5tmW7QCtWtI7wpyP0AOnzKIkxv5jVwaYDkPDJSH5jEz4xExLySyD/9+3qNOFgXoibo4N9fMX0MKSx/Woh1h5PLSiiYRshlRxppF4ZEHdp3Acgydruk0ClsDQfYGuNsQN9w3tmGSEpiyTUvG2c+UO5+dcqDLhb1Hyifj1peR4W6hhsni3RHp97Kt5No2SEyfd5kdm+xakJ/aVSmKNl7otvev4i1qsqaWg5g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:46 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:46 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Gagandeep Singh Subject: [PATCH 12/17] net/dpaa: support mempool debug Date: Thu, 1 Aug 2024 16:23:08 +0530 Message-Id: <20240801105313.630280-13-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 44a9c9bd-a0ef-4f32-a7db-08dcb218369a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 3NWNRPujJVq4bcE6Bo/ZnHANePK5LwtqsqQL2eaxR9mttWkqfiBfaI2NAR6yTDJ1EZtn35O77s4dmM0qwElhYijwS7olOOe+94VJCYiW/E+ULGMwLziiNM4lKbiEfenDFZ0aX/QXIg9N9777ZF1hI/2QLWEzR2QFGGYbmnBSmbvcFUR4DTZkksd6GKcCrFou0+RVc5J9djhHdt5i6dZiReskWSu3OWc9gXPNDvqJxkzP3n0zVKBju7ZILjlmzaWGlYdYPnAM3bF1aeIX34ZG6HflW8WA5aUXxtQgCmye09k7B1DCV2euLtMGWOPbunX8IAXVMnyEzbaiVYTS2aq76b+cIN1tJ1H/42loD2VNUiDxqEPe0O13nMQrk05fP/485v3Q51douAsUnae/XRuOZ9xPzwIpF1SQ/0XcXklHN7gkkqBTlD+hud8neNctVBp0EgnkLU4vC2OYwdEu7NciDA63SuBJoZu/Zbn0JyEg8LQiprU+OTLUwtZmZ6lYAYfyKIjieXyevkg9Z/cUML7Gy1OeBGrqmf7X6kc86lRJtxU6J8m1/dlSK1+BHacepsKwiaZ1BweQkablFUqZrKeb7wEr3nKDhIDcuK8OdvpJR8h7uqgFCXbvvV2SJioxeEkHWdkq7Nu/pt3xygReE41YZfo9ATf59SwNHwvTtR2Kk7pPmjzsqFzCaEx937yQ4spBsilhLeMLSlRQRovnLNNUBSffw30sg+UwfJEeQPp+YoD+7T30f3aO/WfXcHE4N8wI00hsfiWhiH74pfhAkvQP+kRga7TsW429yVoSLd705JAxsBiEogxEj8SdifjlZsFy1Gl/eV85mqQN0Fpd4nsvuCXZSZPg7Ege+VR65bVt3tdqHsng81pqgioR1jGFIe3TwrNG2H3RQ2yTHMefEd27geBCvWBSOwXLHf5M1IdUnmVCS/vhFkxwM/T0N47TFoimpuq+BPxeB9d61h5NDXDcO0DUlHl2MG9K3ZFonEGdGxz2ZnXbVx7ZiwP+QvJdmL4au/ATeNn3Xo/vu/Lluxkk3zJsckJx9NmbeLZItKeRWuW8biSMrkF2uHfdm/aVAtpJyERXwTvfdQDzhqbl0inixSdX+QXGbH2fLVBwD4apq2cPhqAd9XZRoi4DAHwVcbjjtwSZJ9TRAMhx6owlyxygqACCJ4ofCx6LgdQwReWFQp4Rkh5W5oKHco8cfWQd8LngEGANPA8ZG4EZ6XXQSClcvhIpvzfrbKUdlFJLUDAdYLjcEda3CcZRKYngPVDPGa1phaTj8fy06BhufnGMUFNXhR7kAL3KbJT5IyqIUGiXbXJVKabEM+uO4Ron3jT5KxPnpq4tlF/9BKZ0Yl1DfN+5Rb29qRKLdrNEX7HbiOP8MlbrMfXKuLx1KakfcVJ3hu77lT4s25RIS/HoiPTsFvPU6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Oq78NO3SDz8TyxAB1BqG8psMK9auIfKyHE+aFkwbTjgE5cCYUGOqJL9Bnu/Nv+NcHa84YTD4aV2OXZP6u9IK0VXscCfPbwZrLkQiEFJoeF9uCCY0WVpyLgUNVvhj/BF40o0bK2we2Eus0cLHVGzYKGiMroa1s6zFuDU5dBQunaxGPgHpR9VWivN3eqFEYN2yEhN3v1763nuAhzkft+QL+pAbJaustuIiW0zBbXXznsOS09xLZbEcJeE1irzYKXIkhW321hNh7ikyVXk0W8hbhq8haHqn9+cXjCYiYbehQObTaiDptjCYLfTV6lsnminu1RCLTvusw63M196LN4oW4vjwW4kvDIXpWXMoZfRqUyquDOcV6+2tkJhyIPoy7Fw3RLTIGc3aCQYXIeUmDC++sATghONzq1mF1mWkixgiItibYWkOoXvWg+AvqBjbeq3DHCBJ/QQVMRGaUVjdBfYwwt3J0t4yjHkpBgu0x3BZj9NUpFhJfFuHq3W9CZXbGSobGc/2Dy+6311MX2qfP9oQhlNEmp/0J5PxtiQrC4i4N17eun4W1kBNc8njfdKQlAfP2nx1TQeanT+l8CL7O4VdXxY+sg94qasNAObGE3TBwJNLahr5CQ0p4XwnXvTbT+pT2VbQndJoKj0CSBztoaoVQZIcqmNlSRc4KIXjK73k/D3piBNB+sr20C4njCA+Bt5pESgMi7Jk9LsFNx8xl3kAe2MdWL3x1is8MkkPnvyhDu5LDP8eQ2MrR0iW7pm4UtITyxOP7Msp0Bj0X5ePs3a/2Je9UHHkiCZTC7cBrtGIndxWtrt+yT2ygxyDWIsmb8P8UeCjZ5nUx/+Dcy2ptoGQE0gN00wjAXAjy+rQvxQI71oBNZg3wCuUrseZ8zV9l2XSJRT6/6Nj5+7M3VWNKbJUrJbe1Cpdb9dIfChvZx6d22zfM0Z1+mT8oqx4Mn1OVPFBzoWgqUBC+N8icxTGHmoE5jCWMLzil85lIPs9+fVHXwVhDVsWKZm3XNzR91ns4nKZzCSV+iHRoUtrkCzV9zoz07G0CskGrkD5M103OV2lDuig5vDH2pRVGTXy2uZphrPXhkcXQwaCtYYJ97Vb10tahoxC+vsNohKL1ooNxc2dBVt+EwqWVDYNSnZdzhCPR9l4ORwLA24d3VvAU7zgdjKSXEil5TD9LX6PN5GadUP1nTk/EhgVaZyg8TTuz/U6PiKsPsXIakC590t4C6KFYAemy/1MdvmjMmD9XsI0jzlvc+77aZe2zl1GgMt8g39u34gkbzrwVSnexTl9DVn4R0WB/SQsupU++0wEa2GS8OJjgHLKQOhXiW9N3qXkQTNbhwcYbRZN4gb4fc1faVvMKyMKo2sFVDeyartDn/0ze16QWPvlSACjafGrzdcu1B+FnqahG2oH3VsErVxC7SYEoR8NgKc40xwcK9nqZ4rKYFYdlq16SnCJaWYt61NOaHeA1Bl8iJEdEh3snkiSdKuA9+zrrnNN9y/8eROcvyrD5WQj4Xkx5p2BAB+WV8GBJP33Bx+mTQmAiAdPQOkwVj2bG6qfZ2NUVGI1ltCSglDe/cxWh2QAeTyfpvrIyDCv0XNQ+EZsx/2+Vv55RDkup2XQZVb/zw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44a9c9bd-a0ef-4f32-a7db-08dcb218369a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:44.5994 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uq8WOwYW1WjVo6099XzEUX2sssdFro66IVtSHba5J7vJ3Ln3YGl3aiDD07o1ekpsmhqGnk6HU8ppqkBc77018w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Gagandeep Singh This patch adds support to compile time debug the mempool corruptions in dpaa driver. Signed-off-by: Gagandeep Singh --- drivers/net/dpaa/dpaa_rxtx.c | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 56b4ce1056..84fd0c57a4 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -496,6 +496,10 @@ dpaa_eth_sg_to_mbuf(const struct qm_fd *fd, uint32_t ifid) first_seg->data_len = sg_temp->length; first_seg->pkt_len = sg_temp->length; rte_mbuf_refcnt_set(first_seg, 1); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)first_seg), + (void **)&first_seg, 1, 1); +#endif first_seg->port = ifid; first_seg->nb_segs = 1; @@ -513,6 +517,10 @@ dpaa_eth_sg_to_mbuf(const struct qm_fd *fd, uint32_t ifid) first_seg->pkt_len += sg_temp->length; first_seg->nb_segs += 1; rte_mbuf_refcnt_set(cur_seg, 1); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)cur_seg), + (void **)&cur_seg, 1, 1); +#endif prev_seg->next = cur_seg; if (sg_temp->final) { cur_seg->next = NULL; @@ -524,6 +532,10 @@ dpaa_eth_sg_to_mbuf(const struct qm_fd *fd, uint32_t ifid) first_seg->pkt_len, first_seg->nb_segs); dpaa_eth_packet_info(first_seg, vaddr); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)temp), + (void **)&temp, 1, 1); +#endif rte_pktmbuf_free_seg(temp); return first_seg; @@ -564,6 +576,10 @@ dpaa_eth_fd_to_mbuf(const struct qm_fd *fd, uint32_t ifid) mbuf->ol_flags = 0; mbuf->next = NULL; rte_mbuf_refcnt_set(mbuf, 1); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)mbuf), + (void **)&mbuf, 1, 1); +#endif dpaa_eth_packet_info(mbuf, mbuf->buf_addr); return mbuf; @@ -680,6 +696,10 @@ dpaa_rx_cb_no_prefetch(struct qman_fq **fq, struct qm_dqrr_entry **dqrr, mbuf->ol_flags = 0; mbuf->next = NULL; rte_mbuf_refcnt_set(mbuf, 1); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)mbuf), + (void **)&mbuf, 1, 1); +#endif dpaa_eth_packet_info(mbuf, mbuf->buf_addr); dpaa_display_frame_info(fd, fq[0]->fqid, true); #if defined(RTE_LIBRTE_IEEE1588) @@ -727,6 +747,10 @@ dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry **dqrr, mbuf->ol_flags = 0; mbuf->next = NULL; rte_mbuf_refcnt_set(mbuf, 1); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)mbuf), + (void **)&mbuf, 1, 1); +#endif dpaa_eth_packet_info(mbuf, mbuf->buf_addr); dpaa_display_frame_info(fd, fq[0]->fqid, true); #if defined(RTE_LIBRTE_IEEE1588) @@ -978,6 +1002,10 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, return -1; } +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)temp), + (void **)&temp, 1, 0); +#endif fd->cmd = 0; fd->opaque_addr = 0; @@ -1023,6 +1051,10 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, } else { sg_temp->bpid = DPAA_MEMPOOL_TO_BPID(cur_seg->pool); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)cur_seg), + (void **)&cur_seg, 1, 0); +#endif } } else if (RTE_MBUF_HAS_EXTBUF(cur_seg)) { free_buf[*free_count].seg = cur_seg; @@ -1080,6 +1112,10 @@ tx_on_dpaa_pool_unsegmented(struct rte_mbuf *mbuf, * released by BMAN. */ DPAA_MBUF_TO_CONTIG_FD(mbuf, fd_arr, bp_info->bpid); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)mbuf), + (void **)&mbuf, 1, 0); +#endif } } else if (RTE_MBUF_HAS_EXTBUF(mbuf)) { buf_to_free[*free_count].seg = mbuf; @@ -1310,6 +1346,10 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) DPAA_TX_CKSUM_OFFLOAD_MASK) dpaa_unsegmented_checksum(mbuf, &fd_arr[loop]); +#ifdef RTE_LIBRTE_MEMPOOL_DEBUG + rte_mempool_check_cookies(rte_mempool_from_obj((void *)mbuf), + (void **)&mbuf, 1, 0); +#endif continue; } } else { From patchwork Thu Aug 1 10:53:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142833 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4C21345710; Thu, 1 Aug 2024 12:55:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58CC5433CF; Thu, 1 Aug 2024 12:53:52 +0200 (CEST) Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010044.outbound.protection.outlook.com [52.101.69.44]) by mails.dpdk.org (Postfix) with ESMTP id E24C8433DA for ; Thu, 1 Aug 2024 12:53:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KDxVFAIm7bzVBAYBMx5stz5nBzVytvxof8yXDerNGewM/P7KoMNHl6c6I+t6UTHJxB2vUmYcVlMywbHLgSMDOxtWbQINTwK5F3LcrmLJQWEcYudiqg9XATbc8LRLmerL0iTPQYTNfRC3vvWkYGRRhReGen7Bm4GzKrr65EP3XWl/f4i9VQF6SdMjF0Iw+ccrwT6goN7PRsLX9hMllIk2Sf8o+G/QysuroaZvkVroKfmueabcChXQ3cxKePvND95BWws5ldPNLvNF3RNK62zxYpq1GPpEsZCeDVbUqAyIXhdUormwZOGqcOfTTO3vvu4O83HEt+EKHU3seVcttfZSMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uxxQHcju0/mDOAjX9HY7+URCZTWnQnAkl5nPCvVReDM=; b=YpQLnVq34A9wv3/iPPN2iXU6jcpc0nDrbkXVlslmgRZunFkbm01WIZCNIB6bTcVIf1/o7mu6uiUDQ79DCyThVmyMBt0d5XTcb4T8JU0A1KNkmCcYS+erosRut2uU6HQ/+IUim3Ru/harnkZi6TJqAjeK28a/i152U9JAEHzO+DeteBRLsJHzlafn04dd1f2AeQ6Q297rkiVwo+1YLunndIy+6hFuSVRnS3UIt87pD7HEKAxT2BBiopeviKnR1l1Fv92tGOVzgO+IcQT6pqymR6UYujwqzx6XRtWYG/4jMAzfK5hOtRmIZgv5MX3CGenFi+nwik9POJULtbeKGv6oJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uxxQHcju0/mDOAjX9HY7+URCZTWnQnAkl5nPCvVReDM=; b=F0VGXiKhFI81vN4F1eqF3nETV6SSHuEsMqWSPRVVn7S4/YFlkV5xtqURVBZaWFFKsjlJ1mFoTN1BIFgAL6pE8U84H9ZFDi2xkUoBQp6QooISEDDDgW3OcW6hDEP9zjYuEvipbcFrFCilgoI786d2AH34w2VSAt0oJ+LMrvAANtXjvWmoCSudeuMX1CGOBy/ajw8Rqdisz9dcnCuZNZzvYAx+PUNFiOcRIm48ajysBPVWXhyi/QGXoyAnoa7CHoX2bv7vDlSO0lOWdeMG/THKDuAJTjjrtC8iL4trsvHL5/8428ht2PrslKUjh5eHKwsLu9LK3aL3wBamqmEuDiUj+A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:46 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:46 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Vinod Pullabhatla , Rohit Raj Subject: [PATCH 13/17] net/dpaa: add Tx rate limiting DPAA PMD API Date: Thu, 1 Aug 2024 16:23:09 +0530 Message-Id: <20240801105313.630280-14-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ac5e262-69e9-4866-7c77-08dcb218377d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: zY5M7g7djAph/Rs0RR5weOrAf6t2c9V+Y28IvO4x5GNFiNIyXvUJsQpcsS2uGlOIV5jeSYaWS0lcNAADWGeP+zPJCvP2w+RNZi/Q3rI5zD1QSvVHPlIbgacQCJiKKCj7LRUD1JXzibqTr2g5ltKG+XAgrZ4+14jqD4p7pKOsK5wiOJZTIpd+NhrjkemKzn+d+ghNse8/an+9nPCY/Hc8+UVf8cVTwl01OCTgVVG0yBiNDFfyJYlLek0rGzQMB26ZQtqJNzADENcZkIS5ocm4ekCcHe9vLjWe7ZqHdIin6KLeZaRo11KEwTNEKJZA3WTXeU4DeVnFnsUSqe67qsxu2H3OjrNTr1GaSgCds12+P9ocY4/Ii8hQiujk1TtTIX2N3Y0w7vruTML9BwMkkkHvb4ATXmd9736mggOdbL4rurBg01J0a9G37wA70qC346G1KfD0YndXHgp0bxS7N0siOvL1g9SinhN5ZEZOJdKGYYxSSD+aZ+qQk4BfShYLPbETuuVcFRnf9YBea3/sJco8fnVlMb9so9TjFsCUWC5uVJLReFe+DthyMx5Q+AV4AheQ5zLD/yqGwXuX/T8HRLUMd1HLHMXRuET1HAYtOCN6K5+c1ueuYFBqRZeKafT6Y66wWDZzbxNlY8X5CAOAozZwdd5PNf+TrtOq8OmxjmXDVOorAqyU3XS4ni/1sGWnoeZzZMHgq3Moig++CEQugXV1gaRI2AVviEapTDBAOAIJyLH8DoqrLWNBscTfbp/cDa7iRtdGNPXjQQdtsqwpGECicAQ0yBr9UUVlx3KsdYM22VoKxq6eGo5lQwTOMlOU5+kqI7+xG9ti9nGTRta329bx/NArXu64vPrtj+3UvW/NbZUXsibiq5mFsxspRxp3Rpi6NgE4YXhBZ0UN1aZU+SkA94wy4gufwgshVBT16iJ8qNMcfXR39TpD1FLCTDN38TPULTmNZtCP5iT2ytYei+TFVUDLNQwugHyPfMcMVjB7nslS13Vq7c9tWZ0HXcEWt/HlvNTjNMiMoq8GkfYoCbKzXEx/ivqBhAfln1rJozCHyd0oQX7O7v/SWTEeGRefwdoOZVF/XXJKVJ9BV7uN13mwsPX8f9+M7S3bue3Ux//PEZ5eWQykTCyfZ1pDoDEy7bTrrSRDX1PBMnfyINhthCOmf4SVIzdrXXNdBmlclre9QDQEOgovhpJ7TZBVjpN/q6nkuWSq0AMR2BKE5pLN6XEDm2k/22ArEaOSra0l3RaGaCmmb+LQcrQKxz3prYTGn1XaV8Cxk4XpAZZg5gcgqh1N8IPc2jzPd90eV/rnbhAvcsWzw75UFE0u91APIu2565xc84tazsLesCTyWopzwF6l6pM/zGXfam93gqB3LNDjlrepCJMSocRDldSmyfnUvsNP/DSUVeMzDmUFP2pncWk+2A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X7q2amUVExwg9YYSkRYRq2lF7HEFtMriPlgcvO1kw08Q9q4BHnO3KpRzbyJhE55n2aWXWSergD+8qSZ5AQ0LP32ti6LSCn631HZ6kcs6emtiNP+c+Ac4KbT7+LWeKaVM/jYo7Df6hKhNsuno7fq+ARjc7y+VAl4MZD4gwncKlaz38sxrXDUze960yS8SQAHPBLSJjPKY8eMT13WmhW+2ShVksr+O2mMOY8JitzygJlNqrkTPXBXfk552gwYa5COaygBSMtkCYuuYg++whLraC0VoTVuaVWVO1Vcyvr++oGeUKeXWk4MWM/Ljj1Rwv4yIXn9FsFYKRyu2LTcLjRSsKvmC/CCohJZoyUKxFe1eimRlZF25a1ylnYRiKdSU1e6UTaQIivTQ1JdiWaaZ+HPL8GuqUAaNURCEoFb6HTi0Tqu8sHhWvwI529Vd7tjRyEGP5CQO6K5zrFhBAG5tjI9HrIBMW6QrRGNhAWtc6pd+wu4pcCCiTm5JJUtu33NrvWF17DHpz53z9StXcsZeHRiNwHPnv4eLXMW84D7AirF87PqZoFEzPFDt0ziVRnpDiFRd2U8orek43s1BavLO8YDhim60EOiCVk1VNUh4uKED31x3HV/59UjV6nUFiF4D+XgjrIPyHKaFkrcmzifA04WQNrSXm/ZRbDbyZ1jVuYKnnuJFPkY1YhJOhIDMJXt8UXyPZ/kkPWAimDjE6YuYp8N20GjWAuFXCbmxNiLf6vRhdVcLWLwWGkEMk3LCLPeHXGi6Dsx0JFsewGwe7sv4PSZzDzawbk5O5gOcmUGBxbTI61QpKHkQqUJJNi+XkjoFCCYqdrFTIFFc9LAuc+h9X01Na7fNwqrN6vdF0u0ZWFhkuYCLYy0vfyVZT2wPr0GDWqO+PiK+L8eV56sPwmZFGNKNPZjzn6faH0zzPLuLNUNIojzi1JcX2+O0ePEUPZ0CWPiXeIzDkKmd5iKQAINIMljyKX5VoNpgA3kQRSWd1TZs64P87GiZX/gps/FWw4ydLfC/aEnZljoOrddyqvoKOBiq5UvVDrbzYdIsCTeVl08DVCKtUJr1T6YJUJpcz+cRbWQCerXbaJhJXmEKSdzSbC4PSLvh/+KskxYDYhWyRfnU7lXdghqSgvOUdmXDv7ft7Khd2vBUA3tWq1gzaq3BOYTwxsvNotW7snsMeK6on3uiTyCYalUpXRjSZI26AUfEqGph0VZ0T7GkyV+azNTpIUBGRrb3IEk981nEwJV1f7zLrOZzxg6RDWeYckuhhE8lUytCoq79dBQ7g8mHKrPcJPx0cluPBFXqFpu8MG0yWJiKfyVDZh8ZI8q+u5pnHsRy3pvBzy4YuxmJ/zwUsSZhWZ4kacE3+IcCtq51ebiKU6ieGqijwitMghyR0vgwj6398GcNNK6aorrNSXzbsJyprofVueP4q+YQuckQdTt+u0N6uT2/Va8nn2asTa5bc2TIR8W9+UWdKl7EtbocCy3PwaAXWLCcUK0kBon6/H0EzToQPCJHvutt1aO0p5zNMi23QqqCq1Xj8/6xsXHjS225ODDDRpJTrcSCqBF9t3ZfplR/ICDKuei8uZ9XrYGw7djv84+Yfg8DMMSm8X58bqe9Urg76A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ac5e262-69e9-4866-7c77-08dcb218377d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:46.1140 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AkOrPudgwQiZHrni7WA8S+J34URpCjBpZIQ55wd0+f0aAiGDjIRnT3m6vZ6w25IC2GTpYeJoDpOcrY56x8VttQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Vinod Pullabhatla Add support to set Tx rate on DPAA platform through PMD APIs Signed-off-by: Vinod Pullabhatla Signed-off-by: Rohit Raj --- .mailmap | 1 + drivers/net/dpaa/dpaa_flow.c | 95 +++++++++++++++++++++++++--- drivers/net/dpaa/fmlib/fm_lib.c | 32 +++++++++- drivers/net/dpaa/fmlib/fm_port_ext.h | 2 +- drivers/net/dpaa/rte_pmd_dpaa.h | 25 +++++++- drivers/net/dpaa/version.map | 7 ++ 6 files changed, 151 insertions(+), 11 deletions(-) diff --git a/.mailmap b/.mailmap index 4a508bafad..cb0fd52404 100644 --- a/.mailmap +++ b/.mailmap @@ -1562,6 +1562,7 @@ Vincent Jardin Vincent Li Vincent S. Cojot Vinh Tran +Vinod Pullabhatla Vipin Padmam Ramesh Vipin Varghese Vipul Ashri diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c index 082bd5d014..dfc81e4e43 100644 --- a/drivers/net/dpaa/dpaa_flow.c +++ b/drivers/net/dpaa/dpaa_flow.c @@ -13,6 +13,7 @@ #include #include #include +#include #define DPAA_MAX_NUM_ETH_DEV 8 @@ -29,6 +30,11 @@ return &scheme_params->param.key_ext_and_hash.extract_array[hdr_idx]; #define SCH_EXT_FULL_FLD(scheme_params, hdr_idx) \ SCH_EXT_HDR(scheme_params, hdr_idx).extract_by_hdr_type.full_field +/* FMAN mac indexes mappings (0 is unused, first 8 are for 1G, next for 10G + * ports). + */ +const uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; + /* FM global info */ struct dpaa_fm_info { t_handle fman_handle; @@ -649,7 +655,7 @@ static inline int set_pcd_netenv_scheme(struct dpaa_if *dpaa_intf, } -static inline int get_port_type(struct fman_if *fif) +static inline int get_rx_port_type(struct fman_if *fif) { /* For 1G fm-mac9 and fm-mac10 ports, configure the VSP as 10G * ports so that kernel can configure correct port. @@ -668,6 +674,19 @@ static inline int get_port_type(struct fman_if *fif) return -1; } +static inline int get_tx_port_type(struct fman_if *fif) +{ + if (fif->mac_type == fman_mac_1g) + return e_FM_PORT_TYPE_TX; + else if (fif->mac_type == fman_mac_2_5g) + return e_FM_PORT_TYPE_TX_2_5G; + else if (fif->mac_type == fman_mac_10g) + return e_FM_PORT_TYPE_TX_10G; + + DPAA_PMD_ERR("MAC type unsupported"); + return -1; +} + static inline int set_fm_port_handle(struct dpaa_if *dpaa_intf, uint64_t req_dist_set, struct fman_if *fif) @@ -676,17 +695,12 @@ static inline int set_fm_port_handle(struct dpaa_if *dpaa_intf, ioc_fm_pcd_net_env_params_t dist_units; PMD_INIT_FUNC_TRACE(); - /* FMAN mac indexes mappings (0 is unused, - * first 8 are for 1G, next for 10G ports - */ - uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; - /* Memset FM port params */ memset(&fm_port_params, 0, sizeof(fm_port_params)); /* Set FM port params */ fm_port_params.h_fm = fm_info.fman_handle; - fm_port_params.port_type = get_port_type(fif); + fm_port_params.port_type = get_rx_port_type(fif); fm_port_params.port_id = mac_idx[fif->mac_idx]; /* FM PORT Open */ @@ -949,7 +963,6 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf, { t_fm_vsp_params vsp_params; t_fm_buffer_prefix_content buf_prefix_cont; - uint8_t mac_idx[] = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1}; uint8_t idx = mac_idx[fif->mac_idx]; int ret; @@ -1079,3 +1092,69 @@ int dpaa_port_vsp_cleanup(struct dpaa_if *dpaa_intf, struct fman_if *fif) return E_OK; } + +int rte_pmd_dpaa_port_set_rate_limit(uint16_t port_id, uint16_t burst, + uint32_t rate) +{ + t_fm_port_rate_limit port_rate_limit; + bool port_handle_exists = true; + void *handle; + uint32_t ret; + struct rte_eth_dev *dev; + struct dpaa_if *dpaa_intf; + struct fman_if *fif; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + dpaa_intf = dev->data->dev_private; + fif = dev->process_private; + + memset(&port_rate_limit, 0, sizeof(port_rate_limit)); + port_rate_limit.max_burst_size = burst; + port_rate_limit.rate_limit = rate; + + DPAA_PMD_DEBUG("Setting Rate Limiter for port:%s Max Burst =%u Max Rate =%u\n", + dpaa_intf->name, burst, rate); + + if (!dpaa_intf->port_handle) { + t_fm_port_params fm_port_params; + + /* Memset FM port params */ + memset(&fm_port_params, 0, sizeof(fm_port_params)); + + /* Set FM port params */ + fm_port_params.h_fm = fm_open(0); + fm_port_params.port_type = get_tx_port_type(fif); + fm_port_params.port_id = mac_idx[fif->mac_idx]; + + /* FM PORT Open */ + handle = fm_port_open(&fm_port_params); + fm_close(fm_port_params.h_fm); + if (!handle) { + DPAA_PMD_ERR("Can't open handle %p\n", + fm_info.fman_handle); + return -ENODEV; + } + + port_handle_exists = false; + } else { + handle = dpaa_intf->port_handle; + } + + if (burst == 0 || rate == 0) + ret = fm_port_delete_rate_limit(handle); + else + ret = fm_port_set_rate_limit(handle, &port_rate_limit); + + if (ret) { + DPAA_PMD_ERR("Failed to set rate limit ret = %#x\n", -ret); + return -ret; + } + + DPAA_PMD_DEBUG("FM_PORT_SetRateLimit ret = %#x\n", -ret); + + if (!port_handle_exists) + fm_port_close(handle); + + return 0; +} diff --git a/drivers/net/dpaa/fmlib/fm_lib.c b/drivers/net/dpaa/fmlib/fm_lib.c index 68b519ff8a..4b7dd38496 100644 --- a/drivers/net/dpaa/fmlib/fm_lib.c +++ b/drivers/net/dpaa/fmlib/fm_lib.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright 2008-2016 Freescale Semiconductor Inc. - * Copyright 2017-2020 NXP + * Copyright 2017-2020,2022 NXP */ #include @@ -558,3 +558,33 @@ get_device_id(t_handle h_dev) return (t_handle)p_dev->id; } + +uint32_t +fm_port_delete_rate_limit(t_handle h_fm_port) +{ + t_device *p_dev = (t_device *)h_fm_port; + + _fml_dbg("Calling...\n"); + + if (ioctl(p_dev->fd, FM_PORT_IOC_REMOVE_RATE_LIMIT)) + RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); + + _fml_dbg("Finishing.\n"); + + return E_OK; +} + +uint32_t +fm_port_set_rate_limit(t_handle h_fm_port, t_fm_port_rate_limit *p_rate_limit) +{ + t_device *p_dev = (t_device *)h_fm_port; + + _fml_dbg("Calling...\n"); + + if (ioctl(p_dev->fd, FM_PORT_IOC_SET_RATE_LIMIT, p_rate_limit)) + RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG); + + _fml_dbg("Finishing.\n"); + + return E_OK; +} diff --git a/drivers/net/dpaa/fmlib/fm_port_ext.h b/drivers/net/dpaa/fmlib/fm_port_ext.h index bb2e00222e..f1cbf37de3 100644 --- a/drivers/net/dpaa/fmlib/fm_port_ext.h +++ b/drivers/net/dpaa/fmlib/fm_port_ext.h @@ -274,7 +274,7 @@ typedef struct ioc_fm_port_congestion_groups_t { * @Return 0 on success; error code otherwise. */ #define FM_PORT_IOC_SET_RATE_LIMIT \ - IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(3), ioc_fm_port_rate_limit_t) + _IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(3), ioc_fm_port_rate_limit_t) /* * @Function fm_port_delete_rate_limit diff --git a/drivers/net/dpaa/rte_pmd_dpaa.h b/drivers/net/dpaa/rte_pmd_dpaa.h index ec45633ba2..b48adff570 100644 --- a/drivers/net/dpaa/rte_pmd_dpaa.h +++ b/drivers/net/dpaa/rte_pmd_dpaa.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018 NXP + * Copyright 2018,2022 NXP */ #ifndef _PMD_DPAA_H_ @@ -31,4 +31,27 @@ int rte_pmd_dpaa_set_tx_loopback(uint16_t port, uint8_t on); +/** + * Set TX rate limit + * + * @param port_id + * The port identifier of the Ethernet device. + * @param burst + * Max burst size(KBytes) of the Ethernet device. + * 0 - Disable TX rate limit. + * @param rate + * Max rate(Kb/sec) of the Ethernet device. + * 0 - Disable TX rate limit. + * @return + * 0 - if successful. + * <0 - if failed, with proper error code. + * + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + */ +__rte_experimental +int +rte_pmd_dpaa_port_set_rate_limit(uint16_t port_id, uint16_t burst, + uint32_t rate); + #endif /* _PMD_DPAA_H_ */ diff --git a/drivers/net/dpaa/version.map b/drivers/net/dpaa/version.map index c06f4a56de..0662f939bf 100644 --- a/drivers/net/dpaa/version.map +++ b/drivers/net/dpaa/version.map @@ -6,6 +6,13 @@ DPDK_24 { local: *; }; +EXPERIMENTAL { + global: + + # added in 24.11 + rte_pmd_dpaa_port_set_rate_limit; +}; + INTERNAL { global: From patchwork Thu Aug 1 10:53:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142834 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7700845710; Thu, 1 Aug 2024 12:55:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 324BC433F3; Thu, 1 Aug 2024 12:53:54 +0200 (CEST) Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010032.outbound.protection.outlook.com [52.101.69.32]) by mails.dpdk.org (Postfix) with ESMTP id 96A4A433DD for ; Thu, 1 Aug 2024 12:53:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=j3d+fx2am9oDcLOX5BlLYLXw3Fa8j8cdmhJm/kAsJOZtU5zcvK8++qpEvcjEt9+diK5uizQFDQcd/2+U2KoeF/+05xj8ElPttVGMwayeCM2Q7mz69HMBM2evkuvwBzUNW3phYND3TsxhSs5x7OgmiY/EUC4JCIZDPsfUeYzxNaYVKCJqRnFFL9CYQWGPg7pS1LIz5qS3ytYs1UlM7DpDfu/SMkbGlTi4o36uKpMe1pBqvU8Vs5bFcOHtTByKoPjBOS0OQ7kzWQxuFOsFzr+EmDFGKEqoxtKv3q0hBHlzmSxhiqklmkIiSPfsW35ge2PmygQj5oTv3MsBTrwpKKzi2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=60uOz5uHXLyahgC0eIG/nDelcDt4YH7GicN0oaSmFoU=; b=cwDj0JHILazUyoc+1NvJoH3kqVYx+hd9NEy5ELTcnuskt9zUmehcoQxx4ITuI1sfaVDlSYVOWaYlx/N58UlKaDfCP+Zk+m3+7qmBITZo28XcfnMdt2k+nStAt9MUXqfpVKHrfzf0WsivSQ9McgYDo1R3aWAfWGHaAjz37/yVD0PUqC+oed2xMXDmfCTtZ4+t/lyWx/IKLd07gGQsQcc+g4FUch8ZK5CR91HzhQJqquf9NjSJna6vAI/meWq3i9n2WryVLwUD9covFf1C7vyOgyxYKNUHYpbL4LxuN7jah4HoG7mwM5wz8DIY8BBj6RVr76xSetYBc3eTz8QTwgf/Cw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=60uOz5uHXLyahgC0eIG/nDelcDt4YH7GicN0oaSmFoU=; b=JHTyuv79DtGZGjVPN4/YCcIIHzVoJXmi2DizzZnC339Y2W3Zb0lhV08lR1TE3v3Rfv+Y3TWFMl9hd9iN2U6qId5Xv4OUXKufY+k8wJ+IXmEkmi/u3f+TfqHGJzx4raStjdC0d+0ppLso/7HEcy6udTG/DOb88+SPDB7h5ah05EWRi+3fb+JRHlzyCjOWfypJTyGlFO6VoPyhgJvCPp56EUBI1/gVgRwTCc9F06dUpqR/p2UAAD0+O3L7KMiRHjTddmQUUbAqUChYxtNdLMIxRz8gkMfZ8/ds4LkSrCK17Lxxvti08QkvAezwUt/QP8ZyuR2YOndKktdAAdlyIdzPaQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:47 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:47 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Rohit Raj Subject: [PATCH 14/17] bus/dpaa: add OH port mode for dpaa eth Date: Thu, 1 Aug 2024 16:23:10 +0530 Message-Id: <20240801105313.630280-15-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 00e58565-02e3-4e3c-5fe5-08dcb218387c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 8ZAf+6/b8zOoEitnPWHGFj1s9MamDjOc36uQm9Jwyt7suz5T5maXBSQWMjosBOQrK4DSEClO/Zaib0sSCUDTpWQ4iS8fejeHSKVEtv+MsGdO25pCyLDa4CxVOplAvDykt6usY6GuUwRIv6504wOK92p8pnB2j9FR+arEvPTmnZW0CuoHPh34XgorhKfSsQYujB7J2gOiDcwWKu5GboTO/JSBj830d/XdumofGvNgSehfIVKjt+pvP/cz1jv7BpYYQvmO69iYKOwJxhL/XkZQO5Izl4n2JyIauaDnbijJ20X8m8FyTwcPuh/w+9looE+DLZu88zudbQZRAB5gQIENYlwZk99pODlYzDXom2ytTsHuVo9ll0dO7GpbkPgO73p0EY+ypUrnsHaV3oFgnd3fN21kVgVYfjKBc3Jg+N6O2fp8kTfPBY0sfq+nfDeyKsSmJrsgK/8uIMDoLEQj6hVlJHiSmxZAXo2kHi8Yes2NUTIajQhNUkFdahabhrPxbb+1nJW4ptxYUtHON4jstlCyYQJ0N6DZsIxs8XbeNuD7ywZF1heUWTNOvWpucpZKsWszTzouTU8pRrX8SBXpDrOmHtOcQD3tARxAWggFXvW26SG8LCO0/jIZ0elusvhYzXQSXrdKfXGrWQVRXDt7l+fuCqm9dZihOASHCDLngMAQY81X4WMDFVVX62iZ/wYCU3wJKgQxiY7P6Bj4//CobgwNNBzx7ruBFwoEGxiU1tXaVmv6ek1SO3pdkJSCu5G/Ggh5JtDQX1uDXjboLsiRdOZDJnaVifgifmvonn8KXitv93x6blAvP193Joz0O0P0sX/Ttrv0j1Mh1nVjparCZcj4R+xcaM5OA5QOCn6wAfim+AxZ/Ot0H37Oov2/eN2fIHQeJfkrrP9d3UIs/4AA4SMEdEh8Sfmaoq2xXMWI8O1rwGoo+CLDUg6flFS9ivOd8kFxPOuQJmdf41cq/6onrI55Or0Qk3SoCbyoXOfPn1zwNOSOFdlrWALWwLhSUe2VdS62knPuFrMHp6Z5s9RLVz0r82lgaK0LHDBNTr3L7/ymwtVsRzEn/0ia+uG7ZB3UXJqWBkG3ZMUyWBA7nf5ApOd3OJKAuSztbj9XVqVuBe1BGxlFSYCtQg52R4Q44AMeQhfi97cCqIpHJjfqJhdk/8AfcuIIhGEE91lgTzlzNAN6qJH1cxCTF9UwDihEK3VWACrPIuhKYSLbpiMECTxJ7Fro/J4DdAtFcgvt5WagsoOywZe9ijuS+Nu61+0zHOJ+2dSpRLB5DVGcWYFzxQKB+82QNyWskPOyMbTi1tBN548Iafja8wHVMK4KjKYkHBspqvJ8+2Xb6L35SYXxtCeP47qe4U6HRsYkcASeNZ78az2UnIag4uHw/scHd5MsiECsdDY073y49GHDzEVseAn3lGTOFg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R5WyHqw+cZNSRdJ8eoepxsrHyrC8oWXhkVKPgXbAqWzcqsE6Pix06uHnMyLsu5uWTfmp5Jwop+K407HN8QQJ4XpJHYhmew7Dtjn10qKRSx0Ptdfqy7G3EnWv9/WokkZ6d5hhlDkxD1rwMAM1rdVGJw75/OO9jiE5wKnaFwMbG2IoZYHSC89zfbllqPiHKY0O6gnta+fJgSkvnMhN/EjCXP6BmznBrWpXivAZr6AxICdI7Wd6GiX9az22XKVnVI+xkIsB7JbMBGHY2KiOw3mwgf8pTx4zrD4mIc+tEW8R2IRyn+FFU+MUdHeggvkzSPk4dmeHh5y4hPHJDDq0SdBF5ZdR/vr4diPW4/blZ9E9O6Wekum7dUlTwYICLcRb1pvnB6dq8klkM9/JFkB8pJHGFvgLL4hiVkho83aErsvK36ZVO6q8hbhXT/9e/6OPrqYkM3gfFX1jz2o4TUZ3J7h0h4q5S21Rup90LzJtOrZUwwbxPO4YTtctROK7Veyni+BnFxjiYanF9VKRVInW1gUKm6j8V/RU76IczS8XEpbqwFL3inS9fiKjmBm7WiXKDVfvY65HHeB7p37fc9Rmo/PVNudTwuAl9eaXfiw5XsY9D3RxmYn9/q+8SOu7mbI6VJtkWwyYkmBvXMX9M7AajDxKeaV1x/TkQtbE3+SX2opJjv1D8537DZmKl8DJu1sTrCDaUQYCt1oXH0Jyat7rrMiSCyFTMn4B9PbUMSSKcanQk1wvmYT8xOcHCeDDuRPBdzcKPTbpGnmfEfcYGYCgsSA5TEkZ97DJq/fJmtL8A0IM1yYE2jsse89G54brBZTswek6TBmEjBASgRI/1hKwoS2XH8KBlgsmw77g4PF2kCOzwKycrZRHmwM+vRZQ0sCyk9CGMeIZo5mIvz+Wsde6Y9hCUopjm3jpXYTuIJjf+GVtNqGu4xhvMEM5CxyfRK3VftjyB0EZkxlSXQZcoabEtorVxCEZibOuoSlz+GdG2Z/9k9DRfnsUMwQrG+3l4TXZ2tSjeCf8GOjwetkjsH98JIkfb/OCS/77r8nZ5jw800Nq5P4LY4Dwq3+IFFkP/TD2YV7fU6Z9l2ogA77iFtZR4s3oAXPlWr2sH1sIzOAgdVnTcNS6agU0uwe5ZAVQy2vRuMI+gfiOuKg/bCH5Jq/hwgh2E4WdKhIqFAXHt7RlJBkkVuV10BTMEMqXsNuGsISKJEaxhyR91+lfGfkzwXuS1FJguGybJFUGiquyqKKNyA7OywpAOYt7MBuNdHCon7Xf9hwc54X+wrSlVjJAG1ynJw24xQOoNLshed0zwX6Dv+XUGGXqA2sCeCclZqYE+9q89+LVO/xHO3pIXxGVpMEeB11dia5PeIdJ6pt09nudWdzfAWJAdPY0ne3P5WHujE5Rzr7zJzs5IgIgb8FyBSTPAc2lmjZqhffNngDhGzjeEUPAyJqGPw492oO2sGBuNnsmZKwGX/Zh/2lVuj4jfr+HznvbsEcrfvE2uL1FxOXwSQ2LvvJOAXdJpjVcui/2zKN+PmZEUj1ldUIMcu8bPAjBublDEmUKfNhQmp9/zAoQOGXItDk+ouaKUjMNWq892UEbPQYwl8T1MkFKMH4McRqBsrwrGQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00e58565-02e3-4e3c-5fe5-08dcb218387c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:47.8413 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: j1tZ98vTUcwVhMeVzibezehukVN5+/2gVdCqBDo1sLwJRFXXP+XXvH7DNkIomrPKEnpPOmqv1WZQRD7Zb6hOhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Rohit Raj NXP DPAA architecture supports the concept of DPAA port as Offline Port - meaning - not connected to an actual MAC. This is an virtual port to be used by application for exchanging data. This property is completely driven by the device-tree. During the DPAA bus scan, based on the platform device properties as in device-tree, the port can be classified as OH port. This patch add support in the driver to use dpaa eth port in OH mode as well with DPDK applications. Signed-off-by: Rohit Raj --- drivers/bus/dpaa/base/fman/fman.c | 261 ++++++++++++++-------- drivers/bus/dpaa/base/fman/fman_hw.c | 24 +- drivers/bus/dpaa/base/fman/netcfg_layer.c | 19 +- drivers/bus/dpaa/dpaa_bus.c | 23 +- drivers/bus/dpaa/include/fman.h | 33 ++- drivers/net/dpaa/dpaa_ethdev.c | 87 ++++++-- drivers/net/dpaa/dpaa_ethdev.h | 8 +- drivers/net/dpaa/dpaa_flow.c | 39 ++-- drivers/net/dpaa/dpaa_fmc.c | 3 +- 9 files changed, 353 insertions(+), 144 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index a79b0b75dd..f817305ab7 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -43,7 +43,7 @@ if_destructor(struct __fman_if *__if) if (!__if) return; - if (__if->__if.mac_type == fman_offline_internal) + if (__if->__if.mac_type == fman_offline) goto cleanup; list_for_each_entry_safe(bp, tmpbp, &__if->__if.bpool_list, node) { @@ -246,26 +246,34 @@ fman_if_init(const struct device_node *dpa_node) uint64_t port_cell_idx_val = 0; uint64_t ext_args_cell_idx_val = 0; - const struct device_node *mac_node = NULL, *tx_node, *ext_args_node; - const struct device_node *pool_node, *fman_node, *rx_node; + const struct device_node *mac_node = NULL, *ext_args_node; + const struct device_node *pool_node, *fman_node; + const struct device_node *rx_node = NULL, *tx_node = NULL; + const struct device_node *oh_node = NULL; const uint32_t *regs_addr = NULL; const char *mname, *fname; const char *dname = dpa_node->full_name; size_t lenp; - int _errno, is_shared = 0; + int _errno, is_shared = 0, is_offline = 0; const char *char_prop; uint32_t na; if (of_device_is_available(dpa_node) == false) return 0; - if (!of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-init") && - !of_device_is_compatible(dpa_node, "fsl,dpa-ethernet")) { + if (of_device_is_compatible(dpa_node, "fsl,dpa-oh")) + is_offline = 1; + + if (!of_device_is_compatible(dpa_node, "fsl,dpa-oh") && + !of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-init") && + !of_device_is_compatible(dpa_node, "fsl,dpa-ethernet")) { return 0; } - rprop = "fsl,qman-frame-queues-rx"; - mprop = "fsl,fman-mac"; + rprop = is_offline ? "fsl,qman-frame-queues-oh" : + "fsl,qman-frame-queues-rx"; + mprop = is_offline ? "fsl,fman-oh-port" : + "fsl,fman-mac"; /* Obtain the MAC node used by this interface except macless */ mac_phandle = of_get_property(dpa_node, mprop, &lenp); @@ -281,27 +289,43 @@ fman_if_init(const struct device_node *dpa_node) } mname = mac_node->full_name; - /* Extract the Rx and Tx ports */ - ports_phandle = of_get_property(mac_node, "fsl,port-handles", - &lenp); - if (!ports_phandle) - ports_phandle = of_get_property(mac_node, "fsl,fman-ports", + if (!is_offline) { + /* Extract the Rx and Tx ports */ + ports_phandle = of_get_property(mac_node, "fsl,port-handles", &lenp); - if (!ports_phandle) { - FMAN_ERR(-EINVAL, "%s: no fsl,port-handles", - mname); - return -EINVAL; - } - assert(lenp == (2 * sizeof(phandle))); - rx_node = of_find_node_by_phandle(ports_phandle[0]); - if (!rx_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]", mname); - return -ENXIO; - } - tx_node = of_find_node_by_phandle(ports_phandle[1]); - if (!tx_node) { - FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[1]", mname); - return -ENXIO; + if (!ports_phandle) + ports_phandle = of_get_property(mac_node, "fsl,fman-ports", + &lenp); + if (!ports_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,port-handles", + mname); + return -EINVAL; + } + assert(lenp == (2 * sizeof(phandle))); + rx_node = of_find_node_by_phandle(ports_phandle[0]); + if (!rx_node) { + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]", mname); + return -ENXIO; + } + tx_node = of_find_node_by_phandle(ports_phandle[1]); + if (!tx_node) { + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[1]", mname); + return -ENXIO; + } + } else { + /* Extract the OH ports */ + ports_phandle = of_get_property(dpa_node, "fsl,fman-oh-port", + &lenp); + if (!ports_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,fman-oh-port", dname); + return -EINVAL; + } + assert(lenp == (sizeof(phandle))); + oh_node = of_find_node_by_phandle(ports_phandle[0]); + if (!oh_node) { + FMAN_ERR(-ENXIO, "%s: bad fsl,port-handle[0]", mname); + return -ENXIO; + } } /* Check if the port is shared interface */ @@ -430,17 +454,19 @@ fman_if_init(const struct device_node *dpa_node) * Set A2V, OVOM, EBD bits in contextA to allow external * buffer deallocation by fman. */ - fman_dealloc_bufs_mask_hi = FMAN_V3_CONTEXTA_EN_A2V | - FMAN_V3_CONTEXTA_EN_OVOM; - fman_dealloc_bufs_mask_lo = FMAN_V3_CONTEXTA_EN_EBD; + fman_dealloc_bufs_mask_hi = DPAA_FQD_CTX_A_A2_FIELD_VALID | + DPAA_FQD_CTX_A_OVERRIDE_OMB; + fman_dealloc_bufs_mask_lo = DPAA_FQD_CTX_A2_EBD_BIT; } else { fman_dealloc_bufs_mask_hi = 0; fman_dealloc_bufs_mask_lo = 0; } - /* Is the MAC node 1G, 2.5G, 10G? */ + /* Is the MAC node 1G, 2.5G, 10G or offline? */ __if->__if.is_memac = 0; - if (of_device_is_compatible(mac_node, "fsl,fman-1g-mac")) + if (is_offline) + __if->__if.mac_type = fman_offline; + else if (of_device_is_compatible(mac_node, "fsl,fman-1g-mac")) __if->__if.mac_type = fman_mac_1g; else if (of_device_is_compatible(mac_node, "fsl,fman-10g-mac")) __if->__if.mac_type = fman_mac_10g; @@ -468,46 +494,81 @@ fman_if_init(const struct device_node *dpa_node) goto err; } - /* - * For MAC ports, we cannot rely on cell-index. In - * T2080, two of the 10G ports on single FMAN have same - * duplicate cell-indexes as the other two 10G ports on - * same FMAN. Hence, we now rely upon addresses of the - * ports from device tree to deduce the index. - */ + if (!is_offline) { + /* + * For MAC ports, we cannot rely on cell-index. In + * T2080, two of the 10G ports on single FMAN have same + * duplicate cell-indexes as the other two 10G ports on + * same FMAN. Hence, we now rely upon addresses of the + * ports from device tree to deduce the index. + */ - _errno = fman_get_mac_index(regs_addr_host, &__if->__if.mac_idx); - if (_errno) { - FMAN_ERR(-EINVAL, "Invalid register address: %" PRIx64, - regs_addr_host); - goto err; - } + _errno = fman_get_mac_index(regs_addr_host, &__if->__if.mac_idx); + if (_errno) { + FMAN_ERR(-EINVAL, "Invalid register address: %" PRIx64, + regs_addr_host); + goto err; + } + } else { + cell_idx = of_get_property(oh_node, "cell-index", &lenp); + if (!cell_idx) { + FMAN_ERR(-ENXIO, "%s: no cell-index)\n", + oh_node->full_name); + goto err; + } + assert(lenp == sizeof(*cell_idx)); + cell_idx_host = of_read_number(cell_idx, + lenp / sizeof(phandle)); - /* Extract the MAC address for private and shared interfaces */ - mac_addr = of_get_property(mac_node, "local-mac-address", - &lenp); - if (!mac_addr) { - FMAN_ERR(-EINVAL, "%s: no local-mac-address", - mname); - goto err; + __if->__if.mac_idx = cell_idx_host; } - memcpy(&__if->__if.mac_addr, mac_addr, ETHER_ADDR_LEN); - /* Extract the channel ID (from tx-port-handle) */ - tx_channel_id = of_get_property(tx_node, "fsl,qman-channel-id", - &lenp); - if (!tx_channel_id) { - FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id", - tx_node->full_name); - goto err; + if (!is_offline) { + /* Extract the MAC address for private and shared interfaces */ + mac_addr = of_get_property(mac_node, "local-mac-address", + &lenp); + if (!mac_addr) { + FMAN_ERR(-EINVAL, "%s: no local-mac-address", + mname); + goto err; + } + memcpy(&__if->__if.mac_addr, mac_addr, ETHER_ADDR_LEN); + + /* Extract the channel ID (from tx-port-handle) */ + tx_channel_id = of_get_property(tx_node, "fsl,qman-channel-id", + &lenp); + if (!tx_channel_id) { + FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id", + tx_node->full_name); + goto err; + } + } else { + /* Extract the channel ID (from mac) */ + tx_channel_id = of_get_property(mac_node, "fsl,qman-channel-id", + &lenp); + if (!tx_channel_id) { + FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id", + tx_node->full_name); + goto err; + } } - regs_addr = of_get_address(rx_node, 0, &__if->regs_size, NULL); + na = of_n_addr_cells(mac_node); + __if->__if.tx_channel_id = of_read_number(tx_channel_id, na); + + if (!is_offline) + regs_addr = of_get_address(rx_node, 0, &__if->regs_size, NULL); + else + regs_addr = of_get_address(oh_node, 0, &__if->regs_size, NULL); if (!regs_addr) { FMAN_ERR(-EINVAL, "of_get_address(%s)", mname); goto err; } - phys_addr = of_translate_address(rx_node, regs_addr); + + if (!is_offline) + phys_addr = of_translate_address(rx_node, regs_addr); + else + phys_addr = of_translate_address(oh_node, regs_addr); if (!phys_addr) { FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)", mname, regs_addr); @@ -521,23 +582,27 @@ fman_if_init(const struct device_node *dpa_node) goto err; } - regs_addr = of_get_address(tx_node, 0, &__if->regs_size, NULL); - if (!regs_addr) { - FMAN_ERR(-EINVAL, "of_get_address(%s)\n", mname); - goto err; - } - phys_addr = of_translate_address(tx_node, regs_addr); - if (!phys_addr) { - FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)\n", - mname, regs_addr); - goto err; - } - __if->tx_bmi_map = mmap(NULL, __if->regs_size, - PROT_READ | PROT_WRITE, MAP_SHARED, - fman_ccsr_map_fd, phys_addr); - if (__if->tx_bmi_map == MAP_FAILED) { - FMAN_ERR(-errno, "mmap(0x%"PRIx64")\n", phys_addr); - goto err; + if (!is_offline) { + regs_addr = of_get_address(tx_node, 0, &__if->regs_size, NULL); + if (!regs_addr) { + FMAN_ERR(-EINVAL, "of_get_address(%s)\n", mname); + goto err; + } + + phys_addr = of_translate_address(tx_node, regs_addr); + if (!phys_addr) { + FMAN_ERR(-EINVAL, "of_translate_address(%s, %p)\n", + mname, regs_addr); + goto err; + } + + __if->tx_bmi_map = mmap(NULL, __if->regs_size, + PROT_READ | PROT_WRITE, MAP_SHARED, + fman_ccsr_map_fd, phys_addr); + if (__if->tx_bmi_map == MAP_FAILED) { + FMAN_ERR(-errno, "mmap(0x%"PRIx64")\n", phys_addr); + goto err; + } } if (!rtc_map) { @@ -554,11 +619,6 @@ fman_if_init(const struct device_node *dpa_node) __if->rtc_map = rtc_map; } - /* No channel ID for MAC-less */ - assert(lenp == sizeof(*tx_channel_id)); - na = of_n_addr_cells(mac_node); - __if->__if.tx_channel_id = of_read_number(tx_channel_id, na); - /* Extract the Rx FQIDs. (Note, the device representation is silly, * there are "counts" that must always be 1.) */ @@ -568,13 +628,26 @@ fman_if_init(const struct device_node *dpa_node) goto err; } - /* Check if "fsl,qman-frame-queues-rx" in dtb file is valid entry or - * not. A valid entry contains at least 4 entries, rx_error_queue, - * rx_error_queue_count, fqid_rx_def and rx_error_queue_count. + /* + * Check if "fsl,qman-frame-queues-rx/oh" in dtb file is valid entry or + * not. + * + * A valid rx entry contains either 4 or 6 entries. Mandatory entries + * are rx_error_queue, rx_error_queue_count, fqid_rx_def and + * fqid_rx_def_count. Optional entries are fqid_rx_pcd and + * fqid_rx_pcd_count. + * + * A valid oh entry contains 4 entries. Those entries are + * rx_error_queue, rx_error_queue_count, fqid_rx_def and + * fqid_rx_def_count. */ - assert(lenp >= (4 * sizeof(phandle))); - na = of_n_addr_cells(mac_node); + if (!is_offline) + assert(lenp == (4 * sizeof(phandle)) || + lenp == (6 * sizeof(phandle))); + else + assert(lenp == (4 * sizeof(phandle))); + /* Get rid of endianness (issues). Convert to host byte order */ rx_phandle_host[0] = of_read_number(&rx_phandle[0], na); rx_phandle_host[1] = of_read_number(&rx_phandle[1], na); @@ -595,6 +668,9 @@ fman_if_init(const struct device_node *dpa_node) __if->__if.fqid_rx_pcd_count = rx_phandle_host[5]; } + if (is_offline) + goto oh_init_done; + /* Extract the Tx FQIDs */ tx_phandle = of_get_property(dpa_node, "fsl,qman-frame-queues-tx", &lenp); @@ -706,6 +782,7 @@ fman_if_init(const struct device_node *dpa_node) if (is_shared) __if->__if.is_shared_mac = 1; +oh_init_done: fman_if_vsp_init(__if); /* Parsing of the network interface is complete, add it to the list */ @@ -769,6 +846,10 @@ fman_finish(void) list_for_each_entry_safe(__if, tmpif, &__ifs, __if.node) { int _errno; + /* No need to disable Offline port */ + if (__if->__if.mac_type == fman_offline) + continue; + /* disable Rx and Tx */ if ((__if->__if.mac_type == fman_mac_1g) && (!__if->__if.is_memac)) diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index 466709bfc9..afe10de4bc 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright 2017,2020,2022 NXP + * Copyright 2017,2020,2022-2023 NXP * */ @@ -88,6 +88,10 @@ fman_if_add_hash_mac_addr(struct fman_if *p, uint8_t *eth) struct __fman_if *__if = container_of(p, struct __fman_if, __if); + /* Add hash mac addr not supported on Offline port */ + if (__if->__if.mac_type == fman_offline) + return 0; + eth_addr = ETH_ADDR_TO_UINT64(eth); if (!(eth_addr & GROUP_ADDRESS)) @@ -109,6 +113,15 @@ fman_if_get_primary_mac_addr(struct fman_if *p, uint8_t *eth) void *mac_reg = &((struct memac_regs *)__if->ccsr_map)->mac_addr0.mac_addr_l; u32 val = in_be32(mac_reg); + int i; + + /* Get mac addr not supported on Offline port */ + /* Return NULL mac address */ + if (__if->__if.mac_type == fman_offline) { + for (i = 0; i < 6; i++) + eth[i] = 0x0; + return 0; + } eth[0] = (val & 0x000000ff) >> 0; eth[1] = (val & 0x0000ff00) >> 8; @@ -130,6 +143,10 @@ fman_if_clear_mac_addr(struct fman_if *p, uint8_t addr_num) struct __fman_if *m = container_of(p, struct __fman_if, __if); void *reg; + /* Clear mac addr not supported on Offline port */ + if (m->__if.mac_type == fman_offline) + return; + if (addr_num) { reg = &((struct memac_regs *)m->ccsr_map)-> mac_addr[addr_num-1].mac_addr_l; @@ -149,10 +166,13 @@ int fman_if_add_mac_addr(struct fman_if *p, uint8_t *eth, uint8_t addr_num) { struct __fman_if *m = container_of(p, struct __fman_if, __if); - void *reg; u32 val; + /* Set mac addr not supported on Offline port */ + if (m->__if.mac_type == fman_offline) + return 0; + memcpy(&m->__if.mac_addr, eth, ETHER_ADDR_LEN); if (addr_num) diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index 57d87afcb0..e6a6ed1eb6 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2010-2016 Freescale Semiconductor Inc. - * Copyright 2017-2019 NXP + * Copyright 2017-2019,2023 NXP * */ #include @@ -44,6 +44,7 @@ dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) fprintf(f, "\n+ Fman %d, MAC %d (%s);\n", __if->fman_idx, __if->mac_idx, + (__if->mac_type == fman_offline) ? "OFFLINE" : (__if->mac_type == fman_mac_1g) ? "1G" : (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G"); @@ -56,13 +57,15 @@ dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) fprintf(f, "\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); fprintf(f, "\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); - fprintf(f, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); - fprintf(f, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); - fman_if_for_each_bpool(bpool, __if) - fprintf(f, "\tbuffer pool: (bpid=%d, count=%"PRId64 - " size=%"PRId64", addr=0x%"PRIx64")\n", - bpool->bpid, bpool->count, bpool->size, - bpool->addr); + if (__if->mac_type != fman_offline) { + fprintf(f, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); + fprintf(f, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); + fman_if_for_each_bpool(bpool, __if) + fprintf(f, "\tbuffer pool: (bpid=%d, count=%"PRId64 + " size=%"PRId64", addr=0x%"PRIx64")\n", + bpool->bpid, bpool->count, bpool->size, + bpool->addr); + } } } #endif /* RTE_LIBRTE_DPAA_DEBUG_DRIVER */ diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 1f6997c77e..6e4ec90670 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -43,6 +43,7 @@ #include #include #include +#include struct rte_dpaa_bus { struct rte_bus bus; @@ -203,9 +204,12 @@ dpaa_create_device_list(void) /* Create device name */ memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN); - sprintf(dev->name, "fm%d-mac%d", (fman_intf->fman_idx + 1), - fman_intf->mac_idx); - DPAA_BUS_LOG(INFO, "%s netdev added", dev->name); + if (fman_intf->mac_type == fman_offline) + sprintf(dev->name, "fm%d-oh%d", + (fman_intf->fman_idx + 1), fman_intf->mac_idx); + else + sprintf(dev->name, "fm%d-mac%d", + (fman_intf->fman_idx + 1), fman_intf->mac_idx); dev->device.name = dev->name; dev->device.devargs = dpaa_devargs_lookup(dev); @@ -441,7 +445,7 @@ static int rte_dpaa_bus_parse(const char *name, void *out) { unsigned int i, j; - size_t delta; + size_t delta, dev_delta; size_t max_name_len; /* There are two ways of passing device name, with and without @@ -458,16 +462,25 @@ rte_dpaa_bus_parse(const char *name, void *out) delta = 5; } + /* dev_delta points to the dev name (mac/oh/onic). Not valid for + * dpaa_sec. + */ + dev_delta = delta + sizeof("fm.-") - 1; + if (strncmp("dpaa_sec", &name[delta], 8) == 0) { if (sscanf(&name[delta], "dpaa_sec-%u", &i) != 1 || i < 1 || i > 4) return -EINVAL; max_name_len = sizeof("dpaa_sec-.") - 1; + } else if (strncmp("oh", &name[dev_delta], 2) == 0) { + if (sscanf(&name[delta], "fm%u-oh%u", &i, &j) != 2 || + i >= 2 || j >= 16) + return -EINVAL; + max_name_len = sizeof("fm.-oh..") - 1; } else { if (sscanf(&name[delta], "fm%u-mac%u", &i, &j) != 2 || i >= 2 || j >= 16) return -EINVAL; - max_name_len = sizeof("fm.-mac..") - 1; } diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 109c1a4a22..377f73bf0d 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -2,7 +2,7 @@ * * Copyright 2010-2012 Freescale Semiconductor, Inc. * All rights reserved. - * Copyright 2019-2022 NXP + * Copyright 2019-2023 NXP * */ @@ -78,7 +78,7 @@ TAILQ_HEAD(rte_fman_if_list, __fman_if); /* Represents the different flavour of network interface */ enum fman_mac_type { - fman_offline_internal = 0, + fman_offline = 0, fman_mac_1g, fman_mac_10g, fman_mac_2_5g, @@ -474,11 +474,30 @@ extern int fman_ccsr_map_fd; #define FMAN_IP_REV_1_MAJOR_MASK 0x0000FF00 #define FMAN_IP_REV_1_MAJOR_SHIFT 8 #define FMAN_V3 0x06 -#define FMAN_V3_CONTEXTA_EN_A2V 0x10000000 -#define FMAN_V3_CONTEXTA_EN_OVOM 0x02000000 -#define FMAN_V3_CONTEXTA_EN_EBD 0x80000000 -#define FMAN_CONTEXTA_DIS_CHECKSUM 0x7ull -#define FMAN_CONTEXTA_SET_OPCODE11 0x2000000b00000000 + +#define DPAA_FQD_CTX_A_SHIFT_BITS 24 +#define DPAA_FQD_CTX_B_SHIFT_BITS 24 + +/* Following flags are used to set in context A hi field of FQD */ +#define DPAA_FQD_CTX_A_OVERRIDE_FQ (0x80 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_IGNORE_CMD (0x40 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_A1_FIELD_VALID (0x20 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_A2_FIELD_VALID (0x10 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_A0_FIELD_VALID (0x08 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_B0_FIELD_VALID (0x04 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_OVERRIDE_OMB (0x02 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A_RESERVED (0x01 << DPAA_FQD_CTX_A_SHIFT_BITS) + +/* Following flags are used to set in context A lo field of FQD */ +#define DPAA_FQD_CTX_A2_EBD_BIT (0x80 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_EBAD_BIT (0x40 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_FWD_BIT (0x20 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_NL_BIT (0x10 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_CWD_BIT (0x08 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_NENQ_BIT (0x04 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_RESERVED_BIT (0x02 << DPAA_FQD_CTX_A_SHIFT_BITS) +#define DPAA_FQD_CTX_A2_VSPE_BIT (0x01 << DPAA_FQD_CTX_A_SHIFT_BITS) + extern u16 fman_ip_rev; extern u32 fman_dealloc_bufs_mask_hi; extern u32 fman_dealloc_bufs_mask_lo; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 979220a700..130faa6b92 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -292,7 +292,7 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) max_rx_pktlen = DPAA_MAX_RX_PKT_LEN; } - if (!fif->is_shared_mac) + if (fif->mac_type != fman_offline) fman_if_set_maxfrm(dev->process_private, max_rx_pktlen); if (rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) { @@ -311,6 +311,10 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) dpaa_write_fm_config_to_file(); } + /* Disable interrupt support on offline port*/ + if (fif->mac_type == fman_offline) + return 0; + /* if the interrupts were configured on this devices*/ if (intr_handle && rte_intr_fd_get(intr_handle)) { if (dev->data->dev_conf.intr_conf.lsc != 0) @@ -527,6 +531,9 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) ret = dpaa_eth_dev_stop(dev); + if (fif->mac_type == fman_offline) + return 0; + /* Reset link to autoneg */ if (link->link_status && !link->link_autoneg) dpaa_restart_link_autoneg(__fif->node_name); @@ -640,6 +647,11 @@ static int dpaa_eth_dev_info(struct rte_eth_dev *dev, | RTE_ETH_LINK_SPEED_1G | RTE_ETH_LINK_SPEED_2_5G | RTE_ETH_LINK_SPEED_10G; + } else if (fif->mac_type == fman_offline) { + dev_info->speed_capa = RTE_ETH_LINK_SPEED_10M_HD + | RTE_ETH_LINK_SPEED_10M + | RTE_ETH_LINK_SPEED_100M_HD + | RTE_ETH_LINK_SPEED_100M; } else { DPAA_PMD_ERR("invalid link_speed: %s, %d", dpaa_intf->name, fif->mac_type); @@ -740,7 +752,8 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev, ioctl_version = dpaa_get_ioctl_version_number(); - if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) { + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && + fif->mac_type != fman_offline) { for (count = 0; count <= MAX_REPEAT_TIME; count++) { ret = dpaa_get_link_status(__fif->node_name, link); if (ret) @@ -753,6 +766,11 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev, } } else { link->link_status = dpaa_intf->valid; + if (fif->mac_type == fman_offline) { + /*Max supported rate for O/H port is 3.75Mpps*/ + link->link_speed = RTE_ETH_SPEED_NUM_2_5G; + link->link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + } } if (ioctl_version < 2) { @@ -1073,7 +1091,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, dpaa_intf->bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp); /* For shared interface, it's done in kernel, skip.*/ - if (!fif->is_shared_mac) + if (!fif->is_shared_mac && fif->mac_type != fman_offline) dpaa_fman_if_pool_setup(dev); if (fif->num_profiles) { @@ -1218,8 +1236,11 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, rxq->fqid, ret); } } + /* Enable main queue to receive error packets also by default */ - fman_if_set_err_fqid(fif, rxq->fqid); + if (fif->mac_type != fman_offline) + fman_if_set_err_fqid(fif, rxq->fqid); + return 0; } @@ -1368,7 +1389,8 @@ static int dpaa_link_down(struct rte_eth_dev *dev) __fif = container_of(fif, struct __fman_if, __if); - if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && + fif->mac_type != fman_offline) dpaa_update_link_status(__fif->node_name, RTE_ETH_LINK_DOWN); else return dpaa_eth_dev_stop(dev); @@ -1384,7 +1406,8 @@ static int dpaa_link_up(struct rte_eth_dev *dev) __fif = container_of(fif, struct __fman_if, __if); - if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && + fif->mac_type != fman_offline) dpaa_update_link_status(__fif->node_name, RTE_ETH_LINK_UP); else dpaa_eth_dev_start(dev); @@ -1479,9 +1502,15 @@ dpaa_dev_add_mac_addr(struct rte_eth_dev *dev, __rte_unused uint32_t pool) { int ret; + struct fman_if *fif = dev->process_private; PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_offline) { + DPAA_PMD_DEBUG("Add MAC Address not supported on O/H port"); + return 0; + } + ret = fman_if_add_mac_addr(dev->process_private, addr->addr_bytes, index); @@ -1494,8 +1523,15 @@ static void dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_offline) { + DPAA_PMD_DEBUG("Remove MAC Address not supported on O/H port"); + return; + } + fman_if_clear_mac_addr(dev->process_private, index); } @@ -1504,9 +1540,15 @@ dpaa_dev_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { int ret; + struct fman_if *fif = dev->process_private; PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_offline) { + DPAA_PMD_DEBUG("Set MAC Address not supported on O/H port"); + return 0; + } + ret = fman_if_add_mac_addr(dev->process_private, addr->addr_bytes, 0); if (ret) DPAA_PMD_ERR("Setting the MAC ADDR failed %d", ret); @@ -1805,6 +1847,17 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx, return ret; } +uint8_t fm_default_vsp_id(struct fman_if *fif) +{ + /* Avoid being same as base profile which could be used + * for kernel interface of shared mac. + */ + if (fif->base_profile_id) + return 0; + else + return DPAA_DEFAULT_RXQ_VSP_ID; +} + /* Initialise a Tx FQ */ static int dpaa_tx_queue_init(struct qman_fq *fq, struct fman_if *fman_intf, @@ -1839,14 +1892,21 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, opts.fqd.context_a.hi = fman_dealloc_bufs_mask_hi; #else /* no tx-confirmation */ - opts.fqd.context_a.lo = 0 | fman_dealloc_bufs_mask_lo; - opts.fqd.context_a.hi = 0x80000000 | fman_dealloc_bufs_mask_hi; + opts.fqd.context_a.lo = fman_dealloc_bufs_mask_lo; + opts.fqd.context_a.hi = DPAA_FQD_CTX_A_OVERRIDE_FQ | + fman_dealloc_bufs_mask_hi; #endif - if (fman_ip_rev >= FMAN_V3) { + if (fman_ip_rev >= FMAN_V3) /* Set B0V bit in contextA to set ASPID to 0 */ - opts.fqd.context_a.hi |= 0x04000000; + opts.fqd.context_a.hi |= DPAA_FQD_CTX_A_B0_FIELD_VALID; + + if (fman_intf->mac_type == fman_offline) { + opts.fqd.context_a.lo |= DPAA_FQD_CTX_A2_VSPE_BIT; + opts.fqd.context_b = fm_default_vsp_id(fman_intf) << + DPAA_FQD_CTX_B_SHIFT_BITS; } + DPAA_PMD_DEBUG("init tx fq %p, fqid 0x%x", fq, fq->fqid); if (cgr_tx) { @@ -2219,7 +2279,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_DEBUG("All frame queues created"); /* Get the initial configuration for flow control */ - dpaa_fc_set_default(dpaa_intf, fman_intf); + if (fman_intf->mac_type != fman_offline) + dpaa_fc_set_default(dpaa_intf, fman_intf); /* reset bpool list, initialize bpool dynamically */ list_for_each_entry_safe(bp, tmp_bp, &cfg->fman_if->bpool_list, node) { @@ -2250,10 +2311,10 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_INFO("net: dpaa: %s: " RTE_ETHER_ADDR_PRT_FMT, dpaa_device->name, RTE_ETHER_ADDR_BYTES(&fman_intf->mac_addr)); - if (!fman_intf->is_shared_mac) { + if (!fman_intf->is_shared_mac && fman_intf->mac_type != fman_offline) { /* Configure error packet handling */ fman_if_receive_rx_errors(fman_intf, - FM_FD_RX_STATUS_ERR_MASK); + FM_FD_RX_STATUS_ERR_MASK); /* Disable RX mode */ fman_if_disable_rx(fman_intf); /* Disable promiscuous mode */ diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index 068c153dc7..ddb83e3741 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2014-2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017-2022 NXP + * Copyright 2017-2023 NXP * */ #ifndef __DPAA_ETHDEV_H__ @@ -120,6 +120,9 @@ enum { extern struct rte_mempool *dpaa_tx_sg_pool; +/* PMD related logs */ +extern int dpaa_logtype_pmd; + /* structure to free external and indirect * buffers. */ @@ -265,6 +268,9 @@ dpaa_timesync_read_rx_timestamp(struct rte_eth_dev *dev, struct timespec *timestamp, uint32_t flags __rte_unused); +uint8_t +fm_default_vsp_id(struct fman_if *fif); + /* PMD related logs */ extern int dpaa_logtype_pmd; #define RTE_LOGTYPE_DPAA_PMD dpaa_logtype_pmd diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c index dfc81e4e43..b43c3b1b86 100644 --- a/drivers/net/dpaa/dpaa_flow.c +++ b/drivers/net/dpaa/dpaa_flow.c @@ -54,17 +54,6 @@ static struct dpaa_fm_info fm_info; static struct dpaa_fm_model fm_model; static const char *fm_log = "/tmp/fmdpdk.bin"; -static inline uint8_t fm_default_vsp_id(struct fman_if *fif) -{ - /* Avoid being same as base profile which could be used - * for kernel interface of shared mac. - */ - if (fif->base_profile_id) - return 0; - else - return DPAA_DEFAULT_RXQ_VSP_ID; -} - static void fm_prev_cleanup(void) { uint32_t fman_id = 0, i = 0, devid; @@ -660,7 +649,9 @@ static inline int get_rx_port_type(struct fman_if *fif) /* For 1G fm-mac9 and fm-mac10 ports, configure the VSP as 10G * ports so that kernel can configure correct port. */ - if (fif->mac_type == fman_mac_1g && + if (fif->mac_type == fman_offline) + return e_FM_PORT_TYPE_OH_OFFLINE_PARSING; + else if (fif->mac_type == fman_mac_1g && fif->mac_idx >= DPAA_10G_MAC_START_IDX) return e_FM_PORT_TYPE_RX_10G; else if (fif->mac_type == fman_mac_1g) @@ -671,12 +662,14 @@ static inline int get_rx_port_type(struct fman_if *fif) return e_FM_PORT_TYPE_RX_10G; DPAA_PMD_ERR("MAC type unsupported"); - return -1; + return e_FM_PORT_TYPE_DUMMY; } static inline int get_tx_port_type(struct fman_if *fif) { - if (fif->mac_type == fman_mac_1g) + if (fif->mac_type == fman_offline) + return e_FM_PORT_TYPE_OH_OFFLINE_PARSING; + else if (fif->mac_type == fman_mac_1g) return e_FM_PORT_TYPE_TX; else if (fif->mac_type == fman_mac_2_5g) return e_FM_PORT_TYPE_TX_2_5G; @@ -684,7 +677,7 @@ static inline int get_tx_port_type(struct fman_if *fif) return e_FM_PORT_TYPE_TX_10G; DPAA_PMD_ERR("MAC type unsupported"); - return -1; + return e_FM_PORT_TYPE_DUMMY; } static inline int set_fm_port_handle(struct dpaa_if *dpaa_intf, @@ -983,17 +976,31 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf, memset(&vsp_params, 0, sizeof(vsp_params)); vsp_params.h_fm = fman_handle; vsp_params.relative_profile_id = vsp_id; - vsp_params.port_params.port_id = idx; + if (fif->mac_type == fman_offline) + vsp_params.port_params.port_id = fif->mac_idx; + else + vsp_params.port_params.port_id = idx; + if (fif->mac_type == fman_mac_1g) { vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX; } else if (fif->mac_type == fman_mac_2_5g) { vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX_2_5G; } else if (fif->mac_type == fman_mac_10g) { vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX_10G; + } else if (fif->mac_type == fman_offline) { + vsp_params.port_params.port_type = + e_FM_PORT_TYPE_OH_OFFLINE_PARSING; } else { DPAA_PMD_ERR("Mac type %d error", fif->mac_type); return -1; } + + vsp_params.port_params.port_type = get_rx_port_type(fif); + if (vsp_params.port_params.port_type == e_FM_PORT_TYPE_DUMMY) { + DPAA_PMD_ERR("Mac type %d error", fif->mac_type); + return -1; + } + vsp_params.ext_buf_pools.num_of_pools_used = 1; vsp_params.ext_buf_pools.ext_buf_pool[0].id = dpaa_intf->vsp_bpid[vsp_id]; vsp_params.ext_buf_pools.ext_buf_pool[0].size = mbuf_data_room_size; diff --git a/drivers/net/dpaa/dpaa_fmc.c b/drivers/net/dpaa/dpaa_fmc.c index 30f10fae33..abcac51482 100644 --- a/drivers/net/dpaa/dpaa_fmc.c +++ b/drivers/net/dpaa/dpaa_fmc.c @@ -215,8 +215,7 @@ dpaa_port_fmc_port_parse(struct fman_if *fif, if (pport->type == e_FM_PORT_TYPE_OH_OFFLINE_PARSING && pport->number == fif->mac_idx && - (fif->mac_type == fman_offline_internal || - fif->mac_type == fman_onic)) + fif->mac_type == fman_offline) return current_port; if (fif->mac_type == fman_mac_1g) { From patchwork Thu Aug 1 10:53:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142835 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D146045710; Thu, 1 Aug 2024 12:55:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7645433FE; Thu, 1 Aug 2024 12:53:55 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012034.outbound.protection.outlook.com [52.101.66.34]) by mails.dpdk.org (Postfix) with ESMTP id 83E02433E2 for ; Thu, 1 Aug 2024 12:53:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JfblRZqMiKUHMWFaLsIfQYOO7hkjJu/ASzHtQxpgOeaf0DRhp01NnLvzkFX7wSAh0b+ZxPfgwaPPXfICoWlrbUre8JAjZxV5hmW0IB7YaZT8nViHPaA15Tr25U4EpTi0H343unPEqVQUlG8FLqU/7N9Z5u91sod/XqbVYKPsrYNs6MDlkbSj3IlrPINLB8WzP1OVkEhT8lGMaXMPG9FTlvNGy858HokYyk1c2WSel8tgI7AZCklRyaE3GlOkgl0KlUy5l6A/e6iieHvR/XR4P9h3vpr8bQkcLPAOIZsgWFGzz3IVOVphmdl0M2z7VoGm17i+Q7GOx2IZ2Yv1QBX01w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=9ISKY7xqUDJyRzOvBKSZe7FfnrK6IuF9QnIqKZaDtj0=; b=khK5HVckBZNly2wfELtlYfSYseMrEugn6q/yk2FCM7RbVhP0TcSGsyJJgfmf0lQNyKvXxokVSJ5BRiFa/LQdVwnTmKjm6LRvXSMg0xMAWr+TaxJa72A6VQDGUgM7k4iki0A7eshpBbJ8LrrzjTICxmD1oDhFz5bBFhpCehf09XaQU77te4d9o0MO8USC81j7nx4bLEkmXXqBTxgmnQEjYNy8fy0mDgk7nSK9tyyttcGn1Pe4czLhT9ZtZUDwNYHeij8Q0Hmx+oedKuXPjD9fTyAcXS0Ma0SUqjhFOsLYBNJP6lX/8K7hOZ3es39LVAOmRk4Z35QLvl6G2BsDfL8oOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9ISKY7xqUDJyRzOvBKSZe7FfnrK6IuF9QnIqKZaDtj0=; b=FcncI8NO43m5YIUjJS0myoD0Pzt1vh05LT24Y10bkTKjHanX+5ih/+n07i+xcfBunatHJTmUwdKnmjFrGtcRzcQjQrOvw26FR4DEX/6gowZMsk3dngw6HqztwM7hiqnlztbIr5IckY+X7p34UwUxPpwruXuCXDf2k3ELPD9zx8eqdBktckmt8OswZ45mZX2/mB5SBSyyvZj6ajM3cGJnbWdVkDcDiovVjmvq9Ro5LZfkzvPEH1bpJRt53dcfDngbXZfz3Jcz/Djvd4O28U89D/JJ4nE6ndIptQjjA2IjXtSpdMXSa3PjK0xuKo/AlQCmdxL0ZYeNuq/5v84zYO8xYg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AS8PR04MB8433.eurprd04.prod.outlook.com (2603:10a6:20b:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Thu, 1 Aug 2024 10:53:49 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:49 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Rohit Raj Subject: [PATCH 15/17] bus/dpaa: add ONIC port mode for the DPAA eth Date: Thu, 1 Aug 2024 16:23:11 +0530 Message-Id: <20240801105313.630280-16-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AS8PR04MB8433:EE_ X-MS-Office365-Filtering-Correlation-Id: 4fbe4e31-6fdb-4a13-232c-08dcb2183950 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: DPbeoDvBhKSCMpjIcxnjHAI2ZIMQ15O0dSku5XlCkIndVAqaDjjMubo1ORuF+4TYiiANnWQMY6h2MGk4XIPSTWOyygj3aJi6jRYPmkj9B4z/0+6jZ71VOU55KAzEjlT3jKrkNBGecioIzIVvBPERYj1at/6tKFczTYX+F5CwgD1Ls4qEyQfgirpFuig2IjLto3OwebZUQNO4BMmqA7E6xZ43YuVYI00AfAVEpHdBEWTsQk+8aYkc+2BSNxSNrpGsGpQ6WatfCxdVWiqUviBJQHsthWWYD1YWQCI7j+tR6nQPJ+1jHSrGq8BaSyeQ/sNgsDJlV3vwZ5vp0wkX9xb+fpg1iPPfgBmBAcVrgYxp7iIg3/E/4qG4qdiwJ1fhQFbtrSk6BmvgqUN6B7nzRqC+aMiDW7UK1WYy9WaFavpnRzAvXcle2z4Mr72Iq6MxvB8jRTMzx2zH5K/JlB6jZFcjJ8zqsqKVNy7makXGdVZlOdCNnI/faVnFsOsSdzlc1n1A9gxcP1pghiHp04ncO8CQVi3XWYX7HmLQ1atRZj/3XDGAw/J1zM3QTu2hxwCCdWC6dyh5+A9M591283vnGylWn39v+LkeJOFjdfq/Wi+MQLkWPraU//aMQjhptuTOvfVSj7BmaNaF2K6MuJwf2u2MGfhX8vwE/Cv2vwF2GJQpLRnuLokn61Kz7Z4C7cMThiALaFKPBanKGI1QO2SDXEVDsH4Tl+NvcxxnF4pZltjNBo3Ie8uaOXtQ6p3g+t6WsXAciUo77VGYPcIU0TcTOZSMPde+71Illysrm3u2sElaqsgsXNWIr1zz/5fvyfpk7lB0nO65vlLy0kFxz6B+bsA6AbPPaFu9QyS3GxWOU6Ng09VU6C2Wma7uYN8bTXwVmDhE7i0Ea2iOzSTsg35MuNIpO+2pawjDZRcr9ed2Qyb7SxjDJpELZw2nkdUpPfIVjjfNfemyLzSDLmvyeejZjDHVKwr7/qaEVNlF3DqK262EMNsu9N0NSHfOTwl4vO6WoH53D+dnAc/09zdxbbdHdzuqqFCD6cGI7yIiMHDlC+mmLO2WDv+TRMd6Svt8y88iG9VhRyTWqCmsP5VqcUS64yEdm0V2bTAXbIpOUrRuONhVonAa1aNE3P+d58wQrnz/Nchk6TPsvzHRed7TZBbIQgnEQL+oTtbUENgcZRWSeCAl+hsvthc/ril+omE78z8Jbqr/lc82t8YCBlF6Zgt0gWAb2qEAwZbemhTaXBqZbq5ckDe2jEfjueesacURxbWp3+apyK4ZaiT8oAmmFWGf0BRzv1H+Z2iutFunYzUi9NK/yYc7fzzYbP4N+eqQ0PMS1/Md8coFwNBeBjDtaBx3FRpFg+AMxh6BMCe2htcP5lRlZ3xTOb2dGlBf3G/m8uULbQXabBvkELftp0KJeTJV5LDHrA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h1ocO+uLdEBsaCg1+r7x8TlOWhWfiOHn5dOT8zKHFx4vFHv7jW/QiMAQ73PG+Z+PX2Ctq4ge0cYJTYJOnm4tZe/OG/lUfmL2wZFqBChglDGUBVFe56l7GH7AXctPopsAjIJwGAsGCrR3oz1Hgs7Ow5V3tOGOfv0P7bnJ/zV6Wf+pYx5Tt19lMIS3lMRx+nv5VQ5Nm+wIF+ILA3O2cKieiit+3upC6dCRAnT4KPOE3Zz8WFS15P6qfbBr2N2+P+W9SDv0Dqq9ZpS3v1IOMispDhsUYLvaoyxn96mK7krdX7LyNgRWK8PYRHFWNpyvyZJU6iZNj/yob3o9LCjRFRPcEpKjezPPKDkItbhW7jqDD/IRhiTRBKjmvRpDpUtw5Y+7rI0PWsfLFhZRcLL5zUhq4kihgRvEaal8EZ8tbMtO+a+Ux5VxZ8ZSEL7Bthemk0bnZH81MVLog5IDuQlwhtqEHe6wM5QPiCHuXR77YP+P9GgXHcYtLL1CMBIPp1bqCbYgSBi85lc+GAs6P4SPY9mYnxJQb78vCvIGRpeMXSr3TI6i4Tx7GFO2pIcGK6wiTeRWmMbxLHmnQ6WemfEcd6B5UJabcF5Tm6erqBx1owjSnxxoMwNqJJXG3nT4SAvpOysQg83cgfHOhK15Q6gNDdwef/TMvQfevDsoZjh7DL98VGb2mjtinLeKwUJo6jlNdq3bhnxHiu7JdsCw1vIwYwKSonkO65UpVQUOYEFeznmuN3ozMJ1WQeA/M7UqovOgY6hsiBw+ofv0kPfibuKIM1dt1PEMsb1t0SFImxYVHGjesYFUfnIGKAyCFQUoaEUicz+8FXD38HZ2NGleoSEcF+/nvV4tcPvArKbNBLfCFc5zfcQdmuz7dlJ6KDeYcNKXR2+4b9AmebFIm7gkURu7sQy1j+Qzl5kwyaKDsGQ7BWlTSupaP7tM+tV3hs9qa0hPfetM570KxYPCha3OTNJJEXlEY8cFi9P9jWAUHW5U1SmooQxkpVB3X3OcYulKndpre0Cm9HKWBowR+BZTeQURfMA8fSSQocXd9hx5KxfqsQ1Sf/nveuP2cqm54BPFa7ho89TNG5CFx4vlPI4kpu3weNytFqj+txFSpajp+uSYj5rXTwYkRiWZ6kq2qhhKaUFklWoPUZ2y6/4745sbirJAh1J2l2ADJ+ijHKphavwMl+hLwyesDm6AU2WfAGGw2qAbFbWy2jdihk90Lq4q5piJi06JlVmvw6dXUYAeI8VLqtbXXn/x3vsA4noVhPHKKa6pJbI9WJUcvZAIfQYyE0Uri4I6yoc2tSsl32HDEuPY2T9cu+3/Dt6qTzkKrxwydnyD2ERCrDdVd0EVqiprhvC8SDKsOsZgcrwww3N2kT+DZCcZGrwwgnXPHkj1C29ADlsn0hHO5eX2ALu/+7sScEBChooZDlvyeA52vZxLV069V4lAoWyXBHvDIbSInL50wxIuyA3RlUPqz31kzRfUZr2aAY6AITG1tVEdxhCvITH7Xu61XSZILVf9kfrSmHg0KwKNR9fOTWviyOqskto1WlrwnBOrPWqXEEyW3os+QT30BFacBu7gv3jKjH3pPLF0O2TSHB4VJxC36RpC+W9CslMBnGaCow== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fbe4e31-6fdb-4a13-232c-08dcb2183950 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:49.3258 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s9oLV/soQXoI3lR171+fvrVIEBza0PEP15sZn/MII4VBaCnCFz/Mnix5ZU7YxjAAIRsPWgn+MRCEZHaTxPLSsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8433 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 From: Rohit Raj The OH ports can also be used by two application, processing contexts to communicate to each other. This patch enables this mode for dpaa-eth OH port as ONIC port, so that application can use the dpaa-eth to communicate to each other on the same SoC. Again,this properties is driven by the system device-tree variables. Signed-off-by: Rohit Raj --- doc/guides/nics/dpaa.rst | 3 + drivers/bus/dpaa/base/fman/fman.c | 299 +++++++++++++++++++++- drivers/bus/dpaa/base/fman/fman_hw.c | 20 +- drivers/bus/dpaa/base/fman/netcfg_layer.c | 4 +- drivers/bus/dpaa/dpaa_bus.c | 10 +- drivers/bus/dpaa/include/fman.h | 15 +- drivers/net/dpaa/dpaa_ethdev.c | 114 +++++++-- drivers/net/dpaa/dpaa_flow.c | 28 +- drivers/net/dpaa/dpaa_fmc.c | 3 +- 9 files changed, 439 insertions(+), 57 deletions(-) diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst index 448607e9ac..4bd95398ca 100644 --- a/doc/guides/nics/dpaa.rst +++ b/doc/guides/nics/dpaa.rst @@ -136,6 +136,8 @@ RTE framework and DPAA internal components/drivers. The Ethernet driver is bound to a FMAN port and implements the interfaces needed to connect the DPAA network interface to the network stack. Each FMAN Port corresponds to a DPDK network interface. +- PMD also support OH/ONIC mode, where the port works as a HW assisted + virtual port without actually connecting to a Physical MAC. Features @@ -149,6 +151,7 @@ Features - Checksum offload - Promiscuous mode - IEEE1588 PTP + - OH/ONIC virtual port support DPAA Mempool Driver ~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c index f817305ab7..efe6eab4a9 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -43,7 +43,7 @@ if_destructor(struct __fman_if *__if) if (!__if) return; - if (__if->__if.mac_type == fman_offline) + if (__if->__if.mac_type == fman_offline_internal) goto cleanup; list_for_each_entry_safe(bp, tmpbp, &__if->__if.bpool_list, node) { @@ -465,7 +465,7 @@ fman_if_init(const struct device_node *dpa_node) __if->__if.is_memac = 0; if (is_offline) - __if->__if.mac_type = fman_offline; + __if->__if.mac_type = fman_offline_internal; else if (of_device_is_compatible(mac_node, "fsl,fman-1g-mac")) __if->__if.mac_type = fman_mac_1g; else if (of_device_is_compatible(mac_node, "fsl,fman-10g-mac")) @@ -791,6 +791,292 @@ fman_if_init(const struct device_node *dpa_node) dname, __if->__if.tx_channel_id, __if->__if.fman_idx, __if->__if.mac_idx); + /* Don't add OH port to the port list since they will be used by ONIC + * ports. + */ + if (!is_offline) + list_add_tail(&__if->__if.node, &__ifs); + + return 0; +err: + if_destructor(__if); + return _errno; +} + +static int fman_if_init_onic(const struct device_node *dpa_node) +{ + struct __fman_if *__if; + struct fman_if_bpool *bpool; + const phandle *tx_pools_phandle; + const phandle *tx_channel_id, *mac_addr, *cell_idx; + const phandle *rx_phandle; + const struct device_node *pool_node; + size_t lenp; + int _errno; + const phandle *p_onic_oh_nodes = NULL; + const struct device_node *rx_oh_node = NULL; + const struct device_node *tx_oh_node = NULL; + const phandle *p_fman_rx_oh_node = NULL, *p_fman_tx_oh_node = NULL; + const struct device_node *fman_rx_oh_node = NULL; + const struct device_node *fman_tx_oh_node = NULL; + const struct device_node *fman_node; + uint32_t na = OF_DEFAULT_NA; + uint64_t rx_phandle_host[4] = {0}; + uint64_t cell_idx_host = 0; + + if (of_device_is_available(dpa_node) == false) + return 0; + + if (!of_device_is_compatible(dpa_node, "fsl,dpa-ethernet-generic")) + return 0; + + /* Allocate an object for this network interface */ + __if = rte_malloc(NULL, sizeof(*__if), RTE_CACHE_LINE_SIZE); + if (!__if) { + FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*__if)); + goto err; + } + memset(__if, 0, sizeof(*__if)); + + INIT_LIST_HEAD(&__if->__if.bpool_list); + + strlcpy(__if->node_name, dpa_node->name, IF_NAME_MAX_LEN - 1); + __if->node_name[IF_NAME_MAX_LEN - 1] = '\0'; + + strlcpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1); + __if->node_path[PATH_MAX - 1] = '\0'; + + /* Mac node is onic */ + __if->__if.is_memac = 0; + __if->__if.mac_type = fman_onic; + + /* Extract the MAC address for linux peer */ + mac_addr = of_get_property(dpa_node, "local-mac-address", &lenp); + if (!mac_addr) { + FMAN_ERR(-EINVAL, "%s: no local-mac-address\n", + dpa_node->full_name); + goto err; + } + + memcpy(&__if->__if.onic_info.peer_mac, mac_addr, ETHER_ADDR_LEN); + + /* Extract the Rx port (it's the first of the two port handles) + * and get its channel ID. + */ + p_onic_oh_nodes = of_get_property(dpa_node, "fsl,oh-ports", &lenp); + if (!p_onic_oh_nodes) { + FMAN_ERR(-EINVAL, "%s: couldn't get p_onic_oh_nodes\n", + dpa_node->full_name); + goto err; + } + + rx_oh_node = of_find_node_by_phandle(p_onic_oh_nodes[0]); + if (!rx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get rx_oh_node\n", + dpa_node->full_name); + goto err; + } + + p_fman_rx_oh_node = of_get_property(rx_oh_node, "fsl,fman-oh-port", + &lenp); + if (!p_fman_rx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get p_fman_rx_oh_node\n", + rx_oh_node->full_name); + goto err; + } + + fman_rx_oh_node = of_find_node_by_phandle(*p_fman_rx_oh_node); + if (!fman_rx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get fman_rx_oh_node\n", + rx_oh_node->full_name); + goto err; + } + + tx_channel_id = of_get_property(fman_rx_oh_node, "fsl,qman-channel-id", + &lenp); + if (!tx_channel_id) { + FMAN_ERR(-EINVAL, "%s: no fsl-qman-channel-id\n", + rx_oh_node->full_name); + goto err; + } + assert(lenp == sizeof(*tx_channel_id)); + + __if->__if.tx_channel_id = of_read_number(tx_channel_id, na); + + /* Extract the FQs from which oNIC driver in Linux is dequeuing */ + rx_phandle = of_get_property(rx_oh_node, "fsl,qman-frame-queues-oh", + &lenp); + if (!rx_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-oh\n", + rx_oh_node->full_name); + goto err; + } + assert(lenp == (4 * sizeof(phandle))); + + __if->__if.onic_info.rx_start = of_read_number(&rx_phandle[2], na); + __if->__if.onic_info.rx_count = of_read_number(&rx_phandle[3], na); + + /* Extract the Rx FQIDs */ + tx_oh_node = of_find_node_by_phandle(p_onic_oh_nodes[1]); + if (!tx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get tx_oh_node\n", + dpa_node->full_name); + goto err; + } + + p_fman_tx_oh_node = of_get_property(tx_oh_node, "fsl,fman-oh-port", + &lenp); + if (!p_fman_tx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get p_fman_tx_oh_node\n", + tx_oh_node->full_name); + goto err; + } + + fman_tx_oh_node = of_find_node_by_phandle(*p_fman_tx_oh_node); + if (!fman_tx_oh_node) { + FMAN_ERR(-EINVAL, "%s: couldn't get fman_tx_oh_node\n", + tx_oh_node->full_name); + goto err; + } + + cell_idx = of_get_property(fman_tx_oh_node, "cell-index", &lenp); + if (!cell_idx) { + FMAN_ERR(-ENXIO, "%s: no cell-index)\n", tx_oh_node->full_name); + goto err; + } + assert(lenp == sizeof(*cell_idx)); + + cell_idx_host = of_read_number(cell_idx, lenp / sizeof(phandle)); + __if->__if.mac_idx = cell_idx_host; + + fman_node = of_get_parent(fman_tx_oh_node); + cell_idx = of_get_property(fman_node, "cell-index", &lenp); + if (!cell_idx) { + FMAN_ERR(-ENXIO, "%s: no cell-index)\n", tx_oh_node->full_name); + goto err; + } + assert(lenp == sizeof(*cell_idx)); + + cell_idx_host = of_read_number(cell_idx, lenp / sizeof(phandle)); + __if->__if.fman_idx = cell_idx_host; + + rx_phandle = of_get_property(tx_oh_node, "fsl,qman-frame-queues-oh", + &lenp); + if (!rx_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,qman-frame-queues-oh\n", + dpa_node->full_name); + goto err; + } + assert(lenp == (4 * sizeof(phandle))); + + rx_phandle_host[0] = of_read_number(&rx_phandle[0], na); + rx_phandle_host[1] = of_read_number(&rx_phandle[1], na); + rx_phandle_host[2] = of_read_number(&rx_phandle[2], na); + rx_phandle_host[3] = of_read_number(&rx_phandle[3], na); + + assert((rx_phandle_host[1] == 1) && (rx_phandle_host[3] == 1)); + + __if->__if.fqid_rx_err = rx_phandle_host[0]; + __if->__if.fqid_rx_def = rx_phandle_host[2]; + + /* Don't Extract the Tx FQIDs */ + __if->__if.fqid_tx_err = 0; + __if->__if.fqid_tx_confirm = 0; + + /* Obtain the buffer pool nodes used by Tx OH port */ + tx_pools_phandle = of_get_property(tx_oh_node, "fsl,bman-buffer-pools", + &lenp); + if (!tx_pools_phandle) { + FMAN_ERR(-EINVAL, "%s: no fsl,bman-buffer-pools\n", + tx_oh_node->full_name); + goto err; + } + assert(lenp && !(lenp % sizeof(phandle))); + + /* For each pool, parse the corresponding node and add a pool object to + * the interface's "bpool_list". + */ + + while (lenp) { + size_t proplen; + const phandle *prop; + uint64_t bpool_host[6] = {0}; + + /* Allocate an object for the pool */ + bpool = rte_malloc(NULL, sizeof(*bpool), RTE_CACHE_LINE_SIZE); + if (!bpool) { + FMAN_ERR(-ENOMEM, "malloc(%zu)\n", sizeof(*bpool)); + goto err; + } + + /* Find the pool node */ + pool_node = of_find_node_by_phandle(*tx_pools_phandle); + if (!pool_node) { + FMAN_ERR(-ENXIO, "%s: bad fsl,bman-buffer-pools\n", + tx_oh_node->full_name); + rte_free(bpool); + goto err; + } + + /* Extract the BPID property */ + prop = of_get_property(pool_node, "fsl,bpid", &proplen); + if (!prop) { + FMAN_ERR(-EINVAL, "%s: no fsl,bpid\n", + pool_node->full_name); + rte_free(bpool); + goto err; + } + assert(proplen == sizeof(*prop)); + + bpool->bpid = of_read_number(prop, na); + + /* Extract the cfg property (count/size/addr). "fsl,bpool-cfg" + * indicates for the Bman driver to seed the pool. + * "fsl,bpool-ethernet-cfg" is used by the network driver. The + * two are mutually exclusive, so check for either of them. + */ + + prop = of_get_property(pool_node, "fsl,bpool-cfg", &proplen); + if (!prop) + prop = of_get_property(pool_node, + "fsl,bpool-ethernet-cfg", + &proplen); + if (!prop) { + /* It's OK for there to be no bpool-cfg */ + bpool->count = bpool->size = bpool->addr = 0; + } else { + assert(proplen == (6 * sizeof(*prop))); + + bpool_host[0] = of_read_number(&prop[0], na); + bpool_host[1] = of_read_number(&prop[1], na); + bpool_host[2] = of_read_number(&prop[2], na); + bpool_host[3] = of_read_number(&prop[3], na); + bpool_host[4] = of_read_number(&prop[4], na); + bpool_host[5] = of_read_number(&prop[5], na); + + bpool->count = ((uint64_t)bpool_host[0] << 32) | + bpool_host[1]; + bpool->size = ((uint64_t)bpool_host[2] << 32) | + bpool_host[3]; + bpool->addr = ((uint64_t)bpool_host[4] << 32) | + bpool_host[5]; + } + + /* Parsing of the pool is complete, add it to the interface + * list. + */ + list_add_tail(&bpool->node, &__if->__if.bpool_list); + lenp -= sizeof(phandle); + tx_pools_phandle++; + } + + fman_if_vsp_init(__if); + + /* Parsing of the network interface is complete, add it to the list. */ + DPAA_BUS_DEBUG("Found %s, Tx Channel = %x, FMAN = %x, Port ID = %x", + dpa_node->full_name, __if->__if.tx_channel_id, + __if->__if.fman_idx, __if->__if.mac_idx); + list_add_tail(&__if->__if.node, &__ifs); return 0; err: @@ -830,6 +1116,13 @@ fman_init(void) } } + for_each_compatible_node(dpa_node, NULL, "fsl,dpa-ethernet-generic") { + /* it is a oNIC interface */ + _errno = fman_if_init_onic(dpa_node); + if (_errno) + FMAN_ERR(_errno, "if_init(%s)\n", dpa_node->full_name); + } + return 0; err: fman_finish(); @@ -847,7 +1140,7 @@ fman_finish(void) int _errno; /* No need to disable Offline port */ - if (__if->__if.mac_type == fman_offline) + if (__if->__if.mac_type == fman_offline_internal) continue; /* disable Rx and Tx */ diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index afe10de4bc..e4e0460b36 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -88,8 +88,9 @@ fman_if_add_hash_mac_addr(struct fman_if *p, uint8_t *eth) struct __fman_if *__if = container_of(p, struct __fman_if, __if); - /* Add hash mac addr not supported on Offline port */ - if (__if->__if.mac_type == fman_offline) + /* Add hash mac addr not supported on Offline port and onic port */ + if (__if->__if.mac_type == fman_offline_internal || + __if->__if.mac_type == fman_onic) return 0; eth_addr = ETH_ADDR_TO_UINT64(eth); @@ -115,9 +116,10 @@ fman_if_get_primary_mac_addr(struct fman_if *p, uint8_t *eth) u32 val = in_be32(mac_reg); int i; - /* Get mac addr not supported on Offline port */ + /* Get mac addr not supported on Offline port and onic port */ /* Return NULL mac address */ - if (__if->__if.mac_type == fman_offline) { + if (__if->__if.mac_type == fman_offline_internal || + __if->__if.mac_type == fman_onic) { for (i = 0; i < 6; i++) eth[i] = 0x0; return 0; @@ -143,8 +145,9 @@ fman_if_clear_mac_addr(struct fman_if *p, uint8_t addr_num) struct __fman_if *m = container_of(p, struct __fman_if, __if); void *reg; - /* Clear mac addr not supported on Offline port */ - if (m->__if.mac_type == fman_offline) + /* Clear mac addr not supported on Offline port and onic port */ + if (m->__if.mac_type == fman_offline_internal || + m->__if.mac_type == fman_onic) return; if (addr_num) { @@ -169,8 +172,9 @@ fman_if_add_mac_addr(struct fman_if *p, uint8_t *eth, uint8_t addr_num) void *reg; u32 val; - /* Set mac addr not supported on Offline port */ - if (m->__if.mac_type == fman_offline) + /* Set mac addr not supported on Offline port and onic port */ + if (m->__if.mac_type == fman_offline_internal || + m->__if.mac_type == fman_onic) return 0; memcpy(&m->__if.mac_addr, eth, ETHER_ADDR_LEN); diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c index e6a6ed1eb6..ffb37825c2 100644 --- a/drivers/bus/dpaa/base/fman/netcfg_layer.c +++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c @@ -44,7 +44,7 @@ dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) fprintf(f, "\n+ Fman %d, MAC %d (%s);\n", __if->fman_idx, __if->mac_idx, - (__if->mac_type == fman_offline) ? "OFFLINE" : + (__if->mac_type == fman_offline_internal) ? "OFFLINE" : (__if->mac_type == fman_mac_1g) ? "1G" : (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G"); @@ -57,7 +57,7 @@ dump_netcfg(struct netcfg_info *cfg_ptr, FILE *f) fprintf(f, "\tfqid_rx_def: 0x%x\n", p_cfg->rx_def); fprintf(f, "\tfqid_rx_err: 0x%x\n", __if->fqid_rx_err); - if (__if->mac_type != fman_offline) { + if (__if->mac_type != fman_offline_internal) { fprintf(f, "\tfqid_tx_err: 0x%x\n", __if->fqid_tx_err); fprintf(f, "\tfqid_tx_confirm: 0x%x\n", __if->fqid_tx_confirm); fman_if_for_each_bpool(bpool, __if) diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 6e4ec90670..a6c89c4514 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -204,9 +204,12 @@ dpaa_create_device_list(void) /* Create device name */ memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN); - if (fman_intf->mac_type == fman_offline) + if (fman_intf->mac_type == fman_offline_internal) sprintf(dev->name, "fm%d-oh%d", (fman_intf->fman_idx + 1), fman_intf->mac_idx); + else if (fman_intf->mac_type == fman_onic) + sprintf(dev->name, "fm%d-onic%d", + (fman_intf->fman_idx + 1), fman_intf->mac_idx); else sprintf(dev->name, "fm%d-mac%d", (fman_intf->fman_idx + 1), fman_intf->mac_idx); @@ -477,6 +480,11 @@ rte_dpaa_bus_parse(const char *name, void *out) i >= 2 || j >= 16) return -EINVAL; max_name_len = sizeof("fm.-oh..") - 1; + } else if (strncmp("onic", &name[dev_delta], 4) == 0) { + if (sscanf(&name[delta], "fm%u-onic%u", &i, &j) != 2 || + i >= 2 || j >= 16) + return -EINVAL; + max_name_len = sizeof("fm.-onic..") - 1; } else { if (sscanf(&name[delta], "fm%u-mac%u", &i, &j) != 2 || i >= 2 || j >= 16) diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 377f73bf0d..01556cf2a8 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -78,7 +78,7 @@ TAILQ_HEAD(rte_fman_if_list, __fman_if); /* Represents the different flavour of network interface */ enum fman_mac_type { - fman_offline = 0, + fman_offline_internal = 0, fman_mac_1g, fman_mac_10g, fman_mac_2_5g, @@ -366,6 +366,16 @@ struct fman_port_qmi_regs { uint32_t fmqm_pndcc; /**< PortID n Dequeue Confirm Counter */ }; +struct onic_port_cfg { + char macless_name[IF_NAME_MAX_LEN]; + uint32_t rx_start; + uint32_t rx_count; + uint32_t tx_start; + uint32_t tx_count; + struct rte_ether_addr src_mac; + struct rte_ether_addr peer_mac; +}; + /* This struct exports parameters about an Fman network interface, determined * from the device-tree. */ @@ -401,6 +411,9 @@ struct fman_if { uint32_t fqid_tx_err; uint32_t fqid_tx_confirm; + /* oNIC port info */ + struct onic_port_cfg onic_info; + struct list_head bpool_list; /* The node for linking this interface into "fman_if_list" */ struct list_head node; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 130faa6b92..56607034a9 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -292,7 +292,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) max_rx_pktlen = DPAA_MAX_RX_PKT_LEN; } - if (fif->mac_type != fman_offline) + if (!fif->is_shared_mac && fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) fman_if_set_maxfrm(dev->process_private, max_rx_pktlen); if (rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) { @@ -312,7 +313,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) } /* Disable interrupt support on offline port*/ - if (fif->mac_type == fman_offline) + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) return 0; /* if the interrupts were configured on this devices*/ @@ -463,10 +465,11 @@ static int dpaa_eth_dev_start(struct rte_eth_dev *dev) else dev->tx_pkt_burst = dpaa_eth_queue_tx; - fman_if_bmi_stats_enable(fif); - fman_if_bmi_stats_reset(fif); - fman_if_enable_rx(fif); - + if (fif->mac_type != fman_onic) { + fman_if_bmi_stats_enable(fif); + fman_if_bmi_stats_reset(fif); + fman_if_enable_rx(fif); + } for (i = 0; i < dev->data->nb_rx_queues; i++) dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; for (i = 0; i < dev->data->nb_tx_queues; i++) @@ -531,7 +534,8 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) ret = dpaa_eth_dev_stop(dev); - if (fif->mac_type == fman_offline) + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) return 0; /* Reset link to autoneg */ @@ -647,11 +651,14 @@ static int dpaa_eth_dev_info(struct rte_eth_dev *dev, | RTE_ETH_LINK_SPEED_1G | RTE_ETH_LINK_SPEED_2_5G | RTE_ETH_LINK_SPEED_10G; - } else if (fif->mac_type == fman_offline) { + } else if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) { dev_info->speed_capa = RTE_ETH_LINK_SPEED_10M_HD | RTE_ETH_LINK_SPEED_10M | RTE_ETH_LINK_SPEED_100M_HD - | RTE_ETH_LINK_SPEED_100M; + | RTE_ETH_LINK_SPEED_100M + | RTE_ETH_LINK_SPEED_1G + | RTE_ETH_LINK_SPEED_2_5G; } else { DPAA_PMD_ERR("invalid link_speed: %s, %d", dpaa_intf->name, fif->mac_type); @@ -753,7 +760,8 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev, ioctl_version = dpaa_get_ioctl_version_number(); if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && - fif->mac_type != fman_offline) { + fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) { for (count = 0; count <= MAX_REPEAT_TIME; count++) { ret = dpaa_get_link_status(__fif->node_name, link); if (ret) @@ -766,7 +774,8 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev, } } else { link->link_status = dpaa_intf->valid; - if (fif->mac_type == fman_offline) { + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) { /*Max supported rate for O/H port is 3.75Mpps*/ link->link_speed = RTE_ETH_SPEED_NUM_2_5G; link->link_duplex = RTE_ETH_LINK_FULL_DUPLEX; @@ -929,8 +938,16 @@ dpaa_xstats_get_names_by_id( static int dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Enable promiscuous mode not supported on ONIC " + "port"); + return 0; + } + fman_if_promiscuous_enable(dev->process_private); return 0; @@ -938,8 +955,16 @@ static int dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev) static int dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Disable promiscuous mode not supported on ONIC " + "port"); + return 0; + } + fman_if_promiscuous_disable(dev->process_private); return 0; @@ -947,8 +972,15 @@ static int dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev) static int dpaa_eth_multicast_enable(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Enable Multicast not supported on ONIC port"); + return 0; + } + fman_if_set_mcast_filter_table(dev->process_private); return 0; @@ -956,8 +988,15 @@ static int dpaa_eth_multicast_enable(struct rte_eth_dev *dev) static int dpaa_eth_multicast_disable(struct rte_eth_dev *dev) { + struct fman_if *fif = dev->process_private; + PMD_INIT_FUNC_TRACE(); + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Disable Multicast not supported on ONIC port"); + return 0; + } + fman_if_reset_mcast_filter_table(dev->process_private); return 0; @@ -1091,7 +1130,8 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, dpaa_intf->bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp); /* For shared interface, it's done in kernel, skip.*/ - if (!fif->is_shared_mac && fif->mac_type != fman_offline) + if (!fif->is_shared_mac && fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) dpaa_fman_if_pool_setup(dev); if (fif->num_profiles) { @@ -1122,8 +1162,9 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } dpaa_intf->valid = 1; - DPAA_PMD_DEBUG("if:%s sg_on = %d, max_frm =%d", dpaa_intf->name, - fman_if_get_sg_enable(fif), max_rx_pktlen); + if (fif->mac_type != fman_onic) + DPAA_PMD_DEBUG("if:%s sg_on = %d, max_frm =%d", dpaa_intf->name, + fman_if_get_sg_enable(fif), max_rx_pktlen); /* checking if push mode only, no error check for now */ if (!rxq->is_static && dpaa_push_mode_max_queue > dpaa_push_queue_idx) { @@ -1238,7 +1279,8 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } /* Enable main queue to receive error packets also by default */ - if (fif->mac_type != fman_offline) + if (fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) fman_if_set_err_fqid(fif, rxq->fqid); return 0; @@ -1390,7 +1432,8 @@ static int dpaa_link_down(struct rte_eth_dev *dev) __fif = container_of(fif, struct __fman_if, __if); if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && - fif->mac_type != fman_offline) + fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) dpaa_update_link_status(__fif->node_name, RTE_ETH_LINK_DOWN); else return dpaa_eth_dev_stop(dev); @@ -1407,7 +1450,8 @@ static int dpaa_link_up(struct rte_eth_dev *dev) __fif = container_of(fif, struct __fman_if, __if); if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC && - fif->mac_type != fman_offline) + fif->mac_type != fman_offline_internal && + fif->mac_type != fman_onic) dpaa_update_link_status(__fif->node_name, RTE_ETH_LINK_UP); else dpaa_eth_dev_start(dev); @@ -1506,11 +1550,16 @@ dpaa_dev_add_mac_addr(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - if (fif->mac_type == fman_offline) { + if (fif->mac_type == fman_offline_internal) { DPAA_PMD_DEBUG("Add MAC Address not supported on O/H port"); return 0; } + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Add MAC Address not supported on ONIC port"); + return 0; + } + ret = fman_if_add_mac_addr(dev->process_private, addr->addr_bytes, index); @@ -1527,11 +1576,16 @@ dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - if (fif->mac_type == fman_offline) { + if (fif->mac_type == fman_offline_internal) { DPAA_PMD_DEBUG("Remove MAC Address not supported on O/H port"); return; } + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Remove MAC Address not supported on ONIC port"); + return; + } + fman_if_clear_mac_addr(dev->process_private, index); } @@ -1544,11 +1598,16 @@ dpaa_dev_set_mac_addr(struct rte_eth_dev *dev, PMD_INIT_FUNC_TRACE(); - if (fif->mac_type == fman_offline) { + if (fif->mac_type == fman_offline_internal) { DPAA_PMD_DEBUG("Set MAC Address not supported on O/H port"); return 0; } + if (fif->mac_type == fman_onic) { + DPAA_PMD_INFO("Set MAC Address not supported on ONIC port"); + return 0; + } + ret = fman_if_add_mac_addr(dev->process_private, addr->addr_bytes, 0); if (ret) DPAA_PMD_ERR("Setting the MAC ADDR failed %d", ret); @@ -1901,7 +1960,8 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, /* Set B0V bit in contextA to set ASPID to 0 */ opts.fqd.context_a.hi |= DPAA_FQD_CTX_A_B0_FIELD_VALID; - if (fman_intf->mac_type == fman_offline) { + if (fman_intf->mac_type == fman_offline_internal || + fman_intf->mac_type == fman_onic) { opts.fqd.context_a.lo |= DPAA_FQD_CTX_A2_VSPE_BIT; opts.fqd.context_b = fm_default_vsp_id(fman_intf) << DPAA_FQD_CTX_B_SHIFT_BITS; @@ -2112,6 +2172,11 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) goto free_rx; } if (!num_rx_fqs) { + if (fman_intf->mac_type == fman_offline_internal || + fman_intf->mac_type == fman_onic) { + ret = -ENODEV; + goto free_rx; + } DPAA_PMD_WARN("%s is not configured by FMC.", dpaa_intf->name); } @@ -2279,7 +2344,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_DEBUG("All frame queues created"); /* Get the initial configuration for flow control */ - if (fman_intf->mac_type != fman_offline) + if (fman_intf->mac_type != fman_offline_internal && + fman_intf->mac_type != fman_onic) dpaa_fc_set_default(dpaa_intf, fman_intf); /* reset bpool list, initialize bpool dynamically */ @@ -2311,7 +2377,9 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_INFO("net: dpaa: %s: " RTE_ETHER_ADDR_PRT_FMT, dpaa_device->name, RTE_ETHER_ADDR_BYTES(&fman_intf->mac_addr)); - if (!fman_intf->is_shared_mac && fman_intf->mac_type != fman_offline) { + if (!fman_intf->is_shared_mac && + fman_intf->mac_type != fman_offline_internal && + fman_intf->mac_type != fman_onic) { /* Configure error packet handling */ fman_if_receive_rx_errors(fman_intf, FM_FD_RX_STATUS_ERR_MASK); diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c index b43c3b1b86..810b187405 100644 --- a/drivers/net/dpaa/dpaa_flow.c +++ b/drivers/net/dpaa/dpaa_flow.c @@ -646,11 +646,15 @@ static inline int set_pcd_netenv_scheme(struct dpaa_if *dpaa_intf, static inline int get_rx_port_type(struct fman_if *fif) { + /* For onic ports, configure the VSP as offline ports so that + * kernel can configure correct port. + */ + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) + return e_FM_PORT_TYPE_OH_OFFLINE_PARSING; /* For 1G fm-mac9 and fm-mac10 ports, configure the VSP as 10G * ports so that kernel can configure correct port. */ - if (fif->mac_type == fman_offline) - return e_FM_PORT_TYPE_OH_OFFLINE_PARSING; else if (fif->mac_type == fman_mac_1g && fif->mac_idx >= DPAA_10G_MAC_START_IDX) return e_FM_PORT_TYPE_RX_10G; @@ -667,7 +671,8 @@ static inline int get_rx_port_type(struct fman_if *fif) static inline int get_tx_port_type(struct fman_if *fif) { - if (fif->mac_type == fman_offline) + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) return e_FM_PORT_TYPE_OH_OFFLINE_PARSING; else if (fif->mac_type == fman_mac_1g) return e_FM_PORT_TYPE_TX; @@ -976,25 +981,12 @@ static int dpaa_port_vsp_configure(struct dpaa_if *dpaa_intf, memset(&vsp_params, 0, sizeof(vsp_params)); vsp_params.h_fm = fman_handle; vsp_params.relative_profile_id = vsp_id; - if (fif->mac_type == fman_offline) + if (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic) vsp_params.port_params.port_id = fif->mac_idx; else vsp_params.port_params.port_id = idx; - if (fif->mac_type == fman_mac_1g) { - vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX; - } else if (fif->mac_type == fman_mac_2_5g) { - vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX_2_5G; - } else if (fif->mac_type == fman_mac_10g) { - vsp_params.port_params.port_type = e_FM_PORT_TYPE_RX_10G; - } else if (fif->mac_type == fman_offline) { - vsp_params.port_params.port_type = - e_FM_PORT_TYPE_OH_OFFLINE_PARSING; - } else { - DPAA_PMD_ERR("Mac type %d error", fif->mac_type); - return -1; - } - vsp_params.port_params.port_type = get_rx_port_type(fif); if (vsp_params.port_params.port_type == e_FM_PORT_TYPE_DUMMY) { DPAA_PMD_ERR("Mac type %d error", fif->mac_type); diff --git a/drivers/net/dpaa/dpaa_fmc.c b/drivers/net/dpaa/dpaa_fmc.c index abcac51482..30f10fae33 100644 --- a/drivers/net/dpaa/dpaa_fmc.c +++ b/drivers/net/dpaa/dpaa_fmc.c @@ -215,7 +215,8 @@ dpaa_port_fmc_port_parse(struct fman_if *fif, if (pport->type == e_FM_PORT_TYPE_OH_OFFLINE_PARSING && pport->number == fif->mac_idx && - fif->mac_type == fman_offline) + (fif->mac_type == fman_offline_internal || + fif->mac_type == fman_onic)) return current_port; if (fif->mac_type == fman_mac_1g) { From patchwork Thu Aug 1 10:53:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142836 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D3FDC45710; Thu, 1 Aug 2024 12:55:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D3CD943402; Thu, 1 Aug 2024 12:53:56 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012048.outbound.protection.outlook.com [52.101.66.48]) by mails.dpdk.org (Postfix) with ESMTP id F1D35432FC for ; Thu, 1 Aug 2024 12:53:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qW+qJHfZBv+jBIQq4N2fXiqSoeCb3QLK6a1gUd5rccyliVyFg50lzXNkc/3TwYXc4wlYdcH6tKlr4vCPiLPpH0wBtytLoUVGEC64Qe3Dz4MIQRTcHMSQsPKHS9mNfS2RCGn44qMx0xDepNzzufc5zA7GYe7SbB2XC71xdx4p6j9Ey7ImtcVKFfopLAcqlRv0Dj19OI4MFfWdRLMcoaq+vwqqRBPwPLklD/h/Llk6oLGMm74HtAZqK4wlAPS8eb8IULsEw3mNByjbshGl6I8PuLDm1v5l2vjZivmjxECvxz/ubRpBWOEWPVNsrlbMJBoCTTp78Bh2Ibl+tqyX+7lCnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=OcUTWabos+ukfSNeeUiiYAa/wYagJRcVhunT6thu9O8=; b=qgoBHF+XdnURvyM63eKlNOzgr5jAsNwF+SvJYPaYlXYfU2ocUMtfbTEV5Rwxn98LtkqqI86GwCsEsOve0pfsuTWHRWTG1WO9yqQv3FKrucZMemf3Yw34jXJBLir+k/QyOEj7G7zqLYqAVQeedT2ABvv3LNZLQsieZ3MvGaK8drfg0+4UL8UC+Uix2IsktTfIh9sv+vcAilJ5bg7BySCjaRBh3LRP2vtj/w8XGViAMITnL2pQpUDl18sTaTLhv9TeUjeYnFr05cLyeqVtKdPNKiGMWaQUz/BR0VhKfmFFxObpbR6nPD/HCFcH/aZyd0AcUoBFVDkKSFQzdOXeinJ3cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OcUTWabos+ukfSNeeUiiYAa/wYagJRcVhunT6thu9O8=; b=Hy+Q+gatFkiM9N+tOt2wPd9z+xTZSZOICgqiOMVkG4M3jiYybQU4BoCHALVDSW66l0GA79lFSrEtMTNMsfUj25q/U2P2jLIcMK9Zz4d4xs/T82zN8D90Qq0mwPTZJH2vtHCAROxvyr6OA8AyUGOSyOtP6dnwVGdV8J260zsFu8Zt3SWqSxlqS0B4fK+bANpq+4i6r+R9OOM7OyEthEpKoLFHWcuWTstP1oM7r9hLsBXHGeR8I7Q7UhOw6u5fXc/fLJNPBZf+z/mwwmxgjlxEwPSgTP0KluUx4Rg78CqlyXkhBdLFPPnLy9KxDYOJpGePWPXkc/9RI1yMEt31sLbyNA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AM8PR04MB7377.eurprd04.prod.outlook.com (2603:10a6:20b:1de::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 10:53:50 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:50 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Gagandeep Singh Subject: [PATCH 16/17] net/dpaa: improve the dpaa port cleanup Date: Thu, 1 Aug 2024 16:23:12 +0530 Message-Id: <20240801105313.630280-17-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AM8PR04MB7377:EE_ X-MS-Office365-Filtering-Correlation-Id: f4394f52-fd82-4e69-2637-08dcb2183a33 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|1800799024|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: wjgu/RRxMAXxy+StpVlh+L6HYFpAGj34olQNM8pkmH4Cx6f4dKzKoHwxbjrfvkRcGtvynT4SD2NaRpSdiKEpsE8l6tCq1SnKP6yTSxRpLWxRlerZAUj0ApB1Pa5v1UUcnzowG4fQcdFfvbFTGIqHEONqWHLXXmWIPS82XcnPt9zBJnQdlADA8nSFIJAdbvFxFHIGGA7T/jwmxcKzCp63rHmQ4zuAR2yj/40VP3flA0HolCOb3kz6KOfFkm00S4vp1mQVVY52ysQwn5mDuYUjH/x9VlyXrJvlPOT2UPLSdjIgYRuuaZH0L0x021B3kZxsPBbBgeghcs1O53RA6pG1V5Rvdu1WcCVnHnPZ0lHvYGXxGjyoHL9WqMuQ0eny4CkuSIadlKE5Xxtmv4cdwtUBadPV00ZR+ftMlN/kouHvC6DJEUjMeg8vriRbc7MEKQimfu33eIg+3meeRpV74jHrrhSp+C5FFR16RpNkQiNIWvNBh2zT7YdfFDzzLFgqQ1FSiy3Rjfp/PqEIq4ymIv4zIz/gKnMPblANHnPcWwQ9jdsen218gLII9bNpRffY5J0yu9m1Exq9YRcklFYchCecppuyu4x7clEHQ53fJZfu7HWD+HcaUBQL+359TbpTbdwGk1svw9o6RfxmS4Whx3IiheDYXiTiQL57ReW3TPRK0mjtpm1Gd6di4Mo/AvULDs5JqIUMRxCBZ87a1wuomi2K96DXntZaPcyTWhl0soTwA6Hu0jr7paMSiNA2wx3pW/F+4zsRJWhn2iqTIOMN2wvCEnvurSDfoWTdLsW0orRMtU7pk/1erXKfPaDhHqPbrEqjcCjV9mpkgud7SRjqBBY/mNK1Dj+YAsEJh9dDqYchxyGtrsCTRltXG9gF6J3TcAysv2yiQeNmql4OgZXiROivx3LJ1DXEjsPJMGU5KyXAqtCRo9zSbBkQ6x8Sg9DKDQBZCfaZV1VaxQa4BhEGydXBzCS75WosRXbhYoae+yZSAb47iW5CSLjbkH1v5uNLw3CyZ3s5l7cZDHQgmkdl04RLLF0xjEpoq5salYYs4yy4WMjkJ4exURQHzD+EDL3Bk03eZdojY/CfNdRIL+ooAjq2E6si6LN5X7MuNYwwrkz24IwH6nuizz26ryBwQyALBe9kbIGX2rmyjMpgmY3XiQN/7XT5KVarXX0C72Gjpg4Y1Ym463EPrpUIKGGBTGsSypmz8AWrj+5WRHKYd6zfUb2Reoxlev7zLZKY1vwYFVXQtscLbWI1O6Gjyf8CEzrDsG5nd2h0TTDsKSEWimRI1Kw5NUcGojoSjcNy/jjDO/I6reZbOXHK7gMjmDDW5Z/DkM/UGfslNKmquFnXKXN4Q6Tv8E1IM41lSlZGVbi6hdSuiq4/OiYXQKJbQAaHCoZNIZyabFAlF+JXv3u8EQ+FmpUesw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(1800799024)(376014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YwJuoOvOMKchKXgqKPrxZDaxLTUaLwgJcFib9bolDfnmBGG93HWF1eKF+9lDvcyi8zi1H6u+3biBZ2Q0yAusnf0VW2qxGiYOZL2PgsZyAEc4QEjopw1YRaFxP2zrT7jncEtyrKI+z2Y3Qwf7J6gxQLHZKL9Nofg0mxtlJQlTFKQRU0mXuX1TtuqxTl2PQx/mzAcrLeVzHj6AKtZEKm9gud4oE5QnsmR6Fdf5yMU3zRBU/b9i/g1/JjIkK6WViy8p1mfdXJRic2clhzQWI5z8UP3L+Wdtw27/Ana6ziux/yZvwH8WbzBTCmGDwopFvcud1yWw2Mys1hLGCJJ29Rz5YbmjYQFHpzQOiC+FtkWLBOHaDvV6W89USn+lXt/4nQrwwxqC5PT5N6tPv6HlqDPEeKUC5u5hedKs2zVYkxUdNTU+k7LESz0vgrwL9cqCM5/fdX+yw/zRuExFSUe/U5rl3FaKHiX49hAAB7LV0uMLuC9tfyOZpL8zLbuN7GkN7LuFZZYJuX42z2MQnlAbwq7nd3Tex52C1reMu2QeiIb/z+57iznpcT7XSSgoQzFLZPpilFIaRH9vnoNxTzoWkaiOJnBbGpR7zo6FWwXeKQCY5QvCKbDyesrG+X03GkDgpUuRVrHEq0PQ6L0kPcEo/3dvnkZZkJlmy7GEwD3EQ0dUq/AcQxB9vIAhbEso98CSWn+bZqR8I6PPzcysNCkYVEMw+rBpYxjEPqKbtA9UVLB9pe6TlRur3sKpGU0Ft/2cRy1SdfT1ihXhDOmsNQr9XCFLyIpU4/x/EkOQPOxvm6ckMgZRzBLhcUe5XdaDY+zX+a26rlsYy075GBlGP9PR3rKWWyhqTHe2wCxr4LbRamxD+ufW7E4Xi+3ETNWhrz5CF2DW7BT6SNEX21cMxf2/tcvuW3E0uj0a36Q6VNZMmUh1Otwj2QoRSrYV9XWX874qJay97ZlNo5pRp7yMw2HoxxG3cUOcWJitl2TartI2OHVgGIxbaxH6AlwrTl4hRhABwOxJLOA4XPjUnxX4AxfJOzxdRSPVFUUBGdB9DCkPNSyf9piM6A+xwgZ0lv9CQ3qncWNFc2EYxDPnzuAjlbNPsW3fGOKGWzcpFfHplFp4dR5xWRV0rDtd54GcKS0FF6837JdQEwPomjw1hqI4HAJvEy2iZfdMdhWZTOYl2TdearI6otHvOuIUlBE+2gaFy7S9Bke9WNZxzXTw+R3Rb/oY4y5TdZcksTi/IXG7xRgWS8OPEVbAfAwt49DDGhLn7a0w6e0LtFZBaucw/AroX+5q+XwH6eHX9rEirt6AKPeYErZFUrDTMck1BFL6GPvhJxbA2gv9I0mfF/P/RUOVidbLWO6rAJ8m8pGkiax3qFlR/gNHSdjgBfNTlXGKUCVrrRcJEA3apbds7p6Kvz268VvBrAT+bnRaTpYYghBONKUOpkh8eKndV6GcbjU9expyHdlpgnj8DpNjwdwodH1mNIdRQdhoJeKEAKZRYhDUuwaKJ2r9oNnAl9DCnV52B2mRy/vY2ETa5mhyZOroYfjRcGQbiPU6xK269RYYChXlF1gaCfsiWurR5zBk0fqkojNP+bZZLlMpLNdSkTzaIgaZ0Hr7HFHmbA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4394f52-fd82-4e69-2637-08dcb2183a33 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:50.6349 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6lgeow1nMh2tlGNecG9LkbHZ9y+nhvNJ+qSXQhzKNUP8lCQfToPOvbOwZalDH3uJQVUAvN/lLWSdBRwxsjjZyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7377 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 From: Gagandeep Singh During DPAA cleanup in FMCLESS mode, application can see segmentation fault in device close API and in DPAA destructor execution. Segmentation fault in device close is because driver reducing the number of queues initialised during device configuration without releasing the actual queues. And segmentation fault in DPAA destruction is because it is trying to access RTE* devices whose memory has been released in rte_eal_cleanup() call by the application. This patch improves the behavior. Signed-off-by: Gagandeep Singh --- drivers/net/dpaa/dpaa_ethdev.c | 35 ++++++++++++---------------------- drivers/net/dpaa/dpaa_flow.c | 8 ++++---- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 56607034a9..863c1155c8 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017-2020,2022 NXP + * Copyright 2017-2020,2022-2023 NXP * */ /* System headers */ @@ -557,10 +557,10 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) if (dpaa_intf->cgr_rx) { for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) qman_delete_cgr(&dpaa_intf->cgr_rx[loop]); + rte_free(dpaa_intf->cgr_rx); + dpaa_intf->cgr_rx = NULL; } - rte_free(dpaa_intf->cgr_rx); - dpaa_intf->cgr_rx = NULL; /* Release TX congestion Groups */ if (dpaa_intf->cgr_tx) { for (loop = 0; loop < MAX_DPAA_CORES; loop++) @@ -574,6 +574,15 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev) rte_free(dpaa_intf->tx_queues); dpaa_intf->tx_queues = NULL; + if (dpaa_intf->port_handle) { + if (dpaa_fm_deconfig(dpaa_intf, fif)) + DPAA_PMD_WARN("DPAA FM " + "deconfig failed\n"); + } + if (fif->num_profiles) { + if (dpaa_port_vsp_cleanup(dpaa_intf, fif)) + DPAA_PMD_WARN("DPAA FM vsp cleanup failed\n"); + } return ret; } @@ -2563,26 +2572,6 @@ static void __attribute__((destructor(102))) dpaa_finish(void) return; if (!(default_q || fmc_q)) { - unsigned int i; - - for (i = 0; i < RTE_MAX_ETHPORTS; i++) { - if (rte_eth_devices[i].dev_ops == &dpaa_devops) { - struct rte_eth_dev *dev = &rte_eth_devices[i]; - struct dpaa_if *dpaa_intf = - dev->data->dev_private; - struct fman_if *fif = - dev->process_private; - if (dpaa_intf->port_handle) - if (dpaa_fm_deconfig(dpaa_intf, fif)) - DPAA_PMD_WARN("DPAA FM " - "deconfig failed"); - if (fif->num_profiles) { - if (dpaa_port_vsp_cleanup(dpaa_intf, - fif)) - DPAA_PMD_WARN("DPAA FM vsp cleanup failed"); - } - } - } if (is_global_init) if (dpaa_fm_term()) DPAA_PMD_WARN("DPAA FM term failed"); diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c index 810b187405..2240f8d27c 100644 --- a/drivers/net/dpaa/dpaa_flow.c +++ b/drivers/net/dpaa/dpaa_flow.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2017-2019,2021 NXP + * Copyright 2017-2019,2021-2023 NXP */ /* System headers */ @@ -812,8 +812,6 @@ int dpaa_fm_config(struct rte_eth_dev *dev, uint64_t req_dist_set) return -1; } - dpaa_intf->nb_rx_queues = dev->data->nb_rx_queues; - /* Open FM Port and set it in port info */ ret = set_fm_port_handle(dpaa_intf, req_dist_set, fif); if (ret) { @@ -822,7 +820,7 @@ int dpaa_fm_config(struct rte_eth_dev *dev, uint64_t req_dist_set) } if (fif->num_profiles) { - for (i = 0; i < dpaa_intf->nb_rx_queues; i++) + for (i = 0; i < dev->data->nb_rx_queues; i++) dpaa_intf->rx_queues[i].vsp_id = fm_default_vsp_id(fif); @@ -1147,6 +1145,8 @@ int rte_pmd_dpaa_port_set_rate_limit(uint16_t port_id, uint16_t burst, if (ret) { DPAA_PMD_ERR("Failed to set rate limit ret = %#x\n", -ret); + if (!port_handle_exists) + fm_port_close(handle); return -ret; } From patchwork Thu Aug 1 10:53:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 142837 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 796F445710; Thu, 1 Aug 2024 12:55:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EFF7343405; Thu, 1 Aug 2024 12:53:57 +0200 (CEST) Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11012048.outbound.protection.outlook.com [52.101.66.48]) by mails.dpdk.org (Postfix) with ESMTP id 1A5A8433D0 for ; Thu, 1 Aug 2024 12:53:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X5wOfmLtWbop9tcwpVl/zVyNI1BUEGRB2+/CGTYjfoa8J5/nGDM0LLrAUmRmyeAEV5JlHulAeG0+naEsndKX+E7eW5wu/gfbgWORMMIH/7JQ0At7OyKluT/uZE+evM+Srz6tJUR/fchJNcACtdjB2NI8jrL19ynduzk0Uw1Fh1X6zb72mYwHRn6vk3JPEfIPc8aWl5rXmNNW6YqNuRdQ764wDtclh7t+mjtmbpiMvaqG3JEAJlz6Zbnkeq/snz3Ph/qwyh+gqQ7rYrDo2VjuaM6oqRlucz42Iha7VQD0oFT+/7xP0DsQT8WENulnBVs0Tx3UbtvcEbhKI4KFHwt5IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=1MmulNMMqEZtmTs9tg5ayj9YbhXWp0y7W8vf2v/FIrE=; b=kF8uOCocxCJ+UAT/9nOQaNepmDR8tgufReSFrR0meIUw18gpH+QLIRuN98/7uWtc4z5RpxKZcPGhTNxBjgl/tqByR9blBqWi1khaMWWLCji6ArXlrsrnIFIe9TpCtIvSbMnGE7YQXa9674NpBaOr/ZzIRsKtIPIkfS5Wr+q7PzKyjekZEfERy0UPZqgYOqKlCSVx4PtoVEEdW1CxOrn7d0fl3KMXEzk/9UdtWirgoEMemIqoLAwPxJKPTqp2gV3E6UMgygLt7Bv++zYCbhg83wfAuiuUe1m2OOT6j1paiXbR2FoPdqsTPFbmImuJvvNlcVTCaDPTq1lWd8VWWCT82A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1MmulNMMqEZtmTs9tg5ayj9YbhXWp0y7W8vf2v/FIrE=; b=jTJ871xOgW6W9VE/ucjt5psQzQ/OVjSPcFrABj42PV6LhDemRrCY0UxR8/fHt8iQEIcJzVUtWe6IbJdIbzU8osKXI/o0nHQLqXaXxHltTt5FDkkwbdwJDyLFkagPjhxnyU2TdLGthx8r7ZgbFbK/wDsayzilnB/wj5Bg3+DjSy3mpM9+w9xpHeG8jAjcgzKqOjU5PBDAghmFkW6yNIfVJoQHixU2rVjlZ+r/B0HYd2r5pmlT2+rQfSsYVq6+CaeP3rzUQvOTDT9/sY3eTttFP7AdoN9WzAHqINJQ71GpqLIE9Bbu1/KN0KXDKF2jlF/VfBYYFbqa9M7sso8RteStnQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AM8PR04MB7377.eurprd04.prod.outlook.com (2603:10a6:20b:1de::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Thu, 1 Aug 2024 10:53:52 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%3]) with mapi id 15.20.7828.021; Thu, 1 Aug 2024 10:53:52 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@amd.com, Jun Yang Subject: [PATCH 17/17] net/dpaa: improve dpaa errata A010022 handling Date: Thu, 1 Aug 2024 16:23:13 +0530 Message-Id: <20240801105313.630280-18-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240801105313.630280-1-hemant.agrawal@nxp.com> References: <20240801105313.630280-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|AM8PR04MB7377:EE_ X-MS-Office365-Filtering-Correlation-Id: a23b9f55-4b02-4895-897c-08dcb2183afa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|1800799024|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: pie7QnDyWduoLHFME93W3cvIXoX/5/4U+StH6oURXwMhnU+arRN+1LtEuyFXuoTXFPy53GesXTYZ/cF8CYyIZXG8taJqlxlcy3mh72fMC0kZ7PcLnlVf12RiIh5iQmDPfUe+DTK/5Et15bLGObzl8Kcu+UVB13DhTYqEa/kZ6sMirjIuuTXlzcuacZDYM/S2uMQGdbJ+vPCMhltGbJEt6kVWPKSCdpNsr9FNKZZU2aBvfagKJRQG+1HcKw3RB7sDPOZGKNNKB1V+C9sE9rmO+ZOxjvxT3HtJQdmLBz37Ra7kO0BXARnJ/lKwioMgvbB27VsZjiG2QIw4OBpudB4bSLtL0C3kbLp+oYXAZffzF9SGyR2Cavng2p5hOCmAbK6/9VWVT74tZRDLajmuTWgvD5QhBSDh4wogkPrMDH8/A4XXlZsfiWDvPpxeLAuqOU8gUocZV1P0TcvEO7Lqtnx9dcsJ8ybfFe4A0AKGx2VD6STzxe/2g2BeiFMFHfyilQMtKg+0X7mDnCpmk5QQEZWq2xA0t7WIpxHgwR93QCE8/PHJyoRZza1yy+rrx7uSfTyIMClJ6K4JRii7a5Oe7gnhze0iH7l/SUGp9dq2Xs3O0zxHI4LZUZgjaJCeVYTKWYc7jpPraHnx915hrInfyasr8XNArqn71fDeNIN9hnD4KAWp9VMHEGSJQCSuEL2/zwAZPoTabo+1xVj4mRyN0+uUWnMefGuOOtoX8y1FxyDfQKLoHXomv0+urQEyBpKBjVwhFzVjPiR/Nj1IqR5AWrXd0DVeUvj8AFfB01u27y0DlKQ67pUbRZbSFM5zGMUvex0nsfnYk2Jm5dFrLfLhgrX+S8Bq1/tZzX/Dp4bBaMgrmG82VWr/Y8vYC/dp3Fwlt1srzJbBbf6Slbqbvnnglm4/gVfAI7gPMZzWSzpS1meJSlbVUxRTsZ+i/wRRnWbKFfdoYMHGjdyJ7NKakdhGKc/QQl03g1jg8+SidXZne9lCsC4jRDrfWFhqE9CLj+jbG7ZYsX7BdRANTlt6u2PbOC4J6Cs9ShB/B7rozOav5ATBIqbVo2MgSzA0Vc6qQD/ypJULbaJSrmfCk/3EB0wgkKQYLtQUMZy8fsZdqjuaAaTfi19atZkg51euoHbqXJC6Rd1qwY8cQCcF7Uzw2OZ7/9chbf1RWYOhtka3KkxKEsdflFRHL4jsDQbPu4fGMbrFqEEwOJX1Rw4UHvQf6ymsz2BEDSkp2mph7Seus6RTpwKtDgAzSitv5S/lAUzQXbW1J4QcaPjYPCY1IMg5VYULeXgsYGv+PXUcTjW5dVEE2AObRKpCb8DtIz30bJTS/scNNl3Zcf1H6vZHWcliTWzs6O3sGmvutI1BCcqvEyW2y6g+DmJZN6xmX99M56CBGEpsdaWITjtaSIIylW7GIMTBz2MSQA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(1800799024)(376014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8iQF3zvoFFGczC71od91D5zrkRBonXHwV8DknZeMAKLjWRJ1lNOFMUGsgpZCywo0/d5QBhIce7wSafHdN6/zvxSk5TUBDOTrKj0rwCU6iS0hRREeZG8iKFfnzZQQ5OfqPGsoJqSyzd1EoUOhIcF4ewimrjHDzxNikbPQLIA3uJAPYjkqdLg4Q5vwolF9BFueIJLl9XmGcdqIDaK6CEC3N/lt9zLXFRGhwYEsHk9Uu+Xog2U6F2LCOVLyXI5BIL0L3eX017t8yed9BLtSpu60pkGsQ5wcAqrVFBbTbLD808gasLKOFAV46Do4C+G+K5t0T3YN8TC74oO/nLhu8fTTZF1faJmKkf1SPl6q5WP3UjL9CMghwULicrl841/5E61KpNhAt4TLrk3eymCMk/buWMD0u9MmomITjzSDaJEZ3TJhjonuaccNiqXJwB0DmpYt9/nG1iat36FAvnZhQSPdt7iFAJ250VJbyGAN4hpBPIRiWSEMvHYiLTsJeIdBymNVB883BC1JV6xomMf+5r+hvqCaJtc1IqNMV+64rW0xdT27mpcl7Gr5NPbhjAhTwfoYD7MUuCY7qEJ60pwRfBPo1fPUvg2El80IuJp1cmIQsuozPc4rC8N4J+N7GiUFme7byzuhgN0yeTOGa1rd5vObE7zFunFLA0b+oJqhOnQPwnvD0sPQYnZnj5ECbl8Ov3XlGeiJk5bQpEIiBV9uqvO+nxt1Mis2whJQutkFwFw1WzQ6IHGDJqYISREY9JHFKFlP2+X+mjcbU1PsUPgTbw7aA6LGk3nuuEvIyrFvTaCEXdem97X/rw0PnB6L/zVJAVjjP9WOXLE6LsKBPefE4bvoIPo+ETko0ivNtcRqLIlxqVG5fbDCGpnmygmk60Q+2Iz0HDl/F93CdMgyVXhc1593hnCpTTqOGGobS3gXrW415UJPfMfh4gL1RAElCdPCZ4/qzSin4cB+d5STZ9w1hLYP23vKFk20w3woGEl+Cs+hLjZxFbKf9zjtWSuBCOP8nJzmIUjwBlPGTvi2t6tvefRsWkSgmYzdEGsVxcrIxrludy50yUS7cKAMTflVR72gcztAFf+sCroKgjfgWs8yApy7QwYbBTZflVnwHbv5C1n7VEXKEK6aJQD4DGmB2HVRMwEHJ45EzM894j9IvSa/U+o5w6DjX+nOR6M11hKA1fxy/PGGWcHRqrg+05i0ucf0Sug9OoEa1xvJyInCgva+hscPc4zEjpsmLBgejDS8j5BfF5XpHvr5bXuwBH4mRyH4C5BxtOVnY+bHCJ1J8vPRb2NjuvWVGcQ7kYJXKfuZVG9y8Bg4Mex5wt7op9oLwJrL42L4jAcgCeX1XrWpENNco43LxewUkcrmyJHxHqxS03hYhwNmRpnDRP33mg1Vm/JVlE2C1DNFEWh+LUMyqlANpRoLOlBxR9iHrubMZA4bAfRz30A+N42D6GiGW1uF3eXQGcS8iPy3sjKSNvsXnn+ieyc3fD6stQErT6jtq/iIVty+vNHjH7TbtpF23ezCgQL5O4lygiO7wyFL38udJGuX+yjojgJ2e5Bs3eWI79VN1Cwh8TMCkBDKToAnMc/PvQ9aOnoKdMPOY2E+W3OmE9Ar9VQwQw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a23b9f55-4b02-4895-897c-08dcb2183afa X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2024 10:53:51.9409 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uKjRUXiNWUElxBFEFzACUMLu8212EgkqNbZtC1Bbkg+tfWGEyiyhdkjZxovRtS7069ICSRtvlHhGfufihifZ8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7377 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 From: Jun Yang This patch improves the errata handling for "RTE_LIBRTE_DPAA_ERRATA_LS1043_A010022" Signed-off-by: Jun Yang --- drivers/net/dpaa/dpaa_rxtx.c | 40 ++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 84fd0c57a4..325785480a 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -1264,6 +1264,35 @@ reallocate_mbuf(struct qman_fq *txq, struct rte_mbuf *mbuf) return new_mbufs[0]; } +#ifdef RTE_LIBRTE_DPAA_ERRATA_LS1043_A010022 +/* In case the data offset is not multiple of 16, + * FMAN can stall because of an errata. So reallocate + * the buffer in such case. + */ +static inline int +dpaa_eth_ls1043a_mbuf_realloc(struct rte_mbuf *mbuf) +{ + uint64_t len, offset; + + if (dpaa_svr_family != SVR_LS1043A_FAMILY) + return 0; + + while (mbuf) { + len = mbuf->data_len; + offset = mbuf->data_off; + if ((mbuf->next && + !rte_is_aligned((void *)len, 16)) || + !rte_is_aligned((void *)offset, 16)) { + DPAA_PMD_DEBUG("Errata condition hit"); + + return 1; + } + mbuf = mbuf->next; + } + return 0; +} +#endif + uint16_t dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) { @@ -1304,20 +1333,15 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) DPAA_TX_BURST_SIZE : nb_bufs; for (loop = 0; loop < frames_to_send; loop++) { mbuf = *(bufs++); - /* In case the data offset is not multiple of 16, - * FMAN can stall because of an errata. So reallocate - * the buffer in such case. - */ - if (dpaa_svr_family == SVR_LS1043A_FAMILY && - (mbuf->data_off & 0x7F) != 0x0) - realloc_mbuf = 1; - fd_arr[loop].cmd = 0; #if defined(RTE_LIBRTE_IEEE1588) fd_arr[loop].cmd |= DPAA_FD_CMD_FCO | qman_fq_fqid(fq_txconf); fd_arr[loop].cmd |= DPAA_FD_CMD_RPD | DPAA_FD_CMD_UPD; +#endif +#ifdef RTE_LIBRTE_DPAA_ERRATA_LS1043_A010022 + realloc_mbuf = dpaa_eth_ls1043a_mbuf_realloc(mbuf); #endif seqn = *dpaa_seqn(mbuf); if (seqn != DPAA_INVALID_MBUF_SEQN) {