From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 77BCFF969 for ; Mon, 27 Mar 2017 08:10:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490595049; x=1522131049; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Ga+AbMRVFeS0dk0Tc/Pp74G/6T2+HLXVb9aFfhVMocw=; b=Im6kE2ZZ2Q8mU4WX/k2+pk284YnU30OCPcI7DiEibkVzVnMQu/KaKWzS 0ZX9+6AEP8IlOLOfdtQGW+YceOPMGA==; Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2017 23:10:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,229,1486454400"; d="scan'208";a="79629006" Received: from kmsmsx153.gar.corp.intel.com ([172.21.73.88]) by orsmga005.jf.intel.com with ESMTP; 26 Mar 2017 23:10:47 -0700 Received: from pgsmsx109.gar.corp.intel.com (10.221.44.109) by KMSMSX153.gar.corp.intel.com (172.21.73.88) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 27 Mar 2017 14:10:46 +0800 Received: from pgsmsx103.gar.corp.intel.com ([169.254.2.72]) by PGSMSX109.gar.corp.intel.com ([169.254.14.172]) with mapi id 14.03.0248.002; Mon, 27 Mar 2017 14:10:45 +0800 From: "Zhao1, Wei" To: "Wu, Jingjing" , "dev@dpdk.org" CC: "Lu, Wenzhuo" Thread-Topic: [dpdk-dev] [PATCH 3/3] net/i40e: implement device reset on port Thread-Index: AQHSk9t8ep6gCZUmrECQh5kG+f9E3qGjTkiAgAUJKhA= Date: Mon, 27 Mar 2017 06:10:45 +0000 Message-ID: References: <1488516984-34702-1-git-send-email-wei.zhao1@intel.com> <1488516984-34702-4-git-send-email-wei.zhao1@intel.com> <9BB6961774997848B5B42BEC655768F810D1335C@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <9BB6961774997848B5B42BEC655768F810D1335C@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.30.20.205] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 3/3] net/i40e: implement device reset on port 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: , X-List-Received-Date: Mon, 27 Mar 2017 06:10:50 -0000 > -----Original Message----- > From: Wu, Jingjing > Sent: Friday, March 24, 2017 5:07 PM > To: Zhao1, Wei ; dev@dpdk.org > Cc: Zhao1, Wei ; Lu, Wenzhuo > > Subject: RE: [dpdk-dev] [PATCH 3/3] net/i40e: implement device reset on > port >=20 >=20 > > /* > > * Structure to store private data specific for VF instance. > > */ > > @@ -708,6 +718,10 @@ struct i40e_adapter { > > struct rte_timecounter systime_tc; > > struct rte_timecounter rx_tstamp_tc; > > struct rte_timecounter tx_tstamp_tc; > > + > > + /* For VF reset */ > > + volatile uint8_t reset_number; > > + void *reset_store_data; > > }; >=20 > How to move it to i40_vf? Or it can be used for PF in future? This is a legacy from wenzhuo's code, his code is design in this way. If th= is feature is be used by pf, locus of here is may be reasonable? =20 >=20 >=20 > > + > > +static int > > +i40evf_store_before_reset(struct rte_eth_dev *dev) { > > + struct i40e_adapter *adapter =3D > > + I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); > > + struct i40e_vf_reset_store *store_data; > > + struct i40e_vf *vf =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data- > > >dev_private); > > + > > + adapter->reset_store_data =3D rte_zmalloc("i40evf_store_reset", > > + sizeof(struct i40e_vf_reset_store), 0); > > + if (adapter->reset_store_data =3D=3D NULL) { > > + PMD_INIT_LOG(ERR, "Failed to allocate %ld bytes needed > to" > > + " to store data when reset vf", > > + sizeof(struct i40e_vf_reset_store)); > > + return -ENOMEM; > > + } > i40evf_store_before_reset is allocated when reset happens. > Don't forget to free it when reset is done. Otherwise memory leak. >=20 > The same as below mac_addrs. Ok, I will add rte_free for them. > > + store_data =3D > > + (struct i40e_vf_reset_store *)adapter->reset_store_data; > > + store_data->mac_addrs =3D rte_zmalloc("i40evf_mac_store_reset", > > + ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX, 0); > > + if (store_data->mac_addrs =3D=3D NULL) { > > + PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to" > > + " to store MAC addresses when reset vf", > > + ETHER_ADDR_LEN * > > I40E_NUM_MACADDR_MAX); > > + } > > + > > + memcpy(store_data->mac_addrs, dev->data->mac_addrs, > > + ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); > > + > > + store_data->promisc_unicast_enabled =3D vf- > >promisc_unicast_enabled; > > + store_data->promisc_multicast_enabled =3D vf- > > >promisc_multicast_enabled; > > + > > + store_data->vlan_num =3D vf->vsi.vlan_num; > > + memcpy(store_data->vfta, vf->vsi.vfta, > > + sizeof(uint32_t) * I40E_VFTA_SIZE); > > + > > + store_data->mac_num =3D vf->vsi.mac_num; > > + > > + return 0; > > +} >=20 >=20 >=20 > > +static int > > +i40evf_handle_vf_reset(struct rte_eth_dev *dev) { > > + struct i40e_adapter *adapter =3D > > + I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); > > + > > + if (!dev->data->dev_started) > > + return 0; > > + > I think even the dev is not started, we also need to reset it. Because th= e VF > need to reconnect with PF. Ok. =20 > > + adapter->reset_number =3D 1; > > + i40e_vf_reset_dev(dev); > > + adapter->reset_number =3D 0; > > + > How to name the reset_number to resetting? >=20 I will change name to "adapter->reset_flag"