From patchwork Thu Apr 29 00:41:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 92350 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 63D43A0A0E; Thu, 29 Apr 2021 02:38:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 93F6C412CA; Thu, 29 Apr 2021 02:38:06 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id AB5DD4124F for ; Thu, 29 Apr 2021 02:38:03 +0200 (CEST) IronPort-SDR: Xomy54ZBBAYLMO4mq1g6Bk71ilCx6yLtuDnmgVpK40vW6i3IjRlIXfuJ5UXvfNmHvKe0myvTan d1XtK6iku8sQ== X-IronPort-AV: E=McAfee;i="6200,9189,9968"; a="196444573" X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="196444573" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2021 17:38:03 -0700 IronPort-SDR: 6Z1br3k/RJWOjXs6sAfXZ3Mp0kfwQI0abdshQaM/uHhZ8k1pQk8Rh3LuDfQbMbH+PlyFCqzoGg DGZNy7/EvwHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="423790783" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga008.fm.intel.com with ESMTP; 28 Apr 2021 17:38:02 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, Qi Zhang , Brett Creeley Date: Thu, 29 Apr 2021 08:41:39 +0800 Message-Id: <20210429004143.2921260-3-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210429004143.2921260-1-qi.z.zhang@intel.com> References: <20210429004143.2921260-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/6] net/ice/base: add function for post DDP download VLAN mode configuration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Currently it's not clear that only the first PF downloads the package and configures the VLAN mode. When this is happening all other PFs are blocked on the global configuration lock. Once the package is successfully downloaded and the global configuration lock has been released then all PFs resume initialization. This includes some post package download VLAN mode configuration. To make this more obvious add the new function ice_post_pkg_dwnld_vlan_mode_cfg() so any/all post download VLAN mode configuration code can be put in here. This also makes it more clear that all PFs will call this new function. Signed-off-by: Brett Creeley Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_flex_pipe.c | 5 +---- drivers/net/ice/base/ice_vlan_mode.c | 25 ++++++++++++++++++++++++- drivers/net/ice/base/ice_vlan_mode.h | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index b489c8ddb2..b3cea731f3 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -1242,10 +1242,7 @@ ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg) status = ice_dwnld_cfg_bufs(hw, ice_buf_tbl->buf_array, LE32_TO_CPU(ice_buf_tbl->buf_count)); - ice_cache_vlan_mode(hw); - - if (ice_is_dvm_ena(hw)) - ice_change_proto_id_to_dvm(); + ice_post_pkg_dwnld_vlan_mode_cfg(hw); return status; } diff --git a/drivers/net/ice/base/ice_vlan_mode.c b/drivers/net/ice/base/ice_vlan_mode.c index ce150009c2..ebb64c68ec 100644 --- a/drivers/net/ice/base/ice_vlan_mode.c +++ b/drivers/net/ice/base/ice_vlan_mode.c @@ -124,7 +124,7 @@ bool ice_is_dvm_ena(struct ice_hw *hw) * configuration lock has been released because all ports on a device need to * cache the VLAN mode. */ -void ice_cache_vlan_mode(struct ice_hw *hw) +static void ice_cache_vlan_mode(struct ice_hw *hw) { hw->dvm_ena = ice_aq_is_dvm_ena(hw) ? true : false; } @@ -374,3 +374,26 @@ enum ice_status ice_set_vlan_mode(struct ice_hw *hw) return ice_set_svm(hw); } + +/** + * ice_post_pkg_dwnld_vlan_mode_cfg - configure VLAN mode after DDP download + * @hw: pointer to the HW structure + * + * This function is meant to configure any VLAN mode specific functionality + * after the global configuration lock has been released and the DDP has been + * downloaded. + * + * Since only one PF downloads the DDP and configures the VLAN mode there needs + * to be a way to configure the other PFs after the DDP has been downloaded and + * the global configuration lock has been released. All such code should go in + * this function. + */ +void ice_post_pkg_dwnld_vlan_mode_cfg(struct ice_hw *hw) +{ + ice_cache_vlan_mode(hw); + + if (ice_is_dvm_ena(hw)) + ice_change_proto_id_to_dvm(); + else + ice_print_dvm_not_supported(hw); +} diff --git a/drivers/net/ice/base/ice_vlan_mode.h b/drivers/net/ice/base/ice_vlan_mode.h index e9f13e7814..0e41b84000 100644 --- a/drivers/net/ice/base/ice_vlan_mode.h +++ b/drivers/net/ice/base/ice_vlan_mode.h @@ -10,7 +10,7 @@ struct ice_hw; bool ice_is_dvm_ena(struct ice_hw *hw); -void ice_cache_vlan_mode(struct ice_hw *hw); enum ice_status ice_set_vlan_mode(struct ice_hw *hw); +void ice_post_pkg_dwnld_vlan_mode_cfg(struct ice_hw *hw); #endif /* _ICE_VLAN_MODE_H */