From: Jie Liu <[email protected]>
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 <[email protected]>
---
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.