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 8F3405A7A for ; Wed, 15 Jul 2015 12:14:55 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 15 Jul 2015 03:14:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,479,1432623600"; d="scan'208";a="764831268" Received: from dwdohert-dpdk-fedora-20.ir.intel.com ([163.33.213.98]) by orsmga002.jf.intel.com with ESMTP; 15 Jul 2015 03:14:55 -0700 Message-ID: <55A6345A.9050406@intel.com> Date: Wed, 15 Jul 2015 11:22:18 +0100 From: Declan Doherty User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Bernard Iremonger , dev@dpdk.org References: <1436264487-8769-1-git-send-email-bernard.iremonger@intel.com> <1436264487-8769-2-git-send-email-bernard.iremonger@intel.com> In-Reply-To: <1436264487-8769-2-git-send-email-bernard.iremonger@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4 1/3] bonding: add support for 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: Wed, 15 Jul 2015 10:14:56 -0000 On 07/07/15 11:21, Bernard Iremonger wrote: > This patch depends on the Port Hotplug Framework. > It implements the rte_dev_uninit_t() function for the link bonding pmd. > > Signed-off-by: Bernard Iremonger > --- ... > I think we can clean up the create function a bit further as the pci_id_table is static for all bonded devices we can just statically initialize it, as this will remove the resetting of the parameters each time a bonding device is created. See below Declan diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 9d8da1c..bf25470 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -193,12 +193,19 @@ number_of_sockets(void) } const char driver_name[] = "rte_bond_pmd"; -static struct rte_pci_id pci_id_table; + +static struct rte_pci_id pci_id_table = { + .device_id = PCI_ANY_ID, + .subsystem_device_id = PCI_ANY_ID, + .vendor_id = PCI_ANY_ID, + .subsystem_vendor_id = PCI_ANY_ID +}; static struct eth_driver rte_bond_pmd = { .pci_drv = { .name = driver_name, .drv_flags = RTE_PCI_DRV_INTR_LSC | RTE_PCI_DRV_DETACHABLE, + .id_table = &pci_id_table }, }; @@ -208,7 +215,6 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) struct rte_pci_device *pci_dev = NULL; struct bond_dev_private *internals = NULL; struct rte_eth_dev *eth_dev = NULL; - struct rte_pci_driver *pci_drv = NULL; /* now do all data allocation - for eth_dev structure, dummy pci driver * and internal (private) data @@ -231,16 +237,6 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) goto err; } - pci_drv = &rte_bond_pmd.pci_drv; - - memset(&pci_id_table, 0, sizeof(pci_id_table)); - pci_id_table.device_id = PCI_ANY_ID; - pci_id_table.subsystem_device_id = PCI_ANY_ID; - pci_id_table.vendor_id = PCI_ANY_ID; - pci_id_table.subsystem_vendor_id = PCI_ANY_ID; - - pci_drv->id_table = &pci_id_table; - internals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id); if (internals == NULL) { RTE_BOND_LOG(ERR, "Unable to malloc internals on socket"); @@ -255,8 +251,7 @@ rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id) } pci_dev->numa_node = socket_id; - pci_drv->name = driver_name; - pci_dev->driver = pci_drv; + pci_dev->driver = &rte_bond_pmd.pci_drv; eth_dev->driver = &rte_bond_pmd; eth_dev->data->dev_private = internals;