Skip to contentSkip to conversation

add support for cpfl PMD in DPDK

PATCH Superseded Mingxia Liu 8 participants 263 messages Dec 23, 2022 – Mar 9, 2023 Page 2 of 3

Subsystems (2)
lore
Share & tools
lore
#112 lore raw
In reply to Mingxia Liu
Quoted 65 lines · On Thu, 9 Feb 2023 08:45:20 +0000 Mingxia Liu <[email protected]> wrote:

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared library.

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v3 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info

Mingxia Liu (21):
net/cpfl: support device initialization
net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop
net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release
net/cpfl: support MTU configuration
net/cpfl: support basic Rx data path
net/cpfl: support basic Tx data path
net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading
net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

 MAINTAINERS                             |    9 +
 doc/guides/nics/cpfl.rst                |   88 ++
 doc/guides/nics/features/cpfl.ini       |   17 +
 doc/guides/rel_notes/release_23_03.rst  |    6 +
 drivers/net/cpfl/cpfl_ethdev.c          | 1453 +++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h          |   95 ++
 drivers/net/cpfl/cpfl_logs.h            |   32 +
 drivers/net/cpfl/cpfl_rxtx.c            |  952 +++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h            |   44 +
 drivers/net/cpfl/cpfl_rxtx_vec_common.h |  116 ++
 drivers/net/cpfl/meson.build            |   38 +
 drivers/net/meson.build                 |    1 +
 12 files changed, 2851 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
Quoted 9 lines
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx_vec_common.h
 create mode 100644 drivers/net/cpfl/meson.build

Overall, the driver looks good. One recommendation would be to not use rte_memcpy for small fixed size structure. Regular memcpy() will be as fast or faster and get more checking from analyzers.

Examples:

		rte_memcpy(adapter->mbx_resp, ctlq_msg.ctx.indirect.payload->va,

		rte_memcpy(ring_name, "cpfl Tx ring", sizeof("cpfl Tx ring"));

		rte_memcpy(ring_name, "cpfl Rx ring", sizeof("cpfl Rx ring"));
		rte_memcpy(ring_name, "cpfl Tx compl ring", sizeof("cpfl Tx compl ring"));
		rte_memcpy(ring_name, "cpfl Rx buf ring", sizeof("cpfl Rx buf ring"));
		rte_memcpy(vport->rss_key, rss_conf->rss_key,
		rte_memcpy(vport->rss_key, rss_conf->rss_key,
		rte_memcpy(rss_conf->rss_key, vport->rss_key, rss_conf->rss_key_len);
#113 lore raw

ok, thanks, I'll update in next version.

Quoted 106 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Friday, February 10, 2023 12:47 AM
To: Liu, Mingxia <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: Re: [PATCH v5 00/21] add support for cpfl PMD in DPDK

Quoted 10 lines · On Thu, 9 Feb 2023 08:45:20 +0000 Mingxia Liu <[email protected]> wrote:

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

Quoted 3 lines

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared

library.

Quoted 52 lines

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v3 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info

Mingxia Liu (21):
net/cpfl: support device initialization
net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop
net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release
net/cpfl: support MTU configuration
net/cpfl: support basic Rx data path
net/cpfl: support basic Tx data path
net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading
net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

 MAINTAINERS                             |    9 +
 doc/guides/nics/cpfl.rst                |   88 ++
 doc/guides/nics/features/cpfl.ini       |   17 +
 doc/guides/rel_notes/release_23_03.rst  |    6 +
 drivers/net/cpfl/cpfl_ethdev.c          | 1453 +++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h          |   95 ++
 drivers/net/cpfl/cpfl_logs.h            |   32 +
 drivers/net/cpfl/cpfl_rxtx.c            |  952 +++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h            |   44 +
 drivers/net/cpfl/cpfl_rxtx_vec_common.h |  116 ++
 drivers/net/cpfl/meson.build            |   38 +
 drivers/net/meson.build                 |    1 +
 12 files changed, 2851 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst  create mode 100644
Quoted 9 lines

doc/guides/nics/features/cpfl.ini create mode 100644 drivers/net/cpfl/cpfl_ethdev.c create mode 100644 drivers/net/cpfl/cpfl_ethdev.h create mode 100644

drivers/net/cpfl/cpfl_logs.h  create mode 100644
drivers/net/cpfl/cpfl_rxtx.c  create mode 100644
drivers/net/cpfl/cpfl_rxtx.h  create mode 100644
drivers/net/cpfl/cpfl_rxtx_vec_common.h
 create mode 100644 drivers/net/cpfl/meson.build

Overall, the driver looks good. One recommendation would be to not use rte_memcpy for small fixed size structure. Regular memcpy() will be as fast or faster and get more checking from analyzers.

Examples:

		rte_memcpy(adapter->mbx_resp,

ctlq_msg.ctx.indirect.payload->va,

		rte_memcpy(ring_name, "cpfl Tx ring", sizeof("cpfl Tx ring"));

		rte_memcpy(ring_name, "cpfl Rx ring", sizeof("cpfl Rx ring"));
		rte_memcpy(ring_name, "cpfl Tx compl ring", sizeof("cpfl Tx
compl ring"));
		rte_memcpy(ring_name, "cpfl Rx buf ring", sizeof("cpfl Rx
buf ring"));
		rte_memcpy(vport->rss_key, rss_conf->rss_key,
		rte_memcpy(vport->rss_key, rss_conf->rss_key,
		rte_memcpy(rss_conf->rss_key, vport->rss_key, rss_conf-
Quoted 1 line

rss_key_len);

#114 lore raw

v6 cover add support for cpfl PMD in DPDK

In reply to Mingxia Liu

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared library.

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v5 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info
v6 changes:
- for small fixed size structure, change rte_memcpy to memcpy()
- fix compilation for AVX512DQ
- update cpfl maintainers

Mingxia Liu (21):
net/cpfl: support device initialization
net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop
net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release
net/cpfl: support MTU configuration
net/cpfl: support basic Rx data path
net/cpfl: support basic Tx data path
net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading
net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

 MAINTAINERS                             |    8 +
 doc/guides/nics/cpfl.rst                |   88 ++
 doc/guides/nics/features/cpfl.ini       |   17 +
 doc/guides/rel_notes/release_23_03.rst  |    6 +
 drivers/net/cpfl/cpfl_ethdev.c          | 1453 +++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h          |   95 ++
 drivers/net/cpfl/cpfl_logs.h            |   32 +
 drivers/net/cpfl/cpfl_rxtx.c            |  952 +++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h            |   44 +
 drivers/net/cpfl/cpfl_rxtx_vec_common.h |  116 ++
 drivers/net/cpfl/meson.build            |   40 +
 drivers/net/meson.build                 |    1 +
 12 files changed, 2852 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx_vec_common.h
 create mode 100644 drivers/net/cpfl/meson.build
Signature · 1 line
2.25.1
#115 lore raw

PATCH v6 1/21 net/cpfl: support device initialization

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

---
 MAINTAINERS                            |   8 +
 doc/guides/nics/cpfl.rst               |  66 +++
 doc/guides/nics/features/cpfl.ini      |  12 +
 doc/guides/rel_notes/release_23_03.rst |   6 +
 drivers/net/cpfl/cpfl_ethdev.c         | 768 +++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h         |  78 +++
 drivers/net/cpfl/cpfl_logs.h           |  32 ++
 drivers/net/cpfl/cpfl_rxtx.c           | 244 ++++++++
 drivers/net/cpfl/cpfl_rxtx.h           |  25 +
 drivers/net/cpfl/meson.build           |  14 +
 drivers/net/meson.build                |   1 +
 11 files changed, 1254 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
 create mode 100644 drivers/net/cpfl/meson.build
MAINTAINERS +8 -0
index 9a0f416d2e..af80edaf6e 100644
@@ -783,6 +783,14 @@ F: drivers/common/idpf/
 F: doc/guides/nics/idpf.rst
 F: doc/guides/nics/features/idpf.ini
 
+Intel cpfl
+M: Yuying Zhang <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/cpfl/
+F: doc/guides/nics/cpfl.rst
+F: doc/guides/nics/features/cpfl.ini
+
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/cpfl.rst new file +66 -0

67 lines not on this page · raw message

doc/guides/nics/features/cpfl.ini new file +12 -0
new file mode 100644
index 0000000000..a2d1ca9e15
@@ -0,0 +1,12 @@
+;
+; Supported features of the 'cpfl' 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]
+Linux                = Y
+x86-32               = Y
+x86-64               = Y
doc/guides/rel_notes/release_23_03.rst +6 -0
index 07914170a7..b0b23d1a44 100644
@@ -88,6 +88,12 @@ New Features
   * Added timesync API support.
   * Added packet pacing(launch time offloading) support.
 
+* **Added Intel cpfl driver.**
+
+  Added the new ``cpfl`` net driver
+  for Intel\ |reg| Infrastructure Processing Unit (Intel\ |reg| IPU) E2100.
+  See the :doc:`../nics/cpfl` NIC guide for more details on this new driver.
+
 Removed Items
 -------------
 
drivers/net/cpfl/cpfl_ethdev.c new file +768 -0

768 lines not on this page · raw message

drivers/net/cpfl/cpfl_ethdev.h new file +78 -0

78 lines not on this page · raw message

drivers/net/cpfl/cpfl_logs.h new file +32 -0
new file mode 100644
index 0000000000..365b53e8b3
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#ifndef _CPFL_LOGS_H_
+#define _CPFL_LOGS_H_
+
+#include <rte_log.h>
+
+extern int cpfl_logtype_init;
+extern int cpfl_logtype_driver;
+
+#define PMD_INIT_LOG(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_init, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG_RAW(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_driver, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+
+#endif /* _CPFL_LOGS_H_ */
drivers/net/cpfl/cpfl_rxtx.c new file +244 -0

244 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h new file +25 -0
new file mode 100644
index 0000000000..232630c5e9
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#ifndef _CPFL_RXTX_H_
+#define _CPFL_RXTX_H_
+
+#include <idpf_common_rxtx.h>
+#include "cpfl_ethdev.h"
+
+/* In QLEN must be whole number of 32 descriptors. */
+#define CPFL_ALIGN_RING_DESC	32
+#define CPFL_MIN_RING_DESC	32
+#define CPFL_MAX_RING_DESC	4096
+#define CPFL_DMA_MEM_ALIGN	4096
+/* Base address of the HW descriptor ring should be 128B aligned. */
+#define CPFL_RING_BASE_ALIGN	128
+
+#define CPFL_DEFAULT_TX_RS_THRESH	32
+#define CPFL_DEFAULT_TX_FREE_THRESH	32
+
+int cpfl_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);
+#endif /* _CPFL_RXTX_H_ */
drivers/net/cpfl/meson.build new file +14 -0
new file mode 100644
index 0000000000..c721732b50
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+
+if is_windows
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
+endif
+
+deps += ['common_idpf']
+
+sources = files(
+        'cpfl_ethdev.c',
+)
\ No newline at end of file
drivers/net/meson.build +1 -0
index 6470bf3636..a8ca338875 100644
@@ -13,6 +13,7 @@ drivers = [
         'bnxt',
         'bonding',
         'cnxk',
+        'cpfl',
         'cxgbe',
         'dpaa',
         'dpaa2',
Signature · 1 line
2.25.1
#116 lore raw

PATCH v6 2/21 net/cpfl: add Tx queue setup

In reply to Mingxia Liu

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/cpfl/cpfl_ethdev.c | 13 +++++++++++++
 drivers/net/cpfl/cpfl_rxtx.c   |  8 ++++----
 drivers/net/cpfl/meson.build   |  1 +
 3 files changed, 18 insertions(+), 4 deletions(-)
drivers/net/cpfl/cpfl_ethdev.c +13 -0
index fe0061133c..5ca21c9772 100644
@@ -12,6 +12,7 @@
 #include <rte_alarm.h>
 
 #include "cpfl_ethdev.h"
+#include "cpfl_rxtx.h"
 
 #define CPFL_TX_SINGLE_Q	"tx_single"
 #define CPFL_RX_SINGLE_Q	"rx_single"
@@ -96,6 +97,17 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_free_thresh = CPFL_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = CPFL_DEFAULT_TX_RS_THRESH,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = CPFL_MAX_RING_DESC,
+		.nb_min = CPFL_MIN_RING_DESC,
+		.nb_align = CPFL_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -513,6 +525,7 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a
 static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_configure			= cpfl_dev_configure,
 	.dev_close			= cpfl_dev_close,
+	.tx_queue_setup			= cpfl_tx_queue_setup,
 	.dev_infos_get			= cpfl_dev_info_get,
 	.link_update			= cpfl_dev_link_update,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
drivers/net/cpfl/cpfl_rxtx.c +4 -4
index 2b9c20928b..5b69ac0009 100644
@@ -130,7 +130,7 @@ cpfl_tx_complq_setup(struct rte_eth_dev *dev, struct idpf_tx_queue *txq,
 	cq->tx_ring_phys_addr = mz->iova;
 	cq->compl_ring = mz->addr;
 	cq->mz = mz;
-	reset_split_tx_complq(cq);
+	idpf_qc_split_tx_complq_reset(cq);
 
 	txq->complq = cq;
 
@@ -164,7 +164,7 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		tx_conf->tx_rs_thresh : CPFL_DEFAULT_TX_RS_THRESH);
 	tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh > 0) ?
 		tx_conf->tx_free_thresh : CPFL_DEFAULT_TX_FREE_THRESH);
-	if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
+	if (idpf_qc_tx_thresh_check(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
 	/* Allocate the TX queue data structure. */
@@ -215,10 +215,10 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 
 	if (!is_splitq) {
 		txq->tx_ring = mz->addr;
-		reset_single_tx_queue(txq);
+		idpf_qc_single_tx_queue_reset(txq);
 	} else {
 		txq->desc_ring = mz->addr;
-		reset_split_tx_descq(txq);
+		idpf_qc_split_tx_descq_reset(txq);
 
 		/* Setup tx completion queue if split model */
 		ret = cpfl_tx_complq_setup(dev, txq, queue_idx,
drivers/net/cpfl/meson.build +1 -0
index c721732b50..1894423689 100644
@@ -11,4 +11,5 @@ deps += ['common_idpf']
 
 sources = files(
         'cpfl_ethdev.c',
+        'cpfl_rxtx.c',
 )
\ No newline at end of file
Signature · 1 line
2.25.1
#117 lore raw

PATCH v6 3/21 net/cpfl: add Rx queue setup

In reply to Mingxia Liu

Add support for rx_queue_setup ops.

---
 drivers/net/cpfl/cpfl_ethdev.c |  11 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 232 +++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |   6 +
 3 files changed, 249 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +11 -0
index 5ca21c9772..3029f03d02 100644
@@ -102,12 +102,22 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		.tx_rs_thresh = CPFL_DEFAULT_TX_RS_THRESH,
 	};
 
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_free_thresh = CPFL_DEFAULT_RX_FREE_THRESH,
+	};
+
 	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
 		.nb_max = CPFL_MAX_RING_DESC,
 		.nb_min = CPFL_MIN_RING_DESC,
 		.nb_align = CPFL_ALIGN_RING_DESC,
 	};
 
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = CPFL_MAX_RING_DESC,
+		.nb_min = CPFL_MIN_RING_DESC,
+		.nb_align = CPFL_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -525,6 +535,7 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a
 static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_configure			= cpfl_dev_configure,
 	.dev_close			= cpfl_dev_close,
+	.rx_queue_setup			= cpfl_rx_queue_setup,
 	.tx_queue_setup			= cpfl_tx_queue_setup,
 	.dev_infos_get			= cpfl_dev_info_get,
 	.link_update			= cpfl_dev_link_update,
drivers/net/cpfl/cpfl_rxtx.c +232 -0

244 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h +6 -0
index 232630c5e9..e0221abfa3 100644
@@ -16,10 +16,16 @@
 /* Base address of the HW descriptor ring should be 128B aligned. */
 #define CPFL_RING_BASE_ALIGN	128
 
+#define CPFL_DEFAULT_RX_FREE_THRESH	32
+
 #define CPFL_DEFAULT_TX_RS_THRESH	32
 #define CPFL_DEFAULT_TX_FREE_THRESH	32
 
 int cpfl_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 cpfl_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);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#118 lore raw

PATCH v6 4/21 net/cpfl: support device start and stop

In reply to Mingxia Liu

Add dev ops dev_start, dev_stop and link_update.

---
 drivers/net/cpfl/cpfl_ethdev.c | 35 ++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +35 -0
index 3029f03d02..d1dfcfff9b 100644
@@ -184,12 +184,45 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+cpfl_dev_start(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	int ret;
+
+	ret = idpf_vc_vport_ena_dis(vport, true);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		return ret;
+	}
+
+	vport->stopped = 0;
+
+	return 0;
+}
+
+static int
+cpfl_dev_stop(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (vport->stopped == 1)
+		return 0;
+
+	idpf_vc_vport_ena_dis(vport, false);
+
+	vport->stopped = 1;
+
+	return 0;
+}
+
 static int
 cpfl_dev_close(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
 	struct cpfl_adapter_ext *adapter = CPFL_ADAPTER_TO_EXT(vport->adapter);
 
+	cpfl_dev_stop(dev);
 	idpf_vport_deinit(vport);
 
 	adapter->cur_vports &= ~RTE_BIT32(vport->devarg_id);
@@ -538,6 +571,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.rx_queue_setup			= cpfl_rx_queue_setup,
 	.tx_queue_setup			= cpfl_tx_queue_setup,
 	.dev_infos_get			= cpfl_dev_info_get,
+	.dev_start			= cpfl_dev_start,
+	.dev_stop			= cpfl_dev_stop,
 	.link_update			= cpfl_dev_link_update,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
Signature · 1 line
2.25.1
#119 lore raw

PATCH v6 5/21 net/cpfl: support queue start

In reply to Mingxia Liu

Add support for these device ops:
- rx_queue_start
- tx_queue_start

---
 drivers/net/cpfl/cpfl_ethdev.c |  41 ++++++++++
 drivers/net/cpfl/cpfl_rxtx.c   | 138 +++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |   4 +
 3 files changed, 183 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +41 -0
index d1dfcfff9b..c4565e687b 100644
@@ -184,12 +184,51 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+cpfl_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 = cpfl_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 = cpfl_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
 cpfl_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
 	int ret;
 
+	ret = cpfl_start_queues(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to start queues");
+		return ret;
+	}
+
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
@@ -574,6 +613,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_start			= cpfl_dev_start,
 	.dev_stop			= cpfl_dev_stop,
 	.link_update			= cpfl_dev_link_update,
+	.rx_queue_start			= cpfl_rx_queue_start,
+	.tx_queue_start			= cpfl_tx_queue_start,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
drivers/net/cpfl/cpfl_rxtx.c +138 -0

141 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h +4 -0
index e0221abfa3..716b2fefa4 100644
@@ -28,4 +28,8 @@ int cpfl_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 cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int cpfl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int cpfl_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#120 lore raw

PATCH v6 6/21 net/cpfl: support queue stop

In reply to Mingxia Liu

Add support for these device ops:
- rx_queue_stop
- tx_queue_stop

---
 drivers/net/cpfl/cpfl_ethdev.c | 10 +++-
 drivers/net/cpfl/cpfl_rxtx.c   | 87 ++++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  3 ++
 3 files changed, 99 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +9 -1
index c4565e687b..f757fea530 100644
@@ -232,12 +232,16 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
-		return ret;
+		goto err_vport;
 	}
 
 	vport->stopped = 0;
 
 	return 0;
+
+err_vport:
+	cpfl_stop_queues(dev);
+	return ret;
 }
 
 static int
@@ -250,6 +254,8 @@ cpfl_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_vc_vport_ena_dis(vport, false);
 
+	cpfl_stop_queues(dev);
+
 	vport->stopped = 1;
 
 	return 0;
@@ -615,6 +621,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.link_update			= cpfl_dev_link_update,
 	.rx_queue_start			= cpfl_rx_queue_start,
 	.tx_queue_start			= cpfl_tx_queue_start,
+	.rx_queue_stop			= cpfl_rx_queue_stop,
+	.tx_queue_stop			= cpfl_tx_queue_stop,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
drivers/net/cpfl/cpfl_rxtx.c +87 -0

90 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h +3 -0
index 716b2fefa4..e9b810deaa 100644
@@ -32,4 +32,7 @@ int cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int cpfl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int cpfl_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+void cpfl_stop_queues(struct rte_eth_dev *dev);
+int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#121 lore raw

PATCH v6 7/21 net/cpfl: support queue release

In reply to Mingxia Liu

Add support for queue operations:
- rx_queue_release
- tx_queue_release

---
 drivers/net/cpfl/cpfl_ethdev.c |  2 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 35 ++++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  2 ++
 3 files changed, 39 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +2 -0
index f757fea530..2e5bfac1c0 100644
@@ -623,6 +623,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.tx_queue_start			= cpfl_tx_queue_start,
 	.rx_queue_stop			= cpfl_rx_queue_stop,
 	.tx_queue_stop			= cpfl_tx_queue_stop,
+	.rx_queue_release		= cpfl_dev_rx_queue_release,
+	.tx_queue_release		= cpfl_dev_tx_queue_release,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
drivers/net/cpfl/cpfl_rxtx.c +35 -0
index de0f2a5723..3edba70b16 100644
@@ -49,6 +49,14 @@ cpfl_tx_offload_convert(uint64_t offload)
 	return ol;
 }
 
+static const struct idpf_rxq_ops def_rxq_ops = {
+	.release_mbufs = idpf_qc_rxq_mbufs_release,
+};
+
+static const struct idpf_txq_ops def_txq_ops = {
+	.release_mbufs = idpf_qc_txq_mbufs_release,
+};
+
 static const struct rte_memzone *
 cpfl_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx,
 		      uint16_t len, uint16_t queue_type,
@@ -177,6 +185,7 @@ cpfl_rx_split_bufq_setup(struct rte_eth_dev *dev, struct idpf_rx_queue *rxq,
 	idpf_qc_split_rx_bufq_reset(bufq);
 	bufq->qrx_tail = hw->hw_addr + (vport->chunks_info.rx_buf_qtail_start +
 			 queue_idx * vport->chunks_info.rx_buf_qtail_spacing);
+	bufq->ops = &def_rxq_ops;
 	bufq->q_set = true;
 
 	if (bufq_id == 1) {
@@ -235,6 +244,12 @@ cpfl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (idpf_qc_rx_thresh_check(nb_desc, rx_free_thresh) != 0)
 		return -EINVAL;
 
+	/* Free memory if needed */
+	if (dev->data->rx_queues[queue_idx] != NULL) {
+		idpf_qc_rx_queue_release(dev->data->rx_queues[queue_idx]);
+		dev->data->rx_queues[queue_idx] = NULL;
+	}
+
 	/* Setup Rx queue */
 	rxq = rte_zmalloc_socket("cpfl rxq",
 				 sizeof(struct idpf_rx_queue),
@@ -287,6 +302,7 @@ cpfl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		idpf_qc_single_rx_queue_reset(rxq);
 		rxq->qrx_tail = hw->hw_addr + (vport->chunks_info.rx_qtail_start +
 				queue_idx * vport->chunks_info.rx_qtail_spacing);
+		rxq->ops = &def_rxq_ops;
 	} else {
 		idpf_qc_split_rx_descq_reset(rxq);
 
@@ -399,6 +415,12 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (idpf_qc_tx_thresh_check(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
+	/* Free memory if needed. */
+	if (dev->data->tx_queues[queue_idx] != NULL) {
+		idpf_qc_tx_queue_release(dev->data->tx_queues[queue_idx]);
+		dev->data->tx_queues[queue_idx] = NULL;
+	}
+
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("cpfl txq",
 				 sizeof(struct idpf_tx_queue),
@@ -461,6 +483,7 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 
 	txq->qtx_tail = hw->hw_addr + (vport->chunks_info.tx_qtail_start +
 			queue_idx * vport->chunks_info.tx_qtail_spacing);
+	txq->ops = &def_txq_ops;
 	txq->q_set = true;
 	dev->data->tx_queues[queue_idx] = txq;
 
@@ -674,6 +697,18 @@ cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	return 0;
 }
 
+void
+cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
+{
+	idpf_qc_rx_queue_release(dev->data->rx_queues[qid]);
+}
+
+void
+cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
+{
+	idpf_qc_tx_queue_release(dev->data->tx_queues[qid]);
+}
+
 void
 cpfl_stop_queues(struct rte_eth_dev *dev)
 {
drivers/net/cpfl/cpfl_rxtx.h +2 -0
index e9b810deaa..f5882401dc 100644
@@ -35,4 +35,6 @@ int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void cpfl_stop_queues(struct rte_eth_dev *dev);
 int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
+void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#122 lore raw

PATCH v6 8/21 net/cpfl: support MTU configuration

In reply to Mingxia Liu

Add dev ops mtu_set.

---
 doc/guides/nics/features/cpfl.ini |  1 +
 drivers/net/cpfl/cpfl_ethdev.c    | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
doc/guides/nics/features/cpfl.ini +1 -0
index a2d1ca9e15..470ba81579 100644
@@ -7,6 +7,7 @@
 ; is selected.
 ;
 [Features]
+MTU update           = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/cpfl/cpfl_ethdev.c +27 -0
index 2e5bfac1c0..e2eb92c738 100644
@@ -121,6 +121,27 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	return 0;
 }
 
+static int
+cpfl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	/* 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;
+	}
+
+	if (mtu > vport->max_mtu) {
+		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
+		return -EINVAL;
+	}
+
+	vport->max_pkt_len = mtu + CPFL_ETH_OVERHEAD;
+
+	return 0;
+}
+
 static const uint32_t *
 cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 {
@@ -142,6 +163,7 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 static int
 cpfl_dev_configure(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
 
 	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
@@ -181,6 +203,10 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
+	vport->max_pkt_len =
+		(dev->data->mtu == 0) ? CPFL_DEFAULT_MTU : dev->data->mtu +
+		CPFL_ETH_OVERHEAD;
+
 	return 0;
 }
 
@@ -625,6 +651,7 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.tx_queue_stop			= cpfl_tx_queue_stop,
 	.rx_queue_release		= cpfl_dev_rx_queue_release,
 	.tx_queue_release		= cpfl_dev_tx_queue_release,
+	.mtu_set			= cpfl_dev_mtu_set,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
Signature · 1 line
2.25.1
#123 lore raw

PATCH v6 9/21 net/cpfl: support basic Rx data path

In reply to Mingxia Liu

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

---
 drivers/net/cpfl/cpfl_ethdev.c |  2 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 18 ++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  1 +
 3 files changed, 21 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +2 -0
index e2eb92c738..ba66b284cc 100644
@@ -255,6 +255,8 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	cpfl_set_rx_function(dev);
+
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
drivers/net/cpfl/cpfl_rxtx.c +18 -0
index 3edba70b16..568ae3ec68 100644
@@ -734,3 +734,21 @@ cpfl_stop_queues(struct rte_eth_dev *dev)
 			PMD_DRV_LOG(WARNING, "Fail to stop Tx queue %d", i);
 	}
 }
+
+void
+cpfl_set_rx_function(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Split Scalar Rx (port %d).",
+			    dev->data->port_id);
+		dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts;
+	} else {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Single Scalar Rx (port %d).",
+			    dev->data->port_id);
+		dev->rx_pkt_burst = idpf_dp_singleq_recv_pkts;
+	}
+}
drivers/net/cpfl/cpfl_rxtx.h +1 -0
index f5882401dc..a5dd388e1f 100644
@@ -37,4 +37,5 @@ int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
+void cpfl_set_rx_function(struct rte_eth_dev *dev);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#124 lore raw

PATCH v6 10/21 net/cpfl: support basic Tx data path

In reply to Mingxia Liu

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

---
 drivers/net/cpfl/cpfl_ethdev.c |  3 +++
 drivers/net/cpfl/cpfl_rxtx.c   | 20 ++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  1 +
 3 files changed, 24 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +3 -0
index ba66b284cc..f02cbd08d9 100644
@@ -97,6 +97,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	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 = CPFL_DEFAULT_TX_FREE_THRESH,
 		.tx_rs_thresh = CPFL_DEFAULT_TX_RS_THRESH,
@@ -256,6 +258,7 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 	}
 
 	cpfl_set_rx_function(dev);
+	cpfl_set_tx_function(dev);
 
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
drivers/net/cpfl/cpfl_rxtx.c +20 -0
index 568ae3ec68..c250642719 100644
@@ -752,3 +752,23 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 		dev->rx_pkt_burst = idpf_dp_singleq_recv_pkts;
 	}
 }
+
+void
+cpfl_set_tx_function(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Split Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	} else {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Single Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	}
+}
drivers/net/cpfl/cpfl_rxtx.h +1 -0
index a5dd388e1f..5f8144e55f 100644
@@ -38,4 +38,5 @@ int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void cpfl_set_rx_function(struct rte_eth_dev *dev);
+void cpfl_set_tx_function(struct rte_eth_dev *dev);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#125 lore raw

PATCH v6 11/21 net/cpfl: support write back based on ITR expire

In reply to Mingxia Liu

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

---
 drivers/net/cpfl/cpfl_ethdev.c | 45 +++++++++++++++++++++++++++++++++-
 drivers/net/cpfl/cpfl_ethdev.h |  2 ++
 2 files changed, 46 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +44 -1
index f02cbd08d9..7e0630c605 100644
@@ -212,6 +212,15 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+cpfl_config_rx_queues_irqs(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	uint16_t nb_rx_queues = dev->data->nb_rx_queues;
+
+	return idpf_vport_irq_map_config(vport, nb_rx_queues);
+}
+
 static int
 cpfl_start_queues(struct rte_eth_dev *dev)
 {
@@ -249,12 +258,37 @@ static int
 cpfl_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *base = vport->adapter;
+	struct cpfl_adapter_ext *adapter = CPFL_ADAPTER_TO_EXT(base);
+	uint16_t num_allocated_vectors = base->caps.num_allocated_vectors;
+	uint16_t req_vecs_num;
 	int ret;
 
+	req_vecs_num = CPFL_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_vec;
+	}
+
+	ret = idpf_vc_vectors_alloc(vport, req_vecs_num);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors");
+		goto err_vec;
+	}
+	adapter->used_vecs_num += req_vecs_num;
+
+	ret = cpfl_config_rx_queues_irqs(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to configure irqs");
+		goto err_irq;
+	}
+
 	ret = cpfl_start_queues(dev);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
-		return ret;
+		goto err_startq;
 	}
 
 	cpfl_set_rx_function(dev);
@@ -272,6 +306,11 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 
 err_vport:
 	cpfl_stop_queues(dev);
+err_startq:
+	idpf_vport_irq_unmap_config(vport, dev->data->nb_rx_queues);
+err_irq:
+	idpf_vc_vectors_dealloc(vport);
+err_vec:
 	return ret;
 }
 
@@ -287,6 +326,10 @@ cpfl_dev_stop(struct rte_eth_dev *dev)
 
 	cpfl_stop_queues(dev);
 
+	idpf_vport_irq_unmap_config(vport, dev->data->nb_rx_queues);
+
+	idpf_vc_vectors_dealloc(vport);
+
 	vport->stopped = 1;
 
 	return 0;
drivers/net/cpfl/cpfl_ethdev.h +2 -0
index 9ca39b4558..cd7f560d19 100644
@@ -24,6 +24,8 @@
 
 #define CPFL_INVALID_VPORT_IDX	0xffff
 
+#define CPFL_DFLT_Q_VEC_NUM	1
+
 #define CPFL_MIN_BUF_SIZE	1024
 #define CPFL_MAX_FRAME_SIZE	9728
 #define CPFL_DEFAULT_MTU	RTE_ETHER_MTU
Signature · 1 line
2.25.1
#126 lore raw

PATCH v6 12/21 net/cpfl: support RSS

In reply to Mingxia Liu

Add RSS support.

---
 drivers/net/cpfl/cpfl_ethdev.c | 51 ++++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h | 15 ++++++++++
 2 files changed, 66 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +51 -0
index 7e0630c605..fb15004e48 100644
@@ -97,6 +97,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->flow_type_rss_offloads = CPFL_RSS_OFFLOAD_ALL;
+
 	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -162,11 +164,49 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 	return ptypes;
 }
 
+static int
+cpfl_init_rss(struct idpf_vport *vport)
+{
+	struct rte_eth_rss_conf *rss_conf;
+	struct rte_eth_dev_data *dev_data;
+	uint16_t i, nb_q;
+	int ret = 0;
+
+	dev_data = vport->dev_data;
+	rss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = dev_data->nb_rx_queues;
+
+	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);
+		return -EINVAL;
+	} else {
+		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+			   vport->rss_key_size);
+	}
+
+	for (i = 0; i < vport->rss_lut_size; i++)
+		vport->rss_lut[i] = i % nb_q;
+
+	vport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;
+
+	ret = idpf_vport_rss_config(vport);
+	if (ret != 0)
+		PMD_INIT_LOG(ERR, "Failed to configure RSS");
+
+	return ret;
+}
+
 static int
 cpfl_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");
@@ -205,6 +245,17 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
+	if (adapter->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+		ret = cpfl_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;
+	}
+
 	vport->max_pkt_len =
 		(dev->data->mtu == 0) ? CPFL_DEFAULT_MTU : dev->data->mtu +
 		CPFL_ETH_OVERHEAD;
drivers/net/cpfl/cpfl_ethdev.h +15 -0
index cd7f560d19..e00dff4bf0 100644
@@ -36,6 +36,21 @@
 #define CPFL_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + CPFL_VLAN_TAG_SIZE * 2)
 
+#define CPFL_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  |	\
+		RTE_ETH_RSS_L2_PAYLOAD)
+
 #define CPFL_ADAPTER_NAME_LEN	(PCI_PRI_STR_SIZE + 1)
 
 #define CPFL_ALARM_INTERVAL	50000 /* us */
Signature · 1 line
2.25.1
#127 lore raw

PATCH v6 13/21 net/cpfl: support Rx offloading

In reply to Mingxia Liu

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

---
 doc/guides/nics/features/cpfl.ini | 2 ++
 drivers/net/cpfl/cpfl_ethdev.c    | 6 ++++++
 2 files changed, 8 insertions(+)
doc/guides/nics/features/cpfl.ini +2 -0
index 470ba81579..ee5948f444 100644
@@ -8,6 +8,8 @@
 ;
 [Features]
 MTU update           = Y
+L3 checksum offload  = P
+L4 checksum offload  = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/cpfl/cpfl_ethdev.c +6 -0
index fb15004e48..d0f90b7d2c 100644
@@ -99,6 +99,12 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->flow_type_rss_offloads = CPFL_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) {
Signature · 1 line
2.25.1
#128 lore raw

PATCH v6 14/21 net/cpfl: support Tx offloading

In reply to Mingxia Liu

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

---
 doc/guides/nics/features/cpfl.ini | 1 +
 drivers/net/cpfl/cpfl_ethdev.c    | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
doc/guides/nics/features/cpfl.ini +1 -0
index ee5948f444..f4e45c7c68 100644
@@ -8,6 +8,7 @@
 ;
 [Features]
 MTU update           = Y
+TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
 Linux                = Y
drivers/net/cpfl/cpfl_ethdev.c +7 -1
index d0f90b7d2c..fda945d34b 100644
@@ -105,7 +105,13 @@ cpfl_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_IPV4_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_UDP_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_TCP_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = CPFL_DEFAULT_TX_FREE_THRESH,
Signature · 1 line
2.25.1
#129 lore raw

PATCH v6 15/21 net/cpfl: add AVX512 data path for single queue model

In reply to Mingxia Liu

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

---
 doc/guides/nics/cpfl.rst                |  24 +++++-
 drivers/net/cpfl/cpfl_ethdev.c          |   3 +-
 drivers/net/cpfl/cpfl_rxtx.c            |  94 ++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx_vec_common.h | 100 ++++++++++++++++++++++++
 drivers/net/cpfl/meson.build            |  25 +++++-
 5 files changed, 243 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/cpfl/cpfl_rxtx_vec_common.h
doc/guides/nics/cpfl.rst +23 -1
index 7c5aff0789..f0018b41df 100644
@@ -63,4 +63,26 @@ Runtime Config Options
 Driver compilation and testing
 ------------------------------
 
-Refer to the document :doc:`build_and_test` for details.
\ No newline at end of file
+Refer to the document :doc:`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 cpfl.ini,
+  A value "P" means the offload feature is not supported by vector path.
+  If any not supported features are used, cpfl vector PMD is disabled
+  and the scalar paths are chosen.
drivers/net/cpfl/cpfl_ethdev.c +2 -1
index fda945d34b..346af055cf 100644
@@ -111,7 +111,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_TX_OFFLOAD_TCP_CKSUM		|
 		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM		|
 		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 = CPFL_DEFAULT_TX_FREE_THRESH,
drivers/net/cpfl/cpfl_rxtx.c +94 -0

129 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx_vec_common.h new file +100 -0

100 lines not on this page · raw message

drivers/net/cpfl/meson.build +24 -1
index 1894423689..fbe6500826 100644
@@ -7,9 +7,32 @@ if is_windows
     subdir_done()
 endif
 
+if dpdk_conf.get('RTE_IOVA_AS_PA') == 0
+    build = false
+    reason = 'driver does not support disabling IOVA as PA mode'
+    subdir_done()
+endif
+
 deps += ['common_idpf']
 
 sources = files(
         'cpfl_ethdev.c',
         'cpfl_rxtx.c',
-)
\ No newline at end of file
+)
+
+if arch_subdir == 'x86'
+    cpfl_avx512_cpu_support = (
+        cc.get_define('__AVX512F__', args: machine_args) != '' and
+        cc.get_define('__AVX512BW__', args: machine_args) != ''
+    )
+
+    cpfl_avx512_cc_support = (
+        not machine_args.contains('-mno-avx512f') and
+        cc.has_argument('-mavx512f') and
+        cc.has_argument('-mavx512bw')
+    )
+
+    if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true
+        cflags += ['-DCC_AVX512_SUPPORT']
+    endif
+endif
Signature · 1 line
2.25.1
#130 lore raw

PATCH v6 16/21 net/cpfl: support timestamp offload

In reply to Mingxia Liu

Add support for timestamp offload.

---
 doc/guides/nics/features/cpfl.ini | 1 +
 drivers/net/cpfl/cpfl_ethdev.c    | 3 ++-
 drivers/net/cpfl/cpfl_rxtx.c      | 7 +++++++
 3 files changed, 10 insertions(+), 1 deletion(-)
doc/guides/nics/features/cpfl.ini +1 -0
index f4e45c7c68..c1209df3e5 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/cpfl/cpfl_ethdev.c +2 -1
index 346af055cf..1e40f3e55c 100644
@@ -103,7 +103,8 @@ cpfl_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_IPV4_CKSUM		|
drivers/net/cpfl/cpfl_rxtx.c +7 -0
index cb7bbddb16..7b12c80f1c 100644
@@ -516,6 +516,13 @@ cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		return -EINVAL;
 	}
 
+	err = idpf_qc_ts_mbuf_register(rxq);
+	if (err != 0) {
+		PMD_DRV_LOG(ERR, "fail to register timestamp mbuf %u",
+					rx_queue_id);
+		return -EIO;
+	}
+
 	if (rxq->bufq1 == NULL) {
 		/* Single queue */
 		err = idpf_qc_single_rxq_mbufs_alloc(rxq);
Signature · 1 line
2.25.1
#131 lore raw

PATCH v6 17/21 net/cpfl: add AVX512 data path for split queue model

In reply to Mingxia Liu

Add support of AVX512 data path for split queue model.

---
 drivers/net/cpfl/cpfl_rxtx.c            | 56 +++++++++++++++++++++++--
 drivers/net/cpfl/cpfl_rxtx_vec_common.h | 20 ++++++++-
 drivers/net/cpfl/meson.build            |  6 ++-
 3 files changed, 75 insertions(+), 7 deletions(-)
drivers/net/cpfl/cpfl_rxtx.c +53 -3
index 7b12c80f1c..0d5bfb901d 100644
@@ -759,7 +759,8 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 		if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)
 #ifdef CC_AVX512_SUPPORT
 			if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
-			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
+			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1 &&
+			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ))
 				vport->rx_use_avx512 = true;
 #else
 		PMD_DRV_LOG(NOTICE,
@@ -772,6 +773,21 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 
 #ifdef RTE_ARCH_X86
 	if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		if (vport->rx_vec_allowed) {
+			for (i = 0; i < dev->data->nb_rx_queues; i++) {
+				rxq = dev->data->rx_queues[i];
+				(void)idpf_qc_splitq_rx_vec_setup(rxq);
+			}
+#ifdef CC_AVX512_SUPPORT
+			if (vport->rx_use_avx512) {
+				PMD_DRV_LOG(NOTICE,
+					    "Using Split AVX512 Vector Rx (port %d).",
+					    dev->data->port_id);
+				dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts_avx512;
+				return;
+			}
+#endif /* CC_AVX512_SUPPORT */
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Split Scalar Rx (port %d).",
 			    dev->data->port_id);
@@ -827,9 +843,17 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 		vport->tx_vec_allowed = true;
 		if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)
 #ifdef CC_AVX512_SUPPORT
+		{
 			if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
 			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
 				vport->tx_use_avx512 = true;
+			if (vport->tx_use_avx512) {
+				for (i = 0; i < dev->data->nb_tx_queues; i++) {
+					txq = dev->data->tx_queues[i];
+					idpf_qc_tx_vec_avx512_setup(txq);
+				}
+			}
+		}
 #else
 		PMD_DRV_LOG(NOTICE,
 			    "AVX512 is not supported in build env");
@@ -839,14 +863,26 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 	}
 #endif /* RTE_ARCH_X86 */
 
+#ifdef RTE_ARCH_X86
 	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		if (vport->tx_vec_allowed) {
+#ifdef CC_AVX512_SUPPORT
+			if (vport->tx_use_avx512) {
+				PMD_DRV_LOG(NOTICE,
+					    "Using Split AVX512 Vector Tx (port %d).",
+					    dev->data->port_id);
+				dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts_avx512;
+				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+				return;
+			}
+#endif /* CC_AVX512_SUPPORT */
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Split Scalar Tx (port %d).",
 			    dev->data->port_id);
 		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
 		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
 	} else {
-#ifdef RTE_ARCH_X86
 		if (vport->tx_vec_allowed) {
 #ifdef CC_AVX512_SUPPORT
 			if (vport->tx_use_avx512) {
@@ -865,11 +901,25 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 			}
 #endif /* CC_AVX512_SUPPORT */
 		}
-#endif /* RTE_ARCH_X86 */
 		PMD_DRV_LOG(NOTICE,
 			    "Using Single Scalar Tx (port %d).",
 			    dev->data->port_id);
 		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
 		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
 	}
+#else
+	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Split Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	} else {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Single Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	}
+#endif /* RTE_ARCH_X86 */
 }
drivers/net/cpfl/cpfl_rxtx_vec_common.h +18 -2
index 2d4c6a0ef3..665418d27d 100644
@@ -64,15 +64,31 @@ cpfl_tx_vec_queue_default(struct idpf_tx_queue *txq)
 	return CPFL_VECTOR_PATH;
 }
 
+static inline int
+cpfl_rx_splitq_vec_default(struct idpf_rx_queue *rxq)
+{
+	if (rxq->bufq2->rx_buf_len < rxq->max_pkt_len)
+		return CPFL_SCALAR_PATH;
+
+	return CPFL_VECTOR_PATH;
+}
+
 static inline int
 cpfl_rx_vec_dev_check_default(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
 	struct idpf_rx_queue *rxq;
-	int i, ret = 0;
+	int i, default_ret, splitq_ret, ret = CPFL_SCALAR_PATH;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		rxq = dev->data->rx_queues[i];
-		ret = (cpfl_rx_vec_queue_default(rxq));
+		default_ret = cpfl_rx_vec_queue_default(rxq);
+		if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+			splitq_ret = cpfl_rx_splitq_vec_default(rxq);
+			ret = splitq_ret && default_ret;
+		} else {
+			ret = default_ret;
+		}
 		if (ret == CPFL_SCALAR_PATH)
 			return CPFL_SCALAR_PATH;
 	}
drivers/net/cpfl/meson.build +4 -2
index fbe6500826..2cf69258e2 100644
@@ -23,13 +23,15 @@ sources = files(
 if arch_subdir == 'x86'
     cpfl_avx512_cpu_support = (
         cc.get_define('__AVX512F__', args: machine_args) != '' and
-        cc.get_define('__AVX512BW__', args: machine_args) != ''
+        cc.get_define('__AVX512BW__', args: machine_args) != '' and
+        cc.get_define('__AVX512DQ__', args: machine_args) != ''
     )
 
     cpfl_avx512_cc_support = (
         not machine_args.contains('-mno-avx512f') and
         cc.has_argument('-mavx512f') and
-        cc.has_argument('-mavx512bw')
+        cc.has_argument('-mavx512bw') and
+        cc.has_argument('-mavx512dq')
     )
 
     if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true
Signature · 1 line
2.25.1
#132 lore raw

PATCH v6 18/21 net/cpfl: add HW statistics

In reply to Mingxia Liu

This patch add hardware packets/bytes statistics.

---
 drivers/net/cpfl/cpfl_ethdev.c | 86 ++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +86 -0
index 1e40f3e55c..0fb9f0455b 100644
@@ -178,6 +178,87 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 	return ptypes;
 }
 
+static uint64_t
+cpfl_get_mbuf_alloc_failed_stats(struct rte_eth_dev *dev)
+{
+	uint64_t mbuf_alloc_failed = 0;
+	struct idpf_rx_queue *rxq;
+	int i = 0;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		mbuf_alloc_failed += __atomic_load_n(&rxq->rx_stats.mbuf_alloc_failed,
+						     __ATOMIC_RELAXED);
+	}
+
+	return mbuf_alloc_failed;
+}
+
+static int
+cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret == 0) {
+		uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads &
+					 RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 :
+					 RTE_ETHER_CRC_LEN;
+
+		idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
+				pstats->rx_broadcast - pstats->rx_discards;
+		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards;
+		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
+		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * crc_stats_len;
+		stats->obytes = pstats->tx_bytes;
+
+		dev->data->rx_mbuf_alloc_failed = cpfl_get_mbuf_alloc_failed_stats(dev);
+		stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
+	} else {
+		PMD_DRV_LOG(ERR, "Get statistics failed");
+	}
+	return ret;
+}
+
+static void
+cpfl_reset_mbuf_alloc_failed_stats(struct rte_eth_dev *dev)
+{
+	struct idpf_rx_queue *rxq;
+	int i;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		__atomic_store_n(&rxq->rx_stats.mbuf_alloc_failed, 0, __ATOMIC_RELAXED);
+	}
+}
+
+static int
+cpfl_dev_stats_reset(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret != 0)
+		return ret;
+
+	/* set stats offset base on current values */
+	vport->eth_stats_offset = *pstats;
+
+	cpfl_reset_mbuf_alloc_failed_stats(dev);
+
+	return 0;
+}
+
 static int
 cpfl_init_rss(struct idpf_vport *vport)
 {
@@ -365,6 +446,9 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 		goto err_vport;
 	}
 
+	if (cpfl_dev_stats_reset(dev))
+		PMD_DRV_LOG(ERR, "Failed to reset stats");
+
 	vport->stopped = 0;
 
 	return 0;
@@ -766,6 +850,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.tx_queue_release		= cpfl_dev_tx_queue_release,
 	.mtu_set			= cpfl_dev_mtu_set,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
+	.stats_get			= cpfl_dev_stats_get,
+	.stats_reset			= cpfl_dev_stats_reset,
 };
 
 static uint16_t
Signature · 1 line
2.25.1
#133 lore raw

PATCH v6 19/21 net/cpfl: add RSS set/get ops

In reply to Mingxia Liu

Add support for these device ops:
- rss_reta_update
- rss_reta_query
- rss_hash_update
- rss_hash_conf_get

---
 drivers/net/cpfl/cpfl_ethdev.c | 270 ++++++++++++++++++++++++++++++++-
 1 file changed, 269 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +269 -1
index 0fb9f0455b..d2387b9a39 100644
@@ -30,6 +30,56 @@ static const char * const cpfl_valid_args[] = {
 	NULL
 };
 
+static const uint64_t cpfl_map_hena_rss[] = {
+	[IDPF_HASH_NONF_UNICAST_IPV4_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+	[IDPF_HASH_NONF_MULTICAST_IPV4_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+	[IDPF_HASH_NONF_IPV4_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+	[IDPF_HASH_NONF_IPV4_TCP_SYN_NO_ACK] =
+			RTE_ETH_RSS_NONFRAG_IPV4_TCP,
+	[IDPF_HASH_NONF_IPV4_TCP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_TCP,
+	[IDPF_HASH_NONF_IPV4_SCTP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_SCTP,
+	[IDPF_HASH_NONF_IPV4_OTHER] =
+			RTE_ETH_RSS_NONFRAG_IPV4_OTHER,
+	[IDPF_HASH_FRAG_IPV4] = RTE_ETH_RSS_FRAG_IPV4,
+
+	/* IPv6 */
+	[IDPF_HASH_NONF_UNICAST_IPV6_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+	[IDPF_HASH_NONF_MULTICAST_IPV6_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+	[IDPF_HASH_NONF_IPV6_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+	[IDPF_HASH_NONF_IPV6_TCP_SYN_NO_ACK] =
+			RTE_ETH_RSS_NONFRAG_IPV6_TCP,
+	[IDPF_HASH_NONF_IPV6_TCP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_TCP,
+	[IDPF_HASH_NONF_IPV6_SCTP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_SCTP,
+	[IDPF_HASH_NONF_IPV6_OTHER] =
+			RTE_ETH_RSS_NONFRAG_IPV6_OTHER,
+	[IDPF_HASH_FRAG_IPV6] = RTE_ETH_RSS_FRAG_IPV6,
+
+	/* L2 Payload */
+	[IDPF_HASH_L2_PAYLOAD] = RTE_ETH_RSS_L2_PAYLOAD
+};
+
+static const uint64_t cpfl_ipv4_rss = RTE_ETH_RSS_NONFRAG_IPV4_UDP |
+			  RTE_ETH_RSS_NONFRAG_IPV4_TCP |
+			  RTE_ETH_RSS_NONFRAG_IPV4_SCTP |
+			  RTE_ETH_RSS_NONFRAG_IPV4_OTHER |
+			  RTE_ETH_RSS_FRAG_IPV4;
+
+static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |
+			  RTE_ETH_RSS_NONFRAG_IPV6_TCP |
+			  RTE_ETH_RSS_NONFRAG_IPV6_SCTP |
+			  RTE_ETH_RSS_NONFRAG_IPV6_OTHER |
+			  RTE_ETH_RSS_FRAG_IPV6;
+
 static int
 cpfl_dev_link_update(struct rte_eth_dev *dev,
 		     __rte_unused int wait_to_complete)
@@ -97,6 +147,9 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->hash_key_size = vport->rss_key_size;
+	dev_info->reta_size = vport->rss_lut_size;
+
 	dev_info->flow_type_rss_offloads = CPFL_RSS_OFFLOAD_ALL;
 
 	dev_info->rx_offload_capa =
@@ -259,6 +312,36 @@ cpfl_dev_stats_reset(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int cpfl_config_rss_hf(struct idpf_vport *vport, uint64_t rss_hf)
+{
+	uint64_t hena = 0;
+	uint16_t i;
+
+	/**
+	 * RTE_ETH_RSS_IPV4 and RTE_ETH_RSS_IPV6 can be considered as 2
+	 * generalizations of all other IPv4 and IPv6 RSS types.
+	 */
+	if (rss_hf & RTE_ETH_RSS_IPV4)
+		rss_hf |= cpfl_ipv4_rss;
+
+	if (rss_hf & RTE_ETH_RSS_IPV6)
+		rss_hf |= cpfl_ipv6_rss;
+
+	for (i = 0; i < RTE_DIM(cpfl_map_hena_rss); i++) {
+		if (cpfl_map_hena_rss[i] & rss_hf)
+			hena |= BIT_ULL(i);
+	}
+
+	/**
+	 * At present, cp doesn't process the virtual channel msg of rss_hf configuration,
+	 * tips are given below.
+	 */
+	if (hena != vport->rss_hf)
+		PMD_DRV_LOG(WARNING, "Updating RSS Hash Function is not supported at present.");
+
+	return 0;
+}
+
 static int
 cpfl_init_rss(struct idpf_vport *vport)
 {
@@ -279,7 +362,7 @@ cpfl_init_rss(struct idpf_vport *vport)
 			     vport->rss_key_size);
 		return -EINVAL;
 	} else {
-		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+		memcpy(vport->rss_key, rss_conf->rss_key,
 			   vport->rss_key_size);
 	}
 
@@ -295,6 +378,187 @@ cpfl_init_rss(struct idpf_vport *vport)
 	return ret;
 }
 
+static int
+cpfl_rss_reta_update(struct rte_eth_dev *dev,
+		     struct rte_eth_rss_reta_entry64 *reta_conf,
+		     uint16_t reta_size)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t idx, shift;
+	int ret = 0;
+	uint16_t i;
+
+	if (adapter->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	if (reta_size != vport->rss_lut_size) {
+		PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
+				 "(%d) doesn't match the number of hardware can "
+				 "support (%d)",
+			    reta_size, vport->rss_lut_size);
+		return -EINVAL;
+	}
+
+	for (i = 0; i < reta_size; i++) {
+		idx = i / RTE_ETH_RETA_GROUP_SIZE;
+		shift = i % RTE_ETH_RETA_GROUP_SIZE;
+		if (reta_conf[idx].mask & (1ULL << shift))
+			vport->rss_lut[i] = reta_conf[idx].reta[shift];
+	}
+
+	/* send virtchnl ops to configure RSS */
+	ret = idpf_vc_rss_lut_set(vport);
+	if (ret)
+		PMD_INIT_LOG(ERR, "Failed to configure RSS lut");
+
+	return ret;
+}
+
+static int
+cpfl_rss_reta_query(struct rte_eth_dev *dev,
+		    struct rte_eth_rss_reta_entry64 *reta_conf,
+		    uint16_t reta_size)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t idx, shift;
+	int ret = 0;
+	uint16_t i;
+
+	if (adapter->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	if (reta_size != vport->rss_lut_size) {
+		PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
+			"(%d) doesn't match the number of hardware can "
+			"support (%d)", reta_size, vport->rss_lut_size);
+		return -EINVAL;
+	}
+
+	ret = idpf_vc_rss_lut_get(vport);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to get RSS LUT");
+		return ret;
+	}
+
+	for (i = 0; i < reta_size; i++) {
+		idx = i / RTE_ETH_RETA_GROUP_SIZE;
+		shift = i % RTE_ETH_RETA_GROUP_SIZE;
+		if (reta_conf[idx].mask & (1ULL << shift))
+			reta_conf[idx].reta[shift] = vport->rss_lut[i];
+	}
+
+	return 0;
+}
+
+static int
+cpfl_rss_hash_update(struct rte_eth_dev *dev,
+		     struct rte_eth_rss_conf *rss_conf)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	int ret = 0;
+
+	if (adapter->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	if (!rss_conf->rss_key || rss_conf->rss_key_len == 0) {
+		PMD_DRV_LOG(DEBUG, "No key to be configured");
+		goto skip_rss_key;
+	} else if (rss_conf->rss_key_len != vport->rss_key_size) {
+		PMD_DRV_LOG(ERR, "The size of hash key configured "
+				 "(%d) doesn't match the size of hardware can "
+				 "support (%d)",
+			    rss_conf->rss_key_len,
+			    vport->rss_key_size);
+		return -EINVAL;
+	}
+
+	memcpy(vport->rss_key, rss_conf->rss_key,
+		   vport->rss_key_size);
+	ret = idpf_vc_rss_key_set(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS key");
+		return ret;
+	}
+
+skip_rss_key:
+	ret = cpfl_config_rss_hf(vport, rss_conf->rss_hf);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS hash");
+		return ret;
+	}
+
+	return 0;
+}
+
+static uint64_t
+cpfl_map_general_rss_hf(uint64_t config_rss_hf, uint64_t last_general_rss_hf)
+{
+	uint64_t valid_rss_hf = 0;
+	uint16_t i;
+
+	for (i = 0; i < RTE_DIM(cpfl_map_hena_rss); i++) {
+		uint64_t bit = BIT_ULL(i);
+
+		if (bit & config_rss_hf)
+			valid_rss_hf |= cpfl_map_hena_rss[i];
+	}
+
+	if (valid_rss_hf & cpfl_ipv4_rss)
+		valid_rss_hf |= last_general_rss_hf & RTE_ETH_RSS_IPV4;
+
+	if (valid_rss_hf & cpfl_ipv6_rss)
+		valid_rss_hf |= last_general_rss_hf & RTE_ETH_RSS_IPV6;
+
+	return valid_rss_hf;
+}
+
+static int
+cpfl_rss_hash_conf_get(struct rte_eth_dev *dev,
+		       struct rte_eth_rss_conf *rss_conf)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	int ret = 0;
+
+	if (adapter->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	ret = idpf_vc_rss_hash_get(vport);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to get RSS hf");
+		return ret;
+	}
+
+	rss_conf->rss_hf = cpfl_map_general_rss_hf(vport->rss_hf, vport->last_general_rss_hf);
+
+	if (!rss_conf->rss_key)
+		return 0;
+
+	ret = idpf_vc_rss_key_get(vport);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to get RSS key");
+		return ret;
+	}
+
+	if (rss_conf->rss_key_len > vport->rss_key_size)
+		rss_conf->rss_key_len = vport->rss_key_size;
+
+	memcpy(rss_conf->rss_key, vport->rss_key, rss_conf->rss_key_len);
+
+	return 0;
+}
+
 static int
 cpfl_dev_configure(struct rte_eth_dev *dev)
 {
@@ -852,6 +1116,10 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 	.stats_get			= cpfl_dev_stats_get,
 	.stats_reset			= cpfl_dev_stats_reset,
+	.reta_update			= cpfl_rss_reta_update,
+	.reta_query			= cpfl_rss_reta_query,
+	.rss_hash_update		= cpfl_rss_hash_update,
+	.rss_hash_conf_get		= cpfl_rss_hash_conf_get,
 };
 
 static uint16_t
Signature · 1 line
2.25.1
#134 lore raw

PATCH v6 20/21 net/cpfl: support scalar scatter Rx datapath for single queue model

In reply to Mingxia Liu

This patch add single q recv scatter Rx function.

---
 drivers/net/cpfl/cpfl_ethdev.c |  3 ++-
 drivers/net/cpfl/cpfl_rxtx.c   | 27 +++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  2 ++
 3 files changed, 31 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +2 -1
index d2387b9a39..f959a2911d 100644
@@ -157,7 +157,8 @@ cpfl_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_TIMESTAMP;
+		RTE_ETH_RX_OFFLOAD_TIMESTAMP		|
+		RTE_ETH_RX_OFFLOAD_SCATTER;
 
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM		|
drivers/net/cpfl/cpfl_rxtx.c +27 -0
index 0d5bfb901d..6226b02301 100644
@@ -503,6 +503,8 @@ int
 cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
 	struct idpf_rx_queue *rxq;
+	uint16_t max_pkt_len;
+	uint32_t frame_size;
 	int err;
 
 	if (rx_queue_id >= dev->data->nb_rx_queues)
@@ -516,6 +518,17 @@ cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		return -EINVAL;
 	}
 
+	frame_size = dev->data->mtu + CPFL_ETH_OVERHEAD;
+
+	max_pkt_len =
+	    RTE_MIN((uint32_t)CPFL_SUPPORT_CHAIN_NUM * rxq->rx_buf_len,
+		    frame_size);
+
+	rxq->max_pkt_len = max_pkt_len;
+	if ((dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) ||
+	    frame_size > rxq->rx_buf_len)
+		dev->data->scattered_rx = 1;
+
 	err = idpf_qc_ts_mbuf_register(rxq);
 	if (err != 0) {
 		PMD_DRV_LOG(ERR, "fail to register timestamp mbuf %u",
@@ -808,6 +821,13 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 			}
 #endif /* CC_AVX512_SUPPORT */
 		}
+		if (dev->data->scattered_rx) {
+			PMD_DRV_LOG(NOTICE,
+				    "Using Single Scalar Scatterd Rx (port %d).",
+				    dev->data->port_id);
+			dev->rx_pkt_burst = idpf_dp_singleq_recv_scatter_pkts;
+			return;
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Single Scalar Rx (port %d).",
 			    dev->data->port_id);
@@ -820,6 +840,13 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 			    dev->data->port_id);
 		dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts;
 	} else {
+		if (dev->data->scattered_rx) {
+			PMD_DRV_LOG(NOTICE,
+				    "Using Single Scalar Scatterd Rx (port %d).",
+				    dev->data->port_id);
+			dev->rx_pkt_burst = idpf_dp_singleq_recv_scatter_pkts;
+			return;
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Single Scalar Rx (port %d).",
 			    dev->data->port_id);
drivers/net/cpfl/cpfl_rxtx.h +2 -0
index 5f8144e55f..fb267d38c8 100644
@@ -21,6 +21,8 @@
 #define CPFL_DEFAULT_TX_RS_THRESH	32
 #define CPFL_DEFAULT_TX_FREE_THRESH	32
 
+#define CPFL_SUPPORT_CHAIN_NUM 5
+
 int cpfl_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);
Signature · 1 line
2.25.1
#135 lore raw

PATCH v6 21/21 net/cpfl: add xstats ops

In reply to Mingxia Liu

Add support for these device ops:
- dev_xstats_get
- dev_xstats_get_names
- dev_xstats_reset

---
 drivers/net/cpfl/cpfl_ethdev.c | 80 ++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +80 -0
index f959a2911d..543dbd60f0 100644
@@ -80,6 +80,30 @@ static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |
 			  RTE_ETH_RSS_NONFRAG_IPV6_OTHER |
 			  RTE_ETH_RSS_FRAG_IPV6;
 
+struct rte_cpfl_xstats_name_off {
+	char name[RTE_ETH_XSTATS_NAME_SIZE];
+	unsigned int offset;
+};
+
+static const struct rte_cpfl_xstats_name_off rte_cpfl_stats_strings[] = {
+	{"rx_bytes", offsetof(struct virtchnl2_vport_stats, rx_bytes)},
+	{"rx_unicast_packets", offsetof(struct virtchnl2_vport_stats, rx_unicast)},
+	{"rx_multicast_packets", offsetof(struct virtchnl2_vport_stats, rx_multicast)},
+	{"rx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, rx_broadcast)},
+	{"rx_dropped_packets", offsetof(struct virtchnl2_vport_stats, rx_discards)},
+	{"rx_errors", offsetof(struct virtchnl2_vport_stats, rx_errors)},
+	{"rx_unknown_protocol_packets", offsetof(struct virtchnl2_vport_stats,
+						 rx_unknown_protocol)},
+	{"tx_bytes", offsetof(struct virtchnl2_vport_stats, tx_bytes)},
+	{"tx_unicast_packets", offsetof(struct virtchnl2_vport_stats, tx_unicast)},
+	{"tx_multicast_packets", offsetof(struct virtchnl2_vport_stats, tx_multicast)},
+	{"tx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, tx_broadcast)},
+	{"tx_dropped_packets", offsetof(struct virtchnl2_vport_stats, tx_discards)},
+	{"tx_error_packets", offsetof(struct virtchnl2_vport_stats, tx_errors)}};
+
+#define CPFL_NB_XSTATS (sizeof(rte_cpfl_stats_strings) / \
+		sizeof(rte_cpfl_stats_strings[0]))
+
 static int
 cpfl_dev_link_update(struct rte_eth_dev *dev,
 		     __rte_unused int wait_to_complete)
@@ -313,6 +337,59 @@ cpfl_dev_stats_reset(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int cpfl_dev_xstats_reset(struct rte_eth_dev *dev)
+{
+	cpfl_dev_stats_reset(dev);
+	return 0;
+}
+
+static int cpfl_dev_xstats_get(struct rte_eth_dev *dev,
+			       struct rte_eth_xstat *xstats, unsigned int n)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	unsigned int i;
+	int ret;
+
+	if (n < CPFL_NB_XSTATS)
+		return CPFL_NB_XSTATS;
+
+	if (!xstats)
+		return 0;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Get statistics failed");
+		return 0;
+	}
+
+	idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+
+	/* loop over xstats array and values from pstats */
+	for (i = 0; i < CPFL_NB_XSTATS; i++) {
+		xstats[i].id = i;
+		xstats[i].value = *(uint64_t *)(((char *)pstats) +
+			rte_cpfl_stats_strings[i].offset);
+	}
+	return CPFL_NB_XSTATS;
+}
+
+static int cpfl_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+				     struct rte_eth_xstat_name *xstats_names,
+				     __rte_unused unsigned int limit)
+{
+	unsigned int i;
+
+	if (xstats_names)
+		for (i = 0; i < CPFL_NB_XSTATS; i++) {
+			snprintf(xstats_names[i].name,
+				 sizeof(xstats_names[i].name),
+				 "%s", rte_cpfl_stats_strings[i].name);
+		}
+	return CPFL_NB_XSTATS;
+}
+
 static int cpfl_config_rss_hf(struct idpf_vport *vport, uint64_t rss_hf)
 {
 	uint64_t hena = 0;
@@ -1121,6 +1198,9 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.reta_query			= cpfl_rss_reta_query,
 	.rss_hash_update		= cpfl_rss_hash_update,
 	.rss_hash_conf_get		= cpfl_rss_hash_conf_get,
+	.xstats_get			= cpfl_dev_xstats_get,
+	.xstats_get_names		= cpfl_dev_xstats_get_names,
+	.xstats_reset			= cpfl_dev_xstats_reset,
 };
 
 static uint16_t
Signature · 1 line
2.25.1
#136 lore raw
In reply to Mingxia Liu
Quoted 46 lines · Mingxia Liu

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared library.

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v5 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info
v6 changes:
- for small fixed size structure, change rte_memcpy to memcpy()
- fix compilation for AVX512DQ
- update cpfl maintainers

Mingxia Liu (21):
net/cpfl: support device initialization net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release net/cpfl: support MTU configuration net/cpfl: support basic Rx data path net/cpfl: support basic Tx data path net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading

Quoted 8 lines

net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

Hi Mingxia, Beilei,

Is there any missing dependency at this point?

#137 lore raw

Yes, this patchset is based on the idpf PMD code:
http://patches.dpdk.org/project/dpdk/cover/[email protected]/
http://patches.dpdk.org/project/dpdk/cover/[email protected]/
http://patches.dpdk.org/project/dpdk/cover/[email protected]/
http://patches.dpdk.org/project/dpdk/cover/[email protected]/

But as these dependency have been merged to networking.dataplane.dpdk.next-net-intel, so I delete the dependency description.

If necessary , I'll send a new version.

BR
mingxia

Quoted 67 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, February 15, 2023 10:05 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v6 00/21] add support for cpfl PMD in DPDK

Quoted 10 lines · Mingxia Liu

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

Quoted 3 lines

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared

library.

Quoted 33 lines

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v5 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info
v6 changes:
- for small fixed size structure, change rte_memcpy to memcpy()
- fix compilation for AVX512DQ
- update cpfl maintainers

Mingxia Liu (21):
net/cpfl: support device initialization net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release net/cpfl: support MTU configuration net/cpfl: support basic Rx data path net/cpfl: support basic Tx data path net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading

Quoted 8 lines

net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

Hi Mingxia, Beilei,

Is there any missing dependency at this point?

#138 lore raw

v7 cover add support for cpfl PMD in DPDK

In reply to Mingxia Liu

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared library.

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v5 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info
v6 changes:
- for small fixed size structure, change rte_memcpy to memcpy()
- fix compilation for AVX512DQ
- update cpfl maintainers
v7 changes:
- add dependency in cover-letter

This patchset is based on the idpf PMD code:
http://patches.dpdk.org/project/dpdk/cover/[email protected]/
http://patches.dpdk.org/project/dpdk/cover/[email protected]/
http://patches.dpdk.org/project/dpdk/cover/[email protected]/
http://patches.dpdk.org/project/dpdk/cover/[email protected]/

Mingxia Liu (21):
net/cpfl: support device initialization
net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop
net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release
net/cpfl: support MTU configuration
net/cpfl: support basic Rx data path
net/cpfl: support basic Tx data path
net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading
net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

 MAINTAINERS                             |    8 +
 doc/guides/nics/cpfl.rst                |   88 ++
 doc/guides/nics/features/cpfl.ini       |   17 +
 doc/guides/rel_notes/release_23_03.rst  |    6 +
 drivers/net/cpfl/cpfl_ethdev.c          | 1453 +++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h          |   95 ++
 drivers/net/cpfl/cpfl_logs.h            |   32 +
 drivers/net/cpfl/cpfl_rxtx.c            |  952 +++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h            |   44 +
 drivers/net/cpfl/cpfl_rxtx_vec_common.h |  116 ++
 drivers/net/cpfl/meson.build            |   40 +
 drivers/net/meson.build                 |    1 +
 12 files changed, 2852 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx_vec_common.h
 create mode 100644 drivers/net/cpfl/meson.build
Signature · 1 line
2.25.1
#139 lore raw

PATCH v7 1/21 net/cpfl: support device initialization

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

---
 MAINTAINERS                            |   8 +
 doc/guides/nics/cpfl.rst               |  66 +++
 doc/guides/nics/features/cpfl.ini      |  12 +
 doc/guides/rel_notes/release_23_03.rst |   6 +
 drivers/net/cpfl/cpfl_ethdev.c         | 768 +++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h         |  78 +++
 drivers/net/cpfl/cpfl_logs.h           |  32 ++
 drivers/net/cpfl/cpfl_rxtx.c           | 244 ++++++++
 drivers/net/cpfl/cpfl_rxtx.h           |  25 +
 drivers/net/cpfl/meson.build           |  14 +
 drivers/net/meson.build                |   1 +
 11 files changed, 1254 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
 create mode 100644 drivers/net/cpfl/meson.build
MAINTAINERS +8 -0
index 9a0f416d2e..af80edaf6e 100644
@@ -783,6 +783,14 @@ F: drivers/common/idpf/
 F: doc/guides/nics/idpf.rst
 F: doc/guides/nics/features/idpf.ini
 
+Intel cpfl
+M: Yuying Zhang <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/cpfl/
+F: doc/guides/nics/cpfl.rst
+F: doc/guides/nics/features/cpfl.ini
+
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/cpfl.rst new file +66 -0

67 lines not on this page · raw message

doc/guides/nics/features/cpfl.ini new file +12 -0
new file mode 100644
index 0000000000..a2d1ca9e15
@@ -0,0 +1,12 @@
+;
+; Supported features of the 'cpfl' 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]
+Linux                = Y
+x86-32               = Y
+x86-64               = Y
doc/guides/rel_notes/release_23_03.rst +6 -0
index 07914170a7..b0b23d1a44 100644
@@ -88,6 +88,12 @@ New Features
   * Added timesync API support.
   * Added packet pacing(launch time offloading) support.
 
+* **Added Intel cpfl driver.**
+
+  Added the new ``cpfl`` net driver
+  for Intel\ |reg| Infrastructure Processing Unit (Intel\ |reg| IPU) E2100.
+  See the :doc:`../nics/cpfl` NIC guide for more details on this new driver.
+
 Removed Items
 -------------
 
drivers/net/cpfl/cpfl_ethdev.c new file +768 -0

768 lines not on this page · raw message

drivers/net/cpfl/cpfl_ethdev.h new file +78 -0

78 lines not on this page · raw message

drivers/net/cpfl/cpfl_logs.h new file +32 -0
new file mode 100644
index 0000000000..365b53e8b3
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#ifndef _CPFL_LOGS_H_
+#define _CPFL_LOGS_H_
+
+#include <rte_log.h>
+
+extern int cpfl_logtype_init;
+extern int cpfl_logtype_driver;
+
+#define PMD_INIT_LOG(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_init, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG_RAW(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_driver, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+
+#endif /* _CPFL_LOGS_H_ */
drivers/net/cpfl/cpfl_rxtx.c new file +244 -0

244 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h new file +25 -0
new file mode 100644
index 0000000000..232630c5e9
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#ifndef _CPFL_RXTX_H_
+#define _CPFL_RXTX_H_
+
+#include <idpf_common_rxtx.h>
+#include "cpfl_ethdev.h"
+
+/* In QLEN must be whole number of 32 descriptors. */
+#define CPFL_ALIGN_RING_DESC	32
+#define CPFL_MIN_RING_DESC	32
+#define CPFL_MAX_RING_DESC	4096
+#define CPFL_DMA_MEM_ALIGN	4096
+/* Base address of the HW descriptor ring should be 128B aligned. */
+#define CPFL_RING_BASE_ALIGN	128
+
+#define CPFL_DEFAULT_TX_RS_THRESH	32
+#define CPFL_DEFAULT_TX_FREE_THRESH	32
+
+int cpfl_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);
+#endif /* _CPFL_RXTX_H_ */
drivers/net/cpfl/meson.build new file +14 -0
new file mode 100644
index 0000000000..c721732b50
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+
+if is_windows
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
+endif
+
+deps += ['common_idpf']
+
+sources = files(
+        'cpfl_ethdev.c',
+)
\ No newline at end of file
drivers/net/meson.build +1 -0
index 6470bf3636..a8ca338875 100644
@@ -13,6 +13,7 @@ drivers = [
         'bnxt',
         'bonding',
         'cnxk',
+        'cpfl',
         'cxgbe',
         'dpaa',
         'dpaa2',
Signature · 1 line
2.25.1
#140 lore raw

Re: [PATCH v7 01/21] net/cpfl: support device initialization

Quoted 33 lines · Mingxia Liu
drivers/net/cpfl/cpfl_ethdev.c new file +33 -0
+static int
+cpfl_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 -ENOTSUP;
+	}
+
+	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
+		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not supported",
+			     conf->txmode.mq_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->lpbk_mode != 0) {
+		PMD_INIT_LOG(ERR, "Loopback operation mode %d is not supported",
+			     conf->lpbk_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->dcb_capability_en != 0) {
+		PMD_INIT_LOG(ERR, "Priority Flow Control(PFC) if not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.lsc != 0) {
+		PMD_INIT_LOG(ERR, "LSC interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rxq != 0) {

drivers/net/cpfl/cpfl_ethdev.c line 162

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c new file +10 -0
+		PMD_INIT_LOG(ERR, "RXQ interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rmv != 0) {
+		PMD_INIT_LOG(ERR, "RMV interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	return 0;

This is '.dev_configure()' dev ops of a driver, there is nothing wrong with the function but it is a good example to highlight a point.

'rte_eth_dev_configure()' can fail from various reasons, what can an application do in this case?
It is not clear why configuration failed, there is no way to figure out failed config option dynamically.

Application developer can read the log and find out what caused the failure, but what can do next? Put a conditional check for the particular device, assuming application supports multiple devices, before configuration?

I think we need better error value, to help application detect what went wrong and adapt dynamically, perhaps a bitmask of errors one per each config option, what do you think?

And I think this is another reason why we should not make a single API too overloaded and complex.

#141 lore raw

Re: [PATCH v7 01/21] net/cpfl: support device initialization

27/02/2023 14:46, Ferruh Yigit:

Quoted 49 lines · Mingxia Liu
Quoted 33 lines
drivers/net/cpfl/cpfl_ethdev.c new file +33 -0
+static int
+cpfl_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 -ENOTSUP;
+	}
+
+	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
+		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not supported",
+			     conf->txmode.mq_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->lpbk_mode != 0) {
+		PMD_INIT_LOG(ERR, "Loopback operation mode %d is not supported",
+			     conf->lpbk_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->dcb_capability_en != 0) {
+		PMD_INIT_LOG(ERR, "Priority Flow Control(PFC) if not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.lsc != 0) {
+		PMD_INIT_LOG(ERR, "LSC interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rxq != 0) {

drivers/net/cpfl/cpfl_ethdev.c line 162

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c new file +10 -0
+		PMD_INIT_LOG(ERR, "RXQ interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rmv != 0) {
+		PMD_INIT_LOG(ERR, "RMV interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	return 0;

This is '.dev_configure()' dev ops of a driver, there is nothing wrong with the function but it is a good example to highlight a point.

Quoted 4 lines

'rte_eth_dev_configure()' can fail from various reasons, what can an application do in this case?
It is not clear why configuration failed, there is no way to figure out failed config option dynamically.

There are some capabilities to read before calling "configure".

Quoted 4 lines

Application developer can read the log and find out what caused the failure, but what can do next? Put a conditional check for the particular device, assuming application supports multiple devices, before configuration?

Which failures cannot be guessed with capability flags?

Quoted 3 lines

I think we need better error value, to help application detect what went wrong and adapt dynamically, perhaps a bitmask of errors one per each config option, what do you think?

I am not sure we can change such an old API.

Quoted 2 lines

And I think this is another reason why we should not make a single API too overloaded and complex.

Right, and I would support a work to have some of those "configure" features available as small functions.

#142 lore raw

Re: [PATCH v7 01/21] net/cpfl: support device initialization

Quoted 50 lines · Thomas Monjalon

27/02/2023 14:46, Ferruh Yigit:

Quoted 49 lines · Mingxia Liu
Quoted 33 lines
drivers/net/cpfl/cpfl_ethdev.c new file +33 -0
+static int
+cpfl_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 -ENOTSUP;
+	}
+
+	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
+		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not supported",
+			     conf->txmode.mq_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->lpbk_mode != 0) {
+		PMD_INIT_LOG(ERR, "Loopback operation mode %d is not supported",
+			     conf->lpbk_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->dcb_capability_en != 0) {
+		PMD_INIT_LOG(ERR, "Priority Flow Control(PFC) if not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.lsc != 0) {
+		PMD_INIT_LOG(ERR, "LSC interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rxq != 0) {

drivers/net/cpfl/cpfl_ethdev.c line 162

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c new file +10 -0
+		PMD_INIT_LOG(ERR, "RXQ interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rmv != 0) {
+		PMD_INIT_LOG(ERR, "RMV interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	return 0;

This is '.dev_configure()' dev ops of a driver, there is nothing wrong with the function but it is a good example to highlight a point.

Quoted 7 lines
Quoted 4 lines

'rte_eth_dev_configure()' can fail from various reasons, what can an application do in this case?
It is not clear why configuration failed, there is no way to figure out failed config option dynamically.

There are some capabilities to read before calling "configure".

Yes, but there are some PMD specific cases as well, like above SPEED_FIXED is not supported. How an app can manage this?

Mainly "struct rte_eth_dev_info" is used for capabilities (although it is a mixed bag), that is not symmetric with config/setup functions, I mean for a config/setup function there is no clear matching capability struct/function.

Quoted 7 lines
Quoted 4 lines

Application developer can read the log and find out what caused the failure, but what can do next? Put a conditional check for the particular device, assuming application supports multiple devices, before configuration?

Which failures cannot be guessed with capability flags?

At least for above sample as far as I can see some capabilities are missing:
- txmode.mq_mode
- rxmode.mq_mode
- lpbk_mode
- intr_conf.rxq

We can go through all list to detect gaps if we plan to have an action.

Quoted 6 lines
Quoted 3 lines

I think we need better error value, to help application detect what went wrong and adapt dynamically, perhaps a bitmask of errors one per each config option, what do you think?

I am not sure we can change such an old API.

Yes that is hard, but if we keep the return value negative, that can still be backward compatible.

Or API can keep the interface same but set a global 'reason' variable, similar to 'errno', so optionally new application code can get it with a new API and investigate it.

Quoted 6 lines
Quoted 2 lines

And I think this is another reason why we should not make a single API too overloaded and complex.

Right, and I would support a work to have some of those "configure" features available as small functions.

If there is enough appetite we can put something to deprecation notice for next ABI release.

#143 lore raw

RE: [PATCH v7 01/21] net/cpfl: support device initialization

In reply to Thomas Monjalon

Thanks you all!
It's a good question, but as it is experimental version and rc2 is approaching, we won't optimize this function now, and will do it at the time of the official product release.

Quoted 90 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, February 27, 2023 11:46 PM
To: Andrew Rybchenko <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Zhang, Qi Z <[email protected]>; David Marchand <[email protected]>; Ferruh Yigit <[email protected]>
Cc: [email protected]; Liu, Mingxia <[email protected]>; Zhang, Yuying <[email protected]>; Xing, Beilei <[email protected]>; [email protected]
Subject: Re: [PATCH v7 01/21] net/cpfl: support device initialization

27/02/2023 14:46, Ferruh Yigit:

Quoted 12 lines · Mingxia Liu

drivers/net/cpfl/cpfl_ethdev.c

Quoted 11 lines
drivers/net/cpfl/cpfl_ethdev.c new file +11 -0
+static int
+cpfl_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 -ENOTSUP;
+	}
+
+	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
+		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not

supported",

Quoted 6 lines

drivers/net/cpfl/cpfl_ethdev.c

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c new file +6 -0
+			     conf->txmode.mq_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->lpbk_mode != 0) {
+		PMD_INIT_LOG(ERR, "Loopback operation mode %d is not

supported",

Quoted 6 lines

drivers/net/cpfl/cpfl_ethdev.c

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c new file +6 -0
+			     conf->lpbk_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->dcb_capability_en != 0) {
+		PMD_INIT_LOG(ERR, "Priority Flow Control(PFC) if not

supported");

Quoted 24 lines
Quoted 9 lines
drivers/net/cpfl/cpfl_ethdev.c new file +9 -0
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.lsc != 0) {
+		PMD_INIT_LOG(ERR, "LSC interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rxq != 0) {

drivers/net/cpfl/cpfl_ethdev.c line 162

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c new file +10 -0
+		PMD_INIT_LOG(ERR, "RXQ interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rmv != 0) {
+		PMD_INIT_LOG(ERR, "RMV interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	return 0;

This is '.dev_configure()' dev ops of a driver, there is nothing wrong with the function but it is a good example to highlight a point.

Quoted 4 lines

'rte_eth_dev_configure()' can fail from various reasons, what can an application do in this case?
It is not clear why configuration failed, there is no way to figure out failed config option dynamically.

There are some capabilities to read before calling "configure".

Quoted 4 lines

Application developer can read the log and find out what caused the failure, but what can do next? Put a conditional check for the particular device, assuming application supports multiple devices, before configuration?

Which failures cannot be guessed with capability flags?

Quoted 3 lines

I think we need better error value, to help application detect what went wrong and adapt dynamically, perhaps a bitmask of errors one per each config option, what do you think?

I am not sure we can change such an old API.

Quoted 2 lines

And I think this is another reason why we should not make a single API too overloaded and complex.

Right, and I would support a work to have some of those "configure" features available as small functions.

#144 lore raw

Re: [PATCH v7 01/21] net/cpfl: support device initialization

Quoted 4 lines · Mingxia

Thanks you all!
It's a good question, but as it is experimental version and rc2 is approaching, we won't optimize this function now, and will do it at the time of the official product release.

Hi Mingxia,

The discussion is not specific to the driver, it is for ethdev API and for long term.

Quoted 91 lines
Quoted 90 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, February 27, 2023 11:46 PM
To: Andrew Rybchenko <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Zhang, Qi Z <[email protected]>; David Marchand <[email protected]>; Ferruh Yigit <[email protected]>
Cc: [email protected]; Liu, Mingxia <[email protected]>; Zhang, Yuying <[email protected]>; Xing, Beilei <[email protected]>; [email protected]
Subject: Re: [PATCH v7 01/21] net/cpfl: support device initialization

27/02/2023 14:46, Ferruh Yigit:

Quoted 12 lines · Mingxia Liu

drivers/net/cpfl/cpfl_ethdev.c

Quoted 11 lines
drivers/net/cpfl/cpfl_ethdev.c new file +11 -0
+static int
+cpfl_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 -ENOTSUP;
+	}
+
+	if (conf->txmode.mq_mode != RTE_ETH_MQ_TX_NONE) {
+		PMD_INIT_LOG(ERR, "Multi-queue TX mode %d is not

supported",

Quoted 6 lines

drivers/net/cpfl/cpfl_ethdev.c

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c new file +6 -0
+			     conf->txmode.mq_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->lpbk_mode != 0) {
+		PMD_INIT_LOG(ERR, "Loopback operation mode %d is not

supported",

Quoted 6 lines

drivers/net/cpfl/cpfl_ethdev.c

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c new file +6 -0
+			     conf->lpbk_mode);
+		return -ENOTSUP;
+	}
+
+	if (conf->dcb_capability_en != 0) {
+		PMD_INIT_LOG(ERR, "Priority Flow Control(PFC) if not

supported");

Quoted 24 lines
Quoted 9 lines
drivers/net/cpfl/cpfl_ethdev.c new file +9 -0
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.lsc != 0) {
+		PMD_INIT_LOG(ERR, "LSC interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rxq != 0) {

drivers/net/cpfl/cpfl_ethdev.c line 162

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c new file +10 -0
+		PMD_INIT_LOG(ERR, "RXQ interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	if (conf->intr_conf.rmv != 0) {
+		PMD_INIT_LOG(ERR, "RMV interrupt is not supported");
+		return -ENOTSUP;
+	}
+
+	return 0;

This is '.dev_configure()' dev ops of a driver, there is nothing wrong with the function but it is a good example to highlight a point.

Quoted 4 lines

'rte_eth_dev_configure()' can fail from various reasons, what can an application do in this case?
It is not clear why configuration failed, there is no way to figure out failed config option dynamically.

There are some capabilities to read before calling "configure".

Quoted 4 lines

Application developer can read the log and find out what caused the failure, but what can do next? Put a conditional check for the particular device, assuming application supports multiple devices, before configuration?

Which failures cannot be guessed with capability flags?

Quoted 3 lines

I think we need better error value, to help application detect what went wrong and adapt dynamically, perhaps a bitmask of errors one per each config option, what do you think?

I am not sure we can change such an old API.

Quoted 2 lines

And I think this is another reason why we should not make a single API too overloaded and complex.

Right, and I would support a work to have some of those "configure" features available as small functions.

#145 lore raw

Re: [PATCH v7 01/21] net/cpfl: support device initialization

In reply to Mingxia Liu
Quoted 11 lines · Mingxia Liu

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

---
 MAINTAINERS                            |   8 +
 doc/guides/nics/cpfl.rst               |  66 +++

Need to add file to toctree (doc/guides/nics/index.rst) to make it visible.

Quoted 7 lines
 doc/guides/nics/features/cpfl.ini      |  12 +
 doc/guides/rel_notes/release_23_03.rst |   6 +
 drivers/net/cpfl/cpfl_ethdev.c         | 768 +++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h         |  78 +++
 drivers/net/cpfl/cpfl_logs.h           |  32 ++
 drivers/net/cpfl/cpfl_rxtx.c           | 244 ++++++++
 drivers/net/cpfl/cpfl_rxtx.h           |  25 +

cpfl_rxtx.[ch] not used at all in this patch, 'cpfl_tx_queue_setup()' is added in this patch and next patch (2/21) looks a better place for it.

Quoted 18 lines
 drivers/net/cpfl/meson.build           |  14 +
 drivers/net/meson.build                |   1 +
 11 files changed, 1254 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
 create mode 100644 drivers/net/cpfl/meson.build
MAINTAINERS +0 -0
index 9a0f416d2e..af80edaf6e 100644
@@ -783,6 +783,14 @@ F: drivers/common/idpf/
 F: doc/guides/nics/idpf.rst

MAINTAINERS F: drivers/common/idpf/ · line 793

Quoted 10 lines
MAINTAINERS +8 -0
 F: doc/guides/nics/features/idpf.ini
 
+Intel cpfl
+M: Yuying Zhang <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/cpfl/
+F: doc/guides/nics/cpfl.rst
+F: doc/guides/nics/features/cpfl.ini
+

Documentation mentions driver is experimental, can you please highlight this in the maintainers file too, as:
Intel cpfl - EXPERIMENTAL

doc/guides/nics/cpfl.rst line 3

Quoted 12 lines
MAINTAINERS +0 -0
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/cpfl.rst new file +3 -0
new file mode 100644
index 0000000000..7c5aff0789
@@ -0,0 +1,66 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2022 Intel Corporation.
+

s/2022/2023/

doc/guides/nics/cpfl.rst line 11

Quoted 8 lines
doc/guides/nics/cpfl.rst new file +8 -0
+.. include:: <isonum.txt>
+
+CPFL Poll Mode Driver
+=====================
+
+The [*EXPERIMENTAL*] cpfl PMD (**librte_net_cpfl**) provides poll mode driver support
+for Intel\ |reg| Infrastructure Processing Unit (Intel\ |reg| IPU) E2100.
+

Can you please provide a link for the mentioned device?

So, interested users can evaluate, learn more about the mentioned hardware.

Quoted 5 lines
doc/guides/nics/cpfl.rst new file +5 -0
+
+Linux Prerequisites
+-------------------
+
+Follow the DPDK :doc:`../linux_gsg/index` to setup the basic DPDK environment.

doc/guides/nics/cpfl.rst line 26

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+
+To get better performance on Intel platforms,
+please follow the :doc:`../linux_gsg/nic_perf_intel_platform`.
+
+
+Pre-Installation Configuration
+------------------------------
+
+Runtime Config Options
+~~~~~~~~~~~~~~~~~~~~~~

Is "Runtime Config Options", a sub section of "Pre-Installation Configuration"?

doc/guides/nics/cpfl.rst line 37

Quoted 11 lines
doc/guides/nics/cpfl.rst new file +11 -0
+
+- ``vport`` (default ``0``)
+
+  The PMD supports creation of multiple vports for one PCI device,
+  each vport corresponds to a single ethdev.
+  The user can specify the vports with specific ID to be created, for example::
+
+    -a ca:00.0,vport=[0,2,3]
+
+  Then the PMD will create 3 vports (ethdevs) for device ``ca:00.0``.
+

Why need specific IDs?

other option is just provide number of requested vports and they get sequential ids, but since vport ids are got from user instead there must be some significance of them, can you please briefly document why ids matter.

doc/guides/nics/cpfl.rst line 43

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +6 -0
+  If the parameter is not provided, the vport 0 will be created by default.
+
+- ``rx_single`` (default ``0``)
+
+  There are two queue modes supported by Intel\ |reg| IPU Ethernet E2100 Series,
+  single queue mode and split queue mode for Rx queue.

Can you please describe in the documentation what 'split queue' and 'single queue' are and what is the difference between them?

<...>

doc/guides/rel_notes/release_23_03.rst New Features · line 96

Quoted 13 lines

index 07914170a7..b0b23d1a44 100644

doc/guides/rel_notes/release_23_03.rst +6 -0
@@ -88,6 +88,12 @@ New Features
   * Added timesync API support.
   * Added packet pacing(launch time offloading) support.
 
+* **Added Intel cpfl driver.**
+
+  Added the new ``cpfl`` net driver
+  for Intel\ |reg| Infrastructure Processing Unit (Intel\ |reg| IPU) E2100.
+  See the :doc:`../nics/cpfl` NIC guide for more details on this new driver.
+

"New Features" section is grouped, an that grouping is documented in the section comment.

Can you please move the update to the proper location in the section.

<...>

Quoted 30 lines
doc/guides/rel_notes/release_23_03.rst +30 -0
+static int
+cpfl_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));
+
+	switch (vport->link_speed) {
+	case RTE_ETH_SPEED_NUM_10M:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_10M;
+		break;
+	case RTE_ETH_SPEED_NUM_100M:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_100M;
+		break;
+	case RTE_ETH_SPEED_NUM_1G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_1G;
+		break;
+	case RTE_ETH_SPEED_NUM_10G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_10G;
+		break;
+	case RTE_ETH_SPEED_NUM_20G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_20G;
+		break;
+	case RTE_ETH_SPEED_NUM_25G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_25G;
+		break;
+	case RTE_ETH_SPEED_NUM_40G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_40G;

doc/guides/rel_notes/release_23_03.rst New Features

Quoted 10 lines
doc/guides/rel_notes/release_23_03.rst +10 -0
+		break;
+	case RTE_ETH_SPEED_NUM_50G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_50G;
+		break;
+	case RTE_ETH_SPEED_NUM_100G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_100G;
+		break;
+	case RTE_ETH_SPEED_NUM_200G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_200G;
+		break;

What about:

```
switch (vport->link_speed) {
case RTE_ETH_SPEED_NUM_10M:
case RTE_ETH_SPEED_NUM_100M:
...
case RTE_ETH_SPEED_NUM_200G:
	new_link.link_speed = vport->link_speed;
	break;
default:
	new_link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN;
```

OR

```
for (i = 0; i < RTE_DIM(supported_speeds); i++) {
	if (vport->link_speed == supported_speeds[i]) {
		new_link.link_speed = vport->link_speed;
		break;
	}
}

if (i == RTE_DIM(supported_speeds))
	new_link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN;
```

doc/guides/rel_notes/release_23_03.rst

Quoted 2 lines
doc/guides/rel_notes/release_23_03.rst +2 -0
+	default:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;

I think this should be :

if (link_up)

	new_link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN;
else
	new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;

<...>

Quoted 4 lines
doc/guides/rel_notes/release_23_03.rst +4 -0
+static int
+insert_value(struct cpfl_devargs *devargs, uint16_t id)
+{
+	uint16_t i;

doc/guides/rel_notes/release_23_03.rst

Quoted 10 lines
doc/guides/rel_notes/release_23_03.rst +10 -0
+
+	/* ignore duplicate */
+	for (i = 0; i < devargs->req_vport_nb; i++) {
+		if (devargs->req_vports[i] == id)
+			return 0;
+	}
+
+	if (devargs->req_vport_nb >= RTE_DIM(devargs->req_vports)) {
+		PMD_INIT_LOG(ERR, "Total vport number can't be > %d",
+			     CPFL_MAX_VPORT_NUM);

Check is using 'RTE_DIM(devargs->req_vports)' and log is using 'CPFL_MAX_VPORT_NUM', they are same value but better to stick to one of them.

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 8 lines
doc/guides/rel_notes/release_23_03.rst +8 -0
+static int
+parse_vport(const char *key, const char *value, void *args)
+{
+	struct cpfl_devargs *devargs = args;
+	const char *pos = value;
+
+	devargs->req_vport_nb = 0;
+

if "vport" can be provided multiple times, above assignment is wrong, like:
"vport=1,vport=3-5"

<...>

Quoted 12 lines
doc/guides/rel_notes/release_23_03.rst +12 -0
+static int
+cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adapter,
+		   struct cpfl_devargs *cpfl_args)
+{
+	struct rte_devargs *devargs = pci_dev->device.devargs;
+	struct rte_kvargs *kvlist;
+	int i, ret;
+
+	cpfl_args->req_vport_nb = 0;
+
+	if (devargs == NULL)
+		return 0;

doc/guides/rel_notes/release_23_03.rst

Quoted 10 lines
doc/guides/rel_notes/release_23_03.rst +10 -0
+
+	kvlist = rte_kvargs_parse(devargs->args, cpfl_valid_args);
+	if (kvlist == NULL) {
+		PMD_INIT_LOG(ERR, "invalid kvargs key");
+		return -EINVAL;
+	}
+
+	/* check parsed devargs */
+	if (adapter->cur_vport_nb + cpfl_args->req_vport_nb >
+	    CPFL_MAX_VPORT_NUM) {

At this stage 'cpfl_args->req_vport_nb' is 0 since CPFL_VPORT is not parsed yet, is the intention to do this check after 'rte_kvargs_processs()'?

doc/guides/rel_notes/release_23_03.rst

Quoted 9 lines
doc/guides/rel_notes/release_23_03.rst +9 -0
+		PMD_INIT_LOG(ERR, "Total vport number can't be > %d",
+			     CPFL_MAX_VPORT_NUM);
+		ret = -EINVAL;
+		goto bail;
+	}
+
+	for (i = 0; i < cpfl_args->req_vport_nb; i++) {> +		if (adapter->cur_vports & RTE_BIT32(cpfl_args->req_vports[i])) {
+			PMD_INIT_LOG(ERR, "Vport %d has been created",
+				     cpfl_args->req_vports[i]);

This is just argument parsing, nothing created yet, I suggest updating log accordingly.

doc/guides/rel_notes/release_23_03.rst

Quoted 4 lines
doc/guides/rel_notes/release_23_03.rst +4 -0
+			ret = -EINVAL;
+			goto bail;
+		}
+	}

same here, both for 'cpfl_args->req_vport_nb' & 'cpfl_args->req_vports[]', they are not updated yet.

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 4 lines
doc/guides/rel_notes/release_23_03.rst +4 -0
+static void
+cpfl_handle_virtchnl_msg(struct cpfl_adapter_ext *adapter_ex)
+{
+	struct idpf_adapter *adapter = &adapter_ex->base;

Everywhere else, 'struct cpfl_adapter_ext' type variable name is 'adapter', here it is 'adapter_ex' and 'struct idpf_adapter' type is 'adapter'.

As far as I understand 'struct cpfl_adapter_ext' is something like "extended adapter" and extended version of 'struct idpf_adapter', so in the context of this driver what do you think to refer:
'struct cpfl_adapter_ext' as 'adapter'
'struct idpf_adapter' as 'base' (or 'adapter_base'), consistently.

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 7 lines
doc/guides/rel_notes/release_23_03.rst +7 -0
+static const struct eth_dev_ops cpfl_eth_dev_ops = {
+	.dev_configure			= cpfl_dev_configure,
+	.dev_close			= cpfl_dev_close,
+	.dev_infos_get			= cpfl_dev_info_get,
+	.link_update			= cpfl_dev_link_update,
+	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
+};

Can you please move the block just after 'cpfl_dev_close()', to group dev_ops related code together.

<...>

Quoted 38 lines
doc/guides/rel_notes/release_23_03.rst +38 -0
+
+static int
+cpfl_dev_vport_init(struct rte_eth_dev *dev, void *init_params)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct cpfl_vport_param *param = init_params;
+	struct cpfl_adapter_ext *adapter = param->adapter;
+	/* for sending create vport virtchnl msg prepare */
+	struct virtchnl2_create_vport create_vport_info;
+	int ret = 0;
+
+	dev->dev_ops = &cpfl_eth_dev_ops;
+	vport->adapter = &adapter->base;
+	vport->sw_idx = param->idx;
+	vport->devarg_id = param->devarg_id;
+	vport->dev = dev;
+
+	memset(&create_vport_info, 0, sizeof(create_vport_info));
+	ret = idpf_vport_info_init(vport, &create_vport_info);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to init vport req_info.");
+		goto err;
+	}
+
+	ret = idpf_vport_init(vport, &create_vport_info, dev->data);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to init vports.");
+		goto err;
+	}
+
+	adapter->vports[param->idx] = vport;
+	adapter->cur_vports |= RTE_BIT32(param->devarg_id);
+	adapter->cur_vport_nb++;
+
+	dev->data->mac_addrs = rte_zmalloc(NULL, RTE_ETHER_ADDR_LEN, 0);
+	if (dev->data->mac_addrs == NULL) {
+		PMD_INIT_LOG(ERR, "Cannot allocate mac_addr memory.");
+		ret = -ENOMEM;

doc/guides/rel_notes/release_23_03.rst

Quoted 10 lines
doc/guides/rel_notes/release_23_03.rst +10 -0
+		goto err_mac_addrs;
+	}
+
+	rte_ether_addr_copy((struct rte_ether_addr *)vport->default_mac_addr,
+			    &dev->data->mac_addrs[0]);
+
+	return 0;
+
+err_mac_addrs:
+	adapter->vports[param->idx] = NULL;  /* reset */

shouln't update 'cur_vports' & 'cur_vport_nb' too in this error path.

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 9 lines
doc/guides/rel_notes/release_23_03.rst +9 -0
+
+err:
+	if (first_probe) {
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_REMOVE(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+		cpfl_adapter_ext_deinit(adapter);
+		rte_free(adapter);
+	}

Why 'first_probe' is needed, it looks like it is for the case when probe() called multiple time for same pci_dev, can this happen?

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 7 lines
doc/guides/rel_notes/release_23_03.rst +7 -0
+RTE_PMD_REGISTER_PCI(net_cpfl, rte_cpfl_pmd);
+RTE_PMD_REGISTER_PCI_TABLE(net_cpfl, pci_id_cpfl_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_cpfl, "* igb_uio | vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(net_cpfl,
+			      CPFL_TX_SINGLE_Q "=<0|1> "
+			      CPFL_RX_SINGLE_Q "=<0|1> "
+			      CPFL_VPORT "=[vport_set0,[vport_set1],...]");

What about:
"\[vport0_begin[-vport0_end][,vport1_begin[-vport1_end][,..]\]"

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 3 lines
doc/guides/rel_notes/release_23_03.rst +3 -0
+
+#define CPFL_MAX_VPORT_NUM	8
+

It looks like there is a dynamic max vport number (adapter->base.caps.max_vports), and there is above hardcoded define, for requested (devargs) vports.

The dynamic max is received via 'cpfl_adapter_ext_init()' before parsing dev_arg, so can it be possible to remove this hardcoded max completely?

doc/guides/rel_notes/release_23_03.rst

Quoted 7 lines
doc/guides/rel_notes/release_23_03.rst +7 -0
+#define CPFL_INVALID_VPORT_IDX	0xffff
+
+#define CPFL_MIN_BUF_SIZE	1024
+#define CPFL_MAX_FRAME_SIZE	9728
+#define CPFL_DEFAULT_MTU	RTE_ETHER_MTU
+
+#define CPFL_NUM_MACADDR_MAX	64

The macro is not used, can you please add them when they are used.

<...>

Quoted 22 lines
doc/guides/rel_notes/release_23_03.rst +21 -0
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#ifndef _CPFL_LOGS_H_
+#define _CPFL_LOGS_H_
+
+#include <rte_log.h>
+
+extern int cpfl_logtype_init;
+extern int cpfl_logtype_driver;
+
+#define PMD_INIT_LOG(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_init, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG_RAW(level, ...) \

doc/guides/rel_notes/release_23_03.rst line 31

Quoted 10 lines
doc/guides/rel_notes/release_23_03.rst +10 -0
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_driver, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+

Is 'PMD_DRV_LOG_RAW' required at all, why not define 'PMD_DRV_LOG' directly as it is done with 'PMD_INIT_LOG'?

Btw, both 'PMD_DRV_LOG_RAW' seems adding double '\n', one as part of 'fmt', other in the rte_log().

#146 lore raw

RE: [PATCH v7 01/21] net/cpfl: support device initialization

Quoted 18 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:44 AM
To: Liu, Mingxia <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>
Subject: Re: [PATCH v7 01/21] net/cpfl: support device initialization

Quoted 7 lines · Mingxia Liu

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

Quoted 7 lines
Quoted 4 lines
---
 MAINTAINERS                            |   8 +
 doc/guides/nics/cpfl.rst               |  66 +++

Need to add file to toctree (doc/guides/nics/index.rst) to make it visible.

[Liu, Mingxia] ok, got it! Thanks!

Quoted 11 lines
Quoted 7 lines
 doc/guides/nics/features/cpfl.ini      |  12 +
 doc/guides/rel_notes/release_23_03.rst |   6 +
 drivers/net/cpfl/cpfl_ethdev.c         | 768 +++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h         |  78 +++
 drivers/net/cpfl/cpfl_logs.h           |  32 ++
 drivers/net/cpfl/cpfl_rxtx.c           | 244 ++++++++
 drivers/net/cpfl/cpfl_rxtx.h           |  25 +

cpfl_rxtx.[ch] not used at all in this patch, 'cpfl_tx_queue_setup()' is added in this patch and next patch (2/21) looks a better place for it.

[Liu, Mingxia] ok, will update it, thanks!

Quoted 20 lines
Quoted 20 lines
 drivers/net/cpfl/meson.build           |  14 +
 drivers/net/meson.build                |   1 +
 11 files changed, 1254 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst  create mode 100644
doc/guides/nics/features/cpfl.ini  create mode 100644
drivers/net/cpfl/cpfl_ethdev.c  create mode 100644
drivers/net/cpfl/cpfl_ethdev.h  create mode 100644
drivers/net/cpfl/cpfl_logs.h  create mode 100644
drivers/net/cpfl/cpfl_rxtx.c  create mode 100644
drivers/net/cpfl/cpfl_rxtx.h  create mode 100644

drivers/net/cpfl/meson.build

MAINTAINERS index 9a0f416d2e..af80edaf6e renamed from MAINTAINERS +0 -0

100644

MAINTAINERS +0 -0
@@ -783,6 +783,14 @@ F: drivers/common/idpf/
 F: doc/guides/nics/idpf.rst
 F: doc/guides/nics/features/idpf.ini
 
Quoted 13 lines

MAINTAINERS F: drivers/common/idpf/ · line 793

Quoted 8 lines
MAINTAINERS +8 -0
+Intel cpfl
+M: Yuying Zhang <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/cpfl/
+F: doc/guides/nics/cpfl.rst
+F: doc/guides/nics/features/cpfl.ini
+

Documentation mentions driver is experimental, can you please highlight this in the maintainers file too, as:
Intel cpfl - EXPERIMENTAL

[Liu, Mingxia] ok, will update it, thanks!

Quoted 22 lines

doc/guides/nics/cpfl.rst line 3

Quoted 11 lines
MAINTAINERS +0 -0
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/cpfl.rst new renamed from doc/guides/nics/cpfl.rst +0 -0

file mode 100644 index 0000000000..7c5aff0789

doc/guides/nics/cpfl.rst new file +3 -0
@@ -0,0 +1,66 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2022 Intel Corporation.
+

s/2022/2023/

doc/guides/nics/cpfl.rst

Quoted 7 lines
doc/guides/nics/cpfl.rst new file +7 -0
+.. include:: <isonum.txt>
+
+CPFL Poll Mode Driver
+=====================
+
+The [*EXPERIMENTAL*] cpfl PMD (**librte_net_cpfl**) provides poll
+mode driver support for Intel\ |reg| Infrastructure Processing Unit (Intel\

|reg| IPU) E2100.

Quoted 6 lines

doc/guides/nics/cpfl.rst line 11

Quoted 1 line
doc/guides/nics/cpfl.rst new file +1 -0
+

Can you please provide a link for the mentioned device?

So, interested users can evaluate, learn more about the mentioned hardware.

[Liu, Mingxia] ok, will add it, thanks!

Quoted 7 lines

doc/guides/nics/cpfl.rst

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +5 -0
+
+Linux Prerequisites
+-------------------
+
+Follow the DPDK :doc:`../linux_gsg/index` to setup the basic DPDK

environment.

Quoted 13 lines

doc/guides/nics/cpfl.rst line 26

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+
+To get better performance on Intel platforms, please follow the
+:doc:`../linux_gsg/nic_perf_intel_platform`.
+
+
+Pre-Installation Configuration
+------------------------------
+
+Runtime Config Options
+~~~~~~~~~~~~~~~~~~~~~~

Is "Runtime Config Options", a sub section of "Pre-Installation Configuration"?

[Liu, Mingxia] Yes, refer to ice and i40e .rst.

Quoted 7 lines

doc/guides/nics/cpfl.rst

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +6 -0
+
+- ``vport`` (default ``0``)
+
+  The PMD supports creation of multiple vports for one PCI device,
+ each vport corresponds to a single ethdev.
+  The user can specify the vports with specific ID to be created, for

example::

Quoted 8 lines

doc/guides/nics/cpfl.rst line 37

Quoted 5 lines
doc/guides/nics/cpfl.rst new file +5 -0
+
+    -a ca:00.0,vport=[0,2,3]
+
+  Then the PMD will create 3 vports (ethdevs) for device ``ca:00.0``.
+

Why need specific IDs?

[beilei] we’re using this ID to map physical port to vport as default receive and transmit interface.

Quoted 4 lines

other option is just provide number of requested vports and they get sequential ids, but since vport ids are got from user instead there must be some significance of them, can you please briefly document why ids matter.

Quoted 10 lines

doc/guides/nics/cpfl.rst

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +6 -0
+  If the parameter is not provided, the vport 0 will be created by default.
+
+- ``rx_single`` (default ``0``)
+
+  There are two queue modes supported by Intel\ |reg| IPU Ethernet
+ E2100 Series,  single queue mode and split queue mode for Rx queue.

Can you please describe in the documentation what 'split queue' and 'single queue' are and what is the difference between them?

[beilei] sure, will add the description.

Quoted 19 lines

<...>

doc/guides/rel_notes/release_23_03.rst New Features · line 96

Quoted 13 lines

index 07914170a7..b0b23d1a44 100644

doc/guides/rel_notes/release_23_03.rst +6 -0
@@ -88,6 +88,12 @@ New Features
   * Added timesync API support.
   * Added packet pacing(launch time offloading) support.
 
+* **Added Intel cpfl driver.**
+
+  Added the new ``cpfl`` net driver
+  for Intel\ |reg| Infrastructure Processing Unit (Intel\ |reg| IPU) E2100.
+  See the :doc:`../nics/cpfl` NIC guide for more details on this new driver.
+

"New Features" section is grouped, an that grouping is documented in the section comment.

Quoted 2 lines

Can you please move the update to the proper location in the section.

[Liu, Mingxia] ok, thanks will update it.

Quoted 67 lines

<...>

Quoted 29 lines
doc/guides/rel_notes/release_23_03.rst +29 -0
+static int
+cpfl_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));
+
+	switch (vport->link_speed) {
+	case RTE_ETH_SPEED_NUM_10M:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_10M;
+		break;
+	case RTE_ETH_SPEED_NUM_100M:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_100M;
+		break;
+	case RTE_ETH_SPEED_NUM_1G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_1G;
+		break;
+	case RTE_ETH_SPEED_NUM_10G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_10G;
+		break;
+	case RTE_ETH_SPEED_NUM_20G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_20G;
+		break;
+	case RTE_ETH_SPEED_NUM_25G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_25G;
+		break;
+	case RTE_ETH_SPEED_NUM_40G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_40G;

doc/guides/rel_notes/release_23_03.rst

Quoted 10 lines
doc/guides/rel_notes/release_23_03.rst +10 -0
+		break;
+	case RTE_ETH_SPEED_NUM_50G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_50G;
+		break;
+	case RTE_ETH_SPEED_NUM_100G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_100G;
+		break;
+	case RTE_ETH_SPEED_NUM_200G:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_200G;
+		break;

What about:

```
switch (vport->link_speed) {
case RTE_ETH_SPEED_NUM_10M:
case RTE_ETH_SPEED_NUM_100M:
...
case RTE_ETH_SPEED_NUM_200G:
	new_link.link_speed = vport->link_speed;
	break;
default:
	new_link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN; ```

OR

```
for (i = 0; i < RTE_DIM(supported_speeds); i++) {
	if (vport->link_speed == supported_speeds[i]) {
		new_link.link_speed = vport->link_speed;
		break;
	}
}

if (i == RTE_DIM(supported_speeds))
new_link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN; ```

Quoted 9 lines

doc/guides/rel_notes/release_23_03.rst

Quoted 2 lines
doc/guides/rel_notes/release_23_03.rst +2 -0
+	default:
+		new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;

I think this should be :

if (link_up)

	new_link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN; else
	new_link.link_speed = RTE_ETH_SPEED_NUM_NONE;

[Liu, Mingxia] Thanks, good idea, will update.

Quoted 11 lines

<...>

Quoted 9 lines
doc/guides/rel_notes/release_23_03.rst +9 -0
+static int
+insert_value(struct cpfl_devargs *devargs, uint16_t id) {
+	uint16_t i;
+
+	/* ignore duplicate */
+	for (i = 0; i < devargs->req_vport_nb; i++) {
+		if (devargs->req_vports[i] == id)
+			return 0;
+	}
Quoted 9 lines

doc/guides/rel_notes/release_23_03.rst

Quoted 4 lines
doc/guides/rel_notes/release_23_03.rst +4 -0
+
+	if (devargs->req_vport_nb >= RTE_DIM(devargs->req_vports)) {
+		PMD_INIT_LOG(ERR, "Total vport number can't be > %d",
+			     CPFL_MAX_VPORT_NUM);

Check is using 'RTE_DIM(devargs->req_vports)' and log is using 'CPFL_MAX_VPORT_NUM', they are same value but better to stick to one of them.

[Liu, Mingxia] Thanks, good idea, will update.

Quoted 13 lines

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 7 lines
doc/guides/rel_notes/release_23_03.rst +7 -0
+static int
+parse_vport(const char *key, const char *value, void *args) {
+	struct cpfl_devargs *devargs = args;
+	const char *pos = value;
+
+	devargs->req_vport_nb = 0;
+

if "vport" can be provided multiple times, above assignment is wrong, like:
"vport=1,vport=3-5"

[beilei] We won’t support this case. Will add check in idpf_parse_devargs.

Quoted 20 lines

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 2 lines
doc/guides/rel_notes/release_23_03.rst +2 -0
+static int
+cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct

cpfl_adapter_ext *adapter,

Quoted 15 lines
doc/guides/rel_notes/release_23_03.rst +15 -0
+		   struct cpfl_devargs *cpfl_args)
+{
+	struct rte_devargs *devargs = pci_dev->device.devargs;
+	struct rte_kvargs *kvlist;
+	int i, ret;
+
+	cpfl_args->req_vport_nb = 0;
+
+	if (devargs == NULL)
+		return 0;
+
+	kvlist = rte_kvargs_parse(devargs->args, cpfl_valid_args);
+	if (kvlist == NULL) {
+		PMD_INIT_LOG(ERR, "invalid kvargs key");
+		return -EINVAL;
Quoted 9 lines

doc/guides/rel_notes/release_23_03.rst

Quoted 5 lines
doc/guides/rel_notes/release_23_03.rst +5 -0
+	}
+
+	/* check parsed devargs */
+	if (adapter->cur_vport_nb + cpfl_args->req_vport_nb >
+	    CPFL_MAX_VPORT_NUM) {

At this stage 'cpfl_args->req_vport_nb' is 0 since CPFL_VPORT is not parsed yet, is the intention to do this check after 'rte_kvargs_processs()'?

[beilei] Yes, thanks for the catch, will fix it in next version.

Quoted 8 lines

doc/guides/rel_notes/release_23_03.rst

Quoted 7 lines
doc/guides/rel_notes/release_23_03.rst +7 -0
+		PMD_INIT_LOG(ERR, "Total vport number can't be > %d",
+			     CPFL_MAX_VPORT_NUM);
+		ret = -EINVAL;
+		goto bail;
+	}
+
+	for (i = 0; i < cpfl_args->req_vport_nb; i++) {> +		if

(adapter->cur_vports & RTE_BIT32(cpfl_args->req_vports[i])) {

Quoted 6 lines

doc/guides/rel_notes/release_23_03.rst

Quoted 2 lines
doc/guides/rel_notes/release_23_03.rst +2 -0
+			PMD_INIT_LOG(ERR, "Vport %d has been created",
+				     cpfl_args->req_vports[i]);

This is just argument parsing, nothing created yet, I suggest updating log accordingly.

[beilei] OK, will update the log in the next version.

Quoted 8 lines

doc/guides/rel_notes/release_23_03.rst

Quoted 4 lines
doc/guides/rel_notes/release_23_03.rst +4 -0
+			ret = -EINVAL;
+			goto bail;
+		}
+	}

same here, both for 'cpfl_args->req_vport_nb' & 'cpfl_args->req_vports[]', they are not updated yet.

[beilei] Yes, thanks for the catch, will fix it in next version.

Quoted 9 lines

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 3 lines
doc/guides/rel_notes/release_23_03.rst +3 -0
+static void
+cpfl_handle_virtchnl_msg(struct cpfl_adapter_ext *adapter_ex) {
+	struct idpf_adapter *adapter = &adapter_ex->base;

Everywhere else, 'struct cpfl_adapter_ext' type variable name is 'adapter', here it is 'adapter_ex' and 'struct idpf_adapter' type is 'adapter'.

Quoted 6 lines

As far as I understand 'struct cpfl_adapter_ext' is something like "extended adapter" and extended version of 'struct idpf_adapter', so in the context of this driver what do you think to refer:
'struct cpfl_adapter_ext' as 'adapter'
'struct idpf_adapter' as 'base' (or 'adapter_base'), consistently.

[Liu, Mingxia] ok, got it, I'll update them, for your comments.

Quoted 13 lines

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 7 lines
doc/guides/rel_notes/release_23_03.rst +7 -0
+static const struct eth_dev_ops cpfl_eth_dev_ops = {
+	.dev_configure			= cpfl_dev_configure,
+	.dev_close			= cpfl_dev_close,
+	.dev_infos_get			= cpfl_dev_info_get,
+	.link_update			= cpfl_dev_link_update,
+	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
+};

Can you please move the block just after 'cpfl_dev_close()', to group dev_ops related code together.

[Liu, Mingxia] ok, thanks!

Quoted 37 lines

<...>

Quoted 24 lines
doc/guides/rel_notes/release_23_03.rst +24 -0
+
+static int
+cpfl_dev_vport_init(struct rte_eth_dev *dev, void *init_params) {
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct cpfl_vport_param *param = init_params;
+	struct cpfl_adapter_ext *adapter = param->adapter;
+	/* for sending create vport virtchnl msg prepare */
+	struct virtchnl2_create_vport create_vport_info;
+	int ret = 0;
+
+	dev->dev_ops = &cpfl_eth_dev_ops;
+	vport->adapter = &adapter->base;
+	vport->sw_idx = param->idx;
+	vport->devarg_id = param->devarg_id;
+	vport->dev = dev;
+
+	memset(&create_vport_info, 0, sizeof(create_vport_info));
+	ret = idpf_vport_info_init(vport, &create_vport_info);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to init vport req_info.");
+		goto err;
+	}
+
+	ret = idpf_vport_init(vport, &create_vport_info, dev->data);

doc/guides/rel_notes/release_23_03.rst

Quoted 10 lines
doc/guides/rel_notes/release_23_03.rst +10 -0
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to init vports.");
+		goto err;
+	}
+
+	adapter->vports[param->idx] = vport;
+	adapter->cur_vports |= RTE_BIT32(param->devarg_id);
+	adapter->cur_vport_nb++;
+
+	dev->data->mac_addrs = rte_zmalloc(NULL, RTE_ETHER_ADDR_LEN,

0);

Quoted 17 lines
Quoted 8 lines
doc/guides/rel_notes/release_23_03.rst +7 -0
+	if (dev->data->mac_addrs == NULL) {
+		PMD_INIT_LOG(ERR, "Cannot allocate mac_addr memory.");
+		ret = -ENOMEM;
+		goto err_mac_addrs;
+	}
+
+	rte_ether_addr_copy((struct rte_ether_addr *)vport-

default_mac_addr,

doc/guides/rel_notes/release_23_03.rst

Quoted 6 lines
doc/guides/rel_notes/release_23_03.rst +6 -0
+			    &dev->data->mac_addrs[0]);
+
+	return 0;
+
+err_mac_addrs:
+	adapter->vports[param->idx] = NULL;  /* reset */

shouln't update 'cur_vports' & 'cur_vport_nb' too in this error path.

[beilei] Yes, need to update the two fields.

Quoted 16 lines

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 9 lines
doc/guides/rel_notes/release_23_03.rst +9 -0
+
+err:
+	if (first_probe) {
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_REMOVE(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+		cpfl_adapter_ext_deinit(adapter);
+		rte_free(adapter);
+	}

Why 'first_probe' is needed, it looks like it is for the case when probe() called multiple time for same pci_dev, can this happen?

[Liu, Mingxia] It's related to runtime creating vport in the future, but now the version doesn't support runtime.

Quoted 13 lines

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 7 lines
doc/guides/rel_notes/release_23_03.rst +7 -0
+RTE_PMD_REGISTER_PCI(net_cpfl, rte_cpfl_pmd);
+RTE_PMD_REGISTER_PCI_TABLE(net_cpfl, pci_id_cpfl_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_cpfl, "* igb_uio | vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(net_cpfl,
+			      CPFL_TX_SINGLE_Q "=<0|1> "
+			      CPFL_RX_SINGLE_Q "=<0|1> "
+			      CPFL_VPORT "=[vport_set0,[vport_set1],...]");

What about:
"\[vport0_begin[-vport0_end][,vport1_begin[-vport1_end][,..]\]"

[Liu, Mingxia] Good idea, thanks!

Quoted 6 lines

<...>

doc/guides/rel_notes/release_23_03.rst

Quoted 3 lines
doc/guides/rel_notes/release_23_03.rst +3 -0
+
+#define CPFL_MAX_VPORT_NUM	8
+

It looks like there is a dynamic max vport number (adapter-

Quoted 7 lines
Quoted 1 line

base.caps.max_vports), and there is above hardcoded define, for requested

(devargs) vports.

The dynamic max is received via 'cpfl_adapter_ext_init()' before parsing dev_arg, so can it be possible to remove this hardcoded max completely?

[Liu, Mingxia] yes, we'll try.

Quoted 10 lines

doc/guides/rel_notes/release_23_03.rst

Quoted 7 lines
doc/guides/rel_notes/release_23_03.rst +7 -0
+#define CPFL_INVALID_VPORT_IDX	0xffff
+
+#define CPFL_MIN_BUF_SIZE	1024
+#define CPFL_MAX_FRAME_SIZE	9728
+#define CPFL_DEFAULT_MTU	RTE_ETHER_MTU
+
+#define CPFL_NUM_MACADDR_MAX	64

The macro is not used, can you please add them when they are used.

[Liu, Mingxia] ok, thanks! Will delete it.

Quoted 28 lines

<...>

Quoted 26 lines
doc/guides/rel_notes/release_23_03.rst +25 -0
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation  */
+
+#ifndef _CPFL_LOGS_H_
+#define _CPFL_LOGS_H_
+
+#include <rte_log.h>
+
+extern int cpfl_logtype_init;
+extern int cpfl_logtype_driver;
+
+#define PMD_INIT_LOG(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_init, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG_RAW(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_driver, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
Quoted 9 lines

doc/guides/rel_notes/release_23_03.rst line 30

Quoted 5 lines
doc/guides/rel_notes/release_23_03.rst +5 -0
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG(level, fmt, args...) \
+	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
+

Is 'PMD_DRV_LOG_RAW' required at all, why not define 'PMD_DRV_LOG' directly as it is done with 'PMD_INIT_LOG'?

[Liu, Mingxia] Good idea, I'll simplify the code.

Quoted 2 lines

Btw, both 'PMD_DRV_LOG_RAW' seems adding double '\n', one as part of 'fmt', other in the rte_log().

#147 lore raw

Re: [PATCH v7 01/21] net/cpfl: support device initialization

Quoted 12 lines · Mingxia
Quoted 12 lines

doc/guides/nics/cpfl.rst line 26

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+
+To get better performance on Intel platforms, please follow the
+:doc:`../linux_gsg/nic_perf_intel_platform`.
+
+
+Pre-Installation Configuration
+------------------------------
+
+Runtime Config Options
+~~~~~~~~~~~~~~~~~~~~~~

Is "Runtime Config Options", a sub section of "Pre-Installation Configuration"?

Quoted 2 lines

[Liu, Mingxia] Yes, refer to ice and i40e .rst.

You are right it has been used in a few other drivers too, but what exactly "Pre-Installation Configuration" means?

I think it is historical, remaining from times that device options was compile time options and needs to be configured before build.

But these are dynamic runtime configurations, and I think shouldn't be under "Pre-Installation Configuration", instead can have its own section.

@John, what do you think, a few existing samples:
- https://doc.dpdk.org/guides/nics/i40e.html#pre-installation-configuration
- https://doc.dpdk.org/guides/nics/idpf.html#pre-installation-configuration

#148 lore raw

PATCH v7 2/21 net/cpfl: add Tx queue setup

In reply to Mingxia Liu

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/cpfl/cpfl_ethdev.c | 13 +++++++++++++
 drivers/net/cpfl/cpfl_rxtx.c   |  8 ++++----
 drivers/net/cpfl/meson.build   |  1 +
 3 files changed, 18 insertions(+), 4 deletions(-)
drivers/net/cpfl/cpfl_ethdev.c +13 -0
index fe0061133c..5ca21c9772 100644
@@ -12,6 +12,7 @@
 #include <rte_alarm.h>
 
 #include "cpfl_ethdev.h"
+#include "cpfl_rxtx.h"
 
 #define CPFL_TX_SINGLE_Q	"tx_single"
 #define CPFL_RX_SINGLE_Q	"rx_single"
@@ -96,6 +97,17 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_free_thresh = CPFL_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = CPFL_DEFAULT_TX_RS_THRESH,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = CPFL_MAX_RING_DESC,
+		.nb_min = CPFL_MIN_RING_DESC,
+		.nb_align = CPFL_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -513,6 +525,7 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a
 static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_configure			= cpfl_dev_configure,
 	.dev_close			= cpfl_dev_close,
+	.tx_queue_setup			= cpfl_tx_queue_setup,
 	.dev_infos_get			= cpfl_dev_info_get,
 	.link_update			= cpfl_dev_link_update,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
drivers/net/cpfl/cpfl_rxtx.c +4 -4
index 2b9c20928b..5b69ac0009 100644
@@ -130,7 +130,7 @@ cpfl_tx_complq_setup(struct rte_eth_dev *dev, struct idpf_tx_queue *txq,
 	cq->tx_ring_phys_addr = mz->iova;
 	cq->compl_ring = mz->addr;
 	cq->mz = mz;
-	reset_split_tx_complq(cq);
+	idpf_qc_split_tx_complq_reset(cq);
 
 	txq->complq = cq;
 
@@ -164,7 +164,7 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		tx_conf->tx_rs_thresh : CPFL_DEFAULT_TX_RS_THRESH);
 	tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh > 0) ?
 		tx_conf->tx_free_thresh : CPFL_DEFAULT_TX_FREE_THRESH);
-	if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
+	if (idpf_qc_tx_thresh_check(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
 	/* Allocate the TX queue data structure. */
@@ -215,10 +215,10 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 
 	if (!is_splitq) {
 		txq->tx_ring = mz->addr;
-		reset_single_tx_queue(txq);
+		idpf_qc_single_tx_queue_reset(txq);
 	} else {
 		txq->desc_ring = mz->addr;
-		reset_split_tx_descq(txq);
+		idpf_qc_split_tx_descq_reset(txq);
 
 		/* Setup tx completion queue if split model */
 		ret = cpfl_tx_complq_setup(dev, txq, queue_idx,
drivers/net/cpfl/meson.build +1 -0
index c721732b50..1894423689 100644
@@ -11,4 +11,5 @@ deps += ['common_idpf']
 
 sources = files(
         'cpfl_ethdev.c',
+        'cpfl_rxtx.c',
 )
\ No newline at end of file
Signature · 1 line
2.25.1
#149 lore raw

Re: [PATCH v7 02/21] net/cpfl: add Tx queue setup

Quoted 6 lines · Mingxia Liu

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.

Quoted 6 lines

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.

This patch is related to the Tx and above description seems related Rx, can next patch be a better place for above paragraph? Or please revise it for Tx if it applies to this patch too.

#150 lore raw

RE: [PATCH v7 02/21] net/cpfl: add Tx queue setup

Ok,thanks!

Quoted 24 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:45 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 02/21] net/cpfl: add Tx queue setup

Quoted 6 lines · Mingxia Liu

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.

Quoted 6 lines

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.

This patch is related to the Tx and above description seems related Rx, can next patch be a better place for above paragraph? Or please revise it for Tx if it applies to this patch too.

#151 lore raw

PATCH v7 3/21 net/cpfl: add Rx queue setup

In reply to Mingxia Liu

Add support for rx_queue_setup ops.

---
 drivers/net/cpfl/cpfl_ethdev.c |  11 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 232 +++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |   6 +
 3 files changed, 249 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +11 -0
index 5ca21c9772..3029f03d02 100644
@@ -102,12 +102,22 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		.tx_rs_thresh = CPFL_DEFAULT_TX_RS_THRESH,
 	};
 
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_free_thresh = CPFL_DEFAULT_RX_FREE_THRESH,
+	};
+
 	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
 		.nb_max = CPFL_MAX_RING_DESC,
 		.nb_min = CPFL_MIN_RING_DESC,
 		.nb_align = CPFL_ALIGN_RING_DESC,
 	};
 
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = CPFL_MAX_RING_DESC,
+		.nb_min = CPFL_MIN_RING_DESC,
+		.nb_align = CPFL_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -525,6 +535,7 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a
 static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_configure			= cpfl_dev_configure,
 	.dev_close			= cpfl_dev_close,
+	.rx_queue_setup			= cpfl_rx_queue_setup,
 	.tx_queue_setup			= cpfl_tx_queue_setup,
 	.dev_infos_get			= cpfl_dev_info_get,
 	.link_update			= cpfl_dev_link_update,
drivers/net/cpfl/cpfl_rxtx.c +232 -0

244 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h +6 -0
index 232630c5e9..e0221abfa3 100644
@@ -16,10 +16,16 @@
 /* Base address of the HW descriptor ring should be 128B aligned. */
 #define CPFL_RING_BASE_ALIGN	128
 
+#define CPFL_DEFAULT_RX_FREE_THRESH	32
+
 #define CPFL_DEFAULT_TX_RS_THRESH	32
 #define CPFL_DEFAULT_TX_FREE_THRESH	32
 
 int cpfl_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 cpfl_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);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#152 lore raw

Re: [PATCH v7 03/21] net/cpfl: add Rx queue setup

Quoted 3 lines · Mingxia Liu

Add support for rx_queue_setup ops.

<...>

drivers/net/cpfl/cpfl_rxtx.c cpfl_dma_zone_release(const struct rte_memzone *mz) · line 185

Quoted 5 lines
drivers/net/cpfl/cpfl_rxtx.c +5 -0
+
+	if (bufq_id == 1) {
+		rxq->bufq1 = bufq;
+	} else if (bufq_id == 2) {
+		rxq->bufq2 = bufq;

For readability better to use enums to diffrentiate queues, instead of using 1 and 2 as paramter to function.

Also I wonder if queue variable names can be improved too, from 'bufq1' & 'bufq2' to something more descriptive.

#153 lore raw

RE: [PATCH v7 03/21] net/cpfl: add Rx queue setup

Thanks or your comments, we will use enums to differentiate queues.

As for 'bufq1'&'bufq2', they are members of struct idpf_rx_queue, defined in idpf commen module, And it involves idpf pmd code, so it's better to improve it in the later fixed patch.

Quoted 25 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:46 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 03/21] net/cpfl: add Rx queue setup

Quoted 3 lines · Mingxia Liu

Add support for rx_queue_setup ops.

<...>

drivers/net/cpfl/cpfl_rxtx.c cpfl_dma_zone_release(const struct rte_memzone *mz) · line 185

Quoted 5 lines
drivers/net/cpfl/cpfl_rxtx.c +5 -0
+
+	if (bufq_id == 1) {
+		rxq->bufq1 = bufq;
+	} else if (bufq_id == 2) {
+		rxq->bufq2 = bufq;

For readability better to use enums to diffrentiate queues, instead of using 1 and 2 as paramter to function.

Also I wonder if queue variable names can be improved too, from 'bufq1' & 'bufq2' to something more descriptive.

#154 lore raw

Re: [PATCH v7 03/21] net/cpfl: add Rx queue setup

Quoted 5 lines · Mingxia

Thanks or your comments, we will use enums to differentiate queues.

As for 'bufq1'&'bufq2', they are members of struct idpf_rx_queue, defined in idpf commen module, And it involves idpf pmd code, so it's better to improve it in the later fixed patch.

OK

Quoted 25 lines
Quoted 25 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:46 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 03/21] net/cpfl: add Rx queue setup

Quoted 3 lines · Mingxia Liu

Add support for rx_queue_setup ops.

<...>

drivers/net/cpfl/cpfl_rxtx.c cpfl_dma_zone_release(const struct rte_memzone *mz) · line 185

Quoted 5 lines
drivers/net/cpfl/cpfl_rxtx.c +5 -0
+
+	if (bufq_id == 1) {
+		rxq->bufq1 = bufq;
+	} else if (bufq_id == 2) {
+		rxq->bufq2 = bufq;

For readability better to use enums to diffrentiate queues, instead of using 1 and 2 as paramter to function.

Also I wonder if queue variable names can be improved too, from 'bufq1' & 'bufq2' to something more descriptive.

#155 lore raw

PATCH v7 4/21 net/cpfl: support device start and stop

In reply to Mingxia Liu

Add dev ops dev_start, dev_stop and link_update.

---
 drivers/net/cpfl/cpfl_ethdev.c | 35 ++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +35 -0
index 3029f03d02..d1dfcfff9b 100644
@@ -184,12 +184,45 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+cpfl_dev_start(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	int ret;
+
+	ret = idpf_vc_vport_ena_dis(vport, true);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		return ret;
+	}
+
+	vport->stopped = 0;
+
+	return 0;
+}
+
+static int
+cpfl_dev_stop(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (vport->stopped == 1)
+		return 0;
+
+	idpf_vc_vport_ena_dis(vport, false);
+
+	vport->stopped = 1;
+
+	return 0;
+}
+
 static int
 cpfl_dev_close(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
 	struct cpfl_adapter_ext *adapter = CPFL_ADAPTER_TO_EXT(vport->adapter);
 
+	cpfl_dev_stop(dev);
 	idpf_vport_deinit(vport);
 
 	adapter->cur_vports &= ~RTE_BIT32(vport->devarg_id);
@@ -538,6 +571,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.rx_queue_setup			= cpfl_rx_queue_setup,
 	.tx_queue_setup			= cpfl_tx_queue_setup,
 	.dev_infos_get			= cpfl_dev_info_get,
+	.dev_start			= cpfl_dev_start,
+	.dev_stop			= cpfl_dev_stop,
 	.link_update			= cpfl_dev_link_update,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
Signature · 1 line
2.25.1
#156 lore raw

PATCH v7 5/21 net/cpfl: support queue start

In reply to Mingxia Liu

Add support for these device ops:
- rx_queue_start
- tx_queue_start

---
 drivers/net/cpfl/cpfl_ethdev.c |  41 ++++++++++
 drivers/net/cpfl/cpfl_rxtx.c   | 138 +++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |   4 +
 3 files changed, 183 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +41 -0
index d1dfcfff9b..c4565e687b 100644
@@ -184,12 +184,51 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+cpfl_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 = cpfl_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 = cpfl_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
 cpfl_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
 	int ret;
 
+	ret = cpfl_start_queues(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to start queues");
+		return ret;
+	}
+
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
@@ -574,6 +613,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_start			= cpfl_dev_start,
 	.dev_stop			= cpfl_dev_stop,
 	.link_update			= cpfl_dev_link_update,
+	.rx_queue_start			= cpfl_rx_queue_start,
+	.tx_queue_start			= cpfl_tx_queue_start,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
drivers/net/cpfl/cpfl_rxtx.c +138 -0

141 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h +4 -0
index e0221abfa3..716b2fefa4 100644
@@ -28,4 +28,8 @@ int cpfl_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 cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int cpfl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int cpfl_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#157 lore raw

Re: [PATCH v7 05/21] net/cpfl: support queue start

Quoted 5 lines · Mingxia Liu

Add support for these device ops:
- rx_queue_start
- tx_queue_start

<...>

Quoted 9 lines
drivers/net/cpfl/cpfl_rxtx.c +9 -0
+int
+cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+	struct idpf_rx_queue *rxq;
+	int err;
+
+	if (rx_queue_id >= dev->data->nb_rx_queues)
+		return -EINVAL;
+

drivers/net/cpfl/cpfl_rxtx.c cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, · line 496

Quoted 10 lines
drivers/net/cpfl/cpfl_rxtx.c +10 -0
+	rxq = dev->data->rx_queues[rx_queue_id];
+
+	if (rxq == NULL || !rxq->q_set) {
+		PMD_DRV_LOG(ERR, "RX queue %u not available or setup",
+					rx_queue_id);
+		return -EINVAL;
+	}
+
+	if (rxq->bufq1 == NULL) {
+		/* Single queue */

What do you think to keep the queue type explicitly in the queue struct, instead of deducing it from pointer values?

#158 lore raw

RE: [PATCH v7 05/21] net/cpfl: support queue start

Thanks, Ferruh !
It's a good idea!

As for it involves a wide range of change, including idpf common module and idpf pmd code, So we'd better update it in the later fix patch after rc2.

Quoted 38 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:47 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 05/21] net/cpfl: support queue start

Quoted 5 lines · Mingxia Liu

Add support for these device ops:
- rx_queue_start
- tx_queue_start

<...>

Quoted 8 lines
drivers/net/cpfl/cpfl_rxtx.c +8 -0
+int
+cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id) {
+	struct idpf_rx_queue *rxq;
+	int err;
+
+	if (rx_queue_id >= dev->data->nb_rx_queues)
+		return -EINVAL;
+

drivers/net/cpfl/cpfl_rxtx.c cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, · line 496

Quoted 10 lines
drivers/net/cpfl/cpfl_rxtx.c +10 -0
+	rxq = dev->data->rx_queues[rx_queue_id];
+
+	if (rxq == NULL || !rxq->q_set) {
+		PMD_DRV_LOG(ERR, "RX queue %u not available or setup",
+					rx_queue_id);
+		return -EINVAL;
+	}
+
+	if (rxq->bufq1 == NULL) {
+		/* Single queue */

What do you think to keep the queue type explicitly in the queue struct, instead of deducing it from pointer values?

#159 lore raw

RE: [PATCH v7 05/21] net/cpfl: support queue start

If time permits, we will first submit a fixed patch to add a q type member in rx_queue strc.

Quoted 51 lines

-----Original Message-----
From: Liu, Mingxia
Sent: Tuesday, February 28, 2023 11:15 AM
To: Ferruh Yigit <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: RE: [PATCH v7 05/21] net/cpfl: support queue start

Thanks, Ferruh !
It's a good idea!

As for it involves a wide range of change, including idpf common module and idpf pmd code, So we'd better update it in the later fix patch after rc2.

Quoted 38 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:47 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 05/21] net/cpfl: support queue start

Quoted 5 lines · Mingxia Liu

Add support for these device ops:
- rx_queue_start
- tx_queue_start

<...>

Quoted 8 lines
drivers/net/cpfl/cpfl_rxtx.c +8 -0
+int
+cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id) {
+	struct idpf_rx_queue *rxq;
+	int err;
+
+	if (rx_queue_id >= dev->data->nb_rx_queues)
+		return -EINVAL;
+

drivers/net/cpfl/cpfl_rxtx.c cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, · line 496

Quoted 10 lines
drivers/net/cpfl/cpfl_rxtx.c +10 -0
+	rxq = dev->data->rx_queues[rx_queue_id];
+
+	if (rxq == NULL || !rxq->q_set) {
+		PMD_DRV_LOG(ERR, "RX queue %u not available or setup",
+					rx_queue_id);
+		return -EINVAL;
+	}
+
+	if (rxq->bufq1 == NULL) {
+		/* Single queue */

What do you think to keep the queue type explicitly in the queue struct, instead of deducing it from pointer values?

#160 lore raw

PATCH v7 6/21 net/cpfl: support queue stop

In reply to Mingxia Liu

Add support for these device ops:
- rx_queue_stop
- tx_queue_stop

---
 drivers/net/cpfl/cpfl_ethdev.c | 10 +++-
 drivers/net/cpfl/cpfl_rxtx.c   | 87 ++++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  3 ++
 3 files changed, 99 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +9 -1
index c4565e687b..f757fea530 100644
@@ -232,12 +232,16 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
-		return ret;
+		goto err_vport;
 	}
 
 	vport->stopped = 0;
 
 	return 0;
+
+err_vport:
+	cpfl_stop_queues(dev);
+	return ret;
 }
 
 static int
@@ -250,6 +254,8 @@ cpfl_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_vc_vport_ena_dis(vport, false);
 
+	cpfl_stop_queues(dev);
+
 	vport->stopped = 1;
 
 	return 0;
@@ -615,6 +621,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.link_update			= cpfl_dev_link_update,
 	.rx_queue_start			= cpfl_rx_queue_start,
 	.tx_queue_start			= cpfl_tx_queue_start,
+	.rx_queue_stop			= cpfl_rx_queue_stop,
+	.tx_queue_stop			= cpfl_tx_queue_stop,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
drivers/net/cpfl/cpfl_rxtx.c +87 -0

90 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h +3 -0
index 716b2fefa4..e9b810deaa 100644
@@ -32,4 +32,7 @@ int cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int cpfl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int cpfl_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+void cpfl_stop_queues(struct rte_eth_dev *dev);
+int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#161 lore raw

Re: [PATCH v7 06/21] net/cpfl: support queue stop

Quoted 5 lines · Mingxia Liu

Add support for these device ops:
- rx_queue_stop
- tx_queue_stop

<...>

Quoted 14 lines
drivers/net/cpfl/cpfl_rxtx.c +14 -0
+int
+cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_rx_queue *rxq;
+	int err;
+
+	if (rx_queue_id >= dev->data->nb_rx_queues)
+		return -EINVAL;
+
+	err = idpf_vc_queue_switch(vport, rx_queue_id, true, false);
+	if (err != 0) {
+		PMD_DRV_LOG(ERR, "Failed to switch RX queue %u off",
+			    rx_queue_id);

drivers/net/cpfl/cpfl_rxtx.c cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) · line 639

Quoted 10 lines
drivers/net/cpfl/cpfl_rxtx.c +10 -0
+		return err;
+	}
+
+	rxq = dev->data->rx_queues[rx_queue_id];
+	if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SINGLE) {
+		rxq->ops->release_mbufs(rxq);
+		idpf_qc_single_rx_queue_reset(rxq);
+	} else {
+		rxq->bufq1->ops->release_mbufs(rxq->bufq1);
+		rxq->bufq2->ops->release_mbufs(rxq->bufq2);

In this patch, queue ops (bufq1->ops) not set yet, it is set in next patch, switching order with next one may help.

#162 lore raw

PATCH v7 7/21 net/cpfl: support queue release

In reply to Mingxia Liu

Add support for queue operations:
- rx_queue_release
- tx_queue_release

---
 drivers/net/cpfl/cpfl_ethdev.c |  2 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 35 ++++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  2 ++
 3 files changed, 39 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +2 -0
index f757fea530..2e5bfac1c0 100644
@@ -623,6 +623,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.tx_queue_start			= cpfl_tx_queue_start,
 	.rx_queue_stop			= cpfl_rx_queue_stop,
 	.tx_queue_stop			= cpfl_tx_queue_stop,
+	.rx_queue_release		= cpfl_dev_rx_queue_release,
+	.tx_queue_release		= cpfl_dev_tx_queue_release,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
drivers/net/cpfl/cpfl_rxtx.c +35 -0
index de0f2a5723..3edba70b16 100644
@@ -49,6 +49,14 @@ cpfl_tx_offload_convert(uint64_t offload)
 	return ol;
 }
 
+static const struct idpf_rxq_ops def_rxq_ops = {
+	.release_mbufs = idpf_qc_rxq_mbufs_release,
+};
+
+static const struct idpf_txq_ops def_txq_ops = {
+	.release_mbufs = idpf_qc_txq_mbufs_release,
+};
+
 static const struct rte_memzone *
 cpfl_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx,
 		      uint16_t len, uint16_t queue_type,
@@ -177,6 +185,7 @@ cpfl_rx_split_bufq_setup(struct rte_eth_dev *dev, struct idpf_rx_queue *rxq,
 	idpf_qc_split_rx_bufq_reset(bufq);
 	bufq->qrx_tail = hw->hw_addr + (vport->chunks_info.rx_buf_qtail_start +
 			 queue_idx * vport->chunks_info.rx_buf_qtail_spacing);
+	bufq->ops = &def_rxq_ops;
 	bufq->q_set = true;
 
 	if (bufq_id == 1) {
@@ -235,6 +244,12 @@ cpfl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (idpf_qc_rx_thresh_check(nb_desc, rx_free_thresh) != 0)
 		return -EINVAL;
 
+	/* Free memory if needed */
+	if (dev->data->rx_queues[queue_idx] != NULL) {
+		idpf_qc_rx_queue_release(dev->data->rx_queues[queue_idx]);
+		dev->data->rx_queues[queue_idx] = NULL;
+	}
+
 	/* Setup Rx queue */
 	rxq = rte_zmalloc_socket("cpfl rxq",
 				 sizeof(struct idpf_rx_queue),
@@ -287,6 +302,7 @@ cpfl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		idpf_qc_single_rx_queue_reset(rxq);
 		rxq->qrx_tail = hw->hw_addr + (vport->chunks_info.rx_qtail_start +
 				queue_idx * vport->chunks_info.rx_qtail_spacing);
+		rxq->ops = &def_rxq_ops;
 	} else {
 		idpf_qc_split_rx_descq_reset(rxq);
 
@@ -399,6 +415,12 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (idpf_qc_tx_thresh_check(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
+	/* Free memory if needed. */
+	if (dev->data->tx_queues[queue_idx] != NULL) {
+		idpf_qc_tx_queue_release(dev->data->tx_queues[queue_idx]);
+		dev->data->tx_queues[queue_idx] = NULL;
+	}
+
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("cpfl txq",
 				 sizeof(struct idpf_tx_queue),
@@ -461,6 +483,7 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 
 	txq->qtx_tail = hw->hw_addr + (vport->chunks_info.tx_qtail_start +
 			queue_idx * vport->chunks_info.tx_qtail_spacing);
+	txq->ops = &def_txq_ops;
 	txq->q_set = true;
 	dev->data->tx_queues[queue_idx] = txq;
 
@@ -674,6 +697,18 @@ cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	return 0;
 }
 
+void
+cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
+{
+	idpf_qc_rx_queue_release(dev->data->rx_queues[qid]);
+}
+
+void
+cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
+{
+	idpf_qc_tx_queue_release(dev->data->tx_queues[qid]);
+}
+
 void
 cpfl_stop_queues(struct rte_eth_dev *dev)
 {
drivers/net/cpfl/cpfl_rxtx.h +2 -0
index e9b810deaa..f5882401dc 100644
@@ -35,4 +35,6 @@ int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void cpfl_stop_queues(struct rte_eth_dev *dev);
 int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
+void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#163 lore raw

PATCH v7 8/21 net/cpfl: support MTU configuration

In reply to Mingxia Liu

Add dev ops mtu_set.

---
 doc/guides/nics/features/cpfl.ini |  1 +
 drivers/net/cpfl/cpfl_ethdev.c    | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
doc/guides/nics/features/cpfl.ini +1 -0
index a2d1ca9e15..470ba81579 100644
@@ -7,6 +7,7 @@
 ; is selected.
 ;
 [Features]
+MTU update           = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/cpfl/cpfl_ethdev.c +27 -0
index 2e5bfac1c0..e2eb92c738 100644
@@ -121,6 +121,27 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	return 0;
 }
 
+static int
+cpfl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	/* 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;
+	}
+
+	if (mtu > vport->max_mtu) {
+		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
+		return -EINVAL;
+	}
+
+	vport->max_pkt_len = mtu + CPFL_ETH_OVERHEAD;
+
+	return 0;
+}
+
 static const uint32_t *
 cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 {
@@ -142,6 +163,7 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 static int
 cpfl_dev_configure(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
 
 	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
@@ -181,6 +203,10 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
+	vport->max_pkt_len =
+		(dev->data->mtu == 0) ? CPFL_DEFAULT_MTU : dev->data->mtu +
+		CPFL_ETH_OVERHEAD;
+
 	return 0;
 }
 
@@ -625,6 +651,7 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.tx_queue_stop			= cpfl_tx_queue_stop,
 	.rx_queue_release		= cpfl_dev_rx_queue_release,
 	.tx_queue_release		= cpfl_dev_tx_queue_release,
+	.mtu_set			= cpfl_dev_mtu_set,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
Signature · 1 line
2.25.1
#164 lore raw

PATCH v7 9/21 net/cpfl: support basic Rx data path

In reply to Mingxia Liu

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

---
 drivers/net/cpfl/cpfl_ethdev.c |  2 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 18 ++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  1 +
 3 files changed, 21 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +2 -0
index e2eb92c738..ba66b284cc 100644
@@ -255,6 +255,8 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	cpfl_set_rx_function(dev);
+
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
drivers/net/cpfl/cpfl_rxtx.c +18 -0
index 3edba70b16..568ae3ec68 100644
@@ -734,3 +734,21 @@ cpfl_stop_queues(struct rte_eth_dev *dev)
 			PMD_DRV_LOG(WARNING, "Fail to stop Tx queue %d", i);
 	}
 }
+
+void
+cpfl_set_rx_function(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Split Scalar Rx (port %d).",
+			    dev->data->port_id);
+		dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts;
+	} else {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Single Scalar Rx (port %d).",
+			    dev->data->port_id);
+		dev->rx_pkt_burst = idpf_dp_singleq_recv_pkts;
+	}
+}
drivers/net/cpfl/cpfl_rxtx.h +1 -0
index f5882401dc..a5dd388e1f 100644
@@ -37,4 +37,5 @@ int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
+void cpfl_set_rx_function(struct rte_eth_dev *dev);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#165 lore raw

PATCH v7 10/21 net/cpfl: support basic Tx data path

In reply to Mingxia Liu

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

---
 drivers/net/cpfl/cpfl_ethdev.c |  3 +++
 drivers/net/cpfl/cpfl_rxtx.c   | 20 ++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  1 +
 3 files changed, 24 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +3 -0
index ba66b284cc..f02cbd08d9 100644
@@ -97,6 +97,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	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 = CPFL_DEFAULT_TX_FREE_THRESH,
 		.tx_rs_thresh = CPFL_DEFAULT_TX_RS_THRESH,
@@ -256,6 +258,7 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 	}
 
 	cpfl_set_rx_function(dev);
+	cpfl_set_tx_function(dev);
 
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
drivers/net/cpfl/cpfl_rxtx.c +20 -0
index 568ae3ec68..c250642719 100644
@@ -752,3 +752,23 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 		dev->rx_pkt_burst = idpf_dp_singleq_recv_pkts;
 	}
 }
+
+void
+cpfl_set_tx_function(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Split Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	} else {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Single Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	}
+}
drivers/net/cpfl/cpfl_rxtx.h +1 -0
index a5dd388e1f..5f8144e55f 100644
@@ -38,4 +38,5 @@ int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void cpfl_set_rx_function(struct rte_eth_dev *dev);
+void cpfl_set_tx_function(struct rte_eth_dev *dev);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.25.1
#166 lore raw

PATCH v7 11/21 net/cpfl: support write back based on ITR expire

In reply to Mingxia Liu

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

---
 drivers/net/cpfl/cpfl_ethdev.c | 45 +++++++++++++++++++++++++++++++++-
 drivers/net/cpfl/cpfl_ethdev.h |  2 ++
 2 files changed, 46 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +44 -1
index f02cbd08d9..7e0630c605 100644
@@ -212,6 +212,15 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+cpfl_config_rx_queues_irqs(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	uint16_t nb_rx_queues = dev->data->nb_rx_queues;
+
+	return idpf_vport_irq_map_config(vport, nb_rx_queues);
+}
+
 static int
 cpfl_start_queues(struct rte_eth_dev *dev)
 {
@@ -249,12 +258,37 @@ static int
 cpfl_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *base = vport->adapter;
+	struct cpfl_adapter_ext *adapter = CPFL_ADAPTER_TO_EXT(base);
+	uint16_t num_allocated_vectors = base->caps.num_allocated_vectors;
+	uint16_t req_vecs_num;
 	int ret;
 
+	req_vecs_num = CPFL_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_vec;
+	}
+
+	ret = idpf_vc_vectors_alloc(vport, req_vecs_num);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors");
+		goto err_vec;
+	}
+	adapter->used_vecs_num += req_vecs_num;
+
+	ret = cpfl_config_rx_queues_irqs(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to configure irqs");
+		goto err_irq;
+	}
+
 	ret = cpfl_start_queues(dev);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
-		return ret;
+		goto err_startq;
 	}
 
 	cpfl_set_rx_function(dev);
@@ -272,6 +306,11 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 
 err_vport:
 	cpfl_stop_queues(dev);
+err_startq:
+	idpf_vport_irq_unmap_config(vport, dev->data->nb_rx_queues);
+err_irq:
+	idpf_vc_vectors_dealloc(vport);
+err_vec:
 	return ret;
 }
 
@@ -287,6 +326,10 @@ cpfl_dev_stop(struct rte_eth_dev *dev)
 
 	cpfl_stop_queues(dev);
 
+	idpf_vport_irq_unmap_config(vport, dev->data->nb_rx_queues);
+
+	idpf_vc_vectors_dealloc(vport);
+
 	vport->stopped = 1;
 
 	return 0;
drivers/net/cpfl/cpfl_ethdev.h +2 -0
index 9ca39b4558..cd7f560d19 100644
@@ -24,6 +24,8 @@
 
 #define CPFL_INVALID_VPORT_IDX	0xffff
 
+#define CPFL_DFLT_Q_VEC_NUM	1
+
 #define CPFL_MIN_BUF_SIZE	1024
 #define CPFL_MAX_FRAME_SIZE	9728
 #define CPFL_DEFAULT_MTU	RTE_ETHER_MTU
Signature · 1 line
2.25.1
#167 lore raw

Re: [PATCH v7 11/21] net/cpfl: support write back based on ITR expire

Quoted 2 lines · Mingxia Liu

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

Can you please describe this commit more?

I can see a wrapper to 'idpf_vport_irq_map_config()' is called, what is configured related to the IRQ? What ITR stands for, etc...

#168 lore raw

RE: [PATCH v7 11/21] net/cpfl: support write back based on ITR expire

Ok, more commit msg will be given next version.

Quoted 16 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:50 AM
To: Liu, Mingxia <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v7 11/21] net/cpfl: support write back based on ITR expire

Quoted 2 lines · Mingxia Liu

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

Can you please describe this commit more?

I can see a wrapper to 'idpf_vport_irq_map_config()' is called, what is configured related to the IRQ? What ITR stands for, etc...

#169 lore raw

PATCH v7 12/21 net/cpfl: support RSS

In reply to Mingxia Liu

Add RSS support.

---
 drivers/net/cpfl/cpfl_ethdev.c | 51 ++++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h | 15 ++++++++++
 2 files changed, 66 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +51 -0
index 7e0630c605..fb15004e48 100644
@@ -97,6 +97,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->flow_type_rss_offloads = CPFL_RSS_OFFLOAD_ALL;
+
 	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -162,11 +164,49 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 	return ptypes;
 }
 
+static int
+cpfl_init_rss(struct idpf_vport *vport)
+{
+	struct rte_eth_rss_conf *rss_conf;
+	struct rte_eth_dev_data *dev_data;
+	uint16_t i, nb_q;
+	int ret = 0;
+
+	dev_data = vport->dev_data;
+	rss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = dev_data->nb_rx_queues;
+
+	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);
+		return -EINVAL;
+	} else {
+		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+			   vport->rss_key_size);
+	}
+
+	for (i = 0; i < vport->rss_lut_size; i++)
+		vport->rss_lut[i] = i % nb_q;
+
+	vport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;
+
+	ret = idpf_vport_rss_config(vport);
+	if (ret != 0)
+		PMD_INIT_LOG(ERR, "Failed to configure RSS");
+
+	return ret;
+}
+
 static int
 cpfl_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");
@@ -205,6 +245,17 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
+	if (adapter->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+		ret = cpfl_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;
+	}
+
 	vport->max_pkt_len =
 		(dev->data->mtu == 0) ? CPFL_DEFAULT_MTU : dev->data->mtu +
 		CPFL_ETH_OVERHEAD;
drivers/net/cpfl/cpfl_ethdev.h +15 -0
index cd7f560d19..e00dff4bf0 100644
@@ -36,6 +36,21 @@
 #define CPFL_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + CPFL_VLAN_TAG_SIZE * 2)
 
+#define CPFL_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  |	\
+		RTE_ETH_RSS_L2_PAYLOAD)
+
 #define CPFL_ADAPTER_NAME_LEN	(PCI_PRI_STR_SIZE + 1)
 
 #define CPFL_ALARM_INTERVAL	50000 /* us */
Signature · 1 line
2.25.1
#170 lore raw

Re: [PATCH v7 12/21] net/cpfl: support RSS

Quoted 3 lines · Mingxia Liu

Add RSS support.

<...>

Quoted 14 lines

static int
cpfl_dev_configure(struct rte_eth_dev *dev)
{

drivers/net/cpfl/cpfl_ethdev.c +2 -0
 	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");
@@ -205,6 +245,17 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_configure(struct rte_eth_dev *dev) · line 257

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c +10 -0
+	if (adapter->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+		ret = cpfl_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;
+	}

Shouldn't driver take into account 'conf->rxmode->mq_mode' and 'conf->rx_adv_conf->rss_conf->*' ?

#171 lore raw

RE: [PATCH v7 12/21] net/cpfl: support RSS

Quoted 30 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:50 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 12/21] net/cpfl: support RSS

Quoted 3 lines · Mingxia Liu

Add RSS support.

<...>

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) · line 212

Quoted 9 lines

static int
cpfl_dev_configure(struct rte_eth_dev *dev) {

drivers/net/cpfl/cpfl_ethdev.c +2 -0
 	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");

@@ -205,6

Quoted 4 lines

+245,17 @@ cpfl_dev_configure(struct rte_eth_dev *dev)

drivers/net/cpfl/cpfl_ethdev.c +0 -0
 		return -ENOTSUP;
 	}
Quoted 14 lines

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_configure(struct rte_eth_dev *dev) · line 257

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c +10 -0
+	if (adapter->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+		ret = cpfl_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;
+	}

Shouldn't driver take into account 'conf->rxmode->mq_mode' and 'conf-

Quoted 1 line

rx_adv_conf->rss_conf->*' ?

[Liu, Mingxia] Thanks for your comments, we will add checking of 'conf->rxmode->mq_mode'.
As for 'conf- >rx_adv_conf->rss_conf->*', we checked rss_conf->rss_key_len and rss_conf->rss_key in cpfl_dev_configure()-> cpfl_init_rss().

But for now pmd only support default rss_hf according to packge, so ignore the conf->rx_adv_conf->rss_conf->rss_hf. In the future, it will support configuring rss_hf.

#172 lore raw

Re: [PATCH v7 12/21] net/cpfl: support RSS

Quoted 43 lines · Mingxia
Quoted 43 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:50 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 12/21] net/cpfl: support RSS

Quoted 3 lines · Mingxia Liu

Add RSS support.

<...>

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) · line 212

Quoted 9 lines

static int
cpfl_dev_configure(struct rte_eth_dev *dev) {

drivers/net/cpfl/cpfl_ethdev.c +2 -0
 	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");

@@ -205,6

Quoted 4 lines

+245,17 @@ cpfl_dev_configure(struct rte_eth_dev *dev)

drivers/net/cpfl/cpfl_ethdev.c +0 -0
 		return -ENOTSUP;
 	}
 

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_configure(struct rte_eth_dev *dev) · line 257

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c +10 -0
+	if (adapter->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+		ret = cpfl_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;
+	}

Shouldn't driver take into account 'conf->rxmode->mq_mode' and 'conf-

Quoted 7 lines
Quoted 1 line
Quoted 1 line

rx_adv_conf->rss_conf->*' ?

[Liu, Mingxia] Thanks for your comments, we will add checking of 'conf->rxmode->mq_mode'.
As for 'conf- >rx_adv_conf->rss_conf->*', we checked rss_conf->rss_key_len and rss_conf->rss_key in cpfl_dev_configure()-> cpfl_init_rss().

But for now pmd only support default rss_hf according to packge, so ignore the conf->rx_adv_conf->rss_conf->rss_hf. In the future, it will support configuring rss_hf.

ack, thanks.

#173 lore raw

PATCH v7 13/21 net/cpfl: support Rx offloading

In reply to Mingxia Liu

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

---
 doc/guides/nics/features/cpfl.ini | 2 ++
 drivers/net/cpfl/cpfl_ethdev.c    | 6 ++++++
 2 files changed, 8 insertions(+)
doc/guides/nics/features/cpfl.ini +2 -0
index 470ba81579..ee5948f444 100644
@@ -8,6 +8,8 @@
 ;
 [Features]
 MTU update           = Y
+L3 checksum offload  = P
+L4 checksum offload  = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/cpfl/cpfl_ethdev.c +6 -0
index fb15004e48..d0f90b7d2c 100644
@@ -99,6 +99,12 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->flow_type_rss_offloads = CPFL_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) {
Signature · 1 line
2.25.1
#174 lore raw

Re: [PATCH v7 13/21] net/cpfl: support Rx offloading

Quoted 28 lines · Mingxia Liu

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

---
 doc/guides/nics/features/cpfl.ini | 2 ++
 drivers/net/cpfl/cpfl_ethdev.c    | 6 ++++++
 2 files changed, 8 insertions(+)
doc/guides/nics/features/cpfl.ini +2 -0
index 470ba81579..ee5948f444 100644
@@ -8,6 +8,8 @@
 ;
 [Features]
 MTU update           = Y
+L3 checksum offload  = P
+L4 checksum offload  = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/cpfl/cpfl_ethdev.c +0 -0
index fb15004e48..d0f90b7d2c 100644

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) · line 107

Quoted 9 lines
drivers/net/cpfl/cpfl_ethdev.c +6 -0
@@ -99,6 +99,12 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->flow_type_rss_offloads = CPFL_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;
+

Just to confirm, are these capabilities are already supported in the data path functions?

Same for Tx ones in next patch.

#175 lore raw

RE: [PATCH v7 13/21] net/cpfl: support Rx offloading

Quoted 53 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:50 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 13/21] net/cpfl: support Rx offloading

Quoted 29 lines · Mingxia Liu

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

---
 doc/guides/nics/features/cpfl.ini | 2 ++
 drivers/net/cpfl/cpfl_ethdev.c    | 6 ++++++
 2 files changed, 8 insertions(+)
doc/guides/nics/features/cpfl.ini +2 -0
index 470ba81579..ee5948f444 100644
@@ -8,6 +8,8 @@
 ;
 [Features]
 MTU update           = Y
+L3 checksum offload  = P
+L4 checksum offload  = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
(quoted diff) +0 -0

b/drivers/net/cpfl/cpfl_ethdev.c index fb15004e48..d0f90b7d2c 100644

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_info_get(struct rte_eth_dev *dev, struct · line 108

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c +6 -0
@@ -99,6 +99,12 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct
 rte_eth_dev_info *dev_info)
 
 	dev_info->flow_type_rss_offloads = CPFL_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;
+

Just to confirm, are these capabilities are already supported in the data path functions?

Quoted 1 line

Same for Tx ones in next patch.

[Liu, Mingxia] sure, they are all already supported.

#176 lore raw

PATCH v7 14/21 net/cpfl: support Tx offloading

In reply to Mingxia Liu

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

---
 doc/guides/nics/features/cpfl.ini | 1 +
 drivers/net/cpfl/cpfl_ethdev.c    | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
doc/guides/nics/features/cpfl.ini +1 -0
index ee5948f444..f4e45c7c68 100644
@@ -8,6 +8,7 @@
 ;
 [Features]
 MTU update           = Y
+TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
 Linux                = Y
drivers/net/cpfl/cpfl_ethdev.c +7 -1
index d0f90b7d2c..fda945d34b 100644
@@ -105,7 +105,13 @@ cpfl_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_IPV4_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_UDP_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_TCP_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = CPFL_DEFAULT_TX_FREE_THRESH,
Signature · 1 line
2.25.1
#177 lore raw

PATCH v7 15/21 net/cpfl: add AVX512 data path for single queue model

In reply to Mingxia Liu

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

---
 doc/guides/nics/cpfl.rst                |  24 +++++-
 drivers/net/cpfl/cpfl_ethdev.c          |   3 +-
 drivers/net/cpfl/cpfl_rxtx.c            |  94 ++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx_vec_common.h | 100 ++++++++++++++++++++++++
 drivers/net/cpfl/meson.build            |  25 +++++-
 5 files changed, 243 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/cpfl/cpfl_rxtx_vec_common.h
doc/guides/nics/cpfl.rst +23 -1
index 7c5aff0789..f0018b41df 100644
@@ -63,4 +63,26 @@ Runtime Config Options
 Driver compilation and testing
 ------------------------------
 
-Refer to the document :doc:`build_and_test` for details.
\ No newline at end of file
+Refer to the document :doc:`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 cpfl.ini,
+  A value "P" means the offload feature is not supported by vector path.
+  If any not supported features are used, cpfl vector PMD is disabled
+  and the scalar paths are chosen.
drivers/net/cpfl/cpfl_ethdev.c +2 -1
index fda945d34b..346af055cf 100644
@@ -111,7 +111,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_TX_OFFLOAD_TCP_CKSUM		|
 		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM		|
 		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 = CPFL_DEFAULT_TX_FREE_THRESH,
drivers/net/cpfl/cpfl_rxtx.c +94 -0

129 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx_vec_common.h new file +100 -0

100 lines not on this page · raw message

drivers/net/cpfl/meson.build +24 -1
index 1894423689..fbe6500826 100644
@@ -7,9 +7,32 @@ if is_windows
     subdir_done()
 endif
 
+if dpdk_conf.get('RTE_IOVA_AS_PA') == 0
+    build = false
+    reason = 'driver does not support disabling IOVA as PA mode'
+    subdir_done()
+endif
+
 deps += ['common_idpf']
 
 sources = files(
         'cpfl_ethdev.c',
         'cpfl_rxtx.c',
-)
\ No newline at end of file
+)
+
+if arch_subdir == 'x86'
+    cpfl_avx512_cpu_support = (
+        cc.get_define('__AVX512F__', args: machine_args) != '' and
+        cc.get_define('__AVX512BW__', args: machine_args) != ''
+    )
+
+    cpfl_avx512_cc_support = (
+        not machine_args.contains('-mno-avx512f') and
+        cc.has_argument('-mavx512f') and
+        cc.has_argument('-mavx512bw')
+    )
+
+    if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true
+        cflags += ['-DCC_AVX512_SUPPORT']
+    endif
+endif
Signature · 1 line
2.25.1
#178 lore raw

Re: [PATCH v7 15/21] net/cpfl: add AVX512 data path for single queue model

Quoted 4 lines · Mingxia Liu

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

<...>

Quoted 13 lines
drivers/net/cpfl/cpfl_rxtx.c +1 -0
index c250642719..cb7bbddb16 100644
@@ -8,6 +8,7 @@
 
 #include "cpfl_ethdev.h"
 #include "cpfl_rxtx.h"
+#include "cpfl_rxtx_vec_common.h"
 
 static uint64_t
 cpfl_rx_offload_convert(uint64_t offload)

drivers/net/cpfl/cpfl_rxtx.c cpfl_stop_queues(struct rte_eth_dev *dev) · line 739

Quoted 4 lines
drivers/net/cpfl/cpfl_rxtx.c +1 -0
@@ -735,11 +736,61 @@ cpfl_stop_queues(struct rte_eth_dev *dev)
 	}
 }
 
+

Extra empty line.

#179 lore raw

RE: [PATCH v7 15/21] net/cpfl: add AVX512 data path for single queue model

Thanks, will delete it.

Quoted 36 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:51 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Cc: Wu, Wenjun1 <[email protected]>
Subject: Re: [PATCH v7 15/21] net/cpfl: add AVX512 data path for single queue model

Quoted 4 lines · Mingxia Liu

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

<...>

Quoted 13 lines
(quoted diff) +0 -0

b/drivers/net/cpfl/cpfl_rxtx.c index c250642719..cb7bbddb16 100644

drivers/net/cpfl/cpfl_rxtx.c +1 -0
@@ -8,6 +8,7 @@
 
 #include "cpfl_ethdev.h"
 #include "cpfl_rxtx.h"
+#include "cpfl_rxtx_vec_common.h"
 
 static uint64_t
 cpfl_rx_offload_convert(uint64_t offload) @@ -735,11 +736,61 @@

cpfl_stop_queues(struct rte_eth_dev *dev)

drivers/net/cpfl/cpfl_rxtx.c cpfl_stop_queues(struct rte_eth_dev *dev) · line 739

Quoted 4 lines
drivers/net/cpfl/cpfl_rxtx.c +1 -0
 	}
 }
 
+

Extra empty line.

#180 lore raw

PATCH v7 16/21 net/cpfl: support timestamp offload

In reply to Mingxia Liu

Add support for timestamp offload.

---
 doc/guides/nics/features/cpfl.ini | 1 +
 drivers/net/cpfl/cpfl_ethdev.c    | 3 ++-
 drivers/net/cpfl/cpfl_rxtx.c      | 7 +++++++
 3 files changed, 10 insertions(+), 1 deletion(-)
doc/guides/nics/features/cpfl.ini +1 -0
index f4e45c7c68..c1209df3e5 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/cpfl/cpfl_ethdev.c +2 -1
index 346af055cf..1e40f3e55c 100644
@@ -103,7 +103,8 @@ cpfl_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_IPV4_CKSUM		|
drivers/net/cpfl/cpfl_rxtx.c +7 -0
index cb7bbddb16..7b12c80f1c 100644
@@ -516,6 +516,13 @@ cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		return -EINVAL;
 	}
 
+	err = idpf_qc_ts_mbuf_register(rxq);
+	if (err != 0) {
+		PMD_DRV_LOG(ERR, "fail to register timestamp mbuf %u",
+					rx_queue_id);
+		return -EIO;
+	}
+
 	if (rxq->bufq1 == NULL) {
 		/* Single queue */
 		err = idpf_qc_single_rxq_mbufs_alloc(rxq);
Signature · 1 line
2.25.1
#181 lore raw

PATCH v7 17/21 net/cpfl: add AVX512 data path for split queue model

In reply to Mingxia Liu

Add support of AVX512 data path for split queue model.

---
 drivers/net/cpfl/cpfl_rxtx.c            | 56 +++++++++++++++++++++++--
 drivers/net/cpfl/cpfl_rxtx_vec_common.h | 20 ++++++++-
 drivers/net/cpfl/meson.build            |  6 ++-
 3 files changed, 75 insertions(+), 7 deletions(-)
drivers/net/cpfl/cpfl_rxtx.c +53 -3
index 7b12c80f1c..0d5bfb901d 100644
@@ -759,7 +759,8 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 		if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)
 #ifdef CC_AVX512_SUPPORT
 			if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
-			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
+			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1 &&
+			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ))
 				vport->rx_use_avx512 = true;
 #else
 		PMD_DRV_LOG(NOTICE,
@@ -772,6 +773,21 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 
 #ifdef RTE_ARCH_X86
 	if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		if (vport->rx_vec_allowed) {
+			for (i = 0; i < dev->data->nb_rx_queues; i++) {
+				rxq = dev->data->rx_queues[i];
+				(void)idpf_qc_splitq_rx_vec_setup(rxq);
+			}
+#ifdef CC_AVX512_SUPPORT
+			if (vport->rx_use_avx512) {
+				PMD_DRV_LOG(NOTICE,
+					    "Using Split AVX512 Vector Rx (port %d).",
+					    dev->data->port_id);
+				dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts_avx512;
+				return;
+			}
+#endif /* CC_AVX512_SUPPORT */
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Split Scalar Rx (port %d).",
 			    dev->data->port_id);
@@ -827,9 +843,17 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 		vport->tx_vec_allowed = true;
 		if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)
 #ifdef CC_AVX512_SUPPORT
+		{
 			if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
 			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
 				vport->tx_use_avx512 = true;
+			if (vport->tx_use_avx512) {
+				for (i = 0; i < dev->data->nb_tx_queues; i++) {
+					txq = dev->data->tx_queues[i];
+					idpf_qc_tx_vec_avx512_setup(txq);
+				}
+			}
+		}
 #else
 		PMD_DRV_LOG(NOTICE,
 			    "AVX512 is not supported in build env");
@@ -839,14 +863,26 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 	}
 #endif /* RTE_ARCH_X86 */
 
+#ifdef RTE_ARCH_X86
 	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		if (vport->tx_vec_allowed) {
+#ifdef CC_AVX512_SUPPORT
+			if (vport->tx_use_avx512) {
+				PMD_DRV_LOG(NOTICE,
+					    "Using Split AVX512 Vector Tx (port %d).",
+					    dev->data->port_id);
+				dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts_avx512;
+				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+				return;
+			}
+#endif /* CC_AVX512_SUPPORT */
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Split Scalar Tx (port %d).",
 			    dev->data->port_id);
 		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
 		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
 	} else {
-#ifdef RTE_ARCH_X86
 		if (vport->tx_vec_allowed) {
 #ifdef CC_AVX512_SUPPORT
 			if (vport->tx_use_avx512) {
@@ -865,11 +901,25 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 			}
 #endif /* CC_AVX512_SUPPORT */
 		}
-#endif /* RTE_ARCH_X86 */
 		PMD_DRV_LOG(NOTICE,
 			    "Using Single Scalar Tx (port %d).",
 			    dev->data->port_id);
 		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
 		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
 	}
+#else
+	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Split Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	} else {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Single Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	}
+#endif /* RTE_ARCH_X86 */
 }
drivers/net/cpfl/cpfl_rxtx_vec_common.h +18 -2
index 2d4c6a0ef3..665418d27d 100644
@@ -64,15 +64,31 @@ cpfl_tx_vec_queue_default(struct idpf_tx_queue *txq)
 	return CPFL_VECTOR_PATH;
 }
 
+static inline int
+cpfl_rx_splitq_vec_default(struct idpf_rx_queue *rxq)
+{
+	if (rxq->bufq2->rx_buf_len < rxq->max_pkt_len)
+		return CPFL_SCALAR_PATH;
+
+	return CPFL_VECTOR_PATH;
+}
+
 static inline int
 cpfl_rx_vec_dev_check_default(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
 	struct idpf_rx_queue *rxq;
-	int i, ret = 0;
+	int i, default_ret, splitq_ret, ret = CPFL_SCALAR_PATH;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		rxq = dev->data->rx_queues[i];
-		ret = (cpfl_rx_vec_queue_default(rxq));
+		default_ret = cpfl_rx_vec_queue_default(rxq);
+		if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+			splitq_ret = cpfl_rx_splitq_vec_default(rxq);
+			ret = splitq_ret && default_ret;
+		} else {
+			ret = default_ret;
+		}
 		if (ret == CPFL_SCALAR_PATH)
 			return CPFL_SCALAR_PATH;
 	}
drivers/net/cpfl/meson.build +4 -2
index fbe6500826..2cf69258e2 100644
@@ -23,13 +23,15 @@ sources = files(
 if arch_subdir == 'x86'
     cpfl_avx512_cpu_support = (
         cc.get_define('__AVX512F__', args: machine_args) != '' and
-        cc.get_define('__AVX512BW__', args: machine_args) != ''
+        cc.get_define('__AVX512BW__', args: machine_args) != '' and
+        cc.get_define('__AVX512DQ__', args: machine_args) != ''
     )
 
     cpfl_avx512_cc_support = (
         not machine_args.contains('-mno-avx512f') and
         cc.has_argument('-mavx512f') and
-        cc.has_argument('-mavx512bw')
+        cc.has_argument('-mavx512bw') and
+        cc.has_argument('-mavx512dq')
     )
 
     if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true
Signature · 1 line
2.25.1
#182 lore raw

Re: [PATCH v7 17/21] net/cpfl: add AVX512 data path for split queue model

Quoted 4 lines · Mingxia Liu

Add support of AVX512 data path for split queue model.

<...>

Quoted 10 lines
drivers/net/cpfl/meson.build +1 -1
index fbe6500826..2cf69258e2 100644
@@ -23,13 +23,15 @@ sources = files(
 if arch_subdir == 'x86'
     cpfl_avx512_cpu_support = (
         cc.get_define('__AVX512F__', args: machine_args) != '' and
-        cc.get_define('__AVX512BW__', args: machine_args) != ''
+        cc.get_define('__AVX512BW__', args: machine_args) != '' and

drivers/net/cpfl/meson.build sources = files( · line 35

Quoted 10 lines
drivers/net/cpfl/meson.build +3 -1
+        cc.get_define('__AVX512DQ__', args: machine_args) != ''
     )
 
     cpfl_avx512_cc_support = (
         not machine_args.contains('-mno-avx512f') and
         cc.has_argument('-mavx512f') and
-        cc.has_argument('-mavx512bw')
+        cc.has_argument('-mavx512bw') and
+        cc.has_argument('-mavx512dq')
     )

+Bruce

Does it make sense to have a common 'avx512_cc_support' meson function that all required drivers and libraries to use?
As it is getting more complex to detect and it is required by multiple components.

#183 lore raw

PATCH v7 18/21 net/cpfl: add HW statistics

In reply to Mingxia Liu

This patch add hardware packets/bytes statistics.

---
 drivers/net/cpfl/cpfl_ethdev.c | 86 ++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +86 -0
index 1e40f3e55c..0fb9f0455b 100644
@@ -178,6 +178,87 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 	return ptypes;
 }
 
+static uint64_t
+cpfl_get_mbuf_alloc_failed_stats(struct rte_eth_dev *dev)
+{
+	uint64_t mbuf_alloc_failed = 0;
+	struct idpf_rx_queue *rxq;
+	int i = 0;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		mbuf_alloc_failed += __atomic_load_n(&rxq->rx_stats.mbuf_alloc_failed,
+						     __ATOMIC_RELAXED);
+	}
+
+	return mbuf_alloc_failed;
+}
+
+static int
+cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret == 0) {
+		uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads &
+					 RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 :
+					 RTE_ETHER_CRC_LEN;
+
+		idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
+				pstats->rx_broadcast - pstats->rx_discards;
+		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards;
+		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
+		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * crc_stats_len;
+		stats->obytes = pstats->tx_bytes;
+
+		dev->data->rx_mbuf_alloc_failed = cpfl_get_mbuf_alloc_failed_stats(dev);
+		stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
+	} else {
+		PMD_DRV_LOG(ERR, "Get statistics failed");
+	}
+	return ret;
+}
+
+static void
+cpfl_reset_mbuf_alloc_failed_stats(struct rte_eth_dev *dev)
+{
+	struct idpf_rx_queue *rxq;
+	int i;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		__atomic_store_n(&rxq->rx_stats.mbuf_alloc_failed, 0, __ATOMIC_RELAXED);
+	}
+}
+
+static int
+cpfl_dev_stats_reset(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret != 0)
+		return ret;
+
+	/* set stats offset base on current values */
+	vport->eth_stats_offset = *pstats;
+
+	cpfl_reset_mbuf_alloc_failed_stats(dev);
+
+	return 0;
+}
+
 static int
 cpfl_init_rss(struct idpf_vport *vport)
 {
@@ -365,6 +446,9 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 		goto err_vport;
 	}
 
+	if (cpfl_dev_stats_reset(dev))
+		PMD_DRV_LOG(ERR, "Failed to reset stats");
+
 	vport->stopped = 0;
 
 	return 0;
@@ -766,6 +850,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.tx_queue_release		= cpfl_dev_tx_queue_release,
 	.mtu_set			= cpfl_dev_mtu_set,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
+	.stats_get			= cpfl_dev_stats_get,
+	.stats_reset			= cpfl_dev_stats_reset,
 };
 
 static uint16_t
Signature · 1 line
2.25.1
#184 lore raw

Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Quoted 16 lines
drivers/net/cpfl/cpfl_ethdev.c +16 -0
+static int
+cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret == 0) {
+		uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads &
+					 RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 :
+					 RTE_ETHER_CRC_LEN;
+
+		idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) · line 222

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c +10 -0
+				pstats->rx_broadcast - pstats->rx_discards;
+		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards;
+		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
+		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * crc_stats_len;
+		stats->obytes = pstats->tx_bytes;
+
+		dev->data->rx_mbuf_alloc_failed = cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

#185 lore raw

RE: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 50 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Review

Quoted 13 lines
drivers/net/cpfl/cpfl_ethdev.c +11 -0
+static int
+cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats
+*stats) {
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret == 0) {
+		uint8_t crc_stats_len = (dev->data-

dev_conf.rxmode.offloads &

(quoted diff) +1 -0
+					 RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c +6 -0
+					 RTE_ETHER_CRC_LEN;
+
+		idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
+				pstats->rx_broadcast - pstats->rx_discards;
+		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)

Quoted 9 lines
drivers/net/cpfl/cpfl_ethdev.c +9 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards;
+		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
+		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * crc_stats_len;
+		stats->obytes = pstats->tx_bytes;
+
+		dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided to user, user need to access through rte_ethdev APIs. Because we already put rx and tx burst func to common/idpf which has no dependcy with ethdev lib. If I update "dev->data->rx_mbuf_alloc_failed" when allocate mbuf fails, it will break the design of our common/idpf interface to net/cpfl or net.idpf.

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib code.

#186 lore raw

Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 50 lines · Mingxia
Quoted 50 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Review

Quoted 13 lines
drivers/net/cpfl/cpfl_ethdev.c +11 -0
+static int
+cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats
+*stats) {
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret == 0) {
+		uint8_t crc_stats_len = (dev->data-

dev_conf.rxmode.offloads &

(quoted diff) +1 -0
+					 RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c +6 -0
+					 RTE_ETHER_CRC_LEN;
+
+		idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
+				pstats->rx_broadcast - pstats->rx_discards;
+		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)

Quoted 9 lines
drivers/net/cpfl/cpfl_ethdev.c +9 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards;
+		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
+		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * crc_stats_len;
+		stats->obytes = pstats->tx_bytes;
+
+		dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 8 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided to user, user need to access through rte_ethdev APIs. Because we already put rx and tx burst func to common/idpf which has no dependcy with ethdev lib. If I update "dev->data->rx_mbuf_alloc_failed" when allocate mbuf fails, it will break the design of our common/idpf interface to net/cpfl or net.idpf.

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib code.

Please check 'eth_dev_handle_port_info()' function.
As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

#187 lore raw

RE: [PATCH v7 18/21] net/cpfl: add HW statistics

OK, got it.

As our previous design did have flaws.
And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

Thanks,
BR,
mingxia

Quoted 77 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 50 lines · Mingxia
Quoted 50 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Review

Quoted 13 lines
drivers/net/cpfl/cpfl_ethdev.c +11 -0
+static int
+cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats
+*stats) {
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret == 0) {
+		uint8_t crc_stats_len = (dev->data-

dev_conf.rxmode.offloads &

(quoted diff) +1 -0
+					 RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c +6 -0
+					 RTE_ETHER_CRC_LEN;
+
+		idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
+				pstats->rx_broadcast - pstats->rx_discards;
+		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)

Quoted 9 lines
drivers/net/cpfl/cpfl_ethdev.c +9 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards;
+		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
+		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * crc_stats_len;
+		stats->obytes = pstats->tx_bytes;
+
+		dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 3 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 1 line

Because we already put rx and tx burst func to common/idpf which has no

dependcy with ethdev lib. If I update "dev->data->rx_mbuf_alloc_failed"

Quoted 1 line

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 2 lines

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function.
As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

#188 lore raw

Re: [PATCH v7 18/21] net/cpfl: add HW statistics

On 2/28/2023 11:47 AM, Liu, Mingxia wrote:

Comment moved down, please don't top post, it makes very hard to follow discussion.

Quoted 74 lines
Quoted 74 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 50 lines · Mingxia
Quoted 50 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Review

Quoted 13 lines
drivers/net/cpfl/cpfl_ethdev.c +11 -0
+static int
+cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats
+*stats) {
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret == 0) {
+		uint8_t crc_stats_len = (dev->data-

dev_conf.rxmode.offloads &

(quoted diff) +1 -0
+					 RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c +6 -0
+					 RTE_ETHER_CRC_LEN;
+
+		idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
+				pstats->rx_broadcast - pstats->rx_discards;
+		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)

Quoted 9 lines
drivers/net/cpfl/cpfl_ethdev.c +9 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards;
+		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
+		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * crc_stats_len;
+		stats->obytes = pstats->tx_bytes;
+
+		dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 3 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 1 line

Because we already put rx and tx burst func to common/idpf which has no

dependcy with ethdev lib. If I update "dev->data->rx_mbuf_alloc_failed"

Quoted 1 line

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 2 lines

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function.
As I said this is used by telemetry, not directly exposed to the user.

Quoted 9 lines
Quoted 3 lines

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

OK, got it.

As our previous design did have flaws.
And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

I don't believe this is urgent, can you but a one line limitation to the documentation for now, and fix it later?

And for the fix, updating 'dev->data->rx_mbuf_alloc_failed' where ever 'rxq->rx_stats.mbuf_alloc_failed' updated is easy, although you may need to store 'dev->data' in rxq struct for this.

But,
I think it is also fair to question the assumption telemetry has that 'rx_mbuf_alloc_fail' is always available data, and consider moving it to the 'eth_dev_handle_port_stats()' handler.
+Bruce for comment.

#189 lore raw

Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 85 lines · Ferruh Yigit

On 2/28/2023 11:47 AM, Liu, Mingxia wrote:

Comment moved down, please don't top post, it makes very hard to follow discussion.

Quoted 70 lines
Quoted 61 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 40 lines · Mingxia
Quoted 40 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Quoted 7 lines

+static int +cpfl_dev_stats_get(struct rte_eth_dev *dev, struct
rte_eth_stats +*stats) { + struct idpf_vport *vport = +
(struct idpf_vport *)dev->data->dev_private; + struct
virtchnl2_vport_stats *pstats = NULL; + int ret; + + ret =
idpf_vc_stats_query(vport, &pstats); + if (ret == 0) { +
uint8_t crc_stats_len = (dev->data- dev_conf.rxmode.offloads & + RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

Quoted 5 lines
(quoted diff) +1 -0
+					 RTE_ETHER_CRC_LEN; + +

idpf_vport_stats_update(&vport->eth_stats_offset, pstats); + stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + + pstats->rx_broadcast - pstats->rx_discards; + stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

Quoted 7 lines
(quoted diff) +2 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards; +

stats->oerrors = pstats->tx_errors + pstats->tx_discards; +
stats->ibytes = pstats->rx_bytes; + stats->ibytes -=
stats->ipackets * crc_stats_len; + stats->obytes =
pstats->tx_bytes; + + dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 4 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 2 lines

Because we already put rx and tx burst func to common/idpf which has no

dependcy with ethdev lib. If I update
"dev->data->rx_mbuf_alloc_failed"

Quoted 1 line

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 3 lines

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib

Quoted 9 lines

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function. As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

Quoted 7 lines

OK, got it.

As our previous design did have flaws. And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

I don't believe this is urgent, can you but a one line limitation to the documentation for now, and fix it later?

Quoted 8 lines

And for the fix, updating 'dev->data->rx_mbuf_alloc_failed' where ever 'rxq->rx_stats.mbuf_alloc_failed' updated is easy, although you may need to store 'dev->data' in rxq struct for this.

But, I think it is also fair to question the assumption telemetry has that 'rx_mbuf_alloc_fail' is always available data, and consider moving it to the 'eth_dev_handle_port_stats()' handler. +Bruce for comment.

That's not really a telemetry assumption, it's one from the stats, structure. Telemetry just outputs the contents of data reported by ethdev stats, and rx_nombuf is just one of those fields.

/Bruce

#190 lore raw

Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 90 lines · Bruce Richardson
Quoted 89 lines · Ferruh Yigit

On 2/28/2023 11:47 AM, Liu, Mingxia wrote:

Comment moved down, please don't top post, it makes very hard to follow discussion.

Quoted 70 lines
Quoted 61 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 40 lines · Mingxia
Quoted 40 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Quoted 7 lines

+static int +cpfl_dev_stats_get(struct rte_eth_dev *dev, struct
rte_eth_stats +*stats) { + struct idpf_vport *vport = +
(struct idpf_vport *)dev->data->dev_private; + struct
virtchnl2_vport_stats *pstats = NULL; + int ret; + + ret =
idpf_vc_stats_query(vport, &pstats); + if (ret == 0) { +
uint8_t crc_stats_len = (dev->data- dev_conf.rxmode.offloads & + RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

Quoted 5 lines
(quoted diff) +1 -0
+					 RTE_ETHER_CRC_LEN; + +

idpf_vport_stats_update(&vport->eth_stats_offset, pstats); + stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + + pstats->rx_broadcast - pstats->rx_discards; + stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

Quoted 7 lines
(quoted diff) +2 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards; +

stats->oerrors = pstats->tx_errors + pstats->tx_discards; +
stats->ibytes = pstats->rx_bytes; + stats->ibytes -=
stats->ipackets * crc_stats_len; + stats->obytes =
pstats->tx_bytes; + + dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 4 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 2 lines

Because we already put rx and tx burst func to common/idpf which has no

dependcy with ethdev lib. If I update
"dev->data->rx_mbuf_alloc_failed"

Quoted 1 line

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 3 lines

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib

Quoted 9 lines

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function. As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

Quoted 7 lines

OK, got it.

As our previous design did have flaws. And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

I don't believe this is urgent, can you but a one line limitation to the documentation for now, and fix it later?

And for the fix, updating 'dev->data->rx_mbuf_alloc_failed' where ever 'rxq->rx_stats.mbuf_alloc_failed' updated is easy, although you may need to store 'dev->data' in rxq struct for this.

Quoted 9 lines
Quoted 4 lines

But, I think it is also fair to question the assumption telemetry has that 'rx_mbuf_alloc_fail' is always available data, and consider moving it to the 'eth_dev_handle_port_stats()' handler. +Bruce for comment.

That's not really a telemetry assumption, it's one from the stats, structure. Telemetry just outputs the contents of data reported by ethdev stats, and rx_nombuf is just one of those fields.

Not talking about 'rx_nombuf' in 'eth_dev_handle_port_stats()', but talking about 'rx_mbuf_alloc_fail' in 'eth_dev_handle_port_info()',

should telemetry return interim 'eth_dev->data->rx_mbuf_alloc_failed' value, specially when 'rx_nombuf' is available?

Because at least for this driver returned 'rx_mbuf_alloc_fail' value will be wrong, I believe that is same for 'idpf' driver.

#191 lore raw

Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 101 lines · Ferruh Yigit
Quoted 90 lines · Bruce Richardson
Quoted 89 lines · Ferruh Yigit

On 2/28/2023 11:47 AM, Liu, Mingxia wrote:

Comment moved down, please don't top post, it makes very hard to follow discussion.

Quoted 70 lines
Quoted 61 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 40 lines · Mingxia
Quoted 40 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Quoted 7 lines

+static int +cpfl_dev_stats_get(struct rte_eth_dev *dev, struct
rte_eth_stats +*stats) { + struct idpf_vport *vport = +
(struct idpf_vport *)dev->data->dev_private; + struct
virtchnl2_vport_stats *pstats = NULL; + int ret; + + ret =
idpf_vc_stats_query(vport, &pstats); + if (ret == 0) { +
uint8_t crc_stats_len = (dev->data- dev_conf.rxmode.offloads & + RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

Quoted 5 lines
(quoted diff) +1 -0
+					 RTE_ETHER_CRC_LEN; + +

idpf_vport_stats_update(&vport->eth_stats_offset, pstats); + stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + + pstats->rx_broadcast - pstats->rx_discards; + stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

Quoted 7 lines
(quoted diff) +2 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards; +

stats->oerrors = pstats->tx_errors + pstats->tx_discards; +
stats->ibytes = pstats->rx_bytes; + stats->ibytes -=
stats->ipackets * crc_stats_len; + stats->obytes =
pstats->tx_bytes; + + dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 4 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 2 lines

Because we already put rx and tx burst func to common/idpf which has no

dependcy with ethdev lib. If I update
"dev->data->rx_mbuf_alloc_failed"

Quoted 1 line

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 3 lines

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib

Quoted 9 lines

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function. As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

Quoted 7 lines

OK, got it.

As our previous design did have flaws. And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

I don't believe this is urgent, can you but a one line limitation to the documentation for now, and fix it later?

And for the fix, updating 'dev->data->rx_mbuf_alloc_failed' where ever 'rxq->rx_stats.mbuf_alloc_failed' updated is easy, although you may need to store 'dev->data' in rxq struct for this.

Quoted 9 lines
Quoted 4 lines

But, I think it is also fair to question the assumption telemetry has that 'rx_mbuf_alloc_fail' is always available data, and consider moving it to the 'eth_dev_handle_port_stats()' handler. +Bruce for comment.

That's not really a telemetry assumption, it's one from the stats, structure. Telemetry just outputs the contents of data reported by ethdev stats, and rx_nombuf is just one of those fields.

Quoted 10 lines

Not talking about 'rx_nombuf' in 'eth_dev_handle_port_stats()', but talking about 'rx_mbuf_alloc_fail' in 'eth_dev_handle_port_info()',

should telemetry return interim 'eth_dev->data->rx_mbuf_alloc_failed' value, specially when 'rx_nombuf' is available?

Because at least for this driver returned 'rx_mbuf_alloc_fail' value will be wrong, I believe that is same for 'idpf' driver.

Or, let me rephrase like this, 'eth_dev->data->rx_mbuf_alloc_failed' is not returned to user directly via ethdev APIs, but it is via telemetry.

I think it is not guaranteed that this value will be correct at any given time as telemetry assumes, so should we remove it from telemetry?

#192 lore raw

RE: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 129 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 8:33 PM
To: Richardson, Bruce <[email protected]>
Cc: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>; Wu, Jingjing <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 91 lines · Ferruh Yigit
Quoted 90 lines · Bruce Richardson
Quoted 89 lines · Ferruh Yigit

On 2/28/2023 11:47 AM, Liu, Mingxia wrote:

Comment moved down, please don't top post, it makes very hard to follow discussion.

Quoted 74 lines
Quoted 65 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 42 lines · Mingxia
Quoted 42 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Quoted 8 lines

+static int +cpfl_dev_stats_get(struct rte_eth_dev *dev, struct
rte_eth_stats +*stats) { + struct idpf_vport *vport = +
(struct idpf_vport *)dev->data->dev_private; + struct
virtchnl2_vport_stats *pstats = NULL; + int ret; + + ret =
idpf_vc_stats_query(vport, &pstats); + if (ret == 0) { +
uint8_t crc_stats_len = (dev->data- dev_conf.rxmode.offloads & +
RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

Quoted 5 lines
(quoted diff) +1 -0
+					 RTE_ETHER_CRC_LEN; + +

idpf_vport_stats_update(&vport->eth_stats_offset, pstats); + stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + + pstats->rx_broadcast - pstats->rx_discards; + stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

Quoted 7 lines
(quoted diff) +2 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards; +

stats->oerrors = pstats->tx_errors + pstats->tx_discards; +
stats->ibytes = pstats->rx_bytes; + stats->ibytes -=
stats->ipackets * crc_stats_len; + stats->obytes =
pstats->tx_bytes; + + dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 4 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 2 lines

Because we already put rx and tx burst func to common/idpf which has no

dependcy with ethdev lib. If I update
"dev->data->rx_mbuf_alloc_failed"

Quoted 2 lines

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 3 lines

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib

Quoted 9 lines

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function. As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

Quoted 7 lines

OK, got it.

As our previous design did have flaws. And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

I don't believe this is urgent, can you but a one line limitation to the documentation for now, and fix it later?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

And for the fix, updating 'dev->data->rx_mbuf_alloc_failed' where ever 'rxq->rx_stats.mbuf_alloc_failed' updated is easy, although you may need to store 'dev->data' in rxq struct for this.

But, I think it is also fair to question the assumption telemetry has that 'rx_mbuf_alloc_fail' is always available data, and consider moving it to the 'eth_dev_handle_port_stats()' handler. +Bruce for

comment.

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

That's not really a telemetry assumption, it's one from the stats, structure. Telemetry just outputs the contents of data reported by ethdev stats, and rx_nombuf is just one of those fields.

Quoted 10 lines

Not talking about 'rx_nombuf' in 'eth_dev_handle_port_stats()', but talking about 'rx_mbuf_alloc_fail' in 'eth_dev_handle_port_info()',

should telemetry return interim 'eth_dev->data->rx_mbuf_alloc_failed' value, specially when 'rx_nombuf' is available?

Because at least for this driver returned 'rx_mbuf_alloc_fail' value will be wrong, I believe that is same for 'idpf' driver.

Quoted 6 lines

Or, let me rephrase like this, 'eth_dev->data->rx_mbuf_alloc_failed' is not returned to user directly via ethdev APIs, but it is via telemetry.

I think it is not guaranteed that this value will be correct at any given time as telemetry assumes, so should we remove it from telemetry?

May not be necessary, PMD should be able to give the right number, this is something we can fix in idpf and cpfl PMD, to align with other PMD.

#193 lore raw

Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 129 lines · Qi Z
Quoted 129 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 8:33 PM
To: Richardson, Bruce <[email protected]>
Cc: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>; Wu, Jingjing <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 91 lines · Ferruh Yigit
Quoted 90 lines · Bruce Richardson
Quoted 89 lines · Ferruh Yigit

On 2/28/2023 11:47 AM, Liu, Mingxia wrote:

Comment moved down, please don't top post, it makes very hard to follow discussion.

Quoted 74 lines
Quoted 65 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 42 lines · Mingxia
Quoted 42 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Quoted 8 lines

+static int +cpfl_dev_stats_get(struct rte_eth_dev *dev, struct
rte_eth_stats +*stats) { + struct idpf_vport *vport = +
(struct idpf_vport *)dev->data->dev_private; + struct
virtchnl2_vport_stats *pstats = NULL; + int ret; + + ret =
idpf_vc_stats_query(vport, &pstats); + if (ret == 0) { +
uint8_t crc_stats_len = (dev->data- dev_conf.rxmode.offloads & +
RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

Quoted 5 lines
(quoted diff) +1 -0
+					 RTE_ETHER_CRC_LEN; + +

idpf_vport_stats_update(&vport->eth_stats_offset, pstats); + stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + + pstats->rx_broadcast - pstats->rx_discards; + stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

Quoted 7 lines
(quoted diff) +2 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards; +

stats->oerrors = pstats->tx_errors + pstats->tx_discards; +
stats->ibytes = pstats->rx_bytes; + stats->ibytes -=
stats->ipackets * crc_stats_len; + stats->obytes =
pstats->tx_bytes; + + dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 4 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 2 lines

Because we already put rx and tx burst func to common/idpf which has no

dependcy with ethdev lib. If I update
"dev->data->rx_mbuf_alloc_failed"

Quoted 2 lines

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 3 lines

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib

Quoted 9 lines

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function. As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

Quoted 7 lines

OK, got it.

As our previous design did have flaws. And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

I don't believe this is urgent, can you but a one line limitation to the documentation for now, and fix it later?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

And for the fix, updating 'dev->data->rx_mbuf_alloc_failed' where ever 'rxq->rx_stats.mbuf_alloc_failed' updated is easy, although you may need to store 'dev->data' in rxq struct for this.

But, I think it is also fair to question the assumption telemetry has that 'rx_mbuf_alloc_fail' is always available data, and consider moving it to the 'eth_dev_handle_port_stats()' handler. +Bruce for

comment.

Quoted 17 lines
Quoted 6 lines
Quoted 1 line

That's not really a telemetry assumption, it's one from the stats, structure. Telemetry just outputs the contents of data reported by ethdev stats, and rx_nombuf is just one of those fields.

Not talking about 'rx_nombuf' in 'eth_dev_handle_port_stats()', but talking about 'rx_mbuf_alloc_fail' in 'eth_dev_handle_port_info()',

should telemetry return interim 'eth_dev->data->rx_mbuf_alloc_failed' value, specially when 'rx_nombuf' is available?

Because at least for this driver returned 'rx_mbuf_alloc_fail' value will be wrong, I believe that is same for 'idpf' driver.

Quoted 8 lines
Quoted 6 lines

Or, let me rephrase like this, 'eth_dev->data->rx_mbuf_alloc_failed' is not returned to user directly via ethdev APIs, but it is via telemetry.

I think it is not guaranteed that this value will be correct at any given time as telemetry assumes, so should we remove it from telemetry?

May not be necessary, PMD should be able to give the right number, this is something we can fix in idpf and cpfl PMD, to align with other PMD.

Thanks Qi, Ok to have drivers aligned to common usage.

Still, for telemetry we can consider removing 'rx_mbuf_alloc_fail', user can get that information from 'rx_nombuf'.

#194 lore raw

RE: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 157 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 9:35 PM
To: Zhang, Qi Z <[email protected]>; Richardson, Bruce <[email protected]>
Cc: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>; Wu, Jingjing <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 144 lines · Qi Z
Quoted 62 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 8:33 PM
To: Richardson, Bruce <[email protected]>
Cc: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>; Wu, Jingjing <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 50 lines · Ferruh Yigit
Quoted 49 lines · Bruce Richardson
Quoted 48 lines · Ferruh Yigit

On 2/28/2023 11:47 AM, Liu, Mingxia wrote:

Comment moved down, please don't top post, it makes very hard to follow discussion.

Quoted 43 lines
Quoted 43 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 35 lines · Mingxia
Quoted 35 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Quoted 10 lines
(quoted diff) +2 -0
+static int +cpfl_dev_stats_get(struct rte_eth_dev *dev,
+struct

rte_eth_stats +*stats) { + struct idpf_vport *vport = +
(struct idpf_vport *)dev->data->dev_private; + struct
virtchnl2_vport_stats *pstats = NULL; + int ret; + + ret =
idpf_vc_stats_query(vport, &pstats); + if (ret == 0) { +
uint8_t crc_stats_len = (dev->data- dev_conf.rxmode.offloads &
+
RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

Quoted 6 lines
(quoted diff) +1 -0
+					 RTE_ETHER_CRC_LEN; + +

idpf_vport_stats_update(&vport->eth_stats_offset, pstats); + stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + stats->+
pstats->rx_broadcast - pstats->rx_discards; + stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
(quoted diff) +2 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards; +

stats->oerrors = pstats->tx_errors + pstats->tx_discards; +
stats->ibytes = pstats->rx_bytes; + stats->ibytes -=
stats->ipackets * crc_stats_len; + stats->obytes =
pstats->tx_bytes; + + dev->data-

rx_mbuf_alloc_failed =

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq-

rx_stats.mbuf_alloc_failed').

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 2 lines

Because we already put rx and tx burst func to common/idpf which has no

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

dependcy with ethdev lib. If I update
"dev->data->rx_mbuf_alloc_failed"

Quoted 2 lines

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 2 lines

And I didn't find any reference of 'dev->data-

rx_mbuf_alloc_failed'

Quoted 53 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 1 line

in lib

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function. As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

Quoted 7 lines

OK, got it.

As our previous design did have flaws. And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

I don't believe this is urgent, can you but a one line limitation to the documentation for now, and fix it later?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

And for the fix, updating 'dev->data->rx_mbuf_alloc_failed' where ever 'rxq->rx_stats.mbuf_alloc_failed' updated is easy, although you may need to store 'dev->data' in rxq struct for this.

But, I think it is also fair to question the assumption telemetry has that 'rx_mbuf_alloc_fail' is always available data, and consider moving it to the 'eth_dev_handle_port_stats()' handler. +Bruce for

comment.

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

That's not really a telemetry assumption, it's one from the stats, structure. Telemetry just outputs the contents of data reported by ethdev stats, and rx_nombuf is just one of those fields.

Quoted 10 lines

Not talking about 'rx_nombuf' in 'eth_dev_handle_port_stats()', but talking about 'rx_mbuf_alloc_fail' in 'eth_dev_handle_port_info()',

should telemetry return interim 'eth_dev->data->rx_mbuf_alloc_failed' value, specially when 'rx_nombuf' is available?

Because at least for this driver returned 'rx_mbuf_alloc_fail' value will be wrong, I believe that is same for 'idpf' driver.

Or, let me rephrase like this, 'eth_dev->data->rx_mbuf_alloc_failed' is not returned to user directly via ethdev APIs, but it is via telemetry.

I think it is not guaranteed that this value will be correct at any given time as telemetry assumes, so should we remove it from telemetry?

Quoted 7 lines
Quoted 1 line

May not be necessary, PMD should be able to give the right number, this is

something we can fix in idpf and cpfl PMD, to align with other PMD.

Thanks Qi, Ok to have drivers aligned to common usage.

Still, for telemetry we can consider removing 'rx_mbuf_alloc_fail', user can get that information from 'rx_nombuf'.

No objection, if this is not a comprise for above issue :)

#195 lore raw

Re: [PATCH v7 18/21] net/cpfl: add HW statistics

In reply to Ferruh Yigit
Quoted 122 lines · Ferruh Yigit
Quoted 121 lines · Qi Z
Quoted 121 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 8:33 PM
To: Richardson, Bruce <[email protected]>
Cc: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>; Wu, Jingjing <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 91 lines · Ferruh Yigit
Quoted 90 lines · Bruce Richardson
Quoted 89 lines · Ferruh Yigit

On 2/28/2023 11:47 AM, Liu, Mingxia wrote:

Comment moved down, please don't top post, it makes very hard to follow discussion.

Quoted 74 lines
Quoted 65 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 42 lines · Mingxia
Quoted 42 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Quoted 8 lines

+static int +cpfl_dev_stats_get(struct rte_eth_dev *dev, struct
rte_eth_stats +*stats) { + struct idpf_vport *vport = +
(struct idpf_vport *)dev->data->dev_private; + struct
virtchnl2_vport_stats *pstats = NULL; + int ret; + + ret =
idpf_vc_stats_query(vport, &pstats); + if (ret == 0) { +
uint8_t crc_stats_len = (dev->data- dev_conf.rxmode.offloads & +
RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

Quoted 5 lines
(quoted diff) +1 -0
+					 RTE_ETHER_CRC_LEN; + +

idpf_vport_stats_update(&vport->eth_stats_offset, pstats); + stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + + pstats->rx_broadcast - pstats->rx_discards; + stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

Quoted 7 lines
(quoted diff) +2 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards; +

stats->oerrors = pstats->tx_errors + pstats->tx_discards; +
stats->ibytes = pstats->rx_bytes; + stats->ibytes -=
stats->ipackets * crc_stats_len; + stats->obytes =
pstats->tx_bytes; + + dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 4 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 2 lines

Because we already put rx and tx burst func to common/idpf which has no

dependcy with ethdev lib. If I update
"dev->data->rx_mbuf_alloc_failed"

Quoted 2 lines

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 3 lines

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib

Quoted 9 lines

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function. As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

Quoted 7 lines

OK, got it.

As our previous design did have flaws. And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

I don't believe this is urgent, can you but a one line limitation to the documentation for now, and fix it later?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

And for the fix, updating 'dev->data->rx_mbuf_alloc_failed' where ever 'rxq->rx_stats.mbuf_alloc_failed' updated is easy, although you may need to store 'dev->data' in rxq struct for this.

But, I think it is also fair to question the assumption telemetry has that 'rx_mbuf_alloc_fail' is always available data, and consider moving it to the 'eth_dev_handle_port_stats()' handler. +Bruce for

comment.

Quoted 10 lines
Quoted 6 lines
Quoted 1 line

That's not really a telemetry assumption, it's one from the stats, structure. Telemetry just outputs the contents of data reported by ethdev stats, and rx_nombuf is just one of those fields.

Not talking about 'rx_nombuf' in 'eth_dev_handle_port_stats()', but talking about 'rx_mbuf_alloc_fail' in 'eth_dev_handle_port_info()',

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

should telemetry return interim 'eth_dev->data->rx_mbuf_alloc_failed' value, specially when 'rx_nombuf' is available?

Because at least for this driver returned 'rx_mbuf_alloc_fail' value will be wrong, I believe that is same for 'idpf' driver.

Thanks for the clarification, the question is clearer now. Having duplicate info seems strange.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Or, let me rephrase like this, 'eth_dev->data->rx_mbuf_alloc_failed' is not returned to user directly via ethdev APIs, but it is via telemetry.

I think it is not guaranteed that this value will be correct at any given time as telemetry assumes, so should we remove it from telemetry?

Quoted 6 lines
Quoted 1 line

May not be necessary, PMD should be able to give the right number, this is something we can fix in idpf and cpfl PMD, to align with other PMD.

Thanks Qi, Ok to have drivers aligned to common usage.

Still, for telemetry we can consider removing 'rx_mbuf_alloc_fail', user can get that information from 'rx_nombuf'.

I would agree with Ferruh. The information on nombufs should be available just from the stats. It doesn't logically fit in the "info" category, especially when it is in stats already.

/Bruce

#196 lore raw

Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 144 lines · Bruce Richardson
Quoted 122 lines · Ferruh Yigit
Quoted 121 lines · Qi Z
Quoted 121 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 8:33 PM
To: Richardson, Bruce <[email protected]>
Cc: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>; Wu, Jingjing <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 91 lines · Ferruh Yigit
Quoted 90 lines · Bruce Richardson
Quoted 89 lines · Ferruh Yigit

On 2/28/2023 11:47 AM, Liu, Mingxia wrote:

Comment moved down, please don't top post, it makes very hard to follow discussion.

Quoted 74 lines
Quoted 65 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 6:02 PM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 42 lines · Mingxia
Quoted 42 lines

-----Original Message----- From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:52 AM To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 18/21] net/cpfl: add HW statistics

Quoted 3 lines · Mingxia Liu

This patch add hardware packets/bytes statistics.

<...>

Quoted 8 lines

+static int +cpfl_dev_stats_get(struct rte_eth_dev *dev, struct
rte_eth_stats +*stats) { + struct idpf_vport *vport = +
(struct idpf_vport *)dev->data->dev_private; + struct
virtchnl2_vport_stats *pstats = NULL; + int ret; + + ret =
idpf_vc_stats_query(vport, &pstats); + if (ret == 0) { +
uint8_t crc_stats_len = (dev->data- dev_conf.rxmode.offloads & +
RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?

0 :

Quoted 5 lines
(quoted diff) +1 -0
+					 RTE_ETHER_CRC_LEN; + +

idpf_vport_stats_update(&vport->eth_stats_offset, pstats); + stats->ipackets = pstats->rx_unicast + pstats->rx_multicast + + pstats->rx_broadcast - pstats->rx_discards; + stats->opackets = pstats->tx_broadcast + pstats->tx_multicast

+

Quoted 7 lines
(quoted diff) +2 -0
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards; +

stats->oerrors = pstats->tx_errors + pstats->tx_discards; +
stats->ibytes = pstats->rx_bytes; + stats->ibytes -=
stats->ipackets * crc_stats_len; + stats->obytes =
pstats->tx_bytes; + + dev->data->rx_mbuf_alloc_failed =
+cpfl_get_mbuf_alloc_failed_stats(dev);

'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating here only in stats_get() will make it wrong for telemetry.

Quoted 4 lines
Quoted 2 lines

Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').

[Liu, Mingxia] As I know, rte_eth_dev_data is not a public structure provided

to user, user need to access through rte_ethdev APIs.

Quoted 2 lines

Because we already put rx and tx burst func to common/idpf which has no

dependcy with ethdev lib. If I update
"dev->data->rx_mbuf_alloc_failed"

Quoted 2 lines

when allocate mbuf fails, it will break the design of our common/idpf

interface to net/cpfl or net.idpf.

Quoted 3 lines

And I didn't find any reference of 'dev->data->rx_mbuf_alloc_failed' in lib

Quoted 9 lines

code.

Quoted 1 line

Please check 'eth_dev_handle_port_info()' function. As I said this is used by telemetry, not directly exposed to the user.

I got the design concern, perhaps you can put a brief limitation to the driver documentation.

Quoted 7 lines

OK, got it.

As our previous design did have flaws. And if we don't want to affect correctness of telemetry, we have to redesign the idpf common module code, which means a lot of work to do, so can we lower the priority of this issue?

I don't believe this is urgent, can you but a one line limitation to the documentation for now, and fix it later?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

And for the fix, updating 'dev->data->rx_mbuf_alloc_failed' where ever 'rxq->rx_stats.mbuf_alloc_failed' updated is easy, although you may need to store 'dev->data' in rxq struct for this.

But, I think it is also fair to question the assumption telemetry has that 'rx_mbuf_alloc_fail' is always available data, and consider moving it to the 'eth_dev_handle_port_stats()' handler. +Bruce for

comment.

Quoted 10 lines
Quoted 6 lines
Quoted 1 line

That's not really a telemetry assumption, it's one from the stats, structure. Telemetry just outputs the contents of data reported by ethdev stats, and rx_nombuf is just one of those fields.

Not talking about 'rx_nombuf' in 'eth_dev_handle_port_stats()', but talking about 'rx_mbuf_alloc_fail' in 'eth_dev_handle_port_info()',

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

should telemetry return interim 'eth_dev->data->rx_mbuf_alloc_failed' value, specially when 'rx_nombuf' is available?

Because at least for this driver returned 'rx_mbuf_alloc_fail' value will be wrong, I believe that is same for 'idpf' driver.

Thanks for the clarification, the question is clearer now. Having duplicate info seems strange.

Quoted 10 lines
Quoted 9 lines
Quoted 7 lines

Or, let me rephrase like this, 'eth_dev->data->rx_mbuf_alloc_failed' is not returned to user directly via ethdev APIs, but it is via telemetry.

I think it is not guaranteed that this value will be correct at any given time as telemetry assumes, so should we remove it from telemetry?

May not be necessary, PMD should be able to give the right number, this is something we can fix in idpf and cpfl PMD, to align with other PMD.

Quoted 9 lines
Quoted 4 lines

Thanks Qi, Ok to have drivers aligned to common usage.

Still, for telemetry we can consider removing 'rx_mbuf_alloc_fail', user can get that information from 'rx_nombuf'.

I would agree with Ferruh. The information on nombufs should be available just from the stats. It doesn't logically fit in the "info" category, especially when it is in stats already.

Thanks Bruce.

So, no need to update driver(s) related to 'rx_mbuf_alloc_fail', existing patch is good.

I will send ethdev telemetry change later, it is a minor change.

#197 lore raw

PATCH v7 19/21 net/cpfl: add RSS set/get ops

In reply to Mingxia Liu

Add support for these device ops:
- rss_reta_update
- rss_reta_query
- rss_hash_update
- rss_hash_conf_get

---
 drivers/net/cpfl/cpfl_ethdev.c | 270 ++++++++++++++++++++++++++++++++-
 1 file changed, 269 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +269 -1
index 0fb9f0455b..d2387b9a39 100644
@@ -30,6 +30,56 @@ static const char * const cpfl_valid_args[] = {
 	NULL
 };
 
+static const uint64_t cpfl_map_hena_rss[] = {
+	[IDPF_HASH_NONF_UNICAST_IPV4_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+	[IDPF_HASH_NONF_MULTICAST_IPV4_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+	[IDPF_HASH_NONF_IPV4_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+	[IDPF_HASH_NONF_IPV4_TCP_SYN_NO_ACK] =
+			RTE_ETH_RSS_NONFRAG_IPV4_TCP,
+	[IDPF_HASH_NONF_IPV4_TCP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_TCP,
+	[IDPF_HASH_NONF_IPV4_SCTP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_SCTP,
+	[IDPF_HASH_NONF_IPV4_OTHER] =
+			RTE_ETH_RSS_NONFRAG_IPV4_OTHER,
+	[IDPF_HASH_FRAG_IPV4] = RTE_ETH_RSS_FRAG_IPV4,
+
+	/* IPv6 */
+	[IDPF_HASH_NONF_UNICAST_IPV6_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+	[IDPF_HASH_NONF_MULTICAST_IPV6_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+	[IDPF_HASH_NONF_IPV6_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+	[IDPF_HASH_NONF_IPV6_TCP_SYN_NO_ACK] =
+			RTE_ETH_RSS_NONFRAG_IPV6_TCP,
+	[IDPF_HASH_NONF_IPV6_TCP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_TCP,
+	[IDPF_HASH_NONF_IPV6_SCTP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_SCTP,
+	[IDPF_HASH_NONF_IPV6_OTHER] =
+			RTE_ETH_RSS_NONFRAG_IPV6_OTHER,
+	[IDPF_HASH_FRAG_IPV6] = RTE_ETH_RSS_FRAG_IPV6,
+
+	/* L2 Payload */
+	[IDPF_HASH_L2_PAYLOAD] = RTE_ETH_RSS_L2_PAYLOAD
+};
+
+static const uint64_t cpfl_ipv4_rss = RTE_ETH_RSS_NONFRAG_IPV4_UDP |
+			  RTE_ETH_RSS_NONFRAG_IPV4_TCP |
+			  RTE_ETH_RSS_NONFRAG_IPV4_SCTP |
+			  RTE_ETH_RSS_NONFRAG_IPV4_OTHER |
+			  RTE_ETH_RSS_FRAG_IPV4;
+
+static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |
+			  RTE_ETH_RSS_NONFRAG_IPV6_TCP |
+			  RTE_ETH_RSS_NONFRAG_IPV6_SCTP |
+			  RTE_ETH_RSS_NONFRAG_IPV6_OTHER |
+			  RTE_ETH_RSS_FRAG_IPV6;
+
 static int
 cpfl_dev_link_update(struct rte_eth_dev *dev,
 		     __rte_unused int wait_to_complete)
@@ -97,6 +147,9 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->hash_key_size = vport->rss_key_size;
+	dev_info->reta_size = vport->rss_lut_size;
+
 	dev_info->flow_type_rss_offloads = CPFL_RSS_OFFLOAD_ALL;
 
 	dev_info->rx_offload_capa =
@@ -259,6 +312,36 @@ cpfl_dev_stats_reset(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int cpfl_config_rss_hf(struct idpf_vport *vport, uint64_t rss_hf)
+{
+	uint64_t hena = 0;
+	uint16_t i;
+
+	/**
+	 * RTE_ETH_RSS_IPV4 and RTE_ETH_RSS_IPV6 can be considered as 2
+	 * generalizations of all other IPv4 and IPv6 RSS types.
+	 */
+	if (rss_hf & RTE_ETH_RSS_IPV4)
+		rss_hf |= cpfl_ipv4_rss;
+
+	if (rss_hf & RTE_ETH_RSS_IPV6)
+		rss_hf |= cpfl_ipv6_rss;
+
+	for (i = 0; i < RTE_DIM(cpfl_map_hena_rss); i++) {
+		if (cpfl_map_hena_rss[i] & rss_hf)
+			hena |= BIT_ULL(i);
+	}
+
+	/**
+	 * At present, cp doesn't process the virtual channel msg of rss_hf configuration,
+	 * tips are given below.
+	 */
+	if (hena != vport->rss_hf)
+		PMD_DRV_LOG(WARNING, "Updating RSS Hash Function is not supported at present.");
+
+	return 0;
+}
+
 static int
 cpfl_init_rss(struct idpf_vport *vport)
 {
@@ -279,7 +362,7 @@ cpfl_init_rss(struct idpf_vport *vport)
 			     vport->rss_key_size);
 		return -EINVAL;
 	} else {
-		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+		memcpy(vport->rss_key, rss_conf->rss_key,
 			   vport->rss_key_size);
 	}
 
@@ -295,6 +378,187 @@ cpfl_init_rss(struct idpf_vport *vport)
 	return ret;
 }
 
+static int
+cpfl_rss_reta_update(struct rte_eth_dev *dev,
+		     struct rte_eth_rss_reta_entry64 *reta_conf,
+		     uint16_t reta_size)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t idx, shift;
+	int ret = 0;
+	uint16_t i;
+
+	if (adapter->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	if (reta_size != vport->rss_lut_size) {
+		PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
+				 "(%d) doesn't match the number of hardware can "
+				 "support (%d)",
+			    reta_size, vport->rss_lut_size);
+		return -EINVAL;
+	}
+
+	for (i = 0; i < reta_size; i++) {
+		idx = i / RTE_ETH_RETA_GROUP_SIZE;
+		shift = i % RTE_ETH_RETA_GROUP_SIZE;
+		if (reta_conf[idx].mask & (1ULL << shift))
+			vport->rss_lut[i] = reta_conf[idx].reta[shift];
+	}
+
+	/* send virtchnl ops to configure RSS */
+	ret = idpf_vc_rss_lut_set(vport);
+	if (ret)
+		PMD_INIT_LOG(ERR, "Failed to configure RSS lut");
+
+	return ret;
+}
+
+static int
+cpfl_rss_reta_query(struct rte_eth_dev *dev,
+		    struct rte_eth_rss_reta_entry64 *reta_conf,
+		    uint16_t reta_size)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	uint16_t idx, shift;
+	int ret = 0;
+	uint16_t i;
+
+	if (adapter->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	if (reta_size != vport->rss_lut_size) {
+		PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
+			"(%d) doesn't match the number of hardware can "
+			"support (%d)", reta_size, vport->rss_lut_size);
+		return -EINVAL;
+	}
+
+	ret = idpf_vc_rss_lut_get(vport);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to get RSS LUT");
+		return ret;
+	}
+
+	for (i = 0; i < reta_size; i++) {
+		idx = i / RTE_ETH_RETA_GROUP_SIZE;
+		shift = i % RTE_ETH_RETA_GROUP_SIZE;
+		if (reta_conf[idx].mask & (1ULL << shift))
+			reta_conf[idx].reta[shift] = vport->rss_lut[i];
+	}
+
+	return 0;
+}
+
+static int
+cpfl_rss_hash_update(struct rte_eth_dev *dev,
+		     struct rte_eth_rss_conf *rss_conf)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	int ret = 0;
+
+	if (adapter->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	if (!rss_conf->rss_key || rss_conf->rss_key_len == 0) {
+		PMD_DRV_LOG(DEBUG, "No key to be configured");
+		goto skip_rss_key;
+	} else if (rss_conf->rss_key_len != vport->rss_key_size) {
+		PMD_DRV_LOG(ERR, "The size of hash key configured "
+				 "(%d) doesn't match the size of hardware can "
+				 "support (%d)",
+			    rss_conf->rss_key_len,
+			    vport->rss_key_size);
+		return -EINVAL;
+	}
+
+	memcpy(vport->rss_key, rss_conf->rss_key,
+		   vport->rss_key_size);
+	ret = idpf_vc_rss_key_set(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS key");
+		return ret;
+	}
+
+skip_rss_key:
+	ret = cpfl_config_rss_hf(vport, rss_conf->rss_hf);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS hash");
+		return ret;
+	}
+
+	return 0;
+}
+
+static uint64_t
+cpfl_map_general_rss_hf(uint64_t config_rss_hf, uint64_t last_general_rss_hf)
+{
+	uint64_t valid_rss_hf = 0;
+	uint16_t i;
+
+	for (i = 0; i < RTE_DIM(cpfl_map_hena_rss); i++) {
+		uint64_t bit = BIT_ULL(i);
+
+		if (bit & config_rss_hf)
+			valid_rss_hf |= cpfl_map_hena_rss[i];
+	}
+
+	if (valid_rss_hf & cpfl_ipv4_rss)
+		valid_rss_hf |= last_general_rss_hf & RTE_ETH_RSS_IPV4;
+
+	if (valid_rss_hf & cpfl_ipv6_rss)
+		valid_rss_hf |= last_general_rss_hf & RTE_ETH_RSS_IPV6;
+
+	return valid_rss_hf;
+}
+
+static int
+cpfl_rss_hash_conf_get(struct rte_eth_dev *dev,
+		       struct rte_eth_rss_conf *rss_conf)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *adapter = vport->adapter;
+	int ret = 0;
+
+	if (adapter->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	ret = idpf_vc_rss_hash_get(vport);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to get RSS hf");
+		return ret;
+	}
+
+	rss_conf->rss_hf = cpfl_map_general_rss_hf(vport->rss_hf, vport->last_general_rss_hf);
+
+	if (!rss_conf->rss_key)
+		return 0;
+
+	ret = idpf_vc_rss_key_get(vport);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to get RSS key");
+		return ret;
+	}
+
+	if (rss_conf->rss_key_len > vport->rss_key_size)
+		rss_conf->rss_key_len = vport->rss_key_size;
+
+	memcpy(rss_conf->rss_key, vport->rss_key, rss_conf->rss_key_len);
+
+	return 0;
+}
+
 static int
 cpfl_dev_configure(struct rte_eth_dev *dev)
 {
@@ -852,6 +1116,10 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 	.stats_get			= cpfl_dev_stats_get,
 	.stats_reset			= cpfl_dev_stats_reset,
+	.reta_update			= cpfl_rss_reta_update,
+	.reta_query			= cpfl_rss_reta_query,
+	.rss_hash_update		= cpfl_rss_hash_update,
+	.rss_hash_conf_get		= cpfl_rss_hash_conf_get,
 };
 
 static uint16_t
Signature · 1 line
2.25.1
#198 lore raw

PATCH v7 20/21 net/cpfl: support scalar scatter Rx datapath for single queue model

In reply to Mingxia Liu

This patch add single q recv scatter Rx function.

---
 drivers/net/cpfl/cpfl_ethdev.c |  3 ++-
 drivers/net/cpfl/cpfl_rxtx.c   | 27 +++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  2 ++
 3 files changed, 31 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +2 -1
index d2387b9a39..f959a2911d 100644
@@ -157,7 +157,8 @@ cpfl_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_TIMESTAMP;
+		RTE_ETH_RX_OFFLOAD_TIMESTAMP		|
+		RTE_ETH_RX_OFFLOAD_SCATTER;
 
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM		|
drivers/net/cpfl/cpfl_rxtx.c +27 -0
index 0d5bfb901d..6226b02301 100644
@@ -503,6 +503,8 @@ int
 cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
 	struct idpf_rx_queue *rxq;
+	uint16_t max_pkt_len;
+	uint32_t frame_size;
 	int err;
 
 	if (rx_queue_id >= dev->data->nb_rx_queues)
@@ -516,6 +518,17 @@ cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		return -EINVAL;
 	}
 
+	frame_size = dev->data->mtu + CPFL_ETH_OVERHEAD;
+
+	max_pkt_len =
+	    RTE_MIN((uint32_t)CPFL_SUPPORT_CHAIN_NUM * rxq->rx_buf_len,
+		    frame_size);
+
+	rxq->max_pkt_len = max_pkt_len;
+	if ((dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) ||
+	    frame_size > rxq->rx_buf_len)
+		dev->data->scattered_rx = 1;
+
 	err = idpf_qc_ts_mbuf_register(rxq);
 	if (err != 0) {
 		PMD_DRV_LOG(ERR, "fail to register timestamp mbuf %u",
@@ -808,6 +821,13 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 			}
 #endif /* CC_AVX512_SUPPORT */
 		}
+		if (dev->data->scattered_rx) {
+			PMD_DRV_LOG(NOTICE,
+				    "Using Single Scalar Scatterd Rx (port %d).",
+				    dev->data->port_id);
+			dev->rx_pkt_burst = idpf_dp_singleq_recv_scatter_pkts;
+			return;
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Single Scalar Rx (port %d).",
 			    dev->data->port_id);
@@ -820,6 +840,13 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 			    dev->data->port_id);
 		dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts;
 	} else {
+		if (dev->data->scattered_rx) {
+			PMD_DRV_LOG(NOTICE,
+				    "Using Single Scalar Scatterd Rx (port %d).",
+				    dev->data->port_id);
+			dev->rx_pkt_burst = idpf_dp_singleq_recv_scatter_pkts;
+			return;
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Single Scalar Rx (port %d).",
 			    dev->data->port_id);
drivers/net/cpfl/cpfl_rxtx.h +2 -0
index 5f8144e55f..fb267d38c8 100644
@@ -21,6 +21,8 @@
 #define CPFL_DEFAULT_TX_RS_THRESH	32
 #define CPFL_DEFAULT_TX_FREE_THRESH	32
 
+#define CPFL_SUPPORT_CHAIN_NUM 5
+
 int cpfl_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);
Signature · 1 line
2.25.1
#199 lore raw

PATCH v7 21/21 net/cpfl: add xstats ops

In reply to Mingxia Liu

Add support for these device ops:
- dev_xstats_get
- dev_xstats_get_names
- dev_xstats_reset

---
 drivers/net/cpfl/cpfl_ethdev.c | 80 ++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +80 -0
index f959a2911d..543dbd60f0 100644
@@ -80,6 +80,30 @@ static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |
 			  RTE_ETH_RSS_NONFRAG_IPV6_OTHER |
 			  RTE_ETH_RSS_FRAG_IPV6;
 
+struct rte_cpfl_xstats_name_off {
+	char name[RTE_ETH_XSTATS_NAME_SIZE];
+	unsigned int offset;
+};
+
+static const struct rte_cpfl_xstats_name_off rte_cpfl_stats_strings[] = {
+	{"rx_bytes", offsetof(struct virtchnl2_vport_stats, rx_bytes)},
+	{"rx_unicast_packets", offsetof(struct virtchnl2_vport_stats, rx_unicast)},
+	{"rx_multicast_packets", offsetof(struct virtchnl2_vport_stats, rx_multicast)},
+	{"rx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, rx_broadcast)},
+	{"rx_dropped_packets", offsetof(struct virtchnl2_vport_stats, rx_discards)},
+	{"rx_errors", offsetof(struct virtchnl2_vport_stats, rx_errors)},
+	{"rx_unknown_protocol_packets", offsetof(struct virtchnl2_vport_stats,
+						 rx_unknown_protocol)},
+	{"tx_bytes", offsetof(struct virtchnl2_vport_stats, tx_bytes)},
+	{"tx_unicast_packets", offsetof(struct virtchnl2_vport_stats, tx_unicast)},
+	{"tx_multicast_packets", offsetof(struct virtchnl2_vport_stats, tx_multicast)},
+	{"tx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, tx_broadcast)},
+	{"tx_dropped_packets", offsetof(struct virtchnl2_vport_stats, tx_discards)},
+	{"tx_error_packets", offsetof(struct virtchnl2_vport_stats, tx_errors)}};
+
+#define CPFL_NB_XSTATS (sizeof(rte_cpfl_stats_strings) / \
+		sizeof(rte_cpfl_stats_strings[0]))
+
 static int
 cpfl_dev_link_update(struct rte_eth_dev *dev,
 		     __rte_unused int wait_to_complete)
@@ -313,6 +337,59 @@ cpfl_dev_stats_reset(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int cpfl_dev_xstats_reset(struct rte_eth_dev *dev)
+{
+	cpfl_dev_stats_reset(dev);
+	return 0;
+}
+
+static int cpfl_dev_xstats_get(struct rte_eth_dev *dev,
+			       struct rte_eth_xstat *xstats, unsigned int n)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	unsigned int i;
+	int ret;
+
+	if (n < CPFL_NB_XSTATS)
+		return CPFL_NB_XSTATS;
+
+	if (!xstats)
+		return 0;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Get statistics failed");
+		return 0;
+	}
+
+	idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+
+	/* loop over xstats array and values from pstats */
+	for (i = 0; i < CPFL_NB_XSTATS; i++) {
+		xstats[i].id = i;
+		xstats[i].value = *(uint64_t *)(((char *)pstats) +
+			rte_cpfl_stats_strings[i].offset);
+	}
+	return CPFL_NB_XSTATS;
+}
+
+static int cpfl_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+				     struct rte_eth_xstat_name *xstats_names,
+				     __rte_unused unsigned int limit)
+{
+	unsigned int i;
+
+	if (xstats_names)
+		for (i = 0; i < CPFL_NB_XSTATS; i++) {
+			snprintf(xstats_names[i].name,
+				 sizeof(xstats_names[i].name),
+				 "%s", rte_cpfl_stats_strings[i].name);
+		}
+	return CPFL_NB_XSTATS;
+}
+
 static int cpfl_config_rss_hf(struct idpf_vport *vport, uint64_t rss_hf)
 {
 	uint64_t hena = 0;
@@ -1121,6 +1198,9 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.reta_query			= cpfl_rss_reta_query,
 	.rss_hash_update		= cpfl_rss_hash_update,
 	.rss_hash_conf_get		= cpfl_rss_hash_conf_get,
+	.xstats_get			= cpfl_dev_xstats_get,
+	.xstats_get_names		= cpfl_dev_xstats_get_names,
+	.xstats_reset			= cpfl_dev_xstats_reset,
 };
 
 static uint16_t
Signature · 1 line
2.25.1
#200 lore raw

Re: [PATCH v7 21/21] net/cpfl: add xstats ops

Quoted 32 lines · Mingxia Liu

Add support for these device ops:
- dev_xstats_get
- dev_xstats_get_names
- dev_xstats_reset

---
 drivers/net/cpfl/cpfl_ethdev.c | 80 ++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +14 -0
index f959a2911d..543dbd60f0 100644
@@ -80,6 +80,30 @@ static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |
 			  RTE_ETH_RSS_NONFRAG_IPV6_OTHER |
 			  RTE_ETH_RSS_FRAG_IPV6;
 
+struct rte_cpfl_xstats_name_off {
+	char name[RTE_ETH_XSTATS_NAME_SIZE];
+	unsigned int offset;
+};
+
+static const struct rte_cpfl_xstats_name_off rte_cpfl_stats_strings[] = {
+	{"rx_bytes", offsetof(struct virtchnl2_vport_stats, rx_bytes)},
+	{"rx_unicast_packets", offsetof(struct virtchnl2_vport_stats, rx_unicast)},
+	{"rx_multicast_packets", offsetof(struct virtchnl2_vport_stats, rx_multicast)},
+	{"rx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, rx_broadcast)},
+	{"rx_dropped_packets", offsetof(struct virtchnl2_vport_stats, rx_discards)},
+	{"rx_errors", offsetof(struct virtchnl2_vport_stats, rx_errors)},
+	{"rx_unknown_protocol_packets", offsetof(struct virtchnl2_vport_stats,
+						 rx_unknown_protocol)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP | · line 106

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c +10 -0
+	{"tx_bytes", offsetof(struct virtchnl2_vport_stats, tx_bytes)},
+	{"tx_unicast_packets", offsetof(struct virtchnl2_vport_stats, tx_unicast)},
+	{"tx_multicast_packets", offsetof(struct virtchnl2_vport_stats, tx_multicast)},
+	{"tx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, tx_broadcast)},
+	{"tx_dropped_packets", offsetof(struct virtchnl2_vport_stats, tx_discards)},
+	{"tx_error_packets", offsetof(struct virtchnl2_vport_stats, tx_errors)}};
+
+#define CPFL_NB_XSTATS (sizeof(rte_cpfl_stats_strings) / \
+		sizeof(rte_cpfl_stats_strings[0]))
+

Can use RTE_DIM here.

Quoted 18 lines
drivers/net/cpfl/cpfl_ethdev.c +11 -0
 static int
 cpfl_dev_link_update(struct rte_eth_dev *dev,
 		     __rte_unused int wait_to_complete)
@@ -313,6 +337,59 @@ cpfl_dev_stats_reset(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int cpfl_dev_xstats_reset(struct rte_eth_dev *dev)
+{
+	cpfl_dev_stats_reset(dev);
+	return 0;
+}
+
+static int cpfl_dev_xstats_get(struct rte_eth_dev *dev,
+			       struct rte_eth_xstat *xstats, unsigned int n)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_stats_reset(struct rte_eth_dev *dev) · line 360

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c +10 -0
+	struct virtchnl2_vport_stats *pstats = NULL;
+	unsigned int i;
+	int ret;
+
+	if (n < CPFL_NB_XSTATS)
+		return CPFL_NB_XSTATS;
+
+	if (!xstats)
+		return 0;
+

if 'xstats' is NULL, it should return 'CPFL_NB_XSTATS'.

#201 lore raw

RE: [PATCH v7 21/21] net/cpfl: add xstats ops

Quoted 88 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:53 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 21/21] net/cpfl: add xstats ops

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss =

Quoted 16 lines · Mingxia Liu

Add support for these device ops:
- dev_xstats_get
- dev_xstats_get_names
- dev_xstats_reset

---
 drivers/net/cpfl/cpfl_ethdev.c | 80
++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
(quoted diff) +0 -0

b/drivers/net/cpfl/cpfl_ethdev.c index f959a2911d..543dbd60f0 100644

drivers/net/cpfl/cpfl_ethdev.c +0 -0
@@ -80,6 +80,30 @@ static const uint64_t cpfl_ipv6_rss =

RTE_ETH_RSS_NONFRAG_IPV6_UDP |

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |

Quoted 11 lines
drivers/net/cpfl/cpfl_ethdev.c +8 -0
 			  RTE_ETH_RSS_NONFRAG_IPV6_OTHER |
 			  RTE_ETH_RSS_FRAG_IPV6;
 
+struct rte_cpfl_xstats_name_off {
+	char name[RTE_ETH_XSTATS_NAME_SIZE];
+	unsigned int offset;
+};
+
+static const struct rte_cpfl_xstats_name_off rte_cpfl_stats_strings[] = {
+	{"rx_bytes", offsetof(struct virtchnl2_vport_stats, rx_bytes)},
+	{"rx_unicast_packets", offsetof(struct virtchnl2_vport_stats,

rx_unicast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 91

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"rx_multicast_packets", offsetof(struct virtchnl2_vport_stats,

rx_multicast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 92

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"rx_broadcast_packets", offsetof(struct virtchnl2_vport_stats,

rx_broadcast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 93

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"rx_dropped_packets", offsetof(struct virtchnl2_vport_stats,

rx_discards)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 95

Quoted 2 lines
drivers/net/cpfl/cpfl_ethdev.c +2 -0
+	{"rx_errors", offsetof(struct virtchnl2_vport_stats, rx_errors)},
+	{"rx_unknown_protocol_packets", offsetof(struct

virtchnl2_vport_stats,

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |

Quoted 3 lines
drivers/net/cpfl/cpfl_ethdev.c +3 -0
+						 rx_unknown_protocol)},
+	{"tx_bytes", offsetof(struct virtchnl2_vport_stats, tx_bytes)},
+	{"tx_unicast_packets", offsetof(struct virtchnl2_vport_stats,

tx_unicast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 99

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"tx_multicast_packets", offsetof(struct virtchnl2_vport_stats,

tx_multicast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 100

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"tx_broadcast_packets", offsetof(struct virtchnl2_vport_stats,

tx_broadcast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 101

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"tx_dropped_packets", offsetof(struct virtchnl2_vport_stats,

tx_discards)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP | · line 106

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c +6 -0
+	{"tx_error_packets", offsetof(struct virtchnl2_vport_stats,
+tx_errors)}};
+
+#define CPFL_NB_XSTATS (sizeof(rte_cpfl_stats_strings) / \
+		sizeof(rte_cpfl_stats_strings[0]))
+

Can use RTE_DIM here.

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |

Quoted 3 lines
drivers/net/cpfl/cpfl_ethdev.c +0 -0
 static int
 cpfl_dev_link_update(struct rte_eth_dev *dev,
 		     __rte_unused int wait_to_complete) @@ -313,6

+337,59 @@

Quoted 17 lines

cpfl_dev_stats_reset(struct rte_eth_dev *dev)

drivers/net/cpfl/cpfl_ethdev.c +13 -0
 	return 0;
 }
 
+static int cpfl_dev_xstats_reset(struct rte_eth_dev *dev) {
+	cpfl_dev_stats_reset(dev);
+	return 0;
+}
+
+static int cpfl_dev_xstats_get(struct rte_eth_dev *dev,
+			       struct rte_eth_xstat *xstats, unsigned int n) {
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	unsigned int i;
+	int ret;
+
Quoted 8 lines

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_stats_reset(struct rte_eth_dev *dev) · line 360

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c +6 -0
+	if (n < CPFL_NB_XSTATS)
+		return CPFL_NB_XSTATS;
+
+	if (!xstats)
+		return 0;
+

if 'xstats' is NULL, it should return 'CPFL_NB_XSTATS'.

[Liu, Mingxia] ok thanks!

#202 lore raw

RE: [PATCH v7 21/21] net/cpfl: add xstats ops

In reply to Ferruh Yigit
Quoted 58 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:53 AM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v7 21/21] net/cpfl: add xstats ops

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss =

Quoted 16 lines · Mingxia Liu

Add support for these device ops:
- dev_xstats_get
- dev_xstats_get_names
- dev_xstats_reset

---
 drivers/net/cpfl/cpfl_ethdev.c | 80
++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
(quoted diff) +0 -0

b/drivers/net/cpfl/cpfl_ethdev.c index f959a2911d..543dbd60f0 100644

drivers/net/cpfl/cpfl_ethdev.c +0 -0
@@ -80,6 +80,30 @@ static const uint64_t cpfl_ipv6_rss =

RTE_ETH_RSS_NONFRAG_IPV6_UDP |

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |

Quoted 11 lines
drivers/net/cpfl/cpfl_ethdev.c +8 -0
 			  RTE_ETH_RSS_NONFRAG_IPV6_OTHER |
 			  RTE_ETH_RSS_FRAG_IPV6;
 
+struct rte_cpfl_xstats_name_off {
+	char name[RTE_ETH_XSTATS_NAME_SIZE];
+	unsigned int offset;
+};
+
+static const struct rte_cpfl_xstats_name_off rte_cpfl_stats_strings[] = {
+	{"rx_bytes", offsetof(struct virtchnl2_vport_stats, rx_bytes)},
+	{"rx_unicast_packets", offsetof(struct virtchnl2_vport_stats,

rx_unicast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 91

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"rx_multicast_packets", offsetof(struct virtchnl2_vport_stats,

rx_multicast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 92

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"rx_broadcast_packets", offsetof(struct virtchnl2_vport_stats,

rx_broadcast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 93

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"rx_dropped_packets", offsetof(struct virtchnl2_vport_stats,

rx_discards)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 95

Quoted 2 lines
drivers/net/cpfl/cpfl_ethdev.c +2 -0
+	{"rx_errors", offsetof(struct virtchnl2_vport_stats, rx_errors)},
+	{"rx_unknown_protocol_packets", offsetof(struct

virtchnl2_vport_stats,

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |

Quoted 3 lines
drivers/net/cpfl/cpfl_ethdev.c +3 -0
+						 rx_unknown_protocol)},
+	{"tx_bytes", offsetof(struct virtchnl2_vport_stats, tx_bytes)},
+	{"tx_unicast_packets", offsetof(struct virtchnl2_vport_stats,

tx_unicast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 99

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"tx_multicast_packets", offsetof(struct virtchnl2_vport_stats,

tx_multicast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 100

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"tx_broadcast_packets", offsetof(struct virtchnl2_vport_stats,

tx_broadcast)},

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = · line 101

Quoted 1 line
drivers/net/cpfl/cpfl_ethdev.c +1 -0
+	{"tx_dropped_packets", offsetof(struct virtchnl2_vport_stats,

tx_discards)},

Quoted 9 lines

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP | · line 106

Quoted 6 lines
drivers/net/cpfl/cpfl_ethdev.c +6 -0
+	{"tx_error_packets", offsetof(struct virtchnl2_vport_stats,
+tx_errors)}};
+
+#define CPFL_NB_XSTATS (sizeof(rte_cpfl_stats_strings) / \
+		sizeof(rte_cpfl_stats_strings[0]))
+

Can use RTE_DIM here.

[Liu, Mingxia] Ok, it‘s better, thanks.

Quoted 29 lines

drivers/net/cpfl/cpfl_ethdev.c static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |

Quoted 3 lines
drivers/net/cpfl/cpfl_ethdev.c +0 -0
 static int
 cpfl_dev_link_update(struct rte_eth_dev *dev,
 		     __rte_unused int wait_to_complete) @@ -313,6

+337,59 @@

Quoted 13 lines

cpfl_dev_stats_reset(struct rte_eth_dev *dev)

drivers/net/cpfl/cpfl_ethdev.c +9 -0
 	return 0;
 }
 
+static int cpfl_dev_xstats_reset(struct rte_eth_dev *dev) {
+	cpfl_dev_stats_reset(dev);
+	return 0;
+}
+
+static int cpfl_dev_xstats_get(struct rte_eth_dev *dev,
+			       struct rte_eth_xstat *xstats, unsigned int n) {
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_stats_reset(struct rte_eth_dev *dev) · line 360

Quoted 10 lines
drivers/net/cpfl/cpfl_ethdev.c +10 -0
+	struct virtchnl2_vport_stats *pstats = NULL;
+	unsigned int i;
+	int ret;
+
+	if (n < CPFL_NB_XSTATS)
+		return CPFL_NB_XSTATS;
+
+	if (!xstats)
+		return 0;
+

if 'xstats' is NULL, it should return 'CPFL_NB_XSTATS'.

#203 lore raw
In reply to Mingxia Liu
Quoted 10 lines · Mingxia Liu

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

Hi Mingxia, Beilei, Yuying,

Do you know if is there any effort to make device specific offloads part of IDPF spec?

Overall, working on a standard interface and upstreaming driver for it (idpf) but next product is diverging from the standard and requiring a dedicated driver, do you know if 'cpfl' is a temporary solution while standard gets required update or is it a long term difference between standard?

Quoted 77 lines

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared library.

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v5 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info
v6 changes:
- for small fixed size structure, change rte_memcpy to memcpy()
- fix compilation for AVX512DQ
- update cpfl maintainers
v7 changes:
- add dependency in cover-letter

This patchset is based on the idpf PMD code:
http://patches.dpdk.org/project/dpdk/cover/[email protected]/
http://patches.dpdk.org/project/dpdk/cover/[email protected]/
http://patches.dpdk.org/project/dpdk/cover/[email protected]/
http://patches.dpdk.org/project/dpdk/cover/[email protected]/

Mingxia Liu (21):
net/cpfl: support device initialization
net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop
net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release
net/cpfl: support MTU configuration
net/cpfl: support basic Rx data path
net/cpfl: support basic Tx data path
net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading
net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

 MAINTAINERS                             |    8 +
 doc/guides/nics/cpfl.rst                |   88 ++
 doc/guides/nics/features/cpfl.ini       |   17 +
 doc/guides/rel_notes/release_23_03.rst  |    6 +
 drivers/net/cpfl/cpfl_ethdev.c          | 1453 +++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h          |   95 ++
 drivers/net/cpfl/cpfl_logs.h            |   32 +
 drivers/net/cpfl/cpfl_rxtx.c            |  952 +++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h            |   44 +
 drivers/net/cpfl/cpfl_rxtx_vec_common.h |  116 ++
 drivers/net/cpfl/meson.build            |   40 +
 drivers/net/meson.build                 |    1 +
 12 files changed, 2852 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx_vec_common.h
 create mode 100644 drivers/net/cpfl/meson.build
#204 lore raw
Quoted 22 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, February 28, 2023 5:44 AM
To: Liu, Mingxia <[email protected]>; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Cc: [email protected]; Mcnamara, John <[email protected]>
Subject: Re: [PATCH v7 00/21] add support for cpfl PMD in DPDK

Quoted 10 lines · Mingxia Liu

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

Quoted 4 lines

Hi Mingxia, Beilei, Yuying,

Do you know if is there any effort to make device specific offloads part of IDPF spec?

Currently, there is no related effort for standard idpf, but the vendors can enable their own hardware offloading feature based on idpf spec, (like cpfl), and the common/idpf can be leveraged.

Regards
Qi

Quoted 95 lines

Overall, working on a standard interface and upstreaming driver for it (idpf) but next product is diverging from the standard and requiring a dedicated driver, do you know if 'cpfl' is a temporary solution while standard gets required update or is it a long term difference between standard?

Quoted 3 lines

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared

library.

Quoted 21 lines

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v5 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info
v6 changes:
- for small fixed size structure, change rte_memcpy to memcpy()
- fix compilation for AVX512DQ
- update cpfl maintainers
v7 changes:
- add dependency in cover-letter

Quoted 2 lines

This patchset is based on the idpf PMD code:
http://patches.dpdk.org/project/dpdk/cover/20230206054618.40975-1-

beil

Quoted 2 lines

[email protected]/
http://patches.dpdk.org/project/dpdk/cover/20230106090501.9106-1-

beile

Quoted 2 lines

[email protected]/
http://patches.dpdk.org/project/dpdk/cover/20230207084549.2225214-1-

we

Quoted 2 lines

[email protected]/
http://patches.dpdk.org/project/dpdk/cover/20230208073401.2468579-1-

mi

Quoted 49 lines

[email protected]/

Mingxia Liu (21):
net/cpfl: support device initialization
net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop
net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release
net/cpfl: support MTU configuration
net/cpfl: support basic Rx data path
net/cpfl: support basic Tx data path
net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading
net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

 MAINTAINERS                             |    8 +
 doc/guides/nics/cpfl.rst                |   88 ++
 doc/guides/nics/features/cpfl.ini       |   17 +
 doc/guides/rel_notes/release_23_03.rst  |    6 +
 drivers/net/cpfl/cpfl_ethdev.c          | 1453 +++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h          |   95 ++
 drivers/net/cpfl/cpfl_logs.h            |   32 +
 drivers/net/cpfl/cpfl_rxtx.c            |  952 +++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h            |   44 +
 drivers/net/cpfl/cpfl_rxtx_vec_common.h |  116 ++
 drivers/net/cpfl/meson.build            |   40 +
 drivers/net/meson.build                 |    1 +
 12 files changed, 2852 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst  create mode 100644
doc/guides/nics/features/cpfl.ini  create mode 100644
drivers/net/cpfl/cpfl_ethdev.c  create mode 100644
drivers/net/cpfl/cpfl_ethdev.h  create mode 100644
drivers/net/cpfl/cpfl_logs.h  create mode 100644
drivers/net/cpfl/cpfl_rxtx.c  create mode 100644
drivers/net/cpfl/cpfl_rxtx.h  create mode 100644
drivers/net/cpfl/cpfl_rxtx_vec_common.h
 create mode 100644 drivers/net/cpfl/meson.build
#205 lore raw

v8 cover add support for cpfl PMD in DPDK

In reply to Mingxia Liu

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared library.

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v5 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info
v6 changes:
- for small fixed size structure, change rte_memcpy to memcpy()
- fix compilation for AVX512DQ
- update cpfl maintainers
v7 changes:
- add dependency in cover-letter
v8 changes:
- improve documentation and commit msg
- optimize function cpfl_dev_link_update()
- refine devargs check

This patchset is based on the idpf PMD code for refining Rx/Tx queue model info:
http://patches.dpdk.org/project/dpdk/patch/[email protected]/

Mingxia Liu (21):
net/cpfl: support device initialization
net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop
net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release
net/cpfl: support MTU configuration
net/cpfl: support basic Rx data path
net/cpfl: support basic Tx data path
net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading
net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

 MAINTAINERS                             |    8 +
 doc/guides/nics/cpfl.rst                |  107 ++
 doc/guides/nics/features/cpfl.ini       |   16 +
 doc/guides/nics/index.rst               |    1 +
 doc/guides/rel_notes/release_23_03.rst  |    6 +
 drivers/net/cpfl/cpfl_ethdev.c          | 1466 +++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h          |   94 ++
 drivers/net/cpfl/cpfl_logs.h            |   29 +
 drivers/net/cpfl/cpfl_rxtx.c            |  951 +++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h            |   44 +
 drivers/net/cpfl/cpfl_rxtx_vec_common.h |  116 ++
 drivers/net/cpfl/meson.build            |   40 +
 drivers/net/meson.build                 |    1 +
 13 files changed, 2879 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx_vec_common.h
 create mode 100644 drivers/net/cpfl/meson.build
Signature · 1 line
2.34.1
#206 lore raw

PATCH v8 1/21 net/cpfl: support device initialization

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

---
 MAINTAINERS                            |   8 +
 doc/guides/nics/cpfl.rst               |  85 +++
 doc/guides/nics/features/cpfl.ini      |  12 +
 doc/guides/nics/index.rst              |   1 +
 doc/guides/rel_notes/release_23_03.rst |   6 +
 drivers/net/cpfl/cpfl_ethdev.c         | 772 +++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h         |  77 +++
 drivers/net/cpfl/cpfl_logs.h           |  29 +
 drivers/net/cpfl/meson.build           |  14 +
 drivers/net/meson.build                |   1 +
 10 files changed, 1005 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/meson.build
MAINTAINERS +8 -0
index ffbf91296e..878204c93b 100644
@@ -783,6 +783,14 @@ F: drivers/common/idpf/
 F: doc/guides/nics/idpf.rst
 F: doc/guides/nics/features/idpf.ini
 
+Intel cpfl - EXPERIMENTAL
+M: Yuying Zhang <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/cpfl/
+F: doc/guides/nics/cpfl.rst
+F: doc/guides/nics/features/cpfl.ini
+
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/cpfl.rst new file +85 -0

86 lines not on this page · raw message

doc/guides/nics/features/cpfl.ini new file +12 -0
new file mode 100644
index 0000000000..a2d1ca9e15
@@ -0,0 +1,12 @@
+;
+; Supported features of the 'cpfl' 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]
+Linux                = Y
+x86-32               = Y
+x86-64               = Y
doc/guides/nics/index.rst +1 -0
index df58a237ca..5c9d1edf5e 100644
@@ -20,6 +20,7 @@ Network Interface Controller Drivers
     bnx2x
     bnxt
     cnxk
+    cpfl
     cxgbe
     dpaa
     dpaa2
doc/guides/rel_notes/release_23_03.rst +6 -0
index 49c18617a5..29690d8813 100644
@@ -148,6 +148,12 @@ New Features
   * Added support for timesync API.
   * Added support for packet pacing (launch time offloading).
 
+* **Added Intel cpfl driver.**
+
+  * Added the new ``cpfl`` net driver
+    for Intel\ |reg| Infrastructure Processing Unit (Intel\ |reg| IPU) E2100.
+    See the :doc:`../nics/cpfl.rst` NIC guide for more details on this new driver.
+
 * **Updated Marvell cnxk ethdev driver.**
 
   * Added support to skip RED using ``RTE_FLOW_ACTION_TYPE_SKIP_CMAN``.
drivers/net/cpfl/cpfl_ethdev.c new file +772 -0

772 lines not on this page · raw message

drivers/net/cpfl/cpfl_ethdev.h new file +77 -0

77 lines not on this page · raw message

drivers/net/cpfl/cpfl_logs.h new file +29 -0
new file mode 100644
index 0000000000..bdfa5c41a5
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#ifndef _CPFL_LOGS_H_
+#define _CPFL_LOGS_H_
+
+#include <rte_log.h>
+
+extern int cpfl_logtype_init;
+extern int cpfl_logtype_driver;
+
+#define PMD_INIT_LOG(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_init, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_driver, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#endif /* _CPFL_LOGS_H_ */
drivers/net/cpfl/meson.build new file +14 -0
new file mode 100644
index 0000000000..c721732b50
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+
+if is_windows
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
+endif
+
+deps += ['common_idpf']
+
+sources = files(
+        'cpfl_ethdev.c',
+)
\ No newline at end of file
drivers/net/meson.build +1 -0
index f83a6de117..b1df17ce8c 100644
@@ -13,6 +13,7 @@ drivers = [
         'bnxt',
         'bonding',
         'cnxk',
+        'cpfl',
         'cxgbe',
         'dpaa',
         'dpaa2',
Signature · 1 line
2.34.1
#207 lore raw

Re: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 8 lines · Mingxia Liu

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

<...>

doc/guides/nics/cpfl.rst line 3

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +3 -0
@@ -0,0 +1,85 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2022 Intel Corporation.
+

s/2022/2023

<...>

Quoted 83 lines
doc/guides/nics/cpfl.rst new file +83 -0
+static int
+cpfl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+	       struct rte_pci_device *pci_dev)
+{
+	struct cpfl_vport_param vport_param;
+	struct cpfl_adapter_ext *adapter;
+	struct cpfl_devargs devargs;
+	char name[RTE_ETH_NAME_MAX_LEN];
+	int i, retval;
+	bool first_probe = false;
+
+	if (!cpfl_adapter_list_init) {
+		rte_spinlock_init(&cpfl_adapter_lock);
+		TAILQ_INIT(&cpfl_adapter_list);
+		cpfl_adapter_list_init = true;
+	}
+
+	adapter = cpfl_find_adapter_ext(pci_dev);
+	if (adapter == NULL) {
+		first_probe = true;
+		adapter = rte_zmalloc("cpfl_adapter_ext",
+				      sizeof(struct cpfl_adapter_ext), 0);
+		if (adapter == NULL) {
+			PMD_INIT_LOG(ERR, "Failed to allocate adapter.");
+			return -ENOMEM;
+		}
+
+		retval = cpfl_adapter_ext_init(pci_dev, adapter);
+		if (retval != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init adapter.");
+			return retval;
+		}
+
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_INSERT_TAIL(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+	}
+
+	retval = cpfl_parse_devargs(pci_dev, adapter, &devargs);
+	if (retval != 0) {
+		PMD_INIT_LOG(ERR, "Failed to parse private devargs");
+		goto err;
+	}
+
+	if (devargs.req_vport_nb == 0) {
+		/* If no vport devarg, create vport 0 by default. */
+		vport_param.adapter = adapter;
+		vport_param.devarg_id = 0;
+		vport_param.idx = cpfl_vport_idx_alloc(adapter);
+		if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+			PMD_INIT_LOG(ERR, "No space for vport %u", vport_param.devarg_id);
+			return 0;
+		}
+		snprintf(name, sizeof(name), "cpfl_%s_vport_0",
+			 pci_dev->device.name);
+		retval = rte_eth_dev_create(&pci_dev->device, name,
+					    sizeof(struct idpf_vport),
+					    NULL, NULL, cpfl_dev_vport_init,
+					    &vport_param);
+		if (retval != 0)
+			PMD_DRV_LOG(ERR, "Failed to create default vport 0");
+	} else {
+		for (i = 0; i < devargs.req_vport_nb; i++) {
+			vport_param.adapter = adapter;
+			vport_param.devarg_id = devargs.req_vports[i];
+			vport_param.idx = cpfl_vport_idx_alloc(adapter);
+			if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+				PMD_INIT_LOG(ERR, "No space for vport %u", vport_param.devarg_id);
+				break;
+			}
+			snprintf(name, sizeof(name), "cpfl_%s_vport_%d",
+				 pci_dev->device.name,
+				 devargs.req_vports[i]);
+			retval = rte_eth_dev_create(&pci_dev->device, name,
+						    sizeof(struct idpf_vport),
+						    NULL, NULL, cpfl_dev_vport_init,
+						    &vport_param);
+			if (retval != 0)
+				PMD_DRV_LOG(ERR, "Failed to create vport %d",
+					    vport_param.devarg_id);
+		}
+	}
+

doc/guides/nics/cpfl.rst

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+	return 0;
+
+err:
+	if (first_probe) {
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_REMOVE(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+		cpfl_adapter_ext_deinit(adapter);
+		rte_free(adapter);
+	}

Is 'first_probe' left intentionally? If so, what is the reason to have this condition?

#208 lore raw

RE: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 125 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 2, 2023 5:31 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 8 lines · Mingxia Liu

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

<...>

doc/guides/nics/cpfl.rst line 3

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +3 -0
@@ -0,0 +1,85 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2022 Intel Corporation.
+

s/2022/2023

<...>

Quoted 40 lines
doc/guides/nics/cpfl.rst new file +40 -0
+static int
+cpfl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+	       struct rte_pci_device *pci_dev) {
+	struct cpfl_vport_param vport_param;
+	struct cpfl_adapter_ext *adapter;
+	struct cpfl_devargs devargs;
+	char name[RTE_ETH_NAME_MAX_LEN];
+	int i, retval;
+	bool first_probe = false;
+
+	if (!cpfl_adapter_list_init) {
+		rte_spinlock_init(&cpfl_adapter_lock);
+		TAILQ_INIT(&cpfl_adapter_list);
+		cpfl_adapter_list_init = true;
+	}
+
+	adapter = cpfl_find_adapter_ext(pci_dev);
+	if (adapter == NULL) {
+		first_probe = true;
+		adapter = rte_zmalloc("cpfl_adapter_ext",
+				      sizeof(struct cpfl_adapter_ext), 0);
+		if (adapter == NULL) {
+			PMD_INIT_LOG(ERR, "Failed to allocate adapter.");
+			return -ENOMEM;
+		}
+
+		retval = cpfl_adapter_ext_init(pci_dev, adapter);
+		if (retval != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init adapter.");
+			return retval;
+		}
+
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_INSERT_TAIL(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+	}
+
+	retval = cpfl_parse_devargs(pci_dev, adapter, &devargs);
+	if (retval != 0) {
+		PMD_INIT_LOG(ERR, "Failed to parse private devargs");

doc/guides/nics/cpfl.rst line 53

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+		goto err;
+	}
+
+	if (devargs.req_vport_nb == 0) {
+		/* If no vport devarg, create vport 0 by default. */
+		vport_param.adapter = adapter;
+		vport_param.devarg_id = 0;
+		vport_param.idx = cpfl_vport_idx_alloc(adapter);
+		if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+			PMD_INIT_LOG(ERR, "No space for vport %u",

vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 63

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+			return 0;
+		}
+		snprintf(name, sizeof(name), "cpfl_%s_vport_0",
+			 pci_dev->device.name);
+		retval = rte_eth_dev_create(&pci_dev->device, name,
+					    sizeof(struct idpf_vport),
+					    NULL, NULL, cpfl_dev_vport_init,
+					    &vport_param);
+		if (retval != 0)
+			PMD_DRV_LOG(ERR, "Failed to create default vport

0");

doc/guides/nics/cpfl.rst line 70

Quoted 7 lines
doc/guides/nics/cpfl.rst new file +7 -0
+	} else {
+		for (i = 0; i < devargs.req_vport_nb; i++) {
+			vport_param.adapter = adapter;
+			vport_param.devarg_id = devargs.req_vports[i];
+			vport_param.idx = cpfl_vport_idx_alloc(adapter);
+			if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+				PMD_INIT_LOG(ERR, "No space for

vport %u", vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 76

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +6 -0
+				break;
+			}
+			snprintf(name, sizeof(name), "cpfl_%s_vport_%d",
+				 pci_dev->device.name,
+				 devargs.req_vports[i]);
+			retval = rte_eth_dev_create(&pci_dev->device,

name,

doc/guides/nics/cpfl.rst line 78

Quoted 2 lines
doc/guides/nics/cpfl.rst new file +2 -0
+						    sizeof(struct idpf_vport),
+						    NULL, NULL,

cpfl_dev_vport_init,

doc/guides/nics/cpfl.rst line 81

Quoted 3 lines
doc/guides/nics/cpfl.rst new file +3 -0
+						    &vport_param);
+			if (retval != 0)
+				PMD_DRV_LOG(ERR, "Failed to create

vport %d",

Quoted 9 lines
doc/guides/nics/cpfl.rst new file +9 -0
+					    vport_param.devarg_id);
+		}
+	}
+
+	return 0;
+
+err:
+	if (first_probe) {
+		rte_spinlock_lock(&cpfl_adapter_lock);
Quoted 8 lines

doc/guides/nics/cpfl.rst

Quoted 5 lines
doc/guides/nics/cpfl.rst new file +5 -0
+		TAILQ_REMOVE(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+		cpfl_adapter_ext_deinit(adapter);
+		rte_free(adapter);
+	}

Is 'first_probe' left intentionally? If so, what is the reason to have this condition?

[beileix] It's related to create vports at runtime, this feature will be implemented in the future, but now it doesn't suppor.

Quoted 1 line
#209 lore raw

Re: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 133 lines · Mingxia
Quoted 125 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 2, 2023 5:31 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 8 lines · Mingxia Liu

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

<...>

doc/guides/nics/cpfl.rst line 3

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +3 -0
@@ -0,0 +1,85 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2022 Intel Corporation.
+

s/2022/2023

<...>

Quoted 40 lines
doc/guides/nics/cpfl.rst new file +40 -0
+static int
+cpfl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+	       struct rte_pci_device *pci_dev) {
+	struct cpfl_vport_param vport_param;
+	struct cpfl_adapter_ext *adapter;
+	struct cpfl_devargs devargs;
+	char name[RTE_ETH_NAME_MAX_LEN];
+	int i, retval;
+	bool first_probe = false;
+
+	if (!cpfl_adapter_list_init) {
+		rte_spinlock_init(&cpfl_adapter_lock);
+		TAILQ_INIT(&cpfl_adapter_list);
+		cpfl_adapter_list_init = true;
+	}
+
+	adapter = cpfl_find_adapter_ext(pci_dev);
+	if (adapter == NULL) {
+		first_probe = true;
+		adapter = rte_zmalloc("cpfl_adapter_ext",
+				      sizeof(struct cpfl_adapter_ext), 0);
+		if (adapter == NULL) {
+			PMD_INIT_LOG(ERR, "Failed to allocate adapter.");
+			return -ENOMEM;
+		}
+
+		retval = cpfl_adapter_ext_init(pci_dev, adapter);
+		if (retval != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init adapter.");
+			return retval;
+		}
+
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_INSERT_TAIL(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+	}
+
+	retval = cpfl_parse_devargs(pci_dev, adapter, &devargs);
+	if (retval != 0) {
+		PMD_INIT_LOG(ERR, "Failed to parse private devargs");

doc/guides/nics/cpfl.rst line 53

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+		goto err;
+	}
+
+	if (devargs.req_vport_nb == 0) {
+		/* If no vport devarg, create vport 0 by default. */
+		vport_param.adapter = adapter;
+		vport_param.devarg_id = 0;
+		vport_param.idx = cpfl_vport_idx_alloc(adapter);
+		if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+			PMD_INIT_LOG(ERR, "No space for vport %u",

vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 63

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+			return 0;
+		}
+		snprintf(name, sizeof(name), "cpfl_%s_vport_0",
+			 pci_dev->device.name);
+		retval = rte_eth_dev_create(&pci_dev->device, name,
+					    sizeof(struct idpf_vport),
+					    NULL, NULL, cpfl_dev_vport_init,
+					    &vport_param);
+		if (retval != 0)
+			PMD_DRV_LOG(ERR, "Failed to create default vport

0");

doc/guides/nics/cpfl.rst line 70

Quoted 7 lines
doc/guides/nics/cpfl.rst new file +7 -0
+	} else {
+		for (i = 0; i < devargs.req_vport_nb; i++) {
+			vport_param.adapter = adapter;
+			vport_param.devarg_id = devargs.req_vports[i];
+			vport_param.idx = cpfl_vport_idx_alloc(adapter);
+			if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+				PMD_INIT_LOG(ERR, "No space for

vport %u", vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 76

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +6 -0
+				break;
+			}
+			snprintf(name, sizeof(name), "cpfl_%s_vport_%d",
+				 pci_dev->device.name,
+				 devargs.req_vports[i]);
+			retval = rte_eth_dev_create(&pci_dev->device,

name,

doc/guides/nics/cpfl.rst line 78

Quoted 2 lines
doc/guides/nics/cpfl.rst new file +2 -0
+						    sizeof(struct idpf_vport),
+						    NULL, NULL,

cpfl_dev_vport_init,

doc/guides/nics/cpfl.rst line 81

Quoted 3 lines
doc/guides/nics/cpfl.rst new file +3 -0
+						    &vport_param);
+			if (retval != 0)
+				PMD_DRV_LOG(ERR, "Failed to create

vport %d",

Quoted 9 lines
doc/guides/nics/cpfl.rst new file +9 -0
+					    vport_param.devarg_id);
+		}
+	}
+
+	return 0;
+
+err:
+	if (first_probe) {
+		rte_spinlock_lock(&cpfl_adapter_lock);
Quoted 8 lines

doc/guides/nics/cpfl.rst

Quoted 5 lines
doc/guides/nics/cpfl.rst new file +5 -0
+		TAILQ_REMOVE(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+		cpfl_adapter_ext_deinit(adapter);
+		rte_free(adapter);
+	}

Is 'first_probe' left intentionally? If so, what is the reason to have this condition?

Quoted 1 line

[beileix] It's related to create vports at runtime, this feature will be implemented in the future, but now it doesn't suppor.

is it possible to remove it now and add back when needed? This is confusing as it is.

#210 lore raw

RE: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 143 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 2, 2023 7:51 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 133 lines · Mingxia
Quoted 133 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 2, 2023 5:31 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 8 lines · Mingxia Liu

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

<...>

doc/guides/nics/cpfl.rst line 3

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +3 -0
@@ -0,0 +1,85 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2022 Intel Corporation.
+

s/2022/2023

<...>

Quoted 40 lines
doc/guides/nics/cpfl.rst new file +40 -0
+static int
+cpfl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+	       struct rte_pci_device *pci_dev) {
+	struct cpfl_vport_param vport_param;
+	struct cpfl_adapter_ext *adapter;
+	struct cpfl_devargs devargs;
+	char name[RTE_ETH_NAME_MAX_LEN];
+	int i, retval;
+	bool first_probe = false;
+
+	if (!cpfl_adapter_list_init) {
+		rte_spinlock_init(&cpfl_adapter_lock);
+		TAILQ_INIT(&cpfl_adapter_list);
+		cpfl_adapter_list_init = true;
+	}
+
+	adapter = cpfl_find_adapter_ext(pci_dev);
+	if (adapter == NULL) {
+		first_probe = true;
+		adapter = rte_zmalloc("cpfl_adapter_ext",
+				      sizeof(struct cpfl_adapter_ext), 0);
+		if (adapter == NULL) {
+			PMD_INIT_LOG(ERR, "Failed to allocate adapter.");
+			return -ENOMEM;
+		}
+
+		retval = cpfl_adapter_ext_init(pci_dev, adapter);
+		if (retval != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init adapter.");
+			return retval;
+		}
+
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_INSERT_TAIL(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+	}
+
+	retval = cpfl_parse_devargs(pci_dev, adapter, &devargs);
+	if (retval != 0) {
+		PMD_INIT_LOG(ERR, "Failed to parse private devargs");

doc/guides/nics/cpfl.rst line 53

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+		goto err;
+	}
+
+	if (devargs.req_vport_nb == 0) {
+		/* If no vport devarg, create vport 0 by default. */
+		vport_param.adapter = adapter;
+		vport_param.devarg_id = 0;
+		vport_param.idx = cpfl_vport_idx_alloc(adapter);
+		if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+			PMD_INIT_LOG(ERR, "No space for vport %u",

vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 63

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+			return 0;
+		}
+		snprintf(name, sizeof(name), "cpfl_%s_vport_0",
+			 pci_dev->device.name);
+		retval = rte_eth_dev_create(&pci_dev->device, name,
+					    sizeof(struct idpf_vport),
+					    NULL, NULL, cpfl_dev_vport_init,
+					    &vport_param);
+		if (retval != 0)
+			PMD_DRV_LOG(ERR, "Failed to create default vport

0");

doc/guides/nics/cpfl.rst line 70

Quoted 7 lines
doc/guides/nics/cpfl.rst new file +7 -0
+	} else {
+		for (i = 0; i < devargs.req_vport_nb; i++) {
+			vport_param.adapter = adapter;
+			vport_param.devarg_id = devargs.req_vports[i];
+			vport_param.idx = cpfl_vport_idx_alloc(adapter);
+			if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+				PMD_INIT_LOG(ERR, "No space for

vport %u", vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 76

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +6 -0
+				break;
+			}
+			snprintf(name, sizeof(name), "cpfl_%s_vport_%d",
+				 pci_dev->device.name,
+				 devargs.req_vports[i]);
+			retval = rte_eth_dev_create(&pci_dev->device,

name,

doc/guides/nics/cpfl.rst line 78

Quoted 2 lines
doc/guides/nics/cpfl.rst new file +2 -0
+						    sizeof(struct idpf_vport),
+						    NULL, NULL,

cpfl_dev_vport_init,

doc/guides/nics/cpfl.rst line 81

Quoted 3 lines
doc/guides/nics/cpfl.rst new file +3 -0
+						    &vport_param);
+			if (retval != 0)
+				PMD_DRV_LOG(ERR, "Failed to create

vport %d",

Quoted 4 lines
doc/guides/nics/cpfl.rst new file +4 -0
+					    vport_param.devarg_id);
+		}
+	}
+

doc/guides/nics/cpfl.rst

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+	return 0;
+
+err:
+	if (first_probe) {
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_REMOVE(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+		cpfl_adapter_ext_deinit(adapter);
+		rte_free(adapter);
+	}

Is 'first_probe' left intentionally? If so, what is the reason to have this condition?

Quoted 6 lines
Quoted 1 line

[beileix] It's related to create vports at runtime, this feature will be

implemented in the future, but now it doesn't suppor.

is it possible to remove it now and add back when needed? This is confusing as it is.

Make sense. Will remove it in this patch.

Beilei

#211 lore raw

RE: [PATCH v8 01/21] net/cpfl: support device initialization

In reply to Ferruh Yigit
Quoted 143 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 2, 2023 7:51 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 133 lines · Mingxia
Quoted 133 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 2, 2023 5:31 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 8 lines · Mingxia Liu

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

<...>

doc/guides/nics/cpfl.rst line 3

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +3 -0
@@ -0,0 +1,85 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2022 Intel Corporation.
+

s/2022/2023

<...>

Quoted 40 lines
doc/guides/nics/cpfl.rst new file +40 -0
+static int
+cpfl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+	       struct rte_pci_device *pci_dev) {
+	struct cpfl_vport_param vport_param;
+	struct cpfl_adapter_ext *adapter;
+	struct cpfl_devargs devargs;
+	char name[RTE_ETH_NAME_MAX_LEN];
+	int i, retval;
+	bool first_probe = false;
+
+	if (!cpfl_adapter_list_init) {
+		rte_spinlock_init(&cpfl_adapter_lock);
+		TAILQ_INIT(&cpfl_adapter_list);
+		cpfl_adapter_list_init = true;
+	}
+
+	adapter = cpfl_find_adapter_ext(pci_dev);
+	if (adapter == NULL) {
+		first_probe = true;
+		adapter = rte_zmalloc("cpfl_adapter_ext",
+				      sizeof(struct cpfl_adapter_ext), 0);
+		if (adapter == NULL) {
+			PMD_INIT_LOG(ERR, "Failed to allocate adapter.");
+			return -ENOMEM;
+		}
+
+		retval = cpfl_adapter_ext_init(pci_dev, adapter);
+		if (retval != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init adapter.");
+			return retval;
+		}
+
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_INSERT_TAIL(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+	}
+
+	retval = cpfl_parse_devargs(pci_dev, adapter, &devargs);
+	if (retval != 0) {
+		PMD_INIT_LOG(ERR, "Failed to parse private devargs");

doc/guides/nics/cpfl.rst line 53

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+		goto err;
+	}
+
+	if (devargs.req_vport_nb == 0) {
+		/* If no vport devarg, create vport 0 by default. */
+		vport_param.adapter = adapter;
+		vport_param.devarg_id = 0;
+		vport_param.idx = cpfl_vport_idx_alloc(adapter);
+		if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+			PMD_INIT_LOG(ERR, "No space for vport %u",

vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 63

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+			return 0;
+		}
+		snprintf(name, sizeof(name), "cpfl_%s_vport_0",
+			 pci_dev->device.name);
+		retval = rte_eth_dev_create(&pci_dev->device, name,
+					    sizeof(struct idpf_vport),
+					    NULL, NULL, cpfl_dev_vport_init,
+					    &vport_param);
+		if (retval != 0)
+			PMD_DRV_LOG(ERR, "Failed to create default vport

0");

doc/guides/nics/cpfl.rst line 70

Quoted 7 lines
doc/guides/nics/cpfl.rst new file +7 -0
+	} else {
+		for (i = 0; i < devargs.req_vport_nb; i++) {
+			vport_param.adapter = adapter;
+			vport_param.devarg_id = devargs.req_vports[i];
+			vport_param.idx = cpfl_vport_idx_alloc(adapter);
+			if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+				PMD_INIT_LOG(ERR, "No space for

vport %u", vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 76

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +6 -0
+				break;
+			}
+			snprintf(name, sizeof(name), "cpfl_%s_vport_%d",
+				 pci_dev->device.name,
+				 devargs.req_vports[i]);
+			retval = rte_eth_dev_create(&pci_dev->device,

name,

doc/guides/nics/cpfl.rst line 78

Quoted 2 lines
doc/guides/nics/cpfl.rst new file +2 -0
+						    sizeof(struct idpf_vport),
+						    NULL, NULL,

cpfl_dev_vport_init,

doc/guides/nics/cpfl.rst line 81

Quoted 3 lines
doc/guides/nics/cpfl.rst new file +3 -0
+						    &vport_param);
+			if (retval != 0)
+				PMD_DRV_LOG(ERR, "Failed to create

vport %d",

Quoted 4 lines
doc/guides/nics/cpfl.rst new file +4 -0
+					    vport_param.devarg_id);
+		}
+	}
+

doc/guides/nics/cpfl.rst

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+	return 0;
+
+err:
+	if (first_probe) {
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_REMOVE(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+		cpfl_adapter_ext_deinit(adapter);
+		rte_free(adapter);
+	}

Is 'first_probe' left intentionally? If so, what is the reason to have this condition?

Quoted 6 lines
Quoted 1 line

[beileix] It's related to create vports at runtime, this feature will be

implemented in the future, but now it doesn't suppor.

is it possible to remove it now and add back when needed? This is confusing as it is.

[Liu, Mingxia] updated, new version sent. Thanks!

#212 lore raw

RE: [PATCH v8 01/21] net/cpfl: support device initialization

In reply to Ferruh Yigit
Quoted 115 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 2, 2023 5:31 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v8 01/21] net/cpfl: support device initialization

Quoted 8 lines · Mingxia Liu

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

<...>

doc/guides/nics/cpfl.rst line 3

Quoted 6 lines
doc/guides/nics/cpfl.rst new file +3 -0
@@ -0,0 +1,85 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2022 Intel Corporation.
+

s/2022/2023

<...>

Quoted 40 lines
doc/guides/nics/cpfl.rst new file +40 -0
+static int
+cpfl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
+	       struct rte_pci_device *pci_dev) {
+	struct cpfl_vport_param vport_param;
+	struct cpfl_adapter_ext *adapter;
+	struct cpfl_devargs devargs;
+	char name[RTE_ETH_NAME_MAX_LEN];
+	int i, retval;
+	bool first_probe = false;
+
+	if (!cpfl_adapter_list_init) {
+		rte_spinlock_init(&cpfl_adapter_lock);
+		TAILQ_INIT(&cpfl_adapter_list);
+		cpfl_adapter_list_init = true;
+	}
+
+	adapter = cpfl_find_adapter_ext(pci_dev);
+	if (adapter == NULL) {
+		first_probe = true;
+		adapter = rte_zmalloc("cpfl_adapter_ext",
+				      sizeof(struct cpfl_adapter_ext), 0);
+		if (adapter == NULL) {
+			PMD_INIT_LOG(ERR, "Failed to allocate adapter.");
+			return -ENOMEM;
+		}
+
+		retval = cpfl_adapter_ext_init(pci_dev, adapter);
+		if (retval != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init adapter.");
+			return retval;
+		}
+
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_INSERT_TAIL(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+	}
+
+	retval = cpfl_parse_devargs(pci_dev, adapter, &devargs);
+	if (retval != 0) {
+		PMD_INIT_LOG(ERR, "Failed to parse private devargs");

doc/guides/nics/cpfl.rst line 53

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+		goto err;
+	}
+
+	if (devargs.req_vport_nb == 0) {
+		/* If no vport devarg, create vport 0 by default. */
+		vport_param.adapter = adapter;
+		vport_param.devarg_id = 0;
+		vport_param.idx = cpfl_vport_idx_alloc(adapter);
+		if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+			PMD_INIT_LOG(ERR, "No space for vport %u",

vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 63

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+			return 0;
+		}
+		snprintf(name, sizeof(name), "cpfl_%s_vport_0",
+			 pci_dev->device.name);
+		retval = rte_eth_dev_create(&pci_dev->device, name,
+					    sizeof(struct idpf_vport),
+					    NULL, NULL, cpfl_dev_vport_init,
+					    &vport_param);
+		if (retval != 0)
+			PMD_DRV_LOG(ERR, "Failed to create default vport

0");

doc/guides/nics/cpfl.rst line 70

Quoted 7 lines
doc/guides/nics/cpfl.rst new file +7 -0
+	} else {
+		for (i = 0; i < devargs.req_vport_nb; i++) {
+			vport_param.adapter = adapter;
+			vport_param.devarg_id = devargs.req_vports[i];
+			vport_param.idx = cpfl_vport_idx_alloc(adapter);
+			if (vport_param.idx == CPFL_INVALID_VPORT_IDX) {
+				PMD_INIT_LOG(ERR, "No space for vport %u",

vport_param.devarg_id);

doc/guides/nics/cpfl.rst line 78

Quoted 8 lines
doc/guides/nics/cpfl.rst new file +8 -0
+				break;
+			}
+			snprintf(name, sizeof(name), "cpfl_%s_vport_%d",
+				 pci_dev->device.name,
+				 devargs.req_vports[i]);
+			retval = rte_eth_dev_create(&pci_dev->device, name,
+						    sizeof(struct idpf_vport),
+						    NULL, NULL,

cpfl_dev_vport_init,

doc/guides/nics/cpfl.rst line 81

Quoted 3 lines
doc/guides/nics/cpfl.rst new file +3 -0
+						    &vport_param);
+			if (retval != 0)
+				PMD_DRV_LOG(ERR, "Failed to create

vport %d",

Quoted 17 lines
Quoted 4 lines
doc/guides/nics/cpfl.rst new file +4 -0
+					    vport_param.devarg_id);
+		}
+	}
+

doc/guides/nics/cpfl.rst

Quoted 10 lines
doc/guides/nics/cpfl.rst new file +10 -0
+	return 0;
+
+err:
+	if (first_probe) {
+		rte_spinlock_lock(&cpfl_adapter_lock);
+		TAILQ_REMOVE(&cpfl_adapter_list, adapter, next);
+		rte_spinlock_unlock(&cpfl_adapter_lock);
+		cpfl_adapter_ext_deinit(adapter);
+		rte_free(adapter);
+	}

Is 'first_probe' left intentionally? If so, what is the reason to have this condition?

Hi Ferruh,
We'll support runtime create vport in the future, so add this condition here.

BR,
Beilei

#213 lore raw

PATCH v8 2/21 net/cpfl: add Tx queue setup

In reply to Mingxia Liu

Add support for tx_queue_setup ops.

There are two queue modes, single queue mode and split queue mode for Tx queue.

For the single queue model, the descriptor TX queue is used by SW to post buffer descriptors to HW, and it's also used by HW to post completed descriptors to SW.

For the split queue model, "Tx completion queue" are used to pass descriptor buffers from SW to HW, while TX queues are used only to pass the descriptor completions from HW to SW.

---
 drivers/net/cpfl/cpfl_ethdev.c |  13 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 244 +++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  25 ++++
 drivers/net/cpfl/meson.build   |   1 +
 4 files changed, 283 insertions(+)
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
drivers/net/cpfl/cpfl_ethdev.c +13 -0
index 21c505fda3..b40f373fb9 100644
@@ -12,6 +12,7 @@
 #include <rte_alarm.h>
 
 #include "cpfl_ethdev.h"
+#include "cpfl_rxtx.h"
 
 #define CPFL_TX_SINGLE_Q	"tx_single"
 #define CPFL_RX_SINGLE_Q	"rx_single"
@@ -93,6 +94,17 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->default_txconf = (struct rte_eth_txconf) {
+		.tx_free_thresh = CPFL_DEFAULT_TX_FREE_THRESH,
+		.tx_rs_thresh = CPFL_DEFAULT_TX_RS_THRESH,
+	};
+
+	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = CPFL_MAX_RING_DESC,
+		.nb_min = CPFL_MIN_RING_DESC,
+		.nb_align = CPFL_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -179,6 +191,7 @@ cpfl_dev_close(struct rte_eth_dev *dev)
 static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_configure			= cpfl_dev_configure,
 	.dev_close			= cpfl_dev_close,
+	.tx_queue_setup			= cpfl_tx_queue_setup,
 	.dev_infos_get			= cpfl_dev_info_get,
 	.link_update			= cpfl_dev_link_update,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
drivers/net/cpfl/cpfl_rxtx.c new file +244 -0

244 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h new file +25 -0
new file mode 100644
index 0000000000..232630c5e9
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#ifndef _CPFL_RXTX_H_
+#define _CPFL_RXTX_H_
+
+#include <idpf_common_rxtx.h>
+#include "cpfl_ethdev.h"
+
+/* In QLEN must be whole number of 32 descriptors. */
+#define CPFL_ALIGN_RING_DESC	32
+#define CPFL_MIN_RING_DESC	32
+#define CPFL_MAX_RING_DESC	4096
+#define CPFL_DMA_MEM_ALIGN	4096
+/* Base address of the HW descriptor ring should be 128B aligned. */
+#define CPFL_RING_BASE_ALIGN	128
+
+#define CPFL_DEFAULT_TX_RS_THRESH	32
+#define CPFL_DEFAULT_TX_FREE_THRESH	32
+
+int cpfl_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);
+#endif /* _CPFL_RXTX_H_ */
drivers/net/cpfl/meson.build +1 -0
index c721732b50..1894423689 100644
@@ -11,4 +11,5 @@ deps += ['common_idpf']
 
 sources = files(
         'cpfl_ethdev.c',
+        'cpfl_rxtx.c',
 )
\ No newline at end of file
Signature · 1 line
2.34.1
#214 lore raw

PATCH v8 3/21 net/cpfl: add Rx queue setup

In reply to Mingxia Liu

Add support for rx_queue_setup ops.

There are two queue modes supported, single queue mode and split queue mode for Rx queue.

For the single queue model, the descriptor RX queue is used by SW to post buffer descriptors to HW, and it's also used by HW to post completed descriptors to SW.

For 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 from HW to SW.

---
 drivers/net/cpfl/cpfl_ethdev.c |  11 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 232 +++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |   6 +
 3 files changed, 249 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +11 -0
index b40f373fb9..99fd86d6d0 100644
@@ -99,12 +99,22 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		.tx_rs_thresh = CPFL_DEFAULT_TX_RS_THRESH,
 	};
 
+	dev_info->default_rxconf = (struct rte_eth_rxconf) {
+		.rx_free_thresh = CPFL_DEFAULT_RX_FREE_THRESH,
+	};
+
 	dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
 		.nb_max = CPFL_MAX_RING_DESC,
 		.nb_min = CPFL_MIN_RING_DESC,
 		.nb_align = CPFL_ALIGN_RING_DESC,
 	};
 
+	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = CPFL_MAX_RING_DESC,
+		.nb_min = CPFL_MIN_RING_DESC,
+		.nb_align = CPFL_ALIGN_RING_DESC,
+	};
+
 	return 0;
 }
 
@@ -191,6 +201,7 @@ cpfl_dev_close(struct rte_eth_dev *dev)
 static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_configure			= cpfl_dev_configure,
 	.dev_close			= cpfl_dev_close,
+	.rx_queue_setup			= cpfl_rx_queue_setup,
 	.tx_queue_setup			= cpfl_tx_queue_setup,
 	.dev_infos_get			= cpfl_dev_info_get,
 	.link_update			= cpfl_dev_link_update,
drivers/net/cpfl/cpfl_rxtx.c +232 -0

244 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h +6 -0
index 232630c5e9..e0221abfa3 100644
@@ -16,10 +16,16 @@
 /* Base address of the HW descriptor ring should be 128B aligned. */
 #define CPFL_RING_BASE_ALIGN	128
 
+#define CPFL_DEFAULT_RX_FREE_THRESH	32
+
 #define CPFL_DEFAULT_TX_RS_THRESH	32
 #define CPFL_DEFAULT_TX_FREE_THRESH	32
 
 int cpfl_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 cpfl_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);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.34.1
#215 lore raw

PATCH v8 4/21 net/cpfl: support device start and stop

In reply to Mingxia Liu

Add dev ops dev_start, dev_stop and link_update.

---
 drivers/net/cpfl/cpfl_ethdev.c | 35 ++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +35 -0
index 99fd86d6d0..dbd3f056e7 100644
@@ -181,12 +181,45 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+cpfl_dev_start(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	int ret;
+
+	ret = idpf_vc_vport_ena_dis(vport, true);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to enable vport");
+		return ret;
+	}
+
+	vport->stopped = 0;
+
+	return 0;
+}
+
+static int
+cpfl_dev_stop(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (vport->stopped == 1)
+		return 0;
+
+	idpf_vc_vport_ena_dis(vport, false);
+
+	vport->stopped = 1;
+
+	return 0;
+}
+
 static int
 cpfl_dev_close(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
 	struct cpfl_adapter_ext *adapter = CPFL_ADAPTER_TO_EXT(vport->adapter);
 
+	cpfl_dev_stop(dev);
 	idpf_vport_deinit(vport);
 
 	adapter->cur_vports &= ~RTE_BIT32(vport->devarg_id);
@@ -204,6 +237,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.rx_queue_setup			= cpfl_rx_queue_setup,
 	.tx_queue_setup			= cpfl_tx_queue_setup,
 	.dev_infos_get			= cpfl_dev_info_get,
+	.dev_start			= cpfl_dev_start,
+	.dev_stop			= cpfl_dev_stop,
 	.link_update			= cpfl_dev_link_update,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
Signature · 1 line
2.34.1
#216 lore raw

PATCH v8 5/21 net/cpfl: support queue start

In reply to Mingxia Liu

Add support for these device ops:
- rx_queue_start
- tx_queue_start

---
 drivers/net/cpfl/cpfl_ethdev.c |  41 ++++++++++
 drivers/net/cpfl/cpfl_rxtx.c   | 138 +++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |   4 +
 3 files changed, 183 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +41 -0
index dbd3f056e7..3248d22d2f 100644
@@ -181,12 +181,51 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+cpfl_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 = cpfl_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 = cpfl_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
 cpfl_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
 	int ret;
 
+	ret = cpfl_start_queues(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to start queues");
+		return ret;
+	}
+
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
@@ -240,6 +279,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_start			= cpfl_dev_start,
 	.dev_stop			= cpfl_dev_stop,
 	.link_update			= cpfl_dev_link_update,
+	.rx_queue_start			= cpfl_rx_queue_start,
+	.tx_queue_start			= cpfl_tx_queue_start,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
drivers/net/cpfl/cpfl_rxtx.c +138 -0

141 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h +4 -0
index e0221abfa3..716b2fefa4 100644
@@ -28,4 +28,8 @@ int cpfl_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 cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int cpfl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+int cpfl_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.34.1
#217 lore raw

PATCH v8 6/21 net/cpfl: support queue stop

In reply to Mingxia Liu

Add support for these device ops:
- rx_queue_stop
- tx_queue_stop

---
 drivers/net/cpfl/cpfl_ethdev.c | 10 +++-
 drivers/net/cpfl/cpfl_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  3 ++
 3 files changed, 110 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +9 -1
index 3248d22d2f..00672142e3 100644
@@ -229,12 +229,16 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
-		return ret;
+		goto err_vport;
 	}
 
 	vport->stopped = 0;
 
 	return 0;
+
+err_vport:
+	cpfl_stop_queues(dev);
+	return ret;
 }
 
 static int
@@ -247,6 +251,8 @@ cpfl_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_vc_vport_ena_dis(vport, false);
 
+	cpfl_stop_queues(dev);
+
 	vport->stopped = 1;
 
 	return 0;
@@ -281,6 +287,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.link_update			= cpfl_dev_link_update,
 	.rx_queue_start			= cpfl_rx_queue_start,
 	.tx_queue_start			= cpfl_tx_queue_start,
+	.rx_queue_stop			= cpfl_rx_queue_stop,
+	.tx_queue_stop			= cpfl_tx_queue_stop,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
drivers/net/cpfl/cpfl_rxtx.c +98 -0

125 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx.h +3 -0
index 716b2fefa4..e9b810deaa 100644
@@ -32,4 +32,7 @@ int cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int cpfl_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 int cpfl_tx_queue_init(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+void cpfl_stop_queues(struct rte_eth_dev *dev);
+int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
+int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.34.1
#218 lore raw

PATCH v8 7/21 net/cpfl: support queue release

In reply to Mingxia Liu

Add support for queue operations:
- rx_queue_release
- tx_queue_release

---
 drivers/net/cpfl/cpfl_ethdev.c |  2 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 24 ++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  2 ++
 3 files changed, 28 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +2 -0
index 00672142e3..cfce3f60d7 100644
@@ -289,6 +289,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.tx_queue_start			= cpfl_tx_queue_start,
 	.rx_queue_stop			= cpfl_rx_queue_stop,
 	.tx_queue_stop			= cpfl_tx_queue_stop,
+	.rx_queue_release		= cpfl_dev_rx_queue_release,
+	.tx_queue_release		= cpfl_dev_tx_queue_release,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
drivers/net/cpfl/cpfl_rxtx.c +24 -0
index 08db01412e..f9295c970f 100644
@@ -244,6 +244,12 @@ cpfl_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (idpf_qc_rx_thresh_check(nb_desc, rx_free_thresh) != 0)
 		return -EINVAL;
 
+	/* Free memory if needed */
+	if (dev->data->rx_queues[queue_idx] != NULL) {
+		idpf_qc_rx_queue_release(dev->data->rx_queues[queue_idx]);
+		dev->data->rx_queues[queue_idx] = NULL;
+	}
+
 	/* Setup Rx queue */
 	rxq = rte_zmalloc_socket("cpfl rxq",
 				 sizeof(struct idpf_rx_queue),
@@ -409,6 +415,12 @@ cpfl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	if (idpf_qc_tx_thresh_check(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
 		return -EINVAL;
 
+	/* Free memory if needed. */
+	if (dev->data->tx_queues[queue_idx] != NULL) {
+		idpf_qc_tx_queue_release(dev->data->tx_queues[queue_idx]);
+		dev->data->tx_queues[queue_idx] = NULL;
+	}
+
 	/* Allocate the TX queue data structure. */
 	txq = rte_zmalloc_socket("cpfl txq",
 				 sizeof(struct idpf_tx_queue),
@@ -685,6 +697,18 @@ cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 	return 0;
 }
 
+void
+cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
+{
+	idpf_qc_rx_queue_release(dev->data->rx_queues[qid]);
+}
+
+void
+cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
+{
+	idpf_qc_tx_queue_release(dev->data->tx_queues[qid]);
+}
+
 void
 cpfl_stop_queues(struct rte_eth_dev *dev)
 {
drivers/net/cpfl/cpfl_rxtx.h +2 -0
index e9b810deaa..f5882401dc 100644
@@ -35,4 +35,6 @@ int cpfl_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 void cpfl_stop_queues(struct rte_eth_dev *dev);
 int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
+void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.34.1
#219 lore raw

PATCH v8 8/21 net/cpfl: support MTU configuration

In reply to Mingxia Liu

Add dev ops mtu_set.

---
 doc/guides/nics/features/cpfl.ini |  1 +
 drivers/net/cpfl/cpfl_ethdev.c    | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
doc/guides/nics/features/cpfl.ini +1 -0
index a2d1ca9e15..470ba81579 100644
@@ -7,6 +7,7 @@
 ; is selected.
 ;
 [Features]
+MTU update           = Y
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/cpfl/cpfl_ethdev.c +27 -0
index cfce3f60d7..158cd0ae68 100644
@@ -118,6 +118,27 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	return 0;
 }
 
+static int
+cpfl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	/* 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;
+	}
+
+	if (mtu > vport->max_mtu) {
+		PMD_DRV_LOG(ERR, "MTU should be less than %d", vport->max_mtu);
+		return -EINVAL;
+	}
+
+	vport->max_pkt_len = mtu + CPFL_ETH_OVERHEAD;
+
+	return 0;
+}
+
 static const uint32_t *
 cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 {
@@ -139,6 +160,7 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 static int
 cpfl_dev_configure(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
 
 	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
@@ -178,6 +200,10 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
+	vport->max_pkt_len =
+		(dev->data->mtu == 0) ? CPFL_DEFAULT_MTU : dev->data->mtu +
+		CPFL_ETH_OVERHEAD;
+
 	return 0;
 }
 
@@ -291,6 +317,7 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.tx_queue_stop			= cpfl_tx_queue_stop,
 	.rx_queue_release		= cpfl_dev_rx_queue_release,
 	.tx_queue_release		= cpfl_dev_tx_queue_release,
+	.mtu_set			= cpfl_dev_mtu_set,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 };
 
Signature · 1 line
2.34.1
#220 lore raw

PATCH v8 9/21 net/cpfl: support basic Rx data path

In reply to Mingxia Liu

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

---
 drivers/net/cpfl/cpfl_ethdev.c |  2 ++
 drivers/net/cpfl/cpfl_rxtx.c   | 18 ++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  1 +
 3 files changed, 21 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +2 -0
index 158cd0ae68..24f614d397 100644
@@ -252,6 +252,8 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 		return ret;
 	}
 
+	cpfl_set_rx_function(dev);
+
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to enable vport");
drivers/net/cpfl/cpfl_rxtx.c +18 -0
index f9295c970f..a0a442f61d 100644
@@ -734,3 +734,21 @@ cpfl_stop_queues(struct rte_eth_dev *dev)
 			PMD_DRV_LOG(WARNING, "Fail to stop Tx queue %d", i);
 	}
 }
+
+void
+cpfl_set_rx_function(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Split Scalar Rx (port %d).",
+			    dev->data->port_id);
+		dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts;
+	} else {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Single Scalar Rx (port %d).",
+			    dev->data->port_id);
+		dev->rx_pkt_burst = idpf_dp_singleq_recv_pkts;
+	}
+}
drivers/net/cpfl/cpfl_rxtx.h +1 -0
index f5882401dc..a5dd388e1f 100644
@@ -37,4 +37,5 @@ int cpfl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
 int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
+void cpfl_set_rx_function(struct rte_eth_dev *dev);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.34.1
#221 lore raw

PATCH v8 10/21 net/cpfl: support basic Tx data path

In reply to Mingxia Liu

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

---
 drivers/net/cpfl/cpfl_ethdev.c |  3 +++
 drivers/net/cpfl/cpfl_rxtx.c   | 20 ++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  1 +
 3 files changed, 24 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +3 -0
index 24f614d397..37e0270dd7 100644
@@ -94,6 +94,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	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 = CPFL_DEFAULT_TX_FREE_THRESH,
 		.tx_rs_thresh = CPFL_DEFAULT_TX_RS_THRESH,
@@ -253,6 +255,7 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 	}
 
 	cpfl_set_rx_function(dev);
+	cpfl_set_tx_function(dev);
 
 	ret = idpf_vc_vport_ena_dis(vport, true);
 	if (ret != 0) {
drivers/net/cpfl/cpfl_rxtx.c +20 -0
index a0a442f61d..520f61e07e 100644
@@ -752,3 +752,23 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 		dev->rx_pkt_burst = idpf_dp_singleq_recv_pkts;
 	}
 }
+
+void
+cpfl_set_tx_function(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+
+	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Split Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	} else {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Single Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	}
+}
drivers/net/cpfl/cpfl_rxtx.h +1 -0
index a5dd388e1f..5f8144e55f 100644
@@ -38,4 +38,5 @@ int cpfl_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
 void cpfl_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void cpfl_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 void cpfl_set_rx_function(struct rte_eth_dev *dev);
+void cpfl_set_tx_function(struct rte_eth_dev *dev);
 #endif /* _CPFL_RXTX_H_ */
Signature · 1 line
2.34.1
#222 lore raw

PATCH v8 11/21 net/cpfl: support write back based on ITR expire

In reply to Mingxia Liu

ITR is the interval between two interrupts, it can be understood as a timer here. WB_ON_ITR(write back on ITR expire) is used for receiving packets without interrupts or full cache line, then packets can be received one by one.

To enable WB_ON_ITR, need to enable some interrupt with 'idpf_vport_irq_map_config()' first.

---
 drivers/net/cpfl/cpfl_ethdev.c | 45 +++++++++++++++++++++++++++++++++-
 drivers/net/cpfl/cpfl_ethdev.h |  2 ++
 2 files changed, 46 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +44 -1
index 37e0270dd7..b09c7d4996 100644
@@ -209,6 +209,15 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int
+cpfl_config_rx_queues_irqs(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	uint16_t nb_rx_queues = dev->data->nb_rx_queues;
+
+	return idpf_vport_irq_map_config(vport, nb_rx_queues);
+}
+
 static int
 cpfl_start_queues(struct rte_eth_dev *dev)
 {
@@ -246,12 +255,37 @@ static int
 cpfl_dev_start(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *base = vport->adapter;
+	struct cpfl_adapter_ext *adapter = CPFL_ADAPTER_TO_EXT(base);
+	uint16_t num_allocated_vectors = base->caps.num_allocated_vectors;
+	uint16_t req_vecs_num;
 	int ret;
 
+	req_vecs_num = CPFL_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_vec;
+	}
+
+	ret = idpf_vc_vectors_alloc(vport, req_vecs_num);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors");
+		goto err_vec;
+	}
+	adapter->used_vecs_num += req_vecs_num;
+
+	ret = cpfl_config_rx_queues_irqs(dev);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to configure irqs");
+		goto err_irq;
+	}
+
 	ret = cpfl_start_queues(dev);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start queues");
-		return ret;
+		goto err_startq;
 	}
 
 	cpfl_set_rx_function(dev);
@@ -269,6 +303,11 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 
 err_vport:
 	cpfl_stop_queues(dev);
+err_startq:
+	idpf_vport_irq_unmap_config(vport, dev->data->nb_rx_queues);
+err_irq:
+	idpf_vc_vectors_dealloc(vport);
+err_vec:
 	return ret;
 }
 
@@ -284,6 +323,10 @@ cpfl_dev_stop(struct rte_eth_dev *dev)
 
 	cpfl_stop_queues(dev);
 
+	idpf_vport_irq_unmap_config(vport, dev->data->nb_rx_queues);
+
+	idpf_vc_vectors_dealloc(vport);
+
 	vport->stopped = 1;
 
 	return 0;
drivers/net/cpfl/cpfl_ethdev.h +2 -0
index 9738e89ca8..4d1441ae64 100644
@@ -25,6 +25,8 @@
 
 #define CPFL_INVALID_VPORT_IDX	0xffff
 
+#define CPFL_DFLT_Q_VEC_NUM	1
+
 #define CPFL_MIN_BUF_SIZE	1024
 #define CPFL_MAX_FRAME_SIZE	9728
 #define CPFL_DEFAULT_MTU	RTE_ETHER_MTU
Signature · 1 line
2.34.1
#223 lore raw

PATCH v8 12/21 net/cpfl: support RSS

In reply to Mingxia Liu

Add RSS support.

---
 drivers/net/cpfl/cpfl_ethdev.c | 60 ++++++++++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h | 15 +++++++++
 2 files changed, 75 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +60 -0
index b09c7d4996..7fa52a5a19 100644
@@ -94,6 +94,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->flow_type_rss_offloads = CPFL_RSS_OFFLOAD_ALL;
+
 	dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
@@ -159,11 +161,49 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 	return ptypes;
 }
 
+static int
+cpfl_init_rss(struct idpf_vport *vport)
+{
+	struct rte_eth_rss_conf *rss_conf;
+	struct rte_eth_dev_data *dev_data;
+	uint16_t i, nb_q;
+	int ret = 0;
+
+	dev_data = vport->dev_data;
+	rss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf;
+	nb_q = dev_data->nb_rx_queues;
+
+	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);
+		return -EINVAL;
+	} else {
+		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+			   vport->rss_key_size);
+	}
+
+	for (i = 0; i < vport->rss_lut_size; i++)
+		vport->rss_lut[i] = i % nb_q;
+
+	vport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;
+
+	ret = idpf_vport_rss_config(vport);
+	if (ret != 0)
+		PMD_INIT_LOG(ERR, "Failed to configure RSS");
+
+	return ret;
+}
+
 static int
 cpfl_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 *base = vport->adapter;
+	int ret;
 
 	if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
 		PMD_INIT_LOG(ERR, "Setting link speed is not supported");
@@ -202,6 +242,26 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
 		return -ENOTSUP;
 	}
 
+	if (conf->rxmode.mq_mode != RTE_ETH_MQ_RX_RSS &&
+	    conf->rxmode.mq_mode != RTE_ETH_MQ_RX_NONE) {
+		PMD_INIT_LOG(ERR, "RX mode %d is not supported.",
+			     conf->rxmode.mq_mode);
+		return -EINVAL;
+	}
+
+	if (base->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0 &&
+		conf->rxmode.mq_mode == RTE_ETH_MQ_RX_RSS) {
+		ret = cpfl_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.");
+		if (conf->rxmode.mq_mode == RTE_ETH_MQ_RX_RSS)
+			return -ENOTSUP;
+	}
+
 	vport->max_pkt_len =
 		(dev->data->mtu == 0) ? CPFL_DEFAULT_MTU : dev->data->mtu +
 		CPFL_ETH_OVERHEAD;
drivers/net/cpfl/cpfl_ethdev.h +15 -0
index 4d1441ae64..200dfcac02 100644
@@ -35,6 +35,21 @@
 #define CPFL_ETH_OVERHEAD \
 	(RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + CPFL_VLAN_TAG_SIZE * 2)
 
+#define CPFL_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  |	\
+		RTE_ETH_RSS_L2_PAYLOAD)
+
 #define CPFL_ADAPTER_NAME_LEN	(PCI_PRI_STR_SIZE + 1)
 
 #define CPFL_ALARM_INTERVAL	50000 /* us */
Signature · 1 line
2.34.1
#224 lore raw

PATCH v8 13/21 net/cpfl: support Rx offloading

In reply to Mingxia Liu

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

---
 doc/guides/nics/features/cpfl.ini | 2 ++
 drivers/net/cpfl/cpfl_ethdev.c    | 6 ++++++
 2 files changed, 8 insertions(+)
doc/guides/nics/features/cpfl.ini +2 -0
index 470ba81579..ee5948f444 100644
@@ -8,6 +8,8 @@
 ;
 [Features]
 MTU update           = Y
+L3 checksum offload  = P
+L4 checksum offload  = P
 Linux                = Y
 x86-32               = Y
 x86-64               = Y
drivers/net/cpfl/cpfl_ethdev.c +6 -0
index 7fa52a5a19..3949fd0368 100644
@@ -96,6 +96,12 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
 	dev_info->flow_type_rss_offloads = CPFL_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) {
Signature · 1 line
2.34.1
#225 lore raw

PATCH v8 14/21 net/cpfl: support Tx offloading

In reply to Mingxia Liu

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

---
 doc/guides/nics/features/cpfl.ini | 1 +
 drivers/net/cpfl/cpfl_ethdev.c    | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
doc/guides/nics/features/cpfl.ini +1 -0
index ee5948f444..f4e45c7c68 100644
@@ -8,6 +8,7 @@
 ;
 [Features]
 MTU update           = Y
+TSO                  = P
 L3 checksum offload  = P
 L4 checksum offload  = P
 Linux                = Y
drivers/net/cpfl/cpfl_ethdev.c +7 -1
index 3949fd0368..b9bfc38292 100644
@@ -102,7 +102,13 @@ cpfl_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_IPV4_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_UDP_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_TCP_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM		|
+		RTE_ETH_TX_OFFLOAD_TCP_TSO		|
+		RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 	dev_info->default_txconf = (struct rte_eth_txconf) {
 		.tx_free_thresh = CPFL_DEFAULT_TX_FREE_THRESH,
Signature · 1 line
2.34.1
#226 lore raw

PATCH v8 15/21 net/cpfl: add AVX512 data path for single queue model

In reply to Mingxia Liu

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

---
 doc/guides/nics/cpfl.rst                |  24 +++++-
 drivers/net/cpfl/cpfl_ethdev.c          |   3 +-
 drivers/net/cpfl/cpfl_rxtx.c            |  93 ++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx_vec_common.h | 100 ++++++++++++++++++++++++
 drivers/net/cpfl/meson.build            |  25 +++++-
 5 files changed, 242 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/cpfl/cpfl_rxtx_vec_common.h
doc/guides/nics/cpfl.rst +23 -1
index 253fa3afae..e2d71f8a4c 100644
@@ -82,4 +82,26 @@ Runtime Config Options
 Driver compilation and testing
 ------------------------------
 
-Refer to the document :doc:`build_and_test` for details.
\ No newline at end of file
+Refer to the document :doc:`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 cpfl.ini,
+  A value "P" means the offload feature is not supported by vector path.
+  If any not supported features are used, cpfl vector PMD is disabled
+  and the scalar paths are chosen.
drivers/net/cpfl/cpfl_ethdev.c +2 -1
index b9bfc38292..8685c6e27b 100644
@@ -108,7 +108,8 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		RTE_ETH_TX_OFFLOAD_TCP_CKSUM		|
 		RTE_ETH_TX_OFFLOAD_SCTP_CKSUM		|
 		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 = CPFL_DEFAULT_TX_FREE_THRESH,
drivers/net/cpfl/cpfl_rxtx.c +93 -0

129 lines not on this page · raw message

drivers/net/cpfl/cpfl_rxtx_vec_common.h new file +100 -0

100 lines not on this page · raw message

drivers/net/cpfl/meson.build +24 -1
index 1894423689..fbe6500826 100644
@@ -7,9 +7,32 @@ if is_windows
     subdir_done()
 endif
 
+if dpdk_conf.get('RTE_IOVA_AS_PA') == 0
+    build = false
+    reason = 'driver does not support disabling IOVA as PA mode'
+    subdir_done()
+endif
+
 deps += ['common_idpf']
 
 sources = files(
         'cpfl_ethdev.c',
         'cpfl_rxtx.c',
-)
\ No newline at end of file
+)
+
+if arch_subdir == 'x86'
+    cpfl_avx512_cpu_support = (
+        cc.get_define('__AVX512F__', args: machine_args) != '' and
+        cc.get_define('__AVX512BW__', args: machine_args) != ''
+    )
+
+    cpfl_avx512_cc_support = (
+        not machine_args.contains('-mno-avx512f') and
+        cc.has_argument('-mavx512f') and
+        cc.has_argument('-mavx512bw')
+    )
+
+    if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true
+        cflags += ['-DCC_AVX512_SUPPORT']
+    endif
+endif
Signature · 1 line
2.34.1
#227 lore raw

PATCH v8 16/21 net/cpfl: support timestamp offload

In reply to Mingxia Liu

Add support for timestamp offload.

---
 drivers/net/cpfl/cpfl_ethdev.c | 3 ++-
 drivers/net/cpfl/cpfl_rxtx.c   | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +2 -1
index 8685c6e27b..8ed6308a36 100644
@@ -100,7 +100,8 @@ cpfl_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_IPV4_CKSUM		|
drivers/net/cpfl/cpfl_rxtx.c +7 -0
index a3832acd4f..ea28d3978c 100644
@@ -516,6 +516,13 @@ cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		return -EINVAL;
 	}
 
+	err = idpf_qc_ts_mbuf_register(rxq);
+	if (err != 0) {
+		PMD_DRV_LOG(ERR, "fail to register timestamp mbuf %u",
+			    rx_queue_id);
+		return -EIO;
+	}
+
 	if (rxq->adapter->is_rx_singleq) {
 		/* Single queue */
 		err = idpf_qc_single_rxq_mbufs_alloc(rxq);
Signature · 1 line
2.34.1
#228 lore raw

PATCH v8 17/21 net/cpfl: add AVX512 data path for split queue model

In reply to Mingxia Liu

Add support of AVX512 data path for split queue model.

---
 drivers/net/cpfl/cpfl_rxtx.c            | 56 +++++++++++++++++++++++--
 drivers/net/cpfl/cpfl_rxtx_vec_common.h | 20 ++++++++-
 drivers/net/cpfl/meson.build            |  6 ++-
 3 files changed, 75 insertions(+), 7 deletions(-)
drivers/net/cpfl/cpfl_rxtx.c +53 -3
index ea28d3978c..dac95579f5 100644
@@ -758,7 +758,8 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 		if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)
 #ifdef CC_AVX512_SUPPORT
 			if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
-			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
+			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1 &&
+			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512DQ))
 				vport->rx_use_avx512 = true;
 #else
 		PMD_DRV_LOG(NOTICE,
@@ -771,6 +772,21 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 
 #ifdef RTE_ARCH_X86
 	if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		if (vport->rx_vec_allowed) {
+			for (i = 0; i < dev->data->nb_rx_queues; i++) {
+				rxq = dev->data->rx_queues[i];
+				(void)idpf_qc_splitq_rx_vec_setup(rxq);
+			}
+#ifdef CC_AVX512_SUPPORT
+			if (vport->rx_use_avx512) {
+				PMD_DRV_LOG(NOTICE,
+					    "Using Split AVX512 Vector Rx (port %d).",
+					    dev->data->port_id);
+				dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts_avx512;
+				return;
+			}
+#endif /* CC_AVX512_SUPPORT */
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Split Scalar Rx (port %d).",
 			    dev->data->port_id);
@@ -826,9 +842,17 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 		vport->tx_vec_allowed = true;
 		if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)
 #ifdef CC_AVX512_SUPPORT
+		{
 			if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
 			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
 				vport->tx_use_avx512 = true;
+			if (vport->tx_use_avx512) {
+				for (i = 0; i < dev->data->nb_tx_queues; i++) {
+					txq = dev->data->tx_queues[i];
+					idpf_qc_tx_vec_avx512_setup(txq);
+				}
+			}
+		}
 #else
 		PMD_DRV_LOG(NOTICE,
 			    "AVX512 is not supported in build env");
@@ -838,14 +862,26 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 	}
 #endif /* RTE_ARCH_X86 */
 
+#ifdef RTE_ARCH_X86
 	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		if (vport->tx_vec_allowed) {
+#ifdef CC_AVX512_SUPPORT
+			if (vport->tx_use_avx512) {
+				PMD_DRV_LOG(NOTICE,
+					    "Using Split AVX512 Vector Tx (port %d).",
+					    dev->data->port_id);
+				dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts_avx512;
+				dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+				return;
+			}
+#endif /* CC_AVX512_SUPPORT */
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Split Scalar Tx (port %d).",
 			    dev->data->port_id);
 		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
 		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
 	} else {
-#ifdef RTE_ARCH_X86
 		if (vport->tx_vec_allowed) {
 #ifdef CC_AVX512_SUPPORT
 			if (vport->tx_use_avx512) {
@@ -864,11 +900,25 @@ cpfl_set_tx_function(struct rte_eth_dev *dev)
 			}
 #endif /* CC_AVX512_SUPPORT */
 		}
-#endif /* RTE_ARCH_X86 */
 		PMD_DRV_LOG(NOTICE,
 			    "Using Single Scalar Tx (port %d).",
 			    dev->data->port_id);
 		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
 		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
 	}
+#else
+	if (vport->txq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Split Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_splitq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	} else {
+		PMD_DRV_LOG(NOTICE,
+			    "Using Single Scalar Tx (port %d).",
+			    dev->data->port_id);
+		dev->tx_pkt_burst = idpf_dp_singleq_xmit_pkts;
+		dev->tx_pkt_prepare = idpf_dp_prep_pkts;
+	}
+#endif /* RTE_ARCH_X86 */
 }
drivers/net/cpfl/cpfl_rxtx_vec_common.h +18 -2
index 2d4c6a0ef3..665418d27d 100644
@@ -64,15 +64,31 @@ cpfl_tx_vec_queue_default(struct idpf_tx_queue *txq)
 	return CPFL_VECTOR_PATH;
 }
 
+static inline int
+cpfl_rx_splitq_vec_default(struct idpf_rx_queue *rxq)
+{
+	if (rxq->bufq2->rx_buf_len < rxq->max_pkt_len)
+		return CPFL_SCALAR_PATH;
+
+	return CPFL_VECTOR_PATH;
+}
+
 static inline int
 cpfl_rx_vec_dev_check_default(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = dev->data->dev_private;
 	struct idpf_rx_queue *rxq;
-	int i, ret = 0;
+	int i, default_ret, splitq_ret, ret = CPFL_SCALAR_PATH;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		rxq = dev->data->rx_queues[i];
-		ret = (cpfl_rx_vec_queue_default(rxq));
+		default_ret = cpfl_rx_vec_queue_default(rxq);
+		if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
+			splitq_ret = cpfl_rx_splitq_vec_default(rxq);
+			ret = splitq_ret && default_ret;
+		} else {
+			ret = default_ret;
+		}
 		if (ret == CPFL_SCALAR_PATH)
 			return CPFL_SCALAR_PATH;
 	}
drivers/net/cpfl/meson.build +4 -2
index fbe6500826..2cf69258e2 100644
@@ -23,13 +23,15 @@ sources = files(
 if arch_subdir == 'x86'
     cpfl_avx512_cpu_support = (
         cc.get_define('__AVX512F__', args: machine_args) != '' and
-        cc.get_define('__AVX512BW__', args: machine_args) != ''
+        cc.get_define('__AVX512BW__', args: machine_args) != '' and
+        cc.get_define('__AVX512DQ__', args: machine_args) != ''
     )
 
     cpfl_avx512_cc_support = (
         not machine_args.contains('-mno-avx512f') and
         cc.has_argument('-mavx512f') and
-        cc.has_argument('-mavx512bw')
+        cc.has_argument('-mavx512bw') and
+        cc.has_argument('-mavx512dq')
     )
 
     if cpfl_avx512_cpu_support == true or cpfl_avx512_cc_support == true
Signature · 1 line
2.34.1
#229 lore raw

PATCH v8 18/21 net/cpfl: add HW statistics

In reply to Mingxia Liu

This patch add hardware packets/bytes statistics.

---
 drivers/net/cpfl/cpfl_ethdev.c | 87 ++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +87 -0
index 8ed6308a36..1f41bb8977 100644
@@ -175,6 +175,88 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 	return ptypes;
 }
 
+static uint64_t
+cpfl_get_mbuf_alloc_failed_stats(struct rte_eth_dev *dev)
+{
+	uint64_t mbuf_alloc_failed = 0;
+	struct idpf_rx_queue *rxq;
+	int i = 0;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		mbuf_alloc_failed += __atomic_load_n(&rxq->rx_stats.mbuf_alloc_failed,
+						     __ATOMIC_RELAXED);
+	}
+
+	return mbuf_alloc_failed;
+}
+
+static int
+cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret == 0) {
+		uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads &
+					 RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 :
+					 RTE_ETHER_CRC_LEN;
+
+		idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+		stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
+				pstats->rx_broadcast - pstats->rx_discards;
+		stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
+						pstats->tx_unicast;
+		stats->imissed = pstats->rx_discards;
+		stats->ierrors = pstats->rx_errors;
+		stats->oerrors = pstats->tx_errors + pstats->tx_discards;
+		stats->ibytes = pstats->rx_bytes;
+		stats->ibytes -= stats->ipackets * crc_stats_len;
+		stats->obytes = pstats->tx_bytes;
+
+		dev->data->rx_mbuf_alloc_failed = cpfl_get_mbuf_alloc_failed_stats(dev);
+		stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
+	} else {
+		PMD_DRV_LOG(ERR, "Get statistics failed");
+	}
+	return ret;
+}
+
+static void
+cpfl_reset_mbuf_alloc_failed_stats(struct rte_eth_dev *dev)
+{
+	struct idpf_rx_queue *rxq;
+	int i;
+
+	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		rxq = dev->data->rx_queues[i];
+		__atomic_store_n(&rxq->rx_stats.mbuf_alloc_failed, 0, __ATOMIC_RELAXED);
+	}
+}
+
+static int
+cpfl_dev_stats_reset(struct rte_eth_dev *dev)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	int ret;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret != 0)
+		return ret;
+
+	/* set stats offset base on current values */
+	vport->eth_stats_offset = *pstats;
+
+	cpfl_reset_mbuf_alloc_failed_stats(dev);
+
+	return 0;
+}
+
 static int
 cpfl_init_rss(struct idpf_vport *vport)
 {
@@ -371,6 +453,9 @@ cpfl_dev_start(struct rte_eth_dev *dev)
 		goto err_vport;
 	}
 
+	if (cpfl_dev_stats_reset(dev))
+		PMD_DRV_LOG(ERR, "Failed to reset stats");
+
 	vport->stopped = 0;
 
 	return 0;
@@ -441,6 +526,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.tx_queue_release		= cpfl_dev_tx_queue_release,
 	.mtu_set			= cpfl_dev_mtu_set,
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
+	.stats_get			= cpfl_dev_stats_get,
+	.stats_reset			= cpfl_dev_stats_reset,
 };
 
 static int
Signature · 1 line
2.34.1
#230 lore raw

PATCH v8 19/21 net/cpfl: add RSS set/get ops

In reply to Mingxia Liu

Add support for these device ops:
- rss_reta_update
- rss_reta_query
- rss_hash_update
- rss_hash_conf_get

---
 drivers/net/cpfl/cpfl_ethdev.c | 271 ++++++++++++++++++++++++++++++++-
 1 file changed, 270 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +270 -1
index 1f41bb8977..fe800b49f3 100644
@@ -47,6 +47,57 @@ uint32_t cpfl_supported_speeds[] = {
 	RTE_ETH_SPEED_NUM_200G
 };
 
+static const uint64_t cpfl_map_hena_rss[] = {
+	[IDPF_HASH_NONF_UNICAST_IPV4_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+	[IDPF_HASH_NONF_MULTICAST_IPV4_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+	[IDPF_HASH_NONF_IPV4_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+	[IDPF_HASH_NONF_IPV4_TCP_SYN_NO_ACK] =
+			RTE_ETH_RSS_NONFRAG_IPV4_TCP,
+	[IDPF_HASH_NONF_IPV4_TCP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_TCP,
+	[IDPF_HASH_NONF_IPV4_SCTP] =
+			RTE_ETH_RSS_NONFRAG_IPV4_SCTP,
+	[IDPF_HASH_NONF_IPV4_OTHER] =
+			RTE_ETH_RSS_NONFRAG_IPV4_OTHER,
+	[IDPF_HASH_FRAG_IPV4] = RTE_ETH_RSS_FRAG_IPV4,
+
+	/* IPv6 */
+	[IDPF_HASH_NONF_UNICAST_IPV6_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+	[IDPF_HASH_NONF_MULTICAST_IPV6_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+	[IDPF_HASH_NONF_IPV6_UDP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+	[IDPF_HASH_NONF_IPV6_TCP_SYN_NO_ACK] =
+			RTE_ETH_RSS_NONFRAG_IPV6_TCP,
+	[IDPF_HASH_NONF_IPV6_TCP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_TCP,
+	[IDPF_HASH_NONF_IPV6_SCTP] =
+			RTE_ETH_RSS_NONFRAG_IPV6_SCTP,
+	[IDPF_HASH_NONF_IPV6_OTHER] =
+			RTE_ETH_RSS_NONFRAG_IPV6_OTHER,
+	[IDPF_HASH_FRAG_IPV6] = RTE_ETH_RSS_FRAG_IPV6,
+
+	/* L2 Payload */
+	[IDPF_HASH_L2_PAYLOAD] = RTE_ETH_RSS_L2_PAYLOAD
+};
+
+static const uint64_t cpfl_ipv4_rss = RTE_ETH_RSS_NONFRAG_IPV4_UDP |
+			  RTE_ETH_RSS_NONFRAG_IPV4_TCP |
+			  RTE_ETH_RSS_NONFRAG_IPV4_SCTP |
+			  RTE_ETH_RSS_NONFRAG_IPV4_OTHER |
+			  RTE_ETH_RSS_FRAG_IPV4;
+
+static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |
+			  RTE_ETH_RSS_NONFRAG_IPV6_TCP |
+			  RTE_ETH_RSS_NONFRAG_IPV6_SCTP |
+			  RTE_ETH_RSS_NONFRAG_IPV6_OTHER |
+			  RTE_ETH_RSS_FRAG_IPV6;
+
+
 static int
 cpfl_dev_link_update(struct rte_eth_dev *dev,
 		     __rte_unused int wait_to_complete)
@@ -94,6 +145,9 @@ cpfl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->max_mtu = vport->max_mtu;
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
+	dev_info->hash_key_size = vport->rss_key_size;
+	dev_info->reta_size = vport->rss_lut_size;
+
 	dev_info->flow_type_rss_offloads = CPFL_RSS_OFFLOAD_ALL;
 
 	dev_info->rx_offload_capa =
@@ -257,6 +311,36 @@ cpfl_dev_stats_reset(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int cpfl_config_rss_hf(struct idpf_vport *vport, uint64_t rss_hf)
+{
+	uint64_t hena = 0;
+	uint16_t i;
+
+	/**
+	 * RTE_ETH_RSS_IPV4 and RTE_ETH_RSS_IPV6 can be considered as 2
+	 * generalizations of all other IPv4 and IPv6 RSS types.
+	 */
+	if (rss_hf & RTE_ETH_RSS_IPV4)
+		rss_hf |= cpfl_ipv4_rss;
+
+	if (rss_hf & RTE_ETH_RSS_IPV6)
+		rss_hf |= cpfl_ipv6_rss;
+
+	for (i = 0; i < RTE_DIM(cpfl_map_hena_rss); i++) {
+		if (cpfl_map_hena_rss[i] & rss_hf)
+			hena |= BIT_ULL(i);
+	}
+
+	/**
+	 * At present, cp doesn't process the virtual channel msg of rss_hf configuration,
+	 * tips are given below.
+	 */
+	if (hena != vport->rss_hf)
+		PMD_DRV_LOG(WARNING, "Updating RSS Hash Function is not supported at present.");
+
+	return 0;
+}
+
 static int
 cpfl_init_rss(struct idpf_vport *vport)
 {
@@ -277,7 +361,7 @@ cpfl_init_rss(struct idpf_vport *vport)
 			     vport->rss_key_size);
 		return -EINVAL;
 	} else {
-		rte_memcpy(vport->rss_key, rss_conf->rss_key,
+		memcpy(vport->rss_key, rss_conf->rss_key,
 			   vport->rss_key_size);
 	}
 
@@ -293,6 +377,187 @@ cpfl_init_rss(struct idpf_vport *vport)
 	return ret;
 }
 
+static int
+cpfl_rss_reta_update(struct rte_eth_dev *dev,
+		     struct rte_eth_rss_reta_entry64 *reta_conf,
+		     uint16_t reta_size)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *base = vport->adapter;
+	uint16_t idx, shift;
+	int ret = 0;
+	uint16_t i;
+
+	if (base->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	if (reta_size != vport->rss_lut_size) {
+		PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
+				 "(%d) doesn't match the number of hardware can "
+				 "support (%d)",
+			    reta_size, vport->rss_lut_size);
+		return -EINVAL;
+	}
+
+	for (i = 0; i < reta_size; i++) {
+		idx = i / RTE_ETH_RETA_GROUP_SIZE;
+		shift = i % RTE_ETH_RETA_GROUP_SIZE;
+		if (reta_conf[idx].mask & (1ULL << shift))
+			vport->rss_lut[i] = reta_conf[idx].reta[shift];
+	}
+
+	/* send virtchnl ops to configure RSS */
+	ret = idpf_vc_rss_lut_set(vport);
+	if (ret)
+		PMD_INIT_LOG(ERR, "Failed to configure RSS lut");
+
+	return ret;
+}
+
+static int
+cpfl_rss_reta_query(struct rte_eth_dev *dev,
+		    struct rte_eth_rss_reta_entry64 *reta_conf,
+		    uint16_t reta_size)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *base = vport->adapter;
+	uint16_t idx, shift;
+	int ret = 0;
+	uint16_t i;
+
+	if (base->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	if (reta_size != vport->rss_lut_size) {
+		PMD_DRV_LOG(ERR, "The size of hash lookup table configured "
+			"(%d) doesn't match the number of hardware can "
+			"support (%d)", reta_size, vport->rss_lut_size);
+		return -EINVAL;
+	}
+
+	ret = idpf_vc_rss_lut_get(vport);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to get RSS LUT");
+		return ret;
+	}
+
+	for (i = 0; i < reta_size; i++) {
+		idx = i / RTE_ETH_RETA_GROUP_SIZE;
+		shift = i % RTE_ETH_RETA_GROUP_SIZE;
+		if (reta_conf[idx].mask & (1ULL << shift))
+			reta_conf[idx].reta[shift] = vport->rss_lut[i];
+	}
+
+	return 0;
+}
+
+static int
+cpfl_rss_hash_update(struct rte_eth_dev *dev,
+		     struct rte_eth_rss_conf *rss_conf)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *base = vport->adapter;
+	int ret = 0;
+
+	if (base->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	if (!rss_conf->rss_key || rss_conf->rss_key_len == 0) {
+		PMD_DRV_LOG(DEBUG, "No key to be configured");
+		goto skip_rss_key;
+	} else if (rss_conf->rss_key_len != vport->rss_key_size) {
+		PMD_DRV_LOG(ERR, "The size of hash key configured "
+				 "(%d) doesn't match the size of hardware can "
+				 "support (%d)",
+			    rss_conf->rss_key_len,
+			    vport->rss_key_size);
+		return -EINVAL;
+	}
+
+	memcpy(vport->rss_key, rss_conf->rss_key,
+		   vport->rss_key_size);
+	ret = idpf_vc_rss_key_set(vport);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS key");
+		return ret;
+	}
+
+skip_rss_key:
+	ret = cpfl_config_rss_hf(vport, rss_conf->rss_hf);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to configure RSS hash");
+		return ret;
+	}
+
+	return 0;
+}
+
+static uint64_t
+cpfl_map_general_rss_hf(uint64_t config_rss_hf, uint64_t last_general_rss_hf)
+{
+	uint64_t valid_rss_hf = 0;
+	uint16_t i;
+
+	for (i = 0; i < RTE_DIM(cpfl_map_hena_rss); i++) {
+		uint64_t bit = BIT_ULL(i);
+
+		if (bit & config_rss_hf)
+			valid_rss_hf |= cpfl_map_hena_rss[i];
+	}
+
+	if (valid_rss_hf & cpfl_ipv4_rss)
+		valid_rss_hf |= last_general_rss_hf & RTE_ETH_RSS_IPV4;
+
+	if (valid_rss_hf & cpfl_ipv6_rss)
+		valid_rss_hf |= last_general_rss_hf & RTE_ETH_RSS_IPV6;
+
+	return valid_rss_hf;
+}
+
+static int
+cpfl_rss_hash_conf_get(struct rte_eth_dev *dev,
+		       struct rte_eth_rss_conf *rss_conf)
+{
+	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *base = vport->adapter;
+	int ret = 0;
+
+	if (base->caps.rss_caps == 0 || dev->data->nb_rx_queues == 0) {
+		PMD_DRV_LOG(DEBUG, "RSS is not supported");
+		return -ENOTSUP;
+	}
+
+	ret = idpf_vc_rss_hash_get(vport);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to get RSS hf");
+		return ret;
+	}
+
+	rss_conf->rss_hf = cpfl_map_general_rss_hf(vport->rss_hf, vport->last_general_rss_hf);
+
+	if (!rss_conf->rss_key)
+		return 0;
+
+	ret = idpf_vc_rss_key_get(vport);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to get RSS key");
+		return ret;
+	}
+
+	if (rss_conf->rss_key_len > vport->rss_key_size)
+		rss_conf->rss_key_len = vport->rss_key_size;
+
+	memcpy(rss_conf->rss_key, vport->rss_key, rss_conf->rss_key_len);
+
+	return 0;
+}
+
 static int
 cpfl_dev_configure(struct rte_eth_dev *dev)
 {
@@ -528,6 +793,10 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.dev_supported_ptypes_get	= cpfl_dev_supported_ptypes_get,
 	.stats_get			= cpfl_dev_stats_get,
 	.stats_reset			= cpfl_dev_stats_reset,
+	.reta_update			= cpfl_rss_reta_update,
+	.reta_query			= cpfl_rss_reta_query,
+	.rss_hash_update		= cpfl_rss_hash_update,
+	.rss_hash_conf_get		= cpfl_rss_hash_conf_get,
 };
 
 static int
Signature · 1 line
2.34.1
#231 lore raw

PATCH v8 20/21 net/cpfl: support scalar scatter Rx datapath for single queue model

In reply to Mingxia Liu

This patch add single q recv scatter Rx function.

---
 drivers/net/cpfl/cpfl_ethdev.c |  3 ++-
 drivers/net/cpfl/cpfl_rxtx.c   | 27 +++++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h   |  2 ++
 3 files changed, 31 insertions(+), 1 deletion(-)
drivers/net/cpfl/cpfl_ethdev.c +2 -1
index fe800b49f3..87c591ae5c 100644
@@ -155,7 +155,8 @@ cpfl_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_TIMESTAMP;
+		RTE_ETH_RX_OFFLOAD_TIMESTAMP		|
+		RTE_ETH_RX_OFFLOAD_SCATTER;
 
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_IPV4_CKSUM		|
drivers/net/cpfl/cpfl_rxtx.c +27 -0
index dac95579f5..9e8767df72 100644
@@ -503,6 +503,8 @@ int
 cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
 	struct idpf_rx_queue *rxq;
+	uint16_t max_pkt_len;
+	uint32_t frame_size;
 	int err;
 
 	if (rx_queue_id >= dev->data->nb_rx_queues)
@@ -516,6 +518,17 @@ cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		return -EINVAL;
 	}
 
+	frame_size = dev->data->mtu + CPFL_ETH_OVERHEAD;
+
+	max_pkt_len =
+	    RTE_MIN((uint32_t)CPFL_SUPPORT_CHAIN_NUM * rxq->rx_buf_len,
+		    frame_size);
+
+	rxq->max_pkt_len = max_pkt_len;
+	if ((dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_SCATTER) ||
+	    frame_size > rxq->rx_buf_len)
+		dev->data->scattered_rx = 1;
+
 	err = idpf_qc_ts_mbuf_register(rxq);
 	if (err != 0) {
 		PMD_DRV_LOG(ERR, "fail to register timestamp mbuf %u",
@@ -807,6 +820,13 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 			}
 #endif /* CC_AVX512_SUPPORT */
 		}
+		if (dev->data->scattered_rx) {
+			PMD_DRV_LOG(NOTICE,
+				    "Using Single Scalar Scatterd Rx (port %d).",
+				    dev->data->port_id);
+			dev->rx_pkt_burst = idpf_dp_singleq_recv_scatter_pkts;
+			return;
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Single Scalar Rx (port %d).",
 			    dev->data->port_id);
@@ -819,6 +839,13 @@ cpfl_set_rx_function(struct rte_eth_dev *dev)
 			    dev->data->port_id);
 		dev->rx_pkt_burst = idpf_dp_splitq_recv_pkts;
 	} else {
+		if (dev->data->scattered_rx) {
+			PMD_DRV_LOG(NOTICE,
+				    "Using Single Scalar Scatterd Rx (port %d).",
+				    dev->data->port_id);
+			dev->rx_pkt_burst = idpf_dp_singleq_recv_scatter_pkts;
+			return;
+		}
 		PMD_DRV_LOG(NOTICE,
 			    "Using Single Scalar Rx (port %d).",
 			    dev->data->port_id);
drivers/net/cpfl/cpfl_rxtx.h +2 -0
index 5f8144e55f..fb267d38c8 100644
@@ -21,6 +21,8 @@
 #define CPFL_DEFAULT_TX_RS_THRESH	32
 #define CPFL_DEFAULT_TX_FREE_THRESH	32
 
+#define CPFL_SUPPORT_CHAIN_NUM 5
+
 int cpfl_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);
Signature · 1 line
2.34.1
#232 lore raw

PATCH v8 21/21 net/cpfl: add xstats ops

In reply to Mingxia Liu

Add support for these device ops:
- dev_xstats_get
- dev_xstats_get_names
- dev_xstats_reset

---
 drivers/net/cpfl/cpfl_ethdev.c | 78 ++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
drivers/net/cpfl/cpfl_ethdev.c +78 -0
index 87c591ae5c..0a971334c9 100644
@@ -97,6 +97,28 @@ static const uint64_t cpfl_ipv6_rss = RTE_ETH_RSS_NONFRAG_IPV6_UDP |
 			  RTE_ETH_RSS_NONFRAG_IPV6_OTHER |
 			  RTE_ETH_RSS_FRAG_IPV6;
 
+struct rte_cpfl_xstats_name_off {
+	char name[RTE_ETH_XSTATS_NAME_SIZE];
+	unsigned int offset;
+};
+
+static const struct rte_cpfl_xstats_name_off rte_cpfl_stats_strings[] = {
+	{"rx_bytes", offsetof(struct virtchnl2_vport_stats, rx_bytes)},
+	{"rx_unicast_packets", offsetof(struct virtchnl2_vport_stats, rx_unicast)},
+	{"rx_multicast_packets", offsetof(struct virtchnl2_vport_stats, rx_multicast)},
+	{"rx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, rx_broadcast)},
+	{"rx_dropped_packets", offsetof(struct virtchnl2_vport_stats, rx_discards)},
+	{"rx_errors", offsetof(struct virtchnl2_vport_stats, rx_errors)},
+	{"rx_unknown_protocol_packets", offsetof(struct virtchnl2_vport_stats,
+						 rx_unknown_protocol)},
+	{"tx_bytes", offsetof(struct virtchnl2_vport_stats, tx_bytes)},
+	{"tx_unicast_packets", offsetof(struct virtchnl2_vport_stats, tx_unicast)},
+	{"tx_multicast_packets", offsetof(struct virtchnl2_vport_stats, tx_multicast)},
+	{"tx_broadcast_packets", offsetof(struct virtchnl2_vport_stats, tx_broadcast)},
+	{"tx_dropped_packets", offsetof(struct virtchnl2_vport_stats, tx_discards)},
+	{"tx_error_packets", offsetof(struct virtchnl2_vport_stats, tx_errors)}};
+
+#define CPFL_NB_XSTATS			RTE_DIM(rte_cpfl_stats_strings)
 
 static int
 cpfl_dev_link_update(struct rte_eth_dev *dev,
@@ -312,6 +334,59 @@ cpfl_dev_stats_reset(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static int cpfl_dev_xstats_reset(struct rte_eth_dev *dev)
+{
+	cpfl_dev_stats_reset(dev);
+	return 0;
+}
+
+static int cpfl_dev_xstats_get(struct rte_eth_dev *dev,
+			       struct rte_eth_xstat *xstats, unsigned int n)
+{
+	struct idpf_vport *vport =
+		(struct idpf_vport *)dev->data->dev_private;
+	struct virtchnl2_vport_stats *pstats = NULL;
+	unsigned int i;
+	int ret;
+
+	if (n < CPFL_NB_XSTATS)
+		return CPFL_NB_XSTATS;
+
+	if (!xstats)
+		return CPFL_NB_XSTATS;
+
+	ret = idpf_vc_stats_query(vport, &pstats);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Get statistics failed");
+		return 0;
+	}
+
+	idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
+
+	/* loop over xstats array and values from pstats */
+	for (i = 0; i < CPFL_NB_XSTATS; i++) {
+		xstats[i].id = i;
+		xstats[i].value = *(uint64_t *)(((char *)pstats) +
+			rte_cpfl_stats_strings[i].offset);
+	}
+	return CPFL_NB_XSTATS;
+}
+
+static int cpfl_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+				     struct rte_eth_xstat_name *xstats_names,
+				     __rte_unused unsigned int limit)
+{
+	unsigned int i;
+
+	if (xstats_names)
+		for (i = 0; i < CPFL_NB_XSTATS; i++) {
+			snprintf(xstats_names[i].name,
+				 sizeof(xstats_names[i].name),
+				 "%s", rte_cpfl_stats_strings[i].name);
+		}
+	return CPFL_NB_XSTATS;
+}
+
 static int cpfl_config_rss_hf(struct idpf_vport *vport, uint64_t rss_hf)
 {
 	uint64_t hena = 0;
@@ -798,6 +873,9 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {
 	.reta_query			= cpfl_rss_reta_query,
 	.rss_hash_update		= cpfl_rss_hash_update,
 	.rss_hash_conf_get		= cpfl_rss_hash_conf_get,
+	.xstats_get			= cpfl_dev_xstats_get,
+	.xstats_get_names		= cpfl_dev_xstats_get_names,
+	.xstats_reset			= cpfl_dev_xstats_reset,
 };
 
 static int
Signature · 1 line
2.34.1
#233 lore raw

Re: [PATCH v8 21/21] net/cpfl: add xstats ops

Quoted 6 lines · Mingxia Liu

Add support for these device ops:
- dev_xstats_get
- dev_xstats_get_names
- dev_xstats_reset

<...>

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_stats_reset(struct rte_eth_dev *dev) · line 386

Quoted 12 lines
drivers/net/cpfl/cpfl_ethdev.c +12 -0
+static int cpfl_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+				     struct rte_eth_xstat_name *xstats_names,
+				     __rte_unused unsigned int limit)
+{
+	unsigned int i;
+
+	if (xstats_names)
+		for (i = 0; i < CPFL_NB_XSTATS; i++) {
+			snprintf(xstats_names[i].name,
+				 sizeof(xstats_names[i].name),
+				 "%s", rte_cpfl_stats_strings[i].name);
+		}

Although above is correct, can you please add {}, it is safer to do it for multi line blocks.

#234 lore raw

RE: [PATCH v8 21/21] net/cpfl: add xstats ops

Quoted 23 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Thursday, March 2, 2023 5:30 PM
To: Liu, Mingxia <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Yuying <[email protected]>
Subject: Re: [PATCH v8 21/21] net/cpfl: add xstats ops

Quoted 6 lines · Mingxia Liu

Add support for these device ops:
- dev_xstats_get
- dev_xstats_get_names
- dev_xstats_reset

<...>

Quoted 1 line

+static int cpfl_dev_xstats_get_names(__rte_unused struct rte_eth_dev

*dev,

Review

Quoted 1 line
(quoted diff) +1 -0
+				     struct rte_eth_xstat_name

*xstats_names,

Quoted 13 lines

drivers/net/cpfl/cpfl_ethdev.c cpfl_dev_stats_reset(struct rte_eth_dev *dev) · line 386

Quoted 9 lines
drivers/net/cpfl/cpfl_ethdev.c +9 -0
+				     __rte_unused unsigned int limit) {
+	unsigned int i;
+
+	if (xstats_names)
+		for (i = 0; i < CPFL_NB_XSTATS; i++) {
+			snprintf(xstats_names[i].name,
+				 sizeof(xstats_names[i].name),
+				 "%s", rte_cpfl_stats_strings[i].name);
+		}

Although above is correct, can you please add {}, it is safer to do it for multi line blocks.

[Liu, Mingxia] ok, I'll add nexr version.

#235 lore raw

v9 cover add support for cpfl PMD in DPDK

In reply to Mingxia Liu

The patchset introduced the cpfl (Control Plane Function Library) PMD for Intel® IPU E2100’s Configure Physical Function (Device ID: 0x1453)

The cpfl PMD inherits all the features from idpf PMD which will follow an ongoing standard data plan function spec
https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=idpf
Besides, it will also support more device specific hardware offloading features from DPDK’s control path (e.g.: hairpin, rte_flow …). which is different from idpf PMD, and that's why we need a new cpfl PMD.

This patchset mainly focuses on idpf PMD’s equivalent features. To avoid duplicated code, the patchset depends on below patchsets which move the common part from net/idpf into common/idpf as a shared library.

v2 changes:
- rebase to the new baseline.
- Fix rss lut config issue.
v3 changes:
- rebase to the new baseline.
v4 changes:
- Resend v3. No code changed.
v5 changes:
- rebase to the new baseline.
- optimize some code
- give "not supported" tips when user want to config rss hash type
- if stats reset fails at initialization time, don't rollback, just print ERROR info
v6 changes:
- for small fixed size structure, change rte_memcpy to memcpy()
- fix compilation for AVX512DQ
- update cpfl maintainers
v7 changes:
- add dependency in cover-letter
v8 changes:
- improve documentation and commit msg
- optimize function cpfl_dev_link_update()
- refine devargs check
v9 changes:
- refine cpfl_pci_probe(), remove redundant code.

This patchset is based on the idpf PMD code for refining Rx/Tx queue model info:
http://patches.dpdk.org/project/dpdk/patch/[email protected]/

Mingxia Liu (21):
net/cpfl: support device initialization
net/cpfl: add Tx queue setup
net/cpfl: add Rx queue setup
net/cpfl: support device start and stop
net/cpfl: support queue start
net/cpfl: support queue stop
net/cpfl: support queue release
net/cpfl: support MTU configuration
net/cpfl: support basic Rx data path
net/cpfl: support basic Tx data path
net/cpfl: support write back based on ITR expire net/cpfl: support RSS
net/cpfl: support Rx offloading
net/cpfl: support Tx offloading
net/cpfl: add AVX512 data path for single queue model net/cpfl: support timestamp offload
net/cpfl: add AVX512 data path for split queue model net/cpfl: add HW statistics
net/cpfl: add RSS set/get ops
net/cpfl: support scalar scatter Rx datapath for single queue model net/cpfl: add xstats ops

 MAINTAINERS                             |    8 +
 doc/guides/nics/cpfl.rst                |  107 ++
 doc/guides/nics/features/cpfl.ini       |   16 +
 doc/guides/nics/index.rst               |    1 +
 doc/guides/rel_notes/release_23_03.rst  |    6 +
 drivers/net/cpfl/cpfl_ethdev.c          | 1460 +++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h          |   94 ++
 drivers/net/cpfl/cpfl_logs.h            |   29 +
 drivers/net/cpfl/cpfl_rxtx.c            |  951 +++++++++++++++
 drivers/net/cpfl/cpfl_rxtx.h            |   44 +
 drivers/net/cpfl/cpfl_rxtx_vec_common.h |  116 ++
 drivers/net/cpfl/meson.build            |   40 +
 drivers/net/meson.build                 |    1 +
 13 files changed, 2873 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.c
 create mode 100644 drivers/net/cpfl/cpfl_rxtx.h
 create mode 100644 drivers/net/cpfl/cpfl_rxtx_vec_common.h
 create mode 100644 drivers/net/cpfl/meson.build
Signature · 1 line
2.34.1
#236 lore raw

PATCH v9 1/21 net/cpfl: support device initialization

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

---
 MAINTAINERS                            |   8 +
 doc/guides/nics/cpfl.rst               |  85 +++
 doc/guides/nics/features/cpfl.ini      |  12 +
 doc/guides/nics/index.rst              |   1 +
 doc/guides/rel_notes/release_23_03.rst |   6 +
 drivers/net/cpfl/cpfl_ethdev.c         | 765 +++++++++++++++++++++++++
 drivers/net/cpfl/cpfl_ethdev.h         |  77 +++
 drivers/net/cpfl/cpfl_logs.h           |  29 +
 drivers/net/cpfl/meson.build           |  14 +
 drivers/net/meson.build                |   1 +
 10 files changed, 998 insertions(+)
 create mode 100644 doc/guides/nics/cpfl.rst
 create mode 100644 doc/guides/nics/features/cpfl.ini
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.c
 create mode 100644 drivers/net/cpfl/cpfl_ethdev.h
 create mode 100644 drivers/net/cpfl/cpfl_logs.h
 create mode 100644 drivers/net/cpfl/meson.build
MAINTAINERS +8 -0
index ffbf91296e..878204c93b 100644
@@ -783,6 +783,14 @@ F: drivers/common/idpf/
 F: doc/guides/nics/idpf.rst
 F: doc/guides/nics/features/idpf.ini
 
+Intel cpfl - EXPERIMENTAL
+M: Yuying Zhang <[email protected]>
+M: Beilei Xing <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-intel
+F: drivers/net/cpfl/
+F: doc/guides/nics/cpfl.rst
+F: doc/guides/nics/features/cpfl.ini
+
 Intel igc
 M: Junfeng Guo <[email protected]>
 M: Simei Su <[email protected]>
doc/guides/nics/cpfl.rst new file +85 -0

86 lines not on this page · raw message

doc/guides/nics/features/cpfl.ini new file +12 -0
new file mode 100644
index 0000000000..a2d1ca9e15
@@ -0,0 +1,12 @@
+;
+; Supported features of the 'cpfl' 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]
+Linux                = Y
+x86-32               = Y
+x86-64               = Y
doc/guides/nics/index.rst +1 -0
index df58a237ca..5c9d1edf5e 100644
@@ -20,6 +20,7 @@ Network Interface Controller Drivers
     bnx2x
     bnxt
     cnxk
+    cpfl
     cxgbe
     dpaa
     dpaa2
doc/guides/rel_notes/release_23_03.rst +6 -0
index 49c18617a5..29690d8813 100644
@@ -148,6 +148,12 @@ New Features
   * Added support for timesync API.
   * Added support for packet pacing (launch time offloading).
 
+* **Added Intel cpfl driver.**
+
+  * Added the new ``cpfl`` net driver
+    for Intel\ |reg| Infrastructure Processing Unit (Intel\ |reg| IPU) E2100.
+    See the :doc:`../nics/cpfl.rst` NIC guide for more details on this new driver.
+
 * **Updated Marvell cnxk ethdev driver.**
 
   * Added support to skip RED using ``RTE_FLOW_ACTION_TYPE_SKIP_CMAN``.
drivers/net/cpfl/cpfl_ethdev.c new file +765 -0

765 lines not on this page · raw message

drivers/net/cpfl/cpfl_ethdev.h new file +77 -0

77 lines not on this page · raw message

drivers/net/cpfl/cpfl_logs.h new file +29 -0
new file mode 100644
index 0000000000..bdfa5c41a5
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#ifndef _CPFL_LOGS_H_
+#define _CPFL_LOGS_H_
+
+#include <rte_log.h>
+
+extern int cpfl_logtype_init;
+extern int cpfl_logtype_driver;
+
+#define PMD_INIT_LOG(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_init, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#define PMD_DRV_LOG(level, ...) \
+	rte_log(RTE_LOG_ ## level, \
+		cpfl_logtype_driver, \
+		RTE_FMT("%s(): " \
+			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
+			__func__, \
+			RTE_FMT_TAIL(__VA_ARGS__,)))
+
+#endif /* _CPFL_LOGS_H_ */
drivers/net/cpfl/meson.build new file +14 -0
new file mode 100644
index 0000000000..c721732b50
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+
+if is_windows
+    build = false
+    reason = 'not supported on Windows'
+    subdir_done()
+endif
+
+deps += ['common_idpf']
+
+sources = files(
+        'cpfl_ethdev.c',
+)
\ No newline at end of file
drivers/net/meson.build +1 -0
index f83a6de117..b1df17ce8c 100644
@@ -13,6 +13,7 @@ drivers = [
         'bnxt',
         'bonding',
         'cnxk',
+        'cpfl',
         'cxgbe',
         'dpaa',
         'dpaa2',
Signature · 1 line
2.34.1