From patchwork Mon Jul 25 20:56:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Keller X-Patchwork-Id: 12928415 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 38A24CCA48D for ; Mon, 25 Jul 2022 20:57:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236506AbiGYU5G (ORCPT ); Mon, 25 Jul 2022 16:57:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237265AbiGYU5A (ORCPT ); Mon, 25 Jul 2022 16:57:00 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DB5C23165; Mon, 25 Jul 2022 13:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658782619; x=1690318619; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=7ccEV+/xeo51k2kZfZEV/UHYAHUAvNzlKxTD/caoJQs=; b=PFVm3dmHQyY45bgMFy6fqnys7ZdvaacKkwxW0anRIljSNUvaMeHhPvrp fQULED96HvXpvmEYJvbbjDkCaEbyQPuuziWt6wiIY+9Mq7V3eVE2DFPFP C0ukwgzoLQE9btfcYLQ8dsZ01sA37mimyZQhTLDmSTnPltNL08IOzEuvn zlWatLoRWzdg+ph8VhOYhyI3c41hUoUZZ2A033b4YoW47VFhLx4XOBfr7 Vkk23exyTzUTJYgv1xWrCMiO97yrxL2oc9YwF/euKzNXHx6m9IJWitFTu cwqyEFyAkw8446HEB3g9KoSAe/bWuR6QbNkxHjewd61yt6CQw54D5UbR9 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10419"; a="313548921" X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="313548921" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2022 13:56:58 -0700 X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="550135505" Received: from jekeller-desk.amr.corp.intel.com ([10.166.241.7]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2022 13:56:58 -0700 From: Jacob Keller To: netdev@vger.kernel.org Cc: Jacob Keller , Jonathan Corbet , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Tony Nguyen , David Ahern , Stephen Hemminger , linux-doc@vger.kernel.org Subject: [iproute2-next v3 0/3] devlink: support dry run attribute for flash update Date: Mon, 25 Jul 2022 13:56:47 -0700 Message-Id: <20220725205650.4018731-1-jacob.e.keller@intel.com> X-Mailer: git-send-email 2.37.1.208.ge72d93e88cb2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com Allow users to request a dry run of a flash update by adding the DEVLINK_ATTR_DRY_RUN. Because many devlink commands do not validate and reject unknown attributes, this could have unexpected side effects on older kernels which lack the attribute. To handle this, check the socket and determine the maximum attribute the kernel supports. Only allow passing the DEVLINK_ATTR_DRY_RUN for kernels which have the attribute. This allows a user to validate that a flash update will be accepted by the driver and device without being forced to commit to updating. Changes since v1 * Add Cc for maintainers * Make dl_kernel_supports_dry_run more generic Changes since v2 * Remove unnecessary () with return * Reduce indentation of dl_get_max_attr Cc: Jacob Keller Cc: Jonathan Corbet Cc: Jiri Pirko Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Tony Nguyen Cc: David Ahern Cc: Stephen Hemminger Cc: linux-doc@vger.kernel.org Cc: netdev@vger.kernel.org Jacob Keller (3): update UAPI header mnlg: add function to get CTRL_ATTR_MAXATTR value devlink: add dry run attribute support to devlink flash devlink/devlink.c | 46 +++++++++++++++++++++++++++-- devlink/mnlg.c | 56 ++++++++++++++++++++++++++++++++++++ devlink/mnlg.h | 1 + include/uapi/linux/devlink.h | 8 ++++++ 4 files changed, 109 insertions(+), 2 deletions(-) base-commit: 4cb0bec3744ac4f8d21de0e769f170e4059c6b9e