summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2017-02-28 18:16:44 +0200
committerHanoh Haim <hhaim@cisco.com>2017-02-28 18:16:44 +0200
commita875cce88abb1facc2b6d59b3af011ae797b6d18 (patch)
tree483b79df4ded70639b78b7eaa8e045f115b8a76c
parent404b0d6a3d91edf31eb4507f548c14a44a9ee2d9 (diff)
parent0e80bd4f57b89c01a8b12889a260264a8eae08ad (diff)
Merge branch 'master' of csi-sceasr-b94:/auto/proj-pcube-b/apps/PL-b/tools/repo//trex-core
-rw-r--r--src/internal_api/trex_platform_api.h2
-rw-r--r--src/main_dpdk.cpp180
-rw-r--r--src/stateless/cp/trex_stateless_port.h12
-rw-r--r--src/stateless/cp/trex_stream.cpp7
4 files changed, 59 insertions, 142 deletions
diff --git a/src/internal_api/trex_platform_api.h b/src/internal_api/trex_platform_api.h
index 5723503c..5bd8ff99 100644
--- a/src/internal_api/trex_platform_api.h
+++ b/src/internal_api/trex_platform_api.h
@@ -122,7 +122,6 @@ public:
uint8_t hw_macaddr[6];
std::string pci_addr;
int numa_node;
- bool has_crc;
};
virtual void port_id_to_cores(uint8_t port_id, std::vector<std::pair<uint8_t, uint8_t>> &cores_id_list) const = 0;
@@ -226,7 +225,6 @@ public:
virtual void get_interface_info(uint8_t interface_id, intf_info_st &info) const {
info.driver_name = "TEST";
- info.has_crc = true;
info.numa_node = 0;
memset(&info.hw_macaddr, 0, sizeof(info.hw_macaddr));
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index bfeb0d8a..fb2a6dce 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -85,9 +85,6 @@ extern "C" {
#define RX_CHECK_MIX_SAMPLE_RATE 8
#define RX_CHECK_MIX_SAMPLE_RATE_1G 2
-
-#define SOCKET0 0
-
#define MAX_PKT_BURST 32
#define BP_MAX_CORES 32
@@ -139,32 +136,42 @@ static char global_image_postfix[10];
class CTRexExtendedDriverBase {
-public:
-
- /* need to remove this function - see bug trex-359 */
- virtual bool has_crc_added() {
- return true;
- }
-
- /* currently all NICs support it except Mellanox */
- virtual bool supports_port_reorder() {
- return true;
- }
+protected:
+ enum {
+ // Is there HW support for dropping packets arriving to certain queue?
+ TREX_DRV_CAP_DROP_Q = 0x1,
+ /* Does this NIC type support automatic packet dropping in case of a link down?
+ in case it is supported the packets will be dropped, else there would be a back pressure to tx queues
+ this interface is used as a workaround to let TRex work without link in stateless mode, driver that
+ does not support that will be failed at init time because it will cause watchdog due to watchdog hang */
+ TREX_DRV_CAP_DROP_PKTS_IF_LNK_DOWN = 0x2,
+ // Does the driver support changing MAC address?
+ TREX_DRV_CAP_MAC_ADDR_CHG = 0x4,
+ /* Mellanox driver does not work well with the DPDK port reorder we do */
+ TREX_DRV_CAP_NO_PORT_REORDER_POSSIBLE = 0x8,
+ } trex_drv_cap;
+public:
virtual int get_min_sample_rate(void)=0;
virtual void update_configuration(port_cfg_t * cfg)=0;
virtual void update_global_config_fdir(port_cfg_t * cfg)=0;
-
- virtual bool is_hardware_filter_is_supported(){
- return(false);
- }
virtual int configure_rx_filter_rules(CPhyEthIF * _if)=0;
virtual int add_del_rx_flow_stat_rule(uint8_t port_id, enum rte_filter_op op, uint16_t l3, uint8_t l4
, uint8_t ipv6_next_h, uint16_t id) {return 0;}
- virtual bool is_hardware_support_drop_queue(){
- return(false);
+ bool is_hardware_support_drop_queue() {
+ return ((m_cap & TREX_DRV_CAP_DROP_Q) != 0);
+ }
+ bool hardware_support_mac_change() {
+ return ((m_cap & TREX_DRV_CAP_MAC_ADDR_CHG) != 0);
+ }
+ bool drop_packets_incase_of_linkdown() {
+ return ((m_cap & TREX_DRV_CAP_DROP_PKTS_IF_LNK_DOWN) != 0);
+ }
+ virtual bool supports_port_reorder() {
+ // Since only Mellanox does not support, logic here is reveresed compared to other flags.
+ // Put this only if not supported.
+ return ((m_cap & TREX_DRV_CAP_NO_PORT_REORDER_POSSIBLE) == 0);
}
-
virtual int stop_queue(CPhyEthIF * _if, uint16_t q_num);
void get_extended_stats_fixed(CPhyEthIF * _if, CPhyEthIFStats *stats, int fix_i, int fix_o);
virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats)=0;
@@ -183,22 +190,17 @@ public:
virtual int set_rcv_all(CPhyEthIF * _if, bool set_on)=0;
virtual TRexPortAttr * create_port_attr(uint8_t port_id) = 0;
- /* Does this NIC type support automatic packet dropping in case of a link down?
- in case it is supported the packets will be dropped, else there would be a back pressure to tx queues
- this interface is used as a workaround to let TRex work without link in stateless mode, driver that
- does not support that will be failed at init time because it will cause watchdog due to watchdog hang */
- virtual bool drop_packets_incase_of_linkdown() {
- return (false);
- }
-
/* Mellanox ConnectX-4 can drop only 35MPPS per Rx queue. to workaround this issue we will create multi rx queue and enable RSS. for Queue1 we will disable RSS
return zero for disable patch and rx queues number for enable
*/
virtual uint16_t enable_rss_drop_workaround(void) {
- return (0);
+ return 0;
}
+protected:
+ // flags describing interface capabilities
+ uint32_t m_cap;
};
@@ -206,6 +208,7 @@ class CTRexExtendedDriverBase1G : public CTRexExtendedDriverBase {
public:
CTRexExtendedDriverBase1G(){
+ m_cap = TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG;
}
TRexPortAttr * create_port_attr(uint8_t port_id) {
@@ -222,20 +225,11 @@ public:
return ( RX_CHECK_MIX_SAMPLE_RATE_1G);
}
virtual void update_configuration(port_cfg_t * cfg);
-
- virtual bool is_hardware_filter_is_supported(){
- return (true);
- }
-
virtual int stop_queue(CPhyEthIF * _if, uint16_t q_num);
virtual int configure_rx_filter_rules(CPhyEthIF * _if);
virtual int configure_rx_filter_rules_statefull(CPhyEthIF * _if);
virtual int configure_rx_filter_rules_stateless(CPhyEthIF * _if);
virtual void clear_rx_filter_rules(CPhyEthIF * _if);
- virtual bool is_hardware_support_drop_queue(){
- return(true);
- }
-
virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats);
virtual void clear_extended_stats(CPhyEthIF * _if);
virtual int dump_fdir_global_stats(CPhyEthIF * _if, FILE *fd) {return 0;}
@@ -255,28 +249,13 @@ public:
TRexPortAttr * create_port_attr(uint8_t port_id) {
return new DpdkTRexPortAttr(port_id, true, true);
}
-
- virtual bool has_crc_added() {
- return true;
- }
-
virtual void update_global_config_fdir(port_cfg_t * cfg) {}
virtual int get_min_sample_rate(void){
return ( RX_CHECK_MIX_SAMPLE_RATE_1G);
}
virtual void update_configuration(port_cfg_t * cfg);
-
- virtual bool is_hardware_filter_is_supported(){
- return (true);
- }
-
virtual int configure_rx_filter_rules(CPhyEthIF * _if);
-
- virtual bool is_hardware_support_drop_queue(){
- return(false);
- }
-
virtual int stop_queue(CPhyEthIF * _if, uint16_t q_num);
virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats)=0;
virtual void clear_extended_stats(CPhyEthIF * _if);
@@ -294,6 +273,7 @@ public:
CTRexExtendedDriverVirtio() {
/* we are working in mode that we have 1 queue for rx and one queue for tx*/
CGlobalInfo::m_options.preview.set_vm_one_queue_enable(true);
+ m_cap = /*TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG */ 0;
}
static CTRexExtendedDriverBase * create(){
return ( new CTRexExtendedDriverVirtio() );
@@ -306,6 +286,7 @@ public:
CTRexExtendedDriverVmxnet3(){
/* we are working in mode in which we have 1 queue for rx and one queue for tx*/
CGlobalInfo::m_options.preview.set_vm_one_queue_enable(true);
+ m_cap = /*TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG*/0;
}
static CTRexExtendedDriverBase * create() {
@@ -320,15 +301,11 @@ public:
CTRexExtendedDriverI40evf(){
/* we are working in mode in which we have 1 queue for rx and one queue for tx*/
CGlobalInfo::m_options.preview.set_vm_one_queue_enable(true);
+ m_cap = /*TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG */0;
}
virtual void get_extended_stats(CPhyEthIF * _if, CPhyEthIFStats *stats) {
get_extended_stats_fixed(_if, stats, 0, 4);
}
-
- virtual bool has_crc_added() {
- return true;
- }
-
virtual void update_configuration(port_cfg_t * cfg);
static CTRexExtendedDriverBase * create() {
return ( new CTRexExtendedDriverI40evf() );
@@ -341,6 +318,7 @@ public:
CTRexExtendedDriverIxgbevf(){
/* we are working in mode in which we have 1 queue for rx and one queue for tx*/
CGlobalInfo::m_options.preview.set_vm_one_queue_enable(true);
+ m_cap = /*TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG */0;
}
virtual void get_extended_stats(CPhyEthIF * _if, CPhyEthIFStats *stats) {
get_extended_stats_fixed(_if, stats, 4, 4);
@@ -355,6 +333,7 @@ class CTRexExtendedDriverBaseE1000 : public CTRexExtendedDriverVirtBase {
CTRexExtendedDriverBaseE1000() {
// E1000 driver is only relevant in VM in our case
CGlobalInfo::m_options.preview.set_vm_one_queue_enable(true);
+ m_cap = /*TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG */0;
}
public:
static CTRexExtendedDriverBase * create() {
@@ -369,6 +348,7 @@ public:
class CTRexExtendedDriverBase10G : public CTRexExtendedDriverBase {
public:
CTRexExtendedDriverBase10G(){
+ m_cap = TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG;
}
TRexPortAttr * create_port_attr(uint8_t port_id) {
@@ -385,16 +365,9 @@ public:
return (RX_CHECK_MIX_SAMPLE_RATE);
}
virtual void update_configuration(port_cfg_t * cfg);
-
- virtual bool is_hardware_filter_is_supported(){
- return (true);
- }
virtual int configure_rx_filter_rules(CPhyEthIF * _if);
virtual int configure_rx_filter_rules_stateless(CPhyEthIF * _if);
virtual int configure_rx_filter_rules_statefull(CPhyEthIF * _if);
- virtual bool is_hardware_support_drop_queue(){
- return(true);
- }
virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats);
virtual void clear_extended_stats(CPhyEthIF * _if);
virtual int wait_for_stable_link();
@@ -415,6 +388,7 @@ public:
// If we want to support more counters in case of card having less interfaces, we
// Will have to identify the number of interfaces dynamically.
m_if_per_card = 4;
+ m_cap = TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG | TREX_DRV_CAP_DROP_PKTS_IF_LNK_DOWN;
}
TRexPortAttr * create_port_attr(uint8_t port_id) {
@@ -435,13 +409,6 @@ public:
virtual int configure_rx_filter_rules(CPhyEthIF * _if);
virtual int add_del_rx_flow_stat_rule(uint8_t port_id, enum rte_filter_op op, uint16_t l3_proto
, uint8_t l4_proto, uint8_t ipv6_next_h, uint16_t id);
- virtual bool is_hardware_filter_is_supported(){
- return (true);
- }
-
- virtual bool is_hardware_support_drop_queue(){
- return(true);
- }
virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats);
virtual void clear_extended_stats(CPhyEthIF * _if);
virtual void reset_rx_stats(CPhyEthIF * _if, uint32_t *stats, int min, int len);
@@ -463,10 +430,6 @@ private:
virtual int add_del_eth_type_rule(uint8_t port_id, enum rte_filter_op op, uint16_t eth_type);
virtual int configure_rx_filter_rules_statefull(CPhyEthIF * _if);
- virtual bool drop_packets_incase_of_linkdown() {
- return (true);
- }
-
private:
uint8_t m_if_per_card;
};
@@ -474,6 +437,7 @@ private:
class CTRexExtendedDriverBaseVIC : public CTRexExtendedDriverBase {
public:
CTRexExtendedDriverBaseVIC(){
+ m_cap = TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG;
}
TRexPortAttr * create_port_attr(uint8_t port_id) {
@@ -483,23 +447,11 @@ public:
static CTRexExtendedDriverBase * create(){
return ( new CTRexExtendedDriverBaseVIC() );
}
-
- virtual bool is_hardware_filter_is_supported(){
- return (true);
- }
virtual void update_global_config_fdir(port_cfg_t * cfg){
}
-
-
- virtual bool is_hardware_support_drop_queue(){
- return(true);
- }
-
void clear_extended_stats(CPhyEthIF * _if);
-
void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats);
-
virtual int get_min_sample_rate(void){
return (RX_CHECK_MIX_SAMPLE_RATE);
}
@@ -532,6 +484,8 @@ private:
class CTRexExtendedDriverBaseMlnx5G : public CTRexExtendedDriverBase {
public:
CTRexExtendedDriverBaseMlnx5G(){
+ m_cap = TREX_DRV_CAP_DROP_Q | TREX_DRV_CAP_MAC_ADDR_CHG
+ | TREX_DRV_CAP_NO_PORT_REORDER_POSSIBLE;
}
TRexPortAttr * create_port_attr(uint8_t port_id) {
@@ -552,13 +506,6 @@ public:
virtual void update_configuration(port_cfg_t * cfg);
virtual int configure_rx_filter_rules(CPhyEthIF * _if);
- virtual bool is_hardware_filter_is_supported(){
- return (true);
- }
-
- virtual bool is_hardware_support_drop_queue(){
- return(true);
- }
virtual void get_extended_stats(CPhyEthIF * _if,CPhyEthIFStats *stats);
virtual void clear_extended_stats(CPhyEthIF * _if);
virtual void reset_rx_stats(CPhyEthIF * _if, uint32_t *stats, int min, int len);
@@ -578,10 +525,6 @@ public:
return (5);
}
- virtual bool supports_port_reorder() {
- return false;
- }
-
private:
virtual void add_del_rules(enum rte_filter_op op, uint8_t port_id, uint16_t type, uint16_t ip_id, uint8_t l4_proto
, int queue);
@@ -1600,20 +1543,12 @@ void CPhyEthIF::configure(uint16_t nb_rx_queue,
pci_reg_write(IXGBE_L34T_IMIR(0),(1<<21));
*/
-
void CPhyEthIF::configure_rx_duplicate_rules(){
-
if ( get_is_rx_filter_enable() ){
-
- if ( get_ex_drv()->is_hardware_filter_is_supported()==false ){
- printf(" ERROR this feature is not supported with current hardware \n");
- exit(1);
- }
get_ex_drv()->configure_rx_filter_rules(this);
}
}
-
void CPhyEthIF::stop_rx_drop_queue() {
// In debug mode, we want to see all packets. Don't want to disable any queue.
if ( get_vm_one_queue_enable() || (CGlobalInfo::m_options.m_debug_pkt_proto != 0)) {
@@ -1721,7 +1656,7 @@ void CPhyEthIF::disable_flow_control(){
}
/*
-Get user frienly devices description from saved env. var
+Get user friendly devices description from saved env. var
Changes certain attributes based on description
*/
void DpdkTRexPortAttr::update_description(){
@@ -1884,7 +1819,7 @@ int DpdkTRexPortAttr::add_mac(char * mac){
mac_addr.addr_bytes[i] =mac[i];
}
- if ( ! get_vm_one_queue_enable() ) {
+ if ( get_ex_drv()->hardware_support_mac_change() ) {
if ( rte_eth_dev_mac_addr_add(m_port_id, &mac_addr,0) != 0) {
printf("Failed setting MAC for port %d \n", m_port_id);
exit(-1);
@@ -3835,7 +3770,7 @@ int CGlobalTRex::ixgbe_start(void){
// 1 TX queue in VM case
_if->tx_queue_setup(0, RTE_TEST_TX_DESC_VM_DEFAULT, socket_id, &m_port_cfg.m_tx_conf);
} else {
- // 2 rx queues.
+ // 2 rx queues in normal case. More if rss enabled.
// TX queues: 1 for each core handling the port pair + 1 for latency pkts + 1 for use by RX core
uint16_t rx_queues;
@@ -3857,7 +3792,8 @@ int CGlobalTRex::ixgbe_start(void){
}
/* drop queue */
_if->rx_queue_setup(j,
- RTE_TEST_RX_DESC_DEFAULT_MLX,
+ // RTE_TEST_RX_DESC_DEFAULT_MLX,
+ RTE_TEST_RX_DESC_DEFAULT,
socket_id,
&m_port_cfg.m_rx_conf,
CGlobalInfo::m_mem_pool[socket_id].m_mbuf_pool_2048);
@@ -4138,8 +4074,10 @@ int CGlobalTRex::ixgbe_prob_init(void){
printf("max_tx_queues : %d \n",dev_info.max_tx_queues);
printf("max_mac_addrs : %d \n",dev_info.max_mac_addrs);
- printf("rx_offload_capa : %x \n",dev_info.rx_offload_capa);
- printf("tx_offload_capa : %x \n",dev_info.tx_offload_capa);
+ printf("rx_offload_capa : 0x%x \n",dev_info.rx_offload_capa);
+ printf("tx_offload_capa : 0x%x \n",dev_info.tx_offload_capa);
+ printf("rss reta_size : %d \n",dev_info.reta_size);
+ printf("flow_type_rss : 0x%lx \n",dev_info.flow_type_rss_offloads);
}
int i;
@@ -5219,7 +5157,6 @@ static CGlobalTRex g_trex;
void CPhyEthIF::configure_rss_redirect_table(uint16_t numer_of_queues,
uint16_t skip_queue){
-
struct rte_eth_dev_info dev_info;
rte_eth_dev_info_get(m_port_id,&dev_info);
@@ -5230,7 +5167,7 @@ void CPhyEthIF::configure_rss_redirect_table(uint16_t numer_of_queues,
struct rte_eth_rss_reta_entry64 reta_conf[reta_conf_size];
- rte_eth_dev_rss_reta_query(m_port_id,&reta_conf[0],dev_info.reta_size);
+ rte_eth_dev_rss_reta_query(m_port_id,&reta_conf[0],dev_info.reta_size);
int i,j;
@@ -5247,22 +5184,20 @@ void CPhyEthIF::configure_rss_redirect_table(uint16_t numer_of_queues,
skip+=1;
}
reta_conf[j].reta[i]=q;
- // printf(" %d %d %d \n",j,i,q);
}
}
- rte_eth_dev_rss_reta_update(m_port_id,&reta_conf[0],dev_info.reta_size);
+ assert (rte_eth_dev_rss_reta_update(m_port_id,&reta_conf[0],dev_info.reta_size) == 0);
- rte_eth_dev_rss_reta_query(m_port_id,&reta_conf[0],dev_info.reta_size);
+ assert (rte_eth_dev_rss_reta_query(m_port_id,&reta_conf[0],dev_info.reta_size) == 0);
- #if 0
+#if 0
/* verification */
for (j=0; j<reta_conf_size; j++) {
for (i=0; i<RTE_RETA_GROUP_SIZE; i++) {
printf(" R %d %d %d \n",j,i,reta_conf[j].reta[i]);
}
}
- #endif
-
+#endif
}
@@ -7480,7 +7415,6 @@ TrexDpdkPlatformApi::get_interface_info(uint8_t interface_id, intf_info_st &info
struct ether_addr rte_mac_addr;
info.driver_name = CTRexExtendedDriverDb::Ins()->get_driver_name();
- info.has_crc = CTRexExtendedDriverDb::Ins()->get_drv()->has_crc_added();
/* mac INFO */
diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h
index 5c2c8397..a1f7b76a 100644
--- a/src/stateless/cp/trex_stateless_port.h
+++ b/src/stateless/cp/trex_stateless_port.h
@@ -358,18 +358,6 @@ public:
return m_rx_count_num;
}
- /**
- * return true if port adds CRC to a packet (not occurs for
- * VNICs)
- *
- * @author imarom (24-Feb-16)
- *
- * @return bool
- */
- bool has_crc_added() const {
- return m_api_info.has_crc;
- }
-
TrexPortOwner & get_owner() {
return m_owner;
}
diff --git a/src/stateless/cp/trex_stream.cpp b/src/stateless/cp/trex_stream.cpp
index 7a3dfef7..90c8493b 100644
--- a/src/stateless/cp/trex_stream.cpp
+++ b/src/stateless/cp/trex_stream.cpp
@@ -265,13 +265,10 @@ TrexStreamRate::get_line_speed_bps() {
double
TrexStreamRate::get_pkt_size() {
- TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(m_stream.m_port_id);
-
double pkt_size = m_stream.get_pkt_size();
- if (port->has_crc_added()) {
- pkt_size += 4;
- }
+ // compensate for Ethernet FCS (CRC) added by driver
+ pkt_size += 4;
return pkt_size;
}