From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730065.outbound.protection.outlook.com [40.107.73.65]) by dpdk.org (Postfix) with ESMTP id 0DA031B160 for ; Sat, 29 Sep 2018 12:31:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-aquantia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z57x+gJxhLAaKfpNCgkID8gIGB9YT11pq8MwL3oSnwg=; b=ZhPsR7rnGXOAAH8MglOdeaDKzoEtUHO3hpC+Hz5P93qQ9mUDV4DYGYwJUNBZ1pi5QUioNJclxDqTCf0Z9saHwxAp6Iy/EfAcaEwUWB44pQC3w3+LGKNS2qoeaiEwippPwPAVbyu5kpnEYzsRMTKLyg7bWCNLId0BlPIZlReuyPI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; Received: from ubuntubox.rdc.aquantia.com (95.79.108.179) by BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.22; Sat, 29 Sep 2018 10:31:36 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com Date: Sat, 29 Sep 2018 13:30:21 +0300 Message-Id: <6e5d1bfd1e27795ec7136121b62923b3b7da5180.1538215990.git.igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.79.108.179] X-ClientProxiedBy: VI1P193CA0009.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::19) To BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d4cb348-aea4-4806-f1e2-08d625f6bc95 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1650; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 3:C3Db38LdHwkitNQsZ6Q5YSWp7poPUg5QpT3UG+tod004zyZdyagyGoTuZq9wmQtOb0QQGP8CaMCpi0BoZfMf5f5LA9bHmdLOL7lV1eDE/SLstfPNUqSvRv4mT4+HzWQdZE0ZL43Pr2m78NtE1R/X4krp638z021ygmfuRADp9leuri/4nj7uCRXCLbPbi8k9zAA00tZLKT7h2sVAhuzxz1AjtvI2FsE8PlXO2NCy0fXXtFiiuuJfkEoeoh3klYBG; 25:YyVPZQJUfwt6j9rZtfSF3wk9ZfPeDTGaM4iXQhhQPnptUQhvQcYa7SvUrP4jaXmIDqSR4J5Ls96oeDp9+hMUoE7/8dH7Hvm8xjesJPJibDUmmciVSOcagcZZTWCNURld4Y+8hwD3OtG8Ga2CBYx2M9enabSWGVpPsI1hXP1L7UnKVKsyzJPBLmN1Bp8CkiGNyK3jQDAXnwcjYUJiJgZb17lHhPVnbHfLP7ijIbdOFCKO1PAgN6Z4QNPfHowwBf+YVfguSDiMY71sp6XPzaupabIZovIrii7dgR5h313F0mBYtfIY70OBFU/VxpvuaWJmZsf2Ls/keRjL5dNxwYrzDRrknWoqw+PDGejgv0jZxkc=; 31:idkteOgSL3osb4t231EFwSN2kF3U8k1Gp2G0Xxe5g/+GdWeVrzvWPjQ2001axK1pFwCXzyUQkUrywJbXkJdReC05mSkrbqu6CMw+y98yfqNMXFH7KYiYKLoqhPYtAUF0enSz144nwyaAHAyiXj9PR9eGOc9gLCTMqYWs34meX6OKrnV+A6Tkycz/IA2/SMvHQ/eOS0wSbUATipotuGCj44wmD2kaN1HPM70n1yjXI/E= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1650: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 20:3ULR4XD6s1dagWwsLS0/ahqDm6raVgT7M+cETxBmz9LBpW9LTEkxDbTFhk2uVdxT19ZeZuhNJcCqKIVWXjKflUs6qSmncaUAzHegJloWjJ/QWzMxBfyiYnKj1K/YvFO4bYQHvJbBLCZo6KUOvSUPjcSMQipLX/khzdu1YJSAYXv+75ujrZ+drQCI95C5zIwKfnk7+DBkvQEyrtsULSlhh5YfZoMJffpCzWsNkRnrzRtpktIYJDobt7II89c2IjXUFCvN+sRHel3h/7SxInQ2IpKm6GpCyFR1hUm7Dd4mrG8HPLqcyPcgcBVpQ8tQBltMf4SfLHcj+n9Wbpps8NX/l0fsMWsOk3zX5PwzaIIiufS2WuuH2TKR9rVt94YO59vwfy50DdYYO0LqLlRMcZFPaxQ3zuNbOziV+TxF04H/pjer21cWWecthxQ+rt5UGoNQz/a6qwjSOMmNrpAU3pjYYUhv7TvOHPLco258FiNSbzJ7/am0iS0PmTr0WoBdwKPi; 4:zrnOVDQtcKum58VbMGoNwWPTNQI+FgHhRDlLyTJEK6ZyeEcWSjg7C9jqzo4lnj70XMXIv2y7pXmjI9mGYo4Ef+5GkucXVjCrVn2oBuhbaEHkQnd0ybSQwJxS4ZpnLN8y80Flz0L1HH/Gi7jWTzVTiMrM2fNeHPK2ZhtJxLNQWPcQ1v8KzNXMlTPzJFCF6L24RzdOcDM7mhZHhGFJW9/3dIT1Wpktuf7UO6UuKSIMnGhiTnkzsJ3iNoO7q5R53pIX5pr1myi3ImYCICNByP417JceHaEesZ3Ci1ix3yFTgjRAsEKu2L8hq9fl2RFCwwSy X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201708071742011)(7699051); SRVR:BLUPR0701MB1650; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1650; X-Forefront-PRVS: 0810818DA0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(396003)(376002)(39850400004)(366004)(189003)(199004)(16526019)(14444005)(446003)(76176011)(2906002)(6916009)(6666003)(97736004)(8676002)(81166006)(81156014)(36756003)(4326008)(316002)(8936002)(50226002)(34290500001)(86362001)(5660300001)(68736007)(16586007)(118296001)(72206003)(3846002)(6116002)(53936002)(386003)(105586002)(6486002)(47776003)(66066001)(486006)(25786009)(305945005)(50466002)(44832011)(956004)(2616005)(26005)(107886003)(52116002)(51416003)(7696005)(186003)(476003)(478600001)(2361001)(7736002)(2351001)(48376002)(106356001)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1650; H:ubuntubox.rdc.aquantia.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1650; 23:dHErJuXxql36CZ3rmgAq1rgvG5a0ajhIWz8yoXB?= =?us-ascii?Q?WV/yhXcpZ/2OyrXDKuqaOxFW2JxM59wSgyVwtaK6kuJQlFgoWIs/Aiyf4VU8?= =?us-ascii?Q?fi/3fF/+n/McOeZRcK0gCpPONjMZ1MNbl3vbWbcKCqnYuTcD6HxbQdB0mVwL?= =?us-ascii?Q?q4TZSXd5dmw4yL60+DOZSN7+razl7iKGFZapx28ZQhEjMI2qv4PTwU7TznWx?= =?us-ascii?Q?b8Sor2PDFtnoC0UfczCM8EEsrmkZQGI4rG5y0tLSemcOCS2rxHAmNywqNPWq?= =?us-ascii?Q?5h3Zyd46jBfOLTdONybhkId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P8EeZfQtonj55xCdREgg==; 5:BhumE2/+VxlAvGwUpj/WS3tubE3m53rc5zrn3FIhBcA9B5+kgKdv5B4VUjRnU42fltPXGxZAIUARQzQS/j30xcO2ahbw4kdOL3YqZkvlBO60du0We4xHMH/6j6JqsmGpI6IOpkqxHOpzAspKdfOOCVRQiqnt5eisE4ViocNRmdg=; 7:vA6Gp7ZeMmEPOC4Temzc86Ng2WMEBctjis69paY07VSgQXEg6yZeZk43yO3lW1PrJyIOe94RBlfTvaUZMdCIrE7bBzBP6Ris/2g6Y8VHoVCPW/NuiCAhLDTpoBZh2IdfuDJ6YnWVGgJsHKZ6oEYR9ca01xYKJOGiHYo2577dwYsAlh/PmZYd9094nkjvOs66aSg2MKOI9jcHBuxRVXf3HSfsQJ3tFXcz96NauxB2IVobZCfMl42LqGoazelG8/IY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2018 10:31:36.6723 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d4cb348-aea4-4806-f1e2-08d625f6bc95 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1650 Subject: [dpdk-dev] [PATCH v3 07/22] net/atlantic: rte device start, stop, initial configuration 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: Sat, 29 Sep 2018 10:31:39 -0000 From: Pavel Belous Start, stop and reset are all done via hw_atl layer. Link interrupt configuration is also done here. Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- drivers/net/atlantic/atl_ethdev.c | 196 ++++++++++++++++++++++++++++++++++++-- drivers/net/atlantic/atl_ethdev.h | 8 ++ drivers/net/atlantic/atl_types.h | 4 + 3 files changed, 201 insertions(+), 7 deletions(-) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 5728d9037d72..afb2972ffcc2 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -6,6 +6,11 @@ #include "atl_ethdev.h" #include "atl_common.h" +#include "atl_hw_regs.h" +#include "atl_logs.h" +#include "hw_atl/hw_atl_llh.h" +#include "hw_atl/hw_atl_b0.h" +#include "hw_atl/hw_atl_b0_internal.h" static int eth_atl_dev_init(struct rte_eth_dev *eth_dev); static int eth_atl_dev_uninit(struct rte_eth_dev *eth_dev); @@ -16,6 +21,13 @@ static void atl_dev_stop(struct rte_eth_dev *dev); static void atl_dev_close(struct rte_eth_dev *dev); static int atl_dev_reset(struct rte_eth_dev *dev); +static int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, + size_t fw_size); + +static void atl_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); + + static int eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev); static int eth_atl_pci_remove(struct rte_pci_device *pci_dev); @@ -66,17 +78,103 @@ static const struct eth_dev_ops atl_eth_dev_ops = { .dev_stop = atl_dev_stop, .dev_close = atl_dev_close, .dev_reset = atl_dev_reset, + + .fw_version_get = atl_fw_version_get, + .dev_infos_get = atl_dev_info_get, }; +static inline int32_t +atl_reset_hw(struct aq_hw_s *hw) +{ + return hw_atl_b0_hw_reset(hw); +} + +static void +atl_print_adapter_info(struct aq_hw_s *hw __rte_unused) +{ + PMD_INIT_LOG(DEBUG, "FW version: %u.%u.%u", + hw->fw_ver_actual >> 24, + (hw->fw_ver_actual >> 16) & 0xFF, + hw->fw_ver_actual & 0xFFFF); + PMD_INIT_LOG(DEBUG, "Driver version: %s", ATL_PMD_DRIVER_VERSION); +} + static int -eth_atl_dev_init(struct rte_eth_dev *eth_dev __rte_unused) +eth_atl_dev_init(struct rte_eth_dev *eth_dev) { - return 0; + struct atl_adapter *adapter = + (struct atl_adapter *)eth_dev->data->dev_private; + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + int err = 0; + + PMD_INIT_FUNC_TRACE(); + + eth_dev->dev_ops = &atl_eth_dev_ops; + + /* For secondary processes, the primary process has done all the work */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + rte_eth_copy_pci_info(eth_dev, pci_dev); + + /* Vendor and Device ID need to be set before init of shared code */ + hw->device_id = pci_dev->id.device_id; + hw->vendor_id = pci_dev->id.vendor_id; + hw->mmio = (void *)pci_dev->mem_resource[0].addr; + + /* Hardware configuration - hardcode */ + adapter->hw_cfg.is_lro = false; + adapter->hw_cfg.wol = false; + + hw->aq_nic_cfg = &adapter->hw_cfg; + + /* Allocate memory for storing MAC addresses */ + eth_dev->data->mac_addrs = rte_zmalloc("atlantic", ETHER_ADDR_LEN, 0); + if (eth_dev->data->mac_addrs == NULL) { + PMD_INIT_LOG(ERR, "MAC Malloc failed"); + return -ENOMEM; + } + + err = hw_atl_utils_initfw(hw, &hw->aq_fw_ops); + if (err) + return err; + + /* Copy the permanent MAC address */ + if (hw->aq_fw_ops->get_mac_permanent(hw, + (u8 *)ð_dev->data->mac_addrs[0]) != 0) + return -EINVAL; + + return err; } static int -eth_atl_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused) +eth_atl_dev_uninit(struct rte_eth_dev *eth_dev) { + struct aq_hw_s *hw; + + PMD_INIT_FUNC_TRACE(); + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -EPERM; + + hw = ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + + if (hw->adapter_stopped == 0) + atl_dev_close(eth_dev); + + eth_dev->dev_ops = NULL; + + rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; + + rte_free(eth_dev->data->hash_mac_addrs); + eth_dev->data->hash_mac_addrs = NULL; + +#ifdef RTE_LIBRTE_SECURITY + rte_free(eth_dev->security_ctx); +#endif + return 0; } @@ -105,25 +203,62 @@ atl_dev_configure(struct rte_eth_dev *dev __rte_unused) * It returns 0 on success. */ static int -atl_dev_start(struct rte_eth_dev *dev __rte_unused) +atl_dev_start(struct rte_eth_dev *dev) { - return 0; + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + int status; + int err; + + PMD_INIT_FUNC_TRACE(); + + /* stop adapter */ + hw->adapter_stopped = 0; + + /* reinitialize adapter + * this calls reset and start + */ + status = atl_reset_hw(hw); + if (status != 0) + return -1; + + err = hw_atl_b0_hw_init(hw, (uint8_t *)dev->data->mac_addrs); + + hw_atl_b0_hw_start(hw); + + atl_print_adapter_info(hw); + + return err; } /* * Stop device: disable rx and tx functions to allow for reconfiguring. */ static void -atl_dev_stop(struct rte_eth_dev *dev __rte_unused) +atl_dev_stop(struct rte_eth_dev *dev) { + struct aq_hw_s *hw = + ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + /* reset the NIC */ + atl_reset_hw(hw); + hw->adapter_stopped = 0; + } /* * Reset and stop device. */ static void -atl_dev_close(struct rte_eth_dev *dev __rte_unused) +atl_dev_close(struct rte_eth_dev *dev) { + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + PMD_INIT_FUNC_TRACE(); + + atl_reset_hw(hw); + + atl_dev_stop(dev); + hw->adapter_stopped = 1; } static int @@ -140,6 +275,53 @@ atl_dev_reset(struct rte_eth_dev *dev) return ret; } +static int +atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) +{ + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + uint32_t fw_ver = 0; + unsigned int ret = 0; + + ret = hw_atl_utils_get_fw_version(hw, &fw_ver); + if (ret) + return 0; + + ret = snprintf(fw_version, fw_size, "%u.%u.%u", fw_ver >> 24, + (fw_ver >> 16) & 0xFFU, fw_ver & 0xFFFFU); + + ret += 1; /* add string null-terminator */ + + if (fw_size < ret) + return ret; + + return 0; +} + +static void +atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) +{ + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + + dev_info->max_vfs = pci_dev->max_vfs; + + dev_info->max_hash_mac_addrs = 0; + dev_info->max_vmdq_pools = 0; + dev_info->vmdq_queue_num = 0; +} + RTE_PMD_REGISTER_PCI(net_atlantic, rte_atl_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_atlantic, pci_id_atl_map); RTE_PMD_REGISTER_KMOD_DEP(net_atlantic, "* igb_uio | uio_pci_generic"); + +RTE_INIT(atl_init_log); +static void +atl_init_log(void) +{ + atl_logtype_init = rte_log_register("pmd.atlantic.init"); + if (atl_logtype_init >= 0) + rte_log_set_level(atl_logtype_init, RTE_LOG_DEBUG); + atl_logtype_driver = rte_log_register("pmd.atlantic.driver"); + if (atl_logtype_driver >= 0) + rte_log_set_level(atl_logtype_driver, RTE_LOG_DEBUG); +} + diff --git a/drivers/net/atlantic/atl_ethdev.h b/drivers/net/atlantic/atl_ethdev.h index ae87517560de..0b5db79e1c22 100644 --- a/drivers/net/atlantic/atl_ethdev.h +++ b/drivers/net/atlantic/atl_ethdev.h @@ -6,10 +6,18 @@ #define _ATLANTIC_ETHDEV_H_ #include +#include "atl_types.h" +#include "hw_atl/hw_atl_utils.h" + +#define ATL_DEV_PRIVATE_TO_HW(adapter) \ + (&((struct atl_adapter *)adapter)->hw) + /* * Structure to store private data for each driver instance (for each port). */ struct atl_adapter { + struct aq_hw_s hw; + struct aq_hw_cfg_s hw_cfg; }; #endif /* _ATLANTIC_ETHDEV_H_ */ diff --git a/drivers/net/atlantic/atl_types.h b/drivers/net/atlantic/atl_types.h index 8185a86e1733..85f768ce7d93 100644 --- a/drivers/net/atlantic/atl_types.h +++ b/drivers/net/atlantic/atl_types.h @@ -83,6 +83,10 @@ struct aq_hw_cfg_s { }; struct aq_hw_s { + u16 device_id; + u16 vendor_id; + bool adapter_stopped; + u8 rbl_enabled:1; struct aq_hw_cfg_s *aq_nic_cfg; const struct aq_fw_ops *aq_fw_ops; -- 2.7.4