From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96351A00C5; Tue, 21 Jun 2022 12:34:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B7BC242B81; Tue, 21 Jun 2022 12:34:14 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2134.outbound.protection.outlook.com [40.107.237.134]) by mails.dpdk.org (Postfix) with ESMTP id 0467042B81 for ; Tue, 21 Jun 2022 12:34:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AomeQroWW1QBdyC4hjN0N6bPYDrWdYBloLayoqZSh9Jjjc1u1Kzj2jHa3DQDKyxFgh3bfYGXCwG4Qpk8msnUGibz6YbwDlbW1gYvpHFcd2Z+cidN7ezfrEwpC0Nxscm361nTIa0JPzOP47ZOewqmHv6nk0EhqELBlbio6XCrv3UiXkjexEogBhjBcJTu88WTNlalqg8vHsICl7txmTIDII0cDeBea40+UAa1OeKEEKW6FeLdHLWpV5fJACZmwpTonLwuDfp8Cfwhi7hU8DGNszF/eziNFK9saGigwlpygMjT+r+86BJE1VzDqGXJumhSiQqqec93Y68YTp+zi/XL4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b8bT9YKGR9pqmupZtfvWnjJTxPMp3Qi+aLlqBvHztxk=; b=RhqHwZ8X7vTKSL0Y3tsCrUM+WMK/qSLFpkrfsAX30b0tk9/Ir6lmBfutTjBAxjlYBSEKaqQ4P0HDjgJoo23xr3lQY699pJsPHdiZVnGnFidJd7gh72UCwUuxG8IqGYPz8/T+pBxSDEDQcOMdkbncavP/msro6IO6j1oK/n0igc8xTLMyrxygGhTpUw0AT1WF7QvFkXHdXttJZIqoFE6S7/Z4MKP45QKg+Nghl4FAP3WTAMxPt1J8ZStamr+x61it/GdDWUko4tcAc3Ca4ANJ6bwKXe7un4tsMrIku3EuOLU467BrCLIle6voQsgYVQ79bBWTiVKa+K3bfmdrsgbGSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b8bT9YKGR9pqmupZtfvWnjJTxPMp3Qi+aLlqBvHztxk=; b=UxykG/NbmG8fv6iga6K7mihW3brFmZxRX2A+4jBp3ekuvX45w0iGVrXe3vX1qx7nWpvCqK3IFMCI2aAZSL1z3QEGlRtEILXJ7bDCkJtpKUYT8mb67hmzEu/RZqtn4WQuNmrXqqRKnbD6P2XKzEmRypMh+HL5HGBpe301y7tYS/k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by MN2PR13MB3086.namprd13.prod.outlook.com (2603:10b6:208:135::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Tue, 21 Jun 2022 10:34:11 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::5d9e:9ce5:51d1:2021]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::5d9e:9ce5:51d1:2021%7]) with mapi id 15.20.5373.015; Tue, 21 Jun 2022 10:34:11 +0000 From: Chaoyong He To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v2 08/12] net/nfp: move common rxtx function for flower use Date: Tue, 21 Jun 2022 18:33:04 +0800 Message-Id: <1655807588-7320-9-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655807588-7320-1-git-send-email-chaoyong.he@corigine.com> References: <1655807588-7320-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: OS0PR01CA0018.jpnprd01.prod.outlook.com (2603:1096:604:24::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82d25f83-629d-4b35-3eba-08da5371947a X-MS-TrafficTypeDiagnostic: MN2PR13MB3086:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hjGzEnXhYTVQTJxTgnB9E/n3t42X5zJEaYQl37a56fx3l8l4ePLEtKZ+wKE6/Xuy4XssjIdE/9o8iE0bBru5XXMYPl/HD1C2mdElGCwyGkitFLVbJ6BweRjA58M4h0E1R5/AB4ZK4Jc9qH0rLT8YxoVRvlqbl461oWAiOV7508+67duLdnCS8sfJmbxJXt5lv3qC6rCKOoIFlUMN3NXuNJwf/fwrUdIqVZ/We79uncHhr9Sw3ypAhb0RAyozjk6zfIAa1Fef/mI3Io6A8E83MYVB24H23jaRJYWH53bgDsnY3mwKjwCh0fmBMe8oFI5ADQ0RldFWutx2hAIZC2OhCp0lFd0N7t8Dz1IMEHEqQogFp7ynRqzHbaPfZcfBjZphVutYtTVJ5ZVSS9eWJnxpAH3exTdXsVYJHdv7Sv8JDgU4n6Bwqo2H/b8yCVpEmjFDlyE8NTpTHFzIPVB5IL1fJ5EEn3XpLKdV3L8vweaWwOfRmn/olwm03U0R9tJmXdnrTY88e9BSm3JSnE3spWKiweirrMAj7WUrO9Rmo4NQbneeTaH+Q80lQ54RexIwzKCJ3X0nfyOtM96kpd/VO+3/r1AewRQRaAcC9BQjXu2J9L9dJi/j1+eRidkLpDHHBHzvvOvecfUVzSg6gwVL428rGord6tW8A/yyKJ+WRDYuhbgEf6NTy32WmiylKWOLQoDzdbTWOuaK4fHKEJnbTEpzrIs+HX3TsBv+WyfR8buOsTmEKEIz8IT67TX60sO/CC2O X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(376002)(396003)(136003)(366004)(39830400003)(346002)(83380400001)(107886003)(186003)(41300700001)(2616005)(38100700002)(38350700002)(6666004)(66476007)(4326008)(86362001)(5660300002)(8936002)(44832011)(6506007)(2906002)(52116002)(26005)(6512007)(6916009)(54906003)(316002)(8676002)(66556008)(66946007)(6486002)(478600001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cWk3LzBxQXR4WmFvbzZ6eTZibzdYdWthRkFPRWpHL0N5WURuMGlTZEo5SVBn?= =?utf-8?B?Q1cvUW5qanFUNjF2RXowTmUzaWlnZ2xqQjY1NEhnVGovc1NIT0JIZHN0Uytz?= =?utf-8?B?ZmRXZDY4QmZUaFNPS3lSYUlndmk0VHJzbTRpakErVEplaEg1bXk0NmhGWXFh?= =?utf-8?B?UlRYQlhkd0xWK2RIYVlsOUdKQlNRWGR3eXdmQlVPUUJ5TktReTFhV1k3dGlO?= =?utf-8?B?bzJUblN1ZExDSDlpL01EWWtYS3VMbzFHNWNYVG1XV0pJRnpRYS9peFBaOXZa?= =?utf-8?B?bmp6VWxhTGFBZno5MDhSQWVmaTRzbjZ5enNUaUZZY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f-8?B?eGFtMUJxZDZiMVlLRDU4dE91MXpWNllwRkloeVg2OWtIY2pJemZ4dHQ2ZkZL?= =?utf-8?B?dmx5a3NZeXZWQjFWdFNsM1hka2FyNEFwZC9uaExBbHJ1VnppV3NSR1hkaS81?= =?utf-8?B?eHdOYlVKL2M0NXhoQjg1RUZqbFdzdE9FSTJRbjMydmJyWUVGOVBZaXkycnh3?= =?utf-8?B?b2N1RVc4bDU5eDg5YURMMGF0YUdqTDJDOXBXNjY2WHpwWlVEK0NZMWlXNUFG?= =?utf-8?Q?NIYV2KPDvvf9hrXA=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82d25f83-629d-4b35-3eba-08da5371947a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 10:34:11.7402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JeTfUl5yZ7UOh6Ob86ceAVCn6efny40DgGC6wiFJ4zlFRFWdVamrLfFMAhRJ5uuO+Px+nuO4P9bqG/5TC7y7GJ/UDamqsZof69WodgJwGZ8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3086 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 commit move some common Rx and Tx logic to the rxtx header file so that they can be re-used by flower tx and rx logic. Signed-off-by: Chaoyong He Signed-off-by: Heinrich Kuhn Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_rxtx.c | 32 +------------------------------- drivers/net/nfp/nfp_rxtx.h | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 7414c51..cdcf5c2 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -116,12 +116,6 @@ return count; } -static inline void -nfp_net_mbuf_alloc_failed(struct nfp_net_rxq *rxq) -{ - rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++; -} - /* * nfp_net_set_hash - Set mbuf hash data * @@ -583,7 +577,7 @@ * @txq: TX queue to work with * Returns number of descriptors freed */ -static int +int nfp_net_tx_free_bufs(struct nfp_net_txq *txq) { uint32_t qcp_rd_p; @@ -774,30 +768,6 @@ return 0; } -/* Leaving always free descriptors for avoiding wrapping confusion */ -static inline -uint32_t nfp_net_nfd3_free_tx_desc(struct nfp_net_txq *txq) -{ - if (txq->wr_p >= txq->rd_p) - return txq->tx_count - (txq->wr_p - txq->rd_p) - 8; - else - return txq->rd_p - txq->wr_p - 8; -} - -/* - * nfp_net_txq_full - Check if the TX queue free descriptors - * is below tx_free_threshold - * - * @txq: TX queue to check - * - * This function uses the host copy* of read/write pointers - */ -static inline -uint32_t nfp_net_nfd3_txq_full(struct nfp_net_txq *txq) -{ - return (nfp_net_nfd3_free_tx_desc(txq) < txq->tx_free_thresh); -} - /* nfp_net_tx_tso - Set TX descriptor for TSO */ static inline void nfp_net_nfd3_tx_tso(struct nfp_net_txq *txq, struct nfp_net_nfd3_tx_desc *txd, diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h index 5c005d7..a30171f 100644 --- a/drivers/net/nfp/nfp_rxtx.h +++ b/drivers/net/nfp/nfp_rxtx.h @@ -330,6 +330,36 @@ struct nfp_net_rxq { int rx_qcidx; } __rte_aligned(64); +static inline void +nfp_net_mbuf_alloc_failed(struct nfp_net_rxq *rxq) +{ + rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++; +} + +/* Leaving always free descriptors for avoiding wrapping confusion */ +static inline uint32_t +nfp_net_nfd3_free_tx_desc(struct nfp_net_txq *txq) +{ + if (txq->wr_p >= txq->rd_p) + return txq->tx_count - (txq->wr_p - txq->rd_p) - 8; + else + return txq->rd_p - txq->wr_p - 8; +} + +/* + * nfp_net_nfd3_txq_full - Check if the TX queue free descriptors + * is below tx_free_threshold + * + * @txq: TX queue to check + * + * This function uses the host copy* of read/write pointers + */ +static inline uint32_t +nfp_net_nfd3_txq_full(struct nfp_net_txq *txq) +{ + return (nfp_net_nfd3_free_tx_desc(txq) < txq->tx_free_thresh); +} + int nfp_net_rx_freelist_setup(struct rte_eth_dev *dev); uint32_t nfp_net_rx_queue_count(void *rx_queue); uint16_t nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, @@ -355,6 +385,7 @@ int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, uint16_t nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +int nfp_net_tx_free_bufs(struct nfp_net_txq *txq); #endif /* _NFP_RXTX_H_ */ /* -- 1.8.3.1