From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Chen, Jing D" Subject: Re: [PATCH 4/6] fm10k: Fix issue that MAC addr can't be set to silicon Date: Wed, 10 Jun 2015 05:34:55 +0000 Message-ID: <4341B239C0EFF9468EE453F9E9F4604D01709065@shsmsx102.ccr.corp.intel.com> References: <1432887044-24777-1-git-send-email-jing.d.chen@intel.com> <1432887044-24777-5-git-send-email-jing.d.chen@intel.com> <533710CFB86FA344BFBF2D6802E6028604695A13@SHSMSX101.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "He, Shaopeng" To: "Qiu, Michael" , "dev@dpdk.org" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id E5F215A87 for ; Wed, 10 Jun 2015 07:35:34 +0200 (CEST) In-Reply-To: <533710CFB86FA344BFBF2D6802E6028604695A13@SHSMSX101.ccr.corp.intel.com> Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, Michael, > -----Original Message----- > From: Qiu, Michael > Sent: Wednesday, June 10, 2015 12:24 AM > To: Chen, Jing D; dev@dpdk.org > Cc: He, Shaopeng > Subject: Re: [PATCH 4/6] fm10k: Fix issue that MAC addr can't be set to s= ilicon >=20 > On 2015/5/29 16:11, Chen, Jing D wrote: > > From: "Chen Jing D(Mark)" > > > > In fm10k, PF driver needs to communicate with switch through > > mailbox if it needs to add/delete MAC address. > > This fix will validate if switch is ready before going forward. > > Then, it is necessary to acquire LPORT_MAP info after issuing > > MAC addr request to switch. > > > > Signed-off-by: Chen Jing D(Mark) > > --- > > drivers/net/fm10k/fm10k_ethdev.c | 34 > +++++++++++++++++++++++++++++++--- > > 1 files changed, 31 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/fm10k/fm10k_ethdev.c > b/drivers/net/fm10k/fm10k_ethdev.c > > index 19e718b..dedfbb4 100644 > > --- a/drivers/net/fm10k/fm10k_ethdev.c > > +++ b/drivers/net/fm10k/fm10k_ethdev.c > > @@ -45,6 +45,10 @@ > > #define FM10K_MBXLOCK_DELAY_US 20 > > #define UINT64_LOWER_32BITS_MASK 0x00000000ffffffffULL > > > > +/* Max try times to aquire switch status */ > > +#define MAX_QUERY_SWITCH_STATE_TIMES 10 > > +/* Wait interval to get switch status */ > > +#define WAIT_SWITCH_MSG_US 100000 > > /* Number of chars per uint32 type */ > > #define CHARS_PER_UINT32 (sizeof(uint32_t)) > > #define BIT_MASK_PER_UINT32 ((1 << CHARS_PER_UINT32) - 1) > > @@ -1802,6 +1806,32 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) > > fm10k_dev_enable_intr_vf(dev); > > } > > > > + /* Enable uio intr after callback registered */ > > + rte_intr_enable(&(dev->pci_dev->intr_handle)); > > + > > + hw->mac.ops.update_int_moderator(hw); > > + > > + /* Make sure Switch Manager is ready before going forward. */ > > + if (hw->mac.type =3D=3D fm10k_mac_pf) { > > + int switch_ready =3D 0; > > + int i; > > + > > + for (i =3D 0; i < MAX_QUERY_SWITCH_STATE_TIMES; i++) { > > + fm10k_mbx_lock(hw); > > + hw->mac.ops.get_host_state(hw, &switch_ready); > > + fm10k_mbx_unlock(hw); > > + if (switch_ready) > > + break; > > + /* Delay some time to acquire async LPORT_MAP > info. */ > > + rte_delay_us(WAIT_SWITCH_MSG_US); > > + } > > + > > + if (switch_ready =3D=3D 0) { > > + PMD_INIT_LOG(ERR, "switch is not ready"); > > + return -1; >=20 > Here better to return -EIO or other error code? "-1" seems not keep the > same style with other return routine in this function. Thanks for your comments! I can't find a good error number to describe what's happening. Even with EI= O, application can't tell what kind of error is returned. So, I'd like to keep it unchange= d. >=20 > Thanks, > Michael >=20 >=20 > > + } > > + } > > + > > /* > > * Below function will trigger operations on mailbox, acquire lock to > > * avoid race condition from interrupt handler. Operations on mailbox > > @@ -1811,7 +1841,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) > > */ > > fm10k_mbx_lock(hw); > > /* Enable port first */ > > - hw->mac.ops.update_lport_state(hw, 0, 0, 1); > > + hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map, 1, 1); > > > > /* Update default vlan */ > > hw->mac.ops.update_vlan(hw, hw->mac.default_vid, 0, true); > > @@ -1831,8 +1861,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) > > > > fm10k_mbx_unlock(hw); > > > > - /* enable uio intr after callback registered */ > > - rte_intr_enable(&(dev->pci_dev->intr_handle)); > > > > return 0; > > }