From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 0B75AA0096 for ; Mon, 8 Apr 2019 13:23:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A7DEB5A4A; Mon, 8 Apr 2019 13:23:00 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00059.outbound.protection.outlook.com [40.107.0.59]) by dpdk.org (Postfix) with ESMTP id 3D07B4F94 for ; Mon, 8 Apr 2019 13:22:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2miP8QifQM7Og9QpAD1/pzCG9SZBncTaEGTQUqWg2v0=; b=eZSaPzVDn6OxJkfFaRuRoU5opeTDdarlxY6H2UNold8AONIyEBjLhsZP9gZ7ywHOSUvqfWYNagQq2QdXkDGGYkLaFub5IGwa01uMgeW6EIQm/0fh6FCguATyOn/idAnH+CMB0//c/3v2iyEoCOmfJpKWbZ2t42ZzVD5+NO4njpQ= Received: from VE1PR04MB6365.eurprd04.prod.outlook.com (10.255.118.78) by VE1PR04MB6606.eurprd04.prod.outlook.com (20.179.235.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.13; Mon, 8 Apr 2019 11:22:39 +0000 Received: from VE1PR04MB6365.eurprd04.prod.outlook.com ([fe80::f5ad:f178:4c55:13e0]) by VE1PR04MB6365.eurprd04.prod.outlook.com ([fe80::f5ad:f178:4c55:13e0%3]) with mapi id 15.20.1771.016; Mon, 8 Apr 2019 11:22:39 +0000 From: Gagandeep Singh To: "dev@dpdk.org" , "ferruh.yigit@intel.com" CC: Gagandeep Singh Thread-Topic: [PATCH 07/13] net/enetc: remove forward declarations Thread-Index: AQHU7f1g2f3/GQxeM0qGd4BV9iZFjw== Date: Mon, 8 Apr 2019 11:22:39 +0000 Message-ID: <1554745507-15089-8-git-send-email-g.singh@nxp.com> References: <1554745507-15089-1-git-send-email-g.singh@nxp.com> In-Reply-To: <1554745507-15089-1-git-send-email-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR0101CA0003.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::13) To VE1PR04MB6365.eurprd04.prod.outlook.com (2603:10a6:803:12a::14) x-mailer: git-send-email 1.9.1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [92.120.1.67] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 38e23882-73f2-495a-a538-08d6bc148246 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VE1PR04MB6606; x-ms-traffictypediagnostic: VE1PR04MB6606: x-microsoft-antispam-prvs: x-forefront-prvs: 0001227049 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(39860400002)(396003)(136003)(199004)(189003)(76176011)(97736004)(81156014)(71200400001)(71190400001)(72206003)(3846002)(25786009)(81166006)(53936002)(2616005)(5660300002)(6116002)(8676002)(7736002)(446003)(478600001)(8936002)(11346002)(305945005)(2906002)(256004)(14444005)(66066001)(6512007)(476003)(6436002)(486006)(50226002)(2501003)(99286004)(106356001)(86362001)(110136005)(4326008)(6486002)(68736007)(105586002)(6506007)(52116002)(316002)(26005)(386003)(14454004)(186003)(36756003)(102836004); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR04MB6606; H:VE1PR04MB6365.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: /zMjR7UkUYzGgtSUgdVMjH0CNhcl4II0wDnDXPiBvTA06PI4SNnTdmLxxp7BjIt331snhH3dAOra+sAqBK7NmN+1WgJCqUCWRUhpRg3wvh4Sn/hSul9hULL0drXz1FtKw+5pQysZ8sKjGvbpdd+z7orMpu1UmM/mEll5VmGPiTIjA7k/TCuXktgZXWTZPI0mMDsiR/8z5K7ggyCC4kSEEig5pAPw4Wag2mNdgjV/8uhEBCERfxV+9CaZRvJnDzQg9vPXxNjMWHV+3Ges/ybpu6OvF0dvRMmg0ouvvOwFC7oaB1iLt9fClU6a8chEBufWW8PBXtUBT43w0BFoNdJyqQrl176l0OLU4Ypp+sNnSJZAT6UCx3pyYU2xNf28aWnEY5EYIc5Ii24w6UnXuKOwXZX0NRZoYY0D0RQJZRTkd0c= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38e23882-73f2-495a-a538-08d6bc148246 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2019 11:22:39.5322 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6606 Subject: [dpdk-dev] [PATCH 07/13] net/enetc: remove forward declarations 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190408112239.hr_SOWWEKDSFJhTxGQ7T2Gb2SN2Dvs5n5SuW8xG_dp8@z> Remove unneeded forward declarations and re-order the code. Signed-off-by: Gagandeep Singh --- drivers/net/enetc/enetc_ethdev.c | 237 ++++++++++++++++++-----------------= ---- 1 file changed, 107 insertions(+), 130 deletions(-) diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_eth= dev.c index d403d7a..f8b9510 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -10,115 +10,6 @@ =20 int enetc_logtype_pmd; =20 -/* Functions Prototypes */ -static int enetc_dev_configure(struct rte_eth_dev *dev); -static int enetc_dev_start(struct rte_eth_dev *dev); -static void enetc_dev_stop(struct rte_eth_dev *dev); -static void enetc_dev_close(struct rte_eth_dev *dev); -static void enetc_dev_infos_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); -static int enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete= ); -static int enetc_hardware_init(struct enetc_eth_hw *hw); -static int enetc_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue= _id, - uint16_t nb_rx_desc, unsigned int socket_id, - const struct rte_eth_rxconf *rx_conf, - struct rte_mempool *mb_pool); -static void enetc_rx_queue_release(void *rxq); -static int enetc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue= _id, - uint16_t nb_tx_desc, unsigned int socket_id, - const struct rte_eth_txconf *tx_conf); -static void enetc_tx_queue_release(void *txq); -static const uint32_t *enetc_supported_ptypes_get(struct rte_eth_dev *dev)= ; -static int enetc_stats_get(struct rte_eth_dev *dev, - struct rte_eth_stats *stats); -static void enetc_stats_reset(struct rte_eth_dev *dev); - -/* - * The set of PCI devices this driver supports - */ -static const struct rte_pci_id pci_id_enetc_map[] =3D { - { RTE_PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_DEV_ID) }, - { RTE_PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_DEV_ID_VF) }, - { .vendor_id =3D 0, /* sentinel */ }, -}; - -/* Features supported by this driver */ -static const struct eth_dev_ops enetc_ops =3D { - .dev_configure =3D enetc_dev_configure, - .dev_start =3D enetc_dev_start, - .dev_stop =3D enetc_dev_stop, - .dev_close =3D enetc_dev_close, - .link_update =3D enetc_link_update, - .stats_get =3D enetc_stats_get, - .stats_reset =3D enetc_stats_reset, - .dev_infos_get =3D enetc_dev_infos_get, - .rx_queue_setup =3D enetc_rx_queue_setup, - .rx_queue_release =3D enetc_rx_queue_release, - .tx_queue_setup =3D enetc_tx_queue_setup, - .tx_queue_release =3D enetc_tx_queue_release, - .dev_supported_ptypes_get =3D enetc_supported_ptypes_get, -}; - -/** - * Initialisation of the enetc device - * - * @param eth_dev - * - Pointer to the structure rte_eth_dev - * - * @return - * - On success, zero. - * - On failure, negative value. - */ -static int -enetc_dev_init(struct rte_eth_dev *eth_dev) -{ - int error =3D 0; - struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(eth_dev); - struct enetc_eth_hw *hw =3D - ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); - - PMD_INIT_FUNC_TRACE(); - eth_dev->dev_ops =3D &enetc_ops; - eth_dev->rx_pkt_burst =3D &enetc_recv_pkts; - eth_dev->tx_pkt_burst =3D &enetc_xmit_pkts; - - /* Retrieving and storing the HW base address of device */ - hw->hw.reg =3D (void *)pci_dev->mem_resource[0].addr; - hw->device_id =3D pci_dev->id.device_id; - - error =3D enetc_hardware_init(hw); - if (error !=3D 0) { - ENETC_PMD_ERR("Hardware initialization failed"); - return -1; - } - - /* Allocate memory for storing MAC addresses */ - eth_dev->data->mac_addrs =3D rte_zmalloc("enetc_eth", ETHER_ADDR_LEN, 0); - if (!eth_dev->data->mac_addrs) { - ENETC_PMD_ERR("Failed to allocate %d bytes needed to " - "store MAC addresses", - ETHER_ADDR_LEN * 1); - error =3D -ENOMEM; - return -1; - } - - /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)hw->mac.addr, - ð_dev->data->mac_addrs[0]); - - ENETC_PMD_DEBUG("port_id %d vendorID=3D0x%x deviceID=3D0x%x", - eth_dev->data->port_id, pci_dev->id.vendor_id, - pci_dev->id.device_id); - return 0; -} - -static int -enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused) -{ - PMD_INIT_FUNC_TRACE(); - return 0; -} - static int enetc_dev_configure(struct rte_eth_dev *dev __rte_unused) { @@ -179,27 +70,6 @@ static int enetc_stats_get(struct rte_eth_dev *dev, val & (~(ENETC_PM0_TX_EN | ENETC_PM0_RX_EN))); } =20 -static void -enetc_dev_close(struct rte_eth_dev *dev) -{ - uint16_t i; - - PMD_INIT_FUNC_TRACE(); - enetc_dev_stop(dev); - - for (i =3D 0; i < dev->data->nb_rx_queues; i++) { - enetc_rx_queue_release(dev->data->rx_queues[i]); - dev->data->rx_queues[i] =3D NULL; - } - dev->data->nb_rx_queues =3D 0; - - for (i =3D 0; i < dev->data->nb_tx_queues; i++) { - enetc_tx_queue_release(dev->data->tx_queues[i]); - dev->data->tx_queues[i] =3D NULL; - } - dev->data->nb_tx_queues =3D 0; -} - static const uint32_t * enetc_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) { @@ -653,6 +523,113 @@ int enetc_stats_get(struct rte_eth_dev *dev, enetc_port_wr(enetc_hw, ENETC_PM0_STAT_CONFIG, ENETC_CLEAR_STATS); } =20 +static void +enetc_dev_close(struct rte_eth_dev *dev) +{ + uint16_t i; + + PMD_INIT_FUNC_TRACE(); + enetc_dev_stop(dev); + + for (i =3D 0; i < dev->data->nb_rx_queues; i++) { + enetc_rx_queue_release(dev->data->rx_queues[i]); + dev->data->rx_queues[i] =3D NULL; + } + dev->data->nb_rx_queues =3D 0; + + for (i =3D 0; i < dev->data->nb_tx_queues; i++) { + enetc_tx_queue_release(dev->data->tx_queues[i]); + dev->data->tx_queues[i] =3D NULL; + } + dev->data->nb_tx_queues =3D 0; +} + +/* + * The set of PCI devices this driver supports + */ +static const struct rte_pci_id pci_id_enetc_map[] =3D { + { RTE_PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_DEV_ID) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_DEV_ID_VF) }, + { .vendor_id =3D 0, /* sentinel */ }, +}; + +/* Features supported by this driver */ +static const struct eth_dev_ops enetc_ops =3D { + .dev_configure =3D enetc_dev_configure, + .dev_start =3D enetc_dev_start, + .dev_stop =3D enetc_dev_stop, + .dev_close =3D enetc_dev_close, + .link_update =3D enetc_link_update, + .stats_get =3D enetc_stats_get, + .stats_reset =3D enetc_stats_reset, + .dev_infos_get =3D enetc_dev_infos_get, + .rx_queue_setup =3D enetc_rx_queue_setup, + .rx_queue_release =3D enetc_rx_queue_release, + .tx_queue_setup =3D enetc_tx_queue_setup, + .tx_queue_release =3D enetc_tx_queue_release, + .dev_supported_ptypes_get =3D enetc_supported_ptypes_get, +}; + +/** + * Initialisation of the enetc device + * + * @param eth_dev + * - Pointer to the structure rte_eth_dev + * + * @return + * - On success, zero. + * - On failure, negative value. + */ +static int +enetc_dev_init(struct rte_eth_dev *eth_dev) +{ + int error =3D 0; + struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(eth_dev); + struct enetc_eth_hw *hw =3D + ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + + PMD_INIT_FUNC_TRACE(); + eth_dev->dev_ops =3D &enetc_ops; + eth_dev->rx_pkt_burst =3D &enetc_recv_pkts; + eth_dev->tx_pkt_burst =3D &enetc_xmit_pkts; + + /* Retrieving and storing the HW base address of device */ + hw->hw.reg =3D (void *)pci_dev->mem_resource[0].addr; + hw->device_id =3D pci_dev->id.device_id; + + error =3D enetc_hardware_init(hw); + if (error !=3D 0) { + ENETC_PMD_ERR("Hardware initialization failed"); + return -1; + } + + /* Allocate memory for storing MAC addresses */ + eth_dev->data->mac_addrs =3D rte_zmalloc("enetc_eth", ETHER_ADDR_LEN, 0); + if (!eth_dev->data->mac_addrs) { + ENETC_PMD_ERR("Failed to allocate %d bytes needed to " + "store MAC addresses", + ETHER_ADDR_LEN * 1); + error =3D -ENOMEM; + return -1; + } + + /* Copy the permanent MAC address */ + ether_addr_copy((struct ether_addr *)hw->mac.addr, + ð_dev->data->mac_addrs[0]); + + ENETC_PMD_DEBUG("port_id %d vendorID=3D0x%x deviceID=3D0x%x", + eth_dev->data->port_id, pci_dev->id.vendor_id, + pci_dev->id.device_id); + return 0; +} + +static int +enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused) +{ + PMD_INIT_FUNC_TRACE(); + return 0; +} + static int enetc_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) --=20 1.9.1