Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2447023rdb; Wed, 21 Feb 2024 07:59:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW6Aw4ykqmtZ0L99CKmSSbhIt9G74M029jGzxLVt7Ewtq8g7u8adt4m4TQ3ZUooVvsq4wS0Y7ij3E/Nhhq+fIGf3cFByGW1I7F1rAxH+Q== X-Google-Smtp-Source: AGHT+IHVYmCtUAHuuM2Nc3/1M0PY7DAzpiI8G0OQ1ZpXly4hPlEH3Qkf+mE2BicqrMlIV1Xc6GjL X-Received: by 2002:a05:6870:c145:b0:21e:6b78:ff43 with SMTP id g5-20020a056870c14500b0021e6b78ff43mr17679550oad.39.1708531187709; Wed, 21 Feb 2024 07:59:47 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k126-20020a633d84000000b005ced65a49e8si8543174pga.734.2024.02.21.07.59.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 07:59:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75054-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=neutral (body hash did not verify) header.i=@fastly.com header.s=google header.b="lSxBK/6e"; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-75054-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75054-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=REJECT sp=REJECT dis=QUARANTINE) 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 24051285CEA for ; Wed, 21 Feb 2024 15:59:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B389E823AC; Wed, 21 Feb 2024 15:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="lSxBK/6e" Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.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 3A9E78174C for ; Wed, 21 Feb 2024 15:58:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708531114; cv=none; b=F7GNFW4mP5wOM/ngN8rVb5xDU2s/5znraKNRRkh5AhLPdX6bLHqakv0W1Q5qgeYZrMF7rH8X7ybF4UG1K67rTGZpR0yS1QJXBFI8LY3A/yE44mDTXkZn2vRROLknMCzNnX9Yx+KFbghC0YKRhxo32zE+UnlxO7gMx3xZ4somIoY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708531114; c=relaxed/simple; bh=pWhB/9g8CnlBlxQ4Kle145idANlWr2RhmhOKdwGONLo=; h=From:To:Cc:Subject:Date:Message-Id; b=JUdKbmM7T52k+CYFNSt6iDwzpOBkD/KHbFHmLQnX1L1FBdLF2nSMOxZxu25ZCG//zmd3hYioAtAPmgZ/zoGHsewUdDygKlFu5JDS34KIgXmqEOtZLsS72F2WKzCB2SRdV2lTlCD1pvuT7W+uD40eHH0HvSJE4DISekJQPOmfWdE= 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=lSxBK/6e; arc=none smtp.client-ip=209.85.210.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-pf1-f172.google.com with SMTP id d2e1a72fcca58-6e46dcd8feaso1983482b3a.2 for ; Wed, 21 Feb 2024 07:58:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1708531112; x=1709135912; darn=vger.kernel.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ak7VbKSDllUoXEGnuzHtfjgftB0cmnm1/VIOdiVmP0s=; b=lSxBK/6ezXaqTjYAA57Z6SSYkeQ87fijqJG7wwsrr1hfGQgHwk9j6MfqRaGM0tFDL/ koVqnO3pXr84FOx8JHuA5xP6pQRPK+YXj44ithDPeQUDiRirNvnW2A+kcX7FY3XQP6Ud h8dHtXsdfXJd5BFaQ7z1XA8Y8Faiw8zikLClI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708531112; x=1709135912; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ak7VbKSDllUoXEGnuzHtfjgftB0cmnm1/VIOdiVmP0s=; b=YtHgClJ1vtN02MbGSbMBJwUXHdD/Ns5fMvSy9Bxjdf/kGbyAhv8triAIb7ivAoTvxy +SA27FMef/VNAKoQGmLH4lRK9qjoDlRo44CsIkIWSP3PZVq6JbIPnvlWORn+dU/x3m0+ Dwbq9zMGs0GP4DPrVHAxGGMru3YPJWubxeH7sGH75NW8xBvI6nUR8yaRyBJNCfmYBzoO sW2i2jXGMfrdXoP4X/Kvvz+23A8zwX6169XxNhdIsjzV3a8XnVme4EthOu6fjhH51n5t Adc9F50dsQ4eaPdu/k/rk9abfLXYJ+bzQsO1/A8Gwh1YA8EWrQjxjUui/OKRfP1oNt4x OEhw== X-Forwarded-Encrypted: i=1; AJvYcCXhEzT9RWANAbVBUbyGwutaHjDgMoDez9m82uneyiv2Uxhz0AESMCKgZCsgyW9GiuZSYMFUZZe4rjJOp7FMYqKIUQvAm9Saii0D5Fqp X-Gm-Message-State: AOJu0Yy9x7HF5nth/j6VKNMJ1e1nXYp8h5OK8RynblHX7mAR03X9aYjl zaqyEfdwTMsjZ2T9Byp5uwM9bUuPL+xgmpcWMp5h/jgORcbojJ1gdv9iVHcsfI0= X-Received: by 2002:aa7:8704:0:b0:6e2:e48b:43f2 with SMTP id b4-20020aa78704000000b006e2e48b43f2mr10940437pfo.20.1708531112482; Wed, 21 Feb 2024 07:58:32 -0800 (PST) Received: from localhost.localdomain (c-24-6-151-244.hsd1.ca.comcast.net. [24.6.151.244]) by smtp.gmail.com with ESMTPSA id du17-20020a056a002b5100b006e46672df97sm5751327pfb.75.2024.02.21.07.58.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2024 07:58:31 -0800 (PST) From: Joe Damato To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Joe Damato , Alexei Starovoitov , Amritha Nambiar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jesper Dangaard Brouer , Larysa Zaremba , Maciej Fijalkowski , Paolo Abeni , Sridhar Samudrala , Stanislav Fomichev , Tariq Toukan Subject: [PATCH net-next 0/2] Expose netdev name in netdev netlink APIs Date: Wed, 21 Feb 2024 07:57:28 -0800 Message-Id: <1708531057-67392-1-git-send-email-jdamato@fastly.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Greetings: The netdev netlink APIs currently provide the ifindex of a device associated with the NIC queue or NAPI when the netlink API is used. In order for user applications to map this back to a human readable device name, user applications must issue a subsequent ioctl (SIOCGIFNAME) in order to map an ifindex back to a device name. This patch set adds ifname to the API so that when queue or NAPI information is retrieved, the human readable string is included. The netdev netlink YAML spec has been updated to include this field, as well. This saves the subsequent call to ioctl and makes the netlink information more user friendly. Applications might use this information in conjunction with SO_INCOMING_NAPI_ID to map NAPI IDs to specific NICs with application specific configuration (e.g. NUMA zone and CPU layout information). An example using the netlink cli tool before this change: $ ./cli.py --spec netdev.yaml --dump queue-get --json='{"ifindex": 7}' [{'id': 0, 'ifindex': 7, 'type': 'rx'}, {'id': 1, 'ifindex': 7, 'type': 'rx'}, {'id': 2, 'ifindex': 7, 'type': 'rx'}, .. $ ./cli.py --spec netdev.yaml --dump napi-get --json='{"ifindex": 7}' [{'id': 448, 'ifindex': 7}, {'id': 447, 'ifindex': 7}, {'id': 446, 'ifindex': 7}, .. An example after this change: $ ./cli.py --spec netdev.yaml --dump queue-get --json='{"ifindex": 7}' [{'id': 0, 'ifindex': 7, 'ifname': 'eth1', 'type': 'rx'}, {'id': 1, 'ifindex': 7, 'ifname': 'eth1', 'type': 'rx'}, {'id': 2, 'ifindex': 7, 'ifname': 'eth1', 'type': 'rx'}, ... $ ./cli.py --spec netdev.yaml --dump napi-get --json='{"ifindex": 7}' [{'id': 448, 'ifindex': 7, 'ifname': 'eth1'}, {'id': 447, 'ifindex': 7, 'ifname': 'eth1'}, {'id': 446, 'ifindex': 7, 'ifname': 'eth1'}, ... Thanks, Joe Joe Damato (2): netdev-genl: Add ifname for queue and NAPI APIs netdev-genl: spec: Add ifname to netdev nl YAML spec Documentation/netlink/specs/netdev.yaml | 10 ++++++++++ include/uapi/linux/netdev.h | 2 ++ net/core/netdev-genl.c | 22 +++++++++++++++++----- tools/include/uapi/linux/netdev.h | 2 ++ 4 files changed, 31 insertions(+), 5 deletions(-) -- 2.7.4