From patchwork Thu Aug 1 09:31:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Swiatkowski X-Patchwork-Id: 13750095 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A374184559 for ; Thu, 1 Aug 2024 09:31:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504714; cv=none; b=qRBBmmbv86cMaBvU2NpL6LOtRYyRq9QvOwNbIma5sFDvpkl37WXVpgqlqd/kr8Z+1/0/OypLmrWFtpbYB0MMor/g5kDGCze3LMnDpwQdDNtfyHNZwFAiuv928LZ1TEQC6ZVXLnPgLvUeUDTgFRdcPC/tx4MUvwScc81h44UOWb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722504714; c=relaxed/simple; bh=p1f0FRz522FVjvw0mP54THAe7lOJ1S3rku4i3m3g5Ng=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YRDlLUjajhVN3qEAmxBr3zL16zQzLp5RHNae0RlA33FWiwRgeyDlfuLHM8Z+/XX51Hg8fwRrzLYOJrN7AU6XizPDVMUWyhlLxU5OqGDD/fylpOuqc9y0gcj0egzFKWizK7HBb+tnUdhkRhdb94OAYun/qztTucyWKxJViVWESIw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ftcwwZ2Q; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ftcwwZ2Q" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722504713; x=1754040713; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p1f0FRz522FVjvw0mP54THAe7lOJ1S3rku4i3m3g5Ng=; b=ftcwwZ2QWrpf6ixZBTtoWI/+3Q2at0qxDfwyq4ELT349QyKzicU7ak3g oM6AkEPXEDkrZPJ42hNHzp/XwecCIL/aAR4oQkxuoZ0tKLaU9acKGMKzZ 3knIVE2YvSfL6tQhww72acz/W7YbEeuvEwpKF2twA27pLw7JNHRG6HaXD m9y4ad9p8wRSdfCz5s8OjoYWgRZQ0DnqPGpAXRZOCCyCYlGayxjnXa5je LfeDvCWmotK7IpUOxEoZXMLj3Vq8zC8SSiWif89hq0uKGHaJJYouWj8Yv l5e9sdmE003A3wKTlJafYSqUf9YAowUZK0TlK+vU38MvaLtd5RwZLgouW w==; X-CSE-ConnectionGUID: 4V5gsV0/RmG+t4E6c2pq3A== X-CSE-MsgGUID: lITzXNNGRzaodwNXoAJFTQ== X-IronPort-AV: E=McAfee;i="6700,10204,11150"; a="23363462" X-IronPort-AV: E=Sophos;i="6.09,254,1716274800"; d="scan'208";a="23363462" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Aug 2024 02:31:37 -0700 X-CSE-ConnectionGUID: sqRrHXQ/QYaANnaPiT+lBQ== X-CSE-MsgGUID: OdG28j5DQE+OjShOQPTbuQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,254,1716274800"; d="scan'208";a="59628247" Received: from gk3153-dr2-r750-36946.igk.intel.com ([10.102.20.192]) by fmviesa004.fm.intel.com with ESMTP; 01 Aug 2024 02:31:34 -0700 From: Michal Swiatkowski To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, pawel.chmielewski@intel.com, sridhar.samudrala@intel.com, jacob.e.keller@intel.com, pio.raczynski@gmail.com, konrad.knitter@intel.com, marcin.szycik@intel.com, wojciech.drewek@intel.com, nex.sw.ncis.nat.hpm.dev@intel.com, przemyslaw.kitszel@intel.com, jiri@resnulli.us Subject: [iwl-next v2 6/7] ice: enable_rdma devlink param Date: Thu, 1 Aug 2024 11:31:14 +0200 Message-ID: <20240801093115.8553-7-michal.swiatkowski@linux.intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240801093115.8553-1-michal.swiatkowski@linux.intel.com> References: <20240801093115.8553-1-michal.swiatkowski@linux.intel.com> 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 Implement enable_rdma devlink parameter to allow user to turn RDMA feature on and off. It is useful when there is no enough interrupts and user doesn't need RDMA feature. Reviewed-by: Jan Sokolowski Reviewed-by: Przemek Kitszel Signed-off-by: Michal Swiatkowski --- .../net/ethernet/intel/ice/devlink/devlink.c | 19 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_lib.c | 8 +++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c index bdc22ea13e0f..530d443a8e14 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink.c +++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c @@ -1544,6 +1544,19 @@ ice_devlink_msix_min_pf_validate(struct devlink *devlink, u32 id, return 0; } +static int ice_devlink_enable_rdma_validate(struct devlink *devlink, u32 id, + union devlink_param_value val, + struct netlink_ext_ack *extack) +{ + struct ice_pf *pf = devlink_priv(devlink); + bool new_state = val.vbool; + + if (new_state && !test_bit(ICE_FLAG_RDMA_ENA, pf->flags)) + return -EOPNOTSUPP; + + return 0; +} + enum ice_param_id { ICE_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX, ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS, @@ -1559,6 +1572,8 @@ static const struct devlink_param ice_dvl_rdma_params[] = { ice_devlink_enable_iw_get, ice_devlink_enable_iw_set, ice_devlink_enable_iw_validate), + DEVLINK_PARAM_GENERIC(ENABLE_RDMA, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT), + NULL, NULL, ice_devlink_enable_rdma_validate), }; static const struct devlink_param ice_dvl_msix_params[] = { @@ -1700,6 +1715,10 @@ int ice_devlink_register_params(struct ice_pf *pf) devl_param_driverinit_value_set(devlink, DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN, value); + value.vbool = test_bit(ICE_FLAG_RDMA_ENA, pf->flags); + devl_param_driverinit_value_set(devlink, + DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA, + value); return 0; } diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index e211cf5e8ba0..5d6e9198e704 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -831,7 +831,13 @@ bool ice_is_safe_mode(struct ice_pf *pf) */ bool ice_is_rdma_ena(struct ice_pf *pf) { - return test_bit(ICE_FLAG_RDMA_ENA, pf->flags); + union devlink_param_value value; + int err; + + err = devl_param_driverinit_value_get(priv_to_devlink(pf), + DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA, + &value); + return err ? test_bit(ICE_FLAG_RDMA_ENA, pf->flags) : value.vbool; } /**