From patchwork Thu Jan 16 23:16:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wei X-Patchwork-Id: 13942449 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 F29A21DDC0F for ; Thu, 16 Jan 2025 23:17:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737069437; cv=none; b=pfCtaHFZQCBkfKXzXHTucxqwFldGewBAEdavF2NEiiCUK1TKKN1HmrAWI253ItE+scTF40rfj3oZWxi8FPiwpgwGCTtvIIuEnHKE4vcMlq0sGpPVL7mv63r6es93ITBZ0JON720k4Hs8BHrRWKpfcL8hrRz0AgSeCxRUhDTGrmg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737069437; c=relaxed/simple; bh=pC+izCPPiOw4hj77bHjJXxuiiJXIs1YU+ft+8NS5olQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S+2rpz+EmkhV9qwKIxPR/02PgPfm6qX50plNabJWDaw+/LAjfLGNwgwKjLxoq8Nwdog1YyRffxcnWZUe/un+/5SG8t2v4BbGKoKi5ote77oTbYq4Q+MfUoiG7zLaAbIxC994jizIBkRxVa3C0GF5d/L0CzaC8n86kKZ8WTaYfbk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=MhWOmsvZ; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="MhWOmsvZ" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2eec9b3a1bbso2161128a91.3 for ; Thu, 16 Jan 2025 15:17:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1737069435; x=1737674235; 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=3FSAJNCphdORunxyfbKbeJpz17xsYuZAoUUdQ0kuFhk=; b=MhWOmsvZSKuJFs4nOFUyxc3wjG6PCpQOc7daLyTV1R5lAL1DNu4krWXdbrYIUS6Rf+ HqdCXNSNzpX74oeNYs06hijSF+FOAR01WUbUikx5gCBBtRXbItqm/htgMnQJljI83r9F NicwGwYdmNFe2JuvDys2FzDUjnNY/i/mZVGj5vfDLPDlLF07LvlC0eRs9aDQhS+8lKAQ sE5HAZv/l0m8KuGvSup0x/2F5Oiz056A7pNOiczmchgZkmDvrdWbz/qJNo9p9v3nsWsx UE8zw1yVGzHEpTyN7cIf8CYfjDeY5TeEMBTNO29Q6NWLI6RPPpHOSBH2StuRzpxFEzRg EMJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737069435; x=1737674235; 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=3FSAJNCphdORunxyfbKbeJpz17xsYuZAoUUdQ0kuFhk=; b=R3Gqpe7RuRnHOasHZzTX4kkiavLeo2Tc6GatTV9NYOlkuRfw90h95NAp6NI+C5ZmUO T7l5p4UtofeYs7YIkCjKM3ANtqFxh2DQ7B472Cqj/Z75eKqedf3Wdhzyck31zhFbgc0T 6QA/HQzjTeCqK63DRn+yw4DLL3Lb2qQYm/TsT+SgKfFfcCMUeVxN2zPx1jA+XNNjTCpn bZWSApEyovyqw93X6Aar4yUt58k9xUQD2+oasB5mPaydmoGmJRt2UnSJyyFWiym+jx2F E98Abj/igSOT+lbk+uAb+3d3PIx6+E11araaHE/h8noDpji9TOGj1sQu2ZB1cMgOX/Pv VS9g== X-Forwarded-Encrypted: i=1; AJvYcCUHsTLAca2X3uTb/pV8gRjAj4XAVEDa/0ykN1YXGT3cAPbdOnpfotRZ+fQLTbicN4sV9LkNTYY=@vger.kernel.org X-Gm-Message-State: AOJu0Yxd/kDzGNPhalE7wsgtetAKu3JYxN+DKlbJ7KK5VrpO89MflAb/ nmVp1jh29goBMCQbWj6AS3pOFEI3KSg4OJ9/ydNXNSes1ZufZ/67v3CZGkbwsa4= X-Gm-Gg: ASbGncsaTmy7BdcCLUcKecGk5QSI+CHH0Jy7tsk5IHCJe8BMUpvm81IPuH8KVwbdqQj 6leIZoz1Z++XKgr2YN+RB5vgxsaTEvRUs4qqK4sHhp7GMAycezVqeJJ/ju3Mu5SGFagzDoWjCbp LRALomNDExiaj6HQAckjK9GlI9wtF5lbTWWHh/DglC348ReTq/Sj8dujHVr7PF03GcvzTD9r4lA ous+EZEX+3P2BK8mpGsKQ9Dn065fUP8JMrNEhGIrQ== X-Google-Smtp-Source: AGHT+IHedyepUZITwcmVCPI/PDCZLlhzbajAfD5uFw0pI37FVETUFJhRTBupzGFiFEFPGnhoIgXD6w== X-Received: by 2002:a17:90a:e183:b0:2f5:63a:449c with SMTP id 98e67ed59e1d1-2f782d4ef30mr576843a91.28.1737069435153; Thu, 16 Jan 2025 15:17:15 -0800 (PST) Received: from localhost ([2a03:2880:ff:73::]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f72c2bb480sm3855603a91.33.2025.01.16.15.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 15:17:14 -0800 (PST) From: David Wei To: io-uring@vger.kernel.org, netdev@vger.kernel.org Cc: Jens Axboe , Pavel Begunkov , Jakub Kicinski , Paolo Abeni , "David S. Miller" , Eric Dumazet , Jesper Dangaard Brouer , David Ahern , Mina Almasry , Stanislav Fomichev , Joe Damato , Pedro Tammela Subject: [PATCH net-next v11 05/21] netdev: add io_uring memory provider info Date: Thu, 16 Jan 2025 15:16:47 -0800 Message-ID: <20250116231704.2402455-6-dw@davidwei.uk> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250116231704.2402455-1-dw@davidwei.uk> References: <20250116231704.2402455-1-dw@davidwei.uk> 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 Add a nested attribute for io_uring memory provider info. For now it is empty and its presence indicates that a particular page pool or queue has an io_uring memory provider attached. $ ./cli.py --spec netlink/specs/netdev.yaml --dump page-pool-get [{'id': 80, 'ifindex': 2, 'inflight': 64, 'inflight-mem': 262144, 'napi-id': 525}, {'id': 79, 'ifindex': 2, 'inflight': 320, 'inflight-mem': 1310720, 'io_uring': {}, 'napi-id': 525}, ... $ ./cli.py --spec netlink/specs/netdev.yaml --dump queue-get [{'id': 0, 'ifindex': 1, 'type': 'rx'}, {'id': 0, 'ifindex': 1, 'type': 'tx'}, {'id': 0, 'ifindex': 2, 'napi-id': 513, 'type': 'rx'}, {'id': 1, 'ifindex': 2, 'napi-id': 514, 'type': 'rx'}, ... {'id': 12, 'ifindex': 2, 'io_uring': {}, 'napi-id': 525, 'type': 'rx'}, ... Reviewed-by: Jakub Kicinski Signed-off-by: Pavel Begunkov Signed-off-by: David Wei --- Documentation/netlink/specs/netdev.yaml | 15 +++++++++++++++ include/uapi/linux/netdev.h | 8 ++++++++ tools/include/uapi/linux/netdev.h | 8 ++++++++ 3 files changed, 31 insertions(+) diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml index cbb544bd6c84..288923e965ae 100644 --- a/Documentation/netlink/specs/netdev.yaml +++ b/Documentation/netlink/specs/netdev.yaml @@ -114,6 +114,9 @@ attribute-sets: doc: Bitmask of enabled AF_XDP features. type: u64 enum: xsk-flags + - + name: io-uring-provider-info + attributes: [] - name: page-pool attributes: @@ -171,6 +174,11 @@ attribute-sets: name: dmabuf doc: ID of the dmabuf this page-pool is attached to. type: u32 + - + name: io-uring + doc: io-uring memory provider information. + type: nest + nested-attributes: io-uring-provider-info - name: page-pool-info subset-of: page-pool @@ -296,6 +304,11 @@ attribute-sets: name: dmabuf doc: ID of the dmabuf attached to this queue, if any. type: u32 + - + name: io-uring + doc: io_uring memory provider information. + type: nest + nested-attributes: io-uring-provider-info - name: qstats @@ -572,6 +585,7 @@ operations: - inflight-mem - detach-time - dmabuf + - io-uring dump: reply: *pp-reply config-cond: page-pool @@ -637,6 +651,7 @@ operations: - napi-id - ifindex - dmabuf + - io-uring dump: request: attributes: diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h index e4be227d3ad6..684090732068 100644 --- a/include/uapi/linux/netdev.h +++ b/include/uapi/linux/netdev.h @@ -86,6 +86,12 @@ enum { NETDEV_A_DEV_MAX = (__NETDEV_A_DEV_MAX - 1) }; +enum { + + __NETDEV_A_IO_URING_PROVIDER_INFO_MAX, + NETDEV_A_IO_URING_PROVIDER_INFO_MAX = (__NETDEV_A_IO_URING_PROVIDER_INFO_MAX - 1) +}; + enum { NETDEV_A_PAGE_POOL_ID = 1, NETDEV_A_PAGE_POOL_IFINDEX, @@ -94,6 +100,7 @@ enum { NETDEV_A_PAGE_POOL_INFLIGHT_MEM, NETDEV_A_PAGE_POOL_DETACH_TIME, NETDEV_A_PAGE_POOL_DMABUF, + NETDEV_A_PAGE_POOL_IO_URING, __NETDEV_A_PAGE_POOL_MAX, NETDEV_A_PAGE_POOL_MAX = (__NETDEV_A_PAGE_POOL_MAX - 1) @@ -136,6 +143,7 @@ enum { NETDEV_A_QUEUE_TYPE, NETDEV_A_QUEUE_NAPI_ID, NETDEV_A_QUEUE_DMABUF, + NETDEV_A_QUEUE_IO_URING, __NETDEV_A_QUEUE_MAX, NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1) diff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/netdev.h index e4be227d3ad6..684090732068 100644 --- a/tools/include/uapi/linux/netdev.h +++ b/tools/include/uapi/linux/netdev.h @@ -86,6 +86,12 @@ enum { NETDEV_A_DEV_MAX = (__NETDEV_A_DEV_MAX - 1) }; +enum { + + __NETDEV_A_IO_URING_PROVIDER_INFO_MAX, + NETDEV_A_IO_URING_PROVIDER_INFO_MAX = (__NETDEV_A_IO_URING_PROVIDER_INFO_MAX - 1) +}; + enum { NETDEV_A_PAGE_POOL_ID = 1, NETDEV_A_PAGE_POOL_IFINDEX, @@ -94,6 +100,7 @@ enum { NETDEV_A_PAGE_POOL_INFLIGHT_MEM, NETDEV_A_PAGE_POOL_DETACH_TIME, NETDEV_A_PAGE_POOL_DMABUF, + NETDEV_A_PAGE_POOL_IO_URING, __NETDEV_A_PAGE_POOL_MAX, NETDEV_A_PAGE_POOL_MAX = (__NETDEV_A_PAGE_POOL_MAX - 1) @@ -136,6 +143,7 @@ enum { NETDEV_A_QUEUE_TYPE, NETDEV_A_QUEUE_NAPI_ID, NETDEV_A_QUEUE_DMABUF, + NETDEV_A_QUEUE_IO_URING, __NETDEV_A_QUEUE_MAX, NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1)