From patchwork Mon Nov 28 20:42:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 13057941 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A287C4167D for ; Mon, 28 Nov 2022 20:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234184AbiK1UnR (ORCPT ); Mon, 28 Nov 2022 15:43:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234281AbiK1UnI (ORCPT ); Mon, 28 Nov 2022 15:43:08 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB161A068 for ; Mon, 28 Nov 2022 12:43:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669668186; x=1701204186; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=67+M9s2vsNxh22kJv/ZAX0nd8Rr3W/o5Y22iVqthvB8=; b=T9dA8BNNfXn4mMpMQsUk8WQ+oOMX2pWthrdorMnNyD3JjpyB1ddjS4C5 HbSO+mcIl+zTUjk313Rk6laCEQZ8Jxi6s4Jbs288M29U7Z76GCd0Fuldf kXcx/9Nq+5xyZGmc/qgC9eDgqIt6A9Jh9PZwj+QYnabCNLGE6CUyid9xi MIRUkDYSHonvNFGoM7ITEjEtO1OGuX+TyB6qYyEzw45uoxmiWf0RiYAC7 BFoBLLfZqtzPSgEDtUYdzCgZdEhwKKX7QI1lj/Ivo4F0VUBtD9YZR0DDe 9Mwl3JTuUqDfwnDbwfcgOf3l4fChSHgCt6dwFbtMNCdenwl48z9BhewVV A==; X-IronPort-AV: E=McAfee;i="6500,9779,10545"; a="313649894" X-IronPort-AV: E=Sophos;i="5.96,201,1665471600"; d="scan'208";a="313649894" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2022 12:43:04 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10545"; a="594008790" X-IronPort-AV: E=Sophos;i="5.96,201,1665471600"; d="scan'208";a="594008790" Received: from jekeller-desk.amr.corp.intel.com (HELO jekeller-desk.jekeller.internal) ([10.166.241.7]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2022 12:43:04 -0800 From: Jacob Keller To: netdev@vger.kernel.org Cc: Jiri Pirko , Jacob Keller Subject: [PATCH iproute2-next] devlink: support direct region read requests Date: Mon, 28 Nov 2022 12:42:56 -0800 Message-Id: <20221128204256.1200695-1-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.38.1.420.g319605f8f00e MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com The kernel has gained support for reading from regions without needing to create a snapshot. To use this support, the DEVLINK_ATTR_REGION_DIRECT attribute must be added to the command. For the "read" command, if the user did not specify a snapshot, add the new attribute to request a direct read. The "dump" command will still require a snapshot. While technically a dump could be performed without a snapshot it is not guaranteed to be atomic unless the region size is no larger than 256 bytes. Signed-off-by: Jacob Keller --- This depends on https://lore.kernel.org/netdev/20221128203647.1198669-1-jacob.e.keller@intel.com/T/#t devlink/devlink.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) base-commit: 2ed09c3bf8aca185b2f3eb369ae435503f9b9826 diff --git a/devlink/devlink.c b/devlink/devlink.c index 8aefa101b2f8..5057b09505ef 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -8535,11 +8535,15 @@ static int cmd_region_read(struct dl *dl) int err; err = dl_argv_parse(dl, DL_OPT_HANDLE_REGION | DL_OPT_REGION_ADDRESS | - DL_OPT_REGION_LENGTH | DL_OPT_REGION_SNAPSHOT_ID, - 0); + DL_OPT_REGION_LENGTH, + DL_OPT_REGION_SNAPSHOT_ID); if (err) return err; + /* If user didn't provide a snapshot id, perform a direct read */ + if (!(dl->opts.present & DL_OPT_REGION_SNAPSHOT_ID)) + mnl_attr_put(nlh, DEVLINK_ATTR_REGION_DIRECT, 0, NULL); + nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_REGION_READ, NLM_F_REQUEST | NLM_F_ACK | NLM_F_DUMP);