Commit bfd823bd authored by Sony Chacko's avatar Sony Chacko Committed by David S. Miller

netxen: support for GbE port settings

o Enable setting speed and auto negotiation parameters for GbE ports.
o Hardware do not support half duplex setting currently.

David Miller:
	Amit please update your patch to silently reject link setting
	attempts that are unsupported by the device.
Signed-off-by: default avatarSony Chacko <sony.chacko@qlogic.com>
Signed-off-by: default avatarAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d87f4fe2
...@@ -739,7 +739,8 @@ struct netxen_recv_context { ...@@ -739,7 +739,8 @@ struct netxen_recv_context {
#define NX_CDRP_CMD_READ_PEXQ_PARAMETERS 0x0000001c #define NX_CDRP_CMD_READ_PEXQ_PARAMETERS 0x0000001c
#define NX_CDRP_CMD_GET_LIC_CAPABILITIES 0x0000001d #define NX_CDRP_CMD_GET_LIC_CAPABILITIES 0x0000001d
#define NX_CDRP_CMD_READ_MAX_LRO_PER_BOARD 0x0000001e #define NX_CDRP_CMD_READ_MAX_LRO_PER_BOARD 0x0000001e
#define NX_CDRP_CMD_MAX 0x0000001f #define NX_CDRP_CMD_CONFIG_GBE_PORT 0x0000001f
#define NX_CDRP_CMD_MAX 0x00000020
#define NX_RCODE_SUCCESS 0 #define NX_RCODE_SUCCESS 0
#define NX_RCODE_NO_HOST_MEM 1 #define NX_RCODE_NO_HOST_MEM 1
...@@ -1054,6 +1055,7 @@ typedef struct { ...@@ -1054,6 +1055,7 @@ typedef struct {
#define NX_FW_CAPABILITY_BDG (1 << 8) #define NX_FW_CAPABILITY_BDG (1 << 8)
#define NX_FW_CAPABILITY_FVLANTX (1 << 9) #define NX_FW_CAPABILITY_FVLANTX (1 << 9)
#define NX_FW_CAPABILITY_HW_LRO (1 << 10) #define NX_FW_CAPABILITY_HW_LRO (1 << 10)
#define NX_FW_CAPABILITY_GBE_LINK_CFG (1 << 11)
/* module types */ /* module types */
#define LINKEVENT_MODULE_NOT_PRESENT 1 #define LINKEVENT_MODULE_NOT_PRESENT 1
...@@ -1349,6 +1351,8 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup); ...@@ -1349,6 +1351,8 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup);
void netxen_pci_camqm_read_2M(struct netxen_adapter *, u64, u64 *); void netxen_pci_camqm_read_2M(struct netxen_adapter *, u64, u64 *);
void netxen_pci_camqm_write_2M(struct netxen_adapter *, u64, u64); void netxen_pci_camqm_write_2M(struct netxen_adapter *, u64, u64);
int nx_fw_cmd_set_gbe_port(struct netxen_adapter *adapter,
u32 speed, u32 duplex, u32 autoneg);
int nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu); int nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu);
int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu);
int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable); int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable);
......
...@@ -112,6 +112,21 @@ nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu) ...@@ -112,6 +112,21 @@ nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu)
return 0; return 0;
} }
int
nx_fw_cmd_set_gbe_port(struct netxen_adapter *adapter,
u32 speed, u32 duplex, u32 autoneg)
{
return netxen_issue_cmd(adapter,
adapter->ahw.pci_func,
NXHAL_VERSION,
speed,
duplex,
autoneg,
NX_CDRP_CMD_CONFIG_GBE_PORT);
}
static int static int
nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
{ {
......
...@@ -214,7 +214,6 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -214,7 +214,6 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
check_sfp_module = netif_running(dev) && check_sfp_module = netif_running(dev) &&
adapter->has_link_events; adapter->has_link_events;
} else { } else {
ecmd->autoneg = AUTONEG_ENABLE;
ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg); ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg);
ecmd->advertising |= ecmd->advertising |=
(ADVERTISED_TP | ADVERTISED_Autoneg); (ADVERTISED_TP | ADVERTISED_Autoneg);
...@@ -252,53 +251,24 @@ static int ...@@ -252,53 +251,24 @@ static int
netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{ {
struct netxen_adapter *adapter = netdev_priv(dev); struct netxen_adapter *adapter = netdev_priv(dev);
__u32 status; int ret;
/* read which mode */ if (adapter->ahw.port_type != NETXEN_NIC_GBE)
if (adapter->ahw.port_type == NETXEN_NIC_GBE) { return -EOPNOTSUPP;
/* autonegotiation */
if (adapter->phy_write &&
adapter->phy_write(adapter,
NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
ecmd->autoneg) != 0)
return -EIO;
else
adapter->link_autoneg = ecmd->autoneg;
if (adapter->phy_read && if (!(adapter->capabilities & NX_FW_CAPABILITY_GBE_LINK_CFG))
adapter->phy_read(adapter, return -EOPNOTSUPP;
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
&status) != 0)
return -EIO;
/* speed */ ret = nx_fw_cmd_set_gbe_port(adapter, ecmd->speed, ecmd->duplex,
switch (ecmd->speed) { ecmd->autoneg);
case SPEED_10: if (ret == NX_RCODE_NOT_SUPPORTED)
netxen_set_phy_speed(status, 0); return -EOPNOTSUPP;
break; else if (ret)
case SPEED_100:
netxen_set_phy_speed(status, 1);
break;
case SPEED_1000:
netxen_set_phy_speed(status, 2);
break;
}
/* set duplex mode */
if (ecmd->duplex == DUPLEX_HALF)
netxen_clear_phy_duplex(status);
if (ecmd->duplex == DUPLEX_FULL)
netxen_set_phy_duplex(status);
if (adapter->phy_write &&
adapter->phy_write(adapter,
NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
*((int *)&status)) != 0)
return -EIO; return -EIO;
else {
adapter->link_speed = ecmd->speed; adapter->link_speed = ecmd->speed;
adapter->link_duplex = ecmd->duplex; adapter->link_duplex = ecmd->duplex;
} adapter->link_autoneg = ecmd->autoneg;
} else
return -EOPNOTSUPP;
if (!netif_running(dev)) if (!netif_running(dev))
return 0; return 0;
......
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