Skip to contentSkip to conversation

net/atlantic: Aquantia aQtion 10G NIC Family DPDK PMD driver

PATCH Superseded Igor Russkikh 2 participants 28 messages Sep 29, 2018 – Oct 4, 2018

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover net/atlantic: Aquantia aQtion 10G NIC Family DPDK PMD driver

Hello DPDK community!

Aquantia would like to contribute PMD for aQtion AQC10X NIC family:
https://www.aquantia.com/products/aqtion/chips/
These are 10G ethernet NICs with various features.

We do base this work on parts of the existing native linux kernel driver source (atlantic). Shared code is hw_atl hardware and registers access module.

We'd like to target this driver for 18.11 DPDK release timeline, it'd be good to hear comments from the community on how feasible is this.

This patchset implements basic driver infrastructure, vlan offloads, checksumm offloads, rss control, multiring, jumbo frames and other features.

Later on, we plan to share HW MACSEC offloads, rxflows and other features.

version 3 changes:
- patchset fixed to be incrementally buildable
- extra includes removed and cleaned up
- license changed to dual GPL-BSD for pieces shared with linux
- removed extra logging #defines
- misc comments from previous review session

version 2 changes:
- fixed build on freebsd (no ETIME const)
- fixed a bunch of checkpatch failures and warnings
- removed extra CFLAGS disabled warning
- making static arrays const

Igor Russkikh (9):
net/atlantic: logging macroes and some typedefs net/atlantic: hardware register access routines net/atlantic: hw_atl register declarations net/atlantic: firmware operations layer net/atlantic: b0 hardware layer main logic net/atlantic: RX side structures and implementation net/atlantic: RSS and RETA manipulation API net/atlantic: LED control DPDK and private APIs net/atlantic: documentation and rel notes

Pavel Belous (13):
net/atlantic: atlantic PMD driver skeleton net/atlantic: rte device start, stop, initial configuration net/atlantic: TX/RX function prototypes
net/atlantic: TX side structures and implementation net/atlantic: link status and interrupt management net/atlantic: device statistics, xstats
net/atlantic: support for RX/TX descriptors information net/atlantic: promisc and allmulti configuration net/atlantic: flow control configuration net/atlantic: MAC address manipulations
net/atlantic: VLAN filters and offloads
net/atlantic: eeprom and register manipulation routines net/atlantic: support for read MAC registers for debug purposes

 config/common_base                                |    5 +
 doc/guides/nics/atlantic.rst                      |   53 +
 doc/guides/nics/features/atlantic.ini             |   37 +
 doc/guides/nics/index.rst                         |    1 +
 doc/guides/rel_notes/release_18_11.rst            |    5 +
 drivers/net/Makefile                              |    1 +
 drivers/net/atlantic/Makefile                     |   39 +
 drivers/net/atlantic/atl_common.h                 |   96 +
 drivers/net/atlantic/atl_ethdev.c                 | 1688 +++++++++++++++
 drivers/net/atlantic/atl_ethdev.h                 |  110 +
 drivers/net/atlantic/atl_hw_regs.c                |   52 +
 drivers/net/atlantic/atl_hw_regs.h                |   53 +
 drivers/net/atlantic/atl_logs.h                   |   31 +
 drivers/net/atlantic/atl_rxtx.c                   | 1335 ++++++++++++
 drivers/net/atlantic/atl_types.h                  |  193 ++
 drivers/net/atlantic/hw_atl/hw_atl_b0.c           |  510 +++++
 drivers/net/atlantic/hw_atl/hw_atl_b0.h           |   40 +
 drivers/net/atlantic/hw_atl/hw_atl_b0_internal.h  |  145 ++
 drivers/net/atlantic/hw_atl/hw_atl_llh.c          | 1490 +++++++++++++
 drivers/net/atlantic/hw_atl/hw_atl_llh.h          |  714 ++++++
 drivers/net/atlantic/hw_atl/hw_atl_llh_internal.h | 2407 +++++++++++++++++++++
 drivers/net/atlantic/hw_atl/hw_atl_utils.c        |  942 ++++++++
 drivers/net/atlantic/hw_atl/hw_atl_utils.h        |  510 +++++
 drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c   |  618 ++++++
 drivers/net/atlantic/meson.build                  |   21 +
 drivers/net/atlantic/rte_pmd_atlantic.c           |   19 +
 drivers/net/atlantic/rte_pmd_atlantic.h           |   44 +
 drivers/net/atlantic/rte_pmd_atlantic_version.map |    4 +
 drivers/net/meson.build                           |    1 +
 mk/rte.app.mk                                     |    1 +
 30 files changed, 11165 insertions(+)
 create mode 100644 doc/guides/nics/atlantic.rst
 create mode 100644 doc/guides/nics/features/atlantic.ini
 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/atl_hw_regs.c
 create mode 100644 drivers/net/atlantic/atl_hw_regs.h
 create mode 100644 drivers/net/atlantic/atl_logs.h
 create mode 100644 drivers/net/atlantic/atl_rxtx.c
 create mode 100644 drivers/net/atlantic/atl_types.h
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_b0.c
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_b0.h
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_b0_internal.h
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_llh.c
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_llh.h
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_llh_internal.h
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_utils.c
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_utils.h
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
 create mode 100644 drivers/net/atlantic/meson.build
 create mode 100644 drivers/net/atlantic/rte_pmd_atlantic.c
 create mode 100644 drivers/net/atlantic/rte_pmd_atlantic.h
 create mode 100644 drivers/net/atlantic/rte_pmd_atlantic_version.map
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/22 net/atlantic: atlantic PMD driver skeleton

From: Pavel Belous <[email protected]>

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

---
 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
config/common_base +5 -0
index 155c7d40ea31..ba51ffbd43ce 100644
@@ -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
 #
drivers/net/Makefile +1 -0
index 664398de983a..8ac6b9db5916 100644
@@ -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
drivers/net/atlantic/Makefile new file +27 -0
new file mode 100644
index 000000000000..e42ce5b178ab
@@ -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
drivers/net/atlantic/atl_common.h new file +96 -0

96 lines not on this page · raw message

drivers/net/atlantic/atl_ethdev.c new file +145 -0

145 lines not on this page · raw message

drivers/net/atlantic/atl_ethdev.h new file +15 -0
new file mode 100644
index 000000000000..ae87517560de
@@ -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_ */
drivers/net/atlantic/meson.build new file +10 -0
new file mode 100644
index 000000000000..90ee5288206a
@@ -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
drivers/net/atlantic/rte_pmd_atlantic_version.map new file +4 -0
new file mode 100644
index 000000000000..521e51f411fb
@@ -0,0 +1,4 @@
+DPDK_18.11 {
+
+	local: *;
+};
drivers/net/meson.build +1 -0
index f59bea7905e3..8208ab101ed5 100644
@@ -3,6 +3,7 @@
 
 drivers = ['af_packet',
 	'ark',
+	'atlantic',
 	'avp',
 	'axgbe', 'bonding',
 	'bnx2x',
mk/rte.app.mk +1 -0
index 899d51a23b2c..fd06e7df014e 100644
@@ -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
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v3 01/22] net/atlantic: atlantic PMD driver skeleton

Quoted 31 lines · Igor Russkikh

From: Pavel Belous <[email protected]>

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

---
 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
config/common_base +0 -0
index 155c7d40ea31..ba51ffbd43ce 100644

config/common_base CONFIG_RTE_LIBRTE_PMD_DPAA_EVENTDEV=n · line 640

Quoted 6 lines
config/common_base +3 -0
@@ -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

Just to check, default enable in "common_base" means PMD supports all architectures (x86_64, i686, arm, ppc) and both Linux and FreeBSD. If this is not the case, please disable in common_base and enable in whatever supported.

<...>

config/common_base CONFIG_RTE_LIBRTE_PMD_DPAA_EVENTDEV=n · line 642

Quoted 2 lines
config/common_base +2 -0
+int atl_logtype_init;
+int atl_logtype_driver;

These are not yet used in this PMD, please add when used.

<...>

config/common_base CONFIG_RTE_LIBRTE_PMD_DPAA_EVENTDEV=n · line 645

Quoted 3 lines
config/common_base +3 -0
+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_INTR_LSC is way of saying LSC interrupts are supported, please add the flag when driver supports it.

config/common_base CONFIG_RTE_LIBRTE_PMD_DPAA_EVENTDEV=n

Quoted 11 lines
config/common_base +11 -0
+		     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,

I am not sure but it may fail to run without .dev_infos_get, can you please check.

<...>

config/common_base

Quoted 13 lines
config/common_base +13 -0
+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;
+}

Up to you, but dev_reset may be left out from initial skeleton patch and moved into later patches.

<...>

config/common_base line 7

Quoted 8 lines
config/common_base +7 -0
@@ -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>

Why include "rte_tm_driver.h" at this stage?

<...>

config/common_base line 8

Quoted 9 lines
config/common_base +8 -0
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Aquantia Corporation
+
+sources = files(
+	'atl_ethdev.c',
+)
+
+deps += ['eal']

Makefile has more dependency, although I am not sure what to provide in meson, just can you please double check if this mismatch is ok?

config/common_base line 10

Quoted 2 lines
config/common_base +2 -0
+
+allow_experimental_apis = true

Do you need this, at least at this stage?

<...>

config/common_base _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -ldl -lmnl · line 160

Quoted 5 lines
config/common_base +1 -0
@@ -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

Add in alphabetical order please.

#3 lore raw

PATCH v3 2/22 net/atlantic: logging macroes and some typedefs

In reply to Igor Russkikh
---
 drivers/net/atlantic/atl_logs.h  | 31 +++++++++++++++++++++++++++++++
 drivers/net/atlantic/atl_types.h | 31 +++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 drivers/net/atlantic/atl_logs.h
 create mode 100644 drivers/net/atlantic/atl_types.h
drivers/net/atlantic/atl_logs.h new file +31 -0
new file mode 100644
index 000000000000..e3dba334fe92
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Aquantia Corporation
+ */
+#ifndef ATL_LOGS_H
+#define ATL_LOGS_H
+
+#include <rte_log.h>
+
+extern int atl_logtype_init;
+
+#define PMD_INIT_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, atl_logtype_init, \
+		"%s(): " fmt "\n", __func__, ##args)
+
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+
+#define PMD_RX_LOG(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+
+#define PMD_TX_LOG(level, fmt, args...) \
+	RTE_LOG_DP(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+
+extern int atl_logtype_driver;
+#define PMD_DRV_LOG_RAW(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, atl_logtype_driver, "%s(): " fmt, \
+		__func__, ## args)
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+
+#endif
drivers/net/atlantic/atl_types.h new file +31 -0
new file mode 100644
index 000000000000..5a14c2506477
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Aquantia Corporation
+ */
+#ifndef ATL_TYPES_H
+#define ATL_TYPES_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include <inttypes.h>
+#include <string.h>
+
+typedef uint8_t		u8;
+typedef int8_t		s8;
+typedef uint16_t	u16;
+typedef int16_t		s16;
+typedef uint32_t	u32;
+typedef int32_t		s32;
+typedef uint64_t	u64;
+#ifndef __cplusplus
+typedef int		bool;
+#endif
+
+#define FALSE               0
+#define TRUE                1
+
+#define false               0
+#define true                1
+#define min(a, b)	RTE_MIN(a, b)
+#define max(a, b)	RTE_MAX(a, b)
+
+#endif
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH v3 02/22] net/atlantic: logging macroes and some typedefs

Quoted 2 lines · Igor Russkikh

<...>

Quoted 4 lines
drivers/net/atlantic/atl_logs.h new file +3 -0
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Aquantia Corporation
+ */

drivers/net/atlantic/atl_logs.h line 13

Quoted 10 lines
drivers/net/atlantic/atl_logs.h new file +10 -0
+#ifndef ATL_LOGS_H
+#define ATL_LOGS_H
+
+#include <rte_log.h>
+
+extern int atl_logtype_init;
+
+#define PMD_INIT_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, atl_logtype_init, \
+		"%s(): " fmt "\n", __func__, ##args)

You didn't initialize the "atl_logtype_init" at this stage yet.

<...>

Quoted 12 lines
drivers/net/atlantic/atl_types.h new file +11 -0
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Aquantia Corporation
+ */
+#ifndef ATL_TYPES_H
+#define ATL_TYPES_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include <inttypes.h>
+#include <string.h>
+

drivers/net/atlantic/atl_types.h line 21

Quoted 10 lines
drivers/net/atlantic/atl_types.h new file +10 -0
+typedef uint8_t		u8;
+typedef int8_t		s8;
+typedef uint16_t	u16;
+typedef int16_t		s16;
+typedef uint32_t	u32;
+typedef int32_t		s32;
+typedef uint64_t	u64;
+#ifndef __cplusplus
+typedef int		bool;
+#endif

There is already a patch trying to remove these kind of usage, and replace with "#include <stdbool.h>", is it possible to do same?

https://patches.dpdk.org/patch/44988/

#5 lore raw

PATCH v3 3/22 net/atlantic: hardware register access routines

In reply to Igor Russkikh
---
 drivers/net/atlantic/Makefile      |  1 +
 drivers/net/atlantic/atl_hw_regs.c | 52 +++++++++++++++++++++++++++++++++++++
 drivers/net/atlantic/atl_hw_regs.h | 53 ++++++++++++++++++++++++++++++++++++++
 drivers/net/atlantic/atl_types.h   |  4 +++
 drivers/net/atlantic/meson.build   |  1 +
 5 files changed, 111 insertions(+)
 create mode 100644 drivers/net/atlantic/atl_hw_regs.c
 create mode 100644 drivers/net/atlantic/atl_hw_regs.h
drivers/net/atlantic/Makefile +1 -0
index e42ce5b178ab..8613ced71732 100644
@@ -23,5 +23,6 @@ LDLIBS += -lrte_bus_pci
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_hw_regs.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/atlantic/atl_hw_regs.c new file +52 -0

52 lines not on this page · raw message

drivers/net/atlantic/atl_hw_regs.h new file +53 -0

53 lines not on this page · raw message

drivers/net/atlantic/atl_types.h +4 -0
index 5a14c2506477..83fb377add47 100644
@@ -28,4 +28,8 @@ typedef int		bool;
 #define min(a, b)	RTE_MIN(a, b)
 #define max(a, b)	RTE_MAX(a, b)
 
+struct aq_hw_s {
+	void *mmio;
+};
+
 #endif
drivers/net/atlantic/meson.build +1 -0
index 90ee5288206a..7fdde358ba21 100644
@@ -3,6 +3,7 @@
 
 sources = files(
 	'atl_ethdev.c',
+	'atl_hw_regs.c',
 )
 
 deps += ['eal']
Signature · 1 line
2.7.4
#6 lore raw

PATCH v3 4/22 net/atlantic: hw_atl register declarations

In reply to Igor Russkikh

This hw_atl layer is maintained in sync with linux kernel driver. It will generally be in sync with linux upstream.

---
 drivers/net/atlantic/Makefile                     |    3 +
 drivers/net/atlantic/hw_atl/hw_atl_llh.c          | 1490 +++++++++++++
 drivers/net/atlantic/hw_atl/hw_atl_llh.h          |  714 ++++++
 drivers/net/atlantic/hw_atl/hw_atl_llh_internal.h | 2407 +++++++++++++++++++++
 drivers/net/atlantic/meson.build                  |    3 +
 5 files changed, 4617 insertions(+)
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_llh.c
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_llh.h
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_llh_internal.h
drivers/net/atlantic/Makefile +3 -0
index 8613ced71732..cae317badc0c 100644
@@ -19,10 +19,13 @@ LDLIBS += -lrte_eal
 LDLIBS += -lrte_ethdev -lrte_net
 LDLIBS += -lrte_bus_pci
 
+VPATH += $(SRCDIR)/hw_atl
+
 #
 # all source are stored in SRCS-y
 #
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_hw_regs.c
+SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_llh.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/atlantic/hw_atl/hw_atl_llh.c new file +1490 -0

1,490 lines not on this page · raw message

drivers/net/atlantic/hw_atl/hw_atl_llh.h new file +714 -0

714 lines not on this page · raw message

drivers/net/atlantic/hw_atl/hw_atl_llh_internal.h new file +2407 -0

783 lines not on this page · raw message

drivers/net/atlantic/meson.build +3 -0
index 7fdde358ba21..f3193b75b650 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.7.4

Part of the diff is not shown here. View the raw message.

#7 lore raw

PATCH v3 5/22 net/atlantic: firmware operations layer

In reply to Igor Russkikh

AQC NICs comes in fields with two major
FW generations: 1x and 3x.

This is part of linux atlantic driver shared code, responsible for internal NIC firmware interactions, including link management ops, FW initialization, various lifecycle features.

---
 drivers/net/atlantic/Makefile                   |   2 +
 drivers/net/atlantic/atl_types.h                |  95 +++
 drivers/net/atlantic/hw_atl/hw_atl_utils.c      | 942 ++++++++++++++++++++++++
 drivers/net/atlantic/hw_atl/hw_atl_utils.h      | 510 +++++++++++++
 drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 618 ++++++++++++++++
 drivers/net/atlantic/meson.build                |   2 +
 6 files changed, 2169 insertions(+)
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_utils.c
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_utils.h
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c
drivers/net/atlantic/Makefile +2 -0
index cae317badc0c..a291053b5ab7 100644
@@ -26,6 +26,8 @@ VPATH += $(SRCDIR)/hw_atl
 #
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_hw_regs.c
+SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_utils.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_llh.c
+SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_utils_fw2x.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/atlantic/atl_types.h +95 -0

103 lines not on this page · raw message

drivers/net/atlantic/hw_atl/hw_atl_utils.c new file +942 -0

942 lines not on this page · raw message

drivers/net/atlantic/hw_atl/hw_atl_utils.h new file +510 -0

510 lines not on this page · raw message

drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c new file +618 -0

618 lines not on this page · raw message

drivers/net/atlantic/meson.build +2 -0
index f3193b75b650..919cf6e4f20a 100644
@@ -7,6 +7,8 @@ sources = files(
 	'atl_ethdev.c',
 	'atl_hw_regs.c',
 	'hw_atl/hw_atl_llh.c',
+	'hw_atl/hw_atl_utils_fw2x.c',
+	'hw_atl/hw_atl_utils.c',
 )
 
 deps += ['eal']
Signature · 1 line
2.7.4
#8 lore raw

PATCH v3 6/22 net/atlantic: b0 hardware layer main logic

In reply to Igor Russkikh

This is hw_atl logic layer derived from linux atlantic driver. It contains RX/TX hardware initialization sequences, various hw configuration.

---
 drivers/net/atlantic/Makefile                    |   1 +
 drivers/net/atlantic/atl_types.h                 |  14 +
 drivers/net/atlantic/hw_atl/hw_atl_b0.c          | 510 +++++++++++++++++++++++
 drivers/net/atlantic/hw_atl/hw_atl_b0.h          |  40 ++
 drivers/net/atlantic/hw_atl/hw_atl_b0_internal.h | 145 +++++++
 drivers/net/atlantic/meson.build                 |   1 +
 6 files changed, 711 insertions(+)
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_b0.c
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_b0.h
 create mode 100644 drivers/net/atlantic/hw_atl/hw_atl_b0_internal.h
drivers/net/atlantic/Makefile +1 -0
index a291053b5ab7..91306d71ba97 100644
@@ -29,5 +29,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_hw_regs.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_utils.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_llh.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_utils_fw2x.c
+SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_b0.c
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/atlantic/atl_types.h +14 -0
index 589088a82227..8185a86e1733 100644
@@ -8,6 +8,7 @@
 #include <stddef.h>
 #include <inttypes.h>
 #include <string.h>
+#include <netinet/in.h>
 
 typedef uint8_t		u8;
 typedef int8_t		s8;
@@ -28,6 +29,7 @@ typedef int		bool;
 #define min(a, b)	RTE_MIN(a, b)
 #define max(a, b)	RTE_MAX(a, b)
 
+#include "hw_atl/hw_atl_b0_internal.h"
 #include "hw_atl/hw_atl_utils.h"
 
 struct aq_hw_link_status_s {
@@ -56,8 +58,18 @@ struct aq_stats_s {
 	u64 dma_oct_tc;
 };
 
+struct aq_rss_parameters {
+	u16 base_cpu_number;
+	u16 indirection_table_size;
+	u16 hash_secret_key_size;
+	u32 hash_secret_key[HW_ATL_B0_RSS_HASHKEY_BITS / 8];
+	u8 indirection_table[HW_ATL_B0_RSS_REDIRECTION_MAX];
+};
+
 struct aq_hw_cfg_s {
 	bool is_lro;
+	bool is_rss;
+	unsigned int num_rss_queues;
 	int wol;
 
 	int link_speed_msk;
@@ -66,6 +78,8 @@ struct aq_hw_cfg_s {
 	unsigned int vecs;
 
 	uint32_t flow_control;
+
+	struct aq_rss_parameters aq_rss;
 };
 
 struct aq_hw_s {
drivers/net/atlantic/hw_atl/hw_atl_b0.c new file +510 -0

510 lines not on this page · raw message

drivers/net/atlantic/hw_atl/hw_atl_b0.h new file +40 -0
new file mode 100644
index 000000000000..06feb56c1620
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) */
+/* Copyright (C) 2014-2017 aQuantia Corporation. */
+
+/* File hw_atl_b0.h: Declaration of abstract interface for Atlantic hardware
+ * specific functions.
+ */
+
+#ifndef HW_ATL_B0_H
+#define HW_ATL_B0_H
+
+int hw_atl_b0_hw_reset(struct aq_hw_s *self);
+int hw_atl_b0_hw_init(struct aq_hw_s *self, u8 *mac_addr);
+
+int hw_atl_b0_hw_ring_tx_init(struct aq_hw_s *self, uint64_t base_addr,
+		int index, int size, int cpu, int vec);
+int hw_atl_b0_hw_ring_rx_init(struct aq_hw_s *self, uint64_t base_addr,
+		int index, int size, int buff_size, int cpu, int vec);
+
+int hw_atl_b0_hw_start(struct aq_hw_s *self);
+
+int hw_atl_b0_hw_ring_rx_start(struct aq_hw_s *self, int index);
+int hw_atl_b0_hw_ring_tx_start(struct aq_hw_s *self, int index);
+
+
+int hw_atl_b0_hw_ring_tx_stop(struct aq_hw_s *self, int index);
+int hw_atl_b0_hw_ring_rx_stop(struct aq_hw_s *self, int index);
+
+
+int hw_atl_b0_hw_tx_ring_tail_update(struct aq_hw_s *self, int tail, int index);
+
+int hw_atl_b0_hw_rss_hash_set(struct aq_hw_s *self,
+				     struct aq_rss_parameters *rss_params);
+int hw_atl_b0_hw_rss_set(struct aq_hw_s *self,
+				struct aq_rss_parameters *rss_params);
+
+int hw_atl_b0_hw_irq_enable(struct aq_hw_s *self, u64 mask);
+int hw_atl_b0_hw_irq_disable(struct aq_hw_s *self, u64 mask);
+int hw_atl_b0_hw_irq_read(struct aq_hw_s *self, u64 *mask);
+
+#endif /* HW_ATL_B0_H */
drivers/net/atlantic/hw_atl/hw_atl_b0_internal.h new file +145 -0

145 lines not on this page · raw message

drivers/net/atlantic/meson.build +1 -0
index 919cf6e4f20a..e7b4e0cba574 100644
@@ -6,6 +6,7 @@
 sources = files(
 	'atl_ethdev.c',
 	'atl_hw_regs.c',
+	'hw_atl/hw_atl_b0.c',
 	'hw_atl/hw_atl_llh.c',
 	'hw_atl/hw_atl_utils_fw2x.c',
 	'hw_atl/hw_atl_utils.c',
Signature · 1 line
2.7.4
#9 lore raw

PATCH v3 7/22 net/atlantic: rte device start, stop, initial configuration

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

Start, stop and reset are all done via hw_atl layer. Link interrupt configuration is also done here.

---
 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(-)
drivers/net/atlantic/atl_ethdev.c +189 -7
index 5728d9037d72..afb2972ffcc2 100644
@@ -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 *)&eth_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);
+}
+
drivers/net/atlantic/atl_ethdev.h +8 -0
index ae87517560de..0b5db79e1c22 100644
@@ -6,10 +6,18 @@
 #define _ATLANTIC_ETHDEV_H_
 #include <rte_tm_driver.h>
 
+#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_ */
drivers/net/atlantic/atl_types.h +4 -0
index 8185a86e1733..85f768ce7d93 100644
@@ -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;
Signature · 1 line
2.7.4
#10 lore raw

PATCH v3 8/22 net/atlantic: TX/RX function prototypes

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/Makefile     |  1 +
 drivers/net/atlantic/atl_ethdev.c | 20 ++++++++++++++++++-
 drivers/net/atlantic/atl_ethdev.h | 15 ++++++++++++++
 drivers/net/atlantic/atl_rxtx.c   | 42 +++++++++++++++++++++++++++++++++++++++
 drivers/net/atlantic/meson.build  |  1 +
 5 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/atlantic/atl_rxtx.c
drivers/net/atlantic/Makefile +1 -0
index 91306d71ba97..b88da362146d 100644
@@ -24,6 +24,7 @@ VPATH += $(SRCDIR)/hw_atl
 #
 # all source are stored in SRCS-y
 #
+SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += atl_hw_regs.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_utils.c
drivers/net/atlantic/atl_ethdev.c +19 -1
index afb2972ffcc2..4347f9772358 100644
@@ -111,6 +111,9 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev)
 	PMD_INIT_FUNC_TRACE();
 
 	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)
@@ -164,6 +167,8 @@ eth_atl_dev_uninit(struct rte_eth_dev *eth_dev)
 		atl_dev_close(eth_dev);
 
 	eth_dev->dev_ops = NULL;
+	eth_dev->rx_pkt_burst = NULL;
+	eth_dev->tx_pkt_burst = NULL;
 
 	rte_free(eth_dev->data->mac_addrs);
 	eth_dev->data->mac_addrs = NULL;
@@ -224,10 +229,23 @@ atl_dev_start(struct rte_eth_dev *dev)
 	err = hw_atl_b0_hw_init(hw, (uint8_t *)dev->data->mac_addrs);
 
 	hw_atl_b0_hw_start(hw);
+	/* initialize transmission unit */
+	atl_tx_init(dev);
+
+	/* This can fail when allocating mbufs for descriptor rings */
+	err = atl_rx_init(dev);
+	if (err) {
+		PMD_INIT_LOG(ERR, "Unable to initialize RX hardware");
+		goto error;
+	}
 
 	atl_print_adapter_info(hw);
 
-	return err;
+	return 0;
+
+error:
+	PMD_INIT_LOG(ERR, "failure in atl_dev_start(): %d", err);
+	return -EIO;
 }
 
 /*
drivers/net/atlantic/atl_ethdev.h +15 -0
index 0b5db79e1c22..53fbc0a17bd2 100644
@@ -20,4 +20,19 @@ struct atl_adapter {
 	struct aq_hw_cfg_s         hw_cfg;
 };
 
+/*
+ * RX/TX function prototypes
+ */
+int atl_rx_init(struct rte_eth_dev *dev);
+int atl_tx_init(struct rte_eth_dev *dev);
+
+uint16_t atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+		uint16_t nb_pkts);
+
+uint16_t atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+		uint16_t nb_pkts);
+
+uint16_t atl_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+		uint16_t nb_pkts);
+
 #endif /* _ATLANTIC_ETHDEV_H_ */
drivers/net/atlantic/atl_rxtx.c new file +42 -0

42 lines not on this page · raw message

drivers/net/atlantic/meson.build +1 -0
index e7b4e0cba574..7575e471e306 100644
@@ -4,6 +4,7 @@
 #subdir('hw_atl')
 
 sources = files(
+	'atl_rxtx.c',
 	'atl_ethdev.c',
 	'atl_hw_regs.c',
 	'hw_atl/hw_atl_b0.c',
Signature · 1 line
2.7.4
#11 lore raw

PATCH v3 9/22 net/atlantic: RX side structures and implementation

In reply to Igor Russkikh
---
 drivers/net/atlantic/Makefile     |   2 +-
 drivers/net/atlantic/atl_ethdev.c |  71 +++++
 drivers/net/atlantic/atl_ethdev.h |  19 ++
 drivers/net/atlantic/atl_rxtx.c   | 616 +++++++++++++++++++++++++++++++++++++-
 4 files changed, 702 insertions(+), 6 deletions(-)
drivers/net/atlantic/Makefile +1 -1
index b88da362146d..62dcdbffa69c 100644
@@ -15,7 +15,7 @@ EXPORT_MAP := rte_pmd_atlantic_version.map
 
 LIBABIVER := 1
 
-LDLIBS += -lrte_eal
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net
 LDLIBS += -lrte_bus_pci
 
drivers/net/atlantic/atl_ethdev.c +71 -0

124 lines not on this page · raw message

drivers/net/atlantic/atl_ethdev.h +19 -0
index 53fbc0a17bd2..acb3066c189f 100644
@@ -12,6 +12,10 @@
 #define ATL_DEV_PRIVATE_TO_HW(adapter) \
 	(&((struct atl_adapter *)adapter)->hw)
 
+#define ATL_DEV_TO_ADAPTER(dev) \
+	((struct atl_adapter *)(dev)->data->dev_private)
+
+
 /*
  * Structure to store private data for each driver instance (for each port).
  */
@@ -23,9 +27,24 @@ struct atl_adapter {
 /*
  * RX/TX function prototypes
  */
+void atl_rx_queue_release(void *rxq);
+
+int atl_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);
+
 int atl_rx_init(struct rte_eth_dev *dev);
 int atl_tx_init(struct rte_eth_dev *dev);
 
+int atl_start_queues(struct rte_eth_dev *dev);
+int atl_stop_queues(struct rte_eth_dev *dev);
+void atl_free_queues(struct rte_eth_dev *dev);
+
+int atl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int atl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+
+
 uint16_t atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
drivers/net/atlantic/atl_rxtx.c +611 -5

643 lines not on this page · raw message

Signature · 1 line
2.7.4
#12 lore raw

PATCH v3 10/22 net/atlantic: TX side structures and implementation

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/atl_ethdev.c |  28 ++
 drivers/net/atlantic/atl_ethdev.h |   7 +
 drivers/net/atlantic/atl_rxtx.c   | 530 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 556 insertions(+), 9 deletions(-)
drivers/net/atlantic/atl_ethdev.c +28 -0
index cdcfc5ec02c2..6a00277c3c8e 100644
@@ -79,12 +79,27 @@ static struct rte_pci_driver rte_atl_pmd = {
 			| DEV_RX_OFFLOAD_TCP_CKSUM \
 			| DEV_RX_OFFLOAD_JUMBO_FRAME)
 
+#define ATL_TX_OFFLOADS (DEV_TX_OFFLOAD_VLAN_INSERT \
+			| DEV_TX_OFFLOAD_IPV4_CKSUM \
+			| DEV_TX_OFFLOAD_UDP_CKSUM \
+			| DEV_TX_OFFLOAD_TCP_CKSUM \
+			| DEV_TX_OFFLOAD_TCP_TSO \
+			| DEV_TX_OFFLOAD_MULTI_SEGS)
+
 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,
@@ -101,6 +116,11 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	.rx_queue_stop	      = atl_rx_queue_stop,
 	.rx_queue_setup       = atl_rx_queue_setup,
 	.rx_queue_release     = atl_rx_queue_release,
+
+	.tx_queue_start	      = atl_tx_queue_start,
+	.tx_queue_stop	      = atl_tx_queue_stop,
+	.tx_queue_setup       = atl_tx_queue_setup,
+	.tx_queue_release     = atl_tx_queue_release,
 };
 
 static inline int32_t
@@ -369,11 +389,19 @@ atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->rx_offload_capa = ATL_RX_OFFLOADS;
 
+	dev_info->tx_offload_capa = ATL_TX_OFFLOADS;
+
+
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
 		.rx_free_thresh = ATL_DEFAULT_RX_FREE_THRESH,
 	};
 
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_free_thresh = ATL_DEFAULT_TX_FREE_THRESH,
+	};
+
 	dev_info->rx_desc_lim = rx_desc_lim;
+	dev_info->tx_desc_lim = tx_desc_lim;
 }
 
 static const uint32_t *
drivers/net/atlantic/atl_ethdev.h +7 -0
index acb3066c189f..cafe37cdf963 100644
@@ -28,12 +28,17 @@ struct atl_adapter {
  * RX/TX function prototypes
  */
 void atl_rx_queue_release(void *rxq);
+void atl_tx_queue_release(void *txq);
 
 int atl_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);
 
+int atl_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);
+
 int atl_rx_init(struct rte_eth_dev *dev);
 int atl_tx_init(struct rte_eth_dev *dev);
 
@@ -44,6 +49,8 @@ void atl_free_queues(struct rte_eth_dev *dev);
 int atl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int atl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 
+int atl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int atl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 uint16_t atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
drivers/net/atlantic/atl_rxtx.c +521 -9

609 lines not on this page · raw message

Signature · 1 line
2.7.4
#13 lore raw

PATCH v3 11/22 net/atlantic: link status and interrupt management

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

Implement link interrupt, link info, link polling.

---
 drivers/net/atlantic/atl_ethdev.c | 461 +++++++++++++++++++++++++++++++++++++-
 drivers/net/atlantic/atl_ethdev.h |  16 ++
 drivers/net/atlantic/atl_rxtx.c   |  36 +++
 drivers/net/atlantic/atl_types.h  |   2 +
 4 files changed, 514 insertions(+), 1 deletion(-)
drivers/net/atlantic/atl_ethdev.c +460 -1
index 6a00277c3c8e..75c9fa169925 100644
@@ -18,8 +18,11 @@ 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 int  atl_dev_set_link_up(struct rte_eth_dev *dev);
+static int  atl_dev_set_link_down(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_link_update(struct rte_eth_dev *dev, int wait);
 
 static int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 			      size_t fw_size);
@@ -29,6 +32,16 @@ static void atl_dev_info_get(struct rte_eth_dev *dev,
 
 static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
+static void atl_dev_link_status_print(struct rte_eth_dev *dev);
+
+/* Interrupts */
+static int atl_dev_rxq_interrupt_setup(struct rte_eth_dev *dev);
+static int atl_dev_lsc_interrupt_setup(struct rte_eth_dev *dev, uint8_t on);
+static int atl_dev_interrupt_get_status(struct rte_eth_dev *dev);
+static int atl_dev_interrupt_action(struct rte_eth_dev *dev,
+				    struct rte_intr_handle *handle);
+static void atl_dev_interrupt_handler(void *param);
+
 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);
@@ -104,9 +117,14 @@ 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_set_link_up      = atl_dev_set_link_up,
+	.dev_set_link_down    = atl_dev_set_link_down,
 	.dev_close	      = atl_dev_close,
 	.dev_reset	      = atl_dev_reset,
 
+	/* Link */
+	.link_update	      = atl_dev_link_update,
+
 	.fw_version_get       = atl_fw_version_get,
 	.dev_infos_get	      = atl_dev_info_get,
 	.dev_supported_ptypes_get = atl_dev_supported_ptypes_get,
@@ -121,14 +139,85 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	.tx_queue_stop	      = atl_tx_queue_stop,
 	.tx_queue_setup       = atl_tx_queue_setup,
 	.tx_queue_release     = atl_tx_queue_release,
+
+	.rx_queue_intr_enable = atl_dev_rx_queue_intr_enable,
+	.rx_queue_intr_disable = atl_dev_rx_queue_intr_disable,
 };
 
+
+/**
+ * Atomically reads the link status information from global
+ * structure rte_eth_dev.
+ *
+ * @param dev
+ *   - Pointer to the structure rte_eth_dev to read from.
+ *   - Pointer to the buffer to be saved with the link status.
+ *
+ * @return
+ *   - On success, zero.
+ *   - On failure, negative value.
+ */
+static inline int
+rte_atl_dev_atomic_read_link_status(struct rte_eth_dev *dev,
+				struct rte_eth_link *link)
+{
+	struct rte_eth_link *dst = link;
+	struct rte_eth_link *src = &dev->data->dev_link;
+
+	if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
+					*(uint64_t *)src) == 0)
+		return -1;
+
+	return 0;
+}
+
+/**
+ * Atomically writes the link status information into global
+ * structure rte_eth_dev.
+ *
+ * @param dev
+ *   - Pointer to the structure rte_eth_dev to read from.
+ *   - Pointer to the buffer to be saved with the link status.
+ *
+ * @return
+ *   - On success, zero.
+ *   - On failure, negative value.
+ */
+static inline int
+rte_atl_dev_atomic_write_link_status(struct rte_eth_dev *dev,
+				struct rte_eth_link *link)
+{
+	struct rte_eth_link *dst = &dev->data->dev_link;
+	struct rte_eth_link *src = link;
+
+	if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
+					*(uint64_t *)src) == 0)
+		return -1;
+
+	return 0;
+}
+
 static inline int32_t
 atl_reset_hw(struct aq_hw_s *hw)
 {
 	return hw_atl_b0_hw_reset(hw);
 }
 
+static inline void
+atl_enable_intr(struct rte_eth_dev *dev)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw_atl_itr_irq_msk_setlsw_set(hw, 0xffffffff);
+}
+
+static void
+atl_disable_intr(struct aq_hw_s *hw)
+{
+	PMD_INIT_FUNC_TRACE();
+	hw_atl_itr_irq_msk_clearlsw_set(hw, 0xffffffff);
+}
+
 static void
 atl_print_adapter_info(struct aq_hw_s *hw __rte_unused)
 {
@@ -145,6 +234,7 @@ 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;
 
@@ -169,9 +259,17 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev)
 	/* Hardware configuration - hardcode */
 	adapter->hw_cfg.is_lro = false;
 	adapter->hw_cfg.wol = false;
+	adapter->hw_cfg.link_speed_msk = AQ_NIC_RATE_10G |
+			  AQ_NIC_RATE_5G |
+			  AQ_NIC_RATE_2G5 |
+			  AQ_NIC_RATE_1G |
+			  AQ_NIC_RATE_100M;
 
 	hw->aq_nic_cfg = &adapter->hw_cfg;
 
+	/* disable interrupt */
+	atl_disable_intr(hw);
+
 	/* 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) {
@@ -188,12 +286,23 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev)
 			(u8 *)&eth_dev->data->mac_addrs[0]) != 0)
 		return -EINVAL;
 
+	rte_intr_callback_register(intr_handle,
+				   atl_dev_interrupt_handler, eth_dev);
+
+	/* enable uio/vfio intr/eventfd mapping */
+	rte_intr_enable(intr_handle);
+
+	/* enable support intr */
+	atl_enable_intr(eth_dev);
+
 	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;
 
 	PMD_INIT_FUNC_TRACE();
@@ -210,6 +319,11 @@ eth_atl_dev_uninit(struct rte_eth_dev *eth_dev)
 	eth_dev->rx_pkt_burst = NULL;
 	eth_dev->tx_pkt_burst = NULL;
 
+	/* disable uio intr before callback unregister */
+	rte_intr_disable(intr_handle);
+	rte_intr_callback_unregister(intr_handle,
+				     atl_dev_interrupt_handler, eth_dev);
+
 	rte_free(eth_dev->data->mac_addrs);
 	eth_dev->data->mac_addrs = NULL;
 
@@ -238,8 +352,16 @@ eth_atl_pci_remove(struct rte_pci_device *pci_dev)
 }
 
 static int
-atl_dev_configure(struct rte_eth_dev *dev __rte_unused)
+atl_dev_configure(struct rte_eth_dev *dev)
 {
+	struct atl_interrupt *intr =
+		ATL_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* set flag to update link status after init */
+	intr->flags |= ATL_FLAG_NEED_LINK_UPDATE;
+
 	return 0;
 }
 
@@ -251,11 +373,26 @@ 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 status;
 	int err;
 
 	PMD_INIT_FUNC_TRACE();
 
+	if (dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED) {
+		PMD_INIT_LOG(ERR,
+		"Invalid link_speeds for port %u, fix speed not supported",
+				dev->data->port_id);
+		return -EINVAL;
+	}
+
+	/* disable uio/vfio intr/eventfd mapping */
+	rte_intr_disable(intr_handle);
+
 	/* stop adapter */
 	hw->adapter_stopped = 0;
 
@@ -269,6 +406,32 @@ atl_dev_start(struct rte_eth_dev *dev)
 	err = hw_atl_b0_hw_init(hw, (uint8_t *)dev->data->mac_addrs);
 
 	hw_atl_b0_hw_start(hw);
+	/* 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) {
+			PMD_INIT_LOG(ERR, "At most %d intr queues supported",
+					ATL_MAX_INTR_QUEUE_NUM);
+			return -ENOTSUP;
+		}
+		if (rte_intr_efd_enable(intr_handle, intr_vector)) {
+			PMD_INIT_LOG(ERR, "rte_intr_efd_enable failed");
+			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) {
+			PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues"
+				     " intr_vec", dev->data->nb_rx_queues);
+			return -ENOMEM;
+		}
+	}
+
 	/* initialize transmission unit */
 	atl_tx_init(dev);
 
@@ -285,6 +448,61 @@ atl_dev_start(struct rte_eth_dev *dev)
 		goto error;
 	}
 
+	err = hw->aq_fw_ops->update_link_status(hw);
+
+	if (err)
+		goto error;
+
+	dev->data->dev_link.link_status = hw->aq_link_status.mbps != 0;
+
+	link_speeds = &dev->data->dev_conf.link_speeds;
+
+	speed = 0x0;
+
+	if (*link_speeds == ETH_LINK_SPEED_AUTONEG) {
+		speed = hw->aq_nic_cfg->link_speed_msk;
+	} else {
+		if (*link_speeds & ETH_LINK_SPEED_10G)
+			speed |= AQ_NIC_RATE_10G;
+		if (*link_speeds & ETH_LINK_SPEED_5G)
+			speed |= AQ_NIC_RATE_5G;
+		if (*link_speeds & ETH_LINK_SPEED_1G)
+			speed |= AQ_NIC_RATE_1G;
+		if (*link_speeds & ETH_LINK_SPEED_2_5G)
+			speed |=  AQ_NIC_RATE_2G5;
+		if (*link_speeds & ETH_LINK_SPEED_100M)
+			speed |= AQ_NIC_RATE_100M;
+	}
+
+	err = hw->aq_fw_ops->set_link_speed(hw, speed);
+	if (err)
+		goto error;
+
+	if (rte_intr_allow_others(intr_handle)) {
+		/* check if lsc interrupt is enabled */
+		if (dev->data->dev_conf.intr_conf.lsc != 0)
+			atl_dev_lsc_interrupt_setup(dev, TRUE);
+		else
+			atl_dev_lsc_interrupt_setup(dev, FALSE);
+	} else {
+		rte_intr_callback_unregister(intr_handle,
+					     atl_dev_interrupt_handler, dev);
+		if (dev->data->dev_conf.intr_conf.lsc != 0)
+			PMD_INIT_LOG(INFO, "lsc won't enable because of"
+				     " no intr multiplex");
+	}
+
+	/* check if rxq interrupt is enabled */
+	if (dev->data->dev_conf.intr_conf.rxq != 0 &&
+	    rte_intr_dp_is_en(intr_handle))
+		atl_dev_rxq_interrupt_setup(dev);
+
+	/* enable uio/vfio intr/eventfd mapping */
+	rte_intr_enable(intr_handle);
+
+	/* resume enabled intr since hw reset */
+	atl_enable_intr(dev);
+
 	atl_print_adapter_info(hw);
 
 	return 0;
@@ -301,8 +519,16 @@ atl_dev_start(struct rte_eth_dev *dev)
 static void
 atl_dev_stop(struct rte_eth_dev *dev)
 {
+	struct rte_eth_link link;
 	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;
+
+	PMD_INIT_FUNC_TRACE();
+
+	/* disable interrupts */
+	atl_disable_intr(hw);
 
 	/* reset the NIC */
 	atl_reset_hw(hw);
@@ -314,6 +540,45 @@ atl_dev_stop(struct rte_eth_dev *dev)
 	dev->data->scattered_rx = 0;
 	dev->data->lro = 0;
 
+	/* Clear recorded link status */
+	memset(&link, 0, sizeof(link));
+	rte_atl_dev_atomic_write_link_status(dev, &link);
+
+	if (!rte_intr_allow_others(intr_handle))
+		/* resume to the default handler */
+		rte_intr_callback_register(intr_handle,
+					   atl_dev_interrupt_handler,
+					   (void *)dev);
+
+	/* Clean datapath event and queue/vec mapping */
+	rte_intr_efd_disable(intr_handle);
+	if (intr_handle->intr_vec != NULL) {
+		rte_free(intr_handle->intr_vec);
+		intr_handle->intr_vec = NULL;
+	}
+}
+
+/*
+ * Set device link up: enable tx.
+ */
+static int
+atl_dev_set_link_up(struct rte_eth_dev *dev)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	return hw->aq_fw_ops->set_link_speed(hw,
+			hw->aq_nic_cfg->link_speed_msk);
+}
+
+/*
+ * Set device link down: disable tx.
+ */
+static int
+atl_dev_set_link_down(struct rte_eth_dev *dev)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	return hw->aq_fw_ops->set_link_speed(hw, 0);
 }
 
 /*
@@ -402,6 +667,11 @@ atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->rx_desc_lim = rx_desc_lim;
 	dev_info->tx_desc_lim = tx_desc_lim;
+
+	dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G;
+	dev_info->speed_capa |= ETH_LINK_SPEED_100M;
+	dev_info->speed_capa |= ETH_LINK_SPEED_2_5G;
+	dev_info->speed_capa |= ETH_LINK_SPEED_5G;
 }
 
 static const uint32_t *
@@ -426,6 +696,195 @@ atl_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 	return NULL;
 }
 
+/* return 0 means link status changed, -1 means not changed */
+static int
+atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct atl_interrupt *intr =
+		ATL_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
+	struct rte_eth_link link, old;
+	int err = 0;
+
+	link.link_status = ETH_LINK_DOWN;
+	link.link_speed = 0;
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_autoneg = hw->is_autoneg ? ETH_LINK_AUTONEG : ETH_LINK_FIXED;
+	memset(&old, 0, sizeof(old));
+
+	/* load old link status */
+	rte_atl_dev_atomic_read_link_status(dev, &old);
+
+	/* read current link status */
+	err = hw->aq_fw_ops->update_link_status(hw);
+
+	if (err)
+		return 0;
+
+	if (hw->aq_link_status.mbps == 0) {
+		/* write default (down) link status */
+		rte_atl_dev_atomic_write_link_status(dev, &link);
+		if (link.link_status == old.link_status)
+			return -1;
+		return 0;
+	}
+
+	intr->flags &= ~ATL_FLAG_NEED_LINK_CONFIG;
+
+	link.link_status = ETH_LINK_UP;
+	link.link_duplex = ETH_LINK_FULL_DUPLEX;
+	link.link_speed = hw->aq_link_status.mbps;
+
+	rte_atl_dev_atomic_write_link_status(dev, &link);
+
+	if (link.link_status == old.link_status)
+		return -1;
+
+	return 0;
+}
+
+
+/**
+ * It clears the interrupt causes and enables the interrupt.
+ * It will be called once only during nic initialized.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ * @param on
+ *  Enable or Disable.
+ *
+ * @return
+ *  - On success, zero.
+ *  - On failure, a negative value.
+ */
+
+static int
+atl_dev_lsc_interrupt_setup(struct rte_eth_dev *dev, uint8_t on __rte_unused)
+{
+	atl_dev_link_status_print(dev);
+	return 0;
+}
+
+static int
+atl_dev_rxq_interrupt_setup(struct rte_eth_dev *dev __rte_unused)
+{
+	return 0;
+}
+
+
+static int
+atl_dev_interrupt_get_status(struct rte_eth_dev *dev)
+{
+	struct atl_interrupt *intr =
+		ATL_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u64 cause = 0;
+
+	hw_atl_b0_hw_irq_read(hw, &cause);
+
+	atl_disable_intr(hw);
+	intr->flags = cause & BIT(ATL_IRQ_CAUSE_LINK) ?
+			ATL_FLAG_NEED_LINK_UPDATE : 0;
+
+	return 0;
+}
+
+/**
+ * It gets and then prints the link status.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ *
+ * @return
+ *  - On success, zero.
+ *  - On failure, a negative value.
+ */
+static void
+atl_dev_link_status_print(struct rte_eth_dev *dev)
+{
+	struct rte_eth_link link;
+
+	memset(&link, 0, sizeof(link));
+	rte_atl_dev_atomic_read_link_status(dev, &link);
+	if (link.link_status) {
+		PMD_DRV_LOG(INFO, "Port %d: Link Up - speed %u Mbps - %s",
+					(int)(dev->data->port_id),
+					(unsigned int)link.link_speed,
+			link.link_duplex == ETH_LINK_FULL_DUPLEX ?
+					"full-duplex" : "half-duplex");
+	} else {
+		PMD_DRV_LOG(INFO, " Port %d: Link Down",
+				(int)(dev->data->port_id));
+	}
+
+
+#ifdef DEBUG
+{
+	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+
+	PMD_DRV_LOG(DEBUG, "PCI Address: " PCI_PRI_FMT,
+				pci_dev->addr.domain,
+				pci_dev->addr.bus,
+				pci_dev->addr.devid,
+				pci_dev->addr.function);
+}
+#endif
+
+	PMD_DRV_LOG(INFO, "Link speed:%d", link.link_speed);
+}
+
+/*
+ * It executes link_update after knowing an interrupt occurred.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ *
+ * @return
+ *  - On success, zero.
+ *  - On failure, a negative value.
+ */
+static int
+atl_dev_interrupt_action(struct rte_eth_dev *dev,
+			   struct rte_intr_handle *intr_handle)
+{
+	struct atl_interrupt *intr =
+		ATL_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
+
+	if (intr->flags & ATL_FLAG_NEED_LINK_UPDATE) {
+		atl_dev_link_update(dev, 0);
+		intr->flags &= ~ATL_FLAG_NEED_LINK_UPDATE;
+		atl_dev_link_status_print(dev);
+		_rte_eth_dev_callback_process(dev,
+			RTE_ETH_EVENT_INTR_LSC, NULL);
+	}
+
+	atl_enable_intr(dev);
+	rte_intr_enable(intr_handle);
+
+	return 0;
+}
+
+/**
+ * Interrupt handler triggered by NIC  for handling
+ * specific interrupt.
+ *
+ * @param handle
+ *  Pointer to interrupt handle.
+ * @param param
+ *  The address of parameter (struct rte_eth_dev *) regsitered before.
+ *
+ * @return
+ *  void
+ */
+static void
+atl_dev_interrupt_handler(void *param)
+{
+	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+
+	atl_dev_interrupt_get_status(dev);
+	atl_dev_interrupt_action(dev, dev->intr_handle);
+}
+
 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");
drivers/net/atlantic/atl_ethdev.h +16 -0
index cafe37cdf963..f75ed0fd1127 100644
@@ -15,6 +15,16 @@
 #define ATL_DEV_TO_ADAPTER(dev) \
 	((struct atl_adapter *)(dev)->data->dev_private)
 
+#define ATL_DEV_PRIVATE_TO_INTR(adapter) \
+	(&((struct atl_adapter *)adapter)->intr)
+
+#define ATL_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
+#define ATL_FLAG_NEED_LINK_CONFIG (uint32_t)(4 << 0)
+
+struct atl_interrupt {
+	uint32_t flags;
+	uint32_t mask;
+};
 
 /*
  * Structure to store private data for each driver instance (for each port).
@@ -22,6 +32,7 @@
 struct atl_adapter {
 	struct aq_hw_s             hw;
 	struct aq_hw_cfg_s         hw_cfg;
+	struct atl_interrupt       intr;
 };
 
 /*
@@ -39,6 +50,11 @@ int atl_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);
 
+int atl_dev_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
+				 uint16_t queue_id);
+int atl_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
+				  uint16_t queue_id);
+
 int atl_rx_init(struct rte_eth_dev *dev);
 int atl_tx_init(struct rte_eth_dev *dev);
 
drivers/net/atlantic/atl_rxtx.c +36 -0
index 172d5fb232f2..9d82a0d74f22 100644
@@ -620,6 +620,42 @@ atl_stop_queues(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+atl_rx_enable_intr(struct rte_eth_dev *dev, uint16_t queue_id, bool enable)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct atl_rx_queue *rxq;
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (queue_id >= dev->data->nb_rx_queues) {
+		PMD_DRV_LOG(ERR, "Invalid RX queue id=%d", queue_id);
+		return -EINVAL;
+	}
+
+	rxq = dev->data->rx_queues[queue_id];
+
+	if (rxq == NULL)
+		return 0;
+
+	/* Mapping interrupt vector */
+	hw_atl_itr_irq_map_en_rx_set(hw, enable, queue_id);
+
+	return 0;
+}
+
+int
+atl_dev_rx_queue_intr_enable(struct rte_eth_dev *eth_dev, uint16_t queue_id)
+{
+	return atl_rx_enable_intr(eth_dev, queue_id, true);
+}
+
+int
+atl_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev, uint16_t queue_id)
+{
+	return atl_rx_enable_intr(eth_dev, queue_id, false);
+}
+
 uint16_t
 atl_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
 	      uint16_t nb_pkts)
drivers/net/atlantic/atl_types.h +2 -0
index 85f768ce7d93..5f840cc8d63d 100644
@@ -93,11 +93,13 @@ struct aq_hw_s {
 	void *mmio;
 
 	struct aq_hw_link_status_s aq_link_status;
+	bool is_autoneg;
 
 	struct hw_aq_atl_utils_mbox mbox;
 	struct hw_atl_stats_s last_stats;
 	struct aq_stats_s curr_stats;
 
+	u64 speed;
 	unsigned int chip_features;
 	u32 fw_ver_actual;
 	u32 mbox_addr;
Signature · 1 line
2.7.4
#14 lore raw

PATCH v3 12/22 net/atlantic: device statistics, xstats

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/atl_ethdev.c | 154 ++++++++++++++++++++++++++++++++++++++
 drivers/net/atlantic/atl_ethdev.h |   1 +
 drivers/net/atlantic/atl_rxtx.c   |  11 ++-
 drivers/net/atlantic/atl_types.h  |  41 ++++++++++
 4 files changed, 206 insertions(+), 1 deletion(-)
drivers/net/atlantic/atl_ethdev.c +154 -0
index 75c9fa169925..fc1d862042d2 100644
@@ -24,6 +24,24 @@ static void atl_dev_close(struct rte_eth_dev *dev);
 static int  atl_dev_reset(struct rte_eth_dev *dev);
 static int  atl_dev_link_update(struct rte_eth_dev *dev, int wait);
 
+static int atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
+				    struct rte_eth_xstat_name *xstats_names,
+				    unsigned int size);
+
+static int atl_dev_stats_get(struct rte_eth_dev *dev,
+				struct rte_eth_stats *stats);
+
+static int atl_dev_xstats_get(struct rte_eth_dev *dev,
+			      struct rte_eth_xstat *stats, unsigned int n);
+
+static void atl_dev_stats_reset(struct rte_eth_dev *dev);
+static void atl_dev_xstats_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 int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 			      size_t fw_size);
 
@@ -113,6 +131,33 @@ static const struct rte_eth_desc_lim tx_desc_lim = {
 	.nb_mtu_seg_max = ATL_TX_MAX_SEG,
 };
 
+#define ATL_XSTATS_FIELD(name) { \
+	#name, \
+	offsetof(struct aq_stats_s, name) \
+}
+
+struct atl_xstats_tbl_s {
+	const char *name;
+	unsigned int offset;
+};
+
+static struct atl_xstats_tbl_s atl_xstats_tbl[] = {
+	ATL_XSTATS_FIELD(uprc),
+	ATL_XSTATS_FIELD(mprc),
+	ATL_XSTATS_FIELD(bprc),
+	ATL_XSTATS_FIELD(erpt),
+	ATL_XSTATS_FIELD(uptc),
+	ATL_XSTATS_FIELD(mptc),
+	ATL_XSTATS_FIELD(bptc),
+	ATL_XSTATS_FIELD(erpr),
+	ATL_XSTATS_FIELD(ubrc),
+	ATL_XSTATS_FIELD(ubtc),
+	ATL_XSTATS_FIELD(mbrc),
+	ATL_XSTATS_FIELD(mbtc),
+	ATL_XSTATS_FIELD(bbrc),
+	ATL_XSTATS_FIELD(bbtc),
+};
+
 static const struct eth_dev_ops atl_eth_dev_ops = {
 	.dev_configure	      = atl_dev_configure,
 	.dev_start	      = atl_dev_start,
@@ -125,6 +170,14 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	/* Link */
 	.link_update	      = atl_dev_link_update,
 
+	/* Stats */
+	.stats_get	      = atl_dev_stats_get,
+	.xstats_get	      = atl_dev_xstats_get,
+	.xstats_get_names     = atl_dev_xstats_get_names,
+	.stats_reset	      = atl_dev_stats_reset,
+	.xstats_reset	      = atl_dev_xstats_reset,
+	.queue_stats_mapping_set = atl_dev_queue_stats_mapping_set,
+
 	.fw_version_get       = atl_fw_version_get,
 	.dev_infos_get	      = atl_dev_info_get,
 	.dev_supported_ptypes_get = atl_dev_supported_ptypes_get,
@@ -286,6 +339,9 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev)
 			(u8 *)&eth_dev->data->mac_addrs[0]) != 0)
 		return -EINVAL;
 
+	/* Reset the hw statistics */
+	atl_dev_stats_reset(eth_dev);
+
 	rte_intr_callback_register(intr_handle,
 				   atl_dev_interrupt_handler, eth_dev);
 
@@ -613,6 +669,104 @@ atl_dev_reset(struct rte_eth_dev *dev)
 	return ret;
 }
 
+
+static int
+atl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+{
+	struct atl_adapter *adapter =
+		(struct atl_adapter *)dev->data->dev_private;
+	struct aq_hw_s *hw = &adapter->hw;
+	struct atl_sw_stats *swstats = &adapter->sw_stats;
+	unsigned int i;
+
+	hw->aq_fw_ops->update_stats(hw);
+
+	/* Fill out the rte_eth_stats statistics structure */
+	stats->ipackets = hw->curr_stats.dma_pkt_rc;
+	stats->ibytes = hw->curr_stats.dma_oct_rc;
+	stats->imissed = hw->curr_stats.dpc;
+	stats->ierrors = hw->curr_stats.erpt;
+
+	stats->opackets = hw->curr_stats.dma_pkt_tc;
+	stats->obytes = hw->curr_stats.dma_oct_tc;
+	stats->oerrors = 0;
+
+	stats->rx_nombuf = swstats->rx_nombuf;
+
+	for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
+		stats->q_ipackets[i] = swstats->q_ipackets[i];
+		stats->q_opackets[i] = swstats->q_opackets[i];
+		stats->q_ibytes[i] = swstats->q_ibytes[i];
+		stats->q_obytes[i] = swstats->q_obytes[i];
+		stats->q_errors[i] = swstats->q_errors[i];
+	}
+	return 0;
+}
+
+static void
+atl_dev_stats_reset(struct rte_eth_dev *dev)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw->aq_fw_ops->update_stats(hw);
+
+	/* Reset software totals */
+	memset(&hw->curr_stats, 0, sizeof(hw->curr_stats));
+}
+
+static int
+atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
+			 struct rte_eth_xstat_name *xstats_names,
+			 unsigned int size)
+{
+	unsigned int i;
+
+	if (!xstats_names)
+		return RTE_DIM(atl_xstats_tbl);
+
+	for (i = 0; i < size && i < RTE_DIM(atl_xstats_tbl); i++)
+		snprintf(xstats_names[i].name, RTE_ETH_XSTATS_NAME_SIZE, "%s",
+			atl_xstats_tbl[i].name);
+
+	return size;
+}
+
+static int
+atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
+		   unsigned int n)
+{
+	struct atl_adapter *adapter =
+		(struct atl_adapter *)dev->data->dev_private;
+	struct aq_hw_s *hw = &adapter->hw;
+	unsigned int i;
+
+	if (!stats)
+		return 0;
+
+	for (i = 0; i < n && i < RTE_DIM(atl_xstats_tbl); i++) {
+		stats[i].id = i;
+		stats[i].value = *(u64 *)((uint8_t *)&hw->curr_stats +
+					atl_xstats_tbl[i].offset);
+	}
+
+	return n;
+}
+
+static void
+atl_dev_xstats_reset(struct rte_eth_dev *dev __rte_unused)
+{
+}
+
+static int
+atl_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev __rte_unused,
+					     uint16_t queue_id __rte_unused,
+					     uint8_t stat_idx __rte_unused,
+					     uint8_t is_rx __rte_unused)
+{
+	/* The mapping is hardcoded: queue 0 -> stat 0, etc */
+	return 0;
+}
+
 static int
 atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 {
drivers/net/atlantic/atl_ethdev.h +1 -0
index f75ed0fd1127..90d63797b2c6 100644
@@ -32,6 +32,7 @@ struct atl_interrupt {
 struct atl_adapter {
 	struct aq_hw_s             hw;
 	struct aq_hw_cfg_s         hw_cfg;
+	struct atl_sw_stats        sw_stats;
 	struct atl_interrupt       intr;
 };
 
drivers/net/atlantic/atl_rxtx.c +10 -1
index 9d82a0d74f22..94054ca5c9fa 100644
@@ -843,7 +843,8 @@ atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 				   "queue_id=%u", (unsigned int)rxq->port_id,
 				   (unsigned int)rxq->queue_id);
 				dev->data->rx_mbuf_alloc_failed++;
-						goto err_stop;
+				adapter->sw_stats.rx_nombuf++;
+				goto err_stop;
 			}
 
 			nb_hold++;
@@ -926,6 +927,9 @@ atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 		 * of returned packets.
 		 */
 		rx_pkts[nb_rx++] = rx_mbuf_first;
+		adapter->sw_stats.q_ipackets[rxq->queue_id]++;
+		adapter->sw_stats.q_ibytes[rxq->queue_id] +=
+			rx_mbuf_first->pkt_len;
 
 		PMD_RX_LOG(ERR, "add mbuf segs=%d pkt_len=%d",
 			rx_mbuf_first->nb_segs,
@@ -1071,6 +1075,8 @@ static inline void
 atl_xmit_pkt(struct aq_hw_s *hw, struct atl_tx_queue *txq,
 	     struct rte_mbuf *tx_pkt)
 {
+	struct atl_adapter *adapter =
+		ATL_DEV_TO_ADAPTER(&rte_eth_devices[txq->port_id]);
 	uint32_t pay_len = 0;
 	int tail = 0;
 	struct atl_tx_entry *tx_entry;
@@ -1151,6 +1157,9 @@ atl_xmit_pkt(struct aq_hw_s *hw, struct atl_tx_queue *txq,
 	txq->tx_tail = tail;
 
 	txq->tx_free -= desc_count;
+
+	adapter->sw_stats.q_opackets[txq->queue_id]++;
+	adapter->sw_stats.q_obytes[txq->queue_id] += pay_len;
 }
 
 uint16_t
drivers/net/atlantic/atl_types.h +41 -0

45 lines not on this page · raw message

Signature · 1 line
2.7.4
#15 lore raw

PATCH v3 13/22 net/atlantic: support for RX/TX descriptors information

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/atl_ethdev.c |   8 +++
 drivers/net/atlantic/atl_ethdev.h |  12 ++++
 drivers/net/atlantic/atl_rxtx.c   | 125 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 145 insertions(+)
drivers/net/atlantic/atl_ethdev.c +8 -0
index fc1d862042d2..bc0cb3da1f66 100644
@@ -195,6 +195,14 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 
 	.rx_queue_intr_enable = atl_dev_rx_queue_intr_enable,
 	.rx_queue_intr_disable = atl_dev_rx_queue_intr_disable,
+
+	.rx_queue_count       = atl_rx_queue_count,
+	.rx_descriptor_done   = atl_dev_rx_descriptor_done,
+	.rx_descriptor_status = atl_dev_rx_descriptor_status,
+	.tx_descriptor_status = atl_dev_tx_descriptor_status,
+
+	.rxq_info_get	      = atl_rxq_info_get,
+	.txq_info_get	      = atl_txq_info_get,
 };
 
 
drivers/net/atlantic/atl_ethdev.h +12 -0
index 90d63797b2c6..17c8505e4707 100644
@@ -51,6 +51,12 @@ int atl_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);
 
+uint32_t atl_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+
+int atl_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
+int atl_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
+int atl_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
+
 int atl_dev_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
 				 uint16_t queue_id);
 int atl_dev_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
@@ -69,6 +75,12 @@ int atl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int atl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int atl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+void atl_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_rxq_info *qinfo);
+
+void atl_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+	struct rte_eth_txq_info *qinfo);
+
 uint16_t atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
drivers/net/atlantic/atl_rxtx.c +125 -0

131 lines not on this page · raw message

Signature · 1 line
2.7.4
#16 lore raw

PATCH v3 14/22 net/atlantic: promisc and allmulti configuration

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/atl_ethdev.c | 44 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
drivers/net/atlantic/atl_ethdev.c +44 -0
index bc0cb3da1f66..e71be3e14ca5 100644
@@ -22,6 +22,10 @@ static int  atl_dev_set_link_up(struct rte_eth_dev *dev);
 static int  atl_dev_set_link_down(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 void atl_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static void atl_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static void atl_dev_allmulticast_enable(struct rte_eth_dev *dev);
+static void atl_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int  atl_dev_link_update(struct rte_eth_dev *dev, int wait);
 
 static int atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
@@ -167,6 +171,12 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	.dev_close	      = atl_dev_close,
 	.dev_reset	      = atl_dev_reset,
 
+	/* PROMISC */
+	.promiscuous_enable   = atl_dev_promiscuous_enable,
+	.promiscuous_disable  = atl_dev_promiscuous_disable,
+	.allmulticast_enable  = atl_dev_allmulticast_enable,
+	.allmulticast_disable = atl_dev_allmulticast_disable,
+
 	/* Link */
 	.link_update	      = atl_dev_link_update,
 
@@ -905,6 +915,40 @@ atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)
 	return 0;
 }
 
+static void
+atl_dev_promiscuous_enable(struct rte_eth_dev *dev)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw_atl_rpfl2promiscuous_mode_en_set(hw, true);
+}
+
+static void
+atl_dev_promiscuous_disable(struct rte_eth_dev *dev)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw_atl_rpfl2promiscuous_mode_en_set(hw, false);
+}
+
+static void
+atl_dev_allmulticast_enable(struct rte_eth_dev *dev)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	hw_atl_rpfl2_accept_all_mc_packets_set(hw, true);
+}
+
+static void
+atl_dev_allmulticast_disable(struct rte_eth_dev *dev)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	if (dev->data->promiscuous == 1)
+		return; /* must remain in all_multicast mode */
+
+	hw_atl_rpfl2_accept_all_mc_packets_set(hw, false);
+}
 
 /**
  * It clears the interrupt causes and enables the interrupt.
Signature · 1 line
2.7.4
#17 lore raw

PATCH v3 15/22 net/atlantic: RSS and RETA manipulation API

In reply to Igor Russkikh
---
 drivers/net/atlantic/atl_ethdev.c | 107 ++++++++++++++++++++++++++++++++++++++
 drivers/net/atlantic/atl_ethdev.h |  14 +++++
 drivers/net/atlantic/atl_rxtx.c   |   5 ++
 3 files changed, 126 insertions(+)
drivers/net/atlantic/atl_ethdev.c +107 -0
index e71be3e14ca5..51e933a3559a 100644
@@ -64,6 +64,19 @@ static int atl_dev_interrupt_action(struct rte_eth_dev *dev,
 				    struct rte_intr_handle *handle);
 static void atl_dev_interrupt_handler(void *param);
 
+/* RSS */
+static int atl_reta_update(struct rte_eth_dev *dev,
+			     struct rte_eth_rss_reta_entry64 *reta_conf,
+			     uint16_t reta_size);
+static int atl_reta_query(struct rte_eth_dev *dev,
+			    struct rte_eth_rss_reta_entry64 *reta_conf,
+			    uint16_t reta_size);
+static int atl_rss_hash_update(struct rte_eth_dev *dev,
+				 struct rte_eth_rss_conf *rss_conf);
+static int atl_rss_hash_conf_get(struct rte_eth_dev *dev,
+				   struct rte_eth_rss_conf *rss_conf);
+
+
 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);
@@ -213,6 +226,11 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 
 	.rxq_info_get	      = atl_rxq_info_get,
 	.txq_info_get	      = atl_txq_info_get,
+
+	.reta_update          = atl_reta_update,
+	.reta_query           = atl_reta_query,
+	.rss_hash_update      = atl_rss_hash_update,
+	.rss_hash_conf_get    = atl_rss_hash_conf_get,
 };
 
 
@@ -330,12 +348,18 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev)
 	/* Hardware configuration - hardcode */
 	adapter->hw_cfg.is_lro = false;
 	adapter->hw_cfg.wol = false;
+	adapter->hw_cfg.is_rss = false;
+	adapter->hw_cfg.num_rss_queues = HW_ATL_B0_RSS_MAX;
+
 	adapter->hw_cfg.link_speed_msk = AQ_NIC_RATE_10G |
 			  AQ_NIC_RATE_5G |
 			  AQ_NIC_RATE_2G5 |
 			  AQ_NIC_RATE_1G |
 			  AQ_NIC_RATE_100M;
 
+	adapter->hw_cfg.aq_rss.indirection_table_size =
+		HW_ATL_B0_RSS_REDIRECTION_MAX;
+
 	hw->aq_nic_cfg = &adapter->hw_cfg;
 
 	/* disable interrupt */
@@ -840,6 +864,10 @@ atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->rx_desc_lim = rx_desc_lim;
 	dev_info->tx_desc_lim = tx_desc_lim;
 
+	dev_info->hash_key_size = HW_ATL_B0_RSS_HASHKEY_BITS / 8;
+	dev_info->reta_size = HW_ATL_B0_RSS_REDIRECTION_MAX;
+	dev_info->flow_type_rss_offloads = ATL_RSS_OFFLOAD_ALL;
+
 	dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G;
 	dev_info->speed_capa |= ETH_LINK_SPEED_100M;
 	dev_info->speed_capa |= ETH_LINK_SPEED_2_5G;
@@ -1091,6 +1119,85 @@ atl_dev_interrupt_handler(void *param)
 	atl_dev_interrupt_action(dev, dev->intr_handle);
 }
 
+static int
+atl_reta_update(struct rte_eth_dev *dev,
+		   struct rte_eth_rss_reta_entry64 *reta_conf,
+		   uint16_t reta_size)
+{
+	int i;
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct aq_hw_cfg_s *cf = ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
+
+	for (i = 0; i < reta_size && i < cf->aq_rss.indirection_table_size; i++)
+		cf->aq_rss.indirection_table[i] = min(reta_conf->reta[i],
+					dev->data->nb_rx_queues - 1);
+
+	hw_atl_b0_hw_rss_set(hw, &cf->aq_rss);
+	return 0;
+}
+
+static int
+atl_reta_query(struct rte_eth_dev *dev,
+		    struct rte_eth_rss_reta_entry64 *reta_conf,
+		    uint16_t reta_size)
+{
+	int i;
+	struct aq_hw_cfg_s *cf = ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
+
+	for (i = 0; i < reta_size && i < cf->aq_rss.indirection_table_size; i++)
+		reta_conf->reta[i] = cf->aq_rss.indirection_table[i];
+	reta_conf->mask = ~0U;
+	return 0;
+}
+
+static int
+atl_rss_hash_update(struct rte_eth_dev *dev,
+				 struct rte_eth_rss_conf *rss_conf)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct aq_hw_cfg_s *cfg =
+		ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
+	static u8 def_rss_key[40] = {
+		0x1e, 0xad, 0x71, 0x87, 0x65, 0xfc, 0x26, 0x7d,
+		0x0d, 0x45, 0x67, 0x74, 0xcd, 0x06, 0x1a, 0x18,
+		0xb6, 0xc1, 0xf0, 0xc7, 0xbb, 0x18, 0xbe, 0xf8,
+		0x19, 0x13, 0x4b, 0xa9, 0xd0, 0x3e, 0xfe, 0x70,
+		0x25, 0x03, 0xab, 0x50, 0x6a, 0x8b, 0x82, 0x0c
+	};
+
+	cfg->is_rss = !!rss_conf->rss_hf;
+	if (rss_conf->rss_key) {
+		memcpy(cfg->aq_rss.hash_secret_key, rss_conf->rss_key,
+		       rss_conf->rss_key_len);
+		cfg->aq_rss.hash_secret_key_size = rss_conf->rss_key_len;
+	} else {
+		memcpy(cfg->aq_rss.hash_secret_key, def_rss_key,
+		       sizeof(def_rss_key));
+		cfg->aq_rss.hash_secret_key_size = sizeof(def_rss_key);
+	}
+
+	hw_atl_b0_hw_rss_set(hw, &cfg->aq_rss);
+	hw_atl_b0_hw_rss_hash_set(hw, &cfg->aq_rss);
+	return 0;
+}
+
+static int
+atl_rss_hash_conf_get(struct rte_eth_dev *dev,
+				 struct rte_eth_rss_conf *rss_conf)
+{
+	struct aq_hw_cfg_s *cfg =
+		ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
+
+	rss_conf->rss_hf = cfg->is_rss ? ATL_RSS_OFFLOAD_ALL : 0;
+	if (rss_conf->rss_key) {
+		rss_conf->rss_key_len = cfg->aq_rss.hash_secret_key_size;
+		memcpy(rss_conf->rss_key, cfg->aq_rss.hash_secret_key,
+		       rss_conf->rss_key_len);
+	}
+
+	return 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");
drivers/net/atlantic/atl_ethdev.h +14 -0
index 17c8505e4707..69612a016089 100644
@@ -9,6 +9,17 @@
 #include "atl_types.h"
 #include "hw_atl/hw_atl_utils.h"
 
+#define ATL_RSS_OFFLOAD_ALL ( \
+	ETH_RSS_IPV4 | \
+	ETH_RSS_NONFRAG_IPV4_TCP | \
+	ETH_RSS_NONFRAG_IPV4_UDP | \
+	ETH_RSS_IPV6 | \
+	ETH_RSS_NONFRAG_IPV6_TCP | \
+	ETH_RSS_NONFRAG_IPV6_UDP | \
+	ETH_RSS_IPV6_EX | \
+	ETH_RSS_IPV6_TCP_EX | \
+	ETH_RSS_IPV6_UDP_EX)
+
 #define ATL_DEV_PRIVATE_TO_HW(adapter) \
 	(&((struct atl_adapter *)adapter)->hw)
 
@@ -18,6 +29,9 @@
 #define ATL_DEV_PRIVATE_TO_INTR(adapter) \
 	(&((struct atl_adapter *)adapter)->intr)
 
+#define ATL_DEV_PRIVATE_TO_CFG(adapter) \
+	(&((struct atl_adapter *)adapter)->hw_cfg)
+
 #define ATL_FLAG_NEED_LINK_UPDATE (uint32_t)(1 << 0)
 #define ATL_FLAG_NEED_LINK_CONFIG (uint32_t)(4 << 0)
 
drivers/net/atlantic/atl_rxtx.c +5 -0
index ebb606fbcd7c..cac518c1a780 100644
@@ -321,6 +321,7 @@ int
 atl_rx_init(struct rte_eth_dev *eth_dev)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+	struct aq_rss_parameters *rss_params = &hw->aq_nic_cfg->aq_rss;
 	struct atl_rx_queue *rxq;
 	uint64_t base_addr = 0;
 	int i = 0;
@@ -358,6 +359,10 @@ atl_rx_init(struct rte_eth_dev *eth_dev)
 						rxq->port_id);
 	}
 
+	for (i = rss_params->indirection_table_size; i--;)
+		rss_params->indirection_table[i] = i &
+			(eth_dev->data->nb_rx_queues - 1);
+	hw_atl_b0_hw_rss_set(hw, rss_params);
 	return err;
 }
 
Signature · 1 line
2.7.4
#18 lore raw

PATCH v3 16/22 net/atlantic: flow control configuration

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/atl_ethdev.c | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
drivers/net/atlantic/atl_ethdev.c +54 -0
index 51e933a3559a..243020dc00a9 100644
@@ -54,6 +54,12 @@ static void atl_dev_info_get(struct rte_eth_dev *dev,
 
 static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
+/* Flow control */
+static int atl_flow_ctrl_get(struct rte_eth_dev *dev,
+			       struct rte_eth_fc_conf *fc_conf);
+static int atl_flow_ctrl_set(struct rte_eth_dev *dev,
+			       struct rte_eth_fc_conf *fc_conf);
+
 static void atl_dev_link_status_print(struct rte_eth_dev *dev);
 
 /* Interrupts */
@@ -224,6 +230,10 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	.rx_descriptor_status = atl_dev_rx_descriptor_status,
 	.tx_descriptor_status = atl_dev_tx_descriptor_status,
 
+	/* Flow Control */
+	.flow_ctrl_get	      = atl_flow_ctrl_get,
+	.flow_ctrl_set	      = atl_flow_ctrl_set,
+
 	.rxq_info_get	      = atl_rxq_info_get,
 	.txq_info_get	      = atl_txq_info_get,
 
@@ -357,6 +367,7 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev)
 			  AQ_NIC_RATE_1G |
 			  AQ_NIC_RATE_100M;
 
+	adapter->hw_cfg.flow_control = (AQ_NIC_FC_RX | AQ_NIC_FC_TX);
 	adapter->hw_cfg.aq_rss.indirection_table_size =
 		HW_ATL_B0_RSS_REDIRECTION_MAX;
 
@@ -1119,6 +1130,49 @@ atl_dev_interrupt_handler(void *param)
 	atl_dev_interrupt_action(dev, dev->intr_handle);
 }
 
+
+static int
+atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	if (hw->aq_nic_cfg->flow_control == AQ_NIC_FC_OFF)
+		fc_conf->mode = RTE_FC_NONE;
+	else if (hw->aq_nic_cfg->flow_control & (AQ_NIC_FC_RX | AQ_NIC_FC_TX))
+		fc_conf->mode = RTE_FC_FULL;
+	else if (hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX)
+		fc_conf->mode = RTE_FC_RX_PAUSE;
+	else if (hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX)
+		fc_conf->mode = RTE_FC_TX_PAUSE;
+
+	return 0;
+}
+
+static int
+atl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t old_flow_control = hw->aq_nic_cfg->flow_control;
+
+
+	if (hw->aq_fw_ops->set_flow_control == NULL)
+		return -ENOTSUP;
+
+	if (fc_conf->mode == RTE_FC_NONE)
+		hw->aq_nic_cfg->flow_control = AQ_NIC_FC_OFF;
+	else if (fc_conf->mode == RTE_FC_RX_PAUSE)
+		hw->aq_nic_cfg->flow_control = AQ_NIC_FC_RX;
+	else if (fc_conf->mode == RTE_FC_TX_PAUSE)
+		hw->aq_nic_cfg->flow_control = AQ_NIC_FC_TX;
+	else if (fc_conf->mode == RTE_FC_FULL)
+		hw->aq_nic_cfg->flow_control = (AQ_NIC_FC_RX | AQ_NIC_FC_TX);
+
+	if (old_flow_control != hw->aq_nic_cfg->flow_control)
+		return hw->aq_fw_ops->set_flow_control(hw);
+
+	return 0;
+}
+
 static int
 atl_reta_update(struct rte_eth_dev *dev,
 		   struct rte_eth_rss_reta_entry64 *reta_conf,
Signature · 1 line
2.7.4
#19 lore raw

PATCH v3 17/22 net/atlantic: MAC address manipulations

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/atl_ethdev.c | 126 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 126 insertions(+)
drivers/net/atlantic/atl_ethdev.c +126 -0
index 243020dc00a9..b71028d9d227 100644
@@ -54,6 +54,8 @@ static void atl_dev_info_get(struct rte_eth_dev *dev,
 
 static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
+static int atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
+
 /* Flow control */
 static int atl_flow_ctrl_get(struct rte_eth_dev *dev,
 			       struct rte_eth_fc_conf *fc_conf);
@@ -70,6 +72,18 @@ static int atl_dev_interrupt_action(struct rte_eth_dev *dev,
 				    struct rte_intr_handle *handle);
 static void atl_dev_interrupt_handler(void *param);
 
+
+static int atl_add_mac_addr(struct rte_eth_dev *dev,
+			    struct ether_addr *mac_addr,
+			    uint32_t index, uint32_t pool);
+static void atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index);
+static int atl_set_default_mac_addr(struct rte_eth_dev *dev,
+					   struct ether_addr *mac_addr);
+
+static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev,
+				    struct ether_addr *mc_addr_set,
+				    uint32_t nb_mc_addr);
+
 /* RSS */
 static int atl_reta_update(struct rte_eth_dev *dev,
 			     struct rte_eth_rss_reta_entry64 *reta_conf,
@@ -211,6 +225,8 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	.dev_infos_get	      = atl_dev_info_get,
 	.dev_supported_ptypes_get = atl_dev_supported_ptypes_get,
 
+	.mtu_set	      = atl_dev_mtu_set,
+
 	/* Queue Control */
 	.rx_queue_start	      = atl_rx_queue_start,
 	.rx_queue_stop	      = atl_rx_queue_stop,
@@ -234,6 +250,11 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	.flow_ctrl_get	      = atl_flow_ctrl_get,
 	.flow_ctrl_set	      = atl_flow_ctrl_set,
 
+	/* MAC */
+	.mac_addr_add	      = atl_add_mac_addr,
+	.mac_addr_remove      = atl_remove_mac_addr,
+	.mac_addr_set	      = atl_set_default_mac_addr,
+	.set_mc_addr_list     = atl_dev_set_mc_addr_list,
 	.rxq_info_get	      = atl_rxq_info_get,
 	.txq_info_get	      = atl_txq_info_get,
 
@@ -1174,6 +1195,111 @@ atl_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 }
 
 static int
+atl_update_mac_addr(struct rte_eth_dev *dev, uint32_t index,
+		    u8 *mac_addr, bool enable)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	unsigned int h = 0U;
+	unsigned int l = 0U;
+	int err;
+
+	if (mac_addr) {
+		h = (mac_addr[0] << 8) | (mac_addr[1]);
+		l = (mac_addr[2] << 24) | (mac_addr[3] << 16) |
+			(mac_addr[4] << 8) | mac_addr[5];
+	}
+
+	hw_atl_rpfl2_uc_flr_en_set(hw, 0U, index);
+	hw_atl_rpfl2unicast_dest_addresslsw_set(hw, l, index);
+	hw_atl_rpfl2unicast_dest_addressmsw_set(hw, h, index);
+
+	if (enable)
+		hw_atl_rpfl2_uc_flr_en_set(hw, 1U, index);
+
+	err = aq_hw_err_from_flags(hw);
+
+	return err;
+}
+
+static int
+atl_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
+			uint32_t index __rte_unused, uint32_t pool __rte_unused)
+{
+	if (is_zero_ether_addr(mac_addr)) {
+		PMD_DRV_LOG(ERR, "Invalid Ethernet Address");
+		return -EINVAL;
+	}
+
+	return atl_update_mac_addr(dev, index, (u8 *)mac_addr, TRUE);
+}
+
+static void
+atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index)
+{
+	atl_update_mac_addr(dev, index, NULL, FALSE);
+}
+
+static int
+atl_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr)
+{
+	atl_remove_mac_addr(dev, 0);
+	atl_add_mac_addr(dev, addr, 0, 0);
+	return 0;
+}
+
+static int
+atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct rte_eth_dev_info dev_info;
+	uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN;
+
+	atl_dev_info_get(dev, &dev_info);
+
+	if ((mtu < ETHER_MIN_MTU) || (frame_size > dev_info.max_rx_pktlen))
+		return -EINVAL;
+
+	/* update max frame size */
+	dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
+
+	return 0;
+}
+
+static int
+atl_dev_set_mc_addr_list(struct rte_eth_dev *dev,
+			  struct ether_addr *mc_addr_set,
+			  uint32_t nb_mc_addr)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 i;
+
+	if (nb_mc_addr > AQ_HW_MULTICAST_ADDRESS_MAX - HW_ATL_B0_MAC_MIN)
+		return -EINVAL;
+
+	/* Update whole uc filters table */
+	for (i = 0; i < AQ_HW_MULTICAST_ADDRESS_MAX - HW_ATL_B0_MAC_MIN; i++) {
+		u8 *mac_addr = NULL;
+		u32 l = 0, h = 0;
+
+		if (i < nb_mc_addr) {
+			mac_addr = mc_addr_set[i].addr_bytes;
+			l = (mac_addr[2] << 24) | (mac_addr[3] << 16) |
+				(mac_addr[4] << 8) | mac_addr[5];
+			h = (mac_addr[0] << 8) | mac_addr[1];
+		}
+
+		hw_atl_rpfl2_uc_flr_en_set(hw, 0U, HW_ATL_B0_MAC_MIN + i);
+		hw_atl_rpfl2unicast_dest_addresslsw_set(hw, l,
+							HW_ATL_B0_MAC_MIN + i);
+		hw_atl_rpfl2unicast_dest_addressmsw_set(hw, h,
+							HW_ATL_B0_MAC_MIN + i);
+		hw_atl_rpfl2_uc_flr_en_set(hw, !!mac_addr,
+					   HW_ATL_B0_MAC_MIN + i);
+	}
+
+	return 0;
+}
+
+static int
 atl_reta_update(struct rte_eth_dev *dev,
 		   struct rte_eth_rss_reta_entry64 *reta_conf,
 		   uint16_t reta_size)
Signature · 1 line
2.7.4
#20 lore raw

PATCH v3 18/22 net/atlantic: VLAN filters and offloads

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/atl_ethdev.c | 161 ++++++++++++++++++++++++++++++++++++++
 drivers/net/atlantic/atl_types.h  |   2 +
 2 files changed, 163 insertions(+)
drivers/net/atlantic/atl_ethdev.c +161 -0
index b71028d9d227..792dd7be127a 100644
@@ -56,6 +56,20 @@ static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
 static int atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 
+
+/* VLAN stuff */
+static int atl_vlan_filter_set(struct rte_eth_dev *dev,
+		uint16_t vlan_id, int on);
+
+static int atl_vlan_offload_set(struct rte_eth_dev *dev, int mask);
+
+static void atl_vlan_strip_queue_set(struct rte_eth_dev *dev,
+				     uint16_t queue_id, int on);
+
+static int atl_vlan_tpid_set(struct rte_eth_dev *dev,
+			     enum rte_vlan_type vlan_type, uint16_t tpid);
+
+
 /* Flow control */
 static int atl_flow_ctrl_get(struct rte_eth_dev *dev,
 			       struct rte_eth_fc_conf *fc_conf);
@@ -227,6 +241,12 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 
 	.mtu_set	      = atl_dev_mtu_set,
 
+	/* VLAN */
+	.vlan_filter_set      = atl_vlan_filter_set,
+	.vlan_offload_set     = atl_vlan_offload_set,
+	.vlan_tpid_set        = atl_vlan_tpid_set,
+	.vlan_strip_queue_set = atl_vlan_strip_queue_set,
+
 	/* Queue Control */
 	.rx_queue_start	      = atl_rx_queue_start,
 	.rx_queue_stop	      = atl_rx_queue_stop,
@@ -1265,6 +1285,147 @@ atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 }
 
 static int
+atl_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
+{
+	struct aq_hw_cfg_s *cfg =
+		ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int err = 0;
+	int i = 0;
+
+	PMD_INIT_FUNC_TRACE();
+
+	for (i = 0; i < HW_ATL_B0_MAX_VLAN_IDS; i++) {
+		if (cfg->vlan_filter[i] == vlan_id) {
+			if (!on) {
+				/* Disable VLAN filter. */
+				hw_atl_rpf_vlan_flr_en_set(hw, 0U, i);
+
+				/* Clear VLAN filter entry */
+				cfg->vlan_filter[i] = 0;
+			}
+			break;
+		}
+	}
+
+	/* VLAN_ID was not found. So, nothing to delete. */
+	if (i == HW_ATL_B0_MAX_VLAN_IDS && !on)
+		goto exit;
+
+	/* VLAN_ID already exist, or already removed above. Nothing to do. */
+	if (i != HW_ATL_B0_MAX_VLAN_IDS)
+		goto exit;
+
+	/* Try to found free VLAN filter to add new VLAN_ID */
+	for (i = 0; i < HW_ATL_B0_MAX_VLAN_IDS; i++) {
+		if (cfg->vlan_filter[i] == 0)
+			break;
+	}
+
+	if (i == HW_ATL_B0_MAX_VLAN_IDS) {
+		/* We have no free VLAN filter to add new VLAN_ID*/
+		err = -ENOMEM;
+		goto exit;
+	}
+
+	cfg->vlan_filter[i] = vlan_id;
+	hw_atl_rpf_vlan_flr_act_set(hw, 1U, i);
+	hw_atl_rpf_vlan_id_flr_set(hw, vlan_id, i);
+	hw_atl_rpf_vlan_flr_en_set(hw, 1U, i);
+
+exit:
+	/* Enable VLAN promisc mode if vlan_filter empty  */
+	for (i = 0; i < HW_ATL_B0_MAX_VLAN_IDS; i++) {
+		if (cfg->vlan_filter[i] != 0)
+			break;
+	}
+
+	hw_atl_rpf_vlan_prom_mode_en_set(hw, i == HW_ATL_B0_MAX_VLAN_IDS);
+
+	return err;
+}
+
+static int
+atl_enable_vlan_filter(struct rte_eth_dev *dev, int en)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct aq_hw_cfg_s *cfg =
+		ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
+	int i;
+
+	PMD_INIT_FUNC_TRACE();
+
+	for (i = 0; i < HW_ATL_B0_MAX_VLAN_IDS; i++) {
+		if (cfg->vlan_filter[i])
+			hw_atl_rpf_vlan_flr_en_set(hw, en, i);
+	}
+	return 0;
+}
+
+static int
+atl_vlan_offload_set(struct rte_eth_dev *dev, int mask)
+{
+	struct aq_hw_cfg_s *cfg =
+		ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private);
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int ret = 0;
+	int i;
+
+	PMD_INIT_FUNC_TRACE();
+
+	ret = atl_enable_vlan_filter(dev, mask & ETH_VLAN_FILTER_MASK);
+
+	cfg->vlan_strip = !!(mask & ETH_VLAN_STRIP_MASK);
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++)
+		hw_atl_rpo_rx_desc_vlan_stripping_set(hw, cfg->vlan_strip, i);
+
+	if (mask & ETH_VLAN_EXTEND_MASK)
+		ret = -ENOTSUP;
+
+	return ret;
+}
+
+static int
+atl_vlan_tpid_set(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type,
+		  uint16_t tpid)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int err = 0;
+
+	PMD_INIT_FUNC_TRACE();
+
+	switch (vlan_type) {
+	case ETH_VLAN_TYPE_INNER:
+		hw_atl_rpf_vlan_inner_etht_set(hw, tpid);
+		break;
+	case ETH_VLAN_TYPE_OUTER:
+		hw_atl_rpf_vlan_outer_etht_set(hw, tpid);
+		break;
+	default:
+		PMD_DRV_LOG(ERR, "Unsupported VLAN type");
+		err = -ENOTSUP;
+	}
+
+	return err;
+}
+
+static void
+atl_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue_id, int on)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	PMD_INIT_FUNC_TRACE();
+
+	if (queue_id > dev->data->nb_rx_queues) {
+		PMD_DRV_LOG(ERR, "Invalid queue id");
+		return;
+	}
+
+	hw_atl_rpo_rx_desc_vlan_stripping_set(hw, on, queue_id);
+}
+
+static int
 atl_dev_set_mc_addr_list(struct rte_eth_dev *dev,
 			  struct ether_addr *mc_addr_set,
 			  uint32_t nb_mc_addr)
drivers/net/atlantic/atl_types.h +2 -0
index 99e920315014..eb6feec177ff 100644
@@ -77,6 +77,8 @@ struct aq_hw_cfg_s {
 	int irq_mask;
 	unsigned int vecs;
 
+	bool vlan_strip;
+	uint32_t vlan_filter[HW_ATL_B0_MAX_VLAN_IDS];
 	uint32_t flow_control;
 
 	struct aq_rss_parameters aq_rss;
Signature · 1 line
2.7.4
#21 lore raw

PATCH v3 19/22 net/atlantic: eeprom and register manipulation routines

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/atl_ethdev.c | 47 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/atlantic/atl_ethdev.c +47 -0
index 792dd7be127a..b3a19f96e8c8 100644
@@ -69,6 +69,13 @@ static void atl_vlan_strip_queue_set(struct rte_eth_dev *dev,
 static int atl_vlan_tpid_set(struct rte_eth_dev *dev,
 			     enum rte_vlan_type vlan_type, uint16_t tpid);
 
+/* EEPROM */
+static int atl_dev_get_eeprom_length(struct rte_eth_dev *dev);
+static int atl_dev_get_eeprom(struct rte_eth_dev *dev,
+			      struct rte_dev_eeprom_info *eeprom);
+static int atl_dev_set_eeprom(struct rte_eth_dev *dev,
+			      struct rte_dev_eeprom_info *eeprom);
+
 
 /* Flow control */
 static int atl_flow_ctrl_get(struct rte_eth_dev *dev,
@@ -266,6 +273,11 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	.rx_descriptor_status = atl_dev_rx_descriptor_status,
 	.tx_descriptor_status = atl_dev_tx_descriptor_status,
 
+	/* EEPROM */
+	.get_eeprom_length    = atl_dev_get_eeprom_length,
+	.get_eeprom           = atl_dev_get_eeprom,
+	.set_eeprom           = atl_dev_set_eeprom,
+
 	/* Flow Control */
 	.flow_ctrl_get	      = atl_flow_ctrl_get,
 	.flow_ctrl_set	      = atl_flow_ctrl_set,
@@ -1171,6 +1183,41 @@ atl_dev_interrupt_handler(void *param)
 	atl_dev_interrupt_action(dev, dev->intr_handle);
 }
 
+#define SFP_EEPROM_SIZE 0xff
+
+static int
+atl_dev_get_eeprom_length(struct rte_eth_dev *dev __rte_unused)
+{
+	return SFP_EEPROM_SIZE;
+}
+
+static int
+atl_dev_get_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	if (hw->aq_fw_ops->get_eeprom == NULL)
+		return -ENOTSUP;
+
+	if (eeprom->length != SFP_EEPROM_SIZE || eeprom->data == NULL)
+		return -EINVAL;
+
+	return hw->aq_fw_ops->get_eeprom(hw, eeprom->data, eeprom->length);
+}
+
+static int
+atl_dev_set_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	if (hw->aq_fw_ops->set_eeprom == NULL)
+		return -ENOTSUP;
+
+	if (eeprom->length != SFP_EEPROM_SIZE || eeprom->data == NULL)
+		return -EINVAL;
+
+	return hw->aq_fw_ops->set_eeprom(hw, eeprom->data, eeprom->length);
+}
 
 static int
 atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
Signature · 1 line
2.7.4
#22 lore raw

PATCH v3 20/22 net/atlantic: LED control DPDK and private APIs

In reply to Igor Russkikh
---
 drivers/net/atlantic/Makefile           |  4 +++
 drivers/net/atlantic/atl_ethdev.c       | 53 +++++++++++++++++++++++++++++++++
 drivers/net/atlantic/atl_ethdev.h       |  3 ++
 drivers/net/atlantic/meson.build        |  3 ++
 drivers/net/atlantic/rte_pmd_atlantic.c | 19 ++++++++++++
 drivers/net/atlantic/rte_pmd_atlantic.h | 44 +++++++++++++++++++++++++++
 6 files changed, 126 insertions(+)
 create mode 100644 drivers/net/atlantic/rte_pmd_atlantic.c
 create mode 100644 drivers/net/atlantic/rte_pmd_atlantic.h
drivers/net/atlantic/Makefile +4 -0
index 62dcdbffa69c..6e821e013af9 100644
@@ -31,5 +31,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_utils.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_llh.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_utils_fw2x.c
 SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += hw_atl_b0.c
+SRCS-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD) += rte_pmd_atlantic.c
+
+# install this header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_ATLANTIC_PMD)-include := rte_pmd_atlantic.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/atlantic/atl_ethdev.c +53 -0

71 lines not on this page · raw message

drivers/net/atlantic/atl_ethdev.h +3 -0
index 69612a016089..51d6042088c7 100644
@@ -104,4 +104,7 @@ uint16_t atl_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 uint16_t atl_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 
+int
+atl_dev_led_control(struct rte_eth_dev *dev, int control);
+
 #endif /* _ATLANTIC_ETHDEV_H_ */
drivers/net/atlantic/meson.build +3 -0
index 7575e471e306..8e992f2406f6 100644
@@ -11,8 +11,11 @@ sources = files(
 	'hw_atl/hw_atl_llh.c',
 	'hw_atl/hw_atl_utils_fw2x.c',
 	'hw_atl/hw_atl_utils.c',
+	'rte_pmd_atlantic.c',
 )
 
 deps += ['eal']
 
 allow_experimental_apis = true
+
+install_headers('rte_pmd_atlantic.h')
drivers/net/atlantic/rte_pmd_atlantic.c new file +19 -0
new file mode 100644
index 000000000000..4cb09baf2afc
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Aquantia Corporation
+ */
+
+#include <rte_ethdev_driver.h>
+
+#include "rte_pmd_atlantic.h"
+#include "atl_ethdev.h"
+
+int rte_pmd_atl_dev_led_control(int port, int control)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+
+	return atl_dev_led_control(dev, control);
+}
drivers/net/atlantic/rte_pmd_atlantic.h new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.7.4
#23 lore raw

PATCH v3 21/22 net/atlantic: support for read MAC registers for debug purposes

In reply to Igor Russkikh

From: Pavel Belous <[email protected]>

---
 drivers/net/atlantic/atl_ethdev.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
drivers/net/atlantic/atl_ethdev.c +31 -0
index 90ab8d9c0b1d..c69b2536a3e3 100644
@@ -80,6 +80,9 @@ static int atl_dev_get_eeprom(struct rte_eth_dev *dev,
 static int atl_dev_set_eeprom(struct rte_eth_dev *dev,
 			      struct rte_dev_eeprom_info *eeprom);
 
+/* Regs */
+static int atl_dev_get_regs(struct rte_eth_dev *dev,
+			    struct rte_dev_reg_info *regs);
 
 /* Flow control */
 static int atl_flow_ctrl_get(struct rte_eth_dev *dev,
@@ -238,6 +241,8 @@ static const struct eth_dev_ops atl_eth_dev_ops = {
 	/* Link */
 	.link_update	      = atl_dev_link_update,
 
+	.get_reg              = atl_dev_get_regs,
+
 	/* Stats */
 	.stats_get	      = atl_dev_stats_get,
 	.xstats_get	      = atl_dev_xstats_get,
@@ -1273,6 +1278,32 @@ atl_dev_set_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom)
 }
 
 static int
+atl_dev_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs)
+{
+	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 mif_id;
+	int err;
+
+	if (regs->data == NULL) {
+		regs->length = hw_atl_utils_hw_get_reg_length();
+		regs->width = sizeof(u32);
+		return 0;
+	}
+
+	/* Only full register dump is supported */
+	if (regs->length && regs->length != hw_atl_utils_hw_get_reg_length())
+		return -ENOTSUP;
+
+	err = hw_atl_utils_hw_get_regs(hw, regs->data);
+
+	/* Device version */
+	mif_id = hw_atl_reg_glb_mif_id_get(hw);
+	regs->version = mif_id & 0xFFU;
+
+	return err;
+}
+
+static int
 atl_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
Signature · 1 line
2.7.4
#24 lore raw

PATCH v3 22/22 net/atlantic: documentation and rel notes

In reply to Igor Russkikh
---
 doc/guides/nics/atlantic.rst           | 53 ++++++++++++++++++++++++++++++++++
 doc/guides/nics/features/atlantic.ini  | 37 ++++++++++++++++++++++++
 doc/guides/nics/index.rst              |  1 +
 doc/guides/rel_notes/release_18_11.rst |  5 ++++
 4 files changed, 96 insertions(+)
 create mode 100644 doc/guides/nics/atlantic.rst
 create mode 100644 doc/guides/nics/features/atlantic.ini
doc/guides/nics/atlantic.rst new file +53 -0
new file mode 100644
index 000000000000..88939359d942
@@ -0,0 +1,53 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2018 Aquantia Corporation.
+
+Aquantia Atlantic DPDK Driver
+=============================
+
+Atlantic DPDK driver provides DPDK support for Aquantia's AQtion family of chipsets: AQC107/AQC108/AQC109
+
+Supported features
+^^^^^^^^^^^^^^^^^^
+
+
+- Base L2 features
+- Promiscuous mode
+- Port statistics
+- Multicast mode
+- RSS (Receive Side Scaling)
+- Checksum offload
+- Jumbo Frame upto 16K
+
+Configuration Information
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- ``CONFIG_RTE_LIBRTE_ATLANTIC_PMD`` (default ``y``)
+
+Not yet supported features
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+NOP
+
+Application Programming Interface
+---------------------------------
+
+Atlantic NIC supports custom LED pin configuration interface.
+For details, refer rte_pmd_atlantic.h header file
+
+Limitations or Known issues
+---------------------------
+
+Statistics
+~~~~~~~~~~
+
+MTU setting
+~~~~~~~~~~~
+
+Atlantic NIC supports up to 16K jumbo frame size
+
+Supported Chipsets and NICs
+---------------------------
+
+- Aquantia AQtion AQC107 10 Gigabit Ethernet Controller
+- Aquantia AQtion AQC108 5 Gigabit Ethernet Controller
+- Aquantia AQtion AQC109 2.5 Gigabit Ethernet Controller
doc/guides/nics/features/atlantic.ini new file +37 -0
new file mode 100644
index 000000000000..2d943ce13212
@@ -0,0 +1,37 @@
+;
+; Supported features of the 'atlantic' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Speed capabilities   = Y
+Link status          = Y
+Link status event    = Y
+MTU update           = Y
+Jumbo frame          = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
+Unicast MAC filter   = Y
+VLAN filter          = Y
+Flow control         = Y
+CRC offload          = Y
+VLAN offload         = Y
+L3 checksum offload  = Y
+L4 checksum offload  = Y
+Rx descriptor status = Y
+Tx descriptor status = Y
+Basic stats          = Y
+Extended stats       = Y
+Stats per queue      = Y
+Linux UIO            = Y
+x86-32               = Y
+x86-64               = Y
+Queue start/stop     = Y
+RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
+Packet type parsing  = Y
+FW version           = Y
+EEPROM dump          = Y
+Registers dump       = Y
+LED                  = Y
doc/guides/nics/index.rst +1 -0
index 59f6063dce92..7925c2bd86ff 100644
@@ -12,6 +12,7 @@ Network Interface Controller Drivers
     features
     build_and_test
     ark
+    atlantic
     avp
     axgbe
     bnx2x
doc/guides/rel_notes/release_18_11.rst +5 -0
index bc9b74ec44fc..8473516ddb78 100644
@@ -67,6 +67,11 @@ New Features
   SR-IOV option in Hyper-V and Azure. This is an alternative to the previous
   vdev_netvsc, tap, and failsafe drivers combination.
 
+* **Added Ethernet poll mode driver for Aquantia aQtion family of 10G devices.**
+
+  Added the new ``atlantic`` ethernet poll mode driver for Aquantia XGBE devices.
+  See the :doc:`../nics/atlantic` nic driver guide for more details on this
+  driver.
 
 API Changes
 -----------
Signature · 1 line
2.7.4
#25 lore raw
In reply to Igor Russkikh
Quoted 16 lines · Igor Russkikh

Hello DPDK community!

Aquantia would like to contribute PMD for aQtion AQC10X NIC family:
https://www.aquantia.com/products/aqtion/chips/
These are 10G ethernet NICs with various features.

We do base this work on parts of the existing native linux kernel driver source (atlantic). Shared code is hw_atl hardware and registers access module.

We'd like to target this driver for 18.11 DPDK release timeline, it'd be good to hear comments from the community on how feasible is this.

This patchset implements basic driver infrastructure, vlan offloads, checksumm offloads, rss control, multiring, jumbo frames and other features.

Quoted 8 lines

Later on, we plan to share HW MACSEC offloads, rxflows and other features.

version 3 changes:
- patchset fixed to be incrementally buildable
- extra includes removed and cleaned up
- license changed to dual GPL-BSD for pieces shared with linux
- removed extra logging #defines
- misc comments from previous review session

Hi Igor,

Thanks for the update. But a reminder, each patch should be build and functional, there are build errors when first patch applied. I think build is broken until 7/22.

Can you please re-work the patchset to make each patch compiles?

Thanks,
ferruh

#26 lore raw

Hi Ferruh,

Thanks again for the review, we'll investigate and work on your comments!

Quoted 5 lines
Quoted 1 line

+CONFIG_RTE_LIBRTE_ATLANTIC_PMD=y

Just to check, default enable in "common_base" means PMD supports all architectures (x86_64, i686, arm, ppc) and both Linux and FreeBSD. If this is not the case, please disable in common_base and enable in whatever supported.

We actually don't have an ability to test and verify on PPC. We are pretty confident on x86_64, i686 and arm.

Thus, will it be ok to add N into defconfig_ppc_64-power8-linuxapp-gcc only?

Quoted 5 lines

Thanks for the update. But a reminder, each patch should be build and functional, there are build errors when first patch applied. I think build is broken until 7/22.

Can you please re-work the patchset to make each patch compiles?

Thats strange because we explicitly tested that.
CI also states its OK:
http://patchwork.dpdk.org/project/dpdk/list/?series=1598&submitter=&state=*&q=&archive=&delegate=

Could it be some custom build environment on your side, or may be you do apply it on different base, not master?

Regards,
Igor

#27 lore raw
Quoted 10 lines · Igor Russkikh

Hi Ferruh,

Thanks again for the review, we'll investigate and work on your comments!

Quoted 5 lines
Quoted 1 line

+CONFIG_RTE_LIBRTE_ATLANTIC_PMD=y

Just to check, default enable in "common_base" means PMD supports all architectures (x86_64, i686, arm, ppc) and both Linux and FreeBSD. If this is not the case, please disable in common_base and enable in whatever supported.

Quoted 4 lines

We actually don't have an ability to test and verify on PPC. We are pretty confident on x86_64, i686 and arm.

Thus, will it be ok to add N into defconfig_ppc_64-power8-linuxapp-gcc only?

If FreeBSD is also supported yes, above will be OK.

Quoted 5 lines
Quoted 5 lines

Thanks for the update. But a reminder, each patch should be build and functional, there are build errors when first patch applied. I think build is broken until 7/22.

Quoted 8 lines
Quoted 1 line

Can you please re-work the patchset to make each patch compiles?

Thats strange because we explicitly tested that.
CI also states its OK:
http://patchwork.dpdk.org/project/dpdk/list/?series=1598&submitter=&state=*&q=&archive=&delegate=

Could it be some custom build environment on your side, or may be you do apply it on different base, not master?

I double checked, after fist patch applied getting following build error [1], and it seems valid because "atl_eth_dev_ops" not used at all.

[1]
.../drivers/net/atlantic/atl_ethdev.c:63:33: error: unused variable 'atl_eth_dev_ops' [-Werror,-Wunused-const-variable]

static const struct eth_dev_ops atl_eth_dev_ops = {
                                ^