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 28115A0543; Tue, 21 Jun 2022 10:11:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2112342BAC; Tue, 21 Jun 2022 10:09:28 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2127.outbound.protection.outlook.com [40.107.93.127]) by mails.dpdk.org (Postfix) with ESMTP id 9ABB142B8E for ; Tue, 21 Jun 2022 10:09:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RpH79kKacOZbO7WeLcsRn/rMl+lIIxHTx20TseC2NeuIwERw69dz8AOS2JkMUgqJAklzHsWHbVX6xkW0/vvggnJbCRdFOWaEzXjxIMzT23Vd2UchL0+UCHTxv6qpMecJctC2VylYLk6UtLhtF4OMbZlu/Qq3/hFBBfh3hPlQj+ceHvCyY2Y2KNY8z/iLlSCIXNhk448Bb3cFJeaOoe0HTB3hm2qgW2mYMvAsEcmVQuCFMfOGhFkDnYypTNxfLwmoxsuQEYnziPXUWm9Oax46HVyjoaxtLhrZBNGr/CHj/oKETJHQGqlxpuyYr8IieLclFtX3OqZsXg+9fAaCwHdo/Q== 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=m84/OY/uO0ISgGWpKdXwSU+KeIGx3oLmPyhiwtnrXSsxl7r2QAHjE/PT9OZ/TzOhipSkIii2TEtiZ7/rvjICXRaNq1BVYcSdJXrgOzapXl3vpKO0Zf7DQaOXtbWcU3+ZJrLkIGhXUKIEu8WszYUy/L+18B7dNNQeDVQ0cnumfwCqYNj6vLkh46uIBNu8lDS7DjMPFmFArD44aVY4hDKwF8UL4jFsECRQTWZIVkK+YeiYO3ILSFmlvCQhAZrNB9q6u4H5eyKOC5LCMk3FZX6ybKqOsqtSMGCc6S16/qOQSqnbcT3xRiRIqhVkyImaRiWqsh1ewHiDHbNzzgefL8CA5w== 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=WGLErw3g1DWRxMeVTcuolcHcna3dGTfxQF8waQZJAhTz4lBlnmPuxtwAafFkAh+c4/x1HuYFAlMA85L4TJ0Km27sMRszY6PqDmNr1KU35Fcl7l3EtIJsZPdQ4OkMmc4eVYaNhyY/LrnC1JW6tGA8fdeIezTAF60A+k6WVc9MX90= 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 DM6PR13MB2730.namprd13.prod.outlook.com (2603:10b6:5:13e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.13; Tue, 21 Jun 2022 08:09:24 +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 08:09:24 +0000 From: Chaoyong He To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH 08/12] net/nfp: move common rxtx function for flower use Date: Tue, 21 Jun 2022 16:08:35 +0800 Message-Id: <1655798919-38659-9-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1655798919-38659-1-git-send-email-chaoyong.he@corigine.com> References: <1655798919-38659-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: OS0P286CA0009.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:9c::14) 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: 01a294b3-92c5-4214-aeae-08da535d5a65 X-MS-TrafficTypeDiagnostic: DM6PR13MB2730: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: 4qs42vUdHDd290Kc3cEVxDXdDdVbs06c67hTvS2BGMCLC8ar84WWfvf4uWlXdVYg+ORmQpymPE1wcwvPgozMNhdWYygGn2+gbk2SGZNmf6iVVRpmR6RoKWr6bptD3UoriiXwb5xCXcE5Xo+73Tc8LGY8oKAxShNHtf4aemsxlZZz+NhXlHQjCHuSe105q5m9hUKng5WI6tRb0pS3SgqvLTSKAmoFAUGJ9YCsJxw82uirELESNg7KyE5bnOzMmIrmnGDLViUKMkIQNKCh0RozKhQYmqWL0tjBp6JKnY1uvMWv3aIT94f3YFsbNE1SaliF4mpF3NGB/G4MHeJlMj47YggNtQembH89m+jQeDOknqRwkvShTQJ2sICgUOYngnScOjoOdU2o9At06XrBd5ld5aZAdH3HMtu9KtHM4m2yLkiele+9PYVfa8OudUKDNEQdOuTcL0o0ieGLFc+loR1eYs1WSxwUpHdIuz+sDOebM5I4Uxs4YhkIwjxbCLUINRAFxoF6eARZASiySINd4xVMuFGSDICzNuHhOcZD2+nKGsRsViYUHmbt+YZ6HeZWXGkUqKzF7wVSkrwyFn2rM0fe9qKZxOeBPlrKVRTU3PReJEbX59yYiUps6JLunzPeSe0gADdmyU6qwxdeRq3IboTz1Ys2CmQhWqs/WNXAUgJYXFziclPGmP355NhLZgjc3Ov68BRz9NMznSKga9lKkQsLkA== 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)(39840400004)(376002)(366004)(136003)(346002)(396003)(38100700002)(2616005)(38350700002)(86362001)(83380400001)(66946007)(66476007)(41300700001)(186003)(8936002)(8676002)(66556008)(5660300002)(107886003)(44832011)(2906002)(316002)(4326008)(6506007)(26005)(6512007)(6916009)(54906003)(478600001)(52116002)(6666004)(36756003)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?amFqYmtmT05pemhodHlpd0RQclNDeWpBWUNPU1N6UmNwT2VINXd0TzV0RnpB?= =?utf-8?B?SS9iNWZ1YVYxczRTdDlrcSt5ZDErS25aMFpqWjh6aDRielhrQWNQa3hRdXF6?= =?utf-8?B?djg5V0FQRlJNU1FQaysxMHBPcDVRMDFqbXppcEVqUUp3c0kwWThWME5UTTBM?= =?utf-8?B?bTRTSVNlNmtQU1JXNCt0WVRKNnRkUytIZ0FuenU2T0F1TkhwbmpleSsrNkp0?= =?utf-8?B?RW9YZGdWUWZ0UlVWVTRqZVhXMFp5MWpqOCthak9peW1KYjJEK3l4TERiT041?= =?utf-8?B?SVo2aTh3Q2p1MmlDUTZJMnFCdHdRSjVzL09BTE8yNEIrazdkMGdxM1MvQjRZ?= =?utf-8?B?ajMxZUxrOHFlb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ovTE5ubU5QTkJTRWZKV0hM?= =?utf-8?B?RUN2WmMzdHZVd3owbkZQTjZGQVk2dFlwVGsyM2tTblQxbTMzcEJIMkJSYld3?= =?utf-8?B?aDZ2aU1XWnJRdzY2Wk92Ymcra2NBUnlwZDlpcVVROEx1L3J4aXlhb1VVaThx?= =?utf-8?B?YlFxaFBMZit4R09WSFYwVkxTVExUSXQ0MTNpUnlEbEhjaVorcWRxdjN3NzIv?= =?utf-8?Q?ltjm6b+ubxE/I9c4=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01a294b3-92c5-4214-aeae-08da535d5a65 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 08:09:24.2210 (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: KDBQqAAthGWSZwHsIz7xrg5+FA49Hybw8j6APz+h6FCLbxD1h+/KWuMjJAetnhGEWgM6NK4vQo94akiIOQx0oODNMRizQt3PWZMBkVSMSI4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB2730 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