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 E3A34A0543; Fri, 12 Aug 2022 11:23:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C6A2E42C42; Fri, 12 Aug 2022 11:22:53 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2110.outbound.protection.outlook.com [40.107.223.110]) by mails.dpdk.org (Postfix) with ESMTP id 1297742C17 for ; Fri, 12 Aug 2022 11:22:53 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IAHI8Fp08+v9PmWeA799b+JKjz+mezubGF4HNmgAXJ8EE8dSD92tkedVzfCwYJSVLzYqIwK2GU8QEK6M1fVa4cK5AL8nwmUV+xcfgZS5ZO7fOymUrA7MSXerdL6skTh2rYpFvvW8muVMDcoU2ygGfikWP4uTQ1LKZd1aneCUjTy8ajXLbF+h0OvwN/ZGAnriUifGAnfHcIm4tExCjUXCOvIsnqc541rEDDg6bQijApn1DU1DI16j7oocWwQYRB8J111RCwfSJBqOL8B31cKqNYn2JOyVaVm3q2KJs9+WOCwpXlerPxFT5fRHbOfFqKbtbHZdq4K8LrHS3OLnzNQcNw== 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=GzQgExWfI2kSr84aCe80fnBccBdk/Ve66iYXJiEdspo=; b=hWa0s/H8jVJuMp/Q/xaKb4iXmymuWZ+kIQWZ9I2fDCNPekmpVcAZymORMYTHaBR1wd0E74DhZ2KG4GtpwJxMZjf7n4tA+qSh5yWWj3Fc/uMcglXZjDXIUTUCBxCNYaPoguDOy5VVb6VGSoX2+XRqV5fSteDqMocNMGGBQsw7b+4Dm7qYc77t8/Xk9+2lmtGtFKhFDRYKoPxbPZoqgHtsQTfO8bswnMM9sOOJqqUH+z+ftHPsUyuytjdgb6H828rYaXbpJzjHYxmxPaFYtbK7uBGa39Mtxl2AElmB1JsEX08AUX2CZrZIR1oTujV7YSgfa4FhUI86k+7vJxuk4lsl9A== 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=GzQgExWfI2kSr84aCe80fnBccBdk/Ve66iYXJiEdspo=; b=haQSbpsq2T27BChgotcsxNfmORolA70PFMVo0tYr2+3qJpeumfaNaNtHedOs81uSnOT4/oK5CxkjZahoEz+KmF75ty1WHnfK7OuxVyDIgIJ8C0Wr4s92EOl/R/mZloFKftSevjcGoxy1Ap0uOkIos7AJGMwPfHL36S7eY32s7hE= 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 PH0PR13MB5284.namprd13.prod.outlook.com (2603:10b6:510:f5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.9; Fri, 12 Aug 2022 09:22:51 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431%5]) with mapi id 15.20.5525.009; Fri, 12 Aug 2022 09:22:51 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v6 08/12] net/nfp: move common rxtx function for flower use Date: Fri, 12 Aug 2022 17:22:09 +0800 Message-Id: <1660296133-35266-9-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660296133-35266-1-git-send-email-chaoyong.he@corigine.com> References: <1660296133-35266-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0046.apcprd01.prod.exchangelabs.com (2603:1096:4:193::18) 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: f869003f-3210-47d2-77bf-08da7c443aff X-MS-TrafficTypeDiagnostic: PH0PR13MB5284:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dKWMV/24MFdBIfCxLDSWTX04Ht3p+97pa+Etf/nkvdahgJPTGlIQ5jlVacCyW3HIQpR1ZQ/O2s5z5bb57VoLwkxd6pOD1aI5qPBrrCBUR8MtWJdgjh9sEWICRmmDYq1rnEX7wnNzjINbu8pZNSV4Cj8EXMYi4xP7fjtMhe0vdcqi8wS8Q0nhlXWOHzSr43T8LYJHCuy/ewA4gOAolD0E846HfcuzkoRDTqhPzo2vyaOeZqGIYupED9DI/orJDTXglKHA05zdGsBEcLuf6NTbFlWqXT/t/l3/4DYUqgVh4kWX8v4eRWgUIaDpDQNJQsI7ADh3Zyid2TEAeen9mYuTLGhMScO+CUT8quE+m079PK5iiR4HH6kanKx8jEUfQUX9po8G98tUs274t1QHx8NzHS0wl4xFkLuaysLl/LZtpr9cn7xIOOUQqAnyNfthPlLl7M/xOhhaOEqqCohxjQofnK1q7gqX4SqHTaur+z5CckSSxvu+uLQOVCAy5/1Y86UrGPNJonrQm/E5SQyZCXLzna3D8aFF3gL27j578HberkJcj19zn6+qnNcb5+fxfle+I4qOpyV8YGfhY6ZowpapXHSMjGRssWNfxmCbVzgvVoIJcpChHnUD6J9cR9Zimh1bLTz6KnkVzDrypsKRd7B9+Cb7v5VLhRp7ASzLSJrjvgPwrF7QpDDsAUwpv5lI246T7UEtqkRh1AiV2kD4zdOqQ6Dm74bXE6BVLZi9GKAaWdwPqLveMzsvO/e4r/mQ3KvgatA5piwfK8LZyCHTqZozsBhf9SjlJ7Bqicp79G1qTXWzWBCEHzDnoOOdhExQxj+6ldQ6Gi+h0c3lXpT1UNqxxQ== 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)(346002)(376002)(39850400004)(136003)(396003)(366004)(86362001)(36756003)(6666004)(41300700001)(44832011)(38100700002)(38350700002)(83380400001)(186003)(6506007)(6916009)(26005)(107886003)(6512007)(2616005)(5660300002)(8936002)(478600001)(52116002)(2906002)(6486002)(8676002)(316002)(54906003)(66476007)(4326008)(66946007)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?S1BRNVQyOUZ0ZXBSYWpqNGczN3NzSEFSTXMzdGd6MTg1R0tPMVFBN3J2N3pj?= =?utf-8?B?dmhkaDc3emUyNk9hcno4dXhrTWEwNDNBMlZMaGV3RVIwSDQzNnpBcWg4Snpm?= =?utf-8?B?VlAvdlF5TkxLdS8rakxwT3VEWlpHdjlqQkNUYlc5dXlXZFA4QU9WOWhpcExt?= =?utf-8?B?L21HbXRhWnQ1am1weDZaK3VvTnpxSTc1SGMrR0Y0SHJhWHFIcTBna1N2dFVZ?= =?utf-8?B?WDE5bXJHUmg0SzlYWW1lNDF4YzJGQ0U1YW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Ehm?= =?utf-8?B?REZvTkE3OCt6V2ZMMmhQYWptWHFEaTRBTDNXaTBvNXlpaFlLVENXb2NqZkdX?= =?utf-8?B?ZFpYMGVkbFhET2psYk5yMmlTVHhXbGZWcUxaZWFTSVBFZTVpNUpERmN0UXdz?= =?utf-8?B?OUE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: f869003f-3210-47d2-77bf-08da7c443aff X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 09:22:51.7973 (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: 6jryT50evVRUT+Yy0t9j+MNStLQDekEr7SUGrrKehKVtosWl+AdZ/n8l1agYb04kpj5Vx7J+L260QdlPdpHLMk3lFgl0LUwHR1fgxhVfjKY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5284 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 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 8429b44..8d63a7b 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