Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp162938lqg; Fri, 26 Apr 2024 11:35:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWwiW5Tm4wrtli7eQKMBuaXj9KCvrz7jEMIZWFe03JTrb+aq4clz3GlHa65stCsaJ9+MhGYBb5vKAMaopTk8HOF8THq96PlaMJBdcofow== X-Google-Smtp-Source: AGHT+IHDwfeM+KifE1ypVQvUpRFOpO0nPGGeiTF35gBojop4CfNEHMJVkEi170CXOkiW26eGoYai X-Received: by 2002:a05:6a00:1907:b0:6e5:ea19:bbcb with SMTP id y7-20020a056a00190700b006e5ea19bbcbmr4601830pfi.5.1714156506064; Fri, 26 Apr 2024 11:35:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714156506; cv=pass; d=google.com; s=arc-20160816; b=AYAsA/FOoPMZxoWqFyrbnPS5p6BoL9UwoMiLyUqAfYfqrKpRUKaf6BJFV+QqvjTJDm C3TjIMDzxqM2V1TNodNJvJYRBD6+0ajxkxIJ0vvIFHsQL1Ui6Vi5M29Hs6LN/VPDTYQZ 3i5+CN1007pT33HrFw+gZLJLaqNmERn0WOfpXyIfoEPcelmnl3X5TN6vmAFWcjscuAof 9TfsbZpXku0sTLH3+NkM6h2ezNXZEicRajsDQ4/tuftK1iWwHrl+i7+K9KAogCf+4Hz2 SSZKYUXSKaPFmFsLIkz1OezasNUH4WLRfuAYDVF/aEoZsymFeNqXmiwY5ODLUvOBkMwT fBtg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=aqaAQgdA856jvIs7dAW5ZIMPYVryl65URaMxVc//Sq0=; fh=aDTS+bpspYtECWIZkV9sc23CsXTIDr2sIkz0LRDYvxk=; b=TDfCOrU11sFSndj8tA1F5cqymAXj7jN/9WaUXw6tcIVZHdzEF1rVJpOBrLGHe02Q9C 5zQSjSQG5ujwz91RAY6TyII/fLt3rch+qwfiywqV0buoY9zV3FNFXwETEHVSev/igcJx N2TpePBqxGW3ER7nVd7/GMxd3JOQ373jC/jzZD0SPke6Ex0TaqWPWbN1Cfs2yAkVM2Ll Gnna2HQjsTss5IR7D0sXN+UCjTFsslUhp0na8xmDMaHOaaMMoUtzS3Zo8DaQoWVbmOS5 fDnISKhWsGq0Bg7iMN03NFb7mUzN6d6EWXW+Ru+O7a5eVpUKNS9f6D/Tog4PtK5vemt+ DJQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=SiRoxZi6; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-160574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160574-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c12-20020a056a000acc00b006ee250a6c70si16042675pfl.61.2024.04.26.11.35.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 11:35:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=SiRoxZi6; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-160574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160574-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AB223287740 for ; Fri, 26 Apr 2024 18:35:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B7F32137E; Fri, 26 Apr 2024 18:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="SiRoxZi6" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 298C0125AE for ; Fri, 26 Apr 2024 18:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714156451; cv=none; b=tmcQTOw9Y9x3yBnyqmyatDLo/13UIr+fmnklk4P66pXmdJLrWpgT2Wc7apxxoMs2q0P8Qlql5gYzv3xPjqaK3JXrpeE+duC+13ZhvODWom+pn+16FzegLEMWbqRnvIKWdyf1mUrebLUMPPaCd25rOz73I0gFF3IXOXcf1GBmwmg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714156451; c=relaxed/simple; bh=vHW1DL0lxBdtpusUhIuDr8YiecZhEDqf3QUX1YWqzBU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CySsZb/DXVVbvL5c/cpxSq1JXTsSPEpLbDKwsGkaEQbs/gxqEX0gwFtDUqpc3jQhdDeoCEfvoWbnGQJZUfs1QcSYiO1gYtIcMCh3gwPTJUhXyWiDm8LUmAWQ1Zm6EKXY410lBPBYJeURLfUr8E7CHNnaDoFkjvIb3D4g4cBbZ3w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=SiRoxZi6; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1e83a2a4f2cso17102655ad.1 for ; Fri, 26 Apr 2024 11:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1714156448; x=1714761248; darn=vger.kernel.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=aqaAQgdA856jvIs7dAW5ZIMPYVryl65URaMxVc//Sq0=; b=SiRoxZi6yDcS7xehwrjfxyCY3jGc6AAAdpeCGyiTmJmoT7ywIEGPo7WZ+YiSXnO1Nf SOHhjebIOgI4KiAdoB6ZlxyTP6SQKI4aBarpXaiOy7G986qTar+Hi0TpPtdFzLTZZyJ+ sGj5NWmI1QoHbMyyVsh2/RrSDh5dU0IsQn7Yk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714156448; x=1714761248; 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=aqaAQgdA856jvIs7dAW5ZIMPYVryl65URaMxVc//Sq0=; b=ZFtx5Qo9qC/YBlXr+UFUIfQgFeB6u9cpQMDl7/NbFRWWds8U17wjZ7R9jrEL6DLrUO 8beObqC/EkHH9QEcxBJWzpmjV8Ld/r9aHAZCP2K6i5p604UrpbnJ1v1ZeTny1sATFmHP UI9/OvMjWaTu19TyPI1BlSkbveAVZjbw7DxHMxKE0b4cAshTm722WQhsAA51IsexNy3v s4T8gmtjf7LCaTSWZUXgMkAc5/wjNm1ccvNXJLbXla94KTtQ8NCNpdY1KvJ/o2xLXt1+ i8+86kiOqFwPJEDJ5bUtf6BiT5ENam1+66olwpO/6r0rA5hEkktDAcP4+0qCbYbalt7D w95A== X-Gm-Message-State: AOJu0YzjTEDcT7wCXt3Y0wd2aUgE2vdbnkf4skuvud20h2ogEvBZHnYC czCSvVV8TRsy3dT9gna77j0DKQEXguqva1uV02zHMsOrCeZaEIqzOg6MlpLmKx5A0vpqqwqbY/b iayYtqT30PpZgrpVRR3s/oOK1cI+7m+UamIUa5Kr6ePpBdlwwIXTobexrQWt74v10pNvg7Pf18f UDMeVEttBavDpuum9JDEEDr3jQPUOH8XehH6uopNGFoD4= X-Received: by 2002:a17:903:1205:b0:1e4:ccf6:209f with SMTP id l5-20020a170903120500b001e4ccf6209fmr4140136plh.28.1714156447894; Fri, 26 Apr 2024 11:34:07 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id j23-20020a170902759700b001deecb4f897sm15713152pll.100.2024.04.26.11.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 11:34:07 -0700 (PDT) From: Joe Damato To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, tariqt@nvidia.com, saeedm@nvidia.com Cc: mkarsten@uwaterloo.ca, gal@nvidia.com, nalramli@fastly.com, Joe Damato , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-rdma@vger.kernel.org (open list:MELLANOX MLX4 core VPI driver) Subject: [PATCH net-next v2 1/3] net/mlx4: Track RX allocation failures in a stat Date: Fri, 26 Apr 2024 18:33:53 +0000 Message-Id: <20240426183355.500364-2-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240426183355.500364-1-jdamato@fastly.com> References: <20240426183355.500364-1-jdamato@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit mlx4_en_alloc_frags currently returns -ENOMEM when mlx4_alloc_page fails but does not increment a stat field when this occurs. struct mlx4_en_rx_ring has a dropped field which is tabulated in mlx4_en_DUMP_ETH_STATS, but never incremented by the driver. This change modifies mlx4_en_alloc_frags to increment mlx4_en_rx_ring's dropped field for the -ENOMEM case. Signed-off-by: Joe Damato Tested-by: Martin Karsten --- drivers/net/ethernet/mellanox/mlx4/en_port.c | 5 ++++- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_port.c b/drivers/net/ethernet/mellanox/mlx4/en_port.c index 532997eba698..47541f7666f2 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_port.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_port.c @@ -151,7 +151,7 @@ void mlx4_en_fold_software_stats(struct net_device *dev) { struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; - unsigned long packets, bytes; + unsigned long packets, bytes, dropped; int i; if (!priv->port_up || mlx4_is_master(mdev->dev)) @@ -159,14 +159,17 @@ void mlx4_en_fold_software_stats(struct net_device *dev) packets = 0; bytes = 0; + dropped = 0; for (i = 0; i < priv->rx_ring_num; i++) { const struct mlx4_en_rx_ring *ring = priv->rx_ring[i]; packets += READ_ONCE(ring->packets); bytes += READ_ONCE(ring->bytes); + dropped += READ_ONCE(ring->dropped); } dev->stats.rx_packets = packets; dev->stats.rx_bytes = bytes; + dev->stats.rx_missed_errors = dropped; packets = 0; bytes = 0; diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 8328df8645d5..573ae10300c7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -82,8 +82,10 @@ static int mlx4_en_alloc_frags(struct mlx4_en_priv *priv, for (i = 0; i < priv->num_frags; i++, frags++) { if (!frags->page) { - if (mlx4_alloc_page(priv, frags, gfp)) + if (mlx4_alloc_page(priv, frags, gfp)) { + ring->dropped++; return -ENOMEM; + } ring->rx_alloc_pages++; } rx_desc->data[i].addr = cpu_to_be64(frags->dma + -- 2.25.1