From owner-freebsd-net@freebsd.org Mon Sep 7 17:39:50 2020 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B35D3D0C4B for ; Mon, 7 Sep 2020 17:39:50 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BlbBs4rshz4Rx7 for ; Mon, 7 Sep 2020 17:39:49 +0000 (UTC) (envelope-from rajfbsd@gmail.com) Received: by mail-ot1-x32d.google.com with SMTP id e23so12827412otk.7 for ; Mon, 07 Sep 2020 10:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=mn5BLO01mkHmV6z9VYSsjvBp4E6tfbAX8RjEeFsBsrI=; b=rSOud1MGbDf1urUO06QDMsUNc+vcPtYDjd4cQbvGEWOIFjAl2V9E6fH3ZScjet2wol ewGCy/ODHXODqK+d8QddmUKKpCcw/WIr9TucaL3euas9qwSBNAtOzSsLiMjxecmdc8UD I8dqH/gFgdTyP79Dh1WVncYZOSkPmZBKwYn4f2/P/D6TT3VyAheRan/0OyLQjSN8wDsM U8a7BtfrN5pZ0Y+xM3i4OrnzShsm2ei4rF4u2SVp8PrkC9C0+DWAjPMruamvyLaozeuL 9C8hS2hgTiTXbR8EqfJURTtiJ1Ub7NXCp/7WIInbJbGu3A9VO/Kz5Zu+pX9CZvqDf7tP dNdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=mn5BLO01mkHmV6z9VYSsjvBp4E6tfbAX8RjEeFsBsrI=; b=MVV3TesVAPQXjAb5CsTWEgXKPzopHRrbL0/qi2lSvJPsBOMyLJzmSDykJFe3uaMXpE lZ0q30KX/CJX1fa0Rg9VDRXwBTZlx0iNDqqSPtH3PApc1t7ftZgsNg9mDQwbRkfzho1F QMHPeh6fL/TShItOcEGFvel0LGj0wVU/GWDIrBoqXz+r1sOMNbsxGLd7aXJ8YByqm8EU AzONP57Hf5z3kJ+Pkl8RIraGtXYGCfPm0KfVotLiWlbwjD4IRJVP0MtBXSwjHKjlDdFW qevw48prb9VHzx1HLBakuIn8e/ynW2z/rsc85YTHZSd8MJdLHSTWrJ1tlqQMWxPGg18d npvQ== X-Gm-Message-State: AOAM533H0nWpKcneHEG26Fr+8svdIa1lVgbjmbUDPAa/dkWHXGTSuDwi TnEmVYquMDiPhmaxhqYzSs3t3teQp6LY7CBtwGrb91O6Nx4= X-Google-Smtp-Source: ABdhPJzO+EREx0lPE4UvTABZc8EcOnO9m3OMFEG3BNRBGAepN08f2sAxZpxm8ruXwjkQuxGIEjSH66UTo7D2RO+aU78= X-Received: by 2002:a05:6830:1e0a:: with SMTP id s10mr14198555otr.95.1599500387985; Mon, 07 Sep 2020 10:39:47 -0700 (PDT) MIME-Version: 1.0 From: Rajesh Kumar Date: Mon, 7 Sep 2020 23:09:36 +0530 Message-ID: Subject: 10G Network interface not reaching wire speed on Receive path with single thread iperf run To: freebsd-net@freebsd.org X-Rspamd-Queue-Id: 4BlbBs4rshz4Rx7 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=rSOud1MG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rajfbsd@gmail.com designates 2607:f8b0:4864:20::32d as permitted sender) smtp.mailfrom=rajfbsd@gmail.com X-Spamd-Result: default: False [-3.27 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.948]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.05)[-1.047]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::32d:from]; NEURAL_HAM_SHORT(-0.27)[-0.274]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-net]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2020 17:39:50 -0000 Hi FreeBSD team, I am writing a network driver using the iflib framework and using the "iperf" tool for performance testing. 1) 10G link with 9000 MTU: Seeing line-rate numbers on both Tx and Rx path. 2) 10G link with 1500 MTU. Seeing line-rate numbers on Tx path, but low numbers on Rx path. Base issue seems to be that Rx buffers are not getting re-filled fast enough. With low thread count, I see higher CPU utilization and lower throughput. But with a higher number of threads, I could see better throughput and lesser cpu utilization. iperf with 1 Thread: CPU Utilization is 80% - 95% - Throughput is ~4Gbps. iperf with 2 Thread: CPU Utilization is 80% - 90% - Throughput is ~7.5Gbps. iperf with 4 Thread: CPU Utilization is 40% - 75% - Throughput is ~9Gbps. iperf with 8 Thread: CPU Utilization is 30% - 70% - Throughput is ~9.2Gbps. So, something is causing CPU utilization higher with lesser thread, which kind of leads to Rx buffers not getting filled up faster and hence the performance numbers drop. From a code perspective, I couldn't see any evident CPU consuming operations in the Rx path. It's plain hardware descriptors reading/processing. Anyway we can debug to find what is causing more CPU utilization (with lesser threads) in my case? Any clues on debugging this issue? Thanks, Rajesh.