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 7F120A0543; Fri, 12 Aug 2022 12:23:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4141142C49; Fri, 12 Aug 2022 12:23:00 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2109.outbound.protection.outlook.com [40.107.100.109]) by mails.dpdk.org (Postfix) with ESMTP id B4E5E42C21 for ; Fri, 12 Aug 2022 12:22:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nh7nTLDyGIPh50CdVoMnqZCVovpaPQS1DmVPAeqAhMd8Lpn5MBIGp0W361YZjTJkVgSSvqJg1s5TuHr/Fa1MaZqVdHZdHIxWBPcHgwRtNKfcY3QGUfmxT7oqEt7/BrpCTNdcCC8n+W0urhZ4nynuNkfeSTxYR4NJ9bs7m/9hnK7EVNEdy48ucqfepthYoyy5pxiEQuXRL5AdbhE+c7E9vHBN+6oyy5AHpBgegOoBf7ELUZMTLpSDxSTaYHNqAISK5FaIwEtXGSsOIfOgX3I95BdL3f+G+z8R+rmRH6HlHvC9Mk6rlomR0s8MnIin/vgW6gxxdFIKf80VSltXH9SDIg== 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=Prfw5AuYqDDnWSOP12APbWVm0KVejSGNDHW0546zXbcxxxF8Aiq6YTQm2eQs+T0+K+j9rwPJJ8NjPPD4256g/gp3qP+3soAt1n6oZXZHkQl7w3ysX9RELnZKYz8YE72U502oVHvbZB8RpoicJw3QfEl271jz3VY4TNJilMgT3+GienRoWB8zFDlICbQZceoKDjYwuUqOYP5z7frKUVoQD9LfjjNsfbGVpr36KVLtLYITJHDAHPLJkhF1tfg8Lxjuz7fhUfhDh3dUHjRg7NKuVe2uvRMPrC13PRGg/EvZU/bBQBGdHXoXUbLgI3nMyY+EKzY93nnLPac9nGVrj2ANug== 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=RbkDlCGFkDnNrg2s/4EEyCQwxiWQkp3KDXAl+ApVntSVHTPYu9pbzzhsAm0T0QctH9JoUJcBsATJpiR8puyooHW+ET/XXDxF9WchRx17LKPRbghmzyhjsBVtb5vyUMKXyDPQJk/hTAJBzTBz5xmuRUG0vD49Bl/oxbu5vWyH9wk= 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 MN2PR13MB2624.namprd13.prod.outlook.com (2603:10b6:208:ed::10) 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 10:22:57 +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 10:22:57 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v7 08/12] net/nfp: move common rxtx function for flower use Date: Fri, 12 Aug 2022 18:22:26 +0800 Message-Id: <1660299750-10668-9-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660299750-10668-1-git-send-email-chaoyong.he@corigine.com> References: <1660299750-10668-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BYAPR01CA0019.prod.exchangelabs.com (2603:10b6:a02:80::32) 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: 6043e94b-42cf-41b0-4c7b-08da7c4ca006 X-MS-TrafficTypeDiagnostic: MN2PR13MB2624:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: smtA5i9dKWR/tMa9kByqH73XnIPpbMDXT18NmxzKui1OP1ITN1+/xb3uDbzHa9VntslmQLqjFCO/vPsyqPRV+W/BeXPWm5hRlv3LdPOh0+0clShcqV/Z930Bs+vAUjPNp8tuumsPobhj3wub26khUg51DZ7s3F0331378l5OkHJDt9uLugyCHhPRCnj47RnOZPDfpaUOTtub85jLnXc089YwbaiQo+V+3msWDJ3yMmGRQRsI2QonAlQUZZmBQyJ9Jv7LYe+DkzTeu+s87t65wOBijXwhAkUFBqRjPVylOpgBl2b8iypEgRdT4hyDC4qQJ3VIoRx07qdQHnohN+F+128PWjsG6NWw+213j/8AJmAlTaHSBjCD0u1Fo13gy9ZCL4Znv9wtROEbiK3UUdwm0KJMAnESvuxMXSo7j4W+S0CSxxAHQNDyo/KOeYTX8+gq1gWG2MV6vJw1DLy2B8vuDxyMtmo9gSeoKQaBJ4UR5VEqkCUR/2PR1Ep3qqFo5nSE8VEJ/o7Gjvq3iU0ok8/1vbH5j1I8eQP0/TQ8U3eOYGu6ctm5hMTebVSNySvSIhGWZvURjQt+WAnJPvYViPx37IJo8vFopzcNduq3qH4Kk8fzEMB0lXFksdbX5mmTG6nG3ie7+763wl/o+vLpIpxIoPF6CGEeAN7jjz979TmbOwJfoi2Zct7yNhzpFvcSZtCaixvRr/WT8IDFx6qGmFwZ0QTpYUgEv+G3Mv4f+b/qdVk4OFL4rw+h07DbLSNt2sq6OU3heHPOsWRFqfeAKBPeUvmPRhW2ZBzykLmCYhYDqFE= 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)(366004)(396003)(346002)(39840400004)(376002)(136003)(52116002)(41300700001)(54906003)(6916009)(316002)(26005)(478600001)(6486002)(6512007)(186003)(6666004)(36756003)(83380400001)(5660300002)(2616005)(107886003)(6506007)(66476007)(8676002)(4326008)(66556008)(66946007)(44832011)(86362001)(2906002)(8936002)(38100700002)(38350700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SGl2K2pxNko5SXBMbzFxM1VsMHc4N1lBV3JZc2ppQXVVL2ZMelZqRnVjZ0Nm?= =?utf-8?B?Y3JuaUs2Z2ZsQ3FSV2gwTEtwYkxLTmdQNUxKN2o3RDJSUHhsOXFGNmQweFpK?= =?utf-8?B?a2hQMGpaNFNVZHhrNUprNU1XZ3VpbndUY04rdXRqZ0hlN0ltV0ZwcUpTYkE1?= =?utf-8?B?MWpLbDhTUjFUc2Uxdkk4a1ZFK01od0w3aGwzcGQ5NzNycGh0c2JzSlFiYlM5?= =?utf-8?B?N3NJdFR5UGNHSFF4eU9Cci9KeVJPMHhmOEs0OW9BV1ZmNG5DUEJ6NE1NRW1V?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1MmZTR1hSRUdtd2JaTmRiRHR4?= =?utf-8?B?TlhRYTFyajdkMnJwdEorUFNKVHE0cnZDU0V4NXBHb1hlaWkrWmV1azVyUEs3?= =?utf-8?B?NHc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6043e94b-42cf-41b0-4c7b-08da7c4ca006 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 10:22:57.3128 (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: O0sLYQOOQ6iLXHRf765ut2ZXGhj9l8nMUMDkldOjjw/SM8Dqkezmjmy1yAv9K4EDHSAue9WcYLUShPccLX+SR6OyVlAOHlMO6oc9qW/xhtk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB2624 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