Skip to contentSkip to conversation

add support for idpf PMD in DPDK

PATCH In review Junfeng Guo 9 participants 376 messages Aug 3, 2022 – Nov 3, 2022 Page 2 of 5

Subsystems (2)
lore
Share & tools
lore
#74 lore raw

PATCH v6 1/14 common/idpf: introduce common library

In reply to Junfeng Guo

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.

Also add OS specific implementation about some MACRO definitions and small functions which are specific for DPDK.

---
 drivers/common/idpf/idpf_alloc.h            |   22 +
 drivers/common/idpf/idpf_common.c           |  364 +++
 drivers/common/idpf/idpf_controlq.c         |  691 +++++
 drivers/common/idpf/idpf_controlq.h         |  224 ++
 drivers/common/idpf/idpf_controlq_api.h     |  234 ++
 drivers/common/idpf/idpf_controlq_setup.c   |  179 ++
 drivers/common/idpf/idpf_devids.h           |   18 +
 drivers/common/idpf/idpf_lan_pf_regs.h      |  134 +
 drivers/common/idpf/idpf_lan_txrx.h         |  428 +++
 drivers/common/idpf/idpf_lan_vf_regs.h      |  114 +
 drivers/common/idpf/idpf_osdep.h            |  375 +++
 drivers/common/idpf/idpf_prototype.h        |   45 +
 drivers/common/idpf/idpf_type.h             |  106 +
 drivers/common/idpf/meson.build             |   14 +
 drivers/common/idpf/siov_regs.h             |   47 +
 drivers/common/idpf/version.map             |   12 +
 drivers/common/idpf/virtchnl.h              | 2866 +++++++++++++++++++
 drivers/common/idpf/virtchnl2.h             | 1462 ++++++++++
 drivers/common/idpf/virtchnl2_lan_desc.h    |  606 ++++
 drivers/common/idpf/virtchnl_inline_ipsec.h |  567 ++++
 drivers/common/meson.build                  |    1 +
 21 files changed, 8509 insertions(+)
 create mode 100644 drivers/common/idpf/idpf_alloc.h
 create mode 100644 drivers/common/idpf/idpf_common.c
 create mode 100644 drivers/common/idpf/idpf_controlq.c
 create mode 100644 drivers/common/idpf/idpf_controlq.h
 create mode 100644 drivers/common/idpf/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/idpf_devids.h
 create mode 100644 drivers/common/idpf/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/idpf_osdep.h
 create mode 100644 drivers/common/idpf/idpf_prototype.h
 create mode 100644 drivers/common/idpf/idpf_type.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/siov_regs.h
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/common/idpf/virtchnl.h
 create mode 100644 drivers/common/idpf/virtchnl2.h
 create mode 100644 drivers/common/idpf/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/virtchnl_inline_ipsec.h
drivers/common/idpf/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/idpf_controlq_api.h new file +234 -0

234 lines not on this page · raw message

drivers/common/idpf/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/idpf_osdep.h new file +375 -0

375 lines not on this page · raw message

drivers/common/idpf/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/meson.build new file +14 -0
new file mode 100644
index 0000000000..183587b51a
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
drivers/common/idpf/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752
@@ -0,0 +1,12 @@
+INTERNAL {
+	global:
+
+	idpf_ctlq_deinit;
+	idpf_ctlq_init;
[… more lines in the raw message]

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

drivers/common/idpf/virtchnl.h new file +2866 -0

2,866 lines not on this page · raw message

drivers/common/idpf/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.34.1

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

#75 lore raw

v7 cover add support for idpf PMD in DPDK

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU Ethernet ES2000 Series (Device ID: 0x1452).

v2:
fixed some coding style issues and did some refactors.

v3:
fixed some coding style issues and did some refactors.

v4:
fixed some coding style issues and build errors.

v5:
fixed typo.

v6-v7:
fixed build errors.

Junfeng Guo (14):
common/idpf: introduce common library
net/idpf: add support for device initialization net/idpf: add queue setup and release in single queue model net/idpf: add queue setup and release in split queue model net/idpf: add support for queue start and stop net/idpf: add support for device information get net/idpf: add support for packet type get net/idpf: add support for basic Rx/Tx datapath net/idpf: add support for Rx/Tx offloading net/idpf: add support for RSS
net/idpf: add support for MTU configuration net/idpf: add support for write back based on ITR expire net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 MAINTAINERS                                 |    9 +
 doc/guides/nics/features/idpf.ini           |   24 +
 doc/guides/nics/idpf.rst                    |   94 +
 doc/guides/nics/index.rst                   |    1 +
 doc/guides/rel_notes/release_22_11.rst      |    5 +
 drivers/common/idpf/idpf_alloc.h            |   22 +
 drivers/common/idpf/idpf_common.c           |  364 +++
 drivers/common/idpf/idpf_controlq.c         |  691 +++++
 drivers/common/idpf/idpf_controlq.h         |  224 ++
 drivers/common/idpf/idpf_controlq_api.h     |  234 ++
 drivers/common/idpf/idpf_controlq_setup.c   |  179 ++
 drivers/common/idpf/idpf_devids.h           |   18 +
 drivers/common/idpf/idpf_lan_pf_regs.h      |  134 +
 drivers/common/idpf/idpf_lan_txrx.h         |  428 +++
 drivers/common/idpf/idpf_lan_vf_regs.h      |  114 +
 drivers/common/idpf/idpf_osdep.h            |  375 +++
 drivers/common/idpf/idpf_prototype.h        |   45 +
 drivers/common/idpf/idpf_type.h             |  106 +
 drivers/common/idpf/meson.build             |   14 +
 drivers/common/idpf/siov_regs.h             |   47 +
 drivers/common/idpf/version.map             |   12 +
 drivers/common/idpf/virtchnl.h              | 2866 +++++++++++++++++++
 drivers/common/idpf/virtchnl2.h             | 1462 ++++++++++
 drivers/common/idpf/virtchnl2_lan_desc.h    |  606 ++++
 drivers/common/idpf/virtchnl_inline_ipsec.h |  567 ++++
 drivers/common/meson.build                  |    1 +
 drivers/net/idpf/idpf_ethdev.c              | 1244 ++++++++
 drivers/net/idpf/idpf_ethdev.h              |  271 ++
 drivers/net/idpf/idpf_logs.h                |   42 +
 drivers/net/idpf/idpf_rxtx.c                | 2375 +++++++++++++++
 drivers/net/idpf/idpf_rxtx.h                |  324 +++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c     |  871 ++++++
 drivers/net/idpf/idpf_rxtx_vec_common.h     |  100 +
 drivers/net/idpf/idpf_vchnl.c               | 1445 ++++++++++
 drivers/net/idpf/meson.build                |   45 +
 drivers/net/idpf/version.map                |    3 +
 drivers/net/meson.build                     |    1 +
 37 files changed, 15363 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/common/idpf/idpf_alloc.h
 create mode 100644 drivers/common/idpf/idpf_common.c
 create mode 100644 drivers/common/idpf/idpf_controlq.c
 create mode 100644 drivers/common/idpf/idpf_controlq.h
 create mode 100644 drivers/common/idpf/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/idpf_devids.h
 create mode 100644 drivers/common/idpf/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/idpf_osdep.h
 create mode 100644 drivers/common/idpf/idpf_prototype.h
 create mode 100644 drivers/common/idpf/idpf_type.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/siov_regs.h
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/common/idpf/virtchnl.h
 create mode 100644 drivers/common/idpf/virtchnl2.h
 create mode 100644 drivers/common/idpf/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/virtchnl_inline_ipsec.h
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
Signature · 1 line
2.34.1
#76 lore raw

PATCH v7 1/14 common/idpf: introduce common library

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.

Also add OS specific implementation about some MACRO definitions and small functions which are specific for DPDK.

---
 drivers/common/idpf/idpf_alloc.h            |   22 +
 drivers/common/idpf/idpf_common.c           |  364 +++
 drivers/common/idpf/idpf_controlq.c         |  691 +++++
 drivers/common/idpf/idpf_controlq.h         |  224 ++
 drivers/common/idpf/idpf_controlq_api.h     |  234 ++
 drivers/common/idpf/idpf_controlq_setup.c   |  179 ++
 drivers/common/idpf/idpf_devids.h           |   18 +
 drivers/common/idpf/idpf_lan_pf_regs.h      |  134 +
 drivers/common/idpf/idpf_lan_txrx.h         |  428 +++
 drivers/common/idpf/idpf_lan_vf_regs.h      |  114 +
 drivers/common/idpf/idpf_osdep.h            |  375 +++
 drivers/common/idpf/idpf_prototype.h        |   45 +
 drivers/common/idpf/idpf_type.h             |  106 +
 drivers/common/idpf/meson.build             |   14 +
 drivers/common/idpf/siov_regs.h             |   47 +
 drivers/common/idpf/version.map             |   12 +
 drivers/common/idpf/virtchnl.h              | 2866 +++++++++++++++++++
 drivers/common/idpf/virtchnl2.h             | 1462 ++++++++++
 drivers/common/idpf/virtchnl2_lan_desc.h    |  606 ++++
 drivers/common/idpf/virtchnl_inline_ipsec.h |  567 ++++
 drivers/common/meson.build                  |    1 +
 21 files changed, 8509 insertions(+)
 create mode 100644 drivers/common/idpf/idpf_alloc.h
 create mode 100644 drivers/common/idpf/idpf_common.c
 create mode 100644 drivers/common/idpf/idpf_controlq.c
 create mode 100644 drivers/common/idpf/idpf_controlq.h
 create mode 100644 drivers/common/idpf/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/idpf_devids.h
 create mode 100644 drivers/common/idpf/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/idpf_osdep.h
 create mode 100644 drivers/common/idpf/idpf_prototype.h
 create mode 100644 drivers/common/idpf/idpf_type.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/siov_regs.h
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/common/idpf/virtchnl.h
 create mode 100644 drivers/common/idpf/virtchnl2.h
 create mode 100644 drivers/common/idpf/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/virtchnl_inline_ipsec.h
drivers/common/idpf/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/idpf_controlq_api.h new file +234 -0

234 lines not on this page · raw message

drivers/common/idpf/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/idpf_osdep.h new file +375 -0

375 lines not on this page · raw message

drivers/common/idpf/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/meson.build new file +14 -0
new file mode 100644
index 0000000000..183587b51a
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
drivers/common/idpf/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752
@@ -0,0 +1,12 @@
+INTERNAL {
+	global:
+
+	idpf_ctlq_deinit;
+	idpf_ctlq_init;
[… more lines in the raw message]

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

drivers/common/idpf/virtchnl.h new file +2866 -0

2,866 lines not on this page · raw message

drivers/common/idpf/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.34.1

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

#77 lore raw

PATCH v7 2/14 net/idpf: add support for device initialization

In reply to Junfeng Guo

Support device init and add the following dev ops skeleton:
- dev_configure
- dev_start
- dev_stop
- dev_close

---
 MAINTAINERS                            |   9 +
 doc/guides/nics/features/idpf.ini      |  15 +
 doc/guides/nics/idpf.rst               |  52 ++
 doc/guides/nics/index.rst              |   1 +
 doc/guides/rel_notes/release_22_11.rst |   5 +
 drivers/net/idpf/idpf_ethdev.c         | 774 +++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h         | 204 +++++++
 drivers/net/idpf/idpf_logs.h           |  42 ++
 drivers/net/idpf/idpf_vchnl.c          | 495 ++++++++++++++++
 drivers/net/idpf/meson.build           |  16 +
 drivers/net/idpf/version.map           |   3 +
 drivers/net/meson.build                |   1 +
 12 files changed, 1617 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
MAINTAINERS +9 -0
index 2bd4a55f1b..e2d9c2ac50 100644
@@ -758,6 +758,15 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
+Intel idpf
+M: Jingjing Wu <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/idpf/
+F: drivers/common/idpf/
+F: doc/guides/nics/idpf.rst
+F: doc/guides/nics/features/idpf.ini
+
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/features/idpf.ini new file +15 -0
new file mode 100644
index 0000000000..f029a279b3
@@ -0,0 +1,15 @@
+;
+; Supported features of the 'idpf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+; A feature with "P" indicates only be supported when non-vector path
+; is selected.
+;
+[Features]
+Multiprocess aware   = Y
+FreeBSD              = Y
+Linux                = Y
+Windows              = Y
+x86-32               = Y
+x86-64               = Y
doc/guides/nics/idpf.rst new file +52 -0

52 lines not on this page · raw message

doc/guides/nics/index.rst +1 -0
index 32c7544968..b4dd5ea522 100644
@@ -33,6 +33,7 @@ Network Interface Controller Drivers
     hns3
     i40e
     ice
+    idpf
     igb
     igc
     ionic
doc/guides/rel_notes/release_22_11.rst +5 -0
index 2da8bc9661..6697b61848 100644
@@ -236,6 +236,11 @@ New Features
 
      strings $dpdk_binary_or_driver | sed -n 's/^PMD_INFO_STRING= //p'
 
+* **Added IDPF PMD [*EXPERIMENTAL*].**
+
+  Added the new ``idpf`` net driver for Intel® IPU Ethernet ES2000 Series.
+  See the :doc:`../nics/idpf` NIC guide for more details on this new driver.
+
 
 Removed Items
 -------------
drivers/net/idpf/idpf_ethdev.c new file +774 -0

774 lines not on this page · raw message

drivers/net/idpf/idpf_ethdev.h new file +204 -0

204 lines not on this page · raw message

drivers/net/idpf/idpf_logs.h new file +42 -0

42 lines not on this page · raw message

drivers/net/idpf/idpf_vchnl.c new file +495 -0

495 lines not on this page · raw message

drivers/net/idpf/meson.build new file +16 -0
new file mode 100644
index 0000000000..bf8bf58ef5
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+if is_windows
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
+endif
+
+includes += include_directories('../../common/idpf')
+deps += ['common_idpf', 'security', 'cryptodev']
+
+sources = files(
+    'idpf_ethdev.c',
+    'idpf_vchnl.c',
+)
drivers/net/idpf/version.map new file +3 -0
new file mode 100644
index 0000000000..c2e0723b4c
@@ -0,0 +1,3 @@
+DPDK_22 {
+	local: *;
+};
drivers/net/meson.build +1 -0
index 35bfa78dee..4a951b95f2 100644
@@ -28,6 +28,7 @@ drivers = [
         'i40e',
         'iavf',
         'ice',
+        'idpf',
         'igc',
         'ionic',
         'ipn3ke',
Signature · 1 line
2.34.1
#78 lore raw

PATCH v7 3/14 net/idpf: add queue setup and release in single queue model

In reply to Junfeng Guo

Add support for queue operations in single queue model:
- rx_queue_setup
- rx_queue_release
- tx_queue_setup
- tx_queue_release

In the single queue model, the same descriptor queue is used by SW to post buffer descriptors to HW and by HW to post completed descriptors to SW.

---
 doc/guides/nics/features/idpf.ini |   2 +
 doc/guides/nics/idpf.rst          |  22 ++
 drivers/net/idpf/idpf_ethdev.c    |  58 ++++
 drivers/net/idpf/idpf_ethdev.h    |   9 +
 drivers/net/idpf/idpf_rxtx.c      | 465 ++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h      | 186 ++++++++++++
 drivers/net/idpf/idpf_vchnl.c     | 251 ++++++++++++++++
 drivers/net/idpf/meson.build      |   1 +
 8 files changed, 994 insertions(+)
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
doc/guides/nics/features/idpf.ini +2 -0
index f029a279b3..681a908194 100644
@@ -7,6 +7,8 @@
 ; is selected.
 ;
 [Features]
+Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 Multiprocess aware   = Y
 FreeBSD              = Y
 Linux                = Y
doc/guides/nics/idpf.rst +22 -0
index cc56db6e70..84b21e7be0 100644
@@ -45,6 +45,28 @@ Runtime Config Options
   Then idpf PMD will create 3 vports (ethdevs) for device ca:00.0.
   NOTE: This parameter is MUST, otherwise there'll be no any ethdev created.
 
+- ``rx_single`` (default ``0``)
+
+  There're two queue modes supported by Intel® IPU Ethernet ES2000 Series, single queue
+  mode and split queue mode for Rx queue. User can choose Rx queue mode by the ``devargs``
+  parameter ``rx_single``.
+
+    -a ca:00.0,rx_single=1
+
+  Then idpf PMD will configure Rx queue with single queue mode. Otherwise, split queue
+  mode is chosen by default.
+
+- ``tx_single`` (default ``0``)
+
+  There're two queue modes supported by Intel® IPU Ethernet ES2000 Series, single queue
+  mode and split queue mode for Tx queue. User can choose Tx queue mode by the ``devargs``
+  parameter ``tx_single``.
+
+    -a ca:00.0,tx_single=1
+
+  Then idpf PMD will configure Tx queue with single queue mode. Otherwise, split queue
+  mode is chosen by default.
+
 Driver compilation and testing
 ------------------------------
 
drivers/net/idpf/idpf_ethdev.c +58 -0

107 lines not on this page · raw message

drivers/net/idpf/idpf_ethdev.h +9 -0
index 77824d5f7f..8b7170f49e 100644
@@ -83,6 +83,8 @@ struct idpf_chunks_info {
 struct idpf_vport {
 	struct idpf_adapter *adapter; /* Backreference to associated adapter */
 	uint16_t vport_id;
+	uint32_t txq_model;
+	uint32_t rxq_model;
 	uint16_t num_tx_q;
 	uint16_t num_rx_q;
 
@@ -118,6 +120,9 @@ struct idpf_adapter {
 	uint32_t cmd_retval; /* return value of the cmd response from ipf */
 	uint8_t *mbx_resp; /* buffer to store the mailbox response from ipf */
 
+	uint32_t txq_model;
+	uint32_t rxq_model;
+
 	/* Vport info */
 	uint8_t **vport_req_info;
 	uint8_t **vport_recv_info;
@@ -197,6 +202,10 @@ int idpf_vc_check_api_version(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct rte_eth_dev *dev);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
+int idpf_vc_config_rxqs(struct idpf_vport *vport);
+int idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id);
+int idpf_vc_config_txqs(struct idpf_vport *vport);
+int idpf_vc_config_txq(struct idpf_vport *vport, uint16_t txq_id);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
drivers/net/idpf/idpf_rxtx.c new file +465 -0

465 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h new file +186 -0

186 lines not on this page · raw message

drivers/net/idpf/idpf_vchnl.c +251 -0

263 lines not on this page · raw message

drivers/net/idpf/meson.build +1 -0
index bf8bf58ef5..832f887296 100644
@@ -12,5 +12,6 @@ deps += ['common_idpf', 'security', 'cryptodev']
 
 sources = files(
     'idpf_ethdev.c',
+    'idpf_rxtx.c',
     'idpf_vchnl.c',
 )
Signature · 1 line
2.34.1
#79 lore raw

PATCH v7 4/14 net/idpf: add queue setup and release in split queue model

In reply to Junfeng Guo

Add support for queue operations in split queue model:
- rx_queue_setup
- rx_queue_release
- tx_queue_setup
- tx_queue_release

In the split queue model, "RX buffer queues" are used to pass descriptor buffers from SW to HW while Rx queues are used only to pass the descriptor completions, that is, descriptors that point to completed buffers, from HW to SW. This is contrary to the single queue model in which Rx queues are used for both purposes.

---
 drivers/net/idpf/idpf_ethdev.c |  34 ++-
 drivers/net/idpf/idpf_ethdev.h |  11 +
 drivers/net/idpf/idpf_rxtx.c   | 483 ++++++++++++++++++++++++++++++++-
 drivers/net/idpf/idpf_vchnl.c  | 127 ++++++++-
 4 files changed, 642 insertions(+), 13 deletions(-)
drivers/net/idpf/idpf_ethdev.c +32 -2
index 96af54f47b..f9717cd5ff 100644
@@ -90,13 +90,25 @@ idpf_init_vport_req_info(struct rte_eth_dev *dev)
 		(struct virtchnl2_create_vport *)adapter->vport_req_info[idx];
 
 	vport_info->vport_type = rte_cpu_to_le_16(VIRTCHNL2_VPORT_TYPE_DEFAULT);
-	if (adapter->txq_model) {
+	if (!adapter->txq_model) {
+		vport_info->txq_model =
+			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SPLIT);
+		vport_info->num_tx_q = IDPF_DEFAULT_TXQ_NUM;
+		vport_info->num_tx_complq =
+			IDPF_DEFAULT_TXQ_NUM * IDPF_TX_COMPLQ_PER_GRP;
+	} else {
 		vport_info->txq_model =
 			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SINGLE);
 		vport_info->num_tx_q = IDPF_DEFAULT_TXQ_NUM;
 		vport_info->num_tx_complq = 0;
 	}
-	if (adapter->rxq_model) {
+	if (!adapter->rxq_model) {
+		vport_info->rxq_model =
+			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SPLIT);
+		vport_info->num_rx_q = IDPF_DEFAULT_RXQ_NUM;
+		vport_info->num_rx_bufq =
+			IDPF_DEFAULT_RXQ_NUM * IDPF_RX_BUFQ_PER_GRP;
+	} else {
 		vport_info->rxq_model =
 			rte_cpu_to_le_16(VIRTCHNL2_QUEUE_MODEL_SINGLE);
 		vport_info->num_rx_q = IDPF_DEFAULT_RXQ_NUM;
@@ -134,7 +146,9 @@ idpf_init_vport(struct rte_eth_dev *dev)
 	vport->txq_model = vport_info->txq_model;
 	vport->rxq_model = vport_info->rxq_model;
 	vport->num_tx_q = vport_info->num_tx_q;
+	vport->num_tx_complq = vport_info->num_tx_complq;
 	vport->num_rx_q = vport_info->num_rx_q;
+	vport->num_rx_bufq = vport_info->num_rx_bufq;
 	vport->max_mtu = vport_info->max_mtu;
 	rte_memcpy(vport->default_mac_addr,
 		   vport_info->default_mac_addr, ETH_ALEN);
@@ -157,6 +171,22 @@ idpf_init_vport(struct rte_eth_dev *dev)
 				vport_info->chunks.chunks[i].qtail_reg_start;
 			vport->chunks_info.rx_qtail_spacing =
 				vport_info->chunks.chunks[i].qtail_reg_spacing;
+		} else if (vport_info->chunks.chunks[i].type ==
+			 VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION) {
+			vport->chunks_info.tx_compl_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.tx_compl_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.tx_compl_qtail_spacing =
+				vport_info->chunks.chunks[i].qtail_reg_spacing;
+		} else if (vport_info->chunks.chunks[i].type ==
+			 VIRTCHNL2_QUEUE_TYPE_RX_BUFFER) {
+			vport->chunks_info.rx_buf_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.rx_buf_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.rx_buf_qtail_spacing =
+				vport_info->chunks.chunks[i].qtail_reg_spacing;
 		}
 	}
 
drivers/net/idpf/idpf_ethdev.h +11 -0
index 8b7170f49e..270ab7b6de 100644
@@ -73,11 +73,18 @@ enum idpf_vc_result {
 struct idpf_chunks_info {
 	uint32_t tx_start_qid;
 	uint32_t rx_start_qid;
+	/* Valid only if split queue model */
+	uint32_t tx_compl_start_qid;
+	uint32_t rx_buf_start_qid;
 
 	uint64_t tx_qtail_start;
 	uint32_t tx_qtail_spacing;
 	uint64_t rx_qtail_start;
 	uint32_t rx_qtail_spacing;
+	uint64_t tx_compl_qtail_start;
+	uint32_t tx_compl_qtail_spacing;
+	uint64_t rx_buf_qtail_start;
+	uint32_t rx_buf_qtail_spacing;
 };
 
 struct idpf_vport {
@@ -86,7 +93,11 @@ struct idpf_vport {
 	uint32_t txq_model;
 	uint32_t rxq_model;
 	uint16_t num_tx_q;
+	/* valid only if txq_model is split Q */
+	uint16_t num_tx_complq;
 	uint16_t num_rx_q;
+	/* valid only if rxq_model is split Q */
+	uint16_t num_rx_bufq;
 
 	uint16_t max_mtu;
 	uint8_t default_mac_addr[VIRTCHNL_ETH_LENGTH_OF_ADDRESS];
drivers/net/idpf/idpf_rxtx.c +480 -3

525 lines not on this page · raw message

drivers/net/idpf/idpf_vchnl.c +119 -8

172 lines not on this page · raw message

Signature · 1 line
2.34.1
#80 lore raw

PATCH v7 5/14 net/idpf: add support for queue start and stop

In reply to Junfeng Guo

Add support for queue operations:
- rx_queue_start
- rx_queue_stop
- tx_queue_start
- tx_queue_stop

---
 doc/guides/nics/features/idpf.ini |   1 +
 drivers/net/idpf/idpf_ethdev.c    |  46 +++++
 drivers/net/idpf/idpf_ethdev.h    |   3 +
 drivers/net/idpf/idpf_rxtx.c      | 309 ++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h      |   6 +
 drivers/net/idpf/idpf_vchnl.c     | 150 +++++++++++++++
 6 files changed, 515 insertions(+)
doc/guides/nics/features/idpf.ini +1 -0
index 681a908194..597beec5d9 100644
@@ -7,6 +7,7 @@
 ; is selected.
 ;
 [Features]
+Queue start/stop     = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
 Multiprocess aware   = Y
drivers/net/idpf/idpf_ethdev.c +46 -0

76 lines not on this page · raw message

drivers/net/idpf/idpf_ethdev.h +3 -0
index 270ab7b6de..b625868ceb 100644
@@ -217,6 +217,9 @@ int idpf_vc_config_rxqs(struct idpf_vport *vport);
 int idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id);
 int idpf_vc_config_txqs(struct idpf_vport *vport);
 int idpf_vc_config_txq(struct idpf_vport *vport, uint16_t txq_id);
+int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
+		      bool rx, bool on);
+int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
drivers/net/idpf/idpf_rxtx.c +309 -0

318 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +6 -0
index 69a1fa6348..f0427b96c5 100644
@@ -175,12 +175,18 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 void idpf_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
 int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 
+void idpf_stop_queues(struct rte_eth_dev *dev);
+
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +150 -0

156 lines not on this page · raw message

Signature · 1 line
2.34.1
#81 lore raw

PATCH v7 6/14 net/idpf: add support for device information get

In reply to Junfeng Guo

Add dev ops dev_infos_get.

---
 drivers/net/idpf/idpf_ethdev.c | 50 ++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/net/idpf/idpf_ethdev.c +50 -0
index c25f222c5e..d1b6797d4a 100644
@@ -30,6 +30,8 @@ static int idpf_dev_configure(struct rte_eth_dev *dev);
 static int idpf_dev_start(struct rte_eth_dev *dev);
 static int idpf_dev_stop(struct rte_eth_dev *dev);
 static int idpf_dev_close(struct rte_eth_dev *dev);
+static int idpf_dev_info_get(struct rte_eth_dev *dev,
+			     struct rte_eth_dev_info *dev_info);
 static void idpf_adapter_rel(struct idpf_adapter *adapter);
 
 int
@@ -65,9 +67,57 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.rx_queue_release		= idpf_dev_rx_queue_release,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.tx_queue_release		= idpf_dev_tx_queue_release,
+	.dev_infos_get			= idpf_dev_info_get,
 	.link_update			= idpf_dev_link_update,
 };
 
+static int
+idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+
+	dev_info->max_rx_queues = adapter->caps->max_rx_q;
+	dev_info->max_tx_queues = adapter->caps->max_tx_q;
+	dev_info->min_rx_bufsize = IDPF_MIN_BUF_SIZE;
+	dev_info->max_rx_pktlen = IDPF_MAX_FRAME_SIZE;
+
+	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;
+	dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
+		RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
+
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_free_thresh = IDPF_DEFAULT_RX_FREE_THRESH,
+		.rx_drop_en = 0,
+		.offloads = 0,
+	};
+
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
+		.offloads = 0,
+	};
+
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = IDPF_MAX_RING_DESC,
+		.nb_min = IDPF_MIN_RING_DESC,
+		.nb_align = IDPF_ALIGN_RING_DESC,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = IDPF_MAX_RING_DESC,
+		.nb_min = IDPF_MIN_RING_DESC,
+		.nb_align = IDPF_ALIGN_RING_DESC,
+	};
+
+	dev_info->default_rxportconf.burst_size = IDPF_RX_MAX_BURST;
+	dev_info->default_txportconf.burst_size = IDPF_TX_MAX_BURST;
+	dev_info->default_rxportconf.nb_queues = 1;
+	dev_info->default_txportconf.nb_queues = 1;
+
+	return 0;
+}
+
 static int
 idpf_init_vport_req_info(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.34.1
#82 lore raw

PATCH v7 7/14 net/idpf: add support for packet type get

In reply to Junfeng Guo

Add dev ops dev_supported_ptypes_get.

---
 doc/guides/nics/features/idpf.ini |   1 +
 drivers/net/idpf/idpf_ethdev.c    |   7 +
 drivers/net/idpf/idpf_ethdev.h    |   2 +
 drivers/net/idpf/idpf_rxtx.c      |  19 +++
 drivers/net/idpf/idpf_rxtx.h      |   6 +
 drivers/net/idpf/idpf_vchnl.c     | 235 ++++++++++++++++++++++++++++++
 6 files changed, 270 insertions(+)
doc/guides/nics/features/idpf.ini +1 -0
index 597beec5d9..79ffafc0d4 100644
@@ -10,6 +10,7 @@
 Queue start/stop     = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Packet type parsing  = Y
 Multiprocess aware   = Y
 FreeBSD              = Y
 Linux                = Y
drivers/net/idpf/idpf_ethdev.c +7 -0
index d1b6797d4a..20f0f39640 100644
@@ -55,6 +55,7 @@ idpf_dev_link_update(struct rte_eth_dev *dev,
 }
 
 static const struct eth_dev_ops idpf_eth_dev_ops = {
+	.dev_supported_ptypes_get	= idpf_dev_supported_ptypes_get,
 	.dev_configure			= idpf_dev_configure,
 	.dev_start			= idpf_dev_start,
 	.dev_stop			= idpf_dev_stop,
@@ -652,6 +653,12 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 		goto err_api;
 	}
 
+	ret = idpf_get_pkt_type(adapter);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to set ptype table");
+		goto err_api;
+	}
+
 	adapter->caps = rte_zmalloc("idpf_caps",
 				sizeof(struct virtchnl2_get_capabilities), 0);
 	if (!adapter->caps) {
drivers/net/idpf/idpf_ethdev.h +2 -0
index b625868ceb..863d163330 100644
@@ -210,6 +210,7 @@ int idpf_dev_link_update(struct rte_eth_dev *dev,
 			 __rte_unused int wait_to_complete);
 void idpf_handle_virtchnl_msg(struct rte_eth_dev *dev);
 int idpf_vc_check_api_version(struct idpf_adapter *adapter);
+int idpf_get_pkt_type(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct rte_eth_dev *dev);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
@@ -221,6 +222,7 @@ int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
 		      bool rx, bool on);
 int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
+int idpf_vc_query_ptype_info(struct idpf_adapter *adapter);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
 
drivers/net/idpf/idpf_rxtx.c +19 -0
index 95193713c4..e92ea09c3b 100644
@@ -8,6 +8,25 @@
 #include "idpf_ethdev.h"
 #include "idpf_rxtx.h"
 
+const uint32_t *
+idpf_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
+{
+	static const uint32_t ptypes[] = {
+		RTE_PTYPE_L2_ETHER,
+		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
+		RTE_PTYPE_L3_IPV6_EXT_UNKNOWN,
+		RTE_PTYPE_L4_FRAG,
+		RTE_PTYPE_L4_NONFRAG,
+		RTE_PTYPE_L4_UDP,
+		RTE_PTYPE_L4_TCP,
+		RTE_PTYPE_L4_SCTP,
+		RTE_PTYPE_L4_ICMP,
+		RTE_PTYPE_UNKNOWN
+	};
+
+	return ptypes;
+}
+
 static inline int
 check_rx_thresh(uint16_t nb_desc, uint16_t thresh)
 {
drivers/net/idpf/idpf_rxtx.h +6 -0
index f0427b96c5..cd1dda4688 100644
@@ -47,6 +47,10 @@
 #define IDPF_TX_OFFLOAD_NOTSUP_MASK \
 		(RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK)
 
+#define IDPF_GET_PTYPE_SIZE(p) \
+	(sizeof(struct virtchnl2_ptype) + \
+	(((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0])))
+
 struct idpf_rx_queue {
 	struct idpf_adapter *adapter;	/* the adapter this queue belongs to */
 	struct rte_mempool *mp;		/* mbuf pool to populate Rx ring */
@@ -189,4 +193,6 @@ void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 
 void idpf_stop_queues(struct rte_eth_dev *dev);
 
+const uint32_t *idpf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
+
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +235 -0

244 lines not on this page · raw message

Signature · 1 line
2.34.1
#83 lore raw

PATCH v7 8/14 net/idpf: add support for basic Rx/Tx datapath

In reply to Junfeng Guo

Add basic Rx & Tx support in split queue mode and single queue mode. Split queue mode is selected by default.

---
 drivers/net/idpf/idpf_ethdev.c |   8 +-
 drivers/net/idpf/idpf_rxtx.c   | 667 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  16 +-
 3 files changed, 687 insertions(+), 4 deletions(-)
drivers/net/idpf/idpf_ethdev.c +7 -1
index 20f0f39640..c6d6c87274 100644
@@ -313,6 +313,9 @@ idpf_dev_start(struct rte_eth_dev *dev)
 		goto err_mtu;
 	}
 
+	idpf_set_rx_function(dev);
+	idpf_set_tx_function(dev);
+
 	if (idpf_vc_ena_dis_vport(vport, true)) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
 		goto err_vport;
@@ -764,8 +767,11 @@ idpf_dev_init(struct rte_eth_dev *dev, void *init_params)
 	/* for secondary processes, we don't initialise any further as primary
 	 * has already done this work.
 	 */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		idpf_set_rx_function(dev);
+		idpf_set_tx_function(dev);
 		return ret;
+	}
 
 	dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
drivers/net/idpf/idpf_rxtx.c +667 -0

670 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +13 -3
index cd1dda4688..bd3ebe2f50 100644
@@ -44,9 +44,6 @@
 #define IDPF_MAX_TSO_FRAME_SIZE	262143
 #define IDPF_TX_MAX_MTU_SEG     10
 
-#define IDPF_TX_OFFLOAD_NOTSUP_MASK \
-		(RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK)
-
 #define IDPF_GET_PTYPE_SIZE(p) \
 	(sizeof(struct virtchnl2_ptype) + \
 	(((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0])))
@@ -191,8 +188,21 @@ int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 
+uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+				uint16_t nb_pkts);
+uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+			       uint16_t nb_pkts);
+uint16_t idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+				uint16_t nb_pkts);
+uint16_t idpf_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			       uint16_t nb_pkts);
+uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			uint16_t nb_pkts);
 void idpf_stop_queues(struct rte_eth_dev *dev);
 
+void idpf_set_rx_function(struct rte_eth_dev *dev);
+void idpf_set_tx_function(struct rte_eth_dev *dev);
+
 const uint32_t *idpf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.34.1
#84 lore raw

PATCH v7 9/14 net/idpf: add support for Rx/Tx offloading

In reply to Junfeng Guo

Add Rx/Tx offloading support, including TSO and CHKSUM.

---
 doc/guides/nics/features/idpf.ini |   3 +
 drivers/net/idpf/idpf_ethdev.c    |  10 ++
 drivers/net/idpf/idpf_rxtx.c      | 212 +++++++++++++++++++++++++++++-
 drivers/net/idpf/idpf_rxtx.h      |  19 +++
 4 files changed, 242 insertions(+), 2 deletions(-)
doc/guides/nics/features/idpf.ini +3 -0
index 79ffafc0d4..36dec39b9f 100644
@@ -10,6 +10,9 @@
 Queue start/stop     = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+TSO                  = P
+L3 checksum offload  = P
+L4 checksum offload  = P
 Packet type parsing  = Y
 Multiprocess aware   = Y
 FreeBSD              = Y
drivers/net/idpf/idpf_ethdev.c +10 -0
index c6d6c87274..ffde2ce7d1 100644
@@ -86,6 +86,16 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;
 	dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
 		RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
+	dev_info->rx_offload_capa =
+		RTE_ETH_RX_OFFLOAD_IPV4_CKSUM		|
+		RTE_ETH_RX_OFFLOAD_UDP_CKSUM		|
+		RTE_ETH_RX_OFFLOAD_TCP_CKSUM		|
+		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+
+	dev_info->tx_offload_capa =
+		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS		|
+		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
 		.rx_free_thresh = IDPF_DEFAULT_RX_FREE_THRESH,
drivers/net/idpf/idpf_rxtx.c +210 -2

326 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +19 -0
index bd3ebe2f50..a2394ffa2c 100644
@@ -44,6 +44,25 @@
 #define IDPF_MAX_TSO_FRAME_SIZE	262143
 #define IDPF_TX_MAX_MTU_SEG     10
 
+#define IDPF_TX_CKSUM_OFFLOAD_MASK (		\
+		RTE_MBUF_F_TX_IP_CKSUM |	\
+		RTE_MBUF_F_TX_L4_MASK |		\
+		RTE_MBUF_F_TX_TCP_SEG)
+
+#define IDPF_TX_OFFLOAD_MASK (			\
+		RTE_MBUF_F_TX_OUTER_IPV6 |	\
+		RTE_MBUF_F_TX_OUTER_IPV4 |	\
+		RTE_MBUF_F_TX_IPV6 |		\
+		RTE_MBUF_F_TX_IPV4 |		\
+		RTE_MBUF_F_TX_VLAN |		\
+		RTE_MBUF_F_TX_IP_CKSUM |	\
+		RTE_MBUF_F_TX_L4_MASK |		\
+		RTE_MBUF_F_TX_TCP_SEG |		\
+		RTE_ETH_TX_OFFLOAD_SECURITY)
+
+#define IDPF_TX_OFFLOAD_NOTSUP_MASK \
+		(RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK)
+
 #define IDPF_GET_PTYPE_SIZE(p) \
 	(sizeof(struct virtchnl2_ptype) + \
 	(((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0])))
Signature · 1 line
2.34.1
#85 lore raw

PATCH v7 10/14 net/idpf: add support for RSS

In reply to Junfeng Guo

Add RSS support.

---
 drivers/net/idpf/idpf_ethdev.c | 123 ++++++++++++++++++++++++++++++++-
 drivers/net/idpf/idpf_ethdev.h |  26 +++++++
 drivers/net/idpf/idpf_rxtx.c   |  27 ++++++++
 drivers/net/idpf/idpf_vchnl.c  |  96 +++++++++++++++++++++++++
 4 files changed, 269 insertions(+), 3 deletions(-)
drivers/net/idpf/idpf_ethdev.c +120 -3
index ffde2ce7d1..cc1cfe402b 100644
@@ -83,6 +83,7 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->min_rx_bufsize = IDPF_MIN_BUF_SIZE;
 	dev_info->max_rx_pktlen = IDPF_MAX_FRAME_SIZE;
 
+	dev_info->flow_type_rss_offloads = IDPF_RSS_OFFLOAD_ALL;
 	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;
 	dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
 		RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
@@ -90,7 +91,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_RX_OFFLOAD_IPV4_CKSUM		|
 		RTE_ETH_RX_OFFLOAD_UDP_CKSUM		|
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM		|
-		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM	|
+		RTE_ETH_RX_OFFLOAD_RSS_HASH;
 
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
@@ -197,6 +199,10 @@ idpf_parse_devarg_id(char *name)
 	return val;
 }
 
+#ifndef IDPF_RSS_KEY_LEN
+#define IDPF_RSS_KEY_LEN 52
+#endif
+
 static int
 idpf_init_vport(struct rte_eth_dev *dev)
 {
@@ -217,6 +223,10 @@ idpf_init_vport(struct rte_eth_dev *dev)
 	vport->max_mtu = vport_info->max_mtu;
 	rte_memcpy(vport->default_mac_addr,
 		   vport_info->default_mac_addr, ETH_ALEN);
+	vport->rss_algorithm = vport_info->rss_algorithm;
+	vport->rss_key_size = RTE_MIN(IDPF_RSS_KEY_LEN,
+				     vport_info->rss_key_size);
+	vport->rss_lut_size = vport_info->rss_lut_size;
 	vport->sw_idx = idx;
 
 	for (i = 0; i < vport_info->chunks.num_chunks; i++) {
@@ -265,15 +275,116 @@ idpf_init_vport(struct rte_eth_dev *dev)
 }
 
 static int
-idpf_dev_configure(__rte_unused struct rte_eth_dev *dev)
+idpf_config_rss(struct idpf_vport *vport)
+{
+	int ret;
+
+	ret = idpf_vc_set_rss_key(vport);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS key");
+		return ret;
+	}
+
+	ret = idpf_vc_set_rss_lut(vport);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS lut");
+		return ret;
+	}
+
+	ret = idpf_vc_set_rss_hash(vport);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS hash");
+		return ret;
+	}
+
+	return ret;
+}
+
+static int
+idpf_init_rss(struct idpf_vport *vport)
+{
+	struct rte_eth_rss_conf *rss_conf;
+	uint16_t i, nb_q, lut_size;
+	int ret = 0;
+
+	rss_conf = &vport->dev_data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = vport->dev_data->nb_rx_queues;
+
+	vport->rss_key = (uint8_t *)rte_zmalloc("rss_key",
+					     vport->rss_key_size, 0);
+	if (!vport->rss_key) {
+		PMD_INIT_LOG(ERR, "Failed to allocate RSS key");
+		ret = -ENOMEM;
+		goto err_key;
+	}
+
+	lut_size = vport->rss_lut_size;
+	vport->rss_lut = (uint32_t *)rte_zmalloc("rss_lut",
+					      sizeof(uint32_t) * lut_size, 0);
+	if (!vport->rss_lut) {
+		PMD_INIT_LOG(ERR, "Failed to allocate RSS lut");
+		ret = -ENOMEM;
+		goto err_lut;
+	}
+
+	if (!rss_conf->rss_key) {
+		for (i = 0; i < vport->rss_key_size; i++)
+			vport->rss_key[i] = (uint8_t)rte_rand();
+	} else {
+		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+			   RTE_MIN(rss_conf->rss_key_len,
+				   vport->rss_key_size));
+	}
+
+	for (i = 0; i < lut_size; i++)
+		vport->rss_lut[i] = i % nb_q;
+
+	vport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;
+
+	ret = idpf_config_rss(vport);
+	if (ret) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS");
+		goto err_cfg;
+	}
+
+	return ret;
+
+err_cfg:
+	rte_free(vport->rss_lut);
+	vport->rss_lut = NULL;
+err_lut:
+	rte_free(vport->rss_key);
+	vport->rss_key = NULL;
+err_key:
+	return ret;
+}
+
+static int
+idpf_dev_configure(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	int ret = 0;
+
 	if (dev->data->nb_tx_queues > IDPF_DEFAULT_TXQ_NUM ||
 	    dev->data->nb_rx_queues > IDPF_DEFAULT_RXQ_NUM) {
 		PMD_INIT_LOG(ERR, "Invalid queue number.");
 		return -EINVAL;
 	}
 
-	return 0;
+	if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+		dev->data->dev_conf.rxmode.offloads |=
+			RTE_ETH_RX_OFFLOAD_RSS_HASH;
+
+	if (adapter->caps->rss_caps) {
+		ret = idpf_init_rss(vport);
+		if (ret) {
+			PMD_INIT_LOG(ERR, "Failed to init rss");
+			return ret;
+		}
+	}
+
+	return ret;
 }
 
 static int
@@ -372,6 +483,12 @@ idpf_dev_close(struct rte_eth_dev *dev)
 	idpf_dev_stop(dev);
 	idpf_vc_destroy_vport(vport);
 
+	rte_free(vport->rss_lut);
+	vport->rss_lut = NULL;
+
+	rte_free(vport->rss_key);
+	vport->rss_key = NULL;
+
 	adapter->cur_vports &= ~BIT(vport->devarg_id);
 
 	rte_free(vport);
drivers/net/idpf/idpf_ethdev.h +26 -0
index 863d163330..bba8223cc4 100644
@@ -56,6 +56,20 @@
 #define IDPF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IDPF_VLAN_TAG_SIZE * 2)
 
+#define IDPF_RSS_OFFLOAD_ALL ( \
+	RTE_ETH_RSS_IPV4		| \
+	RTE_ETH_RSS_FRAG_IPV4		| \
+	RTE_ETH_RSS_NONFRAG_IPV4_TCP	| \
+	RTE_ETH_RSS_NONFRAG_IPV4_UDP	| \
+	RTE_ETH_RSS_NONFRAG_IPV4_SCTP	| \
+	RTE_ETH_RSS_NONFRAG_IPV4_OTHER	| \
+	RTE_ETH_RSS_IPV6		| \
+	RTE_ETH_RSS_FRAG_IPV6		| \
+	RTE_ETH_RSS_NONFRAG_IPV6_TCP	| \
+	RTE_ETH_RSS_NONFRAG_IPV6_UDP	| \
+	RTE_ETH_RSS_NONFRAG_IPV6_SCTP	| \
+	RTE_ETH_RSS_NONFRAG_IPV6_OTHER)
+
 #ifndef ETH_ADDR_LEN
 #define ETH_ADDR_LEN		6
 #endif
@@ -102,11 +116,20 @@ struct idpf_vport {
 	uint16_t max_mtu;
 	uint8_t default_mac_addr[VIRTCHNL_ETH_LENGTH_OF_ADDRESS];
 
+	enum virtchnl_rss_algorithm rss_algorithm;
+	uint16_t rss_key_size;
+	uint16_t rss_lut_size;
+
 	uint16_t sw_idx; /* SW idx */
 
 	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t max_pkt_len; /* Maximum packet length */
 
+	/* RSS info */
+	uint32_t *rss_lut;
+	uint8_t *rss_key;
+	uint64_t rss_hf;
+
 	/* Chunk info */
 	struct idpf_chunks_info chunks_info;
 
@@ -214,6 +237,9 @@ int idpf_get_pkt_type(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct rte_eth_dev *dev);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
+int idpf_vc_set_rss_key(struct idpf_vport *vport);
+int idpf_vc_set_rss_lut(struct idpf_vport *vport);
+int idpf_vc_set_rss_hash(struct idpf_vport *vport);
 int idpf_vc_config_rxqs(struct idpf_vport *vport);
 int idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id);
 int idpf_vc_config_txqs(struct idpf_vport *vport);
drivers/net/idpf/idpf_rxtx.c +27 -0
index 31e266bbec..05976acf7f 100644
@@ -1310,6 +1310,32 @@ idpf_splitq_rx_csum_offload(uint8_t err)
 	return flags;
 }
 
+#define IDPF_RX_FLEX_DESC_ADV_HASH1_S	0
+#define IDPF_RX_FLEX_DESC_ADV_HASH2_S	16
+#define IDPF_RX_FLEX_DESC_ADV_HASH3_S	24
+
+static inline uint64_t
+idpf_splitq_rx_rss_offload(struct rte_mbuf *mb,
+			   volatile struct virtchnl2_rx_flex_desc_adv_nic_3 *rx_desc)
+{
+	uint8_t status_err0_qw0;
+	uint64_t flags = 0;
+
+	status_err0_qw0 = rx_desc->status_err0_qw0;
+
+	if (status_err0_qw0 & BIT(VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_RSS_VALID_S)) {
+		flags |= RTE_MBUF_F_RX_RSS_HASH;
+		mb->hash.rss = (rte_le_to_cpu_16(rx_desc->hash1) <<
+				IDPF_RX_FLEX_DESC_ADV_HASH1_S) |
+				((uint32_t)(rx_desc->ff2_mirrid_hash2.hash2) <<
+				IDPF_RX_FLEX_DESC_ADV_HASH2_S) |
+				((uint32_t)(rx_desc->hash3) <<
+				IDPF_RX_FLEX_DESC_ADV_HASH3_S);
+	}
+
+	return flags;
+}
+
 static void
 idpf_split_rx_bufq_refill(struct idpf_rx_queue *rx_bufq)
 {
@@ -1465,6 +1491,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 		status_err0_qw1 = rx_desc->status_err0_qw1;
 		pkt_flags = idpf_splitq_rx_csum_offload(status_err0_qw1);
+		pkt_flags |= idpf_splitq_rx_rss_offload(rxm, rx_desc);
 
 		rxm->ol_flags |= pkt_flags;
 
drivers/net/idpf/idpf_vchnl.c +96 -0

102 lines not on this page · raw message

Signature · 1 line
2.34.1
#86 lore raw

PATCH v7 11/14 net/idpf: add support for MTU configuration

In reply to Junfeng Guo

Add dev ops mtu_set.

---
 doc/guides/nics/features/idpf.ini |  1 +
 drivers/net/idpf/idpf_ethdev.c    | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)
doc/guides/nics/features/idpf.ini +1 -0
index 36dec39b9f..ee3f6e7c6f 100644
@@ -10,6 +10,7 @@
 Queue start/stop     = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+MTU update           = Y
 TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
drivers/net/idpf/idpf_ethdev.c +24 -0
index cc1cfe402b..803c0d7e12 100644
@@ -32,6 +32,7 @@ static int idpf_dev_stop(struct rte_eth_dev *dev);
 static int idpf_dev_close(struct rte_eth_dev *dev);
 static int idpf_dev_info_get(struct rte_eth_dev *dev,
 			     struct rte_eth_dev_info *dev_info);
+static int idpf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 static void idpf_adapter_rel(struct idpf_adapter *adapter);
 
 int
@@ -70,6 +71,7 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.tx_queue_release		= idpf_dev_tx_queue_release,
 	.dev_infos_get			= idpf_dev_info_get,
 	.link_update			= idpf_dev_link_update,
+	.mtu_set			= idpf_dev_mtu_set,
 };
 
 static int
@@ -83,6 +85,9 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->min_rx_bufsize = IDPF_MIN_BUF_SIZE;
 	dev_info->max_rx_pktlen = IDPF_MAX_FRAME_SIZE;
 
+	dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD;
+	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
+
 	dev_info->flow_type_rss_offloads = IDPF_RSS_OFFLOAD_ALL;
 	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;
 	dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
@@ -131,6 +136,18 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	return 0;
 }
 
+static int
+idpf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused)
+{
+	/* mtu setting is forbidden if port is start */
+	if (dev->data->dev_started) {
+		PMD_DRV_LOG(ERR, "port must be stopped before configuration");
+		return -EBUSY;
+	}
+
+	return 0;
+}
+
 static int
 idpf_init_vport_req_info(struct rte_eth_dev *dev)
 {
@@ -429,6 +446,13 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	vport->stopped = 0;
 
+	if (dev->data->mtu > vport->max_mtu) {
+		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
+		goto err_mtu;
+	}
+
+	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
+
 	if (idpf_start_queues(dev)) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
 		goto err_mtu;
Signature · 1 line
2.34.1
#87 lore raw

PATCH v7 12/14 net/idpf: add support for write back based on ITR expire

In reply to Junfeng Guo

Force write-backs by setting WB_ON_ITR bit in DYN_CTL register, so that the packets can be received once at a time.

---
 drivers/net/idpf/idpf_ethdev.c | 119 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h |   8 +++
 drivers/net/idpf/idpf_vchnl.c  | 107 +++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+)
drivers/net/idpf/idpf_ethdev.c +119 -0
index 803c0d7e12..ac70c029b0 100644
@@ -404,6 +404,90 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return ret;
 }
 
+static int
+idpf_config_rx_queues_irqs(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	struct virtchnl2_queue_vector *qv_map;
+	struct idpf_hw *hw = &adapter->hw;
+	uint32_t dynctl_reg_start;
+	uint32_t itrn_reg_start;
+	uint32_t dynctl_val, itrn_val;
+	uint16_t i;
+
+	qv_map = rte_zmalloc("qv_map",
+			dev->data->nb_rx_queues *
+			sizeof(struct virtchnl2_queue_vector), 0);
+	if (!qv_map) {
+		PMD_DRV_LOG(ERR, "Failed to allocate %d queue-vector map",
+			    dev->data->nb_rx_queues);
+		goto qv_map_alloc_err;
+	}
+
+	/* Rx interrupt disabled, Map interrupt only for writeback */
+
+	/* The capability flags adapter->caps->other_caps here should be
+	 * compared with bit VIRTCHNL2_CAP_WB_ON_ITR. The if condition should
+	 * be updated when the FW can return correct flag bits.
+	 */
+	if (adapter->caps->other_caps) {
+		dynctl_reg_start =
+			vport->recv_vectors->vchunks.vchunks->dynctl_reg_start;
+		itrn_reg_start =
+			vport->recv_vectors->vchunks.vchunks->itrn_reg_start;
+		dynctl_val = IDPF_READ_REG(hw, dynctl_reg_start);
+		PMD_DRV_LOG(DEBUG, "Value of dynctl_reg_start is 0x%x",
+			    dynctl_val);
+		itrn_val = IDPF_READ_REG(hw, itrn_reg_start);
+		PMD_DRV_LOG(DEBUG, "Value of itrn_reg_start is 0x%x", itrn_val);
+		/* Force write-backs by setting WB_ON_ITR bit in DYN_CTL
+		 * register. WB_ON_ITR and INTENA are mutually exclusive
+		 * bits. Setting WB_ON_ITR bits means TX and RX Descs
+		 * are written back based on ITR expiration irrespective
+		 * of INTENA setting.
+		 */
+		/* TBD: need to tune INTERVAL value for better performance. */
+		if (itrn_val)
+			IDPF_WRITE_REG(hw,
+				       dynctl_reg_start,
+				       VIRTCHNL2_ITR_IDX_0  <<
+				       PF_GLINT_DYN_CTL_ITR_INDX_S |
+				       PF_GLINT_DYN_CTL_WB_ON_ITR_M |
+				       itrn_val <<
+				       PF_GLINT_DYN_CTL_INTERVAL_S);
+		else
+			IDPF_WRITE_REG(hw,
+				       dynctl_reg_start,
+				       VIRTCHNL2_ITR_IDX_0  <<
+				       PF_GLINT_DYN_CTL_ITR_INDX_S |
+				       PF_GLINT_DYN_CTL_WB_ON_ITR_M |
+				       IDPF_DFLT_INTERVAL <<
+				       PF_GLINT_DYN_CTL_INTERVAL_S);
+	}
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		/* map all queues to the same vector */
+		qv_map[i].queue_id = vport->chunks_info.rx_start_qid + i;
+		qv_map[i].vector_id =
+			vport->recv_vectors->vchunks.vchunks->start_vector_id;
+	}
+	vport->qv_map = qv_map;
+
+	if (idpf_vc_config_irq_map_unmap(vport, true)) {
+		PMD_DRV_LOG(ERR, "config interrupt mapping failed");
+		goto config_irq_map_err;
+	}
+
+	return 0;
+
+config_irq_map_err:
+	rte_free(vport->qv_map);
+	vport->qv_map = NULL;
+
+qv_map_alloc_err:
+	return -1;
+}
+
 static int
 idpf_start_queues(struct rte_eth_dev *dev)
 {
@@ -441,6 +525,10 @@ static int
 idpf_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t num_allocated_vectors =
+		adapter->caps->num_allocated_vectors;
+	uint16_t req_vecs_num;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -453,6 +541,23 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
 
+	req_vecs_num = IDPF_DFLT_Q_VEC_NUM;
+	if (req_vecs_num + adapter->used_vecs_num > num_allocated_vectors) {
+		PMD_DRV_LOG(ERR, "The accumulated request vectors' number should be less than %d",
+			    num_allocated_vectors);
+		goto err_mtu;
+	}
+	if (idpf_vc_alloc_vectors(vport, req_vecs_num)) {
+		PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors");
+		goto err_mtu;
+	}
+	adapter->used_vecs_num += req_vecs_num;
+
+	if (idpf_config_rx_queues_irqs(dev)) {
+		PMD_DRV_LOG(ERR, "Failed to configure irqs");
+		goto err_mtu;
+	}
+
 	if (idpf_start_queues(dev)) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
 		goto err_mtu;
@@ -489,6 +594,12 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_stop_queues(dev);
 
+	if (idpf_vc_config_irq_map_unmap(vport, false))
+		PMD_DRV_LOG(ERR, "config interrupt unmapping failed");
+
+	if (idpf_vc_dealloc_vectors(vport))
+		PMD_DRV_LOG(ERR, "deallocate interrupt vectors failed");
+
 	vport->stopped = 1;
 	dev->data->dev_started = 0;
 
@@ -513,6 +624,12 @@ idpf_dev_close(struct rte_eth_dev *dev)
 	rte_free(vport->rss_key);
 	vport->rss_key = NULL;
 
+	rte_free(vport->recv_vectors);
+	vport->recv_vectors = NULL;
+
+	rte_free(vport->qv_map);
+	vport->qv_map = NULL;
+
 	adapter->cur_vports &= ~BIT(vport->devarg_id);
 
 	rte_free(vport);
@@ -864,6 +981,8 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 	adapter->cur_vports = 0;
 	adapter->cur_vport_nb = 0;
 
+	adapter->used_vecs_num = 0;
+
 	return ret;
 
 err_vports:
drivers/net/idpf/idpf_ethdev.h +8 -0
index bba8223cc4..505b3f36e3 100644
@@ -130,6 +130,11 @@ struct idpf_vport {
 	uint8_t *rss_key;
 	uint64_t rss_hf;
 
+	/* MSIX info*/
+	struct virtchnl2_queue_vector *qv_map; /* queue vector mapping */
+	uint16_t max_vectors;
+	struct virtchnl2_alloc_vectors *recv_vectors;
+
 	/* Chunk info */
 	struct idpf_chunks_info chunks_info;
 
@@ -248,6 +253,9 @@ int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
 		      bool rx, bool on);
 int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
+int idpf_vc_config_irq_map_unmap(struct idpf_vport *vport, bool map);
+int idpf_vc_alloc_vectors(struct idpf_vport *vport, uint16_t num_vectors);
+int idpf_vc_dealloc_vectors(struct idpf_vport *vport);
 int idpf_vc_query_ptype_info(struct idpf_adapter *adapter);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
drivers/net/idpf/idpf_vchnl.c +107 -0

113 lines not on this page · raw message

Signature · 1 line
2.34.1
#88 lore raw

PATCH v7 13/14 net/idpf: add AVX512 data path for single queue model

In reply to Junfeng Guo

Add support of AVX512 vector data path for single queue model.

---
 doc/guides/nics/idpf.rst                |  20 +
 drivers/net/idpf/idpf_ethdev.h          |   5 +
 drivers/net/idpf/idpf_rxtx.c            | 146 ++++
 drivers/net/idpf/idpf_rxtx.h            |   7 +
 drivers/net/idpf/idpf_rxtx_vec_avx512.c | 871 ++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx_vec_common.h | 100 +++
 drivers/net/idpf/meson.build            |  28 +
 7 files changed, 1177 insertions(+)
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
doc/guides/nics/idpf.rst +20 -0
index 84b21e7be0..8f81894e27 100644
@@ -72,3 +72,23 @@ Driver compilation and testing
 
 Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
 for details.
+
+Features
+--------
+
+Vector PMD
+~~~~~~~~~~
+
+Vector path for RX and TX path are selected automatically. The paths
+are chosen based on 2 conditions.
+
+- ``CPU``
+  On the X86 platform, the driver checks if the CPU supports AVX512.
+  If the CPU supports AVX512 and EAL argument ``--force-max-simd-bitwidth``
+  is set to 512, AVX512 paths will be chosen.
+
+- ``Offload features``
+  The supported HW offload features are described in the document idpf.ini,
+  A value "P" means the offload feature is not supported by vector path.
+  If any not supported features are used, idpf vector PMD is disabled and the
+  scalar paths are chosen.
drivers/net/idpf/idpf_ethdev.h +5 -0
index 505b3f36e3..9b0de772c9 100644
@@ -182,6 +182,11 @@ struct idpf_adapter {
 	uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned;
 
 	bool stopped;
+
+	bool rx_vec_allowed;
+	bool tx_vec_allowed;
+	bool rx_use_avx512;
+	bool tx_use_avx512;
 };
 
 TAILQ_HEAD(idpf_adapter_list, idpf_adapter);
drivers/net/idpf/idpf_rxtx.c +146 -0

181 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +7 -0
index a2394ffa2c..8f440557bd 100644
@@ -211,12 +211,19 @@ uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts);
 uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			       uint16_t nb_pkts);
+uint16_t idpf_singleq_recv_pkts_avx512(void *rx_queue, struct rte_mbuf **rx_pkts,
+				       uint16_t nb_pkts);
 uint16_t idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				uint16_t nb_pkts);
 uint16_t idpf_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       uint16_t nb_pkts);
+uint16_t idpf_singleq_xmit_pkts_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
+				       uint16_t nb_pkts);
+int idpf_singleq_tx_vec_setup_avx512(struct idpf_tx_queue *txq);
 uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			uint16_t nb_pkts);
+int idpf_singleq_rx_vec_setup(struct idpf_rx_queue *rxq);
+
 void idpf_stop_queues(struct rte_eth_dev *dev);
 
 void idpf_set_rx_function(struct rte_eth_dev *dev);
drivers/net/idpf/idpf_rxtx_vec_avx512.c new file +871 -0

871 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx_vec_common.h new file +100 -0

100 lines not on this page · raw message

drivers/net/idpf/meson.build +28 -0
index 832f887296..c96e4bfcaa 100644
@@ -15,3 +15,31 @@ sources = files(
     'idpf_rxtx.c',
     'idpf_vchnl.c',
 )
+
+if arch_subdir == 'x86'
+    idpf_avx512_cpu_support = (
+        cc.get_define('__AVX512F__', args: machine_args) != '' and
+        cc.get_define('__AVX512BW__', args: machine_args) != ''
+    )
+
+    idpf_avx512_cc_support = (
+        not machine_args.contains('-mno-avx512f') and
+        cc.has_argument('-mavx512f') and
+        cc.has_argument('-mavx512bw')
+    )
+
+    if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true
+        cflags += ['-DCC_AVX512_SUPPORT']
+        avx512_args = [cflags, '-mavx512f', '-mavx512bw']
+        if cc.has_argument('-march=skylake-avx512')
+            avx512_args += '-march=skylake-avx512'
+        endif
+        idpf_avx512_lib = static_library('idpf_avx512_lib',
+            'idpf_rxtx_vec_avx512.c',
+            dependencies: [static_rte_ethdev, static_rte_bus_pci,
+            static_rte_kvargs, static_rte_hash],
+            include_directories: includes,
+            c_args: avx512_args)
+        objs += idpf_avx512_lib.extract_objects('idpf_rxtx_vec_avx512.c')
+    endif
+endif
Signature · 1 line
2.34.1
#89 lore raw

PATCH v7 14/14 net/idpf: add support for timestamp offload

In reply to Junfeng Guo

Add support for timestamp offload.

---
 doc/guides/nics/features/idpf.ini |  1 +
 drivers/net/idpf/idpf_ethdev.c    |  5 +-
 drivers/net/idpf/idpf_ethdev.h    |  3 ++
 drivers/net/idpf/idpf_rxtx.c      | 57 ++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h      | 90 +++++++++++++++++++++++++++++++
 5 files changed, 155 insertions(+), 1 deletion(-)
doc/guides/nics/features/idpf.ini +1 -0
index ee3f6e7c6f..145d995f51 100644
@@ -14,6 +14,7 @@ MTU update           = Y
 TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
+Timestamp offload    = P
 Packet type parsing  = Y
 Multiprocess aware   = Y
 FreeBSD              = Y
drivers/net/idpf/idpf_ethdev.c +4 -1
index ac70c029b0..c3f628655c 100644
@@ -19,6 +19,8 @@
 struct idpf_adapter_list adapter_list;
 bool adapter_list_init;
 
+uint64_t idpf_timestamp_dynflag;
+
 static const char * const idpf_valid_args[] = {
 	IDPF_TX_SINGLE_Q,
 	IDPF_RX_SINGLE_Q,
@@ -97,7 +99,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_RX_OFFLOAD_UDP_CKSUM		|
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM		|
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM	|
-		RTE_ETH_RX_OFFLOAD_RSS_HASH;
+		RTE_ETH_RX_OFFLOAD_RSS_HASH		|
+		RTE_ETH_RX_OFFLOAD_TIMESTAMP;
 
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
drivers/net/idpf/idpf_ethdev.h +3 -0
index 9b0de772c9..49919e5c74 100644
@@ -187,6 +187,9 @@ struct idpf_adapter {
 	bool tx_vec_allowed;
 	bool rx_use_avx512;
 	bool tx_use_avx512;
+
+	/* For PTP */
+	uint64_t time_hw;
 };
 
 TAILQ_HEAD(idpf_adapter_list, idpf_adapter);
drivers/net/idpf/idpf_rxtx.c +57 -0

120 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +90 -0

106 lines not on this page · raw message

Signature · 1 line
2.34.1
#90 lore raw

v8 cover add support for idpf PMD in DPDK

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452).
The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation.
Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v8:
fixed build errors.

Junfeng Guo (14):
common/idpf: introduce common library
net/idpf: add support for device initialization net/idpf: add queue setup and release in single queue model net/idpf: add queue setup and release in split queue model net/idpf: add support for queue start and stop net/idpf: add support for device information get net/idpf: add support for packet type get net/idpf: add support for basic Rx/Tx datapath net/idpf: add support for Rx/Tx offloading net/idpf: add support for RSS
net/idpf: add support for MTU configuration net/idpf: add support for write back based on ITR expire net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 MAINTAINERS                                 |    9 +
 doc/guides/nics/features/idpf.ini           |   24 +
 doc/guides/nics/idpf.rst                    |   94 +
 doc/guides/nics/index.rst                   |    1 +
 doc/guides/rel_notes/release_22_11.rst      |    6 +
 drivers/common/idpf/idpf_alloc.h            |   22 +
 drivers/common/idpf/idpf_common.c           |  364 +++
 drivers/common/idpf/idpf_controlq.c         |  691 +++++
 drivers/common/idpf/idpf_controlq.h         |  224 ++
 drivers/common/idpf/idpf_controlq_api.h     |  234 ++
 drivers/common/idpf/idpf_controlq_setup.c   |  179 ++
 drivers/common/idpf/idpf_devids.h           |   18 +
 drivers/common/idpf/idpf_lan_pf_regs.h      |  134 +
 drivers/common/idpf/idpf_lan_txrx.h         |  428 +++
 drivers/common/idpf/idpf_lan_vf_regs.h      |  114 +
 drivers/common/idpf/idpf_osdep.h            |  374 +++
 drivers/common/idpf/idpf_prototype.h        |   45 +
 drivers/common/idpf/idpf_type.h             |  106 +
 drivers/common/idpf/meson.build             |   14 +
 drivers/common/idpf/siov_regs.h             |   47 +
 drivers/common/idpf/version.map             |   12 +
 drivers/common/idpf/virtchnl.h              | 2866 +++++++++++++++++++
 drivers/common/idpf/virtchnl2.h             | 1462 ++++++++++
 drivers/common/idpf/virtchnl2_lan_desc.h    |  606 ++++
 drivers/common/idpf/virtchnl_inline_ipsec.h |  567 ++++
 drivers/common/meson.build                  |    1 +
 drivers/net/idpf/idpf_ethdev.c              | 1244 ++++++++
 drivers/net/idpf/idpf_ethdev.h              |  271 ++
 drivers/net/idpf/idpf_logs.h                |   42 +
 drivers/net/idpf/idpf_rxtx.c                | 2375 +++++++++++++++
 drivers/net/idpf/idpf_rxtx.h                |  324 +++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c     |  871 ++++++
 drivers/net/idpf/idpf_rxtx_vec_common.h     |  100 +
 drivers/net/idpf/idpf_vchnl.c               | 1445 ++++++++++
 drivers/net/idpf/meson.build                |   45 +
 drivers/net/idpf/version.map                |    3 +
 drivers/net/meson.build                     |    1 +
 37 files changed, 15363 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/common/idpf/idpf_alloc.h
 create mode 100644 drivers/common/idpf/idpf_common.c
 create mode 100644 drivers/common/idpf/idpf_controlq.c
 create mode 100644 drivers/common/idpf/idpf_controlq.h
 create mode 100644 drivers/common/idpf/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/idpf_devids.h
 create mode 100644 drivers/common/idpf/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/idpf_osdep.h
 create mode 100644 drivers/common/idpf/idpf_prototype.h
 create mode 100644 drivers/common/idpf/idpf_type.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/siov_regs.h
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/common/idpf/virtchnl.h
 create mode 100644 drivers/common/idpf/virtchnl2.h
 create mode 100644 drivers/common/idpf/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/virtchnl_inline_ipsec.h
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
Signature · 1 line
2.34.1
#91 lore raw

PATCH v8 1/14 common/idpf: introduce common library

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.

Also add OS specific implementation about some MACRO definitions and small functions which are specific for DPDK.

---
 drivers/common/idpf/idpf_alloc.h            |   22 +
 drivers/common/idpf/idpf_common.c           |  364 +++
 drivers/common/idpf/idpf_controlq.c         |  691 +++++
 drivers/common/idpf/idpf_controlq.h         |  224 ++
 drivers/common/idpf/idpf_controlq_api.h     |  234 ++
 drivers/common/idpf/idpf_controlq_setup.c   |  179 ++
 drivers/common/idpf/idpf_devids.h           |   18 +
 drivers/common/idpf/idpf_lan_pf_regs.h      |  134 +
 drivers/common/idpf/idpf_lan_txrx.h         |  428 +++
 drivers/common/idpf/idpf_lan_vf_regs.h      |  114 +
 drivers/common/idpf/idpf_osdep.h            |  374 +++
 drivers/common/idpf/idpf_prototype.h        |   45 +
 drivers/common/idpf/idpf_type.h             |  106 +
 drivers/common/idpf/meson.build             |   14 +
 drivers/common/idpf/siov_regs.h             |   47 +
 drivers/common/idpf/version.map             |   12 +
 drivers/common/idpf/virtchnl.h              | 2866 +++++++++++++++++++
 drivers/common/idpf/virtchnl2.h             | 1462 ++++++++++
 drivers/common/idpf/virtchnl2_lan_desc.h    |  606 ++++
 drivers/common/idpf/virtchnl_inline_ipsec.h |  567 ++++
 drivers/common/meson.build                  |    1 +
 21 files changed, 8508 insertions(+)
 create mode 100644 drivers/common/idpf/idpf_alloc.h
 create mode 100644 drivers/common/idpf/idpf_common.c
 create mode 100644 drivers/common/idpf/idpf_controlq.c
 create mode 100644 drivers/common/idpf/idpf_controlq.h
 create mode 100644 drivers/common/idpf/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/idpf_devids.h
 create mode 100644 drivers/common/idpf/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/idpf_osdep.h
 create mode 100644 drivers/common/idpf/idpf_prototype.h
 create mode 100644 drivers/common/idpf/idpf_type.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/siov_regs.h
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/common/idpf/virtchnl.h
 create mode 100644 drivers/common/idpf/virtchnl2.h
 create mode 100644 drivers/common/idpf/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/virtchnl_inline_ipsec.h
drivers/common/idpf/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/idpf_controlq_api.h new file +234 -0

234 lines not on this page · raw message

drivers/common/idpf/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/idpf_osdep.h new file +374 -0

374 lines not on this page · raw message

drivers/common/idpf/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/meson.build new file +14 -0
new file mode 100644
index 0000000000..183587b51a
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
drivers/common/idpf/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752
@@ -0,0 +1,12 @@
+INTERNAL {
+	global:
+
+	idpf_ctlq_deinit;
+	idpf_ctlq_init;
+	idpf_ctlq_clean_sq;
[… more lines in the raw message]

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

drivers/common/idpf/virtchnl.h new file +2866 -0

2,866 lines not on this page · raw message

drivers/common/idpf/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.34.1

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

#92 lore raw

v9 cover add support for idpf PMD in DPDK

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452).
The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation.
Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

Junfeng Guo (14):
common/idpf: introduce common library
net/idpf: add support for device initialization net/idpf: add queue setup and release in single queue model net/idpf: add queue setup and release in split queue model net/idpf: add support for queue start and stop net/idpf: add support for device information get net/idpf: add support for packet type get net/idpf: add support for basic Rx/Tx datapath net/idpf: add support for Rx/Tx offloading net/idpf: add support for RSS
net/idpf: add support for MTU configuration net/idpf: add support for write back based on ITR expire net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 MAINTAINERS                                 |    9 +
 doc/guides/nics/features/idpf.ini           |   24 +
 doc/guides/nics/idpf.rst                    |   94 +
 doc/guides/nics/index.rst                   |    1 +
 doc/guides/rel_notes/release_22_11.rst      |    6 +
 drivers/common/idpf/idpf_alloc.h            |   22 +
 drivers/common/idpf/idpf_common.c           |  364 +++
 drivers/common/idpf/idpf_controlq.c         |  691 +++++
 drivers/common/idpf/idpf_controlq.h         |  224 ++
 drivers/common/idpf/idpf_controlq_api.h     |  234 ++
 drivers/common/idpf/idpf_controlq_setup.c   |  179 ++
 drivers/common/idpf/idpf_devids.h           |   18 +
 drivers/common/idpf/idpf_lan_pf_regs.h      |  134 +
 drivers/common/idpf/idpf_lan_txrx.h         |  428 +++
 drivers/common/idpf/idpf_lan_vf_regs.h      |  114 +
 drivers/common/idpf/idpf_osdep.h            |  364 +++
 drivers/common/idpf/idpf_prototype.h        |   45 +
 drivers/common/idpf/idpf_type.h             |  106 +
 drivers/common/idpf/meson.build             |   14 +
 drivers/common/idpf/siov_regs.h             |   47 +
 drivers/common/idpf/version.map             |   12 +
 drivers/common/idpf/virtchnl.h              | 2866 +++++++++++++++++++
 drivers/common/idpf/virtchnl2.h             | 1462 ++++++++++
 drivers/common/idpf/virtchnl2_lan_desc.h    |  606 ++++
 drivers/common/idpf/virtchnl_inline_ipsec.h |  567 ++++
 drivers/common/meson.build                  |    1 +
 drivers/net/idpf/idpf_ethdev.c              | 1244 ++++++++
 drivers/net/idpf/idpf_ethdev.h              |  273 ++
 drivers/net/idpf/idpf_logs.h                |   42 +
 drivers/net/idpf/idpf_rxtx.c                | 2375 +++++++++++++++
 drivers/net/idpf/idpf_rxtx.h                |  324 +++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c     |  871 ++++++
 drivers/net/idpf/idpf_rxtx_vec_common.h     |  100 +
 drivers/net/idpf/idpf_vchnl.c               | 1445 ++++++++++
 drivers/net/idpf/meson.build                |   45 +
 drivers/net/idpf/version.map                |    3 +
 drivers/net/meson.build                     |    1 +
 37 files changed, 15355 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/common/idpf/idpf_alloc.h
 create mode 100644 drivers/common/idpf/idpf_common.c
 create mode 100644 drivers/common/idpf/idpf_controlq.c
 create mode 100644 drivers/common/idpf/idpf_controlq.h
 create mode 100644 drivers/common/idpf/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/idpf_devids.h
 create mode 100644 drivers/common/idpf/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/idpf_osdep.h
 create mode 100644 drivers/common/idpf/idpf_prototype.h
 create mode 100644 drivers/common/idpf/idpf_type.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/siov_regs.h
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/common/idpf/virtchnl.h
 create mode 100644 drivers/common/idpf/virtchnl2.h
 create mode 100644 drivers/common/idpf/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/virtchnl_inline_ipsec.h
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
Signature · 1 line
2.34.1
#93 lore raw

PATCH v9 1/14 common/idpf: introduce common library

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.

Also add OS specific implementation about some MACRO definitions and small functions which are specific for DPDK.

---
 drivers/common/idpf/idpf_alloc.h            |   22 +
 drivers/common/idpf/idpf_common.c           |  364 +++
 drivers/common/idpf/idpf_controlq.c         |  691 +++++
 drivers/common/idpf/idpf_controlq.h         |  224 ++
 drivers/common/idpf/idpf_controlq_api.h     |  234 ++
 drivers/common/idpf/idpf_controlq_setup.c   |  179 ++
 drivers/common/idpf/idpf_devids.h           |   18 +
 drivers/common/idpf/idpf_lan_pf_regs.h      |  134 +
 drivers/common/idpf/idpf_lan_txrx.h         |  428 +++
 drivers/common/idpf/idpf_lan_vf_regs.h      |  114 +
 drivers/common/idpf/idpf_osdep.h            |  364 +++
 drivers/common/idpf/idpf_prototype.h        |   45 +
 drivers/common/idpf/idpf_type.h             |  106 +
 drivers/common/idpf/meson.build             |   14 +
 drivers/common/idpf/siov_regs.h             |   47 +
 drivers/common/idpf/version.map             |   12 +
 drivers/common/idpf/virtchnl.h              | 2866 +++++++++++++++++++
 drivers/common/idpf/virtchnl2.h             | 1462 ++++++++++
 drivers/common/idpf/virtchnl2_lan_desc.h    |  606 ++++
 drivers/common/idpf/virtchnl_inline_ipsec.h |  567 ++++
 drivers/common/meson.build                  |    1 +
 21 files changed, 8498 insertions(+)
 create mode 100644 drivers/common/idpf/idpf_alloc.h
 create mode 100644 drivers/common/idpf/idpf_common.c
 create mode 100644 drivers/common/idpf/idpf_controlq.c
 create mode 100644 drivers/common/idpf/idpf_controlq.h
 create mode 100644 drivers/common/idpf/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/idpf_devids.h
 create mode 100644 drivers/common/idpf/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/idpf_osdep.h
 create mode 100644 drivers/common/idpf/idpf_prototype.h
 create mode 100644 drivers/common/idpf/idpf_type.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/siov_regs.h
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/common/idpf/virtchnl.h
 create mode 100644 drivers/common/idpf/virtchnl2.h
 create mode 100644 drivers/common/idpf/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/virtchnl_inline_ipsec.h
drivers/common/idpf/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/idpf_controlq_api.h new file +234 -0

234 lines not on this page · raw message

drivers/common/idpf/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/idpf_osdep.h new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/meson.build new file +14 -0
new file mode 100644
index 0000000000..183587b51a
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
drivers/common/idpf/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752
@@ -0,0 +1,12 @@
+INTERNAL {
+	global:
+
+	idpf_ctlq_deinit;
+	idpf_ctlq_init;
+	idpf_ctlq_clean_sq;
+	idpf_ctlq_recv;
+	idpf_ctlq_send;
+	idpf_ctlq_post_rx_buffs;
+
+	local: *;
+};
drivers/common/idpf/virtchnl.h new file +2866 -0

4 lines not on this page · raw message

drivers/common/idpf/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.34.1

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

#94 lore raw

Re: [PATCH v9 01/14] common/idpf: introduce common library

Quoted 5 lines · Junfeng Guo

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.

Also add OS specific implementation about some MACRO definitions and small functions which are specific for DPDK.

Common drivers are required when different class drivers need to share some code. So, it must be expalined here why do you create common driver instead of usage of base/ driver in your net driver.

Note that common driver is a DPDK driver and it must follow DPDK coding style. If the code is actually shared with something else and do not follow DPDK coding style from the very beginning (since it is an existing code), it should be in base/ subdir in either common driver or net driver.

Also you should not use own trivial wrappers for DPDK API in DPDK-specific code. It just complicates reading. E.g. BIT() vs RTE_BIT32().

So, I need an answer on above questions before I continue review.

Quoted 4 lines

[snip]

Quoted 6 lines
drivers/common/idpf/idpf_alloc.h new file +0 -0
new file mode 100644
index 0000000000..bc054851b3

drivers/common/idpf/idpf_alloc.h line 8

Quoted 8 lines
drivers/common/idpf/idpf_alloc.h new file +8 -0
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */

If it is a DPDK-specific driver and it is an interface provided by common driver, it should use Doxygen-style comments to be a part of genereated API documentation.

#95 lore raw

RE: [PATCH v9 01/14] common/idpf: introduce common library

Quoted 15 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, October 21, 2022 2:40 PM
To: Guo, Junfeng <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Wang, Xiao W <[email protected]>
Subject: Re: [PATCH v9 01/14] common/idpf: introduce common library

Quoted 3 lines · Junfeng Guo

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.

Quoted 6 lines
Quoted 2 lines

Also add OS specific implementation about some MACRO definitions and small functions which are specific for DPDK.

Common drivers are required when different class drivers need to share some code. So, it must be expalined here why do you create common driver instead of usage of base/ driver in your net driver.

Hi Andrew,
Thanks for all your comments.
The common driver will be also used in another PMD which should be upstream in 23.03, so we create it.

Quoted 5 lines

Note that common driver is a DPDK driver and it must follow DPDK coding style. If the code is actually shared with something else and do not follow DPDK coding style from the very beginning (since it is an existing code), it should be in base/ subdir in either common driver or net driver.

The common driver is a BSD license release provided by Intel internal team, basically we won't change it. It's the same process as Intel other PMDs, such as base driver of iavf, etc. Is it OK if it's in common/idpf/base/ folder?

Quoted 4 lines

Also you should not use own trivial wrappers for DPDK API in DPDK-specific code. It just complicates reading.
E.g. BIT() vs RTE_BIT32().

Make sense, will try my best to address all your comments in the next version. Thanks again.

Quoted 28 lines

So, I need an answer on above questions before I continue review.

Quoted 4 lines

[snip]

Quoted 7 lines
drivers/common/idpf/idpf_alloc.h new file +0 -0
new file mode 100644
index 0000000000..bc054851b3

drivers/common/idpf/idpf_alloc.h line 7

Quoted 7 lines
drivers/common/idpf/idpf_alloc.h new file +7 -0
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation  */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */

If it is a DPDK-specific driver and it is an interface provided by common driver, it should use Doxygen-style comments to be a part of genereated API documentation.

#96 lore raw

Re: [PATCH v9 01/14] common/idpf: introduce common library

Quoted 27 lines · Beilei
Quoted 15 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, October 21, 2022 2:40 PM
To: Guo, Junfeng <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Wang, Xiao W <[email protected]>
Subject: Re: [PATCH v9 01/14] common/idpf: introduce common library

Quoted 3 lines · Junfeng Guo

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.

Quoted 6 lines
Quoted 2 lines

Also add OS specific implementation about some MACRO definitions and small functions which are specific for DPDK.

Common drivers are required when different class drivers need to share some code. So, it must be expalined here why do you create common driver instead of usage of base/ driver in your net driver.

Hi Andrew,
Thanks for all your comments.
The common driver will be also used in another PMD which should be upstream in 23.03, so we create it.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

Note that common driver is a DPDK driver and it must follow DPDK coding style. If the code is actually shared with something else and do not follow DPDK coding style from the very beginning (since it is an existing code), it should be in base/ subdir in either common driver or net driver.

The common driver is a BSD license release provided by Intel internal team, basically we won't change it. It's the same process as Intel other PMDs, such as base driver of iavf, etc. Is it OK if it's in common/idpf/base/ folder?

If so, yes, it should be there. Some common DPDK-specifics bits could be in common/idpf, but code shared with other teams should be in base/.

Quoted 38 lines
Quoted 5 lines

Also you should not use own trivial wrappers for DPDK API in DPDK-specific code. It just complicates reading.
E.g. BIT() vs RTE_BIT32().

Make sense, will try my best to address all your comments in the next version. Thanks again.

Quoted 28 lines

So, I need an answer on above questions before I continue review.

Quoted 4 lines

[snip]

Quoted 7 lines
drivers/common/idpf/idpf_alloc.h new file +0 -0
new file mode 100644
index 0000000000..bc054851b3

drivers/common/idpf/idpf_alloc.h line 7

Quoted 7 lines
drivers/common/idpf/idpf_alloc.h new file +7 -0
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation  */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */

If it is a DPDK-specific driver and it is an interface provided by common driver, it should use Doxygen-style comments to be a part of genereated API documentation.

#97 lore raw

RE: [PATCH v9 01/14] common/idpf: introduce common library

In reply to Xing, Beilei
Quoted 43 lines

-----Original Message-----
From: Xing, Beilei <[email protected]>
Sent: Friday, October 21, 2022 8:35 PM
To: Andrew Rybchenko <[email protected]>; Guo, Junfeng <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; Wang, Xiao W <[email protected]>
Subject: RE: [PATCH v9 01/14] common/idpf: introduce common library

Quoted 13 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, October 21, 2022 2:40 PM
To: Guo, Junfeng <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Wang, Xiao W <[email protected]>
Subject: Re: [PATCH v9 01/14] common/idpf: introduce common library

Quoted 3 lines · Junfeng Guo

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.

Quoted 6 lines
Quoted 2 lines

Also add OS specific implementation about some MACRO definitions and small functions which are specific for DPDK.

Common drivers are required when different class drivers need to share some code. So, it must be expalined here why do you create common driver instead of usage of base/ driver in your net driver.

Hi Andrew,
Thanks for all your comments.
The common driver will be also used in another PMD which should be upstream in 23.03, so we create it.

Quoted 5 lines

Note that common driver is a DPDK driver and it must follow DPDK coding style. If the code is actually shared with something else and do not follow DPDK coding style from the very beginning (since it is an existing code), it should be in base/ subdir in either common driver or

Quoted 6 lines

net driver.

The common driver is a BSD license release provided by Intel internal team, basically we won't change it. It's the same process as Intel other PMDs, such as base driver of iavf, etc.
Is it OK if it's in common/idpf/base/ folder?

+1 , we'd better move the code only shared by DPDK PMD and kernel driver into the base folder, and we add code only shared by different DPDK PMDs in the upper folder in future.

Quoted 37 lines
Quoted 5 lines

Also you should not use own trivial wrappers for DPDK API in DPDK-specific code. It just complicates reading. E.g. BIT() vs RTE_BIT32().

Make sense, will try my best to address all your comments in the next version. Thanks again.

Quoted 28 lines

So, I need an answer on above questions before I continue review.

Quoted 4 lines

[snip]

Quoted 7 lines
drivers/common/idpf/idpf_alloc.h new file +0 -0
new file mode 100644
index 0000000000..bc054851b3

drivers/common/idpf/idpf_alloc.h line 7

Quoted 7 lines
drivers/common/idpf/idpf_alloc.h new file +7 -0
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation  */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */

If it is a DPDK-specific driver and it is an interface provided by common driver, it should use Doxygen-style comments to be a part of genereated API documentation.

#98 lore raw

v10 cover add support for idpf PMD in DPDK

In reply to Junfeng Guo

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452).
The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation.
Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

v10:
- move shared code to common/idpf/base
- Create one vport if there's no vport devargs
- Refactor if conditions according to coding style
- Refactor virtual channel return values
- Refine dev_stop function
- Refine RSS lut/key
- Fix build error

Junfeng Guo (14):
net/idpf: add support for device start and stop net/idpf: add support for queue start
net/idpf: add support for queue stop
net/idpf: add queue release
net/idpf: add support for packet type get net/idpf: add support for MTU configuration net/idpf: add support for basic Rx datapath net/idpf: add support for basic Tx datapath net/idpf: add support for write back based on ITR expire net/idpf: add support for RSS
net/idpf: add support for Rx offloading net/idpf: add support for Tx offloading net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 doc/guides/nics/features/idpf.ini       |    7 +
 doc/guides/nics/idpf.rst                |   19 +
 drivers/net/idpf/idpf_ethdev.c          |  376 +++++-
 drivers/net/idpf/idpf_ethdev.h          |   66 +
 drivers/net/idpf/idpf_rxtx.c            | 1555 +++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h            |  172 +++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c |  871 +++++++++++++
 drivers/net/idpf/idpf_rxtx_vec_common.h |  100 ++
 drivers/net/idpf/idpf_vchnl.c           |  964 ++++++++++++++
 drivers/net/idpf/meson.build            |   28 +
 10 files changed, 4155 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
Signature · 1 line
2.34.1
#99 lore raw

PATCH v10 1/14 net/idpf: add support for device start and stop

Add dev ops dev_start, dev_stop and link_update.

---
 drivers/net/idpf/idpf_ethdev.c | 89 ++++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h |  5 ++
 2 files changed, 94 insertions(+)
drivers/net/idpf/idpf_ethdev.c +89 -0
index 1d2075f466..4c7a2d0748 100644
@@ -29,17 +29,42 @@ static const char * const idpf_valid_args[] = {
 };
 
 static int idpf_dev_configure(struct rte_eth_dev *dev);
+static int idpf_dev_start(struct rte_eth_dev *dev);
+static int idpf_dev_stop(struct rte_eth_dev *dev);
 static int idpf_dev_close(struct rte_eth_dev *dev);
 static int idpf_dev_info_get(struct rte_eth_dev *dev,
 			     struct rte_eth_dev_info *dev_info);
 static void idpf_adapter_rel(struct idpf_adapter *adapter);
 
+int
+idpf_dev_link_update(struct rte_eth_dev *dev,
+		     __rte_unused int wait_to_complete)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct rte_eth_link new_link;
+
+	memset(&new_link, 0, sizeof(new_link));
+
+	new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
+
+	new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	new_link.link_status = vport->link_up ? RTE_ETH_LINK_UP :
+		RTE_ETH_LINK_DOWN;
+	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
+				  RTE_ETH_LINK_SPEED_FIXED);
+
+	return rte_eth_linkstatus_set(dev, &new_link);
+}
+
 static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_configure			= idpf_dev_configure,
+	.dev_start			= idpf_dev_start,
+	.dev_stop			= idpf_dev_stop,
 	.dev_close			= idpf_dev_close,
 	.rx_queue_setup			= idpf_rx_queue_setup,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
+	.link_update			= idpf_dev_link_update,
 };
 
 static int
@@ -233,6 +258,70 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_start_queues(struct rte_eth_dev *dev)
+{
+	struct idpf_rx_queue *rxq;
+	struct idpf_tx_queue *txq;
+	int err = 0;
+	int i;
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		txq = dev->data->tx_queues[i];
+		if (txq == NULL || txq->tx_deferred_start)
+			continue;
+
+		PMD_DRV_LOG(ERR, "Start Tx queues not supported yet");
+		return -ENOTSUP;
+	}
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq == NULL || rxq->rx_deferred_start)
+			continue;
+
+		PMD_DRV_LOG(ERR, "Start Rx queues not supported yet");
+		return -ENOTSUP;
+	}
+
+	return err;
+}
+
+static int
+idpf_dev_start(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (dev->data->mtu > vport->max_mtu) {
+		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
+		return -1;
+	}
+
+	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
+
+	if (idpf_start_queues(dev) != 0) {
+		PMD_DRV_LOG(ERR, "Failed to start queues");
+		return -1;
+	}
+
+	if (idpf_vc_ena_dis_vport(vport, true) != 0) {
+		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		return -1;
+	}
+
+	return 0;
+}
+
+static int
+idpf_dev_stop(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	idpf_vc_ena_dis_vport(vport, false);
+
+	return 0;
+}
+
 static int
 idpf_dev_close(struct rte_eth_dev *dev)
 {
drivers/net/idpf/idpf_ethdev.h +5 -0
index c0ae801fd5..070531cc48 100644
@@ -105,6 +105,9 @@ struct idpf_vport {
 	/* Chunk info */
 	struct idpf_chunks_info chunks_info;
 
+	/* Event from ipf */
+	bool link_up;
+
 	uint16_t devarg_id;
 };
 
@@ -195,6 +198,8 @@ atomic_set_cmd(struct idpf_adapter *adapter, enum virtchnl_ops ops)
 }
 
 struct idpf_adapter *idpf_find_adapter(struct rte_pci_device *pci_dev);
+int idpf_dev_link_update(struct rte_eth_dev *dev,
+			 __rte_unused int wait_to_complete);
 void idpf_handle_virtchnl_msg(struct rte_eth_dev *dev);
 int idpf_vc_check_api_version(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
Signature · 1 line
2.34.1
#100 lore raw

v11 cover add support for idpf PMD in DPDK

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452).
The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation.
Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

v11:
- move shared code to common/idpf/base
- Create one vport if there's no vport devargs
- Refactor if conditions according to coding style
- Refactor virtual channel return values
- Refine dev_stop function
- Refine RSS lut/key
- Fix build error

Junfeng Guo (18):
common/idpf: introduce common library
net/idpf: add support for device initialization net/idpf: add Tx queue setup
net/idpf: add Rx queue setup
net/idpf: add support for device start and stop net/idpf: add support for queue start
net/idpf: add support for queue stop
net/idpf: add queue release
net/idpf: add support for packet type get net/idpf: add support for MTU configuration net/idpf: add support for basic Rx datapath net/idpf: add support for basic Tx datapath net/idpf: add support for write back based on ITR expire net/idpf: add support for RSS
net/idpf: add support for Rx offloading net/idpf: add support for Tx offloading net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 MAINTAINERS                                   |    9 +
 doc/guides/nics/features/idpf.ini             |   17 +
 doc/guides/nics/idpf.rst                      |   85 +
 doc/guides/nics/index.rst                     |    1 +
 doc/guides/rel_notes/release_22_11.rst        |    6 +
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 drivers/net/idpf/idpf_ethdev.c                | 1223 +++++++
 drivers/net/idpf/idpf_ethdev.h                |  273 ++
 drivers/net/idpf/idpf_logs.h                  |   56 +
 drivers/net/idpf/idpf_rxtx.c                  | 2353 ++++++++++++++
 drivers/net/idpf/idpf_rxtx.h                  |  294 ++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c       |  871 +++++
 drivers/net/idpf/idpf_rxtx_vec_common.h       |  100 +
 drivers/net/idpf/idpf_vchnl.c                 | 1434 +++++++++
 drivers/net/idpf/meson.build                  |   44 +
 drivers/net/idpf/version.map                  |    3 +
 drivers/net/meson.build                       |    1 +
 38 files changed, 15272 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
Signature · 1 line
2.34.1
#101 lore raw

PATCH v11 1/18 common/idpf: introduce common library

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.
Add base code and OS specific implementation first.

---
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 22 files changed, 8502 insertions(+)
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
drivers/common/idpf/base/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/base/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_api.h new file +234 -0

234 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/base/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/base/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/base/idpf_osdep.h new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/base/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/base/meson.build new file +14 -0
new file mode 100644
index 0000000000..ce2b5346e4
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
\ No newline at end of file
drivers/common/idpf/base/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/base/virtchnl.h new file +2866 -0

15 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/base/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/idpf/meson.build new file +4 -0
new file mode 100644
index 0000000000..26881166e9

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

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752

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

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.34.1

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

#102 lore raw

v12 cover add support for idpf PMD in DPDK

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452).
The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation.
Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

v11:
- move shared code to common/idpf/base
- Create one vport if there's no vport devargs
- Refactor if conditions according to coding style
- Refactor virtual channel return values
- Refine dev_stop function
- Refine RSS lut/key
- Fix build error

v12:
- Refine dev_configure
- Fix coding style accoding to the comments
- Re-order patch
- Romove dev_supported_ptypes_get

Junfeng Guo (18):
common/idpf: introduce common library
net/idpf: add support for device initialization net/idpf: add Tx queue setup
net/idpf: add Rx queue setup
net/idpf: add support for device start and stop net/idpf: add support for queue start
net/idpf: add support for queue stop
net/idpf: add queue release
net/idpf: add support for MTU configuration net/idpf: add support for basic Rx datapath net/idpf: add support for basic Tx datapath net/idpf: support packet type get
net/idpf: add support for write back based on ITR expire net/idpf: add support for RSS
net/idpf: add support for Rx offloading net/idpf: add support for Tx offloading net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 MAINTAINERS                                   |    9 +
 doc/guides/nics/features/idpf.ini             |   18 +
 doc/guides/nics/idpf.rst                      |   85 +
 doc/guides/nics/index.rst                     |    1 +
 doc/guides/rel_notes/release_22_11.rst        |    6 +
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 drivers/net/idpf/idpf_ethdev.c                | 1280 ++++++++
 drivers/net/idpf/idpf_ethdev.h                |  252 ++
 drivers/net/idpf/idpf_logs.h                  |   56 +
 drivers/net/idpf/idpf_rxtx.c                  | 2305 +++++++++++++
 drivers/net/idpf/idpf_rxtx.h                  |  291 ++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c       |  871 +++++
 drivers/net/idpf/idpf_rxtx_vec_common.h       |  100 +
 drivers/net/idpf/idpf_vchnl.c                 | 1430 ++++++++
 drivers/net/idpf/meson.build                  |   44 +
 drivers/net/idpf/version.map                  |    3 +
 drivers/net/meson.build                       |    1 +
 38 files changed, 15254 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
Signature · 1 line
2.34.1
#103 lore raw

PATCH v12 1/18 common/idpf: introduce common library

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.
Add base code and OS specific implementation first.

---
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 22 files changed, 8502 insertions(+)
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
drivers/common/idpf/base/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/base/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_api.h new file +234 -0

234 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/base/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/base/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/base/idpf_osdep.h new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/base/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/base/meson.build new file +14 -0
new file mode 100644
index 0000000000..ce2b5346e4
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
\ No newline at end of file
drivers/common/idpf/base/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/base/virtchnl.h new file +2866 -0

15 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/base/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/idpf/meson.build new file +4 -0
new file mode 100644
index 0000000000..26881166e9

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

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752

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

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.34.1

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

#104 lore raw

v13 cover add support for idpf PMD in DPDK

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452).
The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation.
Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

v11:
- move shared code to common/idpf/base
- Create one vport if there's no vport devargs
- Refactor if conditions according to coding style
- Refactor virtual channel return values
- Refine dev_stop function
- Refine RSS lut/key
- Fix build error

v12:
- Refine dev_configure
- Fix coding style accoding to the comments
- Re-order patch
- Romove dev_supported_ptypes_get

v13:
- refine dev_start/stop and queue_start/stop
- fix timestamp offload

Junfeng Guo (18):
common/idpf: introduce common library
net/idpf: add support for device initialization net/idpf: add Tx queue setup
net/idpf: add Rx queue setup
net/idpf: add support for device start and stop net/idpf: add support for queue start
net/idpf: add support for queue stop
net/idpf: add queue release
net/idpf: add support for MTU configuration net/idpf: add support for basic Rx datapath net/idpf: add support for basic Tx datapath net/idpf: support parsing packet type
net/idpf: add support for write back based on ITR expire net/idpf: add support for RSS
net/idpf: add support for Rx offloading net/idpf: add support for Tx offloading net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 MAINTAINERS                                   |    9 +
 doc/guides/nics/features/idpf.ini             |   18 +
 doc/guides/nics/idpf.rst                      |   85 +
 doc/guides/nics/index.rst                     |    1 +
 doc/guides/rel_notes/release_22_11.rst        |    6 +
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 drivers/net/idpf/idpf_ethdev.c                | 1280 ++++++++
 drivers/net/idpf/idpf_ethdev.h                |  252 ++
 drivers/net/idpf/idpf_logs.h                  |   56 +
 drivers/net/idpf/idpf_rxtx.c                  | 2308 +++++++++++++
 drivers/net/idpf/idpf_rxtx.h                  |  291 ++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c       |  871 +++++
 drivers/net/idpf/idpf_rxtx_vec_common.h       |  100 +
 drivers/net/idpf/idpf_vchnl.c                 | 1430 ++++++++
 drivers/net/idpf/meson.build                  |   44 +
 drivers/net/idpf/version.map                  |    3 +
 drivers/net/meson.build                       |    1 +
 38 files changed, 15257 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
Signature · 1 line
2.34.1
#105 lore raw

PATCH v13 1/18 common/idpf: introduce common library

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.
Add base code and OS specific implementation first.

---
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 22 files changed, 8502 insertions(+)
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
drivers/common/idpf/base/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/base/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_api.h new file +234 -0

234 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/base/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/base/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/base/idpf_osdep.h new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/base/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/base/meson.build new file +14 -0
new file mode 100644
index 0000000000..ce2b5346e4
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
\ No newline at end of file
drivers/common/idpf/base/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/base/virtchnl.h new file +2866 -0

15 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/base/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/idpf/meson.build new file +4 -0
new file mode 100644
index 0000000000..26881166e9

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

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752

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

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.34.1

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

#106 lore raw

v14 cover add support for idpf PMD in DPDK

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452).
The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation.
Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

v11:
- move shared code to common/idpf/base
- Create one vport if there's no vport devargs
- Refactor if conditions according to coding style
- Refactor virtual channel return values
- Refine dev_stop function
- Refine RSS lut/key
- Fix build error

v12:
- Refine dev_configure
- Fix coding style accoding to the comments
- Re-order patch
- Romove dev_supported_ptypes_get

v13:
- refine dev_start/stop and queue_start/stop
- fix timestamp offload

v14:
- fix wrong position for rte_validate_tx_offload

Junfeng Guo (18):
common/idpf: introduce common library
net/idpf: add support for device initialization net/idpf: add Tx queue setup
net/idpf: add Rx queue setup
net/idpf: add support for device start and stop net/idpf: add support for queue start
net/idpf: add support for queue stop
net/idpf: add queue release
net/idpf: add support for MTU configuration net/idpf: add support for basic Rx datapath net/idpf: add support for basic Tx datapath net/idpf: support parsing packet type
net/idpf: add support for write back based on ITR expire net/idpf: add support for RSS
net/idpf: add support for Rx offloading net/idpf: add support for Tx offloading net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 MAINTAINERS                                   |    9 +
 doc/guides/nics/features/idpf.ini             |   18 +
 doc/guides/nics/idpf.rst                      |   85 +
 doc/guides/nics/index.rst                     |    1 +
 doc/guides/rel_notes/release_22_11.rst        |    6 +
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 drivers/net/idpf/idpf_ethdev.c                | 1280 ++++++++
 drivers/net/idpf/idpf_ethdev.h                |  252 ++
 drivers/net/idpf/idpf_logs.h                  |   56 +
 drivers/net/idpf/idpf_rxtx.c                  | 2308 +++++++++++++
 drivers/net/idpf/idpf_rxtx.h                  |  291 ++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c       |  871 +++++
 drivers/net/idpf/idpf_rxtx_vec_common.h       |  100 +
 drivers/net/idpf/idpf_vchnl.c                 | 1430 ++++++++
 drivers/net/idpf/meson.build                  |   44 +
 drivers/net/idpf/version.map                  |    3 +
 drivers/net/meson.build                       |    1 +
 38 files changed, 15257 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
Signature · 1 line
2.34.1
#107 lore raw

PATCH v14 1/18 common/idpf: introduce common library

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.
Add base code and OS specific implementation first.

---
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 22 files changed, 8502 insertions(+)
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
drivers/common/idpf/base/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/base/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_api.h new file +234 -0

234 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/base/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/base/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/base/idpf_osdep.h new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/base/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/base/meson.build new file +14 -0
new file mode 100644
index 0000000000..ce2b5346e4
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
\ No newline at end of file
drivers/common/idpf/base/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/base/virtchnl.h new file +2866 -0

15 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/base/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/idpf/meson.build new file +4 -0
new file mode 100644
index 0000000000..26881166e9

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

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752

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

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.34.1

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

#108 lore raw

PATCH v14 2/18 net/idpf: add support for device initialization

In reply to Junfeng Guo

Support device init and add the following dev ops:
- dev_configure
- dev_close
- dev_infos_get

---
 MAINTAINERS                            |   9 +
 doc/guides/nics/features/idpf.ini      |   9 +
 doc/guides/nics/idpf.rst               |  66 ++
 doc/guides/nics/index.rst              |   1 +
 doc/guides/rel_notes/release_22_11.rst |   6 +
 drivers/net/idpf/idpf_ethdev.c         | 886 +++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h         | 189 ++++++
 drivers/net/idpf/idpf_logs.h           |  56 ++
 drivers/net/idpf/idpf_vchnl.c          | 468 +++++++++++++
 drivers/net/idpf/meson.build           |  15 +
 drivers/net/idpf/version.map           |   3 +
 drivers/net/meson.build                |   1 +
 12 files changed, 1709 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
MAINTAINERS +9 -0
index 92b381bc30..34f8b9cc61 100644
@@ -764,6 +764,15 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
+Intel idpf
+M: Jingjing Wu <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/idpf/
+F: drivers/common/idpf/
+F: doc/guides/nics/idpf.rst
+F: doc/guides/nics/features/idpf.ini
+
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/features/idpf.ini new file +9 -0
new file mode 100644
index 0000000000..46aab2eb61
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'idpf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+x86-32               = Y
+x86-64               = Y
doc/guides/nics/idpf.rst new file +66 -0

66 lines not on this page · raw message

doc/guides/nics/index.rst +1 -0
index 32c7544968..b4dd5ea522 100644
@@ -33,6 +33,7 @@ Network Interface Controller Drivers
     hns3
     i40e
     ice
+    idpf
     igb
     igc
     ionic
doc/guides/rel_notes/release_22_11.rst +6 -0
index 1c3daf141d..4af790de37 100644
@@ -160,6 +160,12 @@ New Features
 
   * Added protocol based buffer split support in scalar path.
 
+* **Added IDPF PMD [*EXPERIMENTAL*].**
+
+  Added the new ``idpf`` net driver for Intel® Infrastructure Processing Unit
+  (Intel® IPU) E2000.
+  See the :doc:`../nics/idpf` NIC guide for more details on this new driver.
+
 * **Updated Marvell cnxk driver.**
 
   * Added support for flow action REPRESENTED_PORT.
drivers/net/idpf/idpf_ethdev.c new file +886 -0

886 lines not on this page · raw message

drivers/net/idpf/idpf_ethdev.h new file +189 -0

189 lines not on this page · raw message

drivers/net/idpf/idpf_logs.h new file +56 -0

56 lines not on this page · raw message

drivers/net/idpf/idpf_vchnl.c new file +468 -0

468 lines not on this page · raw message

drivers/net/idpf/meson.build new file +15 -0
new file mode 100644
index 0000000000..ecf73355c3
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+if is_windows
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
+endif
+
+deps += ['common_idpf']
+
+sources = files(
+    'idpf_ethdev.c',
+    'idpf_vchnl.c',
+)
drivers/net/idpf/version.map new file +3 -0
new file mode 100644
index 0000000000..78c3585d7c
@@ -0,0 +1,3 @@
+DPDK_23 {
+	local: *;
+};
drivers/net/meson.build +1 -0
index 35bfa78dee..4a951b95f2 100644
@@ -28,6 +28,7 @@ drivers = [
         'i40e',
         'iavf',
         'ice',
+        'idpf',
         'igc',
         'ionic',
         'ipn3ke',
Signature · 1 line
2.34.1
#109 lore raw

Re: [PATCH v14 02/18] net/idpf: add support for device initialization

Quoted 10 lines · Junfeng Guo

Support device init and add the following dev ops:
- dev_configure
- dev_close
- dev_infos_get

[snip]

drivers/net/idpf/idpf_ethdev.c line 41

Quoted 11 lines
drivers/net/idpf/idpf_ethdev.c new file +11 -0
+static int idpf_dev_configure(struct rte_eth_dev *dev);
+static int idpf_dev_close(struct rte_eth_dev *dev);
+static int idpf_dev_info_get(struct rte_eth_dev *dev,
+			     struct rte_eth_dev_info *dev_info);
+static void idpf_adapter_rel(struct idpf_adapter *adapter);
+
+static const struct eth_dev_ops idpf_eth_dev_ops = {
+	.dev_configure			= idpf_dev_configure,
+	.dev_close			= idpf_dev_close,
+	.dev_infos_get			= idpf_dev_info_get,
+};

Typically it is better to avoid forward static declarations and simply define the ops structure after callbacks.

Quoted 6 lines
drivers/net/idpf/idpf_ethdev.c new file +6 -0
+
+static int
+idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;

drivers/net/idpf/idpf_ethdev.c line 57

Quoted 10 lines
drivers/net/idpf/idpf_ethdev.c new file +10 -0
+
+	dev_info->max_rx_queues = adapter->caps->max_rx_q;
+	dev_info->max_tx_queues = adapter->caps->max_tx_q;
+	dev_info->min_rx_bufsize = IDPF_MIN_BUF_SIZE;
+	dev_info->max_rx_pktlen = IDPF_MAX_FRAME_SIZE;
+
+	dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD;
+	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
+
+	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;

I guess it make sense if and only if you support API to add/remove unicast MAC addresses.

Quoted 3 lines
drivers/net/idpf/idpf_ethdev.c new file +3 -0
+
+	return 0;
+

[snip]

Quoted 57 lines
drivers/net/idpf/idpf_ethdev.c new file +57 -0
+static int
+idpf_init_vport(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t idx = adapter->cur_vport_idx;
+	struct virtchnl2_create_vport *vport_info =
+		(struct virtchnl2_create_vport *)adapter->vport_recv_info[idx];
+	int i, type, ret;
+
+	vport->vport_id = vport_info->vport_id;
+	vport->txq_model = vport_info->txq_model;
+	vport->rxq_model = vport_info->rxq_model;
+	vport->num_tx_q = vport_info->num_tx_q;
+	vport->num_tx_complq = vport_info->num_tx_complq;
+	vport->num_rx_q = vport_info->num_rx_q;
+	vport->num_rx_bufq = vport_info->num_rx_bufq;
+	vport->max_mtu = vport_info->max_mtu;
+	rte_memcpy(vport->default_mac_addr,
+		   vport_info->default_mac_addr, ETH_ALEN);
+	vport->sw_idx = idx;
+
+	for (i = 0; i < vport_info->chunks.num_chunks; i++) {
+		type = vport_info->chunks.chunks[i].type;
+		switch (type) {
+		case VIRTCHNL2_QUEUE_TYPE_TX:
+			vport->chunks_info.tx_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.tx_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.tx_qtail_spacing =
+				vport_info->chunks.chunks[i].qtail_reg_spacing;
+			break;
+		case VIRTCHNL2_QUEUE_TYPE_RX:
+			vport->chunks_info.rx_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.rx_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.rx_qtail_spacing =
+				vport_info->chunks.chunks[i].qtail_reg_spacing;
+			break;
+		case VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION:
+			vport->chunks_info.tx_compl_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.tx_compl_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.tx_compl_qtail_spacing =
+				vport_info->chunks.chunks[i].qtail_reg_spacing;
+			break;
+		case VIRTCHNL2_QUEUE_TYPE_RX_BUFFER:
+			vport->chunks_info.rx_buf_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.rx_buf_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.rx_buf_qtail_spacing =
+				vport_info->chunks.chunks[i].qtail_reg_spacing;
+			break;

drivers/net/idpf/idpf_ethdev.c line 200

Quoted 10 lines
drivers/net/idpf/idpf_ethdev.c new file +10 -0
+		default:
+			PMD_INIT_LOG(ERR, "Unsupported queue type");
+			break;
+		}
+	}
+
+	ret = idpf_parse_devarg_id(dev->data->name);
+	if (ret < 0) {
+		PMD_INIT_LOG(ERR, "Failed to parse devarg id.");
+		return -1;

Negative errno must be returned since finally it is used as rte_eth_dev_create() return value which is negative errno.

Quoted 8 lines
drivers/net/idpf/idpf_ethdev.c new file +8 -0
+	}
+	vport->devarg_id = ret;
+
+	vport->dev_data = dev->data;
+
+	adapter->vports[idx] = vport;
+
+	return 0;

drivers/net/idpf/idpf_ethdev.c line 218

Quoted 10 lines
drivers/net/idpf/idpf_ethdev.c new file +10 -0
+}
+
+static int
+idpf_dev_configure(struct rte_eth_dev *dev)
+{
+	struct rte_eth_conf *conf = &dev->data->dev_conf;
+
+	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
+		PMD_INIT_LOG(ERR, "Setting link speed is not supported");
+		return -1;

The return value is used as rte_eth_dev_configure() return value which should be negative errno, not -1.

Please, double-check all other similar cases.

drivers/net/idpf/idpf_ethdev.c line 222

Quoted 4 lines
drivers/net/idpf/idpf_ethdev.c new file +4 -0
+	}
+
+	if ((dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) ||
+	    (dev->data->nb_rx_queues > 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_RSS)) {

Rigth now (just after the patch) you don't support RSS since you don't handle corresponding configuratoin items. So, Nothing except RX_NONE is supported. RX_RSS should be added when you really support it (later).

Quoted 4 lines
drivers/net/idpf/idpf_ethdev.c new file +4 -0
+		PMD_INIT_LOG(ERR, "Multi-queue packet distribution mode %d is not supported",
+			     conf->rxmode.mq_mode);
+		return -1;
+	}

[snip]

drivers/net/idpf/idpf_ethdev.c line 723

Quoted 10 lines
drivers/net/idpf/idpf_ethdev.c new file +10 -0
+struct idpf_adapter *
+idpf_find_adapter(struct rte_pci_device *pci_dev)
+{
+	struct idpf_adapter *adapter;
+
+	rte_spinlock_lock(&idpf_adapter_lock);
+	TAILQ_FOREACH(adapter, &idpf_adapter_list, next) {
+		if (strncmp(adapter->name, pci_dev->device.name, PCI_PRI_STR_SIZE) == 0) {
+			rte_spinlock_unlock(&idpf_adapter_lock);
+			return adapter;

Pointer to an element of the list protected by spin lock is returned here.

Quoted 6 lines
drivers/net/idpf/idpf_ethdev.c new file +6 -0
+		}
+	}
+	rte_spinlock_unlock(&idpf_adapter_lock);
+
+	return NULL;
+}

[snip]

drivers/net/idpf/idpf_ethdev.c line 852

Quoted 4 lines
drivers/net/idpf/idpf_ethdev.c new file +4 -0
+static int
+idpf_pci_remove(struct rte_pci_device *pci_dev)
+{
+	struct idpf_adapter *adapter = idpf_find_adapter(pci_dev);

Question about locking still stands. I'm not sure that I understand the purpose of locking here. Or why can it be omitted. Anyway, returing pointer to the list element when the list is protected by lock looks suspicous.

Quoted 15 lines
drivers/net/idpf/idpf_ethdev.c new file +15 -0
+	uint16_t port_id;
+
+	/* Ethdev created can be found RTE_ETH_FOREACH_DEV_OF through rte_device */
+	RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) {
+			rte_eth_dev_close(port_id);
+	}
+
+	rte_spinlock_lock(&idpf_adapter_lock);
+	TAILQ_REMOVE(&idpf_adapter_list, adapter, next);
+	rte_spinlock_unlock(&idpf_adapter_lock);
+	idpf_adapter_rel(adapter);
+	rte_free(adapter);
+
+	return 0;
+}

[snip]

Quoted 49 lines
drivers/net/idpf/idpf_vchnl.c new file +49 -0
+int
+idpf_vc_get_caps(struct idpf_adapter *adapter)
+{
+	struct virtchnl2_get_capabilities caps_msg;
+	struct idpf_cmd_info args;
+	int err;
+
+	 memset(&caps_msg, 0, sizeof(struct virtchnl2_get_capabilities));
+	 caps_msg.csum_caps =
+		 VIRTCHNL2_CAP_TX_CSUM_L3_IPV4		|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_TCP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_UDP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_SCTP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_TCP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_UDP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP	|
+		 VIRTCHNL2_CAP_TX_CSUM_GENERIC		|
+		 VIRTCHNL2_CAP_RX_CSUM_L3_IPV4		|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_UDP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_SCTP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_SCTP	|
+		 VIRTCHNL2_CAP_RX_CSUM_GENERIC;
+
+	 caps_msg.seg_caps =
+		 VIRTCHNL2_CAP_SEG_IPV4_TCP		|
+		 VIRTCHNL2_CAP_SEG_IPV4_UDP		|
+		 VIRTCHNL2_CAP_SEG_IPV4_SCTP		|
+		 VIRTCHNL2_CAP_SEG_IPV6_TCP		|
+		 VIRTCHNL2_CAP_SEG_IPV6_UDP		|
+		 VIRTCHNL2_CAP_SEG_IPV6_SCTP		|
+		 VIRTCHNL2_CAP_SEG_GENERIC;
+
+	 caps_msg.rss_caps =
+		 VIRTCHNL2_CAP_RSS_IPV4_TCP		|
+		 VIRTCHNL2_CAP_RSS_IPV4_UDP		|
+		 VIRTCHNL2_CAP_RSS_IPV4_SCTP		|
+		 VIRTCHNL2_CAP_RSS_IPV4_OTHER		|
+		 VIRTCHNL2_CAP_RSS_IPV6_TCP		|
+		 VIRTCHNL2_CAP_RSS_IPV6_UDP		|
+		 VIRTCHNL2_CAP_RSS_IPV6_SCTP		|
+		 VIRTCHNL2_CAP_RSS_IPV6_OTHER		|
+		 VIRTCHNL2_CAP_RSS_IPV4_AH		|
+		 VIRTCHNL2_CAP_RSS_IPV4_ESP		|
+		 VIRTCHNL2_CAP_RSS_IPV4_AH_ESP		|
+		 VIRTCHNL2_CAP_RSS_IPV6_AH		|
+		 VIRTCHNL2_CAP_RSS_IPV6_ESP		|

drivers/net/idpf/idpf_vchnl.c line 356

Quoted 10 lines
drivers/net/idpf/idpf_vchnl.c new file +10 -0
+		 VIRTCHNL2_CAP_RSS_IPV6_AH_ESP;
+
+	 caps_msg.other_caps =
+		 VIRTCHNL2_CAP_SPLITQ_QSCHED		|
+		 VIRTCHNL2_CAP_CRC			|
+		 VIRTCHNL2_CAP_WB_ON_ITR		|
+		 VIRTCHNL2_CAP_PROMISC			|
+		 VIRTCHNL2_CAP_LINK_SPEED		|
+		 VIRTCHNL2_CAP_VLAN;
+

My question aske in v11 still stands since I have no an answer yet. Basically it looks like corresponding caps should be added when corresponding offload support is added later. If no, I'd like to understand why.

Quoted 17 lines
drivers/net/idpf/idpf_vchnl.c new file +17 -0
+	args.ops = VIRTCHNL2_OP_GET_CAPS;
+	args.in_args = (uint8_t *)&caps_msg;
+	args.in_args_size = sizeof(caps_msg);
+	args.out_buffer = adapter->mbx_resp;
+	args.out_size = IDPF_DFLT_MBX_BUF_SIZE;
+
+	err = idpf_execute_vc_cmd(adapter, &args);
+	if (err != 0) {
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of VIRTCHNL2_OP_GET_CAPS");
+		return err;
+	}
+
+	rte_memcpy(adapter->caps, args.out_buffer, sizeof(caps_msg));
+
+	return 0;
+}

[snip]

drivers/net/idpf/idpf_vchnl.c line 456

Quoted 12 lines
drivers/net/idpf/idpf_vchnl.c new file +12 -0
+int
+idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable)
+{
+	struct idpf_adapter *adapter = vport->adapter;
+	struct virtchnl2_vport vc_vport;
+	struct idpf_cmd_info args;
+	int err;
+
+	vc_vport.vport_id = vport->vport_id;
+	args.ops = enable ? VIRTCHNL2_OP_ENABLE_VPORT :
+			    VIRTCHNL2_OP_DISABLE_VPORT;
+	args.in_args = (u8 *)&vc_vport;

uint8_t should be used as you do above in idpf_vc_destroy_vport() and many other cases.

[snip]

#110 lore raw

RE: [PATCH v14 02/18] net/idpf: add support for device initialization

Quoted 26 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, October 28, 2022 11:35 PM
To: Guo, Junfeng <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Li, Xiaoyun <[email protected]>; Wang, Xiao W <[email protected]>; Wu, Wenjun1 <[email protected]>
Subject: Re: [PATCH v14 02/18] net/idpf: add support for device initialization

Quoted 10 lines · Junfeng Guo

Support device init and add the following dev ops:
- dev_configure
- dev_close
- dev_infos_get

[snip]

Quoted 14 lines

drivers/net/idpf/idpf_ethdev.c line 41

Quoted 11 lines
drivers/net/idpf/idpf_ethdev.c new file +11 -0
+static int idpf_dev_configure(struct rte_eth_dev *dev); static int
+idpf_dev_close(struct rte_eth_dev *dev); static int
+idpf_dev_info_get(struct rte_eth_dev *dev,
+			     struct rte_eth_dev_info *dev_info); static void
+idpf_adapter_rel(struct idpf_adapter *adapter);
+
+static const struct eth_dev_ops idpf_eth_dev_ops = {
+	.dev_configure			= idpf_dev_configure,
+	.dev_close			= idpf_dev_close,
+	.dev_infos_get			= idpf_dev_info_get,
+};

Typically it is better to avoid forward static declarations and simply define the ops structure after callbacks.

OK, will fix it in v15.

Quoted 15 lines
Quoted 4 lines
drivers/net/idpf/idpf_ethdev.c new file +3 -0
+
+static int
+idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info

drivers/net/idpf/idpf_ethdev.c

Quoted 10 lines
drivers/net/idpf/idpf_ethdev.c new file +10 -0
+*dev_info) {
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+
+	dev_info->max_rx_queues = adapter->caps->max_rx_q;
+	dev_info->max_tx_queues = adapter->caps->max_tx_q;
+	dev_info->min_rx_bufsize = IDPF_MIN_BUF_SIZE;
+	dev_info->max_rx_pktlen = IDPF_MAX_FRAME_SIZE;
+
+	dev_info->max_mtu = dev_info->max_rx_pktlen -

IDPF_ETH_OVERHEAD;

Quoted 6 lines

drivers/net/idpf/idpf_ethdev.c line 57

Quoted 3 lines
drivers/net/idpf/idpf_ethdev.c new file +3 -0
+	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
+
+	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;

I guess it make sense if and only if you support API to add/remove unicast MAC addresses.

Yes, will remove this info.

Quoted 73 lines
Quoted 4 lines
drivers/net/idpf/idpf_ethdev.c new file +3 -0
+
+	return 0;
+

[snip]

Quoted 66 lines
drivers/net/idpf/idpf_ethdev.c new file +7 -0
+static int
+idpf_init_vport(struct rte_eth_dev *dev) {
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t idx = adapter->cur_vport_idx;
+	struct virtchnl2_create_vport *vport_info =
+		(struct virtchnl2_create_vport *)adapter-

vport_recv_info[idx];

drivers/net/idpf/idpf_ethdev.c new file +24 -0
+	int i, type, ret;
+
+	vport->vport_id = vport_info->vport_id;
+	vport->txq_model = vport_info->txq_model;
+	vport->rxq_model = vport_info->rxq_model;
+	vport->num_tx_q = vport_info->num_tx_q;
+	vport->num_tx_complq = vport_info->num_tx_complq;
+	vport->num_rx_q = vport_info->num_rx_q;
+	vport->num_rx_bufq = vport_info->num_rx_bufq;
+	vport->max_mtu = vport_info->max_mtu;
+	rte_memcpy(vport->default_mac_addr,
+		   vport_info->default_mac_addr, ETH_ALEN);
+	vport->sw_idx = idx;
+
+	for (i = 0; i < vport_info->chunks.num_chunks; i++) {
+		type = vport_info->chunks.chunks[i].type;
+		switch (type) {
+		case VIRTCHNL2_QUEUE_TYPE_TX:
+			vport->chunks_info.tx_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.tx_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.tx_qtail_spacing =
+				vport_info-

chunks.chunks[i].qtail_reg_spacing;

drivers/net/idpf/idpf_ethdev.c new file +8 -0
+			break;
+		case VIRTCHNL2_QUEUE_TYPE_RX:
+			vport->chunks_info.rx_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.rx_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.rx_qtail_spacing =
+				vport_info-

chunks.chunks[i].qtail_reg_spacing;

drivers/net/idpf/idpf_ethdev.c new file +8 -0
+			break;
+		case VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION:
+			vport->chunks_info.tx_compl_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.tx_compl_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.tx_compl_qtail_spacing =
+				vport_info-

chunks.chunks[i].qtail_reg_spacing;

drivers/net/idpf/idpf_ethdev.c new file +8 -0
+			break;
+		case VIRTCHNL2_QUEUE_TYPE_RX_BUFFER:
+			vport->chunks_info.rx_buf_start_qid =
+				vport_info->chunks.chunks[i].start_queue_id;
+			vport->chunks_info.rx_buf_qtail_start =
+				vport_info->chunks.chunks[i].qtail_reg_start;
+			vport->chunks_info.rx_buf_qtail_spacing =
+				vport_info-

chunks.chunks[i].qtail_reg_spacing;

drivers/net/idpf/idpf_ethdev.c new file +6 -0
+			break;
+		default:
+			PMD_INIT_LOG(ERR, "Unsupported queue type");
+			break;
+		}
+	}
Quoted 8 lines

drivers/net/idpf/idpf_ethdev.c line 200

Quoted 5 lines
drivers/net/idpf/idpf_ethdev.c new file +5 -0
+
+	ret = idpf_parse_devarg_id(dev->data->name);
+	if (ret < 0) {
+		PMD_INIT_LOG(ERR, "Failed to parse devarg id.");
+		return -1;

Negative errno must be returned since finally it is used as rte_eth_dev_create() return value which is negative errno.

Make sense, will refine the return value, and check all similar cases.

Quoted 51 lines
Quoted 8 lines
drivers/net/idpf/idpf_ethdev.c new file +7 -0
+	}
+	vport->devarg_id = ret;
+
+	vport->dev_data = dev->data;
+
+	adapter->vports[idx] = vport;
+

drivers/net/idpf/idpf_ethdev.c line 218

Quoted 10 lines
drivers/net/idpf/idpf_ethdev.c new file +10 -0
+	return 0;
+}
+
+static int
+idpf_dev_configure(struct rte_eth_dev *dev) {
+	struct rte_eth_conf *conf = &dev->data->dev_conf;
+
+	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
+		PMD_INIT_LOG(ERR, "Setting link speed is not supported");
+		return -1;

The return value is used as rte_eth_dev_configure() return value which should be negative errno, not -1.

Please, double-check all other similar cases.

drivers/net/idpf/idpf_ethdev.c

Quoted 3 lines
drivers/net/idpf/idpf_ethdev.c new file +3 -0
+	}
+
+	if ((dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode !=

RTE_ETH_MQ_RX_NONE) ||

Review

Quoted 2 lines
(quoted diff) +2 -0
+	    (dev->data->nb_rx_queues > 1 && conf->rxmode.mq_mode !=
+RTE_ETH_MQ_RX_RSS)) {

Rigth now (just after the patch) you don't support RSS since you don't handle corresponding configuratoin items. So, Nothing except RX_NONE is supported. RX_RSS should be added when you really support it (later).

Review

Quoted 1 line
(quoted diff) +1 -0
+		PMD_INIT_LOG(ERR, "Multi-queue packet distribution

mode %d is not supported",

Quoted 3 lines
drivers/net/idpf/idpf_ethdev.c new file +3 -0
+			     conf->rxmode.mq_mode);
+		return -1;
+	}

[snip]

drivers/net/idpf/idpf_ethdev.c

Quoted 7 lines
drivers/net/idpf/idpf_ethdev.c new file +7 -0
+struct idpf_adapter *
+idpf_find_adapter(struct rte_pci_device *pci_dev) {
+	struct idpf_adapter *adapter;
+
+	rte_spinlock_lock(&idpf_adapter_lock);
+	TAILQ_FOREACH(adapter, &idpf_adapter_list, next) {
+		if (strncmp(adapter->name, pci_dev->device.name,

PCI_PRI_STR_SIZE) == 0) {

Quoted 4 lines

drivers/net/idpf/idpf_ethdev.c line 723

Quoted 2 lines
drivers/net/idpf/idpf_ethdev.c new file +2 -0
+			rte_spinlock_unlock(&idpf_adapter_lock);
+			return adapter;

Pointer to an element of the list protected by spin lock is returned here.

Yes, will fix it in v15.

Quoted 139 lines
Quoted 7 lines
drivers/net/idpf/idpf_ethdev.c new file +6 -0
+		}
+	}
+	rte_spinlock_unlock(&idpf_adapter_lock);
+
+	return NULL;
+}

[snip]

drivers/net/idpf/idpf_ethdev.c line 852

Quoted 3 lines
drivers/net/idpf/idpf_ethdev.c new file +3 -0
+static int
+idpf_pci_remove(struct rte_pci_device *pci_dev) {
+	struct idpf_adapter *adapter = idpf_find_adapter(pci_dev);

Question about locking still stands. I'm not sure that I understand the purpose of locking here. Or why can it be omitted.
Anyway, returing pointer to the list element when the list is protected by lock looks suspicous.

drivers/net/idpf/idpf_ethdev.c

Quoted 3 lines
drivers/net/idpf/idpf_ethdev.c new file +3 -0
+	uint16_t port_id;
+
+	/* Ethdev created can be found RTE_ETH_FOREACH_DEV_OF

through rte_device */

Quoted 12 lines
drivers/net/idpf/idpf_ethdev.c new file +12 -0
+	RTE_ETH_FOREACH_DEV_OF(port_id, &pci_dev->device) {
+			rte_eth_dev_close(port_id);
+	}
+
+	rte_spinlock_lock(&idpf_adapter_lock);
+	TAILQ_REMOVE(&idpf_adapter_list, adapter, next);
+	rte_spinlock_unlock(&idpf_adapter_lock);
+	idpf_adapter_rel(adapter);
+	rte_free(adapter);
+
+	return 0;
+}

[snip]

Quoted 48 lines
drivers/net/idpf/idpf_vchnl.c new file +48 -0
+int
+idpf_vc_get_caps(struct idpf_adapter *adapter) {
+	struct virtchnl2_get_capabilities caps_msg;
+	struct idpf_cmd_info args;
+	int err;
+
+	 memset(&caps_msg, 0, sizeof(struct virtchnl2_get_capabilities));
+	 caps_msg.csum_caps =
+		 VIRTCHNL2_CAP_TX_CSUM_L3_IPV4		|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_TCP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_UDP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_SCTP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_TCP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_UDP	|
+		 VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP	|
+		 VIRTCHNL2_CAP_TX_CSUM_GENERIC		|
+		 VIRTCHNL2_CAP_RX_CSUM_L3_IPV4		|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_UDP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_SCTP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP	|
+		 VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_SCTP	|
+		 VIRTCHNL2_CAP_RX_CSUM_GENERIC;
+
+	 caps_msg.seg_caps =
+		 VIRTCHNL2_CAP_SEG_IPV4_TCP		|
+		 VIRTCHNL2_CAP_SEG_IPV4_UDP		|
+		 VIRTCHNL2_CAP_SEG_IPV4_SCTP		|
+		 VIRTCHNL2_CAP_SEG_IPV6_TCP		|
+		 VIRTCHNL2_CAP_SEG_IPV6_UDP		|
+		 VIRTCHNL2_CAP_SEG_IPV6_SCTP		|
+		 VIRTCHNL2_CAP_SEG_GENERIC;
+
+	 caps_msg.rss_caps =
+		 VIRTCHNL2_CAP_RSS_IPV4_TCP		|
+		 VIRTCHNL2_CAP_RSS_IPV4_UDP		|
+		 VIRTCHNL2_CAP_RSS_IPV4_SCTP		|
+		 VIRTCHNL2_CAP_RSS_IPV4_OTHER		|
+		 VIRTCHNL2_CAP_RSS_IPV6_TCP		|
+		 VIRTCHNL2_CAP_RSS_IPV6_UDP		|
+		 VIRTCHNL2_CAP_RSS_IPV6_SCTP		|
+		 VIRTCHNL2_CAP_RSS_IPV6_OTHER		|
+		 VIRTCHNL2_CAP_RSS_IPV4_AH		|
+		 VIRTCHNL2_CAP_RSS_IPV4_ESP		|
+		 VIRTCHNL2_CAP_RSS_IPV4_AH_ESP		|
+		 VIRTCHNL2_CAP_RSS_IPV6_AH		|
+		 VIRTCHNL2_CAP_RSS_IPV6_ESP		|

drivers/net/idpf/idpf_vchnl.c line 356

Quoted 10 lines
drivers/net/idpf/idpf_vchnl.c new file +10 -0
+		 VIRTCHNL2_CAP_RSS_IPV6_AH_ESP;
+
+	 caps_msg.other_caps =
+		 VIRTCHNL2_CAP_SPLITQ_QSCHED		|
+		 VIRTCHNL2_CAP_CRC			|
+		 VIRTCHNL2_CAP_WB_ON_ITR		|
+		 VIRTCHNL2_CAP_PROMISC			|
+		 VIRTCHNL2_CAP_LINK_SPEED		|
+		 VIRTCHNL2_CAP_VLAN;
+

My question aske in v11 still stands since I have no an answer yet. Basically it looks like corresponding caps should be added when corresponding offload support is added later. If no, I'd like to understand why.

drivers/net/idpf/idpf_vchnl.c

Quoted 10 lines
drivers/net/idpf/idpf_vchnl.c new file +10 -0
+	args.ops = VIRTCHNL2_OP_GET_CAPS;
+	args.in_args = (uint8_t *)&caps_msg;
+	args.in_args_size = sizeof(caps_msg);
+	args.out_buffer = adapter->mbx_resp;
+	args.out_size = IDPF_DFLT_MBX_BUF_SIZE;
+
+	err = idpf_execute_vc_cmd(adapter, &args);
+	if (err != 0) {
+		PMD_DRV_LOG(ERR,
+			    "Failed to execute command of

VIRTCHNL2_OP_GET_CAPS");

Quoted 7 lines
drivers/net/idpf/idpf_vchnl.c new file +7 -0
+		return err;
+	}
+
+	rte_memcpy(adapter->caps, args.out_buffer, sizeof(caps_msg));
+
+	return 0;
+}

[snip]

drivers/net/idpf/idpf_vchnl.c line 456

Quoted 11 lines
drivers/net/idpf/idpf_vchnl.c new file +11 -0
+int
+idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable) {
+	struct idpf_adapter *adapter = vport->adapter;
+	struct virtchnl2_vport vc_vport;
+	struct idpf_cmd_info args;
+	int err;
+
+	vc_vport.vport_id = vport->vport_id;
+	args.ops = enable ? VIRTCHNL2_OP_ENABLE_VPORT :
+			    VIRTCHNL2_OP_DISABLE_VPORT;
+	args.in_args = (u8 *)&vc_vport;

uint8_t should be used as you do above in idpf_vc_destroy_vport() and many other cases.

[snip]

#111 lore raw

PATCH v14 3/18 net/idpf: add Tx queue setup

In reply to Junfeng Guo

Add support for tx_queue_setup ops.

In the single queue model, the same descriptor queue is used by SW to post buffer descriptors to HW and by HW to post completed descriptors to SW.

In the split queue model, "RX buffer queues" are used to pass descriptor buffers from SW to HW while Rx queues are used only to pass the descriptor completions, that is, descriptors that point to completed buffers, from HW to SW. This is contrary to the single queue model in which Rx queues are used for both purposes.

---
 drivers/net/idpf/idpf_ethdev.c |  13 ++
 drivers/net/idpf/idpf_rxtx.c   | 364 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  70 +++++++
 drivers/net/idpf/idpf_vchnl.c  |   2 -
 drivers/net/idpf/meson.build   |   1 +
 5 files changed, 448 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
drivers/net/idpf/idpf_ethdev.c +13 -0
index 112dccf5c9..11f8b4ba1c 100644
@@ -11,6 +11,7 @@
 #include <errno.h>
 
 #include "idpf_ethdev.h"
+#include "idpf_rxtx.h"
 
 #define IDPF_TX_SINGLE_Q	"tx_single"
 #define IDPF_RX_SINGLE_Q	"rx_single"
@@ -37,6 +38,7 @@ static void idpf_adapter_rel(struct idpf_adapter *adapter);
 static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_configure			= idpf_dev_configure,
 	.dev_close			= idpf_dev_close,
+	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
 };
 
@@ -56,6 +58,17 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;
 
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = IDPF_MAX_RING_DESC,
+		.nb_min = IDPF_MIN_RING_DESC,
+		.nb_align = IDPF_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
drivers/net/idpf/idpf_rxtx.c new file +364 -0

364 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h new file +70 -0

70 lines not on this page · raw message

drivers/net/idpf/idpf_vchnl.c +0 -2
index 9392711b61..4dae1a0b36 100644
@@ -22,8 +22,6 @@
 
 #include "idpf_ethdev.h"
 
-#define IDPF_CTLQ_LEN	64
-
 static int
 idpf_vc_clean(struct idpf_adapter *adapter)
 {
drivers/net/idpf/meson.build +1 -0
index ecf73355c3..b632b76656 100644
@@ -11,5 +11,6 @@ deps += ['common_idpf']
 
 sources = files(
     'idpf_ethdev.c',
+    'idpf_rxtx.c',
     'idpf_vchnl.c',
 )
Signature · 1 line
2.34.1
#112 lore raw

PATCH v14 4/18 net/idpf: add Rx queue setup

In reply to Junfeng Guo

Add support for rx_queue_setup ops.

---
 drivers/net/idpf/idpf_ethdev.c |  11 +
 drivers/net/idpf/idpf_rxtx.c   | 400 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  46 ++++
 3 files changed, 457 insertions(+)
drivers/net/idpf/idpf_ethdev.c +11 -0
index 11f8b4ba1c..0585153f69 100644
@@ -38,6 +38,7 @@ static void idpf_adapter_rel(struct idpf_adapter *adapter);
 static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_configure			= idpf_dev_configure,
 	.dev_close			= idpf_dev_close,
+	.rx_queue_setup			= idpf_rx_queue_setup,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
 };
@@ -63,12 +64,22 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
 	};
 
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_free_thresh = IDPF_DEFAULT_RX_FREE_THRESH,
+	};
+
 	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
 		.nb_max = IDPF_MAX_RING_DESC,
 		.nb_min = IDPF_MIN_RING_DESC,
 		.nb_align = IDPF_ALIGN_RING_DESC,
 	};
 
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = IDPF_MAX_RING_DESC,
+		.nb_min = IDPF_MIN_RING_DESC,
+		.nb_align = IDPF_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
drivers/net/idpf/idpf_rxtx.c +400 -0

418 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +46 -0

61 lines not on this page · raw message

Signature · 1 line
2.34.1
#113 lore raw

PATCH v14 5/18 net/idpf: add support for device start and stop

In reply to Junfeng Guo

Add dev ops dev_start, dev_stop and link_update.

---
 drivers/net/idpf/idpf_ethdev.c | 55 ++++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.c   | 20 +++++++++++++
 2 files changed, 75 insertions(+)
drivers/net/idpf/idpf_ethdev.c +55 -0
index 0585153f69..3430d00e92 100644
@@ -30,17 +30,38 @@ static const char * const idpf_valid_args[] = {
 };
 
 static int idpf_dev_configure(struct rte_eth_dev *dev);
+static int idpf_dev_start(struct rte_eth_dev *dev);
+static int idpf_dev_stop(struct rte_eth_dev *dev);
 static int idpf_dev_close(struct rte_eth_dev *dev);
 static int idpf_dev_info_get(struct rte_eth_dev *dev,
 			     struct rte_eth_dev_info *dev_info);
 static void idpf_adapter_rel(struct idpf_adapter *adapter);
 
+static int
+idpf_dev_link_update(struct rte_eth_dev *dev,
+		     __rte_unused int wait_to_complete)
+{
+	struct rte_eth_link new_link;
+
+	memset(&new_link, 0, sizeof(new_link));
+
+	new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
+	new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
+				  RTE_ETH_LINK_SPEED_FIXED);
+
+	return rte_eth_linkstatus_set(dev, &new_link);
+}
+
 static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_configure			= idpf_dev_configure,
+	.dev_start			= idpf_dev_start,
+	.dev_stop			= idpf_dev_stop,
 	.dev_close			= idpf_dev_close,
 	.rx_queue_setup			= idpf_rx_queue_setup,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
+	.link_update			= idpf_dev_link_update,
 };
 
 static int
@@ -284,6 +305,40 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_dev_start(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (dev->data->mtu > vport->max_mtu) {
+		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
+		return -1;
+	}
+
+	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
+
+	/* TODO: start queues */
+
+	if (idpf_vc_ena_dis_vport(vport, true) != 0) {
+		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		return -1;
+	}
+
+	return 0;
+}
+
+static int
+idpf_dev_stop(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	idpf_vc_ena_dis_vport(vport, false);
+
+	/* TODO: stop queues */
+
+	return 0;
+}
+
 static int
 idpf_dev_close(struct rte_eth_dev *dev)
 {
drivers/net/idpf/idpf_rxtx.c +20 -0
index 25dd5d85d5..3528d2f2c7 100644
@@ -334,6 +334,11 @@ idpf_rx_split_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_rx_thresh(nb_desc, rx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (rx_conf->rx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Setup Rx description queue */
 	rxq = rte_zmalloc_socket("idpf rxq",
 				 sizeof(struct idpf_rx_queue),
@@ -465,6 +470,11 @@ idpf_rx_single_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_rx_thresh(nb_desc, rx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (rx_conf->rx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Setup Rx description queue */
 	rxq = rte_zmalloc_socket("idpf rxq",
 				 sizeof(struct idpf_rx_queue),
@@ -569,6 +579,11 @@ idpf_tx_split_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (tx_conf->tx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("idpf split txq",
 				 sizeof(struct idpf_tx_queue),
@@ -691,6 +706,11 @@ idpf_tx_single_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (tx_conf->tx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("idpf txq",
 				 sizeof(struct idpf_tx_queue),
Signature · 1 line
2.34.1
#114 lore raw

Re: [PATCH v14 05/18] net/idpf: add support for device start and stop

Quoted 5 lines · Junfeng Guo

Add dev ops dev_start, dev_stop and link_update.

[snip]

drivers/net/idpf/idpf_ethdev.c idpf_dev_configure(struct rte_eth_dev *dev) · line 315

Quoted 12 lines
drivers/net/idpf/idpf_ethdev.c +8 -0
@@ -284,6 +305,40 @@ idpf_dev_configure(struct rte_eth_dev *dev)
  	return 0;
  }
 
+static int
+idpf_dev_start(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (dev->data->mtu > vport->max_mtu) {
+		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
+		return -1;

Negative errno must be returned.

drivers/net/idpf/idpf_ethdev.c idpf_dev_configure(struct rte_eth_dev *dev) · line 324

Quoted 9 lines
drivers/net/idpf/idpf_ethdev.c +9 -0
+	}
+
+	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
+
+	/* TODO: start queues */
+
+	if (idpf_vc_ena_dis_vport(vport, true) != 0) {
+		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		return -1;

same here

Quoted 4 lines
drivers/net/idpf/idpf_ethdev.c +4 -0
+	}
+
+	return 0;
+}

[snip]

#115 lore raw

PATCH v14 6/18 net/idpf: add support for queue start

In reply to Junfeng Guo

Add support for these device ops:
- rx_queue_start
- tx_queue_start

---
 drivers/net/idpf/idpf_ethdev.c |  40 ++-
 drivers/net/idpf/idpf_ethdev.h |   9 +
 drivers/net/idpf/idpf_rxtx.c   | 237 +++++++++++++++--
 drivers/net/idpf/idpf_rxtx.h   |   6 +
 drivers/net/idpf/idpf_vchnl.c  | 447 +++++++++++++++++++++++++++++++++
 5 files changed, 718 insertions(+), 21 deletions(-)
drivers/net/idpf/idpf_ethdev.c +39 -1
index 3430d00e92..abbf519977 100644
@@ -58,6 +58,8 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_start			= idpf_dev_start,
 	.dev_stop			= idpf_dev_stop,
 	.dev_close			= idpf_dev_close,
+	.rx_queue_start			= idpf_rx_queue_start,
+	.tx_queue_start			= idpf_tx_queue_start,
 	.rx_queue_setup			= idpf_rx_queue_setup,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
@@ -305,6 +307,39 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_start_queues(struct rte_eth_dev *dev)
+{
+	struct idpf_rx_queue *rxq;
+	struct idpf_tx_queue *txq;
+	int err = 0;
+	int i;
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		txq = dev->data->tx_queues[i];
+		if (txq == NULL || txq->tx_deferred_start)
+			continue;
+		err = idpf_tx_queue_start(dev, i);
+		if (err != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start Tx queue %u", i);
+			return err;
+		}
+	}
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq == NULL || rxq->rx_deferred_start)
+			continue;
+		err = idpf_rx_queue_start(dev, i);
+		if (err != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start Rx queue %u", i);
+			return err;
+		}
+	}
+
+	return err;
+}
+
 static int
 idpf_dev_start(struct rte_eth_dev *dev)
 {
@@ -317,7 +352,10 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
 
-	/* TODO: start queues */
+	if (idpf_start_queues(dev) != 0) {
+		PMD_DRV_LOG(ERR, "Failed to start queues");
+		return -1;
+	}
 
 	if (idpf_vc_ena_dis_vport(vport, true) != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
drivers/net/idpf/idpf_ethdev.h +9 -0
index 84ae6641e2..96c22009e9 100644
@@ -24,7 +24,9 @@
 #define IDPF_DEFAULT_TXQ_NUM	16
 
 #define IDPF_INVALID_VPORT_IDX	0xffff
+#define IDPF_TXQ_PER_GRP	1
 #define IDPF_TX_COMPLQ_PER_GRP	1
+#define IDPF_RXQ_PER_GRP	1
 #define IDPF_RX_BUFQ_PER_GRP	2
 
 #define IDPF_CTLQ_ID		-1
@@ -182,6 +184,13 @@ int idpf_vc_check_api_version(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct idpf_adapter *adapter);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
+int idpf_vc_config_rxqs(struct idpf_vport *vport);
+int idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id);
+int idpf_vc_config_txqs(struct idpf_vport *vport);
+int idpf_vc_config_txq(struct idpf_vport *vport, uint16_t txq_id);
+int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
+		      bool rx, bool on);
+int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
drivers/net/idpf/idpf_rxtx.c +217 -20

288 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +6 -0
index 3f3932c3eb..ab9b3830fd 100644
@@ -50,6 +50,7 @@ struct idpf_rx_queue {
 
 	bool q_set;             /* if rx queue has been configured */
 	bool q_started;         /* if rx queue has been started */
+	bool rx_deferred_start; /* don't start this queue in dev start */
 
 	/* only valid for split queue mode */
 	uint8_t expected_gen_id;
@@ -95,6 +96,7 @@ struct idpf_tx_queue {
 
 	bool q_set;		/* if tx queue has been configured */
 	bool q_started;		/* if tx queue has been started */
+	bool tx_deferred_start; /* don't start this queue in dev start */
 
 	/* only valid for split queue mode */
 	uint16_t sw_nb_desc;
@@ -109,8 +111,12 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
+int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
+int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +447 -0

465 lines not on this page · raw message

Signature · 1 line
2.34.1
#116 lore raw

Re: [PATCH v14 06/18] net/idpf: add support for queue start

Quoted 7 lines · Junfeng Guo

Add support for these device ops:
- rx_queue_start
- tx_queue_start

[snip]

Quoted 90 lines
drivers/net/idpf/idpf_vchnl.c +90 -0
+#define IDPF_RX_BUF_STRIDE		64
+int
+idpf_vc_config_rxqs(struct idpf_vport *vport)
+{
+	struct idpf_adapter *adapter = vport->adapter;
+	struct idpf_rx_queue **rxq =
+		(struct idpf_rx_queue **)vport->dev_data->rx_queues;
+	struct virtchnl2_config_rx_queues *vc_rxqs = NULL;
+	struct virtchnl2_rxq_info *rxq_info;
+	struct idpf_cmd_info args;
+	uint16_t total_qs, num_qs;
+	int size, i, j;
+	int err = 0;
+	int k = 0;
+
+	total_qs = vport->num_rx_q + vport->num_rx_bufq;
+	while (total_qs) {
+		if (total_qs > adapter->max_rxq_per_msg) {
+			num_qs = adapter->max_rxq_per_msg;
+			total_qs -= adapter->max_rxq_per_msg;
+		} else {
+			num_qs = total_qs;
+			total_qs = 0;
+		}
+
+		size = sizeof(*vc_rxqs) + (num_qs - 1) *
+			sizeof(struct virtchnl2_rxq_info);
+		vc_rxqs = rte_zmalloc("cfg_rxqs", size, 0);
+		if (vc_rxqs == NULL) {
+			PMD_DRV_LOG(ERR, "Failed to allocate virtchnl2_config_rx_queues");
+			err = -ENOMEM;
+			break;
+		}
+		vc_rxqs->vport_id = vport->vport_id;
+		vc_rxqs->num_qinfo = num_qs;
+		if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE) {
+			for (i = 0; i < num_qs; i++, k++) {
+				rxq_info = &vc_rxqs->qinfo[i];
+				rxq_info->dma_ring_addr = rxq[k]->rx_ring_phys_addr;
+				rxq_info->type = VIRTCHNL2_QUEUE_TYPE_RX;
+				rxq_info->queue_id = rxq[k]->queue_id;
+				rxq_info->model = VIRTCHNL2_QUEUE_MODEL_SINGLE;
+				rxq_info->data_buffer_size = rxq[k]->rx_buf_len;
+				rxq_info->max_pkt_size = vport->max_pkt_len;
+
+				rxq_info->desc_ids = VIRTCHNL2_RXDID_2_FLEX_SQ_NIC_M;
+				rxq_info->qflags |= VIRTCHNL2_RX_DESC_SIZE_32BYTE;
+
+				rxq_info->ring_len = rxq[k]->nb_rx_desc;
+			}
+		} else {
+			for (i = 0; i < num_qs / 3; i++, k++) {
+				/* Rx queue */
+				rxq_info = &vc_rxqs->qinfo[i * 3];
+				rxq_info->dma_ring_addr =
+					rxq[k]->rx_ring_phys_addr;
+				rxq_info->type = VIRTCHNL2_QUEUE_TYPE_RX;
+				rxq_info->queue_id = rxq[k]->queue_id;
+				rxq_info->model = VIRTCHNL2_QUEUE_MODEL_SPLIT;
+				rxq_info->data_buffer_size = rxq[k]->rx_buf_len;
+				rxq_info->max_pkt_size = vport->max_pkt_len;
+
+				rxq_info->desc_ids = VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M;
+				rxq_info->qflags |= VIRTCHNL2_RX_DESC_SIZE_32BYTE;
+
+				rxq_info->ring_len = rxq[k]->nb_rx_desc;
+				rxq_info->rx_bufq1_id = rxq[k]->bufq1->queue_id;
+				rxq_info->rx_bufq2_id = rxq[k]->bufq2->queue_id;
+				rxq_info->rx_buffer_low_watermark = 64;
+
+				/* Buffer queue */
+				for (j = 1; j <= IDPF_RX_BUFQ_PER_GRP; j++) {
+					struct idpf_rx_queue *bufq = j == 1 ?
+						rxq[k]->bufq1 : rxq[k]->bufq2;
+					rxq_info = &vc_rxqs->qinfo[i * 3 + j];
+					rxq_info->dma_ring_addr =
+						bufq->rx_ring_phys_addr;
+					rxq_info->type =
+						VIRTCHNL2_QUEUE_TYPE_RX_BUFFER;
+					rxq_info->queue_id = bufq->queue_id;
+					rxq_info->model = VIRTCHNL2_QUEUE_MODEL_SPLIT;
+					rxq_info->data_buffer_size = bufq->rx_buf_len;
+					rxq_info->desc_ids =
+						VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M;
+					rxq_info->ring_len = bufq->nb_rx_desc;
+
+					rxq_info->buffer_notif_stride =
+						IDPF_RX_BUF_STRIDE;
+					rxq_info->rx_buffer_low_watermark = 64;
+				}

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport) · line 547

Quoted 10 lines
drivers/net/idpf/idpf_vchnl.c +10 -0
+			}
+		}
+		memset(&args, 0, sizeof(args));
+		args.ops = VIRTCHNL2_OP_CONFIG_RX_QUEUES;
+		args.in_args = (uint8_t *)vc_rxqs;
+		args.in_args_size = size;
+		args.out_buffer = adapter->mbx_resp;
+		args.out_size = IDPF_DFLT_MBX_BUF_SIZE;
+
+		err = idpf_execute_vc_cmd(adapter, &args);

The function must return negative errno since its return value is used as a return value of functions returning negative errno.

Quoted 9 lines
drivers/net/idpf/idpf_vchnl.c +9 -0
+		rte_free(vc_rxqs);
+		if (err != 0) {
+			PMD_DRV_LOG(ERR, "Failed to execute command of VIRTCHNL2_OP_CONFIG_RX_QUEUES");
+			break;
+		}
+	}
+
+	return err;
+}

[snip]

#117 lore raw

RE: [PATCH v14 06/18] net/idpf: add support for queue start

Quoted 134 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, October 28, 2022 11:51 PM
To: Guo, Junfeng <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Cc: [email protected]; Li, Xiaoyun <[email protected]>
Subject: Re: [PATCH v14 06/18] net/idpf: add support for queue start

Quoted 7 lines · Junfeng Guo

Add support for these device ops:
- rx_queue_start
- tx_queue_start

[snip]

Quoted 19 lines
drivers/net/idpf/idpf_vchnl.c +19 -0
+#define IDPF_RX_BUF_STRIDE		64
+int
+idpf_vc_config_rxqs(struct idpf_vport *vport) {
+	struct idpf_adapter *adapter = vport->adapter;
+	struct idpf_rx_queue **rxq =
+		(struct idpf_rx_queue **)vport->dev_data->rx_queues;
+	struct virtchnl2_config_rx_queues *vc_rxqs = NULL;
+	struct virtchnl2_rxq_info *rxq_info;
+	struct idpf_cmd_info args;
+	uint16_t total_qs, num_qs;
+	int size, i, j;
+	int err = 0;
+	int k = 0;
+
+	total_qs = vport->num_rx_q + vport->num_rx_bufq;
+	while (total_qs) {
+		if (total_qs > adapter->max_rxq_per_msg) {
+			num_qs = adapter->max_rxq_per_msg;
+			total_qs -= adapter->max_rxq_per_msg;

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport)

Quoted 10 lines
drivers/net/idpf/idpf_vchnl.c +10 -0
+		} else {
+			num_qs = total_qs;
+			total_qs = 0;
+		}
+
+		size = sizeof(*vc_rxqs) + (num_qs - 1) *
+			sizeof(struct virtchnl2_rxq_info);
+		vc_rxqs = rte_zmalloc("cfg_rxqs", size, 0);
+		if (vc_rxqs == NULL) {
+			PMD_DRV_LOG(ERR, "Failed to allocate

virtchnl2_config_rx_queues");

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport)

Quoted 6 lines
drivers/net/idpf/idpf_vchnl.c +6 -0
+			err = -ENOMEM;
+			break;
+		}
+		vc_rxqs->vport_id = vport->vport_id;
+		vc_rxqs->num_qinfo = num_qs;
+		if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE)

{

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport) · line 525

Quoted 5 lines
drivers/net/idpf/idpf_vchnl.c +3 -0
+			for (i = 0; i < num_qs; i++, k++) {
+				rxq_info = &vc_rxqs->qinfo[i];
+				rxq_info->dma_ring_addr = rxq[k]-

rx_ring_phys_addr;

drivers/net/idpf/idpf_vchnl.c +1 -0
+				rxq_info->type =

VIRTCHNL2_QUEUE_TYPE_RX;

Review

Quoted 2 lines
(quoted diff) +2 -0
+				rxq_info->queue_id = rxq[k]->queue_id;
+				rxq_info->model =

VIRTCHNL2_QUEUE_MODEL_SINGLE;

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport) · line 530

Quoted 6 lines
(quoted diff) +1 -0
+				rxq_info->data_buffer_size = rxq[k]-

rx_buf_len;

(quoted diff) +1 -0
+				rxq_info->max_pkt_size = vport-

max_pkt_len;

drivers/net/idpf/idpf_vchnl.c +2 -0
+
+				rxq_info->desc_ids =

VIRTCHNL2_RXDID_2_FLEX_SQ_NIC_M;

Review

Quoted 1 line
(quoted diff) +1 -0
+				rxq_info->qflags |=

VIRTCHNL2_RX_DESC_SIZE_32BYTE;

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport) · line 525

Quoted 10 lines
drivers/net/idpf/idpf_vchnl.c +10 -0
+
+				rxq_info->ring_len = rxq[k]->nb_rx_desc;
+			}
+		} else {
+			for (i = 0; i < num_qs / 3; i++, k++) {
+				/* Rx queue */
+				rxq_info = &vc_rxqs->qinfo[i * 3];
+				rxq_info->dma_ring_addr =
+					rxq[k]->rx_ring_phys_addr;
+				rxq_info->type =

VIRTCHNL2_QUEUE_TYPE_RX;

Review

Quoted 2 lines
(quoted diff) +2 -0
+				rxq_info->queue_id = rxq[k]->queue_id;
+				rxq_info->model =

VIRTCHNL2_QUEUE_MODEL_SPLIT;

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport) · line 530

Quoted 6 lines
(quoted diff) +1 -0
+				rxq_info->data_buffer_size = rxq[k]-

rx_buf_len;

(quoted diff) +1 -0
+				rxq_info->max_pkt_size = vport-

max_pkt_len;

drivers/net/idpf/idpf_vchnl.c +2 -0
+
+				rxq_info->desc_ids =

VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M;

Review

Quoted 1 line
(quoted diff) +1 -0
+				rxq_info->qflags |=

VIRTCHNL2_RX_DESC_SIZE_32BYTE;

Quoted 7 lines
drivers/net/idpf/idpf_vchnl.c +3 -0
+
+				rxq_info->ring_len = rxq[k]->nb_rx_desc;
+				rxq_info->rx_bufq1_id = rxq[k]->bufq1-

queue_id;

(quoted diff) +1 -0
+				rxq_info->rx_bufq2_id = rxq[k]->bufq2-

queue_id;

drivers/net/idpf/idpf_vchnl.c +1 -0
+				rxq_info->rx_buffer_low_watermark = 64;

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport) · line 533

Quoted 10 lines
drivers/net/idpf/idpf_vchnl.c +10 -0
+
+				/* Buffer queue */
+				for (j = 1; j <= IDPF_RX_BUFQ_PER_GRP; j++) {
+					struct idpf_rx_queue *bufq = j == 1 ?
+						rxq[k]->bufq1 : rxq[k]->bufq2;
+					rxq_info = &vc_rxqs->qinfo[i * 3 + j];
+					rxq_info->dma_ring_addr =
+						bufq->rx_ring_phys_addr;
+					rxq_info->type =
+
	VIRTCHNL2_QUEUE_TYPE_RX_BUFFER;

Review

Quoted 3 lines
(quoted diff) +1 -0
+					rxq_info->queue_id = bufq-

queue_id;

(quoted diff) +1 -0
+					rxq_info->model =

VIRTCHNL2_QUEUE_MODEL_SPLIT;

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport) · line 533

Quoted 4 lines
(quoted diff) +1 -0
+					rxq_info->data_buffer_size = bufq-

rx_buf_len;

drivers/net/idpf/idpf_vchnl.c +2 -0
+					rxq_info->desc_ids =
+
	VIRTCHNL2_RXDID_2_FLEX_SPLITQ_M;

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport)

Quoted 6 lines
(quoted diff) +1 -0
+					rxq_info->ring_len = bufq-

nb_rx_desc;

drivers/net/idpf/idpf_vchnl.c +4 -0
+
+					rxq_info->buffer_notif_stride =
+						IDPF_RX_BUF_STRIDE;
+					rxq_info->rx_buffer_low_watermark

= 64;

Quoted 14 lines

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport) · line 547

Quoted 11 lines
drivers/net/idpf/idpf_vchnl.c +11 -0
+				}
+			}
+		}
+		memset(&args, 0, sizeof(args));
+		args.ops = VIRTCHNL2_OP_CONFIG_RX_QUEUES;
+		args.in_args = (uint8_t *)vc_rxqs;
+		args.in_args_size = size;
+		args.out_buffer = adapter->mbx_resp;
+		args.out_size = IDPF_DFLT_MBX_BUF_SIZE;
+
+		err = idpf_execute_vc_cmd(adapter, &args);

The function must return negative errno since its return value is used as a return value of functions returning negative errno.

Thanks for all your comments, please expect v15 tomorrow..

Quoted 14 lines

drivers/net/idpf/idpf_vchnl.c idpf_vc_destroy_vport(struct idpf_vport *vport)

Quoted 4 lines
drivers/net/idpf/idpf_vchnl.c +3 -0
+		rte_free(vc_rxqs);
+		if (err != 0) {
+			PMD_DRV_LOG(ERR, "Failed to execute command of

VIRTCHNL2_OP_CONFIG_RX_QUEUES");

Quoted 6 lines
drivers/net/idpf/idpf_vchnl.c +6 -0
+			break;
+		}
+	}
+
+	return err;
+}

[snip]

#118 lore raw

PATCH v14 7/18 net/idpf: add support for queue stop

In reply to Junfeng Guo

Add support for these device ops:
- rx_queue_stop
- tx_queue_stop

---
 doc/guides/nics/features/idpf.ini |   1 +
 drivers/net/idpf/idpf_ethdev.c    |  14 ++-
 drivers/net/idpf/idpf_rxtx.c      | 148 ++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h      |  13 +++
 drivers/net/idpf/idpf_vchnl.c     |  69 ++++++++++++++
 5 files changed, 241 insertions(+), 4 deletions(-)
doc/guides/nics/features/idpf.ini +1 -0
index 46aab2eb61..c25fa5de3f 100644
@@ -4,6 +4,7 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Queue start/stop     = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/idpf/idpf_ethdev.c +10 -4
index abbf519977..05f087a03c 100644
@@ -59,7 +59,9 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_stop			= idpf_dev_stop,
 	.dev_close			= idpf_dev_close,
 	.rx_queue_start			= idpf_rx_queue_start,
+	.rx_queue_stop			= idpf_rx_queue_stop,
 	.tx_queue_start			= idpf_tx_queue_start,
+	.tx_queue_stop			= idpf_tx_queue_stop,
 	.rx_queue_setup			= idpf_rx_queue_setup,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
@@ -347,22 +349,26 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	if (dev->data->mtu > vport->max_mtu) {
 		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
-		return -1;
+		goto err_mtu;
 	}
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
 
 	if (idpf_start_queues(dev) != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
-		return -1;
+		goto err_mtu;
 	}
 
 	if (idpf_vc_ena_dis_vport(vport, true) != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
-		return -1;
+		goto err_vport;
 	}
 
 	return 0;
+err_vport:
+	idpf_stop_queues(dev);
+err_mtu:
+	return -1;
 }
 
 static int
@@ -372,7 +378,7 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_vc_ena_dis_vport(vport, false);
 
-	/* TODO: stop queues */
+	idpf_stop_queues(dev);
 
 	return 0;
 }
drivers/net/idpf/idpf_rxtx.c +148 -0

187 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +13 -0
index ab9b3830fd..b959638489 100644
@@ -51,6 +51,7 @@ struct idpf_rx_queue {
 	bool q_set;             /* if rx queue has been configured */
 	bool q_started;         /* if rx queue has been started */
 	bool rx_deferred_start; /* don't start this queue in dev start */
+	const struct idpf_rxq_ops *ops;
 
 	/* only valid for split queue mode */
 	uint8_t expected_gen_id;
@@ -97,6 +98,7 @@ struct idpf_tx_queue {
 	bool q_set;		/* if tx queue has been configured */
 	bool q_started;		/* if tx queue has been started */
 	bool tx_deferred_start; /* don't start this queue in dev start */
+	const struct idpf_txq_ops *ops;
 
 	/* only valid for split queue mode */
 	uint16_t sw_nb_desc;
@@ -107,16 +109,27 @@ struct idpf_tx_queue {
 	struct idpf_tx_queue *complq;
 };
 
+struct idpf_rxq_ops {
+	void (*release_mbufs)(struct idpf_rx_queue *rxq);
+};
+
+struct idpf_txq_ops {
+	void (*release_mbufs)(struct idpf_tx_queue *txq);
+};
+
 int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
 int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+void idpf_stop_queues(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +69 -0

75 lines not on this page · raw message

Signature · 1 line
2.34.1
#119 lore raw

PATCH v14 8/18 net/idpf: add queue release

In reply to Junfeng Guo

Add support for queue operations:
- rx_queue_release
- tx_queue_release

---
 drivers/net/idpf/idpf_ethdev.c |  2 +
 drivers/net/idpf/idpf_rxtx.c   | 81 ++++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  3 ++
 3 files changed, 86 insertions(+)
drivers/net/idpf/idpf_ethdev.c +2 -0
index 05f087a03c..dee1e03d43 100644
@@ -63,7 +63,9 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.tx_queue_start			= idpf_tx_queue_start,
 	.tx_queue_stop			= idpf_tx_queue_stop,
 	.rx_queue_setup			= idpf_rx_queue_setup,
+	.rx_queue_release		= idpf_dev_rx_queue_release,
 	.tx_queue_setup			= idpf_tx_queue_setup,
+	.tx_queue_release		= idpf_dev_tx_queue_release,
 	.dev_infos_get			= idpf_dev_info_get,
 	.link_update			= idpf_dev_link_update,
 };
drivers/net/idpf/idpf_rxtx.c +81 -0

117 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +3 -0
index b959638489..37944edcac 100644
@@ -124,12 +124,15 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+void idpf_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
+
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
 int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 
 void idpf_stop_queues(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.34.1
#120 lore raw

PATCH v14 9/18 net/idpf: add support for MTU configuration

In reply to Junfeng Guo

Add dev ops mtu_set.

---
 doc/guides/nics/features/idpf.ini |  1 +
 drivers/net/idpf/idpf_ethdev.c    | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
doc/guides/nics/features/idpf.ini +1 -0
index c25fa5de3f..c8f4a0d6ed 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Queue start/stop     = Y
+MTU update           = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/idpf/idpf_ethdev.c +14 -0
index dee1e03d43..94f4671057 100644
@@ -35,6 +35,7 @@ static int idpf_dev_stop(struct rte_eth_dev *dev);
 static int idpf_dev_close(struct rte_eth_dev *dev);
 static int idpf_dev_info_get(struct rte_eth_dev *dev,
 			     struct rte_eth_dev_info *dev_info);
+static int idpf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 static void idpf_adapter_rel(struct idpf_adapter *adapter);
 
 static int
@@ -68,6 +69,7 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.tx_queue_release		= idpf_dev_tx_queue_release,
 	.dev_infos_get			= idpf_dev_info_get,
 	.link_update			= idpf_dev_link_update,
+	.mtu_set			= idpf_dev_mtu_set,
 };
 
 static int
@@ -110,6 +112,18 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	return 0;
 }
 
+static int
+idpf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused)
+{
+	/* mtu setting is forbidden if port is start */
+	if (dev->data->dev_started) {
+		PMD_DRV_LOG(ERR, "port must be stopped before configuration");
+		return -EBUSY;
+	}
+
+	return 0;
+}
+
 static int
 idpf_init_vport_req_info(struct rte_eth_dev *dev)
 {
Signature · 1 line
2.34.1
#121 lore raw

PATCH v14 10/18 net/idpf: add support for basic Rx datapath

In reply to Junfeng Guo

Add basic Rx support in split queue mode and single queue mode.

---
 drivers/net/idpf/idpf_ethdev.c |   2 +
 drivers/net/idpf/idpf_rxtx.c   | 273 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |   7 +-
 3 files changed, 281 insertions(+), 1 deletion(-)
drivers/net/idpf/idpf_ethdev.c +2 -0
index 94f4671057..df2a760673 100644
@@ -375,6 +375,8 @@ idpf_dev_start(struct rte_eth_dev *dev)
 		goto err_mtu;
 	}
 
+	idpf_set_rx_function(dev);
+
 	if (idpf_vc_ena_dis_vport(vport, true) != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
 		goto err_vport;
drivers/net/idpf/idpf_rxtx.c +273 -0

276 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +6 -1
index 37944edcac..650c6c1c3a 100644
@@ -133,6 +133,11 @@ int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
-
+uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+				uint16_t nb_pkts);
+uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+			       uint16_t nb_pkts);
 void idpf_stop_queues(struct rte_eth_dev *dev);
+
+void idpf_set_rx_function(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.34.1
#122 lore raw

PATCH v14 11/18 net/idpf: add support for basic Tx datapath

In reply to Junfeng Guo

Add basic Tx support in split queue mode and single queue mode.

---
 drivers/net/idpf/idpf_ethdev.c |   3 +
 drivers/net/idpf/idpf_ethdev.h |   1 +
 drivers/net/idpf/idpf_rxtx.c   | 357 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  10 +
 4 files changed, 371 insertions(+)
drivers/net/idpf/idpf_ethdev.c +3 -0
index df2a760673..6fb56e584d 100644
@@ -88,6 +88,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;
 
+	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
 		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
@@ -376,6 +378,7 @@ idpf_dev_start(struct rte_eth_dev *dev)
 	}
 
 	idpf_set_rx_function(dev);
+	idpf_set_tx_function(dev);
 
 	if (idpf_vc_ena_dis_vport(vport, true) != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
drivers/net/idpf/idpf_ethdev.h +1 -0
index 96c22009e9..af0a8e2970 100644
@@ -35,6 +35,7 @@
 
 #define IDPF_MIN_BUF_SIZE	1024
 #define IDPF_MAX_FRAME_SIZE	9728
+#define IDPF_MIN_FRAME_SIZE	14
 
 #define IDPF_NUM_MACADDR_MAX	64
 
drivers/net/idpf/idpf_rxtx.c +357 -0

372 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +10 -0
index 650c6c1c3a..30dc94b3dd 100644
@@ -21,6 +21,8 @@
 #define IDPF_DEFAULT_TX_RS_THRESH	32
 #define IDPF_DEFAULT_TX_FREE_THRESH	32
 
+#define IDPF_TX_MAX_MTU_SEG	10
+
 struct idpf_rx_queue {
 	struct idpf_adapter *adapter;   /* the adapter this queue belongs to */
 	struct rte_mempool *mp;         /* mbuf pool to populate Rx ring */
@@ -137,7 +139,15 @@ uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts);
 uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			       uint16_t nb_pkts);
+uint16_t idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+				uint16_t nb_pkts);
+uint16_t idpf_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			       uint16_t nb_pkts);
+uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			uint16_t nb_pkts);
+
 void idpf_stop_queues(struct rte_eth_dev *dev);
 
 void idpf_set_rx_function(struct rte_eth_dev *dev);
+void idpf_set_tx_function(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.34.1
#123 lore raw

PATCH v14 12/18 net/idpf: support parsing packet type

In reply to Junfeng Guo

Parse packet type during receiving packets.

---
 drivers/net/idpf/idpf_ethdev.c |   6 +
 drivers/net/idpf/idpf_ethdev.h |   6 +
 drivers/net/idpf/idpf_rxtx.c   |  11 ++
 drivers/net/idpf/idpf_rxtx.h   |   5 +
 drivers/net/idpf/idpf_vchnl.c  | 240 +++++++++++++++++++++++++++++++++
 5 files changed, 268 insertions(+)
drivers/net/idpf/idpf_ethdev.c +6 -0
index 6fb56e584d..630bdabcd4 100644
@@ -709,6 +709,12 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 		goto err_api;
 	}
 
+	ret = idpf_get_pkt_type(adapter);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to set ptype table");
+		goto err_api;
+	}
+
 	adapter->caps = rte_zmalloc("idpf_caps",
 				sizeof(struct virtchnl2_get_capabilities), 0);
 	if (adapter->caps == NULL) {
drivers/net/idpf/idpf_ethdev.h +6 -0
index af0a8e2970..db9af58f72 100644
@@ -39,6 +39,8 @@
 
 #define IDPF_NUM_MACADDR_MAX	64
 
+#define IDPF_MAX_PKT_TYPE	1024
+
 #define IDPF_VLAN_TAG_SIZE	4
 #define IDPF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IDPF_VLAN_TAG_SIZE * 2)
@@ -125,6 +127,8 @@ struct idpf_adapter {
 	/* Max config queue number per VC message */
 	uint32_t max_rxq_per_msg;
 	uint32_t max_txq_per_msg;
+
+	uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned;
 };
 
 TAILQ_HEAD(idpf_adapter_list, idpf_adapter);
@@ -182,6 +186,7 @@ atomic_set_cmd(struct idpf_adapter *adapter, enum virtchnl_ops ops)
 struct idpf_adapter *idpf_find_adapter(struct rte_pci_device *pci_dev);
 void idpf_handle_virtchnl_msg(struct rte_eth_dev *dev);
 int idpf_vc_check_api_version(struct idpf_adapter *adapter);
+int idpf_get_pkt_type(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct idpf_adapter *adapter);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
@@ -193,6 +198,7 @@ int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
 		      bool rx, bool on);
 int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
+int idpf_vc_query_ptype_info(struct idpf_adapter *adapter);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
 
drivers/net/idpf/idpf_rxtx.c +11 -0
index f55d2143b9..a980714060 100644
@@ -1281,6 +1281,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	volatile struct virtchnl2_rx_flex_desc_adv_nic_3 *rx_desc;
 	uint16_t pktlen_gen_bufq_id;
 	struct idpf_rx_queue *rxq;
+	const uint32_t *ptype_tbl;
 	struct rte_mbuf *rxm;
 	uint16_t rx_id_bufq1;
 	uint16_t rx_id_bufq2;
@@ -1300,6 +1301,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	rx_id_bufq1 = rxq->bufq1->rx_next_avail;
 	rx_id_bufq2 = rxq->bufq2->rx_next_avail;
 	rx_desc_ring = rxq->rx_ring;
+	ptype_tbl = rxq->adapter->ptype_tbl;
 
 	while (nb_rx < nb_pkts) {
 		rx_desc = &rx_desc_ring[rx_id];
@@ -1347,6 +1349,10 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->nb_segs = 1;
 		rxm->port = rxq->port_id;
+		rxm->packet_type =
+			ptype_tbl[(rte_le_to_cpu_16(rx_desc->ptype_err_fflags0) &
+				   VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_M) >>
+				  VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_S];
 
 		rx_pkts[nb_rx++] = rxm;
 	}
@@ -1533,6 +1539,7 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	volatile union virtchnl2_rx_desc *rxdp;
 	union virtchnl2_rx_desc rxd;
 	struct idpf_rx_queue *rxq;
+	const uint32_t *ptype_tbl;
 	uint16_t rx_id, nb_hold;
 	struct rte_eth_dev *dev;
 	uint16_t rx_packet_len;
@@ -1551,6 +1558,7 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	rx_id = rxq->rx_tail;
 	rx_ring = rxq->rx_ring;
+	ptype_tbl = rxq->adapter->ptype_tbl;
 
 	while (nb_rx < nb_pkts) {
 		rxdp = &rx_ring[rx_id];
@@ -1603,6 +1611,9 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->pkt_len = rx_packet_len;
 		rxm->data_len = rx_packet_len;
 		rxm->port = rxq->port_id;
+		rxm->packet_type =
+			ptype_tbl[(uint8_t)(rte_cpu_to_le_16(rxd.flex_nic_wb.ptype_flex_flags0) &
+					    VIRTCHNL2_RX_FLEX_DESC_PTYPE_M)];
 
 		rx_pkts[nb_rx++] = rxm;
 	}
drivers/net/idpf/idpf_rxtx.h +5 -0
index 30dc94b3dd..3853ed55c9 100644
@@ -23,6 +23,10 @@
 
 #define IDPF_TX_MAX_MTU_SEG	10
 
+#define IDPF_GET_PTYPE_SIZE(p) \
+	(sizeof(struct virtchnl2_ptype) + \
+	(((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0])))
+
 struct idpf_rx_queue {
 	struct idpf_adapter *adapter;   /* the adapter this queue belongs to */
 	struct rte_mempool *mp;         /* mbuf pool to populate Rx ring */
@@ -150,4 +154,5 @@ void idpf_stop_queues(struct rte_eth_dev *dev);
 
 void idpf_set_rx_function(struct rte_eth_dev *dev);
 void idpf_set_tx_function(struct rte_eth_dev *dev);
+
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +240 -0

255 lines not on this page · raw message

Signature · 1 line
2.34.1
#124 lore raw

PATCH v14 13/18 net/idpf: add support for write back based on ITR expire

In reply to Junfeng Guo

Enable write back on ITR expire, then packets can be received one by one.

---
 drivers/net/idpf/idpf_ethdev.c | 116 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h |  13 ++++
 drivers/net/idpf/idpf_vchnl.c  | 111 +++++++++++++++++++++++++++++++
 3 files changed, 240 insertions(+)
drivers/net/idpf/idpf_ethdev.c +116 -0
index 630bdabcd4..8045073780 100644
@@ -327,6 +327,90 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_config_rx_queues_irqs(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	struct virtchnl2_queue_vector *qv_map;
+	struct idpf_hw *hw = &adapter->hw;
+	uint32_t dynctl_reg_start;
+	uint32_t itrn_reg_start;
+	uint32_t dynctl_val, itrn_val;
+	uint16_t i;
+
+	qv_map = rte_zmalloc("qv_map",
+			dev->data->nb_rx_queues *
+			sizeof(struct virtchnl2_queue_vector), 0);
+	if (qv_map == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to allocate %d queue-vector map",
+			    dev->data->nb_rx_queues);
+		goto qv_map_alloc_err;
+	}
+
+	/* Rx interrupt disabled, Map interrupt only for writeback */
+
+	/* The capability flags adapter->caps->other_caps here should be
+	 * compared with bit VIRTCHNL2_CAP_WB_ON_ITR. The if condition should
+	 * be updated when the FW can return correct flag bits.
+	 */
+	if (adapter->caps->other_caps != 0) {
+		dynctl_reg_start =
+			vport->recv_vectors->vchunks.vchunks->dynctl_reg_start;
+		itrn_reg_start =
+			vport->recv_vectors->vchunks.vchunks->itrn_reg_start;
+		dynctl_val = IDPF_READ_REG(hw, dynctl_reg_start);
+		PMD_DRV_LOG(DEBUG, "Value of dynctl_reg_start is 0x%x",
+			    dynctl_val);
+		itrn_val = IDPF_READ_REG(hw, itrn_reg_start);
+		PMD_DRV_LOG(DEBUG, "Value of itrn_reg_start is 0x%x", itrn_val);
+		/* Force write-backs by setting WB_ON_ITR bit in DYN_CTL
+		 * register. WB_ON_ITR and INTENA are mutually exclusive
+		 * bits. Setting WB_ON_ITR bits means TX and RX Descs
+		 * are written back based on ITR expiration irrespective
+		 * of INTENA setting.
+		 */
+		/* TBD: need to tune INTERVAL value for better performance. */
+		if (itrn_val != 0)
+			IDPF_WRITE_REG(hw,
+				       dynctl_reg_start,
+				       VIRTCHNL2_ITR_IDX_0  <<
+				       PF_GLINT_DYN_CTL_ITR_INDX_S |
+				       PF_GLINT_DYN_CTL_WB_ON_ITR_M |
+				       itrn_val <<
+				       PF_GLINT_DYN_CTL_INTERVAL_S);
+		else
+			IDPF_WRITE_REG(hw,
+				       dynctl_reg_start,
+				       VIRTCHNL2_ITR_IDX_0  <<
+				       PF_GLINT_DYN_CTL_ITR_INDX_S |
+				       PF_GLINT_DYN_CTL_WB_ON_ITR_M |
+				       IDPF_DFLT_INTERVAL <<
+				       PF_GLINT_DYN_CTL_INTERVAL_S);
+	}
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		/* map all queues to the same vector */
+		qv_map[i].queue_id = vport->chunks_info.rx_start_qid + i;
+		qv_map[i].vector_id =
+			vport->recv_vectors->vchunks.vchunks->start_vector_id;
+	}
+	vport->qv_map = qv_map;
+
+	if (idpf_vc_config_irq_map_unmap(vport, true) != 0) {
+		PMD_DRV_LOG(ERR, "config interrupt mapping failed");
+		goto config_irq_map_err;
+	}
+
+	return 0;
+
+config_irq_map_err:
+	rte_free(vport->qv_map);
+	vport->qv_map = NULL;
+
+qv_map_alloc_err:
+	return -1;
+}
+
 static int
 idpf_start_queues(struct rte_eth_dev *dev)
 {
@@ -364,6 +448,10 @@ static int
 idpf_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t num_allocated_vectors =
+		adapter->caps->num_allocated_vectors;
+	uint16_t req_vecs_num;
 
 	if (dev->data->mtu > vport->max_mtu) {
 		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
@@ -372,6 +460,23 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
 
+	req_vecs_num = IDPF_DFLT_Q_VEC_NUM;
+	if (req_vecs_num + adapter->used_vecs_num > num_allocated_vectors) {
+		PMD_DRV_LOG(ERR, "The accumulated request vectors' number should be less than %d",
+			    num_allocated_vectors);
+		goto err_mtu;
+	}
+	if (idpf_vc_alloc_vectors(vport, req_vecs_num) != 0) {
+		PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors");
+		goto err_mtu;
+	}
+	adapter->used_vecs_num += req_vecs_num;
+
+	if (idpf_config_rx_queues_irqs(dev) != 0) {
+		PMD_DRV_LOG(ERR, "Failed to configure irqs");
+		goto err_mtu;
+	}
+
 	if (idpf_start_queues(dev) != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
 		goto err_mtu;
@@ -401,6 +506,10 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_stop_queues(dev);
 
+	idpf_vc_config_irq_map_unmap(vport, false);
+
+	idpf_vc_dealloc_vectors(vport);
+
 	return 0;
 }
 
@@ -412,6 +521,11 @@ idpf_dev_close(struct rte_eth_dev *dev)
 
 	idpf_vc_destroy_vport(vport);
 
+	rte_free(vport->recv_vectors);
+	vport->recv_vectors = NULL;
+
+	rte_free(vport->qv_map);
+	vport->qv_map = NULL;
 
 	adapter->cur_vports &= ~RTE_BIT32(vport->devarg_id);
 
@@ -766,6 +880,8 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 	adapter->cur_vports = 0;
 	adapter->cur_vport_nb = 0;
 
+	adapter->used_vecs_num = 0;
+
 	return ret;
 
 err_vports:
drivers/net/idpf/idpf_ethdev.h +13 -0
index db9af58f72..811240c386 100644
@@ -33,6 +33,9 @@
 #define IDPF_CTLQ_LEN		64
 #define IDPF_DFLT_MBX_BUF_SIZE	4096
 
+#define IDPF_DFLT_Q_VEC_NUM	1
+#define IDPF_DFLT_INTERVAL	16
+
 #define IDPF_MIN_BUF_SIZE	1024
 #define IDPF_MAX_FRAME_SIZE	9728
 #define IDPF_MIN_FRAME_SIZE	14
@@ -92,6 +95,11 @@ struct idpf_vport {
 	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t max_pkt_len; /* Maximum packet length */
 
+	/* MSIX info*/
+	struct virtchnl2_queue_vector *qv_map; /* queue vector mapping */
+	uint16_t max_vectors;
+	struct virtchnl2_alloc_vectors *recv_vectors;
+
 	/* Chunk info */
 	struct idpf_chunks_info chunks_info;
 
@@ -124,6 +132,8 @@ struct idpf_adapter {
 	uint16_t cur_vport_nb;
 	uint16_t cur_vport_idx;
 
+	uint16_t used_vecs_num;
+
 	/* Max config queue number per VC message */
 	uint32_t max_rxq_per_msg;
 	uint32_t max_txq_per_msg;
@@ -198,6 +208,9 @@ int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
 		      bool rx, bool on);
 int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
+int idpf_vc_config_irq_map_unmap(struct idpf_vport *vport, bool map);
+int idpf_vc_alloc_vectors(struct idpf_vport *vport, uint16_t num_vectors);
+int idpf_vc_dealloc_vectors(struct idpf_vport *vport);
 int idpf_vc_query_ptype_info(struct idpf_adapter *adapter);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
drivers/net/idpf/idpf_vchnl.c +111 -0

123 lines not on this page · raw message

Signature · 1 line
2.34.1
#125 lore raw

PATCH v14 14/18 net/idpf: add support for RSS

In reply to Junfeng Guo

Add RSS support.

---
 drivers/net/idpf/idpf_ethdev.c | 116 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h |  26 ++++++++
 drivers/net/idpf/idpf_vchnl.c  |  97 +++++++++++++++++++++++++++
 3 files changed, 239 insertions(+)
drivers/net/idpf/idpf_ethdev.c +116 -0
index 8045073780..ea7d3bfd7e 100644
@@ -86,6 +86,7 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->flow_type_rss_offloads = IDPF_RSS_OFFLOAD_ALL;
 	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;
 
 	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
@@ -198,6 +199,8 @@ idpf_parse_devarg_id(char *name)
 	return val;
 }
 
+#define IDPF_RSS_KEY_LEN 52
+
 static int
 idpf_init_vport(struct rte_eth_dev *dev)
 {
@@ -218,6 +221,10 @@ idpf_init_vport(struct rte_eth_dev *dev)
 	vport->max_mtu = vport_info->max_mtu;
 	rte_memcpy(vport->default_mac_addr,
 		   vport_info->default_mac_addr, ETH_ALEN);
+	vport->rss_algorithm = vport_info->rss_algorithm;
+	vport->rss_key_size = RTE_MIN(IDPF_RSS_KEY_LEN,
+				     vport_info->rss_key_size);
+	vport->rss_lut_size = vport_info->rss_lut_size;
 	vport->sw_idx = idx;
 
 	for (i = 0; i < vport_info->chunks.num_chunks; i++) {
@@ -275,10 +282,102 @@ idpf_init_vport(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_config_rss(struct idpf_vport *vport)
+{
+	int ret;
+
+	ret = idpf_vc_set_rss_key(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS key");
+		return ret;
+	}
+
+	ret = idpf_vc_set_rss_lut(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS lut");
+		return ret;
+	}
+
+	ret = idpf_vc_set_rss_hash(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS hash");
+		return ret;
+	}
+
+	return ret;
+}
+
+static int
+idpf_init_rss(struct idpf_vport *vport)
+{
+	struct rte_eth_rss_conf *rss_conf;
+	uint16_t i, nb_q, lut_size;
+	int ret = 0;
+
+	rss_conf = &vport->dev_data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = vport->dev_data->nb_rx_queues;
+
+	vport->rss_key = rte_zmalloc("rss_key",
+				     vport->rss_key_size, 0);
+	if (vport->rss_key == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to allocate RSS key");
+		ret = -ENOMEM;
+		goto err_alloc_key;
+	}
+
+	lut_size = vport->rss_lut_size;
+	vport->rss_lut = rte_zmalloc("rss_lut",
+				     sizeof(uint32_t) * lut_size, 0);
+	if (vport->rss_lut == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to allocate RSS lut");
+		ret = -ENOMEM;
+		goto err_alloc_lut;
+	}
+
+	if (rss_conf->rss_key == NULL) {
+		for (i = 0; i < vport->rss_key_size; i++)
+			vport->rss_key[i] = (uint8_t)rte_rand();
+	} else if (rss_conf->rss_key_len != vport->rss_key_size) {
+		PMD_INIT_LOG(ERR, "Invalid RSS key length in RSS configuration, should be %d",
+			     vport->rss_key_size);
+		ret = -EINVAL;
+		goto err_cfg_key;
+	} else {
+		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+			   vport->rss_key_size);
+	}
+
+	for (i = 0; i < lut_size; i++)
+		vport->rss_lut[i] = i % nb_q;
+
+	vport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;
+
+	ret = idpf_config_rss(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS");
+		goto err_cfg_key;
+	}
+
+	return ret;
+
+err_cfg_key:
+	rte_free(vport->rss_lut);
+	vport->rss_lut = NULL;
+err_alloc_lut:
+	rte_free(vport->rss_key);
+	vport->rss_key = NULL;
+err_alloc_key:
+	return ret;
+}
+
 static int
 idpf_dev_configure(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
+	struct idpf_adapter *adapter = vport->adapter;
+	int ret;
 
 	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
 		PMD_INIT_LOG(ERR, "Setting link speed is not supported");
@@ -324,6 +423,17 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 		return -1;
 	}
 
+	if (adapter->caps->rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+		ret = idpf_init_rss(vport);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init rss");
+			return ret;
+		}
+	} else {
+		PMD_INIT_LOG(ERR, "RSS is not supported.");
+		return -1;
+	}
+
 	return 0;
 }
 
@@ -521,6 +631,12 @@ idpf_dev_close(struct rte_eth_dev *dev)
 
 	idpf_vc_destroy_vport(vport);
 
+	rte_free(vport->rss_lut);
+	vport->rss_lut = NULL;
+
+	rte_free(vport->rss_key);
+	vport->rss_key = NULL;
+
 	rte_free(vport->recv_vectors);
 	vport->recv_vectors = NULL;
 
drivers/net/idpf/idpf_ethdev.h +26 -0
index 811240c386..8d0804f603 100644
@@ -48,6 +48,20 @@
 #define IDPF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IDPF_VLAN_TAG_SIZE * 2)
 
+#define IDPF_RSS_OFFLOAD_ALL (				\
+		RTE_ETH_RSS_IPV4                |	\
+		RTE_ETH_RSS_FRAG_IPV4           |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_TCP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_UDP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_SCTP   |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_OTHER  |	\
+		RTE_ETH_RSS_IPV6                |	\
+		RTE_ETH_RSS_FRAG_IPV6           |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_TCP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_UDP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_SCTP   |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_OTHER)
+
 #define IDPF_ADAPTER_NAME_LEN	(PCI_PRI_STR_SIZE + 1)
 
 /* Message type read in virtual channel from PF */
@@ -90,11 +104,20 @@ struct idpf_vport {
 	uint16_t max_mtu;
 	uint8_t default_mac_addr[VIRTCHNL_ETH_LENGTH_OF_ADDRESS];
 
+	enum virtchnl_rss_algorithm rss_algorithm;
+	uint16_t rss_key_size;
+	uint16_t rss_lut_size;
+
 	uint16_t sw_idx; /* SW idx */
 
 	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t max_pkt_len; /* Maximum packet length */
 
+	/* RSS info */
+	uint32_t *rss_lut;
+	uint8_t *rss_key;
+	uint64_t rss_hf;
+
 	/* MSIX info*/
 	struct virtchnl2_queue_vector *qv_map; /* queue vector mapping */
 	uint16_t max_vectors;
@@ -200,6 +223,9 @@ int idpf_get_pkt_type(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct idpf_adapter *adapter);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
+int idpf_vc_set_rss_key(struct idpf_vport *vport);
+int idpf_vc_set_rss_lut(struct idpf_vport *vport);
+int idpf_vc_set_rss_hash(struct idpf_vport *vport);
 int idpf_vc_config_rxqs(struct idpf_vport *vport);
 int idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id);
 int idpf_vc_config_txqs(struct idpf_vport *vport);
drivers/net/idpf/idpf_vchnl.c +97 -0

109 lines not on this page · raw message

Signature · 1 line
2.34.1
#126 lore raw

PATCH v14 15/18 net/idpf: add support for Rx offloading

In reply to Junfeng Guo

Add Rx offloading support:
- support CHKSUM and RSS offload for split queue model
- support CHKSUM offload for single queue model

---
 doc/guides/nics/features/idpf.ini |   5 ++
 drivers/net/idpf/idpf_ethdev.c    |   6 ++
 drivers/net/idpf/idpf_rxtx.c      | 123 ++++++++++++++++++++++++++++++
 3 files changed, 134 insertions(+)
doc/guides/nics/features/idpf.ini +5 -0
index c8f4a0d6ed..6eefac9529 100644
@@ -3,9 +3,14 @@
 ;
 ; Refer to default.ini for the full list of available PMD features.
 ;
+; A feature with "P" indicates only be supported when non-vector path
+; is selected.
+;
 [Features]
 Queue start/stop     = Y
 MTU update           = Y
+L3 checksum offload  = P
+L4 checksum offload  = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/idpf/idpf_ethdev.c +6 -0
index ea7d3bfd7e..88f3db3267 100644
@@ -89,6 +89,12 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->flow_type_rss_offloads = IDPF_RSS_OFFLOAD_ALL;
 	dev_info->max_mac_addrs = IDPF_NUM_MACADDR_MAX;
 
+	dev_info->rx_offload_capa =
+		RTE_ETH_RX_OFFLOAD_IPV4_CKSUM           |
+		RTE_ETH_RX_OFFLOAD_UDP_CKSUM            |
+		RTE_ETH_RX_OFFLOAD_TCP_CKSUM            |
+		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+
 	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
drivers/net/idpf/idpf_rxtx.c +123 -0

171 lines not on this page · raw message

Signature · 1 line
2.34.1
#127 lore raw

PATCH v14 16/18 net/idpf: add support for Tx offloading

In reply to Junfeng Guo

Add Tx offloading support:
- support TSO

---
 doc/guides/nics/features/idpf.ini |   1 +
 drivers/net/idpf/idpf_ethdev.c    |   4 +-
 drivers/net/idpf/idpf_rxtx.c      | 128 +++++++++++++++++++++++++++++-
 drivers/net/idpf/idpf_rxtx.h      |  22 +++++
 4 files changed, 152 insertions(+), 3 deletions(-)
doc/guides/nics/features/idpf.ini +1 -0
index 6eefac9529..86c182021f 100644
@@ -9,6 +9,7 @@
 [Features]
 Queue start/stop     = Y
 MTU update           = Y
+TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
 Linux                = Y
drivers/net/idpf/idpf_ethdev.c +3 -1
index 88f3db3267..868f28d003 100644
@@ -95,7 +95,9 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM            |
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
 
-	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+	dev_info->tx_offload_capa =
+		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
drivers/net/idpf/idpf_rxtx.c +126 -2

199 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +22 -0
index 3853ed55c9..54d297aac6 100644
@@ -23,6 +23,16 @@
 
 #define IDPF_TX_MAX_MTU_SEG	10
 
+#define IDPF_MIN_TSO_MSS	88
+#define IDPF_MAX_TSO_MSS	9728
+#define IDPF_MAX_TSO_FRAME_SIZE	262143
+#define IDPF_TX_MAX_MTU_SEG     10
+
+#define IDPF_TX_OFFLOAD_MASK RTE_MBUF_F_TX_TCP_SEG
+
+#define IDPF_TX_OFFLOAD_NOTSUP_MASK \
+		(RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK)
+
 #define IDPF_GET_PTYPE_SIZE(p) \
 	(sizeof(struct virtchnl2_ptype) + \
 	(((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0])))
@@ -115,6 +125,18 @@ struct idpf_tx_queue {
 	struct idpf_tx_queue *complq;
 };
 
+/* Offload features */
+union idpf_tx_offload {
+	uint64_t data;
+	struct {
+		uint64_t l2_len:7; /* L2 (MAC) Header Length. */
+		uint64_t l3_len:9; /* L3 (IP) Header Length. */
+		uint64_t l4_len:8; /* L4 Header Length. */
+		uint64_t tso_segsz:16; /* TCP TSO segment size */
+		/* uint64_t unused : 24; */
+	};
+};
+
 struct idpf_rxq_ops {
 	void (*release_mbufs)(struct idpf_rx_queue *rxq);
 };
Signature · 1 line
2.34.1
#128 lore raw

PATCH v14 17/18 net/idpf: add AVX512 data path for single queue model

In reply to Junfeng Guo

Add support of AVX512 vector data path for single queue model.

---
 doc/guides/nics/idpf.rst                |  19 +
 drivers/net/idpf/idpf_ethdev.c          |   3 +-
 drivers/net/idpf/idpf_ethdev.h          |   5 +
 drivers/net/idpf/idpf_rxtx.c            | 145 ++++
 drivers/net/idpf/idpf_rxtx.h            |  21 +
 drivers/net/idpf/idpf_rxtx_vec_avx512.c | 871 ++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx_vec_common.h | 100 +++
 drivers/net/idpf/meson.build            |  28 +
 8 files changed, 1191 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
doc/guides/nics/idpf.rst +19 -0
index c1001d5d0c..3039c61748 100644
@@ -64,3 +64,22 @@ Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and
 for details.
 
 
+Features
+--------
+
+Vector PMD
+~~~~~~~~~~
+
+Vector path for RX and TX path are selected automatically. The paths
+are chosen based on 2 conditions.
+
+- ``CPU``
+  On the X86 platform, the driver checks if the CPU supports AVX512.
+  If the CPU supports AVX512 and EAL argument ``--force-max-simd-bitwidth``
+  is set to 512, AVX512 paths will be chosen.
+
+- ``Offload features``
+  The supported HW offload features are described in the document idpf.ini,
+  A value "P" means the offload feature is not supported by vector path.
+  If any not supported features are used, idpf vector PMD is disabled and the
+  scalar paths are chosen.
drivers/net/idpf/idpf_ethdev.c +2 -1
index 868f28d003..62b13b602e 100644
@@ -97,7 +97,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS		|
+		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
drivers/net/idpf/idpf_ethdev.h +5 -0
index 8d0804f603..7d54e5db60 100644
@@ -162,6 +162,11 @@ struct idpf_adapter {
 	uint32_t max_txq_per_msg;
 
 	uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned;
+
+	bool rx_vec_allowed;
+	bool tx_vec_allowed;
+	bool rx_use_avx512;
+	bool tx_use_avx512;
 };
 
 TAILQ_HEAD(idpf_adapter_list, idpf_adapter);
drivers/net/idpf/idpf_rxtx.c +145 -0

185 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +21 -0
index 54d297aac6..506bf8a57d 100644
@@ -18,6 +18,12 @@
 #define IDPF_RX_MAX_BURST		32
 #define IDPF_DEFAULT_RX_FREE_THRESH	32
 
+/* used for Vector PMD */
+#define IDPF_VPMD_RX_MAX_BURST	32
+#define IDPF_VPMD_TX_MAX_BURST	32
+#define IDPF_VPMD_DESCS_PER_LOOP	4
+#define IDPF_RXQ_REARM_THRESH	64
+
 #define IDPF_DEFAULT_TX_RS_THRESH	32
 #define IDPF_DEFAULT_TX_FREE_THRESH	32
 
@@ -54,6 +60,11 @@ struct idpf_rx_queue {
 	struct rte_mbuf *pkt_last_seg;  /* last segment of current packet */
 	struct rte_mbuf fake_mbuf;      /* dummy mbuf */
 
+	/* used for VPMD */
+	uint16_t rxrearm_nb;       /* number of remaining to be re-armed */
+	uint16_t rxrearm_start;    /* the idx we start the re-arming from */
+	uint64_t mbuf_initializer; /* value to init mbufs */
+
 	uint16_t rx_nb_avail;
 	uint16_t rx_next_avail;
 
@@ -84,6 +95,10 @@ struct idpf_tx_entry {
 	uint16_t last_id;
 };
 
+struct idpf_tx_vec_entry {
+	struct rte_mbuf *mbuf;
+};
+
 /* Structure associated with each TX queue. */
 struct idpf_tx_queue {
 	const struct rte_memzone *mz;		/* memzone for Tx ring */
@@ -149,6 +164,7 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
+int idpf_singleq_tx_vec_setup_avx512(struct idpf_tx_queue *txq);
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
@@ -157,16 +173,21 @@ void idpf_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
+int idpf_singleq_rx_vec_setup(struct idpf_rx_queue *rxq);
 int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts);
+uint16_t idpf_singleq_recv_pkts_avx512(void *rx_queue, struct rte_mbuf **rx_pkts,
+				       uint16_t nb_pkts);
 uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			       uint16_t nb_pkts);
 uint16_t idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				uint16_t nb_pkts);
+uint16_t idpf_singleq_xmit_pkts_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
+				       uint16_t nb_pkts);
 uint16_t idpf_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       uint16_t nb_pkts);
 uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
drivers/net/idpf/idpf_rxtx_vec_avx512.c new file +871 -0

871 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx_vec_common.h new file +100 -0

100 lines not on this page · raw message

drivers/net/idpf/meson.build +28 -0
index b632b76656..da99c098ab 100644
@@ -14,3 +14,31 @@ sources = files(
     'idpf_rxtx.c',
     'idpf_vchnl.c',
 )
+
+if arch_subdir == 'x86'
+    idpf_avx512_cpu_support = (
+        cc.get_define('__AVX512F__', args: machine_args) != '' and
+        cc.get_define('__AVX512BW__', args: machine_args) != ''
+    )
+
+    idpf_avx512_cc_support = (
+        not machine_args.contains('-mno-avx512f') and
+        cc.has_argument('-mavx512f') and
+        cc.has_argument('-mavx512bw')
+    )
+
+    if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true
+        cflags += ['-DCC_AVX512_SUPPORT']
+        avx512_args = [cflags, '-mavx512f', '-mavx512bw']
+        if cc.has_argument('-march=skylake-avx512')
+            avx512_args += '-march=skylake-avx512'
+        endif
+        idpf_avx512_lib = static_library('idpf_avx512_lib',
+            'idpf_rxtx_vec_avx512.c',
+            dependencies: [static_rte_common_idpf, static_rte_ethdev, static_rte_bus_pci,
+            static_rte_kvargs, static_rte_hash],
+            include_directories: includes,
+            c_args: avx512_args)
+        objs += idpf_avx512_lib.extract_objects('idpf_rxtx_vec_avx512.c')
+    endif
+endif
Signature · 1 line
2.34.1
#129 lore raw

PATCH v14 18/18 net/idpf: add support for timestamp offload

In reply to Junfeng Guo

Add support for timestamp offload.

---
 doc/guides/nics/features/idpf.ini |  1 +
 drivers/net/idpf/idpf_ethdev.c    |  5 +-
 drivers/net/idpf/idpf_ethdev.h    |  3 ++
 drivers/net/idpf/idpf_rxtx.c      | 65 ++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h      | 90 +++++++++++++++++++++++++++++++
 5 files changed, 163 insertions(+), 1 deletion(-)
doc/guides/nics/features/idpf.ini +1 -0
index 86c182021f..5fbad9600c 100644
@@ -12,6 +12,7 @@ MTU update           = Y
 TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
+Timestamp offload    = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/idpf/idpf_ethdev.c +4 -1
index 62b13b602e..84e7421d76 100644
@@ -22,6 +22,8 @@ rte_spinlock_t idpf_adapter_lock;
 struct idpf_adapter_list idpf_adapter_list;
 bool idpf_adapter_list_init;
 
+uint64_t idpf_timestamp_dynflag;
+
 static const char * const idpf_valid_args[] = {
 	IDPF_TX_SINGLE_Q,
 	IDPF_RX_SINGLE_Q,
@@ -93,7 +95,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_RX_OFFLOAD_IPV4_CKSUM           |
 		RTE_ETH_RX_OFFLOAD_UDP_CKSUM            |
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM            |
-		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM     |
+		RTE_ETH_RX_OFFLOAD_TIMESTAMP;
 
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
drivers/net/idpf/idpf_ethdev.h +3 -0
index 7d54e5db60..ccdf4abe40 100644
@@ -167,6 +167,9 @@ struct idpf_adapter {
 	bool tx_vec_allowed;
 	bool rx_use_avx512;
 	bool tx_use_avx512;
+
+	/* For PTP */
+	uint64_t time_hw;
 };
 
 TAILQ_HEAD(idpf_adapter_list, idpf_adapter);
drivers/net/idpf/idpf_rxtx.c +65 -0

140 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +90 -0

106 lines not on this page · raw message

Signature · 1 line
2.34.1
#130 lore raw

v15 cover add support for idpf PMD in DPDK

In reply to Junfeng Guo

From: Beilei Xing <[email protected]>

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452). The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation. Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

v11:
- move shared code to common/idpf/base
- Create one vport if there's no vport devargs
- Refactor if conditions according to coding style
- Refactor virtual channel return values
- Refine dev_stop function
- Refine RSS lut/key
- Fix build error

v12:
- Refine dev_configure
- Fix coding style according to the comments
- Re-order patch
- Romove dev_supported_ptypes_get

v13:
- refine dev_start/stop and queue_start/stop
- fix timestamp offload

v14:
- fix wrong position for rte_validate_tx_offload

v15:
- refine the return value for ethdev ops.
- removce forward static declarations.
- refine get caps.
- fix lock/unlock handling.

Junfeng Guo (18):
common/idpf: introduce common library
net/idpf: add support for device initialization net/idpf: add Tx queue setup
net/idpf: add Rx queue setup
net/idpf: add support for device start and stop net/idpf: add support for queue start
net/idpf: add support for queue stop
net/idpf: add queue release
net/idpf: add support for MTU configuration net/idpf: add support for basic Rx datapath net/idpf: add support for basic Tx datapath net/idpf: support parsing packet type
net/idpf: add support for write back based on ITR expire net/idpf: add support for RSS
net/idpf: add support for Rx offloading net/idpf: add support for Tx offloading net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 MAINTAINERS                                   |    9 +
 doc/guides/nics/features/idpf.ini             |   17 +
 doc/guides/nics/idpf.rst                      |   85 +
 doc/guides/nics/index.rst                     |    1 +
 doc/guides/rel_notes/release_22_11.rst        |    6 +
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 drivers/net/idpf/idpf_ethdev.c                | 1293 ++++++++
 drivers/net/idpf/idpf_ethdev.h                |  252 ++
 drivers/net/idpf/idpf_logs.h                  |   56 +
 drivers/net/idpf/idpf_rxtx.c                  | 2308 +++++++++++++
 drivers/net/idpf/idpf_rxtx.h                  |  291 ++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c       |  871 +++++
 drivers/net/idpf/idpf_rxtx_vec_common.h       |  100 +
 drivers/net/idpf/idpf_vchnl.c                 | 1416 ++++++++
 drivers/net/idpf/meson.build                  |   44 +
 drivers/net/idpf/version.map                  |    3 +
 drivers/net/meson.build                       |    1 +
 38 files changed, 15255 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
Signature · 1 line
2.26.2
#131 lore raw

PATCH v15 1/18 common/idpf: introduce common library

From: Junfeng Guo <[email protected]>

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.
Add base code and OS specific implementation first.

---
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  234 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 22 files changed, 8502 insertions(+)
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
drivers/common/idpf/base/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/base/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_api.h new file +234 -0

234 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/base/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/base/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/base/idpf_osdep.h new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/base/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/base/meson.build new file +14 -0
new file mode 100644
index 0000000000..ce2b5346e4
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
\ No newline at end of file
drivers/common/idpf/base/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/base/virtchnl.h new file +2866 -0

15 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/base/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/idpf/meson.build new file +4 -0
new file mode 100644
index 0000000000..26881166e9

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

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752

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

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.26.2

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

#132 lore raw

PATCH v15 2/18 net/idpf: add support for device initialization

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Support device init and add the following dev ops:
- dev_configure
- dev_close
- dev_infos_get

---
 MAINTAINERS                            |   9 +
 doc/guides/nics/features/idpf.ini      |   9 +
 doc/guides/nics/idpf.rst               |  66 ++
 doc/guides/nics/index.rst              |   1 +
 doc/guides/rel_notes/release_22_11.rst |   6 +
 drivers/net/idpf/idpf_ethdev.c         | 891 +++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h         | 189 ++++++
 drivers/net/idpf/idpf_logs.h           |  56 ++
 drivers/net/idpf/idpf_vchnl.c          | 416 ++++++++++++
 drivers/net/idpf/meson.build           |  15 +
 drivers/net/idpf/version.map           |   3 +
 drivers/net/meson.build                |   1 +
 12 files changed, 1662 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
MAINTAINERS +9 -0
index bdf233c9f8..cc66db25e8 100644
@@ -770,6 +770,15 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
+Intel idpf
+M: Jingjing Wu <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/idpf/
+F: drivers/common/idpf/
+F: doc/guides/nics/idpf.rst
+F: doc/guides/nics/features/idpf.ini
+
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/features/idpf.ini new file +9 -0
new file mode 100644
index 0000000000..46aab2eb61
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'idpf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+x86-32               = Y
+x86-64               = Y
doc/guides/nics/idpf.rst new file +66 -0

66 lines not on this page · raw message

doc/guides/nics/index.rst +1 -0
index 4d40ea29a3..12841ce407 100644
@@ -34,6 +34,7 @@ Network Interface Controller Drivers
     hns3
     i40e
     ice
+    idpf
     igb
     igc
     ionic
doc/guides/rel_notes/release_22_11.rst +6 -0
index a6f180ed99..7b66733aea 100644
@@ -165,6 +165,12 @@ New Features
 
   * Added protocol based buffer split support in scalar path.
 
+* **Added IDPF PMD [*EXPERIMENTAL*].**
+
+  Added the new ``idpf`` net driver for Intel® Infrastructure Processing Unit
+  (Intel® IPU) E2000.
+  See the :doc:`../nics/idpf` NIC guide for more details on this new driver.
+
 * **Updated Marvell cnxk driver.**
 
   * Added support for flow action REPRESENTED_PORT.
drivers/net/idpf/idpf_ethdev.c new file +891 -0

891 lines not on this page · raw message

drivers/net/idpf/idpf_ethdev.h new file +189 -0

189 lines not on this page · raw message

drivers/net/idpf/idpf_logs.h new file +56 -0

56 lines not on this page · raw message

drivers/net/idpf/idpf_vchnl.c new file +416 -0

416 lines not on this page · raw message

drivers/net/idpf/meson.build new file +15 -0
new file mode 100644
index 0000000000..ecf73355c3
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+if is_windows
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
+endif
+
+deps += ['common_idpf']
+
+sources = files(
+    'idpf_ethdev.c',
+    'idpf_vchnl.c',
+)
drivers/net/idpf/version.map new file +3 -0
new file mode 100644
index 0000000000..78c3585d7c
@@ -0,0 +1,3 @@
+DPDK_23 {
+	local: *;
+};
drivers/net/meson.build +1 -0
index 589399400a..6470bf3636 100644
@@ -29,6 +29,7 @@ drivers = [
         'i40e',
         'iavf',
         'ice',
+        'idpf',
         'igc',
         'ionic',
         'ipn3ke',
Signature · 1 line
2.26.2
#133 lore raw

PATCH v15 3/18 net/idpf: add Tx queue setup

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for tx_queue_setup ops.

In the single queue model, the same descriptor queue is used by SW to post buffer descriptors to HW and by HW to post completed descriptors to SW.

In the split queue model, "RX buffer queues" are used to pass descriptor buffers from SW to HW while Rx queues are used only to pass the descriptor completions, that is, descriptors that point to completed buffers, from HW to SW. This is contrary to the single queue model in which Rx queues are used for both purposes.

---
 drivers/net/idpf/idpf_ethdev.c |  13 ++
 drivers/net/idpf/idpf_rxtx.c   | 364 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  70 +++++++
 drivers/net/idpf/meson.build   |   1 +
 4 files changed, 448 insertions(+)
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
drivers/net/idpf/idpf_ethdev.c +13 -0
index 035f563275..54f20d30ca 100644
@@ -11,6 +11,7 @@
 #include <errno.h>
 
 #include "idpf_ethdev.h"
+#include "idpf_rxtx.h"
 
 #define IDPF_TX_SINGLE_Q	"tx_single"
 #define IDPF_RX_SINGLE_Q	"rx_single"
@@ -42,6 +43,17 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = IDPF_MAX_RING_DESC,
+		.nb_min = IDPF_MIN_RING_DESC,
+		.nb_align = IDPF_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -631,6 +643,7 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_configure			= idpf_dev_configure,
 	.dev_close			= idpf_dev_close,
+	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
 };
 
drivers/net/idpf/idpf_rxtx.c new file +364 -0

364 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h new file +70 -0

70 lines not on this page · raw message

drivers/net/idpf/meson.build +1 -0
index ecf73355c3..b632b76656 100644
@@ -11,5 +11,6 @@ deps += ['common_idpf']
 
 sources = files(
     'idpf_ethdev.c',
+    'idpf_rxtx.c',
     'idpf_vchnl.c',
 )
Signature · 1 line
2.26.2
#134 lore raw

PATCH v15 4/18 net/idpf: add Rx queue setup

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for rx_queue_setup ops.

---
 drivers/net/idpf/idpf_ethdev.c |  11 +
 drivers/net/idpf/idpf_rxtx.c   | 400 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  46 ++++
 3 files changed, 457 insertions(+)
drivers/net/idpf/idpf_ethdev.c +11 -0
index 54f20d30ca..fb5cd1b111 100644
@@ -48,12 +48,22 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
 	};
 
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_free_thresh = IDPF_DEFAULT_RX_FREE_THRESH,
+	};
+
 	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
 		.nb_max = IDPF_MAX_RING_DESC,
 		.nb_min = IDPF_MIN_RING_DESC,
 		.nb_align = IDPF_ALIGN_RING_DESC,
 	};
 
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = IDPF_MAX_RING_DESC,
+		.nb_min = IDPF_MIN_RING_DESC,
+		.nb_align = IDPF_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -643,6 +653,7 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_configure			= idpf_dev_configure,
 	.dev_close			= idpf_dev_close,
+	.rx_queue_setup			= idpf_rx_queue_setup,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
 };
drivers/net/idpf/idpf_rxtx.c +400 -0

418 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +46 -0

61 lines not on this page · raw message

Signature · 1 line
2.26.2
#135 lore raw

PATCH v15 5/18 net/idpf: add support for device start and stop

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add dev ops dev_start, dev_stop and link_update.

---
 drivers/net/idpf/idpf_ethdev.c | 55 ++++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.c   | 20 +++++++++++++
 2 files changed, 75 insertions(+)
drivers/net/idpf/idpf_ethdev.c +55 -0
index fb5cd1b111..621bf9aad5 100644
@@ -29,6 +29,22 @@ static const char * const idpf_valid_args[] = {
 	NULL
 };
 
+static int
+idpf_dev_link_update(struct rte_eth_dev *dev,
+		     __rte_unused int wait_to_complete)
+{
+	struct rte_eth_link new_link;
+
+	memset(&new_link, 0, sizeof(new_link));
+
+	new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
+	new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
+				  RTE_ETH_LINK_SPEED_FIXED);
+
+	return rte_eth_linkstatus_set(dev, &new_link);
+}
+
 static int
 idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
@@ -267,6 +283,42 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_dev_start(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	int ret;
+
+	if (dev->data->mtu > vport->max_mtu) {
+		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
+		return -EINVAL;
+	}
+
+	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
+
+	/* TODO: start queues */
+
+	ret = idpf_vc_ena_dis_vport(vport, true);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+idpf_dev_stop(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	idpf_vc_ena_dis_vport(vport, false);
+
+	/* TODO: stop queues */
+
+	return 0;
+}
+
 static int
 idpf_dev_close(struct rte_eth_dev *dev)
 {
@@ -656,6 +708,9 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.rx_queue_setup			= idpf_rx_queue_setup,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
+	.dev_start			= idpf_dev_start,
+	.dev_stop			= idpf_dev_stop,
+	.link_update			= idpf_dev_link_update,
 };
 
 static uint16_t
drivers/net/idpf/idpf_rxtx.c +20 -0
index 25dd5d85d5..3528d2f2c7 100644
@@ -334,6 +334,11 @@ idpf_rx_split_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_rx_thresh(nb_desc, rx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (rx_conf->rx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Setup Rx description queue */
 	rxq = rte_zmalloc_socket("idpf rxq",
 				 sizeof(struct idpf_rx_queue),
@@ -465,6 +470,11 @@ idpf_rx_single_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_rx_thresh(nb_desc, rx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (rx_conf->rx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Setup Rx description queue */
 	rxq = rte_zmalloc_socket("idpf rxq",
 				 sizeof(struct idpf_rx_queue),
@@ -569,6 +579,11 @@ idpf_tx_split_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (tx_conf->tx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("idpf split txq",
 				 sizeof(struct idpf_tx_queue),
@@ -691,6 +706,11 @@ idpf_tx_single_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (tx_conf->tx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("idpf txq",
 				 sizeof(struct idpf_tx_queue),
Signature · 1 line
2.26.2
#136 lore raw

PATCH v15 6/18 net/idpf: add support for queue start

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for these device ops:
- rx_queue_start
- tx_queue_start

---
 drivers/net/idpf/idpf_ethdev.c |  42 +++-
 drivers/net/idpf/idpf_ethdev.h |   9 +
 drivers/net/idpf/idpf_rxtx.c   | 237 +++++++++++++++--
 drivers/net/idpf/idpf_rxtx.h   |   6 +
 drivers/net/idpf/idpf_vchnl.c  | 447 +++++++++++++++++++++++++++++++++
 5 files changed, 720 insertions(+), 21 deletions(-)
drivers/net/idpf/idpf_ethdev.c +41 -1
index 621bf9aad5..0400ed611f 100644
@@ -283,6 +283,39 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_start_queues(struct rte_eth_dev *dev)
+{
+	struct idpf_rx_queue *rxq;
+	struct idpf_tx_queue *txq;
+	int err = 0;
+	int i;
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		txq = dev->data->tx_queues[i];
+		if (txq == NULL || txq->tx_deferred_start)
+			continue;
+		err = idpf_tx_queue_start(dev, i);
+		if (err != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start Tx queue %u", i);
+			return err;
+		}
+	}
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq == NULL || rxq->rx_deferred_start)
+			continue;
+		err = idpf_rx_queue_start(dev, i);
+		if (err != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start Rx queue %u", i);
+			return err;
+		}
+	}
+
+	return err;
+}
+
 static int
 idpf_dev_start(struct rte_eth_dev *dev)
 {
@@ -296,11 +329,16 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
 
-	/* TODO: start queues */
+	ret = idpf_start_queues(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to start queues");
+		return ret;
+	}
 
 	ret = idpf_vc_ena_dis_vport(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		/* TODO: stop queues */
 		return ret;
 	}
 
@@ -711,6 +749,8 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_start			= idpf_dev_start,
 	.dev_stop			= idpf_dev_stop,
 	.link_update			= idpf_dev_link_update,
+	.rx_queue_start			= idpf_rx_queue_start,
+	.tx_queue_start			= idpf_tx_queue_start,
 };
 
 static uint16_t
drivers/net/idpf/idpf_ethdev.h +9 -0
index 84ae6641e2..96c22009e9 100644
@@ -24,7 +24,9 @@
 #define IDPF_DEFAULT_TXQ_NUM	16
 
 #define IDPF_INVALID_VPORT_IDX	0xffff
+#define IDPF_TXQ_PER_GRP	1
 #define IDPF_TX_COMPLQ_PER_GRP	1
+#define IDPF_RXQ_PER_GRP	1
 #define IDPF_RX_BUFQ_PER_GRP	2
 
 #define IDPF_CTLQ_ID		-1
@@ -182,6 +184,13 @@ int idpf_vc_check_api_version(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct idpf_adapter *adapter);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
+int idpf_vc_config_rxqs(struct idpf_vport *vport);
+int idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id);
+int idpf_vc_config_txqs(struct idpf_vport *vport);
+int idpf_vc_config_txq(struct idpf_vport *vport, uint16_t txq_id);
+int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
+		      bool rx, bool on);
+int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
drivers/net/idpf/idpf_rxtx.c +217 -20

288 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +6 -0
index 3f3932c3eb..ab9b3830fd 100644
@@ -50,6 +50,7 @@ struct idpf_rx_queue {
 
 	bool q_set;             /* if rx queue has been configured */
 	bool q_started;         /* if rx queue has been started */
+	bool rx_deferred_start; /* don't start this queue in dev start */
 
 	/* only valid for split queue mode */
 	uint8_t expected_gen_id;
@@ -95,6 +96,7 @@ struct idpf_tx_queue {
 
 	bool q_set;		/* if tx queue has been configured */
 	bool q_started;		/* if tx queue has been started */
+	bool tx_deferred_start; /* don't start this queue in dev start */
 
 	/* only valid for split queue mode */
 	uint16_t sw_nb_desc;
@@ -109,8 +111,12 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
+int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
+int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +447 -0

465 lines not on this page · raw message

Signature · 1 line
2.26.2
#137 lore raw

PATCH v15 7/18 net/idpf: add support for queue stop

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for these device ops:
- rx_queue_stop
- tx_queue_stop

---
 drivers/net/idpf/idpf_ethdev.c |  17 ++--
 drivers/net/idpf/idpf_rxtx.c   | 148 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  13 +++
 drivers/net/idpf/idpf_vchnl.c  |  69 +++++++++++++++
 4 files changed, 242 insertions(+), 5 deletions(-)
drivers/net/idpf/idpf_ethdev.c +12 -5
index 0400ed611f..9f1e1e6a18 100644
@@ -324,7 +324,8 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	if (dev->data->mtu > vport->max_mtu) {
 		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_mtu;
 	}
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
@@ -332,17 +333,21 @@ idpf_dev_start(struct rte_eth_dev *dev)
 	ret = idpf_start_queues(dev);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
-		return ret;
+		goto err_mtu;
 	}
 
 	ret = idpf_vc_ena_dis_vport(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
-		/* TODO: stop queues */
-		return ret;
+		goto err_vport;
 	}
 
 	return 0;
+
+err_vport:
+	idpf_stop_queues(dev);
+err_mtu:
+	return ret;
 }
 
 static int
@@ -352,7 +357,7 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_vc_ena_dis_vport(vport, false);
 
-	/* TODO: stop queues */
+	idpf_stop_queues(dev);
 
 	return 0;
 }
@@ -751,6 +756,8 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.link_update			= idpf_dev_link_update,
 	.rx_queue_start			= idpf_rx_queue_start,
 	.tx_queue_start			= idpf_tx_queue_start,
+	.rx_queue_stop			= idpf_rx_queue_stop,
+	.tx_queue_stop			= idpf_tx_queue_stop,
 };
 
 static uint16_t
drivers/net/idpf/idpf_rxtx.c +148 -0

187 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +13 -0
index ab9b3830fd..b959638489 100644
@@ -51,6 +51,7 @@ struct idpf_rx_queue {
 	bool q_set;             /* if rx queue has been configured */
 	bool q_started;         /* if rx queue has been started */
 	bool rx_deferred_start; /* don't start this queue in dev start */
+	const struct idpf_rxq_ops *ops;
 
 	/* only valid for split queue mode */
 	uint8_t expected_gen_id;
@@ -97,6 +98,7 @@ struct idpf_tx_queue {
 	bool q_set;		/* if tx queue has been configured */
 	bool q_started;		/* if tx queue has been started */
 	bool tx_deferred_start; /* don't start this queue in dev start */
+	const struct idpf_txq_ops *ops;
 
 	/* only valid for split queue mode */
 	uint16_t sw_nb_desc;
@@ -107,16 +109,27 @@ struct idpf_tx_queue {
 	struct idpf_tx_queue *complq;
 };
 
+struct idpf_rxq_ops {
+	void (*release_mbufs)(struct idpf_rx_queue *rxq);
+};
+
+struct idpf_txq_ops {
+	void (*release_mbufs)(struct idpf_tx_queue *txq);
+};
+
 int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
 int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+void idpf_stop_queues(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +69 -0

75 lines not on this page · raw message

Signature · 1 line
2.26.2
#138 lore raw

PATCH v15 8/18 net/idpf: add queue release

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for queue operations:
- rx_queue_release
- tx_queue_release

---
 drivers/net/idpf/idpf_ethdev.c |  2 +
 drivers/net/idpf/idpf_rxtx.c   | 81 ++++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  3 ++
 3 files changed, 86 insertions(+)
drivers/net/idpf/idpf_ethdev.c +2 -0
index 9f1e1e6a18..1485f40e71 100644
@@ -758,6 +758,8 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.tx_queue_start			= idpf_tx_queue_start,
 	.rx_queue_stop			= idpf_rx_queue_stop,
 	.tx_queue_stop			= idpf_tx_queue_stop,
+	.rx_queue_release		= idpf_dev_rx_queue_release,
+	.tx_queue_release		= idpf_dev_tx_queue_release,
 };
 
 static uint16_t
drivers/net/idpf/idpf_rxtx.c +81 -0

117 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +3 -0
index b959638489..37944edcac 100644
@@ -124,12 +124,15 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+void idpf_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
+
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
 int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 
 void idpf_stop_queues(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.26.2
#139 lore raw

PATCH v15 9/18 net/idpf: add support for MTU configuration

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add dev ops mtu_set.

---
 doc/guides/nics/features/idpf.ini |  1 +
 drivers/net/idpf/idpf_ethdev.c    | 13 +++++++++++++
 2 files changed, 14 insertions(+)
doc/guides/nics/features/idpf.ini +1 -0
index 46aab2eb61..d722c49fde 100644
@@ -4,6 +4,7 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+MTU update           = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/idpf/idpf_ethdev.c +13 -0
index 1485f40e71..856f3d7266 100644
@@ -83,6 +83,18 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	return 0;
 }
 
+static int
+idpf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused)
+{
+	/* mtu setting is forbidden if port is start */
+	if (dev->data->dev_started) {
+		PMD_DRV_LOG(ERR, "port must be stopped before configuration");
+		return -EBUSY;
+	}
+
+	return 0;
+}
+
 static int
 idpf_init_vport_req_info(struct rte_eth_dev *dev)
 {
@@ -760,6 +772,7 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.tx_queue_stop			= idpf_tx_queue_stop,
 	.rx_queue_release		= idpf_dev_rx_queue_release,
 	.tx_queue_release		= idpf_dev_tx_queue_release,
+	.mtu_set			= idpf_dev_mtu_set,
 };
 
 static uint16_t
Signature · 1 line
2.26.2
#140 lore raw

PATCH v15 10/18 net/idpf: add support for basic Rx datapath

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add basic Rx support in split queue mode and single queue mode.

---
 drivers/net/idpf/idpf_ethdev.c |   2 +
 drivers/net/idpf/idpf_rxtx.c   | 273 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |   7 +-
 3 files changed, 281 insertions(+), 1 deletion(-)
drivers/net/idpf/idpf_ethdev.c +2 -0
index 856f3d7266..2f1f9eeee5 100644
@@ -348,6 +348,8 @@ idpf_dev_start(struct rte_eth_dev *dev)
 		goto err_mtu;
 	}
 
+	idpf_set_rx_function(dev);
+
 	ret = idpf_vc_ena_dis_vport(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
drivers/net/idpf/idpf_rxtx.c +273 -0

276 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +6 -1
index 37944edcac..650c6c1c3a 100644
@@ -133,6 +133,11 @@ int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
-
+uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+				uint16_t nb_pkts);
+uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+			       uint16_t nb_pkts);
 void idpf_stop_queues(struct rte_eth_dev *dev);
+
+void idpf_set_rx_function(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.26.2
#141 lore raw

PATCH v15 11/18 net/idpf: add support for basic Tx datapath

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add basic Tx support in split queue mode and single queue mode.

---
 drivers/net/idpf/idpf_ethdev.c |   3 +
 drivers/net/idpf/idpf_ethdev.h |   1 +
 drivers/net/idpf/idpf_rxtx.c   | 357 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  10 +
 4 files changed, 371 insertions(+)
drivers/net/idpf/idpf_ethdev.c +3 -0
index 2f1f9eeee5..f9f6fe1162 100644
@@ -59,6 +59,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
 		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
@@ -349,6 +351,7 @@ idpf_dev_start(struct rte_eth_dev *dev)
 	}
 
 	idpf_set_rx_function(dev);
+	idpf_set_tx_function(dev);
 
 	ret = idpf_vc_ena_dis_vport(vport, true);
 	if (ret != 0) {
drivers/net/idpf/idpf_ethdev.h +1 -0
index 96c22009e9..af0a8e2970 100644
@@ -35,6 +35,7 @@
 
 #define IDPF_MIN_BUF_SIZE	1024
 #define IDPF_MAX_FRAME_SIZE	9728
+#define IDPF_MIN_FRAME_SIZE	14
 
 #define IDPF_NUM_MACADDR_MAX	64
 
drivers/net/idpf/idpf_rxtx.c +357 -0

372 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +10 -0
index 650c6c1c3a..30dc94b3dd 100644
@@ -21,6 +21,8 @@
 #define IDPF_DEFAULT_TX_RS_THRESH	32
 #define IDPF_DEFAULT_TX_FREE_THRESH	32
 
+#define IDPF_TX_MAX_MTU_SEG	10
+
 struct idpf_rx_queue {
 	struct idpf_adapter *adapter;   /* the adapter this queue belongs to */
 	struct rte_mempool *mp;         /* mbuf pool to populate Rx ring */
@@ -137,7 +139,15 @@ uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts);
 uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			       uint16_t nb_pkts);
+uint16_t idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+				uint16_t nb_pkts);
+uint16_t idpf_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			       uint16_t nb_pkts);
+uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			uint16_t nb_pkts);
+
 void idpf_stop_queues(struct rte_eth_dev *dev);
 
 void idpf_set_rx_function(struct rte_eth_dev *dev);
+void idpf_set_tx_function(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.26.2
#142 lore raw

PATCH v15 12/18 net/idpf: support parsing packet type

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Parse packet type during receiving packets.

---
 drivers/net/idpf/idpf_ethdev.c |   6 +
 drivers/net/idpf/idpf_ethdev.h |   6 +
 drivers/net/idpf/idpf_rxtx.c   |  11 ++
 drivers/net/idpf/idpf_rxtx.h   |   5 +
 drivers/net/idpf/idpf_vchnl.c  | 240 +++++++++++++++++++++++++++++++++
 5 files changed, 268 insertions(+)
drivers/net/idpf/idpf_ethdev.c +6 -0
index f9f6fe1162..d0821ec3f3 100644
@@ -686,6 +686,12 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 		goto err_api;
 	}
 
+	ret = idpf_get_pkt_type(adapter);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to set ptype table");
+		goto err_api;
+	}
+
 	adapter->caps = rte_zmalloc("idpf_caps",
 				sizeof(struct virtchnl2_get_capabilities), 0);
 	if (adapter->caps == NULL) {
drivers/net/idpf/idpf_ethdev.h +6 -0
index af0a8e2970..db9af58f72 100644
@@ -39,6 +39,8 @@
 
 #define IDPF_NUM_MACADDR_MAX	64
 
+#define IDPF_MAX_PKT_TYPE	1024
+
 #define IDPF_VLAN_TAG_SIZE	4
 #define IDPF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IDPF_VLAN_TAG_SIZE * 2)
@@ -125,6 +127,8 @@ struct idpf_adapter {
 	/* Max config queue number per VC message */
 	uint32_t max_rxq_per_msg;
 	uint32_t max_txq_per_msg;
+
+	uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned;
 };
 
 TAILQ_HEAD(idpf_adapter_list, idpf_adapter);
@@ -182,6 +186,7 @@ atomic_set_cmd(struct idpf_adapter *adapter, enum virtchnl_ops ops)
 struct idpf_adapter *idpf_find_adapter(struct rte_pci_device *pci_dev);
 void idpf_handle_virtchnl_msg(struct rte_eth_dev *dev);
 int idpf_vc_check_api_version(struct idpf_adapter *adapter);
+int idpf_get_pkt_type(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct idpf_adapter *adapter);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
@@ -193,6 +198,7 @@ int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
 		      bool rx, bool on);
 int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
+int idpf_vc_query_ptype_info(struct idpf_adapter *adapter);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
 
drivers/net/idpf/idpf_rxtx.c +11 -0
index f55d2143b9..a980714060 100644
@@ -1281,6 +1281,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	volatile struct virtchnl2_rx_flex_desc_adv_nic_3 *rx_desc;
 	uint16_t pktlen_gen_bufq_id;
 	struct idpf_rx_queue *rxq;
+	const uint32_t *ptype_tbl;
 	struct rte_mbuf *rxm;
 	uint16_t rx_id_bufq1;
 	uint16_t rx_id_bufq2;
@@ -1300,6 +1301,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	rx_id_bufq1 = rxq->bufq1->rx_next_avail;
 	rx_id_bufq2 = rxq->bufq2->rx_next_avail;
 	rx_desc_ring = rxq->rx_ring;
+	ptype_tbl = rxq->adapter->ptype_tbl;
 
 	while (nb_rx < nb_pkts) {
 		rx_desc = &rx_desc_ring[rx_id];
@@ -1347,6 +1349,10 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->nb_segs = 1;
 		rxm->port = rxq->port_id;
+		rxm->packet_type =
+			ptype_tbl[(rte_le_to_cpu_16(rx_desc->ptype_err_fflags0) &
+				   VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_M) >>
+				  VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_S];
 
 		rx_pkts[nb_rx++] = rxm;
 	}
@@ -1533,6 +1539,7 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	volatile union virtchnl2_rx_desc *rxdp;
 	union virtchnl2_rx_desc rxd;
 	struct idpf_rx_queue *rxq;
+	const uint32_t *ptype_tbl;
 	uint16_t rx_id, nb_hold;
 	struct rte_eth_dev *dev;
 	uint16_t rx_packet_len;
@@ -1551,6 +1558,7 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	rx_id = rxq->rx_tail;
 	rx_ring = rxq->rx_ring;
+	ptype_tbl = rxq->adapter->ptype_tbl;
 
 	while (nb_rx < nb_pkts) {
 		rxdp = &rx_ring[rx_id];
@@ -1603,6 +1611,9 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->pkt_len = rx_packet_len;
 		rxm->data_len = rx_packet_len;
 		rxm->port = rxq->port_id;
+		rxm->packet_type =
+			ptype_tbl[(uint8_t)(rte_cpu_to_le_16(rxd.flex_nic_wb.ptype_flex_flags0) &
+					    VIRTCHNL2_RX_FLEX_DESC_PTYPE_M)];
 
 		rx_pkts[nb_rx++] = rxm;
 	}
drivers/net/idpf/idpf_rxtx.h +5 -0
index 30dc94b3dd..3853ed55c9 100644
@@ -23,6 +23,10 @@
 
 #define IDPF_TX_MAX_MTU_SEG	10
 
+#define IDPF_GET_PTYPE_SIZE(p) \
+	(sizeof(struct virtchnl2_ptype) + \
+	(((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0])))
+
 struct idpf_rx_queue {
 	struct idpf_adapter *adapter;   /* the adapter this queue belongs to */
 	struct rte_mempool *mp;         /* mbuf pool to populate Rx ring */
@@ -150,4 +154,5 @@ void idpf_stop_queues(struct rte_eth_dev *dev);
 
 void idpf_set_rx_function(struct rte_eth_dev *dev);
 void idpf_set_tx_function(struct rte_eth_dev *dev);
+
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +240 -0

255 lines not on this page · raw message

Signature · 1 line
2.26.2
#143 lore raw

PATCH v15 13/18 net/idpf: add support for write back based on ITR expire

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Enable write back on ITR expire, then packets can be received one by one.

---
 drivers/net/idpf/idpf_ethdev.c | 120 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h |  13 ++++
 drivers/net/idpf/idpf_vchnl.c  | 113 +++++++++++++++++++++++++++++++
 3 files changed, 246 insertions(+)
drivers/net/idpf/idpf_ethdev.c +120 -0
index d0821ec3f3..957cc10616 100644
@@ -297,6 +297,90 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_config_rx_queues_irqs(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	struct virtchnl2_queue_vector *qv_map;
+	struct idpf_hw *hw = &adapter->hw;
+	uint32_t dynctl_reg_start;
+	uint32_t itrn_reg_start;
+	uint32_t dynctl_val, itrn_val;
+	uint16_t i;
+
+	qv_map = rte_zmalloc("qv_map",
+			dev->data->nb_rx_queues *
+			sizeof(struct virtchnl2_queue_vector), 0);
+	if (qv_map == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to allocate %d queue-vector map",
+			    dev->data->nb_rx_queues);
+		goto qv_map_alloc_err;
+	}
+
+	/* Rx interrupt disabled, Map interrupt only for writeback */
+
+	/* The capability flags adapter->caps->other_caps should be
+	 * compared with bit VIRTCHNL2_CAP_WB_ON_ITR here. The if
+	 * condition should be updated when the FW can return the
+	 * correct flag bits.
+	 */
+	dynctl_reg_start =
+		vport->recv_vectors->vchunks.vchunks->dynctl_reg_start;
+	itrn_reg_start =
+		vport->recv_vectors->vchunks.vchunks->itrn_reg_start;
+	dynctl_val = IDPF_READ_REG(hw, dynctl_reg_start);
+	PMD_DRV_LOG(DEBUG, "Value of dynctl_reg_start is 0x%x",
+		    dynctl_val);
+	itrn_val = IDPF_READ_REG(hw, itrn_reg_start);
+	PMD_DRV_LOG(DEBUG, "Value of itrn_reg_start is 0x%x", itrn_val);
+	/* Force write-backs by setting WB_ON_ITR bit in DYN_CTL
+	 * register. WB_ON_ITR and INTENA are mutually exclusive
+	 * bits. Setting WB_ON_ITR bits means TX and RX Descs
+	 * are written back based on ITR expiration irrespective
+	 * of INTENA setting.
+	 */
+	/* TBD: need to tune INTERVAL value for better performance. */
+	if (itrn_val != 0)
+		IDPF_WRITE_REG(hw,
+			       dynctl_reg_start,
+			       VIRTCHNL2_ITR_IDX_0  <<
+			       PF_GLINT_DYN_CTL_ITR_INDX_S |
+			       PF_GLINT_DYN_CTL_WB_ON_ITR_M |
+			       itrn_val <<
+			       PF_GLINT_DYN_CTL_INTERVAL_S);
+	else
+		IDPF_WRITE_REG(hw,
+			       dynctl_reg_start,
+			       VIRTCHNL2_ITR_IDX_0  <<
+			       PF_GLINT_DYN_CTL_ITR_INDX_S |
+			       PF_GLINT_DYN_CTL_WB_ON_ITR_M |
+			       IDPF_DFLT_INTERVAL <<
+			       PF_GLINT_DYN_CTL_INTERVAL_S);
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		/* map all queues to the same vector */
+		qv_map[i].queue_id = vport->chunks_info.rx_start_qid + i;
+		qv_map[i].vector_id =
+			vport->recv_vectors->vchunks.vchunks->start_vector_id;
+	}
+	vport->qv_map = qv_map;
+
+	if (idpf_vc_config_irq_map_unmap(vport, true) != 0) {
+		PMD_DRV_LOG(ERR, "config interrupt mapping failed");
+		goto config_irq_map_err;
+	}
+
+	return 0;
+
+config_irq_map_err:
+	rte_free(vport->qv_map);
+	vport->qv_map = NULL;
+
+qv_map_alloc_err:
+	return -1;
+}
+
 static int
 idpf_start_queues(struct rte_eth_dev *dev)
 {
@@ -334,6 +418,10 @@ static int
 idpf_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t num_allocated_vectors =
+		adapter->caps->num_allocated_vectors;
+	uint16_t req_vecs_num;
 	int ret;
 
 	if (dev->data->mtu > vport->max_mtu) {
@@ -344,6 +432,27 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
 
+	req_vecs_num = IDPF_DFLT_Q_VEC_NUM;
+	if (req_vecs_num + adapter->used_vecs_num > num_allocated_vectors) {
+		PMD_DRV_LOG(ERR, "The accumulated request vectors' number should be less than %d",
+			    num_allocated_vectors);
+		ret = -EINVAL;
+		goto err_mtu;
+	}
+
+	ret = idpf_vc_alloc_vectors(vport, req_vecs_num);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors");
+		goto err_mtu;
+	}
+	adapter->used_vecs_num += req_vecs_num;
+
+	ret = idpf_config_rx_queues_irqs(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to configure irqs");
+		goto err_mtu;
+	}
+
 	ret = idpf_start_queues(dev);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
@@ -376,6 +485,10 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_stop_queues(dev);
 
+	idpf_vc_config_irq_map_unmap(vport, false);
+
+	idpf_vc_dealloc_vectors(vport);
+
 	return 0;
 }
 
@@ -387,6 +500,11 @@ idpf_dev_close(struct rte_eth_dev *dev)
 
 	idpf_vc_destroy_vport(vport);
 
+	rte_free(vport->recv_vectors);
+	vport->recv_vectors = NULL;
+
+	rte_free(vport->qv_map);
+	vport->qv_map = NULL;
 
 	adapter->cur_vports &= ~RTE_BIT32(vport->devarg_id);
 
@@ -748,6 +866,8 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 	adapter->cur_vports = 0;
 	adapter->cur_vport_nb = 0;
 
+	adapter->used_vecs_num = 0;
+
 	return ret;
 
 err_vports:
drivers/net/idpf/idpf_ethdev.h +13 -0
index db9af58f72..811240c386 100644
@@ -33,6 +33,9 @@
 #define IDPF_CTLQ_LEN		64
 #define IDPF_DFLT_MBX_BUF_SIZE	4096
 
+#define IDPF_DFLT_Q_VEC_NUM	1
+#define IDPF_DFLT_INTERVAL	16
+
 #define IDPF_MIN_BUF_SIZE	1024
 #define IDPF_MAX_FRAME_SIZE	9728
 #define IDPF_MIN_FRAME_SIZE	14
@@ -92,6 +95,11 @@ struct idpf_vport {
 	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t max_pkt_len; /* Maximum packet length */
 
+	/* MSIX info*/
+	struct virtchnl2_queue_vector *qv_map; /* queue vector mapping */
+	uint16_t max_vectors;
+	struct virtchnl2_alloc_vectors *recv_vectors;
+
 	/* Chunk info */
 	struct idpf_chunks_info chunks_info;
 
@@ -124,6 +132,8 @@ struct idpf_adapter {
 	uint16_t cur_vport_nb;
 	uint16_t cur_vport_idx;
 
+	uint16_t used_vecs_num;
+
 	/* Max config queue number per VC message */
 	uint32_t max_rxq_per_msg;
 	uint32_t max_txq_per_msg;
@@ -198,6 +208,9 @@ int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
 		      bool rx, bool on);
 int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
+int idpf_vc_config_irq_map_unmap(struct idpf_vport *vport, bool map);
+int idpf_vc_alloc_vectors(struct idpf_vport *vport, uint16_t num_vectors);
+int idpf_vc_dealloc_vectors(struct idpf_vport *vport);
 int idpf_vc_query_ptype_info(struct idpf_adapter *adapter);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
drivers/net/idpf/idpf_vchnl.c +113 -0

131 lines not on this page · raw message

Signature · 1 line
2.26.2
#144 lore raw

PATCH v15 14/18 net/idpf: add support for RSS

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add RSS support.

---
 drivers/net/idpf/idpf_ethdev.c | 120 ++++++++++++++++++++++++++++++++-
 drivers/net/idpf/idpf_ethdev.h |  26 +++++++
 drivers/net/idpf/idpf_vchnl.c  | 113 +++++++++++++++++++++++++++++++
 3 files changed, 258 insertions(+), 1 deletion(-)
drivers/net/idpf/idpf_ethdev.c +119 -1
index 957cc10616..58560ea404 100644
@@ -59,6 +59,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->flow_type_rss_offloads = IDPF_RSS_OFFLOAD_ALL;
+
 	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -169,6 +171,8 @@ idpf_parse_devarg_id(char *name)
 	return val;
 }
 
+#define IDPF_RSS_KEY_LEN 52
+
 static int
 idpf_init_vport(struct rte_eth_dev *dev)
 {
@@ -189,6 +193,10 @@ idpf_init_vport(struct rte_eth_dev *dev)
 	vport->max_mtu = vport_info->max_mtu;
 	rte_memcpy(vport->default_mac_addr,
 		   vport_info->default_mac_addr, ETH_ALEN);
+	vport->rss_algorithm = vport_info->rss_algorithm;
+	vport->rss_key_size = RTE_MIN(IDPF_RSS_KEY_LEN,
+				     vport_info->rss_key_size);
+	vport->rss_lut_size = vport_info->rss_lut_size;
 	vport->sw_idx = idx;
 
 	for (i = 0; i < vport_info->chunks.num_chunks; i++) {
@@ -246,17 +254,110 @@ idpf_init_vport(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_config_rss(struct idpf_vport *vport)
+{
+	int ret;
+
+	ret = idpf_vc_set_rss_key(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS key");
+		return ret;
+	}
+
+	ret = idpf_vc_set_rss_lut(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS lut");
+		return ret;
+	}
+
+	ret = idpf_vc_set_rss_hash(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS hash");
+		return ret;
+	}
+
+	return ret;
+}
+
+static int
+idpf_init_rss(struct idpf_vport *vport)
+{
+	struct rte_eth_rss_conf *rss_conf;
+	uint16_t i, nb_q, lut_size;
+	int ret = 0;
+
+	rss_conf = &vport->dev_data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = vport->dev_data->nb_rx_queues;
+
+	vport->rss_key = rte_zmalloc("rss_key",
+				     vport->rss_key_size, 0);
+	if (vport->rss_key == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to allocate RSS key");
+		ret = -ENOMEM;
+		goto err_alloc_key;
+	}
+
+	lut_size = vport->rss_lut_size;
+	vport->rss_lut = rte_zmalloc("rss_lut",
+				     sizeof(uint32_t) * lut_size, 0);
+	if (vport->rss_lut == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to allocate RSS lut");
+		ret = -ENOMEM;
+		goto err_alloc_lut;
+	}
+
+	if (rss_conf->rss_key == NULL) {
+		for (i = 0; i < vport->rss_key_size; i++)
+			vport->rss_key[i] = (uint8_t)rte_rand();
+	} else if (rss_conf->rss_key_len != vport->rss_key_size) {
+		PMD_INIT_LOG(ERR, "Invalid RSS key length in RSS configuration, should be %d",
+			     vport->rss_key_size);
+		ret = -EINVAL;
+		goto err_cfg_key;
+	} else {
+		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+			   vport->rss_key_size);
+	}
+
+	for (i = 0; i < lut_size; i++)
+		vport->rss_lut[i] = i % nb_q;
+
+	vport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;
+
+	ret = idpf_config_rss(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS");
+		goto err_cfg_key;
+	}
+
+	return ret;
+
+err_cfg_key:
+	rte_free(vport->rss_lut);
+	vport->rss_lut = NULL;
+err_alloc_lut:
+	rte_free(vport->rss_key);
+	vport->rss_key = NULL;
+err_alloc_key:
+	return ret;
+}
+
 static int
 idpf_dev_configure(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
+	struct idpf_adapter *adapter = vport->adapter;
+	int ret;
 
 	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
 		PMD_INIT_LOG(ERR, "Setting link speed is not supported");
 		return -ENOTSUP;
 	}
 
-	if (dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) {
+	if ((dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) ||
+	    (dev->data->nb_rx_queues > 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_RSS)) {
 		PMD_INIT_LOG(ERR, "Multi-queue packet distribution mode %d is not supported",
 			     conf->rxmode.mq_mode);
 		return -ENOTSUP;
@@ -294,6 +395,17 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
+	if (adapter->caps->rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+		ret = idpf_init_rss(vport);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init rss");
+			return ret;
+		}
+	} else {
+		PMD_INIT_LOG(ERR, "RSS is not supported.");
+		return -1;
+	}
+
 	return 0;
 }
 
@@ -500,6 +612,12 @@ idpf_dev_close(struct rte_eth_dev *dev)
 
 	idpf_vc_destroy_vport(vport);
 
+	rte_free(vport->rss_lut);
+	vport->rss_lut = NULL;
+
+	rte_free(vport->rss_key);
+	vport->rss_key = NULL;
+
 	rte_free(vport->recv_vectors);
 	vport->recv_vectors = NULL;
 
drivers/net/idpf/idpf_ethdev.h +26 -0
index 811240c386..8d0804f603 100644
@@ -48,6 +48,20 @@
 #define IDPF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IDPF_VLAN_TAG_SIZE * 2)
 
+#define IDPF_RSS_OFFLOAD_ALL (				\
+		RTE_ETH_RSS_IPV4                |	\
+		RTE_ETH_RSS_FRAG_IPV4           |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_TCP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_UDP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_SCTP   |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_OTHER  |	\
+		RTE_ETH_RSS_IPV6                |	\
+		RTE_ETH_RSS_FRAG_IPV6           |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_TCP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_UDP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_SCTP   |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_OTHER)
+
 #define IDPF_ADAPTER_NAME_LEN	(PCI_PRI_STR_SIZE + 1)
 
 /* Message type read in virtual channel from PF */
@@ -90,11 +104,20 @@ struct idpf_vport {
 	uint16_t max_mtu;
 	uint8_t default_mac_addr[VIRTCHNL_ETH_LENGTH_OF_ADDRESS];
 
+	enum virtchnl_rss_algorithm rss_algorithm;
+	uint16_t rss_key_size;
+	uint16_t rss_lut_size;
+
 	uint16_t sw_idx; /* SW idx */
 
 	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t max_pkt_len; /* Maximum packet length */
 
+	/* RSS info */
+	uint32_t *rss_lut;
+	uint8_t *rss_key;
+	uint64_t rss_hf;
+
 	/* MSIX info*/
 	struct virtchnl2_queue_vector *qv_map; /* queue vector mapping */
 	uint16_t max_vectors;
@@ -200,6 +223,9 @@ int idpf_get_pkt_type(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct idpf_adapter *adapter);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
+int idpf_vc_set_rss_key(struct idpf_vport *vport);
+int idpf_vc_set_rss_lut(struct idpf_vport *vport);
+int idpf_vc_set_rss_hash(struct idpf_vport *vport);
 int idpf_vc_config_rxqs(struct idpf_vport *vport);
 int idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id);
 int idpf_vc_config_txqs(struct idpf_vport *vport);
drivers/net/idpf/idpf_vchnl.c +113 -0

131 lines not on this page · raw message

Signature · 1 line
2.26.2
#145 lore raw

PATCH v15 15/18 net/idpf: add support for Rx offloading

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add Rx offloading support:
- support CHKSUM and RSS offload for split queue model
- support CHKSUM offload for single queue model

---
 doc/guides/nics/features/idpf.ini |   5 ++
 drivers/net/idpf/idpf_ethdev.c    |   6 ++
 drivers/net/idpf/idpf_rxtx.c      | 123 ++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_vchnl.c     |  18 +++++
 4 files changed, 152 insertions(+)
doc/guides/nics/features/idpf.ini +5 -0
index d722c49fde..868571654f 100644
@@ -3,8 +3,13 @@
 ;
 ; Refer to default.ini for the full list of available PMD features.
 ;
+; A feature with "P" indicates only be supported when non-vector path
+; is selected.
+;
 [Features]
 MTU update           = Y
+L3 checksum offload  = P
+L4 checksum offload  = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/idpf/idpf_ethdev.c +6 -0
index 58560ea404..a09f104425 100644
@@ -61,6 +61,12 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->flow_type_rss_offloads = IDPF_RSS_OFFLOAD_ALL;
 
+	dev_info->rx_offload_capa =
+		RTE_ETH_RX_OFFLOAD_IPV4_CKSUM           |
+		RTE_ETH_RX_OFFLOAD_UDP_CKSUM            |
+		RTE_ETH_RX_OFFLOAD_TCP_CKSUM            |
+		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+
 	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
drivers/net/idpf/idpf_rxtx.c +123 -0

171 lines not on this page · raw message

drivers/net/idpf/idpf_vchnl.c +18 -0
index 9f72ae6264..495ee401c1 100644
@@ -528,6 +528,24 @@ idpf_vc_get_caps(struct idpf_adapter *adapter)
 
 	memset(&caps_msg, 0, sizeof(struct virtchnl2_get_capabilities));
 
+	caps_msg.csum_caps =
+		VIRTCHNL2_CAP_TX_CSUM_L3_IPV4          |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_TCP      |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_UDP      |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_SCTP     |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_TCP      |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_UDP      |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP     |
+		VIRTCHNL2_CAP_TX_CSUM_GENERIC          |
+		VIRTCHNL2_CAP_RX_CSUM_L3_IPV4          |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP      |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_UDP      |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_SCTP     |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP      |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP      |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_SCTP     |
+		VIRTCHNL2_CAP_RX_CSUM_GENERIC;
+
 	caps_msg.rss_caps =
 		VIRTCHNL2_CAP_RSS_IPV4_TCP             |
 		VIRTCHNL2_CAP_RSS_IPV4_UDP             |
Signature · 1 line
2.26.2
#146 lore raw

PATCH v15 16/18 net/idpf: add support for Tx offloading

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add Tx offloading support:
- support TSO for single queue model and split queue model.

---
 doc/guides/nics/features/idpf.ini |   1 +
 drivers/net/idpf/idpf_ethdev.c    |   4 +-
 drivers/net/idpf/idpf_rxtx.c      | 128 +++++++++++++++++++++++++++++-
 drivers/net/idpf/idpf_rxtx.h      |  22 +++++
 4 files changed, 152 insertions(+), 3 deletions(-)
doc/guides/nics/features/idpf.ini +1 -0
index 868571654f..d82b4aa0ff 100644
@@ -8,6 +8,7 @@
 ;
 [Features]
 MTU update           = Y
+TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
 Linux                = Y
drivers/net/idpf/idpf_ethdev.c +3 -1
index a09f104425..084426260c 100644
@@ -67,7 +67,9 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM            |
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
 
-	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+	dev_info->tx_offload_capa =
+		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
drivers/net/idpf/idpf_rxtx.c +126 -2

199 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +22 -0
index 3853ed55c9..54d297aac6 100644
@@ -23,6 +23,16 @@
 
 #define IDPF_TX_MAX_MTU_SEG	10
 
+#define IDPF_MIN_TSO_MSS	88
+#define IDPF_MAX_TSO_MSS	9728
+#define IDPF_MAX_TSO_FRAME_SIZE	262143
+#define IDPF_TX_MAX_MTU_SEG     10
+
+#define IDPF_TX_OFFLOAD_MASK RTE_MBUF_F_TX_TCP_SEG
+
+#define IDPF_TX_OFFLOAD_NOTSUP_MASK \
+		(RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK)
+
 #define IDPF_GET_PTYPE_SIZE(p) \
 	(sizeof(struct virtchnl2_ptype) + \
 	(((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0])))
@@ -115,6 +125,18 @@ struct idpf_tx_queue {
 	struct idpf_tx_queue *complq;
 };
 
+/* Offload features */
+union idpf_tx_offload {
+	uint64_t data;
+	struct {
+		uint64_t l2_len:7; /* L2 (MAC) Header Length. */
+		uint64_t l3_len:9; /* L3 (IP) Header Length. */
+		uint64_t l4_len:8; /* L4 Header Length. */
+		uint64_t tso_segsz:16; /* TCP TSO segment size */
+		/* uint64_t unused : 24; */
+	};
+};
+
 struct idpf_rxq_ops {
 	void (*release_mbufs)(struct idpf_rx_queue *rxq);
 };
Signature · 1 line
2.26.2
#147 lore raw

PATCH v15 17/18 net/idpf: add AVX512 data path for single queue model

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support of AVX512 vector data path for single queue model.

---
 doc/guides/nics/idpf.rst                |  19 +
 drivers/net/idpf/idpf_ethdev.c          |   3 +-
 drivers/net/idpf/idpf_ethdev.h          |   5 +
 drivers/net/idpf/idpf_rxtx.c            | 145 ++++
 drivers/net/idpf/idpf_rxtx.h            |  21 +
 drivers/net/idpf/idpf_rxtx_vec_avx512.c | 871 ++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx_vec_common.h | 100 +++
 drivers/net/idpf/meson.build            |  28 +
 8 files changed, 1191 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
doc/guides/nics/idpf.rst +19 -0
index c1001d5d0c..3039c61748 100644
@@ -64,3 +64,22 @@ Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and
 for details.
 
 
+Features
+--------
+
+Vector PMD
+~~~~~~~~~~
+
+Vector path for RX and TX path are selected automatically. The paths
+are chosen based on 2 conditions.
+
+- ``CPU``
+  On the X86 platform, the driver checks if the CPU supports AVX512.
+  If the CPU supports AVX512 and EAL argument ``--force-max-simd-bitwidth``
+  is set to 512, AVX512 paths will be chosen.
+
+- ``Offload features``
+  The supported HW offload features are described in the document idpf.ini,
+  A value "P" means the offload feature is not supported by vector path.
+  If any not supported features are used, idpf vector PMD is disabled and the
+  scalar paths are chosen.
drivers/net/idpf/idpf_ethdev.c +2 -1
index 084426260c..cd4ebcc2c6 100644
@@ -69,7 +69,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
-		RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS		|
+		RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
drivers/net/idpf/idpf_ethdev.h +5 -0
index 8d0804f603..7d54e5db60 100644
@@ -162,6 +162,11 @@ struct idpf_adapter {
 	uint32_t max_txq_per_msg;
 
 	uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned;
+
+	bool rx_vec_allowed;
+	bool tx_vec_allowed;
+	bool rx_use_avx512;
+	bool tx_use_avx512;
 };
 
 TAILQ_HEAD(idpf_adapter_list, idpf_adapter);
drivers/net/idpf/idpf_rxtx.c +145 -0

185 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +21 -0
index 54d297aac6..506bf8a57d 100644
@@ -18,6 +18,12 @@
 #define IDPF_RX_MAX_BURST		32
 #define IDPF_DEFAULT_RX_FREE_THRESH	32
 
+/* used for Vector PMD */
+#define IDPF_VPMD_RX_MAX_BURST	32
+#define IDPF_VPMD_TX_MAX_BURST	32
+#define IDPF_VPMD_DESCS_PER_LOOP	4
+#define IDPF_RXQ_REARM_THRESH	64
+
 #define IDPF_DEFAULT_TX_RS_THRESH	32
 #define IDPF_DEFAULT_TX_FREE_THRESH	32
 
@@ -54,6 +60,11 @@ struct idpf_rx_queue {
 	struct rte_mbuf *pkt_last_seg;  /* last segment of current packet */
 	struct rte_mbuf fake_mbuf;      /* dummy mbuf */
 
+	/* used for VPMD */
+	uint16_t rxrearm_nb;       /* number of remaining to be re-armed */
+	uint16_t rxrearm_start;    /* the idx we start the re-arming from */
+	uint64_t mbuf_initializer; /* value to init mbufs */
+
 	uint16_t rx_nb_avail;
 	uint16_t rx_next_avail;
 
@@ -84,6 +95,10 @@ struct idpf_tx_entry {
 	uint16_t last_id;
 };
 
+struct idpf_tx_vec_entry {
+	struct rte_mbuf *mbuf;
+};
+
 /* Structure associated with each TX queue. */
 struct idpf_tx_queue {
 	const struct rte_memzone *mz;		/* memzone for Tx ring */
@@ -149,6 +164,7 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
+int idpf_singleq_tx_vec_setup_avx512(struct idpf_tx_queue *txq);
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
@@ -157,16 +173,21 @@ void idpf_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
+int idpf_singleq_rx_vec_setup(struct idpf_rx_queue *rxq);
 int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts);
+uint16_t idpf_singleq_recv_pkts_avx512(void *rx_queue, struct rte_mbuf **rx_pkts,
+				       uint16_t nb_pkts);
 uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			       uint16_t nb_pkts);
 uint16_t idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				uint16_t nb_pkts);
+uint16_t idpf_singleq_xmit_pkts_avx512(void *tx_queue, struct rte_mbuf **tx_pkts,
+				       uint16_t nb_pkts);
 uint16_t idpf_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			       uint16_t nb_pkts);
 uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
drivers/net/idpf/idpf_rxtx_vec_avx512.c new file +871 -0

871 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx_vec_common.h new file +100 -0

100 lines not on this page · raw message

drivers/net/idpf/meson.build +28 -0
index b632b76656..da99c098ab 100644
@@ -14,3 +14,31 @@ sources = files(
     'idpf_rxtx.c',
     'idpf_vchnl.c',
 )
+
+if arch_subdir == 'x86'
+    idpf_avx512_cpu_support = (
+        cc.get_define('__AVX512F__', args: machine_args) != '' and
+        cc.get_define('__AVX512BW__', args: machine_args) != ''
+    )
+
+    idpf_avx512_cc_support = (
+        not machine_args.contains('-mno-avx512f') and
+        cc.has_argument('-mavx512f') and
+        cc.has_argument('-mavx512bw')
+    )
+
+    if idpf_avx512_cpu_support == true or idpf_avx512_cc_support == true
+        cflags += ['-DCC_AVX512_SUPPORT']
+        avx512_args = [cflags, '-mavx512f', '-mavx512bw']
+        if cc.has_argument('-march=skylake-avx512')
+            avx512_args += '-march=skylake-avx512'
+        endif
+        idpf_avx512_lib = static_library('idpf_avx512_lib',
+            'idpf_rxtx_vec_avx512.c',
+            dependencies: [static_rte_common_idpf, static_rte_ethdev, static_rte_bus_pci,
+            static_rte_kvargs, static_rte_hash],
+            include_directories: includes,
+            c_args: avx512_args)
+        objs += idpf_avx512_lib.extract_objects('idpf_rxtx_vec_avx512.c')
+    endif
+endif
Signature · 1 line
2.26.2
#148 lore raw

PATCH v15 18/18 net/idpf: add support for timestamp offload

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for timestamp offload.

---
 doc/guides/nics/features/idpf.ini |  1 +
 drivers/net/idpf/idpf_ethdev.c    |  5 +-
 drivers/net/idpf/idpf_ethdev.h    |  3 ++
 drivers/net/idpf/idpf_rxtx.c      | 65 ++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h      | 90 +++++++++++++++++++++++++++++++
 5 files changed, 163 insertions(+), 1 deletion(-)
doc/guides/nics/features/idpf.ini +1 -0
index d82b4aa0ff..099fd7f216 100644
@@ -11,6 +11,7 @@ MTU update           = Y
 TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
+Timestamp offload    = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/idpf/idpf_ethdev.c +4 -1
index cd4ebcc2c6..50aac65daf 100644
@@ -22,6 +22,8 @@ rte_spinlock_t idpf_adapter_lock;
 struct idpf_adapter_list idpf_adapter_list;
 bool idpf_adapter_list_init;
 
+uint64_t idpf_timestamp_dynflag;
+
 static const char * const idpf_valid_args[] = {
 	IDPF_TX_SINGLE_Q,
 	IDPF_RX_SINGLE_Q,
@@ -65,7 +67,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_RX_OFFLOAD_IPV4_CKSUM           |
 		RTE_ETH_RX_OFFLOAD_UDP_CKSUM            |
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM            |
-		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM     |
+		RTE_ETH_RX_OFFLOAD_TIMESTAMP;
 
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
drivers/net/idpf/idpf_ethdev.h +3 -0
index 7d54e5db60..ccdf4abe40 100644
@@ -167,6 +167,9 @@ struct idpf_adapter {
 	bool tx_vec_allowed;
 	bool rx_use_avx512;
 	bool tx_use_avx512;
+
+	/* For PTP */
+	uint64_t time_hw;
 };
 
 TAILQ_HEAD(idpf_adapter_list, idpf_adapter);
drivers/net/idpf/idpf_rxtx.c +65 -0

140 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +90 -0

106 lines not on this page · raw message

Signature · 1 line
2.26.2
#149 lore raw
In reply to [email protected]
Quoted 38 lines · On 10/29/22 06:27, [email protected] wrote:

From: Beilei Xing <[email protected]>

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452). The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation. Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

v11:
- move shared code to common/idpf/base
- Create one vport if there's no vport devargs
- Refactor if conditions according to coding style
- Refactor virtual channel return values
- Refine dev_stop function
- Refine RSS lut/key
- Fix build error

v12:
- Refine dev_configure
- Fix coding style according to the comments
- Re-order patch
- Romove dev_supported_ptypes_get

v13:
- refine dev_start/stop and queue_start/stop
- fix timestamp offload

Quoted 8 lines

v14:
- fix wrong position for rte_validate_tx_offload

v15:
- refine the return value for ethdev ops.
- removce forward static declarations.
- refine get caps.
- fix lock/unlock handling.

Applied to dpdk-next-net/main, thanks.

I've a number of concerns:
* conditional compilation IDPF_RX_PTYPE_OFFLOAD in [PATCH v15 17/18]
net/idpf: add AVX512 data path for single queue model
* the same prefix used for functions in common/idpf/base and net/idpf
drivers
* common/idpf/base uses own defines for negative errno (defined as a
number with corresponding errno in a comment). Strictly speaking it is not the same, but work fine in a majority of cases

So, final decision will be done by Thomas on pulling to main tree.

#150 lore raw
Quoted 63 lines

-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Saturday, October 29, 2022 10:48 PM
To: Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>
Subject: Re: [PATCH v15 00/18] add support for idpf PMD in DPDK

Quoted 3 lines · On 10/29/22 06:27, [email protected] wrote:

From: Beilei Xing <[email protected]>

This patchset introduced the idpf (Infrastructure Data Path Function) PMD

in DPDK for Intel® IPU E2000 (Device ID: 0x1452).

Quoted 1 line

The Intel® IPU E2000 targets to deliver high performance under real

workloads with security and isolation.

Quoted 2 lines

Please refer to
https://www.intel.com/content/www/us/en/products/network-

io/infrastruc

Quoted 4 lines

ture-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to

https://patchwork.ozlabs.org/project/intel-wired-
lan/patch/[email protected]/.

Quoted 29 lines

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

v11:
- move shared code to common/idpf/base
- Create one vport if there's no vport devargs
- Refactor if conditions according to coding style
- Refactor virtual channel return values
- Refine dev_stop function
- Refine RSS lut/key
- Fix build error

v12:
- Refine dev_configure
- Fix coding style according to the comments
- Re-order patch
- Romove dev_supported_ptypes_get

v13:
- refine dev_start/stop and queue_start/stop
- fix timestamp offload

Quoted 8 lines

v14:
- fix wrong position for rte_validate_tx_offload

v15:
- refine the return value for ethdev ops.
- removce forward static declarations.
- refine get caps.
- fix lock/unlock handling.

Quoted 4 lines

Applied to dpdk-next-net/main, thanks.

I've a number of concerns:
* conditional compilation IDPF_RX_PTYPE_OFFLOAD in [PATCH v15 17/18]

Will remove the conditional compilation

Quoted 3 lines

net/idpf: add AVX512 data path for single queue model
* the same prefix used for functions in common/idpf/base and net/idpf
drivers

I think the name of PMD and common library can be the same, right?

Quoted 3 lines

* common/idpf/base uses own defines for negative errno (defined as a
number with corresponding errno in a comment). Strictly speaking it is not the same, but work fine in a majority of cases

Make sense, will remove the own defines.
Thanks for your review, I saw the status in patchwork has been accepted, but didn't see idpf in dpdk-next-net, will send v16 to address the comments first.

Quoted 2 lines

So, final decision will be done by Thomas on pulling to main tree.

#151 lore raw

v16 cover add support for idpf PMD in DPDK

In reply to [email protected]

From: Beilei Xing <[email protected]>

This patchset introduced the idpf (Infrastructure Data Path Function) PMD in DPDK for Intel® IPU E2000 (Device ID: 0x1452). The Intel® IPU E2000 targets to deliver high performance under real workloads with security and isolation. Please refer to
https://www.intel.com/content/www/us/en/products/network-io/infrastructure-processing-units/asic/e2000-asic.html
for more information.

Linux upstream is still ongoing, previous work refers to https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/.

v2-v4:
fixed some coding style issues and did some refactors.

v5:
fixed typo.

v6-v9:
fixed build errors and coding style issues.

v11:
- move shared code to common/idpf/base
- Create one vport if there's no vport devargs
- Refactor if conditions according to coding style
- Refactor virtual channel return values
- Refine dev_stop function
- Refine RSS lut/key
- Fix build error

v12:
- Refine dev_configure
- Fix coding style according to the comments
- Re-order patch
- Romove dev_supported_ptypes_get

v13:
- refine dev_start/stop and queue_start/stop
- fix timestamp offload

v14:
- fix wrong position for rte_validate_tx_offload

v15:
- refine the return value for ethdev ops.
- removce forward static declarations.
- refine get caps.
- fix lock/unlock handling.

v16:
- refine errno in shared code
- remove the conditional compilation IDPF_RX_PTYPE_OFFLOAD

Junfeng Guo (18):
common/idpf: introduce common library
net/idpf: add support for device initialization net/idpf: add Tx queue setup
net/idpf: add Rx queue setup
net/idpf: add support for device start and stop net/idpf: add support for queue start
net/idpf: add support for queue stop
net/idpf: add queue release
net/idpf: add support for MTU configuration net/idpf: add support for basic Rx datapath net/idpf: add support for basic Tx datapath net/idpf: support parsing packet type
net/idpf: add support for write back based on ITR expire net/idpf: add support for RSS
net/idpf: add support for Rx offloading net/idpf: add support for Tx offloading net/idpf: add AVX512 data path for single queue model net/idpf: add support for timestamp offload

 MAINTAINERS                                   |    9 +
 doc/guides/nics/features/idpf.ini             |   17 +
 doc/guides/nics/idpf.rst                      |   85 +
 doc/guides/nics/index.rst                     |    1 +
 doc/guides/rel_notes/release_22_11.rst        |    6 +
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  207 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 drivers/net/idpf/idpf_ethdev.c                | 1293 ++++++++
 drivers/net/idpf/idpf_ethdev.h                |  252 ++
 drivers/net/idpf/idpf_logs.h                  |   56 +
 drivers/net/idpf/idpf_rxtx.c                  | 2308 +++++++++++++
 drivers/net/idpf/idpf_rxtx.h                  |  291 ++
 drivers/net/idpf/idpf_rxtx_vec_avx512.c       |  871 +++++
 drivers/net/idpf/idpf_rxtx_vec_common.h       |  100 +
 drivers/net/idpf/idpf_vchnl.c                 | 1416 ++++++++
 drivers/net/idpf/meson.build                  |   44 +
 drivers/net/idpf/version.map                  |    3 +
 drivers/net/meson.build                       |    1 +
 38 files changed, 15228 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_avx512.c
 create mode 100644 drivers/net/idpf/idpf_rxtx_vec_common.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
Signature · 1 line
2.26.2
#152 lore raw

PATCH v16 1/18 common/idpf: introduce common library

From: Junfeng Guo <[email protected]>

Introduce common library for IDPF (Infrastructure Data Path Function) PMD.
Add base code and OS specific implementation first.

---
 drivers/common/idpf/base/idpf_alloc.h         |   22 +
 drivers/common/idpf/base/idpf_common.c        |  364 +++
 drivers/common/idpf/base/idpf_controlq.c      |  691 ++++
 drivers/common/idpf/base/idpf_controlq.h      |  224 ++
 drivers/common/idpf/base/idpf_controlq_api.h  |  207 ++
 .../common/idpf/base/idpf_controlq_setup.c    |  179 +
 drivers/common/idpf/base/idpf_devids.h        |   18 +
 drivers/common/idpf/base/idpf_lan_pf_regs.h   |  134 +
 drivers/common/idpf/base/idpf_lan_txrx.h      |  428 +++
 drivers/common/idpf/base/idpf_lan_vf_regs.h   |  114 +
 drivers/common/idpf/base/idpf_osdep.h         |  364 +++
 drivers/common/idpf/base/idpf_prototype.h     |   45 +
 drivers/common/idpf/base/idpf_type.h          |  106 +
 drivers/common/idpf/base/meson.build          |   14 +
 drivers/common/idpf/base/siov_regs.h          |   47 +
 drivers/common/idpf/base/virtchnl.h           | 2866 +++++++++++++++++
 drivers/common/idpf/base/virtchnl2.h          | 1462 +++++++++
 drivers/common/idpf/base/virtchnl2_lan_desc.h |  606 ++++
 .../common/idpf/base/virtchnl_inline_ipsec.h  |  567 ++++
 drivers/common/idpf/meson.build               |    4 +
 drivers/common/idpf/version.map               |   12 +
 drivers/common/meson.build                    |    1 +
 22 files changed, 8475 insertions(+)
 create mode 100644 drivers/common/idpf/base/idpf_alloc.h
 create mode 100644 drivers/common/idpf/base/idpf_common.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.c
 create mode 100644 drivers/common/idpf/base/idpf_controlq.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_api.h
 create mode 100644 drivers/common/idpf/base/idpf_controlq_setup.c
 create mode 100644 drivers/common/idpf/base/idpf_devids.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_pf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_txrx.h
 create mode 100644 drivers/common/idpf/base/idpf_lan_vf_regs.h
 create mode 100644 drivers/common/idpf/base/idpf_osdep.h
 create mode 100644 drivers/common/idpf/base/idpf_prototype.h
 create mode 100644 drivers/common/idpf/base/idpf_type.h
 create mode 100644 drivers/common/idpf/base/meson.build
 create mode 100644 drivers/common/idpf/base/siov_regs.h
 create mode 100644 drivers/common/idpf/base/virtchnl.h
 create mode 100644 drivers/common/idpf/base/virtchnl2.h
 create mode 100644 drivers/common/idpf/base/virtchnl2_lan_desc.h
 create mode 100644 drivers/common/idpf/base/virtchnl_inline_ipsec.h
 create mode 100644 drivers/common/idpf/meson.build
 create mode 100644 drivers/common/idpf/version.map
drivers/common/idpf/base/idpf_alloc.h new file +22 -0
new file mode 100644
index 0000000000..bc054851b3
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_ALLOC_H_
+#define _IDPF_ALLOC_H_
+
+/* Memory types */
+enum idpf_memset_type {
+	IDPF_NONDMA_MEM = 0,
+	IDPF_DMA_MEM
+};
+
+/* Memcpy types */
+enum idpf_memcpy_type {
+	IDPF_NONDMA_TO_NONDMA = 0,
+	IDPF_NONDMA_TO_DMA,
+	IDPF_DMA_TO_DMA,
+	IDPF_DMA_TO_NONDMA
+};
+
+#endif /* _IDPF_ALLOC_H_ */
drivers/common/idpf/base/idpf_common.c new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.c new file +691 -0

691 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq.h new file +224 -0

224 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_api.h new file +207 -0

207 lines not on this page · raw message

drivers/common/idpf/base/idpf_controlq_setup.c new file +179 -0

179 lines not on this page · raw message

drivers/common/idpf/base/idpf_devids.h new file +18 -0
new file mode 100644
index 0000000000..a91eb4e02a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2001-2022 Intel Corporation
+ */
+
+#ifndef _IDPF_DEVIDS_H_
+#define _IDPF_DEVIDS_H_
+
+/* Vendor ID */
+#define IDPF_INTEL_VENDOR_ID		0x8086
+
+/* Device IDs */
+#define IDPF_DEV_ID_PF			0x1452
+#define IDPF_DEV_ID_VF			0x1889
+
+
+
+
+#endif /* _IDPF_DEVIDS_H_ */
drivers/common/idpf/base/idpf_lan_pf_regs.h new file +134 -0

134 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_txrx.h new file +428 -0

428 lines not on this page · raw message

drivers/common/idpf/base/idpf_lan_vf_regs.h new file +114 -0

114 lines not on this page · raw message

drivers/common/idpf/base/idpf_osdep.h new file +364 -0

364 lines not on this page · raw message

drivers/common/idpf/base/idpf_prototype.h new file +45 -0

45 lines not on this page · raw message

drivers/common/idpf/base/idpf_type.h new file +106 -0

106 lines not on this page · raw message

drivers/common/idpf/base/meson.build new file +14 -0
new file mode 100644
index 0000000000..ce2b5346e4
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+sources = files(
+        'idpf_common.c',
+        'idpf_controlq.c',
+        'idpf_controlq_setup.c',
+)
+
+cflags += ['-Wno-unused-value']
+cflags += ['-Wno-unused-variable']
+cflags += ['-Wno-unused-parameter']
+cflags += ['-Wno-implicit-fallthrough']
+cflags += ['-Wno-strict-aliasing']
\ No newline at end of file
drivers/common/idpf/base/siov_regs.h new file +47 -0

47 lines not on this page · raw message

drivers/common/idpf/base/virtchnl.h new file +2866 -0

42 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2.h new file +1462 -0

1,462 lines not on this page · raw message

drivers/common/idpf/base/virtchnl2_lan_desc.h new file +606 -0

606 lines not on this page · raw message

drivers/common/idpf/base/virtchnl_inline_ipsec.h new file +567 -0

567 lines not on this page · raw message

drivers/common/idpf/meson.build new file +4 -0
new file mode 100644
index 0000000000..26881166e9

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

drivers/common/idpf/version.map new file +12 -0
new file mode 100644
index 0000000000..bfb246c752

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

drivers/common/meson.build +1 -0
index ea261dd70a..b63d899d50 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.26.2

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

#153 lore raw

PATCH v16 2/18 net/idpf: add support for device initialization

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Support device init and add the following dev ops:
- dev_configure
- dev_close
- dev_infos_get

---
 MAINTAINERS                            |   9 +
 doc/guides/nics/features/idpf.ini      |   9 +
 doc/guides/nics/idpf.rst               |  66 ++
 doc/guides/nics/index.rst              |   1 +
 doc/guides/rel_notes/release_22_11.rst |   6 +
 drivers/net/idpf/idpf_ethdev.c         | 891 +++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h         | 189 ++++++
 drivers/net/idpf/idpf_logs.h           |  56 ++
 drivers/net/idpf/idpf_vchnl.c          | 416 ++++++++++++
 drivers/net/idpf/meson.build           |  15 +
 drivers/net/idpf/version.map           |   3 +
 drivers/net/meson.build                |   1 +
 12 files changed, 1662 insertions(+)
 create mode 100644 doc/guides/nics/features/idpf.ini
 create mode 100644 doc/guides/nics/idpf.rst
 create mode 100644 drivers/net/idpf/idpf_ethdev.c
 create mode 100644 drivers/net/idpf/idpf_ethdev.h
 create mode 100644 drivers/net/idpf/idpf_logs.h
 create mode 100644 drivers/net/idpf/idpf_vchnl.c
 create mode 100644 drivers/net/idpf/meson.build
 create mode 100644 drivers/net/idpf/version.map
MAINTAINERS +9 -0
index bdf233c9f8..cc66db25e8 100644
@@ -770,6 +770,15 @@ F: drivers/net/ice/
 F: doc/guides/nics/ice.rst
 F: doc/guides/nics/features/ice.ini
 
+Intel idpf
+M: Jingjing Wu <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/idpf/
+F: drivers/common/idpf/
+F: doc/guides/nics/idpf.rst
+F: doc/guides/nics/features/idpf.ini
+
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/features/idpf.ini new file +9 -0
new file mode 100644
index 0000000000..46aab2eb61
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'idpf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+x86-32               = Y
+x86-64               = Y
doc/guides/nics/idpf.rst new file +66 -0

66 lines not on this page · raw message

doc/guides/nics/index.rst +1 -0
index 4d40ea29a3..12841ce407 100644
@@ -34,6 +34,7 @@ Network Interface Controller Drivers
     hns3
     i40e
     ice
+    idpf
     igb
     igc
     ionic
doc/guides/rel_notes/release_22_11.rst +6 -0
index 28812e092f..77674f2b06 100644
@@ -158,6 +158,12 @@ New Features
 
   * Added protocol based buffer split support in scalar path.
 
+* **Added IDPF PMD [*EXPERIMENTAL*].**
+
+  Added the new ``idpf`` net driver for Intel® Infrastructure Processing Unit
+  (Intel® IPU) E2000.
+  See the :doc:`../nics/idpf` NIC guide for more details on this new driver.
+
 * **Updated Marvell cnxk driver.**
 
   * Added support for flow action REPRESENTED_PORT.
drivers/net/idpf/idpf_ethdev.c new file +891 -0

891 lines not on this page · raw message

drivers/net/idpf/idpf_ethdev.h new file +189 -0

189 lines not on this page · raw message

drivers/net/idpf/idpf_logs.h new file +56 -0

56 lines not on this page · raw message

drivers/net/idpf/idpf_vchnl.c new file +416 -0

416 lines not on this page · raw message

drivers/net/idpf/meson.build new file +15 -0
new file mode 100644
index 0000000000..ecf73355c3
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2022 Intel Corporation
+
+if is_windows
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
+endif
+
+deps += ['common_idpf']
+
+sources = files(
+    'idpf_ethdev.c',
+    'idpf_vchnl.c',
+)
drivers/net/idpf/version.map new file +3 -0
new file mode 100644
index 0000000000..78c3585d7c
@@ -0,0 +1,3 @@
+DPDK_23 {
+	local: *;
+};
drivers/net/meson.build +1 -0
index 589399400a..6470bf3636 100644
@@ -29,6 +29,7 @@ drivers = [
         'i40e',
         'iavf',
         'ice',
+        'idpf',
         'igc',
         'ionic',
         'ipn3ke',
Signature · 1 line
2.26.2
#154 lore raw

PATCH v16 3/18 net/idpf: add Tx queue setup

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for tx_queue_setup ops.

In the single queue model, the same descriptor queue is used by SW to post buffer descriptors to HW and by HW to post completed descriptors to SW.

In the split queue model, "RX buffer queues" are used to pass descriptor buffers from SW to HW while Rx queues are used only to pass the descriptor completions, that is, descriptors that point to completed buffers, from HW to SW. This is contrary to the single queue model in which Rx queues are used for both purposes.

---
 drivers/net/idpf/idpf_ethdev.c |  13 ++
 drivers/net/idpf/idpf_rxtx.c   | 364 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  70 +++++++
 drivers/net/idpf/meson.build   |   1 +
 4 files changed, 448 insertions(+)
 create mode 100644 drivers/net/idpf/idpf_rxtx.c
 create mode 100644 drivers/net/idpf/idpf_rxtx.h
drivers/net/idpf/idpf_ethdev.c +13 -0
index 035f563275..54f20d30ca 100644
@@ -11,6 +11,7 @@
 #include <errno.h>
 
 #include "idpf_ethdev.h"
+#include "idpf_rxtx.h"
 
 #define IDPF_TX_SINGLE_Q	"tx_single"
 #define IDPF_RX_SINGLE_Q	"rx_single"
@@ -42,6 +43,17 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = IDPF_MAX_RING_DESC,
+		.nb_min = IDPF_MIN_RING_DESC,
+		.nb_align = IDPF_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -631,6 +643,7 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_configure			= idpf_dev_configure,
 	.dev_close			= idpf_dev_close,
+	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
 };
 
drivers/net/idpf/idpf_rxtx.c new file +364 -0

364 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h new file +70 -0

70 lines not on this page · raw message

drivers/net/idpf/meson.build +1 -0
index ecf73355c3..b632b76656 100644
@@ -11,5 +11,6 @@ deps += ['common_idpf']
 
 sources = files(
     'idpf_ethdev.c',
+    'idpf_rxtx.c',
     'idpf_vchnl.c',
 )
Signature · 1 line
2.26.2
#155 lore raw

PATCH v16 4/18 net/idpf: add Rx queue setup

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for rx_queue_setup ops.

---
 drivers/net/idpf/idpf_ethdev.c |  11 +
 drivers/net/idpf/idpf_rxtx.c   | 400 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  46 ++++
 3 files changed, 457 insertions(+)
drivers/net/idpf/idpf_ethdev.c +11 -0
index 54f20d30ca..fb5cd1b111 100644
@@ -48,12 +48,22 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
 	};
 
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_free_thresh = IDPF_DEFAULT_RX_FREE_THRESH,
+	};
+
 	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
 		.nb_max = IDPF_MAX_RING_DESC,
 		.nb_min = IDPF_MIN_RING_DESC,
 		.nb_align = IDPF_ALIGN_RING_DESC,
 	};
 
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = IDPF_MAX_RING_DESC,
+		.nb_min = IDPF_MIN_RING_DESC,
+		.nb_align = IDPF_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -643,6 +653,7 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_configure			= idpf_dev_configure,
 	.dev_close			= idpf_dev_close,
+	.rx_queue_setup			= idpf_rx_queue_setup,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
 };
drivers/net/idpf/idpf_rxtx.c +400 -0

418 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +46 -0

61 lines not on this page · raw message

Signature · 1 line
2.26.2
#156 lore raw

PATCH v16 5/18 net/idpf: add support for device start and stop

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add dev ops dev_start, dev_stop and link_update.

---
 drivers/net/idpf/idpf_ethdev.c | 55 ++++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.c   | 20 +++++++++++++
 2 files changed, 75 insertions(+)
drivers/net/idpf/idpf_ethdev.c +55 -0
index fb5cd1b111..621bf9aad5 100644
@@ -29,6 +29,22 @@ static const char * const idpf_valid_args[] = {
 	NULL
 };
 
+static int
+idpf_dev_link_update(struct rte_eth_dev *dev,
+		     __rte_unused int wait_to_complete)
+{
+	struct rte_eth_link new_link;
+
+	memset(&new_link, 0, sizeof(new_link));
+
+	new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
+	new_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
+				  RTE_ETH_LINK_SPEED_FIXED);
+
+	return rte_eth_linkstatus_set(dev, &new_link);
+}
+
 static int
 idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
@@ -267,6 +283,42 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_dev_start(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	int ret;
+
+	if (dev->data->mtu > vport->max_mtu) {
+		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
+		return -EINVAL;
+	}
+
+	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
+
+	/* TODO: start queues */
+
+	ret = idpf_vc_ena_dis_vport(vport, true);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+idpf_dev_stop(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	idpf_vc_ena_dis_vport(vport, false);
+
+	/* TODO: stop queues */
+
+	return 0;
+}
+
 static int
 idpf_dev_close(struct rte_eth_dev *dev)
 {
@@ -656,6 +708,9 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.rx_queue_setup			= idpf_rx_queue_setup,
 	.tx_queue_setup			= idpf_tx_queue_setup,
 	.dev_infos_get			= idpf_dev_info_get,
+	.dev_start			= idpf_dev_start,
+	.dev_stop			= idpf_dev_stop,
+	.link_update			= idpf_dev_link_update,
 };
 
 static uint16_t
drivers/net/idpf/idpf_rxtx.c +20 -0
index 25dd5d85d5..3528d2f2c7 100644
@@ -334,6 +334,11 @@ idpf_rx_split_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_rx_thresh(nb_desc, rx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (rx_conf->rx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Setup Rx description queue */
 	rxq = rte_zmalloc_socket("idpf rxq",
 				 sizeof(struct idpf_rx_queue),
@@ -465,6 +470,11 @@ idpf_rx_single_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_rx_thresh(nb_desc, rx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (rx_conf->rx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Setup Rx description queue */
 	rxq = rte_zmalloc_socket("idpf rxq",
 				 sizeof(struct idpf_rx_queue),
@@ -569,6 +579,11 @@ idpf_tx_split_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (tx_conf->tx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("idpf split txq",
 				 sizeof(struct idpf_tx_queue),
@@ -691,6 +706,11 @@ idpf_tx_single_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
+	if (tx_conf->tx_deferred_start) {
+		PMD_INIT_LOG(ERR, "Queue start is not supported currently.");
+		return -EINVAL;
+	}
+
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("idpf txq",
 				 sizeof(struct idpf_tx_queue),
Signature · 1 line
2.26.2
#157 lore raw

PATCH v16 6/18 net/idpf: add support for queue start

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for these device ops:
- rx_queue_start
- tx_queue_start

---
 drivers/net/idpf/idpf_ethdev.c |  42 +++-
 drivers/net/idpf/idpf_ethdev.h |   9 +
 drivers/net/idpf/idpf_rxtx.c   | 237 +++++++++++++++--
 drivers/net/idpf/idpf_rxtx.h   |   6 +
 drivers/net/idpf/idpf_vchnl.c  | 447 +++++++++++++++++++++++++++++++++
 5 files changed, 720 insertions(+), 21 deletions(-)
drivers/net/idpf/idpf_ethdev.c +41 -1
index 621bf9aad5..0400ed611f 100644
@@ -283,6 +283,39 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_start_queues(struct rte_eth_dev *dev)
+{
+	struct idpf_rx_queue *rxq;
+	struct idpf_tx_queue *txq;
+	int err = 0;
+	int i;
+
+	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		txq = dev->data->tx_queues[i];
+		if (txq == NULL || txq->tx_deferred_start)
+			continue;
+		err = idpf_tx_queue_start(dev, i);
+		if (err != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start Tx queue %u", i);
+			return err;
+		}
+	}
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq == NULL || rxq->rx_deferred_start)
+			continue;
+		err = idpf_rx_queue_start(dev, i);
+		if (err != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start Rx queue %u", i);
+			return err;
+		}
+	}
+
+	return err;
+}
+
 static int
 idpf_dev_start(struct rte_eth_dev *dev)
 {
@@ -296,11 +329,16 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
 
-	/* TODO: start queues */
+	ret = idpf_start_queues(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to start queues");
+		return ret;
+	}
 
 	ret = idpf_vc_ena_dis_vport(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		/* TODO: stop queues */
 		return ret;
 	}
 
@@ -711,6 +749,8 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.dev_start			= idpf_dev_start,
 	.dev_stop			= idpf_dev_stop,
 	.link_update			= idpf_dev_link_update,
+	.rx_queue_start			= idpf_rx_queue_start,
+	.tx_queue_start			= idpf_tx_queue_start,
 };
 
 static uint16_t
drivers/net/idpf/idpf_ethdev.h +9 -0
index 84ae6641e2..96c22009e9 100644
@@ -24,7 +24,9 @@
 #define IDPF_DEFAULT_TXQ_NUM	16
 
 #define IDPF_INVALID_VPORT_IDX	0xffff
+#define IDPF_TXQ_PER_GRP	1
 #define IDPF_TX_COMPLQ_PER_GRP	1
+#define IDPF_RXQ_PER_GRP	1
 #define IDPF_RX_BUFQ_PER_GRP	2
 
 #define IDPF_CTLQ_ID		-1
@@ -182,6 +184,13 @@ int idpf_vc_check_api_version(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct idpf_adapter *adapter);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
+int idpf_vc_config_rxqs(struct idpf_vport *vport);
+int idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id);
+int idpf_vc_config_txqs(struct idpf_vport *vport);
+int idpf_vc_config_txq(struct idpf_vport *vport, uint16_t txq_id);
+int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
+		      bool rx, bool on);
+int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
drivers/net/idpf/idpf_rxtx.c +217 -20

288 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +6 -0
index 3f3932c3eb..ab9b3830fd 100644
@@ -50,6 +50,7 @@ struct idpf_rx_queue {
 
 	bool q_set;             /* if rx queue has been configured */
 	bool q_started;         /* if rx queue has been started */
+	bool rx_deferred_start; /* don't start this queue in dev start */
 
 	/* only valid for split queue mode */
 	uint8_t expected_gen_id;
@@ -95,6 +96,7 @@ struct idpf_tx_queue {
 
 	bool q_set;		/* if tx queue has been configured */
 	bool q_started;		/* if tx queue has been started */
+	bool tx_deferred_start; /* don't start this queue in dev start */
 
 	/* only valid for split queue mode */
 	uint16_t sw_nb_desc;
@@ -109,8 +111,12 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
+int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
+int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +447 -0

465 lines not on this page · raw message

Signature · 1 line
2.26.2
#158 lore raw

PATCH v16 7/18 net/idpf: add support for queue stop

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for these device ops:
- rx_queue_stop
- tx_queue_stop

---
 drivers/net/idpf/idpf_ethdev.c |  17 ++--
 drivers/net/idpf/idpf_rxtx.c   | 148 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  13 +++
 drivers/net/idpf/idpf_vchnl.c  |  69 +++++++++++++++
 4 files changed, 242 insertions(+), 5 deletions(-)
drivers/net/idpf/idpf_ethdev.c +12 -5
index 0400ed611f..9f1e1e6a18 100644
@@ -324,7 +324,8 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	if (dev->data->mtu > vport->max_mtu) {
 		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_mtu;
 	}
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
@@ -332,17 +333,21 @@ idpf_dev_start(struct rte_eth_dev *dev)
 	ret = idpf_start_queues(dev);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
-		return ret;
+		goto err_mtu;
 	}
 
 	ret = idpf_vc_ena_dis_vport(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
-		/* TODO: stop queues */
-		return ret;
+		goto err_vport;
 	}
 
 	return 0;
+
+err_vport:
+	idpf_stop_queues(dev);
+err_mtu:
+	return ret;
 }
 
 static int
@@ -352,7 +357,7 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_vc_ena_dis_vport(vport, false);
 
-	/* TODO: stop queues */
+	idpf_stop_queues(dev);
 
 	return 0;
 }
@@ -751,6 +756,8 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.link_update			= idpf_dev_link_update,
 	.rx_queue_start			= idpf_rx_queue_start,
 	.tx_queue_start			= idpf_tx_queue_start,
+	.rx_queue_stop			= idpf_rx_queue_stop,
+	.tx_queue_stop			= idpf_tx_queue_stop,
 };
 
 static uint16_t
drivers/net/idpf/idpf_rxtx.c +148 -0

187 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +13 -0
index ab9b3830fd..b959638489 100644
@@ -51,6 +51,7 @@ struct idpf_rx_queue {
 	bool q_set;             /* if rx queue has been configured */
 	bool q_started;         /* if rx queue has been started */
 	bool rx_deferred_start; /* don't start this queue in dev start */
+	const struct idpf_rxq_ops *ops;
 
 	/* only valid for split queue mode */
 	uint8_t expected_gen_id;
@@ -97,6 +98,7 @@ struct idpf_tx_queue {
 	bool q_set;		/* if tx queue has been configured */
 	bool q_started;		/* if tx queue has been started */
 	bool tx_deferred_start; /* don't start this queue in dev start */
+	const struct idpf_txq_ops *ops;
 
 	/* only valid for split queue mode */
 	uint16_t sw_nb_desc;
@@ -107,16 +109,27 @@ struct idpf_tx_queue {
 	struct idpf_tx_queue *complq;
 };
 
+struct idpf_rxq_ops {
+	void (*release_mbufs)(struct idpf_rx_queue *rxq);
+};
+
+struct idpf_txq_ops {
+	void (*release_mbufs)(struct idpf_tx_queue *txq);
+};
+
 int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_rxconf *rx_conf,
 			struct rte_mempool *mp);
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
 int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 
+void idpf_stop_queues(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +69 -0

75 lines not on this page · raw message

Signature · 1 line
2.26.2
#159 lore raw

PATCH v16 8/18 net/idpf: add queue release

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add support for queue operations:
- rx_queue_release
- tx_queue_release

---
 drivers/net/idpf/idpf_ethdev.c |  2 +
 drivers/net/idpf/idpf_rxtx.c   | 81 ++++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  3 ++
 3 files changed, 86 insertions(+)
drivers/net/idpf/idpf_ethdev.c +2 -0
index 9f1e1e6a18..1485f40e71 100644
@@ -758,6 +758,8 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.tx_queue_start			= idpf_tx_queue_start,
 	.rx_queue_stop			= idpf_rx_queue_stop,
 	.tx_queue_stop			= idpf_tx_queue_stop,
+	.rx_queue_release		= idpf_dev_rx_queue_release,
+	.tx_queue_release		= idpf_dev_tx_queue_release,
 };
 
 static uint16_t
drivers/net/idpf/idpf_rxtx.c +81 -0

117 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +3 -0
index b959638489..37944edcac 100644
@@ -124,12 +124,15 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 int idpf_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int idpf_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+void idpf_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
+
 int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 			uint16_t nb_desc, unsigned int socket_id,
 			const struct rte_eth_txconf *tx_conf);
 int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 
 void idpf_stop_queues(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.26.2
#160 lore raw

PATCH v16 9/18 net/idpf: add support for MTU configuration

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add dev ops mtu_set.

---
 doc/guides/nics/features/idpf.ini |  1 +
 drivers/net/idpf/idpf_ethdev.c    | 13 +++++++++++++
 2 files changed, 14 insertions(+)
doc/guides/nics/features/idpf.ini +1 -0
index 46aab2eb61..d722c49fde 100644
@@ -4,6 +4,7 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+MTU update           = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/idpf/idpf_ethdev.c +13 -0
index 1485f40e71..856f3d7266 100644
@@ -83,6 +83,18 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	return 0;
 }
 
+static int
+idpf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused)
+{
+	/* mtu setting is forbidden if port is start */
+	if (dev->data->dev_started) {
+		PMD_DRV_LOG(ERR, "port must be stopped before configuration");
+		return -EBUSY;
+	}
+
+	return 0;
+}
+
 static int
 idpf_init_vport_req_info(struct rte_eth_dev *dev)
 {
@@ -760,6 +772,7 @@ static const struct eth_dev_ops idpf_eth_dev_ops = {
 	.tx_queue_stop			= idpf_tx_queue_stop,
 	.rx_queue_release		= idpf_dev_rx_queue_release,
 	.tx_queue_release		= idpf_dev_tx_queue_release,
+	.mtu_set			= idpf_dev_mtu_set,
 };
 
 static uint16_t
Signature · 1 line
2.26.2
#161 lore raw

PATCH v16 10/18 net/idpf: add support for basic Rx datapath

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add basic Rx support in split queue mode and single queue mode.

---
 drivers/net/idpf/idpf_ethdev.c |   2 +
 drivers/net/idpf/idpf_rxtx.c   | 273 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |   7 +-
 3 files changed, 281 insertions(+), 1 deletion(-)
drivers/net/idpf/idpf_ethdev.c +2 -0
index 856f3d7266..2f1f9eeee5 100644
@@ -348,6 +348,8 @@ idpf_dev_start(struct rte_eth_dev *dev)
 		goto err_mtu;
 	}
 
+	idpf_set_rx_function(dev);
+
 	ret = idpf_vc_ena_dis_vport(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
drivers/net/idpf/idpf_rxtx.c +273 -0

276 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +6 -1
index 37944edcac..650c6c1c3a 100644
@@ -133,6 +133,11 @@ int idpf_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int idpf_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void idpf_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
-
+uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+				uint16_t nb_pkts);
+uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
+			       uint16_t nb_pkts);
 void idpf_stop_queues(struct rte_eth_dev *dev);
+
+void idpf_set_rx_function(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.26.2
#162 lore raw

PATCH v16 11/18 net/idpf: add support for basic Tx datapath

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add basic Tx support in split queue mode and single queue mode.

---
 drivers/net/idpf/idpf_ethdev.c |   3 +
 drivers/net/idpf/idpf_ethdev.h |   1 +
 drivers/net/idpf/idpf_rxtx.c   | 357 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_rxtx.h   |  10 +
 4 files changed, 371 insertions(+)
drivers/net/idpf/idpf_ethdev.c +3 -0
index 2f1f9eeee5..f9f6fe1162 100644
@@ -59,6 +59,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
 		.tx_rs_thresh = IDPF_DEFAULT_TX_RS_THRESH,
@@ -349,6 +351,7 @@ idpf_dev_start(struct rte_eth_dev *dev)
 	}
 
 	idpf_set_rx_function(dev);
+	idpf_set_tx_function(dev);
 
 	ret = idpf_vc_ena_dis_vport(vport, true);
 	if (ret != 0) {
drivers/net/idpf/idpf_ethdev.h +1 -0
index 96c22009e9..af0a8e2970 100644
@@ -35,6 +35,7 @@
 
 #define IDPF_MIN_BUF_SIZE	1024
 #define IDPF_MAX_FRAME_SIZE	9728
+#define IDPF_MIN_FRAME_SIZE	14
 
 #define IDPF_NUM_MACADDR_MAX	64
 
drivers/net/idpf/idpf_rxtx.c +357 -0

372 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +10 -0
index 650c6c1c3a..30dc94b3dd 100644
@@ -21,6 +21,8 @@
 #define IDPF_DEFAULT_TX_RS_THRESH	32
 #define IDPF_DEFAULT_TX_FREE_THRESH	32
 
+#define IDPF_TX_MAX_MTU_SEG	10
+
 struct idpf_rx_queue {
 	struct idpf_adapter *adapter;   /* the adapter this queue belongs to */
 	struct rte_mempool *mp;         /* mbuf pool to populate Rx ring */
@@ -137,7 +139,15 @@ uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 				uint16_t nb_pkts);
 uint16_t idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			       uint16_t nb_pkts);
+uint16_t idpf_singleq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+				uint16_t nb_pkts);
+uint16_t idpf_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			       uint16_t nb_pkts);
+uint16_t idpf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
+			uint16_t nb_pkts);
+
 void idpf_stop_queues(struct rte_eth_dev *dev);
 
 void idpf_set_rx_function(struct rte_eth_dev *dev);
+void idpf_set_tx_function(struct rte_eth_dev *dev);
 #endif /* _IDPF_RXTX_H_ */
Signature · 1 line
2.26.2
#163 lore raw

PATCH v16 12/18 net/idpf: support parsing packet type

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Parse packet type during receiving packets.

---
 drivers/net/idpf/idpf_ethdev.c |   6 +
 drivers/net/idpf/idpf_ethdev.h |   6 +
 drivers/net/idpf/idpf_rxtx.c   |  11 ++
 drivers/net/idpf/idpf_rxtx.h   |   5 +
 drivers/net/idpf/idpf_vchnl.c  | 240 +++++++++++++++++++++++++++++++++
 5 files changed, 268 insertions(+)
drivers/net/idpf/idpf_ethdev.c +6 -0
index f9f6fe1162..d0821ec3f3 100644
@@ -686,6 +686,12 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 		goto err_api;
 	}
 
+	ret = idpf_get_pkt_type(adapter);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to set ptype table");
+		goto err_api;
+	}
+
 	adapter->caps = rte_zmalloc("idpf_caps",
 				sizeof(struct virtchnl2_get_capabilities), 0);
 	if (adapter->caps == NULL) {
drivers/net/idpf/idpf_ethdev.h +6 -0
index af0a8e2970..db9af58f72 100644
@@ -39,6 +39,8 @@
 
 #define IDPF_NUM_MACADDR_MAX	64
 
+#define IDPF_MAX_PKT_TYPE	1024
+
 #define IDPF_VLAN_TAG_SIZE	4
 #define IDPF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IDPF_VLAN_TAG_SIZE * 2)
@@ -125,6 +127,8 @@ struct idpf_adapter {
 	/* Max config queue number per VC message */
 	uint32_t max_rxq_per_msg;
 	uint32_t max_txq_per_msg;
+
+	uint32_t ptype_tbl[IDPF_MAX_PKT_TYPE] __rte_cache_min_aligned;
 };
 
 TAILQ_HEAD(idpf_adapter_list, idpf_adapter);
@@ -182,6 +186,7 @@ atomic_set_cmd(struct idpf_adapter *adapter, enum virtchnl_ops ops)
 struct idpf_adapter *idpf_find_adapter(struct rte_pci_device *pci_dev);
 void idpf_handle_virtchnl_msg(struct rte_eth_dev *dev);
 int idpf_vc_check_api_version(struct idpf_adapter *adapter);
+int idpf_get_pkt_type(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct idpf_adapter *adapter);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
@@ -193,6 +198,7 @@ int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
 		      bool rx, bool on);
 int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
+int idpf_vc_query_ptype_info(struct idpf_adapter *adapter);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
 
drivers/net/idpf/idpf_rxtx.c +11 -0
index f55d2143b9..a980714060 100644
@@ -1281,6 +1281,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	volatile struct virtchnl2_rx_flex_desc_adv_nic_3 *rx_desc;
 	uint16_t pktlen_gen_bufq_id;
 	struct idpf_rx_queue *rxq;
+	const uint32_t *ptype_tbl;
 	struct rte_mbuf *rxm;
 	uint16_t rx_id_bufq1;
 	uint16_t rx_id_bufq2;
@@ -1300,6 +1301,7 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	rx_id_bufq1 = rxq->bufq1->rx_next_avail;
 	rx_id_bufq2 = rxq->bufq2->rx_next_avail;
 	rx_desc_ring = rxq->rx_ring;
+	ptype_tbl = rxq->adapter->ptype_tbl;
 
 	while (nb_rx < nb_pkts) {
 		rx_desc = &rx_desc_ring[rx_id];
@@ -1347,6 +1349,10 @@ idpf_splitq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->next = NULL;
 		rxm->nb_segs = 1;
 		rxm->port = rxq->port_id;
+		rxm->packet_type =
+			ptype_tbl[(rte_le_to_cpu_16(rx_desc->ptype_err_fflags0) &
+				   VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_M) >>
+				  VIRTCHNL2_RX_FLEX_DESC_ADV_PTYPE_S];
 
 		rx_pkts[nb_rx++] = rxm;
 	}
@@ -1533,6 +1539,7 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 	volatile union virtchnl2_rx_desc *rxdp;
 	union virtchnl2_rx_desc rxd;
 	struct idpf_rx_queue *rxq;
+	const uint32_t *ptype_tbl;
 	uint16_t rx_id, nb_hold;
 	struct rte_eth_dev *dev;
 	uint16_t rx_packet_len;
@@ -1551,6 +1558,7 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	rx_id = rxq->rx_tail;
 	rx_ring = rxq->rx_ring;
+	ptype_tbl = rxq->adapter->ptype_tbl;
 
 	while (nb_rx < nb_pkts) {
 		rxdp = &rx_ring[rx_id];
@@ -1603,6 +1611,9 @@ idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		rxm->pkt_len = rx_packet_len;
 		rxm->data_len = rx_packet_len;
 		rxm->port = rxq->port_id;
+		rxm->packet_type =
+			ptype_tbl[(uint8_t)(rte_cpu_to_le_16(rxd.flex_nic_wb.ptype_flex_flags0) &
+					    VIRTCHNL2_RX_FLEX_DESC_PTYPE_M)];
 
 		rx_pkts[nb_rx++] = rxm;
 	}
drivers/net/idpf/idpf_rxtx.h +5 -0
index 30dc94b3dd..3853ed55c9 100644
@@ -23,6 +23,10 @@
 
 #define IDPF_TX_MAX_MTU_SEG	10
 
+#define IDPF_GET_PTYPE_SIZE(p) \
+	(sizeof(struct virtchnl2_ptype) + \
+	(((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0])))
+
 struct idpf_rx_queue {
 	struct idpf_adapter *adapter;   /* the adapter this queue belongs to */
 	struct rte_mempool *mp;         /* mbuf pool to populate Rx ring */
@@ -150,4 +154,5 @@ void idpf_stop_queues(struct rte_eth_dev *dev);
 
 void idpf_set_rx_function(struct rte_eth_dev *dev);
 void idpf_set_tx_function(struct rte_eth_dev *dev);
+
 #endif /* _IDPF_RXTX_H_ */
drivers/net/idpf/idpf_vchnl.c +240 -0

255 lines not on this page · raw message

Signature · 1 line
2.26.2
#164 lore raw

PATCH v16 13/18 net/idpf: add support for write back based on ITR expire

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Enable write back on ITR expire, then packets can be received one by one.

---
 drivers/net/idpf/idpf_ethdev.c | 120 +++++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_ethdev.h |  13 ++++
 drivers/net/idpf/idpf_vchnl.c  | 113 +++++++++++++++++++++++++++++++
 3 files changed, 246 insertions(+)
drivers/net/idpf/idpf_ethdev.c +120 -0
index d0821ec3f3..957cc10616 100644
@@ -297,6 +297,90 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_config_rx_queues_irqs(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	struct virtchnl2_queue_vector *qv_map;
+	struct idpf_hw *hw = &adapter->hw;
+	uint32_t dynctl_reg_start;
+	uint32_t itrn_reg_start;
+	uint32_t dynctl_val, itrn_val;
+	uint16_t i;
+
+	qv_map = rte_zmalloc("qv_map",
+			dev->data->nb_rx_queues *
+			sizeof(struct virtchnl2_queue_vector), 0);
+	if (qv_map == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to allocate %d queue-vector map",
+			    dev->data->nb_rx_queues);
+		goto qv_map_alloc_err;
+	}
+
+	/* Rx interrupt disabled, Map interrupt only for writeback */
+
+	/* The capability flags adapter->caps->other_caps should be
+	 * compared with bit VIRTCHNL2_CAP_WB_ON_ITR here. The if
+	 * condition should be updated when the FW can return the
+	 * correct flag bits.
+	 */
+	dynctl_reg_start =
+		vport->recv_vectors->vchunks.vchunks->dynctl_reg_start;
+	itrn_reg_start =
+		vport->recv_vectors->vchunks.vchunks->itrn_reg_start;
+	dynctl_val = IDPF_READ_REG(hw, dynctl_reg_start);
+	PMD_DRV_LOG(DEBUG, "Value of dynctl_reg_start is 0x%x",
+		    dynctl_val);
+	itrn_val = IDPF_READ_REG(hw, itrn_reg_start);
+	PMD_DRV_LOG(DEBUG, "Value of itrn_reg_start is 0x%x", itrn_val);
+	/* Force write-backs by setting WB_ON_ITR bit in DYN_CTL
+	 * register. WB_ON_ITR and INTENA are mutually exclusive
+	 * bits. Setting WB_ON_ITR bits means TX and RX Descs
+	 * are written back based on ITR expiration irrespective
+	 * of INTENA setting.
+	 */
+	/* TBD: need to tune INTERVAL value for better performance. */
+	if (itrn_val != 0)
+		IDPF_WRITE_REG(hw,
+			       dynctl_reg_start,
+			       VIRTCHNL2_ITR_IDX_0  <<
+			       PF_GLINT_DYN_CTL_ITR_INDX_S |
+			       PF_GLINT_DYN_CTL_WB_ON_ITR_M |
+			       itrn_val <<
+			       PF_GLINT_DYN_CTL_INTERVAL_S);
+	else
+		IDPF_WRITE_REG(hw,
+			       dynctl_reg_start,
+			       VIRTCHNL2_ITR_IDX_0  <<
+			       PF_GLINT_DYN_CTL_ITR_INDX_S |
+			       PF_GLINT_DYN_CTL_WB_ON_ITR_M |
+			       IDPF_DFLT_INTERVAL <<
+			       PF_GLINT_DYN_CTL_INTERVAL_S);
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		/* map all queues to the same vector */
+		qv_map[i].queue_id = vport->chunks_info.rx_start_qid + i;
+		qv_map[i].vector_id =
+			vport->recv_vectors->vchunks.vchunks->start_vector_id;
+	}
+	vport->qv_map = qv_map;
+
+	if (idpf_vc_config_irq_map_unmap(vport, true) != 0) {
+		PMD_DRV_LOG(ERR, "config interrupt mapping failed");
+		goto config_irq_map_err;
+	}
+
+	return 0;
+
+config_irq_map_err:
+	rte_free(vport->qv_map);
+	vport->qv_map = NULL;
+
+qv_map_alloc_err:
+	return -1;
+}
+
 static int
 idpf_start_queues(struct rte_eth_dev *dev)
 {
@@ -334,6 +418,10 @@ static int
 idpf_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t num_allocated_vectors =
+		adapter->caps->num_allocated_vectors;
+	uint16_t req_vecs_num;
 	int ret;
 
 	if (dev->data->mtu > vport->max_mtu) {
@@ -344,6 +432,27 @@ idpf_dev_start(struct rte_eth_dev *dev)
 
 	vport->max_pkt_len = dev->data->mtu + IDPF_ETH_OVERHEAD;
 
+	req_vecs_num = IDPF_DFLT_Q_VEC_NUM;
+	if (req_vecs_num + adapter->used_vecs_num > num_allocated_vectors) {
+		PMD_DRV_LOG(ERR, "The accumulated request vectors' number should be less than %d",
+			    num_allocated_vectors);
+		ret = -EINVAL;
+		goto err_mtu;
+	}
+
+	ret = idpf_vc_alloc_vectors(vport, req_vecs_num);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors");
+		goto err_mtu;
+	}
+	adapter->used_vecs_num += req_vecs_num;
+
+	ret = idpf_config_rx_queues_irqs(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to configure irqs");
+		goto err_mtu;
+	}
+
 	ret = idpf_start_queues(dev);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
@@ -376,6 +485,10 @@ idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_stop_queues(dev);
 
+	idpf_vc_config_irq_map_unmap(vport, false);
+
+	idpf_vc_dealloc_vectors(vport);
+
 	return 0;
 }
 
@@ -387,6 +500,11 @@ idpf_dev_close(struct rte_eth_dev *dev)
 
 	idpf_vc_destroy_vport(vport);
 
+	rte_free(vport->recv_vectors);
+	vport->recv_vectors = NULL;
+
+	rte_free(vport->qv_map);
+	vport->qv_map = NULL;
 
 	adapter->cur_vports &= ~RTE_BIT32(vport->devarg_id);
 
@@ -748,6 +866,8 @@ idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter *adapter)
 	adapter->cur_vports = 0;
 	adapter->cur_vport_nb = 0;
 
+	adapter->used_vecs_num = 0;
+
 	return ret;
 
 err_vports:
drivers/net/idpf/idpf_ethdev.h +13 -0
index db9af58f72..811240c386 100644
@@ -33,6 +33,9 @@
 #define IDPF_CTLQ_LEN		64
 #define IDPF_DFLT_MBX_BUF_SIZE	4096
 
+#define IDPF_DFLT_Q_VEC_NUM	1
+#define IDPF_DFLT_INTERVAL	16
+
 #define IDPF_MIN_BUF_SIZE	1024
 #define IDPF_MAX_FRAME_SIZE	9728
 #define IDPF_MIN_FRAME_SIZE	14
@@ -92,6 +95,11 @@ struct idpf_vport {
 	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t max_pkt_len; /* Maximum packet length */
 
+	/* MSIX info*/
+	struct virtchnl2_queue_vector *qv_map; /* queue vector mapping */
+	uint16_t max_vectors;
+	struct virtchnl2_alloc_vectors *recv_vectors;
+
 	/* Chunk info */
 	struct idpf_chunks_info chunks_info;
 
@@ -124,6 +132,8 @@ struct idpf_adapter {
 	uint16_t cur_vport_nb;
 	uint16_t cur_vport_idx;
 
+	uint16_t used_vecs_num;
+
 	/* Max config queue number per VC message */
 	uint32_t max_rxq_per_msg;
 	uint32_t max_txq_per_msg;
@@ -198,6 +208,9 @@ int idpf_switch_queue(struct idpf_vport *vport, uint16_t qid,
 		      bool rx, bool on);
 int idpf_vc_ena_dis_queues(struct idpf_vport *vport, bool enable);
 int idpf_vc_ena_dis_vport(struct idpf_vport *vport, bool enable);
+int idpf_vc_config_irq_map_unmap(struct idpf_vport *vport, bool map);
+int idpf_vc_alloc_vectors(struct idpf_vport *vport, uint16_t num_vectors);
+int idpf_vc_dealloc_vectors(struct idpf_vport *vport);
 int idpf_vc_query_ptype_info(struct idpf_adapter *adapter);
 int idpf_read_one_msg(struct idpf_adapter *adapter, uint32_t ops,
 		      uint16_t buf_len, uint8_t *buf);
drivers/net/idpf/idpf_vchnl.c +113 -0

131 lines not on this page · raw message

Signature · 1 line
2.26.2
#165 lore raw

PATCH v16 14/18 net/idpf: add support for RSS

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add RSS support.

---
 drivers/net/idpf/idpf_ethdev.c | 120 ++++++++++++++++++++++++++++++++-
 drivers/net/idpf/idpf_ethdev.h |  26 +++++++
 drivers/net/idpf/idpf_vchnl.c  | 113 +++++++++++++++++++++++++++++++
 3 files changed, 258 insertions(+), 1 deletion(-)
drivers/net/idpf/idpf_ethdev.c +119 -1
index 957cc10616..58560ea404 100644
@@ -59,6 +59,8 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = dev_info->max_rx_pktlen - IDPF_ETH_OVERHEAD;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->flow_type_rss_offloads = IDPF_RSS_OFFLOAD_ALL;
+
 	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -169,6 +171,8 @@ idpf_parse_devarg_id(char *name)
 	return val;
 }
 
+#define IDPF_RSS_KEY_LEN 52
+
 static int
 idpf_init_vport(struct rte_eth_dev *dev)
 {
@@ -189,6 +193,10 @@ idpf_init_vport(struct rte_eth_dev *dev)
 	vport->max_mtu = vport_info->max_mtu;
 	rte_memcpy(vport->default_mac_addr,
 		   vport_info->default_mac_addr, ETH_ALEN);
+	vport->rss_algorithm = vport_info->rss_algorithm;
+	vport->rss_key_size = RTE_MIN(IDPF_RSS_KEY_LEN,
+				     vport_info->rss_key_size);
+	vport->rss_lut_size = vport_info->rss_lut_size;
 	vport->sw_idx = idx;
 
 	for (i = 0; i < vport_info->chunks.num_chunks; i++) {
@@ -246,17 +254,110 @@ idpf_init_vport(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+idpf_config_rss(struct idpf_vport *vport)
+{
+	int ret;
+
+	ret = idpf_vc_set_rss_key(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS key");
+		return ret;
+	}
+
+	ret = idpf_vc_set_rss_lut(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS lut");
+		return ret;
+	}
+
+	ret = idpf_vc_set_rss_hash(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS hash");
+		return ret;
+	}
+
+	return ret;
+}
+
+static int
+idpf_init_rss(struct idpf_vport *vport)
+{
+	struct rte_eth_rss_conf *rss_conf;
+	uint16_t i, nb_q, lut_size;
+	int ret = 0;
+
+	rss_conf = &vport->dev_data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = vport->dev_data->nb_rx_queues;
+
+	vport->rss_key = rte_zmalloc("rss_key",
+				     vport->rss_key_size, 0);
+	if (vport->rss_key == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to allocate RSS key");
+		ret = -ENOMEM;
+		goto err_alloc_key;
+	}
+
+	lut_size = vport->rss_lut_size;
+	vport->rss_lut = rte_zmalloc("rss_lut",
+				     sizeof(uint32_t) * lut_size, 0);
+	if (vport->rss_lut == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to allocate RSS lut");
+		ret = -ENOMEM;
+		goto err_alloc_lut;
+	}
+
+	if (rss_conf->rss_key == NULL) {
+		for (i = 0; i < vport->rss_key_size; i++)
+			vport->rss_key[i] = (uint8_t)rte_rand();
+	} else if (rss_conf->rss_key_len != vport->rss_key_size) {
+		PMD_INIT_LOG(ERR, "Invalid RSS key length in RSS configuration, should be %d",
+			     vport->rss_key_size);
+		ret = -EINVAL;
+		goto err_cfg_key;
+	} else {
+		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+			   vport->rss_key_size);
+	}
+
+	for (i = 0; i < lut_size; i++)
+		vport->rss_lut[i] = i % nb_q;
+
+	vport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;
+
+	ret = idpf_config_rss(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS");
+		goto err_cfg_key;
+	}
+
+	return ret;
+
+err_cfg_key:
+	rte_free(vport->rss_lut);
+	vport->rss_lut = NULL;
+err_alloc_lut:
+	rte_free(vport->rss_key);
+	vport->rss_key = NULL;
+err_alloc_key:
+	return ret;
+}
+
 static int
 idpf_dev_configure(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
+	struct idpf_adapter *adapter = vport->adapter;
+	int ret;
 
 	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
 		PMD_INIT_LOG(ERR, "Setting link speed is not supported");
 		return -ENOTSUP;
 	}
 
-	if (dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) {
+	if ((dev->data->nb_rx_queues == 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) ||
+	    (dev->data->nb_rx_queues > 1 && conf->rxmode.mq_mode != RTE_ETH_MQ_RX_RSS)) {
 		PMD_INIT_LOG(ERR, "Multi-queue packet distribution mode %d is not supported",
 			     conf->rxmode.mq_mode);
 		return -ENOTSUP;
@@ -294,6 +395,17 @@ idpf_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
+	if (adapter->caps->rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+		ret = idpf_init_rss(vport);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init rss");
+			return ret;
+		}
+	} else {
+		PMD_INIT_LOG(ERR, "RSS is not supported.");
+		return -1;
+	}
+
 	return 0;
 }
 
@@ -500,6 +612,12 @@ idpf_dev_close(struct rte_eth_dev *dev)
 
 	idpf_vc_destroy_vport(vport);
 
+	rte_free(vport->rss_lut);
+	vport->rss_lut = NULL;
+
+	rte_free(vport->rss_key);
+	vport->rss_key = NULL;
+
 	rte_free(vport->recv_vectors);
 	vport->recv_vectors = NULL;
 
drivers/net/idpf/idpf_ethdev.h +26 -0
index 811240c386..8d0804f603 100644
@@ -48,6 +48,20 @@
 #define IDPF_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IDPF_VLAN_TAG_SIZE * 2)
 
+#define IDPF_RSS_OFFLOAD_ALL (				\
+		RTE_ETH_RSS_IPV4                |	\
+		RTE_ETH_RSS_FRAG_IPV4           |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_TCP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_UDP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_SCTP   |	\
+		RTE_ETH_RSS_NONFRAG_IPV4_OTHER  |	\
+		RTE_ETH_RSS_IPV6                |	\
+		RTE_ETH_RSS_FRAG_IPV6           |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_TCP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_UDP    |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_SCTP   |	\
+		RTE_ETH_RSS_NONFRAG_IPV6_OTHER)
+
 #define IDPF_ADAPTER_NAME_LEN	(PCI_PRI_STR_SIZE + 1)
 
 /* Message type read in virtual channel from PF */
@@ -90,11 +104,20 @@ struct idpf_vport {
 	uint16_t max_mtu;
 	uint8_t default_mac_addr[VIRTCHNL_ETH_LENGTH_OF_ADDRESS];
 
+	enum virtchnl_rss_algorithm rss_algorithm;
+	uint16_t rss_key_size;
+	uint16_t rss_lut_size;
+
 	uint16_t sw_idx; /* SW idx */
 
 	struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
 	uint16_t max_pkt_len; /* Maximum packet length */
 
+	/* RSS info */
+	uint32_t *rss_lut;
+	uint8_t *rss_key;
+	uint64_t rss_hf;
+
 	/* MSIX info*/
 	struct virtchnl2_queue_vector *qv_map; /* queue vector mapping */
 	uint16_t max_vectors;
@@ -200,6 +223,9 @@ int idpf_get_pkt_type(struct idpf_adapter *adapter);
 int idpf_vc_get_caps(struct idpf_adapter *adapter);
 int idpf_vc_create_vport(struct idpf_adapter *adapter);
 int idpf_vc_destroy_vport(struct idpf_vport *vport);
+int idpf_vc_set_rss_key(struct idpf_vport *vport);
+int idpf_vc_set_rss_lut(struct idpf_vport *vport);
+int idpf_vc_set_rss_hash(struct idpf_vport *vport);
 int idpf_vc_config_rxqs(struct idpf_vport *vport);
 int idpf_vc_config_rxq(struct idpf_vport *vport, uint16_t rxq_id);
 int idpf_vc_config_txqs(struct idpf_vport *vport);
drivers/net/idpf/idpf_vchnl.c +113 -0

131 lines not on this page · raw message

Signature · 1 line
2.26.2
#166 lore raw

PATCH v16 15/18 net/idpf: add support for Rx offloading

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add Rx offloading support:
- support CHKSUM and RSS offload for split queue model
- support CHKSUM offload for single queue model

---
 doc/guides/nics/features/idpf.ini |   5 ++
 drivers/net/idpf/idpf_ethdev.c    |   6 ++
 drivers/net/idpf/idpf_rxtx.c      | 123 ++++++++++++++++++++++++++++++
 drivers/net/idpf/idpf_vchnl.c     |  18 +++++
 4 files changed, 152 insertions(+)
doc/guides/nics/features/idpf.ini +5 -0
index d722c49fde..868571654f 100644
@@ -3,8 +3,13 @@
 ;
 ; Refer to default.ini for the full list of available PMD features.
 ;
+; A feature with "P" indicates only be supported when non-vector path
+; is selected.
+;
 [Features]
 MTU update           = Y
+L3 checksum offload  = P
+L4 checksum offload  = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/idpf/idpf_ethdev.c +6 -0
index 58560ea404..a09f104425 100644
@@ -61,6 +61,12 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->flow_type_rss_offloads = IDPF_RSS_OFFLOAD_ALL;
 
+	dev_info->rx_offload_capa =
+		RTE_ETH_RX_OFFLOAD_IPV4_CKSUM           |
+		RTE_ETH_RX_OFFLOAD_UDP_CKSUM            |
+		RTE_ETH_RX_OFFLOAD_TCP_CKSUM            |
+		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
+
 	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
drivers/net/idpf/idpf_rxtx.c +123 -0

171 lines not on this page · raw message

drivers/net/idpf/idpf_vchnl.c +18 -0
index 4ef354df89..00ac5b2a6b 100644
@@ -528,6 +528,24 @@ idpf_vc_get_caps(struct idpf_adapter *adapter)
 
 	memset(&caps_msg, 0, sizeof(struct virtchnl2_get_capabilities));
 
+	caps_msg.csum_caps =
+		VIRTCHNL2_CAP_TX_CSUM_L3_IPV4          |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_TCP      |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_UDP      |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_SCTP     |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_TCP      |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_UDP      |
+		VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP     |
+		VIRTCHNL2_CAP_TX_CSUM_GENERIC          |
+		VIRTCHNL2_CAP_RX_CSUM_L3_IPV4          |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP      |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_UDP      |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_SCTP     |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP      |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP      |
+		VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_SCTP     |
+		VIRTCHNL2_CAP_RX_CSUM_GENERIC;
+
 	caps_msg.rss_caps =
 		VIRTCHNL2_CAP_RSS_IPV4_TCP             |
 		VIRTCHNL2_CAP_RSS_IPV4_UDP             |
Signature · 1 line
2.26.2
#167 lore raw

PATCH v16 16/18 net/idpf: add support for Tx offloading

In reply to [email protected]

From: Junfeng Guo <[email protected]>

Add Tx offloading support:
- support TSO for single queue model and split queue model.

---
 doc/guides/nics/features/idpf.ini |   1 +
 drivers/net/idpf/idpf_ethdev.c    |   4 +-
 drivers/net/idpf/idpf_rxtx.c      | 128 +++++++++++++++++++++++++++++-
 drivers/net/idpf/idpf_rxtx.h      |  22 +++++
 4 files changed, 152 insertions(+), 3 deletions(-)
doc/guides/nics/features/idpf.ini +1 -0
index 868571654f..d82b4aa0ff 100644
@@ -8,6 +8,7 @@
 ;
 [Features]
 MTU update           = Y
+TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
 Linux                = Y
drivers/net/idpf/idpf_ethdev.c +3 -1
index a09f104425..084426260c 100644
@@ -67,7 +67,9 @@ idpf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_RX_OFFLOAD_TCP_CKSUM            |
 		RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM;
 
-	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+	dev_info->tx_offload_capa =
+		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = IDPF_DEFAULT_TX_FREE_THRESH,
drivers/net/idpf/idpf_rxtx.c +126 -2

199 lines not on this page · raw message

drivers/net/idpf/idpf_rxtx.h +22 -0
index 3853ed55c9..54d297aac6 100644
@@ -23,6 +23,16 @@
 
 #define IDPF_TX_MAX_MTU_SEG	10
 
+#define IDPF_MIN_TSO_MSS	88
+#define IDPF_MAX_TSO_MSS	9728
+#define IDPF_MAX_TSO_FRAME_SIZE	262143
+#define IDPF_TX_MAX_MTU_SEG     10
+
+#define IDPF_TX_OFFLOAD_MASK RTE_MBUF_F_TX_TCP_SEG
+
+#define IDPF_TX_OFFLOAD_NOTSUP_MASK \
+		(RTE_MBUF_F_TX_OFFLOAD_MASK ^ IDPF_TX_OFFLOAD_MASK)
+
 #define IDPF_GET_PTYPE_SIZE(p) \
 	(sizeof(struct virtchnl2_ptype) + \
 	(((p)->proto_id_count ? ((p)->proto_id_count - 1) : 0) * sizeof((p)->proto_id[0])))
@@ -115,6 +125,18 @@ struct idpf_tx_queue {
 	struct idpf_tx_queue *complq;
 };
 
+/* Offload features */
+union idpf_tx_offload {
+	uint64_t data;
+	struct {
+		uint64_t l2_len:7; /* L2 (MAC) Header Length. */
+		uint64_t l3_len:9; /* L3 (IP) Header Length. */
+		uint64_t l4_len:8; /* L4 Header Length. */
+		uint64_t tso_segsz:16; /* TCP TSO segment size */
+		/* uint64_t unused : 24; */
+	};
+};
+
 struct idpf_rxq_ops {
 	void (*release_mbufs)(struct idpf_rx_queue *rxq);
 };
Signature · 1 line
2.26.2