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 C83AEA0032; Fri, 24 Jun 2022 04:55:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1582442B84; Fri, 24 Jun 2022 04:55:17 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2116.outbound.protection.outlook.com [40.107.237.116]) by mails.dpdk.org (Postfix) with ESMTP id 0B1DF4282C for ; Fri, 24 Jun 2022 04:55:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NDAkHRfaV7UgmDj2NLJ2/tJQziSFPUw2eAO27DnC2k2Jnh1WAafuKvKnRtF1X3H1XGam68/NMMyzdUYq7vt7AOPBlawNHRB9D0MxM7daQ95aWcFDCB5x3edUrSIdRlB4uOG/3hnHzpH6qajtbltA39yO4CT2pyABvl+/DJL7PMen6dV5DNpb9y6nhCyE5GS+cEjeMV6hefD0tnGkK2Jl3OPk7ii28qi5J2SgiKzQ++NZ4iSW1IeQ5x0ebTUisZ0HQBb1/d2lMwSTzTnu5S///iib33LL/zQoSJ2iQgauv4Y+HjKVGerHnHJjjbzW+484hhhSaAtMii4ehy+aKfxdoQ== 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=Y9VnCt//ZoOW+5dVyxAg3PXMYIE2MrN1dXWi2mnIyJFj1fYl1Rche8BZDW8J+uvpAKQV//o+KOFiz361n4PjRLMCe5wbXhlMOs7E1D/x1fOmZ5TcHdD78rCoy7TGC61krsytbpSXZGVLJYuhMrdDPF0aczaVX1Toma76mAXAeXRXTSvGn6z3RGZQaJdF+qoM4FrZgDVWC14QBMCaH1Hk79nq+Xa1OJT6E8BbCLDDBMrr1gmH2sUuZaiIPRDfWaow5DUgx2Q06ApuQH7sW8kFBWBAsotpKHRK3FtMHt+9K4lxmLEyrtQV4QzeEO3uNUckRQV9h/2u1SHXzXHrw2LIVg== 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=rKIjhH4vmkCrydDnqpQkO+o2kmtw9CU6TjIz0iTD/ZH6oDMg6GND5Dgu4bM7iDOWeQeAz6GFXdMkBLAIE3rj9CVaiqRfLfmNcJltUStFBzLfcYrZYgiZhib9STH8zoki7INVx7KrI8AKsFMLygVJjcSKJK+wfuClc71zwCnyew8= 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 MN2PR13MB2752.namprd13.prod.outlook.com (2603:10b6:208:f2::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Fri, 24 Jun 2022 02:55:10 +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; Fri, 24 Jun 2022 02:55:10 +0000 From: Chaoyong He To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v3 08/12] net/nfp: move common rxtx function for flower use Date: Fri, 24 Jun 2022 10:53:57 +0800 Message-Id: <1656039241-20955-9-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1656039241-20955-1-git-send-email-chaoyong.he@corigine.com> References: <1656039241-20955-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR02CA0030.apcprd02.prod.outlook.com (2603:1096:4:195::17) 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: c9cbfef4-5912-4e8f-c483-08da558cf41e X-MS-TrafficTypeDiagnostic: MN2PR13MB2752:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NBjmSGJ++iYAn4BbgIw+3DDzUsf3WvTYMjwV5MLLfaHvFawC1r36466/wnlay5mtvzcIxNlUemluuFebQxVy/8D9xiLD1UA3KWyXEGKYpoWagSZGLA0YX+jHCJPyeCIFoaPpc6fsbKua+jIzegJArhPhCg1nxZEBT7gt0NTp9QQ/fLD5HCOkY97oixt1wuB2fO8MV76zi+Et30ygf7F6j+dslBDjEQz8wauTAFSgW0T2EWNptaiZrbSQAklErCe8iRS0fXnMjbsqMFloZ1W7061iIDj5Zey+azYYmFJFdWXW/wY4luYruwwd8YdcuSXA1BaZy5n+U1t+va28HLAgluExH8f23jM869WW8d7Hz5HmwP2bd3tueeEQVUopiAq70gM7rFLTL/S9tqzwraREsTRPYzvnX0bO8C8lB6U8GHIG5lRPZYWX6o63eCDyXIgk3OCrd2fTv420TLkxw+QVDYz5vO5YCa4TI/LS5JbXYraSVT2iuHTrfl+pGQkCsdLNphnpL+VBHNpaN+YZ8uY0K7nbKrbFevwo1r96rZoopuOjlpyJNGFkm9ytoBr7ItSH9t+hcenmzxRySsp3Luxb8lbY3NZ0VRyu2Qxmv1hi3NHV0bTZ7egfL3yjVVainRAqxbCVpJ6DYH0N8xYFBqeWend08QlT9mdKb6bJHFwDwr7GehsvLAFf3LGX/LkoxO9GvlZ5euuVbe/i5rFXAIiQQBJz183eWhZNnWQpOI7AYT8WNbRO6DxvYnuypEM27Re6CloJdV/6iu2tXBDHg+/hgdeU+szT/sfstldNRB0pQxx1WCKFlcPvcQCirl4nwawVqRiXUYoFwbk5o/OtfgJ5gg== 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)(39830400003)(376002)(366004)(136003)(346002)(396003)(66556008)(2906002)(66946007)(26005)(83380400001)(6916009)(66476007)(6486002)(2616005)(8676002)(41300700001)(38100700002)(4326008)(6506007)(6512007)(44832011)(86362001)(54906003)(478600001)(36756003)(186003)(52116002)(316002)(6666004)(38350700002)(8936002)(107886003)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Um9mL3ZmWU43THpoQnAvR3YyRkZ4VmdldW1tWlZtczBCQXAzT0hYYjh4SWdP?= =?utf-8?B?QytjZEhib3A3L0t3VEpwcFA2NHEwbUs2NFdaQUJwUGJSQXp5NHFmV2dKL3dV?= =?utf-8?B?QnpFSkk4RURYc0Q5QWExRXducE0ybHNDclI0a3BxZFBuLzU3ZWpMRXdxUi95?= =?utf-8?B?eUJZYlJsQ3BtQTZ2RUFCWldlTnZBV1c3YVBzU0hnMUZCVFhxbDFMaEFZb1l4?= =?utf-8?B?dHBjWVFyaUFMaDl2M01OcmY0OFNRYVJRalJ4dFFOQjd3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INUtjdDhNU3RzV0hqNWx1TUx3VGJVR3MwN2JQSXFI?= =?utf-8?B?Z2J0MnNoR1pXbnZVU0U4d0ViWCtoeUpHMmppVnhnREkrcEh5NnVvQ3FFT1Ni?= =?utf-8?B?b2c9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9cbfef4-5912-4e8f-c483-08da558cf41e X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2022 02:55:10.7972 (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: Rb2F7C5bgUUKU4JYMdHrRW3NK4Va5lpZNRJydu2G4jWviCaX7D9N7BdE/dFwDcUH3h4SHwT6NwzY+q27542C4PthiPpdsXOpOljDwW214x8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB2752 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