All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Russkikh <igor.russkikh@aquantia.com>
To: dev@dpdk.org
Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com,
	Pavel Belous <Pavel.Belous@aquantia.com>
Subject: [PATCH v3 01/22] net/atlantic: atlantic PMD driver skeleton
Date: Sat, 29 Sep 2018 13:30:15 +0300	[thread overview]
Message-ID: <cbfd3330a282ba846733aa8e74f56f2e6997b65e.1538215990.git.igor.russkikh@aquantia.com> (raw)
In-Reply-To: <cover.1538215990.git.igor.russkikh@aquantia.com>

From: Pavel Belous <Pavel.Belous@aquantia.com>

Makefile/meson build infrastructure, atl_ethdev minimal skeleton,
header with aquantia aQtion NIC device and vendor IDs.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: Pavel Belous <Pavel.Belous@aquantia.com>
---
 config/common_base                                |   5 +
 drivers/net/Makefile                              |   1 +
 drivers/net/atlantic/Makefile                     |  27 ++++
 drivers/net/atlantic/atl_common.h                 |  96 ++++++++++++++
 drivers/net/atlantic/atl_ethdev.c                 | 145 ++++++++++++++++++++++
 drivers/net/atlantic/atl_ethdev.h                 |  15 +++
 drivers/net/atlantic/meson.build                  |  10 ++
 drivers/net/atlantic/rte_pmd_atlantic_version.map |   4 +
 drivers/net/meson.build                           |   1 +
 mk/rte.app.mk                                     |   1 +
 10 files changed, 305 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 155c7d40ea31..ba51ffbd43ce 100644
--- a/config/common_base
+++ b/config/common_base
@@ -635,6 +635,11 @@ 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
+
+#
 # Compile raw device support
 # EXPERIMENTAL: API may change without prior notice
 #
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 664398de983a..8ac6b9db5916 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -10,6 +10,7 @@ endif
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
 DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark
+DIRS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atlantic
 DIRS-$(CONFIG_RTE_LIBRTE_AVF_PMD) += avf
 DIRS-$(CONFIG_RTE_LIBRTE_AVP_PMD) += avp
 DIRS-$(CONFIG_RTE_LIBRTE_AXGBE_PMD) += axgbe
diff --git a/drivers/net/atlantic/Makefile b/drivers/net/atlantic/Makefile
new file mode 100644
index 000000000000..e42ce5b178ab
--- /dev/null
+++ b/drivers/net/atlantic/Makefile
@@ -0,0 +1,27 @@
+# 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
+
+LDLIBS += -lrte_eal
+LDLIBS += -lrte_ethdev -lrte_net
+LDLIBS += -lrte_bus_pci
+
+#
+# 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 000000000000..b3a0aa5cd212
--- /dev/null
+++ b/drivers/net/atlantic/atl_common.h
@@ -0,0 +1,96 @@
+/* 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
+
+
+#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 000000000000..5728d9037d72
--- /dev/null
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -0,0 +1,145 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Aquantia Corporation
+ */
+
+#include <rte_ethdev_pci.h>
+
+#include "atl_ethdev.h"
+#include "atl_common.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 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 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
+eth_atl_dev_init(struct rte_eth_dev *eth_dev __rte_unused)
+{
+	return 0;
+}
+
+static int
+eth_atl_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused)
+{
+	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 __rte_unused)
+{
+	return 0;
+}
+
+/*
+ * Configure device link speed and setup link.
+ * It returns 0 on success.
+ */
+static int
+atl_dev_start(struct rte_eth_dev *dev __rte_unused)
+{
+	return 0;
+}
+
+/*
+ * Stop device: disable rx and tx functions to allow for reconfiguring.
+ */
+static void
+atl_dev_stop(struct rte_eth_dev *dev __rte_unused)
+{
+}
+
+/*
+ * Reset and stop device.
+ */
+static void
+atl_dev_close(struct rte_eth_dev *dev __rte_unused)
+{
+}
+
+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 000000000000..ae87517560de
--- /dev/null
+++ b/drivers/net/atlantic/atl_ethdev.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Aquantia Corporation
+ */
+
+#ifndef _ATLANTIC_ETHDEV_H_
+#define _ATLANTIC_ETHDEV_H_
+#include <rte_tm_driver.h>
+
+/*
+ * Structure to store private data for each driver instance (for each port).
+ */
+struct atl_adapter {
+};
+
+#endif /* _ATLANTIC_ETHDEV_H_ */
diff --git a/drivers/net/atlantic/meson.build b/drivers/net/atlantic/meson.build
new file mode 100644
index 000000000000..90ee5288206a
--- /dev/null
+++ b/drivers/net/atlantic/meson.build
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Aquantia Corporation
+
+sources = files(
+	'atl_ethdev.c',
+)
+
+deps += ['eal']
+
+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 000000000000..521e51f411fb
--- /dev/null
+++ b/drivers/net/atlantic/rte_pmd_atlantic_version.map
@@ -0,0 +1,4 @@
+DPDK_18.11 {
+
+	local: *;
+};
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index f59bea7905e3..8208ab101ed5 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 899d51a23b2c..fd06e7df014e 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -157,6 +157,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.7.4

  reply	other threads:[~2018-09-29 10:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-29 10:30 [PATCH v3 00/22] net/atlantic: Aquantia aQtion 10G NIC Family DPDK PMD driver Igor Russkikh
2018-09-29 10:30 ` Igor Russkikh [this message]
2018-10-03 18:48   ` [PATCH v3 01/22] net/atlantic: atlantic PMD driver skeleton Ferruh Yigit
2018-09-29 10:30 ` [PATCH v3 02/22] net/atlantic: logging macroes and some typedefs Igor Russkikh
2018-10-03 18:49   ` Ferruh Yigit
2018-09-29 10:30 ` [PATCH v3 03/22] net/atlantic: hardware register access routines Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 04/22] net/atlantic: hw_atl register declarations Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 05/22] net/atlantic: firmware operations layer Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 06/22] net/atlantic: b0 hardware layer main logic Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 07/22] net/atlantic: rte device start, stop, initial configuration Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 08/22] net/atlantic: TX/RX function prototypes Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 09/22] net/atlantic: RX side structures and implementation Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 10/22] net/atlantic: TX " Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 11/22] net/atlantic: link status and interrupt management Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 12/22] net/atlantic: device statistics, xstats Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 13/22] net/atlantic: support for RX/TX descriptors information Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 14/22] net/atlantic: promisc and allmulti configuration Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 15/22] net/atlantic: RSS and RETA manipulation API Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 16/22] net/atlantic: flow control configuration Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 17/22] net/atlantic: MAC address manipulations Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 18/22] net/atlantic: VLAN filters and offloads Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 19/22] net/atlantic: eeprom and register manipulation routines Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 20/22] net/atlantic: LED control DPDK and private APIs Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 21/22] net/atlantic: support for read MAC registers for debug purposes Igor Russkikh
2018-09-29 10:30 ` [PATCH v3 22/22] net/atlantic: documentation and rel notes Igor Russkikh
2018-10-03 18:47 ` [PATCH v3 00/22] net/atlantic: Aquantia aQtion 10G NIC Family DPDK PMD driver Ferruh Yigit
2018-10-04  9:42   ` Igor Russkikh
2018-10-04 10:29     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cbfd3330a282ba846733aa8e74f56f2e6997b65e.1538215990.git.igor.russkikh@aquantia.com \
    --to=igor.russkikh@aquantia.com \
    --cc=dev@dpdk.org \
    --cc=pavel.belous@aquantia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.