summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/dpdk22/drivers/net/i40e/i40e_ethdev.c13
-rw-r--r--src/dpdk22/lib/librte_ether/rte_ethdev.c15
-rw-r--r--src/dpdk22/lib/librte_ether/rte_ethdev.h2
-rwxr-xr-xsrc/main_dpdk.cpp27
4 files changed, 47 insertions, 10 deletions
diff --git a/src/dpdk22/drivers/net/i40e/i40e_ethdev.c b/src/dpdk22/drivers/net/i40e/i40e_ethdev.c
index 7542ade1..0a1e9efc 100644
--- a/src/dpdk22/drivers/net/i40e/i40e_ethdev.c
+++ b/src/dpdk22/drivers/net/i40e/i40e_ethdev.c
@@ -2071,6 +2071,19 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw)
i40e_update_vsi_stats(pf->main_vsi);
}
+// TREX_PATCH
+int
+i40e_trex_get_speed(struct rte_eth_dev *dev)
+{
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ if (i40e_is_40G_device(hw->device_id)) {
+ return 40;
+ } else {
+ return 10;
+ }
+}
+
/* Get all statistics of a port */
static void
i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
diff --git a/src/dpdk22/lib/librte_ether/rte_ethdev.c b/src/dpdk22/lib/librte_ether/rte_ethdev.c
index ed971b49..43ec0265 100644
--- a/src/dpdk22/lib/librte_ether/rte_ethdev.c
+++ b/src/dpdk22/lib/librte_ether/rte_ethdev.c
@@ -1430,6 +1430,21 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link)
}
}
+// TREX_PATCH
+int
+rte_eth_get_speed(uint8_t port_id, int *speed)
+{
+ struct rte_eth_dev *dev;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+
+ dev = &rte_eth_devices[port_id];
+
+ // Only xl710 support this
+ *speed = i40e_trex_get_speed(dev);
+ return 0;
+}
+
int
rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
{
diff --git a/src/dpdk22/lib/librte_ether/rte_ethdev.h b/src/dpdk22/lib/librte_ether/rte_ethdev.h
index f8c7c86d..e4bc9742 100644
--- a/src/dpdk22/lib/librte_ether/rte_ethdev.h
+++ b/src/dpdk22/lib/librte_ether/rte_ethdev.h
@@ -2150,6 +2150,8 @@ extern void rte_eth_link_get(uint8_t port_id, struct rte_eth_link *link);
extern void rte_eth_link_get_nowait(uint8_t port_id,
struct rte_eth_link *link);
+extern int rte_eth_get_speed(uint8_t port_id, int *speed);
+
/**
* Retrieve the general I/O statistics of an Ethernet device.
*
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index d40c4c8b..701ae13e 100755
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -125,7 +125,7 @@ struct port_cfg_t;
class CTRexExtendedDriverBase {
public:
- virtual TrexPlatformApi::driver_speed_e get_driver_speed() = 0;
+ virtual TrexPlatformApi::driver_speed_e get_driver_speed(uint8_t port_id) = 0;
virtual int get_min_sample_rate(void)=0;
virtual void update_configuration(port_cfg_t * cfg)=0;
@@ -155,7 +155,7 @@ public:
CTRexExtendedDriverBase1G(){
}
- TrexPlatformApi::driver_speed_e get_driver_speed() {
+ TrexPlatformApi::driver_speed_e get_driver_speed(uint8_t port_id) {
return TrexPlatformApi::SPEED_1G;
}
@@ -197,7 +197,7 @@ public:
CGlobalInfo::m_options.preview.set_vm_one_queue_enable(true);
}
- TrexPlatformApi::driver_speed_e get_driver_speed() {
+ TrexPlatformApi::driver_speed_e get_driver_speed(uint8_t port_id) {
return TrexPlatformApi::SPEED_1G;
}
@@ -240,7 +240,7 @@ public:
CTRexExtendedDriverBase10G(){
}
- TrexPlatformApi::driver_speed_e get_driver_speed() {
+ TrexPlatformApi::driver_speed_e get_driver_speed(uint8_t port_id) {
return TrexPlatformApi::SPEED_10G;
}
@@ -274,8 +274,15 @@ public:
CTRexExtendedDriverBase40G(){
}
- TrexPlatformApi::driver_speed_e get_driver_speed() {
- return TrexPlatformApi::SPEED_40G;
+ TrexPlatformApi::driver_speed_e get_driver_speed(uint8_t port_id) {
+ int speed;
+
+ rte_eth_get_speed(port_id, &speed);
+ if (speed == 10) {
+ return TrexPlatformApi::SPEED_10G;
+ } else {
+ return TrexPlatformApi::SPEED_40G;
+ }
}
static CTRexExtendedDriverBase * create(){
@@ -4277,8 +4284,8 @@ int main_test(int argc , char * argv[]){
if (CGlobalInfo::m_options.m_debug_pkt_proto != 0) {
CTrexDebug debug = CTrexDebug(g_trex.m_ports, g_trex.m_max_ports);
- debug.test_send(CGlobalInfo::m_options.m_debug_pkt_proto);
- exit(1);
+ debug.test_send(CGlobalInfo::m_options.m_debug_pkt_proto);
+ exit(1);
}
if ( CGlobalInfo::m_options.preview.getOnlyLatency() ){
@@ -4918,12 +4925,12 @@ TrexDpdkPlatformApi::port_id_to_cores(uint8_t port_id, std::vector<std::pair<uin
}
void
-TrexDpdkPlatformApi::get_interface_info(uint8_t interface_id,
+TrexDpdkPlatformApi::get_interface_info(uint8_t port_id,
std::string &driver_name,
driver_speed_e &speed) const {
driver_name = CTRexExtendedDriverDb::Ins()->get_driver_name();
- speed = CTRexExtendedDriverDb::Ins()->get_drv()->get_driver_speed();
+ speed = CTRexExtendedDriverDb::Ins()->get_drv()->get_driver_speed(port_id);
}
void