From: liujie5@linkdatatechnology.com
To: stephen@networkplumber.org
Cc: dev@dpdk.org, Jie Liu <liujie5@linkdatatechnology.com>
Subject: [PATCH v2 05/13] net/sxe2: improve representor device initialization
Date: Sun, 16 Aug 2026 10:52:25 +0800 [thread overview]
Message-ID: <20260816025233.2727226-6-liujie5@linkdatatechnology.com> (raw)
In-Reply-To: <20260816025233.2727226-1-liujie5@linkdatatechnology.com>
From: Jie Liu <liujie5@linkdatatechnology.com>
This patch enhances the representor device initialization with:
- Add statistics initialization in sxe2_repr_dev_init
* Call sxe2_stats_init to setup statistics infrastructure
* Add proper error handling path for stats init failure
- Add representor device naming and NUMA node assignment:
* Update device name format to use base device name prefix
* Set numa_node from parent device data for proper NUMA locality
* Ensures representor devices are allocated on the same NUMA node
- Code style improvements:
* Align struct member fields in sxe2_adapter for consistency
Signed-off-by: Jie Liu <liujie5@linkdatatechnology.com>
---
drivers/net/sxe2/sxe2_ethdev.h | 24 ++++++++++++------------
drivers/net/sxe2/sxe2_ethdev_repr.c | 13 +++++++++++--
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/drivers/net/sxe2/sxe2_ethdev.h b/drivers/net/sxe2/sxe2_ethdev.h
index cfcb7fcf00..d0a0f41ceb 100644
--- a/drivers/net/sxe2/sxe2_ethdev.h
+++ b/drivers/net/sxe2/sxe2_ethdev.h
@@ -314,10 +314,10 @@ struct sxe2_fc_state_ctxt {
};
struct sxe2_adapter {
- struct sxe2_common_device *cdev;
- struct sxe2_dev_info dev_info;
- struct rte_pci_device *pci_dev;
- struct sxe2_repr_private_data *repr_priv_data;
+ struct sxe2_common_device *cdev;
+ struct sxe2_dev_info dev_info;
+ struct rte_pci_device *pci_dev;
+ struct sxe2_repr_private_data *repr_priv_data;
struct sxe2_pci_map_context map_ctxt;
struct sxe2_irq_context irq_ctxt;
struct sxe2_queue_context q_ctxt;
@@ -338,16 +338,16 @@ struct sxe2_adapter {
bool rule_started;
bool flow_isolated;
bool flow_isolate_cfg;
- uint16_t dev_port_id;
+ uint16_t dev_port_id;
bool is_dev_repr;
- uint64_t cap_flags;
+ uint64_t cap_flags;
enum sxe2_dev_type dev_type;
- struct rte_ether_addr mac_addr;
- uint8_t port_idx;
- uint8_t pf_idx;
- uint32_t tx_mode_flags;
- uint32_t rx_mode_flags;
- uint8_t started;
+ struct rte_ether_addr mac_addr;
+ uint8_t port_idx;
+ uint8_t pf_idx;
+ uint32_t tx_mode_flags;
+ uint32_t rx_mode_flags;
+ uint8_t started;
};
#define SXE2_DEV_PRIVATE_TO_ADAPTER(dev) \
diff --git a/drivers/net/sxe2/sxe2_ethdev_repr.c b/drivers/net/sxe2/sxe2_ethdev_repr.c
index f32318b731..b7096f5927 100644
--- a/drivers/net/sxe2/sxe2_ethdev_repr.c
+++ b/drivers/net/sxe2/sxe2_ethdev_repr.c
@@ -483,8 +483,16 @@ int32_t sxe2_repr_dev_init(struct rte_eth_dev *dev,
goto l_init_sw_err;
}
+ ret = sxe2_stats_init(dev);
+ if (ret) {
+ PMD_LOG_ERR(INIT, "Failed to initialize stats, ret=[%d]", ret);
+ goto l_init_irq_ctxt_err;
+ }
+
goto l_end;
+l_init_irq_ctxt_err:
+ sxe2_sw_irq_ctxt_uninit(dev);
l_init_sw_err:
sxe2_eth_uinit(dev);
l_init_eth_err:
@@ -544,8 +552,8 @@ int32_t sxe2_switchdev_repr_devs_init(struct sxe2_adapter *adapter,
}
for (repr_idx = 0; repr_idx < req_eth_da->nb_representor_ports; ++repr_idx) {
- snprintf(name, sizeof(name), "sxe2_representor_c%dpf%d%s%u",
- adapter->pf_idx, adapter->pf_idx,
+ snprintf(name, sizeof(name), "%s_representor_%s%u",
+ adapter->cdev->dev->name,
"vf",
req_eth_da->representor_ports[repr_idx]);
@@ -554,6 +562,7 @@ int32_t sxe2_switchdev_repr_devs_init(struct sxe2_adapter *adapter,
ret = -ENOMEM;
goto l_release_port;
}
+ eth_dev->data->numa_node = adapter->dev_info.dev_data->numa_node;
eth_dev->data->dev_private = rte_zmalloc_socket(name,
sizeof(struct sxe2_adapter),
RTE_CACHE_LINE_SIZE,
--
2.52.0
next prev parent reply other threads:[~2026-08-16 2:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-16 2:52 [PATCH v2 00/13] driver/sxe2: fix bugs liujie5
2026-08-16 2:52 ` [PATCH v2 01/13] net/sxe2: add Rx queue buffer split fill support liujie5
2026-08-16 2:52 ` [PATCH v2 02/13] net/sxe2: update switchdev repr VSI ID display format liujie5
2026-08-16 2:52 ` [PATCH v2 03/13] net/sxe2: add ACL engine event statistics support liujie5
2026-08-16 2:52 ` [PATCH v2 04/13] net/sxe2: enhance device cap and res management liujie5
2026-08-16 2:52 ` liujie5 [this message]
2026-08-16 2:52 ` [PATCH v2 06/13] net/sxe2: refactor flow tunnel port handling liujie5
2026-08-16 2:52 ` [PATCH v2 07/13] net/sxe2: validate IPsec key length against maximum limit liujie5
2026-08-16 2:52 ` [PATCH v2 08/13] net/sxe2: enhance repr event handling and MP code liujie5
2026-08-16 2:52 ` [PATCH v2 09/13] net/sxe2: optimize vectorized Tx/Rx path liujie5
2026-08-16 2:52 ` [PATCH v2 10/13] common/sxe2: allow munmap during kernel reset liujie5
2026-08-16 2:52 ` [PATCH v2 11/13] net/sxe2: clean up duplicate function declarations liujie5
2026-08-16 2:52 ` [PATCH v2 12/13] net/sxe2: clean up structure definitions liujie5
2026-08-16 2:52 ` [PATCH v2 13/13] doc/sxe2: add acl-stat-type parameter documentation liujie5
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260816025233.2727226-6-liujie5@linkdatatechnology.com \
--to=liujie5@linkdatatechnology.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox