From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E0CBA594B for ; Fri, 8 May 2015 05:23:06 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 07 May 2015 20:23:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,387,1427785200"; d="scan'208";a="722612638" Received: from pgsmsx105.gar.corp.intel.com ([10.221.44.96]) by fmsmga002.fm.intel.com with ESMTP; 07 May 2015 20:23:05 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by PGSMSX105.gar.corp.intel.com (10.221.44.96) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 8 May 2015 11:23:04 +0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.162]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.69]) with mapi id 14.03.0224.002; Fri, 8 May 2015 11:23:03 +0800 From: "Wu, Jingjing" To: "Zhang, Helin" , "dev@dpdk.org" Thread-Topic: [PATCH v2 07/33] i40e: replacement of 'i40e_debug_read_register()' Thread-Index: AQHQg1b3FoM4G4pQIUKU6947IfDarZ1xdeAg Date: Fri, 8 May 2015 03:23:03 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F8C18354@SHSMSX104.ccr.corp.intel.com> References: <1429518150-28098-1-git-send-email-helin.zhang@intel.com> <1430406219-23901-1-git-send-email-helin.zhang@intel.com> <1430406219-23901-8-git-send-email-helin.zhang@intel.com> In-Reply-To: <1430406219-23901-8-git-send-email-helin.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "Kenguva, Monica" , "Murray, Steven J" , "Nelson, Shannon" Subject: Re: [dpdk-dev] [PATCH v2 07/33] i40e: replacement of 'i40e_debug_read_register()' X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 May 2015 03:23:07 -0000 Acked-by: Jingjing Wu > -----Original Message----- > From: Zhang, Helin > Sent: Thursday, April 30, 2015 11:03 PM > To: dev@dpdk.org > Cc: Cao, Min; Xu, Qian Q; Wu, Jingjing; Liu, Jijiang; Kenguva, Monica; Pa= tel, > Rashmin N; Murray, Steven J; Nelson, Shannon; Zhang, Helin > Subject: [PATCH v2 07/33] i40e: replacement of > 'i40e_debug_read_register()' >=20 > As base driver provides 'i40e_aq_debug_read_register()', the same > functional interface of 'i40e_debug_read_register()' can be replaced. >=20 > Signed-off-by: Helin Zhang > --- > lib/librte_pmd_i40e/i40e/i40e_common.c | 35 > +++++++++++++++++++++++++++++++ > lib/librte_pmd_i40e/i40e/i40e_prototype.h | 3 +++ > lib/librte_pmd_i40e/i40e_ethdev.c | 22 ++----------------- > 3 files changed, 40 insertions(+), 20 deletions(-) >=20 > diff --git a/lib/librte_pmd_i40e/i40e/i40e_common.c > b/lib/librte_pmd_i40e/i40e/i40e_common.c > index db24b36..4722614 100644 > --- a/lib/librte_pmd_i40e/i40e/i40e_common.c > +++ b/lib/librte_pmd_i40e/i40e/i40e_common.c > @@ -2358,6 +2358,41 @@ enum i40e_status_code > i40e_aq_send_msg_to_vf(struct i40e_hw *hw, u16 vfid, } >=20 > /** > + * i40e_aq_debug_read_register > + * @hw: pointer to the hw struct > + * @reg_addr: register address > + * @reg_val: register value > + * @cmd_details: pointer to command details structure or NULL > + * > + * Read the register using the admin queue commands **/ enum > +i40e_status_code i40e_aq_debug_read_register(struct i40e_hw *hw, > + u32 reg_addr, u64 *reg_val, > + struct i40e_asq_cmd_details *cmd_details) { > + struct i40e_aq_desc desc; > + struct i40e_aqc_debug_reg_read_write *cmd_resp =3D > + (struct i40e_aqc_debug_reg_read_write > *)&desc.params.raw; > + enum i40e_status_code status; > + > + if (reg_val =3D=3D NULL) > + return I40E_ERR_PARAM; > + > + i40e_fill_default_direct_cmd_desc(&desc, > i40e_aqc_opc_debug_read_reg); > + > + cmd_resp->address =3D CPU_TO_LE32(reg_addr); > + > + status =3D i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); > + > + if (status =3D=3D I40E_SUCCESS) { > + *reg_val =3D ((u64)LE32_TO_CPU(cmd_resp->value_high) << > 32) | > + (u64)LE32_TO_CPU(cmd_resp->value_low); > + } > + > + return status; > +} > + > +/** > * i40e_aq_debug_write_register > * @hw: pointer to the hw struct > * @reg_addr: register address > diff --git a/lib/librte_pmd_i40e/i40e/i40e_prototype.h > b/lib/librte_pmd_i40e/i40e/i40e_prototype.h > index 755733d..2165ac8 100644 > --- a/lib/librte_pmd_i40e/i40e/i40e_prototype.h > +++ b/lib/librte_pmd_i40e/i40e/i40e_prototype.h > @@ -91,6 +91,9 @@ enum i40e_status_code > i40e_aq_get_firmware_version(struct i40e_hw *hw, enum > i40e_status_code i40e_aq_debug_write_register(struct i40e_hw *hw, > u32 reg_addr, u64 reg_val, > struct i40e_asq_cmd_details *cmd_details); > +enum i40e_status_code i40e_aq_debug_read_register(struct i40e_hw *hw, > + u32 reg_addr, u64 *reg_val, > + struct i40e_asq_cmd_details *cmd_details); > enum i40e_status_code i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 > cmd_flags, > struct i40e_asq_cmd_details *cmd_details); > enum i40e_status_code i40e_aq_set_default_vsi(struct i40e_hw *hw, u16 > vsi_id, diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c > b/lib/librte_pmd_i40e/i40e_ethdev.c > index 3d45429..96700e4 100644 > --- a/lib/librte_pmd_i40e/i40e_ethdev.c > +++ b/lib/librte_pmd_i40e/i40e_ethdev.c > @@ -5623,25 +5623,6 @@ i40e_pctype_to_flowtype(enum > i40e_filter_pctype pctype) > return flowtype_table[pctype]; > } >=20 > -static int > -i40e_debug_read_register(struct i40e_hw *hw, uint32_t addr, uint64_t *va= l) > -{ > - struct i40e_aq_desc desc; > - enum i40e_status_code status; > - > - i40e_fill_default_direct_cmd_desc(&desc, > i40e_aqc_opc_debug_read_reg); > - desc.params.internal.param1 =3D rte_cpu_to_le_32(addr); > - status =3D i40e_asq_send_command(hw, &desc, NULL, 0, NULL); > - if (status < 0) > - return status; > - > - *val =3D ((uint64_t)(rte_le_to_cpu_32(desc.params.internal.param2)) > << > - (CHAR_BIT * sizeof(uint32_t))) + > - > rte_le_to_cpu_32(desc.params.internal.param3); > - > - return status; > -} > - > /* > * On X710, performance number is far from the expectation on recent > firmware > * versions; on XL710, performance number is also far from the expectati= on > on @@ -5692,7 +5673,8 @@ i40e_configure_registers(struct i40e_hw *hw) >=20 > I40E_GL_SWR_PM_UP_THR_EF_VALUE; > } >=20 > - ret =3D i40e_debug_read_register(hw, reg_table[i].addr, ®); > + ret =3D i40e_aq_debug_read_register(hw, reg_table[i].addr, > + ®, NULL); > if (ret < 0) { > PMD_DRV_LOG(ERR, "Failed to read from > 0x%"PRIx32, > reg_table[i].addr); > -- > 1.8.1.4