From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0044.outbound.protection.outlook.com [104.47.42.44]) by dpdk.org (Postfix) with ESMTP id 5C7C22AA0 for ; Fri, 7 Sep 2018 17:23:16 +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=2Kgn89z0BTBHSMMybxBFGNp+qA1lc30XDW6oxPiwr6U=; b=uNH4eXeb6m16GgoiysiRCiMMrKC1s6JBt6GpKMta4boMbtnQJuOMx32rf27CwIRqhp98YjXRH1YH0V4QWV+reGQdXvR/dqilvBS5AMMb27QZautMukUzhzAw90mW67g+K5XniU+d7gIbSAUZhQvS7O9b2a0u2+jMqBP9AwFT+XM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; Received: from ubuntubox.rdc.aquantia.com (95.79.108.179) by BLUPR0701MB1652.namprd07.prod.outlook.com (2a01:111:e400:58c6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.16; Fri, 7 Sep 2018 15:23:02 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, Nadezhda.Krupnina@aquantia.com, igor.russkikh@aquantia.com, Simon.Edelhaus@aquantia.com, Corey Melton , Ashish Kumar Date: Fri, 7 Sep 2018 18:21:39 +0300 Message-Id: <1536333719-32155-2-git-send-email-igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536333719-32155-1-git-send-email-igor.russkikh@aquantia.com> References: <1536333719-32155-1-git-send-email-igor.russkikh@aquantia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.79.108.179] X-ClientProxiedBy: BN6PR20CA0060.namprd20.prod.outlook.com (2603:10b6:404:151::22) To BLUPR0701MB1652.namprd07.prod.outlook.com (2a01:111:e400:58c6::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d81ad175-dcc4-406f-452e-08d614d5cde1 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1652; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1652; 3:+Wgo4XKsgQzBkK0rYCmjoRbfU2g2VqTt00Dp1pyxga9KWLBvhiUTgv2g+mptZVMz128I2UF+UBHEgGmAls2vj1Pfx/lE63Sdclscl7qmvkmIuVoakfVdw5OB7XEDpelHhwQaFkSGpdVlFcNysz77npDsOEUr1bq1v5MeNsfvQnvGfFUzSbA4FqwR6NGUuOOXi+JXuXJqJ3l1L3uD9cR7JdJusXuAwsvpKKkg+mSs5VMoCWwsZLifaXnzadeLrQHB; 25:W+rZb6o/9UNLOQjZBcDd7uD0czLR4FYK3MsD++j/TF8E/Ei8BWa9LaKz9sy7nobZEsT0o1CdayaK7HRQ/WIgP2ZZoy3f9xzGeKx/HDjsjvkVF6PCkENAIDJRpzvkYk+AHVM2CSKC5izVSNyHSHMM6ZEP7QP1fms3YxP01r9dG6LXRqtjiU3Gzo+vyZ9Ls1JtT0SxR3a0nX1ECuM3qMsPa+jgkaMiet8ROTdj9YQIMw+7p2vSX8rLlVK2yrDOjAI8kfTre8Qfn2Hp5F1QpHauzcYpn+9ChsU/ImdeZ7hzQsTCSC9F+FDSlpCCOjoZIDcc+8Ycn/auKRH1Z5aCX3aaZQ==; 31:eYXiEPfrzwSSYkdmXamkWiyw5T4tRBJHcFKWMivk9f5o4/6wi6TWgB/3LLBWzte63YDndgygJDZjmb2Ss+3hrQ5vfw+vhbwYljN8CkatSiJOTnURKytmUhgqS5oTTgbDFWrkK+gC+V3Z8Xbaj1XYMydH4VwsEOU4OcsTzzE75JdmcRJA75XjGdw3IgnDcaVZIAKGa3V7fIsSZ/HJvZFPWz+vhzQO87IrpYyCrPzAl8U= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1652: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1652; 20:343B5b14Wly5VpVrZgURGdhlB5+wSVVt44jU+zcGoBlnGIncmR8rCmaR31C2ZtgVFHxh5+PdSZiO8iomgR/ngNz2NN4o955mYoQXHunKJBHoUh114oYSLByIDULT5HnYMDgHvnn8jK1LNWshpt9iKi1mzVUuLJlIXbZllJb5l/27gFKHW4DBDHx6nXR4YAdBAUqWvhhnQAy4YoXFbzaVC8F6D7Dgzmz2jPz2b8Rv2B8b0xqt69RsBE4WETGfvWJpRl0L58uJaIt+BDXkntIaASRgzJccc6c3NSQ/hdhrUCNmQpxmxK01lH6kxDl+//SGwYZsAYv3nHQxlGsAbt4cCchi4UCcjctxF4tw7y5eVIBJSbV+bXQgSHgo7ct/p5bmNhs79eswL8Kb0FTcq64NM2BzWlu/9whadZc//E/5F+7Xnn8C3ov6IoQzMgZJF99kuEUtV9ddwtpE21Kp3kWDfcgES0tr7gb2v9o1Wc5/0v9xOTnNMRgg0YMBND8ACWJA; 4:V5ot+O0fEOVfGfdlYeT4/593qO/85hkm8XDdLmsXTJAIUaac9sheuXPzOGPUIcUFh/zL49FSA4TdeZb18sAwYOFLfYHqakIpZWSYPtTXZtbzIjQfnCLTT8Skq4mLL8vYHcAbJPThkjKbPQgQetLNyJFRsxPPTZAedsV36O4aOPaxt3h2CHNgDa+cCiWOZU0yhMxHWBVGmt5SIsMRR13ku3X+rZPKAk/vr3tvenvZdYF9FA9tsu+cBqqk+NUg4A/F+09vwDig9vGIxyq4bUkVOQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231311)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699050); SRVR:BLUPR0701MB1652; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1652; X-Forefront-PRVS: 07880C4932 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39850400004)(396003)(376002)(366004)(346002)(136003)(189003)(199004)(81156014)(81166006)(44832011)(8936002)(2351001)(486006)(106356001)(2361001)(105586002)(446003)(2906002)(50226002)(476003)(11346002)(956004)(2616005)(305945005)(7736002)(16586007)(316002)(54906003)(14444005)(16526019)(66066001)(26005)(7696005)(52116002)(8676002)(51416003)(76176011)(186003)(386003)(68736007)(478600001)(6666003)(6916009)(6486002)(5660300001)(53936002)(47776003)(4326008)(25786009)(86362001)(48376002)(50466002)(575784001)(72206003)(6116002)(97736004)(36756003)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1652; 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; BLUPR0701MB1652; 23:jwCKNJmfZKrpG9Rkx93GfZBzdQWNjufjUNWhInW?= =?us-ascii?Q?og7WCsE2nCqhYU7WIOmxDsz8+IL76cKNE7lpUgOI+WaJfSSR2/v2im7XPutZ?= =?us-ascii?Q?omelDWay0ssskDuRBd4Yh70RegLjDeaS355O0MDlkHqwON5nuKk0pj/PXA6s?= =?us-ascii?Q?bYPwqQAkhVMVk46z/mdu9wP3d1iwJg9tAH6YmK8xcHUxZu3nPmD4FWBLq+D2?= =?us-ascii?Q?DF/9kcCZ4Iyqtm3GF0GzGQLYbPVeqwFRI/M+Kct9ACGxAADBEaAYYmweT66c?= =?us-ascii?Q?Q9uzGUgnTkco0hjH3kUvXP4MX46EdxuFg2ov7nNkuxlI1R6BxFszn4mfQi3q?= =?us-ascii?Q?V98HY6ic13H4llH2/ac346Kz+YgJsPsP4tyc0z5gMno+pucosyNUpWnE+6CT?= =?us-ascii?Q?HuCGu+M3rZlmXfhAxeq+QhAeo+0CCzEDdHNZpHHalSodrz4eSUfLjUzg8IZC?= =?us-ascii?Q?BfKNgxI5+Hqku+kv6GV+klpzQG+RCs5l2JyukrJoILQRvU2SFpvG6P03LgCv?= =?us-ascii?Q?GDFM1aLb+59oihOhPztXQjXkTgu18ZC4xGanaS1I4y0IhUgkMZDFwXs86+eo?= =?us-ascii?Q?JbUYGzn5PllLYjOLh0OQOobT4kzuTpSSGBBNFLeIz1lZ0gdGZ8n7WHG2y6pg?= =?us-ascii?Q?pD2aU9/2gOvpz6b1iY51FasqaRZj3LarjkuY61dahVmnEXdt9GkqgQdZ7xhH?= =?us-ascii?Q?x3omvhmYgrT4xskY61fK5fsWeXRiAZI5rOcqbYvKmDJzVsUDOr1wdxXR7mZ/?= =?us-ascii?Q?TxIv2BURSj74x9Jz/nFEugk/OgJ7HiHj3aZ5W5ShhjFtEDYORB0Eh+tWzNSq?= =?us-ascii?Q?mDcaRbZdXwv4fXQfGxY6h4zEb0R7nXc3XyQ2bIstfr1wheS+aN5C2inEra6W?= =?us-ascii?Q?LUYNBy8Z3/LiRTBvm5fz5RpkfeHCrV1ajotUfQoeSYvxcngKY5MYiqVIkEI7?= =?us-ascii?Q?/IFTpTDpZ3Lhn0H7kfpccBhrCKnwA0bJN1pURKs7IeSas1jwBL15RPR7JGEv?= =?us-ascii?Q?4B9W28bPWMAMNfOuA/c3TER62BIDJzqFNHGFsjWzLkkY0a700kwwpGRJomhq?= =?us-ascii?Q?Avlkp4ZR2S0E60UUDD1tPGRR640LMCmipq+Sxv8M1922g7Ay0h20Brj5X0Q+?= =?us-ascii?Q?44Vi0ELcnXX9AzpDIN3xAiSCgdOJRvyyxGtNjY1Cr5TEEwtXMT4+Jufr6s3i?= =?us-ascii?Q?s6wfq5gWCR9tWFXysGr39Clg+zok+eCPT+SvrcKc/uZGaGWpG/jybtqfZe+W?= =?us-ascii?Q?mpDmCVVrIbY4aQ9Mm47yvb2THosEWCbaiq+23MTf7fIGwNnbgRh0do7udbhS?= =?us-ascii?Q?A1w=3D=3D?= X-Microsoft-Antispam-Message-Info: jdZ1MG64EWjygw+uStk6dao2TZOFHJA/v8bFBj6PRSfOPzj3/awdl70i2MiLQoDW2H+aAMQPfWq2uT6t23LImwXaS5rB+cjP4ZHmiUJvr8a4bcnokbfieVZdUbTsAB1/ZmYufSYlohi/gsgsBzHMkrPH4vGYCoQUdEOh7/6lwY/FJToeKVQh+CYfm2slHMOvVQIiFQyxwomv7+0QJ2Lb10RkOpYmV2PsyoPpCV1Tui043Fq6WvQIpJypfkJF0vQOaWXVzobq8iuaxLUZzesP4lVVWdqWLNWIRrKkrV/YtyDmBTASmQqasLct0XxASaGqGz5E09/4CYcCiLoLE3RJ8ljm0YoOkfqQgYu3G9IDtrE= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1652; 6:v28obKLjQRM4Kmnz6s8XRrfDfdl/BRUlUFRJQehQd3vZHKOyEFn2PpX9FJ9xZ4jILsPptR5O66plzQOkwF5GArvU2kyefqC0TrTpIu/BwKr3RGJ3w7dcibuVxOZv5Czy5uDBTZGLx1mns/ox+y8yHX+GnZNV0DXyjyi7CXM6EYwY5we2WjsAf9rQtK+NCv8T07++ctmPPQvERo9oJjw111/JiYavogoiyscHgFWKpX8ATefeopMTN6nQwU1teNTXPK4x0BaJ1slbLTChMP28YTXbX6OjDAEVtiDTy7m29TiPJRzQo1cTt1LwbaSLdbGxsQJg41LbVXjc6+NAdZxXd+IwmUdIwO2mIfI89/tgTCQXy7Pe75u9pAjJiib10WkSaac4G7ecPHE1nSZLlbsnCZst7xoZ6UUO/e1Pyc0ICstygpx0MO6imdZFSUolatrMR9FZa+2emKecdM3b9Gf1RQ==; 5:yRhwDXm+nw064z5cy3NE8qPUQBEa25sPHGKqxbHJfH5O6WTqBZxQQ5tX78PnGmt8vyqJuGEFj8H/ilEL7GytH8wamQhZtUFuwqLijZJ/lRSP5LXfzjTz98sWhyp2T6WcTpbJTchWXN5wCJVX4ehcdosH5LCuJxLeS3nXVN4hWnk=; 7:CTAiKFtSjbAylWpTWsSqedR9qlScPh4nQ/jWl/Du/DxK78eqp/NCmjhtLAmQfwPA8yGPiBnHiAABImac3AXcpjIt3mPrn7X5y2a6bwQCsDP0jJM65aTSXcf2tYDN/8bMpNCD3f/g5jk9kUA5wsOaBITsASIGdpozdpt+bSDtD/AA6I2qgYl5NUCeB5MhdlgTVG71skwOO06mFvP6+fJi16jIRHnqHPr3NLkutPVE/o66nP1hbqYYD1r24/XYB2Gr SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2018 15:23:02.0724 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d81ad175-dcc4-406f-452e-08d614d5cde1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1652 Subject: [dpdk-dev] [PATCH 01/21] net/atlantic: atlantic PMD driver skeleton 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: Fri, 07 Sep 2018 15:23:17 -0000 From: Pavel Belous Makefile/meson build infrastructure, atl_ethdev minimal skeleton, header with aquantia aQtion NIC device and vendor IDs. Signed-off-by: Igor Russkikh --- config/common_base | 9 + drivers/net/Makefile | 2 + drivers/net/atlantic/Makefile | 59 +++++ drivers/net/atlantic/atl_common.h | 97 ++++++++ drivers/net/atlantic/atl_ethdev.c | 284 ++++++++++++++++++++++ drivers/net/atlantic/atl_ethdev.h | 28 +++ drivers/net/atlantic/meson.build | 19 ++ drivers/net/atlantic/rte_pmd_atlantic_version.map | 4 + drivers/net/meson.build | 1 + mk/rte.app.mk | 1 + 10 files changed, 504 insertions(+) create mode 100644 drivers/net/atlantic/Makefile create mode 100644 drivers/net/atlantic/atl_common.h create mode 100644 drivers/net/atlantic/atl_ethdev.c create mode 100644 drivers/net/atlantic/atl_ethdev.h create mode 100644 drivers/net/atlantic/meson.build create mode 100644 drivers/net/atlantic/rte_pmd_atlantic_version.map diff --git a/config/common_base b/config/common_base index 4bcbaf923..3b5fc8e71 100644 --- a/config/common_base +++ b/config/common_base @@ -635,6 +635,15 @@ CONFIG_RTE_LIBRTE_PMD_DPAA_EVENTDEV=n CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=n # +# Compile Aquantia Atlantic PMD driver +# +CONFIG_RTE_LIBRTE_ATLANTIC_PMD=y +CONFIG_RTE_LIBRTE_ATLANTIC_DEBUG=n +CONFIG_RTE_LIBRTE_ATLANTIC_DEBUG_RX=n +CONFIG_RTE_LIBRTE_ATLANTIC_DEBUG_TX=n +CONFIG_RTE_LIBRTE_ATLANTIC_DEBUG_TX_FREE=n + +# # Compile raw device support # EXPERIMENTAL: API may change without prior notice # diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 664398de9..3d4a1ae59 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -70,4 +70,6 @@ $(error "RTE_LIBRTE_CFGFILE must be enabled in configuration!") endif endif +DIRS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atlantic + include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/net/atlantic/Makefile b/drivers/net/atlantic/Makefile new file mode 100644 index 000000000..d70ee4380 --- /dev/null +++ b/drivers/net/atlantic/Makefile @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Aquantia Corporation + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_atlantic.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +EXPORT_MAP := rte_pmd_atlantic_version.map + +LIBABIVER := 1 + +ifeq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) +# +# CFLAGS for icc +# +CFLAGS_BASE_DRIVER = -wd174 -wd593 -wd869 -wd981 -wd2259 + +else ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y) +# +# CFLAGS for clang +# +#CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value +CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args + +else +# +# CFLAGS for gcc +# + +#CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value +CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args + + +endif +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring +LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash +LDLIBS += -lrte_bus_pci + +# +# Add extra flags for base driver files (also known as shared code) +# to disable warnings in them +# +BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))) +$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))) + +VPATH += $(SRCDIR)/hw_atl + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_ethdev.c + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/atlantic/atl_common.h b/drivers/net/atlantic/atl_common.h new file mode 100644 index 000000000..fd3e705e7 --- /dev/null +++ b/drivers/net/atlantic/atl_common.h @@ -0,0 +1,97 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Aquantia Corporation + */ + +#ifndef AQ_COMMON_H +#define AQ_COMMON_H + +#define ATL_PMD_DRIVER_VERSION "0.4.1" + +#define PCI_VENDOR_ID_AQUANTIA 0x1D6A + +#define AQ_DEVICE_ID_0001 0x0001 +#define AQ_DEVICE_ID_D100 0xD100 +#define AQ_DEVICE_ID_D107 0xD107 +#define AQ_DEVICE_ID_D108 0xD108 +#define AQ_DEVICE_ID_D109 0xD109 + +#define AQ_DEVICE_ID_AQC100 0x00B1 +#define AQ_DEVICE_ID_AQC107 0x07B1 +#define AQ_DEVICE_ID_AQC108 0x08B1 +#define AQ_DEVICE_ID_AQC109 0x09B1 +#define AQ_DEVICE_ID_AQC111 0x11B1 +#define AQ_DEVICE_ID_AQC112 0x12B1 + +#define AQ_DEVICE_ID_AQC100S 0x80B1 +#define AQ_DEVICE_ID_AQC107S 0x87B1 +#define AQ_DEVICE_ID_AQC108S 0x88B1 +#define AQ_DEVICE_ID_AQC109S 0x89B1 +#define AQ_DEVICE_ID_AQC111S 0x91B1 +#define AQ_DEVICE_ID_AQC112S 0x92B1 + +#define AQ_DEVICE_ID_AQC111E 0x51B1 +#define AQ_DEVICE_ID_AQC112E 0x52B1 + +#define HW_ATL_NIC_NAME "aQuantia AQtion 10Gbit Network Adapter" + +#define AQ_HWREV_ANY 0 +#define AQ_HWREV_1 1 +#define AQ_HWREV_2 2 + +#define AQ_NIC_RATE_10G BIT(0) +#define AQ_NIC_RATE_5G BIT(1) +#define AQ_NIC_RATE_5G5R BIT(2) +#define AQ_NIC_RATE_2G5 BIT(3) +#define AQ_NIC_RATE_1G BIT(4) +#define AQ_NIC_RATE_100M BIT(5) + +#define AQ_NIC_RATE_EEE_10G BIT(6) +#define AQ_NIC_RATE_EEE_5G BIT(7) +#define AQ_NIC_RATE_EEE_2G5 BIT(8) +#define AQ_NIC_RATE_EEE_1G BIT(9) + + +#define ATL_MAX_RING_DESC (8*1024-8) +#define ATL_MIN_RING_DESC 32 +#define ATL_RXD_ALIGN 8 +#define ATL_TXD_ALIGN 8 +#define ATL_TX_MAX_SEG 16 + +#define ATL_MAX_INTR_QUEUE_NUM 15 + +#define ATL_MISC_VEC_ID 10 +#define ATL_RX_VEC_START 0 + +#define AQ_NIC_WOL_ENABLED BIT(0) + + +#define AQ_NIC_FC_OFF 0U +#define AQ_NIC_FC_TX 1U +#define AQ_NIC_FC_RX 2U +#define AQ_NIC_FC_FULL 3U +#define AQ_NIC_FC_AUTO 4U + + +/* TODO remove or move to another location */ +#define AQ_CFG_TX_FRAME_MAX (16U * 1024U) +#define AQ_CFG_RX_FRAME_MAX (2U * 1024U) + +#define AQ_HW_MULTICAST_ADDRESS_MAX 32 +#define AQ_HW_MAX_SEGS_SIZE 40 + +#define AQ_HW_MAX_RX_QUEUES 8 +#define AQ_HW_MAX_TX_QUEUES 8 +#define AQ_HW_MIN_RX_RING_SIZE 512 +#define AQ_HW_MAX_RX_RING_SIZE 8192 +#define AQ_HW_MIN_TX_RING_SIZE 512 +#define AQ_HW_MAX_TX_RING_SIZE 8192 + +#define ATL_DEFAULT_RX_FREE_THRESH 64 +#define ATL_DEFAULT_TX_FREE_THRESH 64 + +#define ATL_IRQ_CAUSE_LINK 0x8 + +#define AQ_HW_LED_BLINK 0x2U +#define AQ_HW_LED_DEFAULT 0x0U + +#endif /* AQ_COMMON_H */ diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c new file mode 100644 index 000000000..16080ef9e --- /dev/null +++ b/drivers/net/atlantic/atl_ethdev.c @@ -0,0 +1,284 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Aquantia Corporation + */ + +#include "atl_ethdev.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "atl_common.h" +#include "atl_hw_regs.h" +#include "atl_logs.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); + +static int atl_dev_configure(struct rte_eth_dev *dev); +static int atl_dev_start(struct rte_eth_dev *dev); +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_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev, + uint16_t queue_id, + uint8_t stat_idx, + uint8_t is_rx); + + +static void atl_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); + +static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev); + +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); + +int atl_logtype_init; +int atl_logtype_driver; + +/* + * The set of PCI devices this driver supports + */ +static const struct rte_pci_id pci_id_atl_map[] = { + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_0001) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D100) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D107) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D108) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_D109) }, + + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC100) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC107) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC108) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC109) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112) }, + + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC100S) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC107S) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC108S) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC109S) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111S) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112S) }, + + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC111E) }, + { RTE_PCI_DEVICE(PCI_VENDOR_ID_AQUANTIA, AQ_DEVICE_ID_AQC112E) }, + { .vendor_id = 0, /* sentinel */ }, +}; + +static struct rte_pci_driver rte_atl_pmd = { + .id_table = pci_id_atl_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC | + RTE_PCI_DRV_IOVA_AS_VA, + .probe = eth_atl_pci_probe, + .remove = eth_atl_pci_remove, +}; + +static const struct rte_eth_desc_lim rx_desc_lim = { + .nb_max = ATL_MAX_RING_DESC, + .nb_min = ATL_MIN_RING_DESC, + .nb_align = ATL_RXD_ALIGN, +}; + +static const struct rte_eth_desc_lim tx_desc_lim = { + .nb_max = ATL_MAX_RING_DESC, + .nb_min = ATL_MIN_RING_DESC, + .nb_align = ATL_TXD_ALIGN, + .nb_seg_max = ATL_TX_MAX_SEG, + .nb_mtu_seg_max = ATL_TX_MAX_SEG, +}; + +static const struct eth_dev_ops atl_eth_dev_ops = { + .dev_configure = atl_dev_configure, + .dev_start = atl_dev_start, + .dev_stop = atl_dev_stop, + .dev_close = atl_dev_close, + .dev_reset = atl_dev_reset, +}; + + +static int +atl_get_bus_info(struct aq_hw_s *hw) +{ + hw->bus.speed = atl_bus_speed_unknown; + hw->bus.width = atl_bus_width_unknown; + + return 0; +} + +static int +eth_atl_dev_init(struct rte_eth_dev *eth_dev) +{ + 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 rte_intr_handle *intr_handle = &pci_dev->intr_handle; + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + int err = 0; + + eth_dev->dev_ops = &atl_eth_dev_ops; + eth_dev->rx_pkt_burst = &atl_recv_pkts; + eth_dev->tx_pkt_burst = &atl_xmit_pkts; + eth_dev->tx_pkt_prepare = &atl_prep_pkts; + + /* For secondary processes, the primary process has done all the work */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + return 0; + } + + return err; +} + +static int +eth_atl_dev_uninit(struct rte_eth_dev *eth_dev) +{ + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + struct aq_hw_s *hw; + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -EPERM; + + eth_dev->dev_ops = NULL; + eth_dev->rx_pkt_burst = NULL; + eth_dev->tx_pkt_burst = NULL; + + return 0; +} + +static int +eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_probe(pci_dev, + sizeof(struct atl_adapter), eth_atl_dev_init); +} + +static int +eth_atl_pci_remove(struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_remove(pci_dev, eth_atl_dev_uninit); +} + +static int +atl_dev_configure(struct rte_eth_dev *dev) +{ + struct atl_interrupt *intr = ATL_DEV_PRIVATE_TO_INTR(dev->data->dev_private); + + return 0; +} + +/* + * Configure device link speed and setup link. + * It returns 0 on success. + */ +static int +atl_dev_start(struct rte_eth_dev *dev) +{ + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + uint32_t intr_vector = 0; + uint32_t *link_speeds; + uint32_t speed = 0; + int vlan_mask = 0; + int status; + int err; + + /* check and configure queue intr-vector mapping */ + if ((rte_intr_cap_multiple(intr_handle) || + !RTE_ETH_DEV_SRIOV(dev).active) && + dev->data->dev_conf.intr_conf.rxq != 0) { + intr_vector = dev->data->nb_rx_queues; + if (intr_vector > ATL_MAX_INTR_QUEUE_NUM) { + return -ENOTSUP; + } + if (rte_intr_efd_enable(intr_handle, intr_vector)) { + return -1; + } + } + + if (rte_intr_dp_is_en(intr_handle) && !intr_handle->intr_vec) { + intr_handle->intr_vec = rte_zmalloc("intr_vec", + dev->data->nb_rx_queues * sizeof(int), 0); + if (intr_handle->intr_vec == NULL) { + return -ENOMEM; + } + } + + return 0; + +error: + atl_stop_queues(dev); + return -EIO; +} + +/* + * Stop device: disable rx and tx functions to allow for reconfiguring. + */ +static void +atl_dev_stop(struct rte_eth_dev *dev) +{ + +} + +/* + * Reset and stop device. + */ +static void +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_dev_stop(dev); + hw->adapter_stopped = 1; +} + +static int +atl_dev_reset(struct rte_eth_dev *dev) +{ + int ret; + + ret = eth_atl_dev_uninit(dev); + if (ret) + return ret; + + ret = eth_atl_dev_init(dev); + + return ret; +} + +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"); diff --git a/drivers/net/atlantic/atl_ethdev.h b/drivers/net/atlantic/atl_ethdev.h new file mode 100644 index 000000000..18a814a32 --- /dev/null +++ b/drivers/net/atlantic/atl_ethdev.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Aquantia Corporation + */ + +#ifndef _ATLANTIC_ETHDEV_H_ +#define _ATLANTIC_ETHDEV_H_ +#include +#include +#include +#include +#include + +#include "atl_types.h" +#include "hw_atl/hw_atl_utils.h" + +#define ATL_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0) +#define ATL_FLAG_NEED_LINK_CONFIG (uint32_t)(4 << 0) + +/* + * Structure to store private data for each driver instance (for each port). + */ +struct atl_adapter { +}; + +#define ATL_DEV_TO_ADAPTER(dev) \ + ((struct atl_adapter *)(dev)->data->dev_private) + +#endif /* _ATLANTIC_ETHDEV_H_ */ diff --git a/drivers/net/atlantic/meson.build b/drivers/net/atlantic/meson.build new file mode 100644 index 000000000..187ca9808 --- /dev/null +++ b/drivers/net/atlantic/meson.build @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Aquantia Corporation + +#subdir('hw_atl') + +sources = files( + 'atl_ethdev.c', +) + +deps += ['hash', 'eal'] + +if get_option('buildtype') == 'debug' + dpdk_conf.set('RTE_LIBRTE_ATLANTIC_DEBUG', 1) + dpdk_conf.set('RTE_LIBRTE_ATLANTIC_DEBUG_RX', 1) + dpdk_conf.set('RTE_LIBRTE_ATLANTIC_DEBUG_TX', 1) + dpdk_conf.set('RTE_LIBRTE_ATLANTIC_DEBUG_TX_FREE', 1) +endif + +allow_experimental_apis = true diff --git a/drivers/net/atlantic/rte_pmd_atlantic_version.map b/drivers/net/atlantic/rte_pmd_atlantic_version.map new file mode 100644 index 000000000..9b9ab1a4c --- /dev/null +++ b/drivers/net/atlantic/rte_pmd_atlantic_version.map @@ -0,0 +1,4 @@ +DPDK_18.05 { + + local: *; +}; diff --git a/drivers/net/meson.build b/drivers/net/meson.build index 9c28ed4da..8f55e5217 100644 --- a/drivers/net/meson.build +++ b/drivers/net/meson.build @@ -3,6 +3,7 @@ drivers = ['af_packet', 'ark', + 'atlantic', 'avp', 'axgbe', 'bonding', 'bnx2x', diff --git a/mk/rte.app.mk b/mk/rte.app.mk index de33883be..d2f7f4cb1 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -153,6 +153,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -ldl -lmnl else _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -libverbs -lmlx5 -lmnl endif +_LDLIBS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += -lrte_pmd_atlantic _LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += -lrte_pmd_mvpp2 -L$(LIBMUSDK_PATH)/lib -lmusdk _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null -- 2.13.3.windows.1