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 01BD7DE4 for ; Tue, 16 Jun 2015 00:31:35 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 15 Jun 2015 15:31:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,621,1427785200"; d="scan'208";a="743979725" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Jun 2015 15:31:32 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.73]) by IRSMSX104.ger.corp.intel.com ([169.254.5.171]) with mapi id 14.03.0224.002; Mon, 15 Jun 2015 23:31:32 +0100 From: "Ananyev, Konstantin" To: "Iremonger, Bernard" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug Thread-Index: AQHQogRob4oCUS/88ECSFCBzhAx6C52uMSlQ Date: Mon, 15 Jun 2015 22:31:31 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836A0AA76@irsmsx105.ger.corp.intel.com> References: <1433778458-17434-1-git-send-email-bernard.iremonger@intel.com> In-Reply-To: <1433778458-17434-1-git-send-email-bernard.iremonger@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hotplug 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: Mon, 15 Jun 2015 22:31:36 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bernard Iremonger > Sent: Monday, June 08, 2015 4:48 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [RFC PATCH V4] ixgbe: changes to support PCI Port Hot= plug >=20 > This patch depends on the Port Hotplug Framework. > It implements the eth_dev_uninit functions for rte_ixgbe_pmd and > rte_ixgbevf_pmd. >=20 > Changes in V4: > Release rx and tx queues in dev_uninit() functions. > Replace TRUE and FALSE with 1 and 0. >=20 > Changes in V3: > Rebased to use drivers/net/ixgbe directory. >=20 > Changes in V2: > Added call to dev_close() in dev_uninit() functions. > Removed input parameter checks from dev_uninit() functions. >=20 > Signed-off-by: Bernard Iremonger > --- > drivers/net/ixgbe/ixgbe_ethdev.c | 107 ++++++++++++++++++++++++++++++++= ++++-- > drivers/net/ixgbe/ixgbe_ethdev.h | 2 + > drivers/net/ixgbe/ixgbe_pf.c | 22 ++++++++ > 3 files changed, 126 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_e= thdev.c > index 0d9f9b2..7f9d286 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -117,6 +117,7 @@ > #define IXGBE_QUEUE_STAT_COUNTERS (sizeof(hw_stats->qprc) / sizeof(hw_st= ats->qprc[0])) >=20 > static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev); > +static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev); > static int ixgbe_dev_configure(struct rte_eth_dev *dev); > static int ixgbe_dev_start(struct rte_eth_dev *dev); > static void ixgbe_dev_stop(struct rte_eth_dev *dev); > @@ -183,6 +184,7 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct= ixgbe_dcb_config *dcb_conf >=20 > /* For Virtual Function support */ > static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev); > +static int eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev); > static int ixgbevf_dev_configure(struct rte_eth_dev *dev); > static int ixgbevf_dev_start(struct rte_eth_dev *dev); > static void ixgbevf_dev_stop(struct rte_eth_dev *dev); > @@ -916,6 +918,57 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) > return 0; > } >=20 > +static int > +eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev) > +{ > + struct rte_pci_device *pci_dev; > + struct ixgbe_hw *hw; > + unsigned i; > + > + PMD_INIT_FUNC_TRACE(); > + > + if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) > + return -EPERM; > + > + hw =3D IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); > + pci_dev =3D eth_dev->pci_dev; > + > + if (hw->adapter_stopped =3D=3D 0) > + ixgbe_dev_close(eth_dev); > + > + eth_dev->dev_ops =3D NULL; > + eth_dev->rx_pkt_burst =3D NULL; > + eth_dev->tx_pkt_burst =3D NULL; > + > + /* Unlock any pending hardware semaphore */ > + ixgbe_swfw_lock_reset(hw); > + > + /* disable uio intr before callback unregister */ > + rte_intr_disable(&(pci_dev->intr_handle)); > + rte_intr_callback_unregister(&(pci_dev->intr_handle), > + ixgbe_dev_interrupt_handler, (void *)eth_dev); > + > + /* uninitialize PF if max_vfs not zero */ > + ixgbe_pf_host_uninit(eth_dev); > + > + for (i =3D 0; i < eth_dev->data->nb_rx_queues; i++) { > + ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]); > + eth_dev->data->rx_queues[i] =3D NULL; > + } > + > + for (i =3D 0; i < eth_dev->data->nb_tx_queues; i++) { > + ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]); > + eth_dev->data->tx_queues[i] =3D NULL; > + } > + > + rte_free(eth_dev->data->mac_addrs); > + eth_dev->data->mac_addrs =3D NULL; > + > + rte_free(eth_dev->data->hash_mac_addrs); > + eth_dev->data->hash_mac_addrs =3D NULL; > + > + return 0; > +} >=20 > /* > * Negotiate mailbox API version with the PF. > @@ -1086,13 +1139,56 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) > return 0; > } >=20 > +/* Virtual Function device uninit */ > + > +static int > +eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev) > +{ > + struct ixgbe_hw *hw; > + unsigned i; > + > + PMD_INIT_FUNC_TRACE(); > + > + if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) > + return -EPERM; > + > + hw =3D IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); > + > + if (hw->adapter_stopped =3D=3D 0) > + ixgbevf_dev_close(eth_dev); > + > + eth_dev->dev_ops =3D NULL; > + eth_dev->rx_pkt_burst =3D NULL; > + eth_dev->tx_pkt_burst =3D NULL; > + > + /* Disable the interrupts for VF */ > + ixgbevf_intr_disable(hw); > + > + for (i =3D 0; i < eth_dev->data->nb_rx_queues; i++) { > + ixgbe_dev_rx_queue_release(eth_dev->data->rx_queues[i]); > + eth_dev->data->rx_queues[i] =3D NULL; > + } > + > + for (i =3D 0; i < eth_dev->data->nb_tx_queues; i++) { > + ixgbe_dev_tx_queue_release(eth_dev->data->tx_queues[i]); > + eth_dev->data->tx_queues[i] =3D NULL; > + } > + > + rte_free(eth_dev->data->mac_addrs); > + eth_dev->data->mac_addrs =3D NULL; > + > + return 0; > +} > + > static struct eth_driver rte_ixgbe_pmd =3D { > { > .name =3D "rte_ixgbe_pmd", > .id_table =3D pci_id_ixgbe_map, > - .drv_flags =3D RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, > + .drv_flags =3D RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | > + RTE_PCI_DRV_DETACHABLE, > }, > .eth_dev_init =3D eth_ixgbe_dev_init, > + .eth_dev_uninit =3D eth_ixgbe_dev_uninit, > .dev_private_size =3D sizeof(struct ixgbe_adapter), > }; >=20 > @@ -1103,9 +1199,10 @@ static struct eth_driver rte_ixgbevf_pmd =3D { > { > .name =3D "rte_ixgbevf_pmd", > .id_table =3D pci_id_ixgbevf_map, > - .drv_flags =3D RTE_PCI_DRV_NEED_MAPPING, > + .drv_flags =3D RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, > }, > .eth_dev_init =3D eth_ixgbevf_dev_init, > + .eth_dev_uninit =3D eth_ixgbevf_dev_uninit, > .dev_private_size =3D sizeof(struct ixgbe_adapter), > }; >=20 > @@ -1475,7 +1572,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev) > } >=20 > /* stop adapter */ > - hw->adapter_stopped =3D FALSE; > + hw->adapter_stopped =3D 0; > ixgbe_stop_adapter(hw); >=20 > /* reinitialize adapter > @@ -1628,7 +1725,7 @@ ixgbe_dev_stop(struct rte_eth_dev *dev) >=20 > /* reset the NIC */ > ixgbe_pf_reset_hw(hw); > - hw->adapter_stopped =3D FALSE; > + hw->adapter_stopped =3D 0; >=20 > /* stop adapter */ > ixgbe_stop_adapter(hw); > @@ -3015,7 +3112,7 @@ ixgbevf_dev_stop(struct rte_eth_dev *dev) >=20 > PMD_INIT_FUNC_TRACE(); >=20 > - hw->adapter_stopped =3D TRUE; > + hw->adapter_stopped =3D 1; > ixgbe_stop_adapter(hw); >=20 > /* > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_e= thdev.h > index 19237b8..710ee87 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.h > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h > @@ -389,6 +389,8 @@ void ixgbe_vlan_hw_strip_disable_all(struct rte_eth_d= ev *dev); >=20 > void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev); >=20 > +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev); > + > void ixgbe_pf_mbx_process(struct rte_eth_dev *eth_dev); >=20 > int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev); > diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c > index caed137..fd1c4ca 100644 > --- a/drivers/net/ixgbe/ixgbe_pf.c > +++ b/drivers/net/ixgbe/ixgbe_pf.c > @@ -144,6 +144,28 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev) > return; > } >=20 > +void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev) > +{ > + struct ixgbe_vf_info **vfinfo; > + uint16_t vf_num; > + > + PMD_INIT_FUNC_TRACE(); > + > + vfinfo =3D IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private); > + > + RTE_ETH_DEV_SRIOV(eth_dev).active =3D 0; > + RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool =3D 0; > + RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx =3D 0; > + RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =3D 0; > + > + vf_num =3D dev_num_vf(eth_dev); > + if (vf_num =3D=3D 0) > + return; > + > + rte_free(*vfinfo); > + *vfinfo =3D NULL; > +} > + > int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev) > { > uint32_t vtctl, fcrth; > -- Acked-by: Konstantin Ananyev > 1.7.4.1