summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2016-08-14 14:28:46 +0300
committerIdo Barnea <ibarnea@cisco.com>2016-08-14 14:28:46 +0300
commitce1de344579505665b88c2d548ca8d2acc135988 (patch)
tree03c325167ca3b741a63343688cbf08efe52546fe
parentb5c09779a55f6e0cdd08230109319e086491acdf (diff)
Exit if x710 firmware version is too old
-rw-r--r--src/dpdk/drivers/net/i40e/i40e_ethdev.c10
-rw-r--r--src/dpdk/lib/librte_ether/rte_ethdev.c14
-rw-r--r--src/main_dpdk.cpp34
3 files changed, 58 insertions, 0 deletions
diff --git a/src/dpdk/drivers/net/i40e/i40e_ethdev.c b/src/dpdk/drivers/net/i40e/i40e_ethdev.c
index 12402ae2..778c1eca 100644
--- a/src/dpdk/drivers/net/i40e/i40e_ethdev.c
+++ b/src/dpdk/drivers/net/i40e/i40e_ethdev.c
@@ -2404,6 +2404,16 @@ i40e_trex_fdir_stats_reset(struct rte_eth_dev *dev, uint32_t *stats, uint32_t st
}
}
+// TREX_PATCH
+int
+i40e_trex_get_fw_ver(struct rte_eth_dev *dev, uint32_t *nvm_ver)
+{
+ struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ *nvm_ver = hw->nvm.version;
+ return 0;
+}
+
/* 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/dpdk/lib/librte_ether/rte_ethdev.c b/src/dpdk/lib/librte_ether/rte_ethdev.c
index a12ce3d3..e7bc9d6d 100644
--- a/src/dpdk/lib/librte_ether/rte_ethdev.c
+++ b/src/dpdk/lib/librte_ether/rte_ethdev.c
@@ -1514,6 +1514,20 @@ rte_eth_fdir_stats_reset(uint8_t port_id, uint32_t *stats, uint32_t start, uint3
return 0;
}
+// TREX_PATCH
+int
+rte_eth_get_fw_ver(int port_id, uint32_t *version)
+{
+ 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
+ return i40e_trex_get_fw_ver(dev, version);
+}
+
int
rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
{
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 7a64daf3..caec511b 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -155,6 +155,7 @@ public:
virtual int dump_fdir_global_stats(CPhyEthIF * _if, FILE *fd) { return -1;}
virtual int get_stat_counters_num() {return 0;}
virtual int get_rx_stat_capabilities() {return 0;}
+ virtual int verify_fw_ver(int i) {return 0;}
virtual CFlowStatParser *get_flow_stat_parser();
};
@@ -341,6 +342,7 @@ public:
// disabling flow control on 40G using DPDK API causes the interface to malfunction
virtual bool flow_control_disable_supported(){return false;}
virtual bool hw_rx_stat_supported(){return true;}
+ virtual int verify_fw_ver(int i);
virtual CFlowStatParser *get_flow_stat_parser();
private:
@@ -3487,6 +3489,14 @@ int CGlobalTRex::ixgbe_prob_init(void){
CTRexExtendedDriverDb::Ins()->set_driver_name(dev_info.driver_name);
+ // check if firmware version is new enough
+ for (i = 0; i < m_max_ports; i++) {
+ if (CTRexExtendedDriverDb::Ins()->get_drv()->verify_fw_ver(i) < 0) {
+ // error message printed by verify_fw_ver
+ exit(1);
+ }
+ }
+
m_port_cfg.update_var();
if ( get_is_rx_filter_enable() ){
@@ -5812,6 +5822,30 @@ int CTRexExtendedDriverBase40G::wait_for_stable_link(){
return (0);
}
+extern "C" int rte_eth_get_fw_ver(int port, uint32_t *ver);
+
+int CTRexExtendedDriverBase40G::verify_fw_ver(int port_id) {
+ uint32_t version;
+ int ret;
+
+ ret = rte_eth_get_fw_ver(port_id, &version);
+
+ if (ret == 0) {
+ printf("port %d: FW ver %02d.%02d.%02d\n", port_id, ((version >> 12) & 0xf), ((version >> 4) & 0xff)
+ ,(version & 0xf));
+
+ if ((((version >> 12) & 0xf) < 5) || ((((version >> 12) & 0xf) == 5) && ((version >> 4 & 0xff) == 0)
+ && ((version & 0xf) < 4))) {
+ printf("Error: In this TRex version, X710 firmware must be at least 05.00.04\n");
+ printf(" Please refer to %s for upgrade instructions\n",
+ "https://trex-tgn.cisco.com/trex/doc/trex_manual.html#_firmware_update_to_xl710_x710");
+ exit(1);
+ }
+ }
+
+ return ret;
+}
+
CFlowStatParser *CTRexExtendedDriverBase40G::get_flow_stat_parser() {
CFlowStatParser *parser = new CFlowStatParser();
assert (parser);