From patchwork Fri Apr 26 18:33:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Damato X-Patchwork-Id: 13645255 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 1284911CA1 for ; Fri, 26 Apr 2024 18:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714156448; cv=none; b=Ro9y6NciXHJoxICXbWToMx3mVjhX1Y5OhRsglH0NRtGcLqjjvvhFFskFbbyx8Uoaf2tqbqvjBCxw3W8XWxCXprL8aI8LLLUg/B0bcBi1BrRzFPkP8NuysF81Mpuh7KRCfTTACDul23HbzWAs8nVP7pW5PflUUax0jFm2VYq2W5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714156448; c=relaxed/simple; bh=veT0sDsyrl73mCujRdcKEc2AtCFryNFecy2sFtWamoE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=k+9rUytcgvt9l0AGz+H1OhP7FE/ib3r1YJlWpuf3kIS7Y9tiNKs8SgBZ6lYQz22eY4oX9ral0G+oknKzLe9VVoCyge1UKAskqSM3JMx2zfDrYK6FfbBhOpS04kEC4InhdwobFbGLx38llN4hKRVfJ9zce4JtaA53ceGOWDy1e5c= 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=vVVU2/Ct; arc=none smtp.client-ip=209.85.214.170 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="vVVU2/Ct" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1e3f17c6491so20381955ad.2 for ; Fri, 26 Apr 2024 11:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1714156446; x=1714761246; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pZoSwzLi6xvTIvtNVms/jlVvWAfvYtCLM7lzp/fumoA=; b=vVVU2/Ct3D4r2pjJ2u3DuoB0ifAiZURDotWsnzPg8nxXXw9YkeMRN6cieUZGPlPzMX MqTsJnI6khIFz+q5hkcs0CUXKEUv88CDwSoel4Mvr+R9QJwsFrlZULYwll/ba9T1GTz+ xHVf6eo1eoKnSks0UCOmH4o2MKl+zoHnkiS18= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714156446; x=1714761246; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pZoSwzLi6xvTIvtNVms/jlVvWAfvYtCLM7lzp/fumoA=; b=gXhzY/dqRg7sqgoAVW8S+rrw4aBpn5/S3ujUbJhPh4Uj1IKi0Y92MNw29/lVkD+mkq 4PU5fVcIbbh3teGWOuWjjZgiAFKjkHffkcxBN5RLss1qBOLweJZgzso0tg+X7IbEkLt1 ZQ6hTnU0lcTwdhK7PtXYXQU1jPdCmXsuH2cUjMTD4svUBzT4H+sFwYWuA3BudtORO8ge 58H0Sv9vnJJ08Chm0WpKdRwfe9S9UGZcrj2yg6Wdx7/K4viTeh1GmuK1qkVAz/Fzz56T tdU1tWt2qi4uS51h4Hb1HjkpUm2yFwM4an5eBpVAYc5w0ulUdAtSdCLP6R+L0J5RSy1U oxbw== X-Forwarded-Encrypted: i=1; AJvYcCVpnOUbXWKnIxVbghRDsXC95zKMuiAi5Aj5SNEqp/3s0a5huxbssDP+NaAQsKLgx7qfzS5NhhpEnsd4MV9+4VU758UyScH6 X-Gm-Message-State: AOJu0YzVatEZwZqzDBezwkaTPOXC+nqOVVIH0D9RlupxiA3JZFTE8tlQ YF+YPzj8KniFjhcBacG3uGFRNHQlcG7Gk3yPIigNmN65d3bZyxHHg+V9VvJiBUM= X-Google-Smtp-Source: AGHT+IHnG5xfPC7t9g3uaoL8prAXxXW+Go6YADGhLzvoUqn+vtXCfvI59SkJt+SVoMBVTy4FuT5Pxw== X-Received: by 2002:a17:902:c40f:b0:1e4:4537:40ab with SMTP id k15-20020a170902c40f00b001e4453740abmr4026315plk.12.1714156446226; Fri, 26 Apr 2024 11:34:06 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 11:34:05 -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 , linux-rdma@vger.kernel.org (open list:MELLANOX MLX4 core VPI driver), Paolo Abeni Subject: [PATCH net-next v2 0/3] mlx4: Add support for netdev-genl API Date: Fri, 26 Apr 2024 18:33:52 +0000 Message-Id: <20240426183355.500364-1-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Greetings: Welcome to v2. This series adds support to mlx4 for the netdev-genl API which makes it much easier for users and user programs to map NAPI IDs back to ifindexes, queues, and IRQs. This is extremely useful for a number of use cases, including epoll-based busy poll. In addition, this series includes a patch to generate per-queue statistics using the netlink API, as well. To facilitate the stats, patch 1/3 makes use of an existing field, "dropped" which was already being exported in the ethtool stats by the driver, but was never incremented. As of patch 1/3, it is now being incremented by the driver in an appropriate place and used in patch 3/3 as alloc_fail. Please note: I do not have access to mlx4 hardware, but I've been working closely with Martin Karsten from University of Waterloo (CC'd) who has very graciously tested my patches on their mlx4 hardware (hence his Tested-by attribution in each commit). His latest research work is particularly interesting [1] and this series helps to support that (and future) work. Martin has re-tested this v2 using Jakub's tool [2] and the stats.pkt_byte_sum and stats.qstat_by_ifindex tests passed. [1]: https://dl.acm.org/doi/pdf/10.1145/3626780 [2]: https://lore.kernel.org/lkml/20240423175718.4ad4dc5a@kernel.org/ Thanks, Joe v1 -> v2: - Patch 1/3 now initializes dropped to 0. - Patch 2/3 fix use of uninitialized qtype warning. - Patch 3/3 includes several changes: - mlx4_get_queue_stats_rx and mlx4_get_queue_stats_tx check if i is valid before proceeding. - All initialization to 0xff for stats fields has been omit. The network stack does this before calling into the driver functions, so I've adjusted the driver functions to only set values if there is data to set, leaving the network stack's 0xff in place if not. - mlx4_get_base_stats set all stat fields to 0 individually if there are RX and TX queues. Joe Damato (3): net/mlx4: Track RX allocation failures in a stat net/mlx4: link NAPI instances to queues and IRQs net/mlx4: support per-queue statistics via netlink drivers/net/ethernet/mellanox/mlx4/en_cq.c | 14 ++++ .../net/ethernet/mellanox/mlx4/en_netdev.c | 79 +++++++++++++++++++ drivers/net/ethernet/mellanox/mlx4/en_port.c | 5 +- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 4 +- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 + 5 files changed, 101 insertions(+), 2 deletions(-)