From patchwork Wed May 22 16:12:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 944 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 985D244099; Wed, 22 May 2024 18:14:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0785E402D0; Wed, 22 May 2024 18:14:39 +0200 (CEST) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id 4506B400D6 for ; Wed, 22 May 2024 18:14:38 +0200 (CEST) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1f05b669b6cso12016035ad.3 for ; Wed, 22 May 2024 09:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1716394477; x=1716999277; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t4ZrRfAFjp6MSY8/ydKrDkbl4tHYfqQXuodJQpR310A=; b=0dmXcJNihJEXQjD7q6pOKISmUoC4JlyF3aeZyiMHQVA4FfNNmRnn+Rl+OAq8riMfyj NMJjxYgpHl5oAaaogVfR3U8WHSPae9DSXFn5tzTLksXmPdlFf0xfeJvx/9Lhr7UQhZmw Q1nEwG3kjrBJow6Z2GaJ29Iob17MEL26KnoQI6ObDLwA69NICRxOfX53JvIp0IRTcp+0 EaD0/Eg6wq+K69AdWj0kL1RfXmfIgwzLJ1haELTMh175FiyYD3rQnx09FoF9k47GZSL0 AvWrdh4cKeLj7LUjVR/wAM00ZznDTsvdBoDVT3ffFB1GIvWHUoNkgJ9gSK0CyZKSUVJ3 FR7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716394477; x=1716999277; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t4ZrRfAFjp6MSY8/ydKrDkbl4tHYfqQXuodJQpR310A=; b=SJYFDH16sSFzQMB0zT7i9gjEQQ8jqVU9urmNOY1O2NB0YCPz3rNc6tMubnMuibHASr o0vXJNc2hsTrRee9oyqp7a6onM75jxgLglsQrchIwV9z7xTGf2JgzZ37gqvxr0GARJ4V Py/i3lWSIXE1rPjVoAYxdSaeNpkV7KoJuvYWQViOZ45nGUHMvfc/PrsfTpfc803B2YBh Eqb9dquk9XEdW43tIGS2Jn7A/SPjTOCyK4Sry/Cji1B2YNhd5TxZwcF51+gQu9f5pRM+ TJUrXYKdzlF3WD8LZ2wGh4S/yPUNECexHENS/ZtGVUunhMOqqNaOglCWA/8bG9pI57qG Utrg== X-Gm-Message-State: AOJu0Yxv60acg7dlrQAfDVCgVjk3gg8RLgz80lc5HfS3XWKNkyHXEtoS 58lPK5R4G4IB7WGUj/Otd10gxDeQKhOhVZTddsmu/HcQw14qnWYh2a2781oks7FDaCh/VRe1IE2 tZio= X-Google-Smtp-Source: AGHT+IHzPkjRkpIofxKr27pIuxbER+8jxH0LtbB+gCL681k5wskpYNTdsgLkonppca9LnoDup83Neg== X-Received: by 2002:a17:902:e810:b0:1f2:fdc9:9a6a with SMTP id d9443c01a7336-1f31c9d0567mr26042585ad.42.1716394477294; Wed, 22 May 2024 09:14:37 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f327ae4647sm13684175ad.224.2024.05.22.09.14.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 09:14:36 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v10 0/8] Common statistics for software PMD's Date: Wed, 22 May 2024 09:12:24 -0700 Message-ID: <20240522161427.64568-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240510050507.14381-1-stephen@networkplumber.org> References: <20240510050507.14381-1-stephen@networkplumber.org> MIME-Version: 1.0 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 Adds common code for collecting basic statistics used by many SW based PMD's such as af_packet, af_xdp, null, tap and ring. This version uses two counters (current and offset) to implement SMP safe reset on 64 bit platforms; this avoids having to do locked operation in the fast path. On 32 bit platforms, the compiler will split access to 64 bit variables by default; therefore it has to use std atomic. By using common code, it also fixes missing counts in several drivers. And fixes several bugs. v10 - can use fast 64 bit counter on all architecture except I686 - get rid of rte_read/write_once macros - adjust #include based on iwyu Stephen Hemminger (8): eal: generic 64 bit counter ethdev: add common counters for statistics net/af_packet: use generic SW stats net/af_xdp: use generic SW stats net/pcap: use generic SW stats net/ring: use generic SW stats net/tap: use generic SW stats net/null: use generic SW stats drivers/net/af_packet/rte_eth_af_packet.c | 78 +++--------- drivers/net/af_xdp/rte_eth_af_xdp.c | 85 ++++--------- drivers/net/null/rte_eth_null.c | 83 ++++--------- drivers/net/pcap/pcap_ethdev.c | 100 ++++----------- drivers/net/ring/rte_eth_ring.c | 63 +++------- drivers/net/tap/rte_eth_tap.c | 75 ++---------- drivers/net/tap/rte_eth_tap.h | 15 +-- lib/eal/include/meson.build | 1 + lib/eal/include/rte_counter.h | 141 ++++++++++++++++++++++ lib/ethdev/ethdev_swstats.c | 102 ++++++++++++++++ lib/ethdev/ethdev_swstats.h | 117 ++++++++++++++++++ lib/ethdev/meson.build | 2 + lib/ethdev/version.map | 3 + 13 files changed, 484 insertions(+), 381 deletions(-) create mode 100644 lib/eal/include/rte_counter.h create mode 100644 lib/ethdev/ethdev_swstats.c create mode 100644 lib/ethdev/ethdev_swstats.h