From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B3D1AA0563; Mon, 23 Mar 2020 08:19:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 65E6E1C197; Mon, 23 Mar 2020 08:15:59 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 3AC111C129 for ; Mon, 23 Mar 2020 08:15:33 +0100 (CET) IronPort-SDR: gkiYEmLlGoBkJ5IlJuZ6RK1ub+FEJ8gJeZLi6c4nGQA1Q466zWVssg5tqoiP+mkJAefuskuZt1 CgW0kCqG3WoQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 00:15:32 -0700 IronPort-SDR: USG8t+Nv505Z6ak8gqXtk5jpPfueR5iYMOQk9ZTp76xy43S8fyHovyulnVivU9GwcK6skSsudS RE9y0po795Tg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,295,1580803200"; d="scan'208";a="246111772" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2020 00:15:30 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , Haiyue Wang , Paul M Stillwell Jr Date: Mon, 23 Mar 2020 15:17:50 +0800 Message-Id: <20200323071759.13075-28-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200323071759.13075-1-qi.z.zhang@intel.com> References: <20200309114357.31800-1-qi.z.zhang@intel.com> <20200323071759.13075-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v2 27/36] net/ice/base: add the hook to send AdminQ command X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Add the hook to send the PF's AdminQ command in another path, like not directly to the firmware. If the AdminQ command is sent through the hook path, it needs to save the AQ error codes from firmware as the last status for admin control queue, so that the AdminQ command function can use it to do exception handling like the buffer size is not enough accorindg to error ENOMEM. And convert explicitly the hook path result to the ice_status type. Signed-off-by: Haiyue Wang Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_common.c | 22 ++++++++++++++++++++++ drivers/net/ice/base/ice_type.h | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c index b526a7738..61973286f 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -1315,6 +1315,28 @@ enum ice_status ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf, u16 buf_size, struct ice_sq_cd *cd) { + if (hw->aq_send_cmd_fn) { + enum ice_status status = ICE_ERR_NOT_READY; + u16 retval = ICE_AQ_RC_OK; + + ice_acquire_lock(&hw->adminq.sq_lock); + if (!hw->aq_send_cmd_fn(hw->aq_send_cmd_param, desc, + buf, buf_size)) { + retval = LE16_TO_CPU(desc->retval); + /* strip off FW internal code */ + if (retval) + retval &= 0xff; + if (retval == ICE_AQ_RC_OK) + status = ICE_SUCCESS; + else + status = ICE_ERR_AQ_ERROR; + } + + hw->adminq.sq_last_status = (enum ice_aq_err)retval; + ice_release_lock(&hw->adminq.sq_lock); + + return status; + } return ice_sq_send_cmd(hw, &hw->adminq, desc, buf, buf_size, cd); } diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index 127e8224d..478940225 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -818,6 +818,10 @@ struct ice_hw { /* Control Queue info */ struct ice_ctl_q_info adminq; struct ice_ctl_q_info mailboxq; + /* Additional function to send AdminQ command */ + int (*aq_send_cmd_fn)(void *param, struct ice_aq_desc *desc, + void *buf, u16 buf_size); + void *aq_send_cmd_param; u8 api_branch; /* API branch version */ u8 api_maj_ver; /* API major version */ -- 2.13.6