aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>2016-10-09 00:28:50 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-09 09:30:38 -0400
commitf5ef017e1195d0a8c69a82bf95fea9c776b93ff0 (patch)
tree66c60256b855392644e5147eee6b46f259ff458f
parent6ee080bb09889dc0195a9c659288d17999237fb6 (diff)
be2net: NCSI FW section should be properly updated with ethtool for BE3
The driver has a check to ensure that NCSI FW section is updated only if the current FW version in the card supports it. This FW version check is done using memcmp() which obviously fails in some cases. Fix this by breaking up the version string into integer version components and comparing them. Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 45d174262d32..7e9be9f4236a 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -2728,6 +2728,26 @@ static int be_flash(struct be_adapter *adapter, const u8 *img,
2728 return 0; 2728 return 0;
2729} 2729}
2730 2730
2731#define NCSI_UPDATE_LOG "NCSI section update is not supported in FW ver %s\n"
2732static bool be_fw_ncsi_supported(char *ver)
2733{
2734 int v1[4] = {3, 102, 148, 0}; /* Min ver that supports NCSI FW */
2735 int v2[4];
2736 int i;
2737
2738 if (sscanf(ver, "%d.%d.%d.%d", &v2[0], &v2[1], &v2[2], &v2[3]) != 4)
2739 return false;
2740
2741 for (i = 0; i < 4; i++) {
2742 if (v1[i] < v2[i])
2743 return true;
2744 else if (v1[i] > v2[i])
2745 return false;
2746 }
2747
2748 return true;
2749}
2750
2731/* For BE2, BE3 and BE3-R */ 2751/* For BE2, BE3 and BE3-R */
2732static int be_flash_BEx(struct be_adapter *adapter, 2752static int be_flash_BEx(struct be_adapter *adapter,
2733 const struct firmware *fw, 2753 const struct firmware *fw,
@@ -2805,8 +2825,10 @@ static int be_flash_BEx(struct be_adapter *adapter,
2805 continue; 2825 continue;
2806 2826
2807 if ((pflashcomp[i].optype == OPTYPE_NCSI_FW) && 2827 if ((pflashcomp[i].optype == OPTYPE_NCSI_FW) &&
2808 memcmp(adapter->fw_ver, "3.102.148.0", 11) < 0) 2828 !be_fw_ncsi_supported(adapter->fw_ver)) {
2829 dev_info(dev, NCSI_UPDATE_LOG, adapter->fw_ver);
2809 continue; 2830 continue;
2831 }
2810 2832
2811 if (pflashcomp[i].optype == OPTYPE_PHY_FW && 2833 if (pflashcomp[i].optype == OPTYPE_PHY_FW &&
2812 !phy_flashing_required(adapter)) 2834 !phy_flashing_required(adapter))