Commit b938662d authored by Himanshu Madhani's avatar Himanshu Madhani Committed by David S. Miller

qlcnic: Fix ethtool supported port status for 83xx

o Fix display for interface while using 'ethtool <device>' for 83xx adapter
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: default avatarShahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9fd13331
...@@ -429,6 +429,7 @@ struct qlcnic_hardware_context { ...@@ -429,6 +429,7 @@ struct qlcnic_hardware_context {
u16 port_type; u16 port_type;
u16 board_type; u16 board_type;
u16 supported_type;
u16 link_speed; u16 link_speed;
u16 link_duplex; u16 link_duplex;
...@@ -1514,6 +1515,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter); ...@@ -1514,6 +1515,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter);
void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter); void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter);
void qlcnic_82xx_add_sysfs(struct qlcnic_adapter *adapter); void qlcnic_82xx_add_sysfs(struct qlcnic_adapter *adapter);
void qlcnic_82xx_remove_sysfs(struct qlcnic_adapter *adapter); void qlcnic_82xx_remove_sysfs(struct qlcnic_adapter *adapter);
int qlcnic_82xx_get_settings(struct qlcnic_adapter *, struct ethtool_cmd *);
int qlcnicvf_config_bridged_mode(struct qlcnic_adapter *, u32); int qlcnicvf_config_bridged_mode(struct qlcnic_adapter *, u32);
int qlcnicvf_config_led(struct qlcnic_adapter *, u32, u32); int qlcnicvf_config_led(struct qlcnic_adapter *, u32, u32);
......
...@@ -2830,6 +2830,23 @@ int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter) ...@@ -2830,6 +2830,23 @@ int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter)
break; break;
} }
config = cmd.rsp.arg[3]; config = cmd.rsp.arg[3];
if (QLC_83XX_SFP_PRESENT(config)) {
switch (ahw->module_type) {
case LINKEVENT_MODULE_OPTICAL_UNKNOWN:
case LINKEVENT_MODULE_OPTICAL_SRLR:
case LINKEVENT_MODULE_OPTICAL_LRM:
case LINKEVENT_MODULE_OPTICAL_SFP_1G:
ahw->supported_type = PORT_FIBRE;
break;
case LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLE:
case LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLELEN:
case LINKEVENT_MODULE_TWINAX:
ahw->supported_type = PORT_TP;
break;
default:
ahw->supported_type = PORT_OTHER;
}
}
if (config & 1) if (config & 1)
err = 1; err = 1;
} }
...@@ -2838,7 +2855,8 @@ int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter) ...@@ -2838,7 +2855,8 @@ int qlcnic_83xx_test_link(struct qlcnic_adapter *adapter)
return config; return config;
} }
int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter) int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter,
struct ethtool_cmd *ecmd)
{ {
u32 config = 0; u32 config = 0;
int status = 0; int status = 0;
...@@ -2851,6 +2869,54 @@ int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter) ...@@ -2851,6 +2869,54 @@ int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter)
ahw->module_type = QLC_83XX_SFP_MODULE_TYPE(config); ahw->module_type = QLC_83XX_SFP_MODULE_TYPE(config);
/* hard code until there is a way to get it from flash */ /* hard code until there is a way to get it from flash */
ahw->board_type = QLCNIC_BRDTYPE_83XX_10G; ahw->board_type = QLCNIC_BRDTYPE_83XX_10G;
if (netif_running(adapter->netdev) && ahw->has_link_events) {
ethtool_cmd_speed_set(ecmd, ahw->link_speed);
ecmd->duplex = ahw->link_duplex;
ecmd->autoneg = ahw->link_autoneg;
} else {
ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
ecmd->duplex = DUPLEX_UNKNOWN;
ecmd->autoneg = AUTONEG_DISABLE;
}
if (ahw->port_type == QLCNIC_XGBE) {
ecmd->supported = SUPPORTED_1000baseT_Full;
ecmd->advertising = ADVERTISED_1000baseT_Full;
} else {
ecmd->supported = (SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full |
SUPPORTED_100baseT_Half |
SUPPORTED_100baseT_Full |
SUPPORTED_1000baseT_Half |
SUPPORTED_1000baseT_Full);
ecmd->advertising = (ADVERTISED_100baseT_Half |
ADVERTISED_100baseT_Full |
ADVERTISED_1000baseT_Half |
ADVERTISED_1000baseT_Full);
}
switch (ahw->supported_type) {
case PORT_FIBRE:
ecmd->supported |= SUPPORTED_FIBRE;
ecmd->advertising |= ADVERTISED_FIBRE;
ecmd->port = PORT_FIBRE;
ecmd->transceiver = XCVR_EXTERNAL;
break;
case PORT_TP:
ecmd->supported |= SUPPORTED_TP;
ecmd->advertising |= ADVERTISED_TP;
ecmd->port = PORT_TP;
ecmd->transceiver = XCVR_INTERNAL;
break;
default:
ecmd->supported |= SUPPORTED_FIBRE;
ecmd->advertising |= ADVERTISED_FIBRE;
ecmd->port = PORT_OTHER;
ecmd->transceiver = XCVR_EXTERNAL;
break;
}
ecmd->phy_address = ahw->physical_port;
return status; return status;
} }
......
...@@ -603,7 +603,7 @@ int qlcnic_83xx_get_vnic_pf_info(struct qlcnic_adapter *, struct qlcnic_info *); ...@@ -603,7 +603,7 @@ int qlcnic_83xx_get_vnic_pf_info(struct qlcnic_adapter *, struct qlcnic_info *);
void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *); void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *);
void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data); void qlcnic_83xx_get_stats(struct qlcnic_adapter *adapter, u64 *data);
int qlcnic_83xx_get_settings(struct qlcnic_adapter *); int qlcnic_83xx_get_settings(struct qlcnic_adapter *, struct ethtool_cmd *);
int qlcnic_83xx_set_settings(struct qlcnic_adapter *, struct ethtool_cmd *); int qlcnic_83xx_set_settings(struct qlcnic_adapter *, struct ethtool_cmd *);
void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *, void qlcnic_83xx_get_pauseparam(struct qlcnic_adapter *,
struct ethtool_pauseparam *); struct ethtool_pauseparam *);
......
...@@ -252,6 +252,18 @@ static int ...@@ -252,6 +252,18 @@ static int
qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{ {
struct qlcnic_adapter *adapter = netdev_priv(dev); struct qlcnic_adapter *adapter = netdev_priv(dev);
if (qlcnic_82xx_check(adapter))
return qlcnic_82xx_get_settings(adapter, ecmd);
else if (qlcnic_83xx_check(adapter))
return qlcnic_83xx_get_settings(adapter, ecmd);
return -EIO;
}
int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter,
struct ethtool_cmd *ecmd)
{
struct qlcnic_hardware_context *ahw = adapter->ahw; struct qlcnic_hardware_context *ahw = adapter->ahw;
u32 speed, reg; u32 speed, reg;
int check_sfp_module = 0; int check_sfp_module = 0;
...@@ -277,9 +289,6 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -277,9 +289,6 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
} else if (adapter->ahw->port_type == QLCNIC_XGBE) { } else if (adapter->ahw->port_type == QLCNIC_XGBE) {
u32 val = 0; u32 val = 0;
if (qlcnic_83xx_check(adapter))
qlcnic_83xx_get_settings(adapter);
else
val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR);
if (val == QLCNIC_PORT_MODE_802_3_AP) { if (val == QLCNIC_PORT_MODE_802_3_AP) {
...@@ -290,16 +299,13 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -290,16 +299,13 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->advertising = ADVERTISED_10000baseT_Full; ecmd->advertising = ADVERTISED_10000baseT_Full;
} }
if (netif_running(dev) && adapter->ahw->has_link_events) { if (netif_running(adapter->netdev) && ahw->has_link_events) {
if (qlcnic_82xx_check(adapter)) { reg = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn));
reg = QLCRD32(adapter,
P3P_LINK_SPEED_REG(pcifn));
speed = P3P_LINK_SPEED_VAL(pcifn, reg); speed = P3P_LINK_SPEED_VAL(pcifn, reg);
ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; ahw->link_speed = speed * P3P_LINK_SPEED_MHZ;
} ethtool_cmd_speed_set(ecmd, ahw->link_speed);
ethtool_cmd_speed_set(ecmd, adapter->ahw->link_speed); ecmd->autoneg = ahw->link_autoneg;
ecmd->autoneg = adapter->ahw->link_autoneg; ecmd->duplex = ahw->link_duplex;
ecmd->duplex = adapter->ahw->link_duplex;
goto skip; goto skip;
} }
...@@ -341,8 +347,8 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -341,8 +347,8 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
case QLCNIC_BRDTYPE_P3P_10G_SFP_QT: case QLCNIC_BRDTYPE_P3P_10G_SFP_QT:
ecmd->advertising |= ADVERTISED_TP; ecmd->advertising |= ADVERTISED_TP;
ecmd->supported |= SUPPORTED_TP; ecmd->supported |= SUPPORTED_TP;
check_sfp_module = netif_running(dev) && check_sfp_module = netif_running(adapter->netdev) &&
adapter->ahw->has_link_events; ahw->has_link_events;
case QLCNIC_BRDTYPE_P3P_10G_XFP: case QLCNIC_BRDTYPE_P3P_10G_XFP:
ecmd->supported |= SUPPORTED_FIBRE; ecmd->supported |= SUPPORTED_FIBRE;
ecmd->advertising |= ADVERTISED_FIBRE; ecmd->advertising |= ADVERTISED_FIBRE;
...@@ -356,8 +362,8 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -356,8 +362,8 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->advertising |= ecmd->advertising |=
(ADVERTISED_FIBRE | ADVERTISED_TP); (ADVERTISED_FIBRE | ADVERTISED_TP);
ecmd->port = PORT_FIBRE; ecmd->port = PORT_FIBRE;
check_sfp_module = netif_running(dev) && check_sfp_module = netif_running(adapter->netdev) &&
adapter->ahw->has_link_events; ahw->has_link_events;
} else { } else {
ecmd->autoneg = AUTONEG_ENABLE; ecmd->autoneg = AUTONEG_ENABLE;
ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg);
...@@ -366,13 +372,6 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -366,13 +372,6 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
ecmd->port = PORT_TP; ecmd->port = PORT_TP;
} }
break; break;
case QLCNIC_BRDTYPE_83XX_10G:
ecmd->autoneg = AUTONEG_DISABLE;
ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP);
ecmd->advertising |= (ADVERTISED_FIBRE | ADVERTISED_TP);
ecmd->port = PORT_FIBRE;
check_sfp_module = netif_running(dev) && ahw->has_link_events;
break;
default: default:
dev_err(&adapter->pdev->dev, "Unsupported board model %d\n", dev_err(&adapter->pdev->dev, "Unsupported board model %d\n",
adapter->ahw->board_type); adapter->ahw->board_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment