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 1FD50A0548; Thu, 8 Sep 2022 10:46:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8ACBE42BA0; Thu, 8 Sep 2022 10:45:52 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2106.outbound.protection.outlook.com [40.107.237.106]) by mails.dpdk.org (Postfix) with ESMTP id 3A4DA42B78 for ; Thu, 8 Sep 2022 10:45:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hfi2GV+xIzc1exh6orQu99+zSNy4M7vnVvEXkNfioRKuzb6kIbBcrC+8dsTVauldSdHey53XQncr9sh4PXW00sv8szyQ9EX0XfWumLZW+cLiu2iaaN+qNv0IDIeeO44OGqJD3OiLvpc4NITB2AnHqVSGVn9+fstGsuyhu9nicy7E3VW+8zpOUkb9Bsa8QiSKg4pgfxXE6/rH5cPIFjfv6u5+jk6tZSQ6rnZ83AbUCsPVPfvmoECaZz7MCCSF36IxjllMMw357pGo6nEY45nU/pixm7+TRvIfxIQx3RdnKWD12NWrrL91Avr47sk8bmlomvTcSZUBYNyArtToD85yPw== 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=fDWUmziPnVy9I3CR59JYliXLswX87F8LOLmoo2Rs8BU=; b=aWgTU1Y0LJ1F8X34AjB3kDVgcKvSXmujN7+1OwG3o1NW8GtREIuTp9S+MsFNBELVJDc/dmSt9jSzuDlM1BXRc9Zyi6DNaJalE5ySZa8PUgjRVAbQgX2nV9b0zhmLvOCV313hPU2wOzJpyZP24WdgwCEUKJXd6XY+TxupSCD32K8HWZiAYxhLgJx+3eB+kN7M+SzWZqvMK88QJYGf8IXyLxMTg8QBYki7XKFRlhRL2ufNpi93cyfHJ/Qz9jrVoxgOCjL+oz5DI5BpWOqmn+mnWWK3wf+rUOGBZ+jvz2ZJAP2+/SwkLBMpnDGUh/QE9yrgrzzUM1swqYYpfIINimH6uA== 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=fDWUmziPnVy9I3CR59JYliXLswX87F8LOLmoo2Rs8BU=; b=V4mZBEehdCdU0VJbQ+B0Npo1q+eihQdYvxyJ8s0OdkJjw6C/0AYaBImdyFIn7gqGI9K03vxCUgIMhMmyMkYrSU9mowuIojFxyEVzcSTQgeJ6I5G9N+3L1o0OASkr15o3DTqgjdhpyfHf9d3Q+gDmdivJ2zNlalyKri6ZTP6PZj0= 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 MW4PR13MB5940.namprd13.prod.outlook.com (2603:10b6:303:1b8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.3; Thu, 8 Sep 2022 08:45:49 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::402d:6abc:83a8:2431%6]) with mapi id 15.20.5612.009; Thu, 8 Sep 2022 08:45:49 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He , Heinrich Kuhn Subject: [PATCH v8 11/12] net/nfp: move rxtx function to header file Date: Thu, 8 Sep 2022 16:45:01 +0800 Message-Id: <1662626702-17254-12-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> References: <1662626702-17254-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0023.apcprd01.prod.exchangelabs.com (2603:1096:4:192::17) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW4PR13MB5940:EE_ X-MS-Office365-Filtering-Correlation-Id: 9854ce67-8b1f-4f19-1c6d-08da917687c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B06j+a6vZ+y8kjMFenDgZznq65B3idQYFQj/tFWRqu6CYgz9WVSfomeroF8+h/Qozm5d88EmvPIEx/Qn0gbVNVQbQGHbo3clF4BAoozQVOVrJvU8IUIfvJB34God5qxKdAJFmSxYqsCNHtMhWjTM/NcppWKuJ6UyUpamMKewvGlvdILAmShiNa4jAli197VaF86zMyMeoljAY2MVsGz3FdoTGrYLXWtYMqeaorUN0MQdQDF0KDac13KIq53e81OibUZGkUTRyR1yd10AbrIg+5Ph8yyT9N2UbPueU22OfXIlEfXoel+q+A3TN0ZBT4oMfzS5CVIm0Qb0Hw/MCxoSH3sIhDjD+n4suAyFnqk2Rqg9Qc9MnLBYa1dVLyJkxFJHwU7Kr5KBB696a+yGtGrghsii08ZoSxryfS1VLNzm7w9mymG7Yr95ctbwBdJS4N08Xykzan6qUhy5xMGK+rK4kiwyJOtSEglVe1UlPwbAX31d3bF4pEGRhZiHzQvYzdgekYlR/m+y4QgVPpjv5zeEW7I/QhcqIQ6lOMLSfHD7+vF5uX2auTX9b5+alrpcp/uCBWvEbryTXI1vIZXTHkv06Mr7/Ldbn12yWRnnDJzlcIWx+tg5p9mCc+BkMPTl57GJLMpkDbGRvrGjoZp/55Oi8BNpVVwdDVlT6exrBjotE2a9G23m6IoIm0RZ0M4jrUOYDQpfWnfAG2PE9hONboGs0c5fmd8AIRFWYbCzSTiqhrEpoiQCvIK9HrW7oU79J1ZxgGO3jgeaIzELVhAe+uG37A== 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)(396003)(366004)(39840400004)(346002)(376002)(136003)(107886003)(44832011)(2616005)(41300700001)(6916009)(38350700002)(83380400001)(26005)(6512007)(186003)(36756003)(38100700002)(4326008)(54906003)(2906002)(6506007)(316002)(66946007)(478600001)(86362001)(5660300002)(66476007)(52116002)(6486002)(6666004)(8936002)(8676002)(66556008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NEdwYXJqNEZ2dDBRZnVCdWc1WHI4S0JvSXlnM01sVTBjQnVDd3R1Y2plOTFD?= =?utf-8?B?NWJ0dHR2bGU5QVB5VER4YXNBNzZBMENhaDRqdEhjNTUxYjQzb1RDSlp4eHVh?= =?utf-8?B?cXRmd21LWkJrdFprTXdMcnBxWWVYN0h4ZEg3RjZsTTVjc2JzeVNRTWVXcE1h?= =?utf-8?B?cEVTVTNwejlJVk5OVUV3QTJ6Q3IxMk5MQU9TdnNISlZuMWhiR0h6SHA1dk5N?= =?utf-8?B?TjIyd20xR0hTemMrVWdubGVEcUZGUCtzcWdDQXV0eEhxSTdWenNMckttS1du?= =?utf-8?B?d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nZ1JXMTNPSlM5UHdLNXlsTHVFUm53?= =?utf-8?B?bHhTUVpFRlB6YXVOS0lvVEI4L3dGZ3gwb1FiMXlTSExJTjB4MUo3M1NnQk04?= =?utf-8?B?dVE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR13MB5940 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 Flower makes use of the same Rx and Tx checksum logic as the normal PMD. Expose it so that flower can make use of it. Signed-off-by: Chaoyong He Signed-off-by: Heinrich Kuhn Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_common.c | 2 +- drivers/net/nfp/nfp_ethdev.c | 2 +- drivers/net/nfp/nfp_ethdev_vf.c | 2 +- drivers/net/nfp/nfp_rxtx.c | 91 +---------------------------------------- drivers/net/nfp/nfp_rxtx.h | 90 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+), 93 deletions(-) diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 0e55f0c..e86929c 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -38,9 +38,9 @@ #include "nfpcore/nfp_nsp.h" #include "nfp_common.h" +#include "nfp_ctrl.h" #include "nfp_rxtx.h" #include "nfp_logs.h" -#include "nfp_ctrl.h" #include "nfp_cpp_bridge.h" #include diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index fea41b7..13fed4b 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -33,9 +33,9 @@ #include "nfpcore/nfp_nsp.h" #include "nfp_common.h" +#include "nfp_ctrl.h" #include "nfp_rxtx.h" #include "nfp_logs.h" -#include "nfp_ctrl.h" #include "nfp_cpp_bridge.h" #include "flower/nfp_flower.h" diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index d304d78..ceaf618 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -19,9 +19,9 @@ #include "nfpcore/nfp_rtsym.h" #include "nfp_common.h" +#include "nfp_ctrl.h" #include "nfp_rxtx.h" #include "nfp_logs.h" -#include "nfp_ctrl.h" static void nfp_netvf_read_mac(struct nfp_net_hw *hw) diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 8d63a7b..95403a3 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -17,9 +17,9 @@ #include #include "nfp_common.h" +#include "nfp_ctrl.h" #include "nfp_rxtx.h" #include "nfp_logs.h" -#include "nfp_ctrl.h" #include "nfpcore/nfp_mip.h" #include "nfpcore/nfp_rtsym.h" #include "nfpcore/nfp-common/nfp_platform.h" @@ -208,34 +208,6 @@ } } -/* nfp_net_rx_cksum - set mbuf checksum flags based on RX descriptor flags */ -static inline void -nfp_net_rx_cksum(struct nfp_net_rxq *rxq, struct nfp_net_rx_desc *rxd, - struct rte_mbuf *mb) -{ - struct nfp_net_hw *hw = rxq->hw; - - if (!(hw->ctrl & NFP_NET_CFG_CTRL_RXCSUM)) - return; - - /* If IPv4 and IP checksum error, fail */ - if (unlikely((rxd->rxd.flags & PCIE_DESC_RX_IP4_CSUM) && - !(rxd->rxd.flags & PCIE_DESC_RX_IP4_CSUM_OK))) - mb->ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD; - else - mb->ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD; - - /* If neither UDP nor TCP return */ - if (!(rxd->rxd.flags & PCIE_DESC_RX_TCP_CSUM) && - !(rxd->rxd.flags & PCIE_DESC_RX_UDP_CSUM)) - return; - - if (likely(rxd->rxd.flags & PCIE_DESC_RX_L4_CSUM_OK)) - mb->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD; - else - mb->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD; -} - /* * RX path design: * @@ -768,67 +740,6 @@ return 0; } -/* 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, - struct rte_mbuf *mb) -{ - uint64_t ol_flags; - struct nfp_net_hw *hw = txq->hw; - - if (!(hw->cap & NFP_NET_CFG_CTRL_LSO_ANY)) - goto clean_txd; - - ol_flags = mb->ol_flags; - - if (!(ol_flags & RTE_MBUF_F_TX_TCP_SEG)) - goto clean_txd; - - txd->l3_offset = mb->l2_len; - txd->l4_offset = mb->l2_len + mb->l3_len; - txd->lso_hdrlen = mb->l2_len + mb->l3_len + mb->l4_len; - txd->mss = rte_cpu_to_le_16(mb->tso_segsz); - txd->flags = PCIE_DESC_TX_LSO; - return; - -clean_txd: - txd->flags = 0; - txd->l3_offset = 0; - txd->l4_offset = 0; - txd->lso_hdrlen = 0; - txd->mss = 0; -} - -/* nfp_net_tx_cksum - Set TX CSUM offload flags in TX descriptor */ -static inline void -nfp_net_nfd3_tx_cksum(struct nfp_net_txq *txq, struct nfp_net_nfd3_tx_desc *txd, - struct rte_mbuf *mb) -{ - uint64_t ol_flags; - struct nfp_net_hw *hw = txq->hw; - - if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM)) - return; - - ol_flags = mb->ol_flags; - - /* IPv6 does not need checksum */ - if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) - txd->flags |= PCIE_DESC_TX_IP4_CSUM; - - switch (ol_flags & RTE_MBUF_F_TX_L4_MASK) { - case RTE_MBUF_F_TX_UDP_CKSUM: - txd->flags |= PCIE_DESC_TX_UDP_CSUM; - break; - case RTE_MBUF_F_TX_TCP_CKSUM: - txd->flags |= PCIE_DESC_TX_TCP_CSUM; - break; - } - - if (ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK)) - txd->flags |= PCIE_DESC_TX_CSUM; -} - uint16_t nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h index a30171f..cd70bdd 100644 --- a/drivers/net/nfp/nfp_rxtx.h +++ b/drivers/net/nfp/nfp_rxtx.h @@ -360,6 +360,96 @@ struct nfp_net_rxq { return (nfp_net_nfd3_free_tx_desc(txq) < txq->tx_free_thresh); } +/* set mbuf checksum flags based on RX descriptor flags */ +static inline void +nfp_net_rx_cksum(struct nfp_net_rxq *rxq, struct nfp_net_rx_desc *rxd, + struct rte_mbuf *mb) +{ + struct nfp_net_hw *hw = rxq->hw; + + if (!(hw->ctrl & NFP_NET_CFG_CTRL_RXCSUM)) + return; + + /* If IPv4 and IP checksum error, fail */ + if (unlikely((rxd->rxd.flags & PCIE_DESC_RX_IP4_CSUM) && + !(rxd->rxd.flags & PCIE_DESC_RX_IP4_CSUM_OK))) + mb->ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD; + else + mb->ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD; + + /* If neither UDP nor TCP return */ + if (!(rxd->rxd.flags & PCIE_DESC_RX_TCP_CSUM) && + !(rxd->rxd.flags & PCIE_DESC_RX_UDP_CSUM)) + return; + + if (likely(rxd->rxd.flags & PCIE_DESC_RX_L4_CSUM_OK)) + mb->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD; + else + mb->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD; +} + +/* Set NFD3 TX descriptor for TSO */ +static inline void +nfp_net_nfd3_tx_tso(struct nfp_net_txq *txq, + struct nfp_net_nfd3_tx_desc *txd, + struct rte_mbuf *mb) +{ + uint64_t ol_flags; + struct nfp_net_hw *hw = txq->hw; + + if (!(hw->cap & NFP_NET_CFG_CTRL_LSO_ANY)) + goto clean_txd; + + ol_flags = mb->ol_flags; + + if (!(ol_flags & RTE_MBUF_F_TX_TCP_SEG)) + goto clean_txd; + + txd->l3_offset = mb->l2_len; + txd->l4_offset = mb->l2_len + mb->l3_len; + txd->lso_hdrlen = mb->l2_len + mb->l3_len + mb->l4_len; + txd->mss = rte_cpu_to_le_16(mb->tso_segsz); + txd->flags = PCIE_DESC_TX_LSO; + return; + +clean_txd: + txd->flags = 0; + txd->l3_offset = 0; + txd->l4_offset = 0; + txd->lso_hdrlen = 0; + txd->mss = 0; +} + +/* Set TX CSUM offload flags in NFD3 TX descriptor */ +static inline void +nfp_net_nfd3_tx_cksum(struct nfp_net_txq *txq, struct nfp_net_nfd3_tx_desc *txd, + struct rte_mbuf *mb) +{ + uint64_t ol_flags; + struct nfp_net_hw *hw = txq->hw; + + if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM)) + return; + + ol_flags = mb->ol_flags; + + /* IPv6 does not need checksum */ + if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) + txd->flags |= PCIE_DESC_TX_IP4_CSUM; + + switch (ol_flags & RTE_MBUF_F_TX_L4_MASK) { + case RTE_MBUF_F_TX_UDP_CKSUM: + txd->flags |= PCIE_DESC_TX_UDP_CSUM; + break; + case RTE_MBUF_F_TX_TCP_CKSUM: + txd->flags |= PCIE_DESC_TX_TCP_CSUM; + break; + } + + if (ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_L4_MASK)) + txd->flags |= PCIE_DESC_TX_CSUM; +} + 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, -- 1.8.3.1