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 61303A0C47; Wed, 11 Aug 2021 16:05:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1597A41207; Wed, 11 Aug 2021 16:04:59 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2075.outbound.protection.outlook.com [40.107.220.75]) by mails.dpdk.org (Postfix) with ESMTP id B14CC41205 for ; Wed, 11 Aug 2021 16:04:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M/Q63JDbyP0TuJknTXkYMqKBfQbJpsAPZPvP/WHkQ1ciMQ/SeJHI0V2Z2RJOQqtq4XeWWhnnr40JXUiml7nm7KmIlSb7jBiYMZn4tkIMxwDBcT3F5BbaIuwSjIzZD7KCB+f51IxMvWy9tAvSmxb52+7JQAjgqvwihCBC0EcLpDBrsxorLP2yGha9d5unSfrw8XKBcYhat+v5r1O8gm/Qr/1GpqH1t2B/+rXleGRFW/vuWLmN49xy9/R1Q9d/yFeSp09WSbPYFxJ36JV0G2fnYxyuRbJpBamkYsvYhCPs1mryRkdxBt+6GCDe7fQdsI3TtUoDjovNa8QiapNdSGrnzQ== 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-SenderADCheck; bh=tl6Z/enUQQdEETwhOriTQ+lSKUdAV+IX8NiF+YZghbo=; b=CNqh7lHO1gP1hOJQ0YQc/rJLVhHHOUNT6FbyV9LDGe/57IJxCOj6rQW0ggRQBOudaD9roVO+weJnUz/hG+8Aw0oN9ucIfLSu0+ADJtcPWqp65kBUPWeH8JWKxONd/5e0xADtKWIHa0LvVY2uMl5HDvvJv4Lx48MUUdRxsj5NSBUpdTBuozwGBrlO7Bbk5EcJiYzKYku+Z1CDRkzXiRJYlxNAjmeBiJ38twxwCgYN6nEDg09GUCo+CkQn9AU1dMJG4dGvfxo1O2VMGVmTLw5P0lz38mQXIJUWy5SYE6USPXrDV5sdZpU/kaAaGixfhu3ALG05/nohvasDMv2rPJvCwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tl6Z/enUQQdEETwhOriTQ+lSKUdAV+IX8NiF+YZghbo=; b=lbzyoL3JbBFcpZhcJjLEeHs4uOrPDau+qhAc0nX0gUFeshz+SgGcUv889YEVCtYfVAPFpwFXumCZY3kJ1Wl33qboWoYiYJC41CVi+l9+k8Q6IZb9meHYntjOLmqr0yviOVkovoO0I3rsFl11zd+MijfkmTaKBRjj6Y8beSmjwUB+814VHF4Ta8+gomljA82gFAHS/9doXpF68dzCLoPWxlVM6FCf4YMdXCVkrP2YEmSHVmZxwIum+0jV+Cq74esPWibV9iPM2fIm5geTKMCKtIMBXkeUngu9yEGpCJQ/ES8IRGGpIO3gwQ3R5jdSC/9DhSGK5v6mI1l4B0aXy1y4mA== Received: from DM5PR19CA0021.namprd19.prod.outlook.com (2603:10b6:3:151::31) by DM6PR12MB3737.namprd12.prod.outlook.com (2603:10b6:5:1c5::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14; Wed, 11 Aug 2021 14:04:53 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:3:151:cafe::84) by DM5PR19CA0021.outlook.office365.com (2603:10b6:3:151::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13 via Frontend Transport; Wed, 11 Aug 2021 14:04:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4415.14 via Frontend Transport; Wed, 11 Aug 2021 14:04:53 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 11 Aug 2021 14:04:52 +0000 From: Xueming Li To: CC: Xiaoyu Min , , , Xiaoyun Li Date: Wed, 11 Aug 2021 17:04:08 +0300 Message-ID: <20210811140418.393264-6-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210811140418.393264-1-xuemingl@nvidia.com> References: <20210727034204.20649-1-xuemingl@nvidia.com> <20210811140418.393264-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 33164a32-16cc-4e1f-6a8c-08d95cd0fe52 X-MS-TrafficTypeDiagnostic: DM6PR12MB3737: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QqSJKNdnp6QqImBs2Ell+H7tk1Gx8abKayj4i8uKMKSuRfPhWRj1QdP4IFq+XXKFzcTm9tu5LXL48y7tvq/Ckw+Uvyqy9/4xf2o5CtoycCIm0SL/pzegBniZdlt/qE2XPXujA0gL/NtrxqFjR8OslFp4mPm7pe5GkGUWCqiwhmay9msvdiv4e/+sd9BbRVUvojuAAiFbTsUaQJivBIDlAg1qCRnFmeycFgJkRmZ+mrx49o884SjJ6Wz9pqLsrCNMrGLU1hdZz986XH/FHELW22jzovPsJW+5QsOtwg3NCtgt+0XzcT9vLRpp0hUzB+ays99LNIeTm/G7HkRRgOz2ufT1+Tq91b42XKhxQ9H0h2GyT0GsQgHt0rMUwtY07/SNqoG7qvbNvJ+rufoVy5I8cw2Ve+J7b5eedA2+w9RspeXszFOXB4cjofzjbHGpoJc6y/PkuJGQmqgiSC/fXhDozufNRLuF7JFu3M9ANszog3vslqaBSVBCH9WbRIlGUUitC/0I5VfMwkOXFZBDEe/UYh1A5sJr+UAXhgkNShcQTlGiavrH5BdAMsSdc1mcmJKBs5fw+n8WCsCH78Gv6XVmfqYT8/rpe3KDdpWvNX17ngnG73hZHHFMqXZNoFMyp5y9iNnQpBlnDh6XPoyGHf/+JbyiuY38HFcwZ3cVE1UgccLdoDyUmlHTLO6hKZcuxwtydMSJxeb1nFPaWynNHw3EiCEtqdJFk+v1Nk7Fbg9lApA= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(39860400002)(376002)(136003)(346002)(36840700001)(46966006)(6286002)(83380400001)(478600001)(5660300002)(2616005)(55016002)(109986005)(36756003)(7696005)(336012)(356005)(7636003)(1076003)(70586007)(70206006)(6666004)(82740400003)(82310400003)(2906002)(8936002)(16526019)(47076005)(186003)(8676002)(86362001)(36860700001)(54906003)(426003)(36906005)(4326008)(26005)(316002)(266003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2021 14:04:53.7084 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33164a32-16cc-4e1f-6a8c-08d95cd0fe52 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3737 Subject: [dpdk-dev] [PATCH v2 06/15] app/testpmd: add common fwd wrapper function 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 Sender: "dev" From: Xiaoyu Min Added an inline common wrapper function for all fwd engines which do the following in common: 1. get_start_cycles 2. rte_eth_rx_burst(...,nb_pkt_per_burst) 3. if rxq_share do forward_shared_rxq(), otherwise do fwd directly 4. get_end_cycle Signed-off-by: Xiaoyu Min --- app/test-pmd/testpmd.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 13141dfed9..b685ac48d6 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1022,6 +1022,30 @@ void add_tx_dynf_callback(portid_t portid); void remove_tx_dynf_callback(portid_t portid); int update_jumbo_frame_offload(portid_t portid); +static inline void +do_burst_fwd(struct fwd_stream *fs, packet_fwd_cb fwd) +{ + struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; + uint16_t nb_rx; + uint64_t start_tsc = 0; + + get_start_cycles(&start_tsc); + + /* + * Receive a burst of packets and forward them. + */ + nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, + pkts_burst, nb_pkt_per_burst); + inc_rx_burst_stats(fs, nb_rx); + if (unlikely(nb_rx == 0)) + return; + if (unlikely(rxq_share > 0)) + forward_shared_rxq(fs, nb_rx, pkts_burst, fwd); + else + (*fwd)(fs, nb_rx, pkts_burst); + get_end_cycles(fs, start_tsc); +} + /* * Work-around of a compilation error with ICC on invocations of the * rte_be_to_cpu_16() function. -- 2.25.1