Skip to content

Commit

Permalink
be2net: fix ethtool get settings
Browse files Browse the repository at this point in the history
ethtool get settings was not displaying all the settings correctly.
use the get_phy_info to get more information about the PHY to fix this.

Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ajit Khaparde authored and David S. Miller committed Apr 23, 2012
1 parent ac807fa commit 42f11cf
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 102 deletions.
23 changes: 19 additions & 4 deletions drivers/net/ethernet/emulex/benet/be.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,23 @@ struct be_vf_cfg {
#define BE_UC_PMAC_COUNT 30
#define BE_VF_UC_PMAC_COUNT 2

struct phy_info {
u8 transceiver;
u8 autoneg;
u8 fc_autoneg;
u8 port_type;
u16 phy_type;
u16 interface_type;
u32 misc_params;
u16 auto_speeds_supported;
u16 fixed_speeds_supported;
int link_speed;
int forced_port_speed;
u32 dac_cable_len;
u32 advertising;
u32 supported;
};

struct be_adapter {
struct pci_dev *pdev;
struct net_device *netdev;
Expand Down Expand Up @@ -377,10 +394,6 @@ struct be_adapter {
u32 rx_fc; /* Rx flow control */
u32 tx_fc; /* Tx flow control */
bool stats_cmd_sent;
int link_speed;
u8 port_type;
u8 transceiver;
u8 autoneg;
u8 generation; /* BladeEngine ASIC generation */
u32 flash_status;
struct completion flash_compl;
Expand All @@ -392,6 +405,7 @@ struct be_adapter {
u32 sli_family;
u8 hba_port_num;
u16 pvid;
struct phy_info phy;
u8 wol_cap;
bool wol;
u32 max_pmac_cnt; /* Max secondary UC MACs programmable */
Expand Down Expand Up @@ -583,4 +597,5 @@ extern void be_link_status_update(struct be_adapter *adapter, u8 link_status);
extern void be_parse_stats(struct be_adapter *adapter);
extern int be_load_fw(struct be_adapter *adapter, u8 *func);
extern bool be_is_wol_supported(struct be_adapter *adapter);
extern bool be_pause_supported(struct be_adapter *adapter);
#endif /* BE_H */
17 changes: 11 additions & 6 deletions drivers/net/ethernet/emulex/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static void be_async_link_state_process(struct be_adapter *adapter,
struct be_async_event_link_state *evt)
{
/* When link status changes, link speed must be re-queried from FW */
adapter->link_speed = -1;
adapter->phy.link_speed = -1;

/* For the initial link status do not rely on the ASYNC event as
* it may not be received in some cases.
Expand All @@ -153,7 +153,7 @@ static void be_async_grp5_qos_speed_process(struct be_adapter *adapter,
{
if (evt->physical_port == adapter->port_num) {
/* qos_link_speed is in units of 10 Mbps */
adapter->link_speed = evt->qos_link_speed * 10;
adapter->phy.link_speed = evt->qos_link_speed * 10;
}
}

Expand Down Expand Up @@ -2136,8 +2136,7 @@ int be_cmd_get_seeprom_data(struct be_adapter *adapter,
return status;
}

int be_cmd_get_phy_info(struct be_adapter *adapter,
struct be_phy_info *phy_info)
int be_cmd_get_phy_info(struct be_adapter *adapter)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_get_phy_info *req;
Expand Down Expand Up @@ -2170,9 +2169,15 @@ int be_cmd_get_phy_info(struct be_adapter *adapter,
if (!status) {
struct be_phy_info *resp_phy_info =
cmd.va + sizeof(struct be_cmd_req_hdr);
phy_info->phy_type = le16_to_cpu(resp_phy_info->phy_type);
phy_info->interface_type =
adapter->phy.phy_type = le16_to_cpu(resp_phy_info->phy_type);
adapter->phy.interface_type =
le16_to_cpu(resp_phy_info->interface_type);
adapter->phy.auto_speeds_supported =
le16_to_cpu(resp_phy_info->auto_speeds_supported);
adapter->phy.fixed_speeds_supported =
le16_to_cpu(resp_phy_info->fixed_speeds_supported);
adapter->phy.misc_params =
le32_to_cpu(resp_phy_info->misc_params);
}
pci_free_consistent(adapter->pdev, cmd.size,
cmd.va, cmd.dma);
Expand Down
36 changes: 33 additions & 3 deletions drivers/net/ethernet/emulex/benet/be_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -1309,9 +1309,36 @@ enum {
PHY_TYPE_KX4_10GB,
PHY_TYPE_BASET_10GB,
PHY_TYPE_BASET_1GB,
PHY_TYPE_BASEX_1GB,
PHY_TYPE_SGMII,
PHY_TYPE_DISABLED = 255
};

#define BE_SUPPORTED_SPEED_NONE 0
#define BE_SUPPORTED_SPEED_10MBPS 1
#define BE_SUPPORTED_SPEED_100MBPS 2
#define BE_SUPPORTED_SPEED_1GBPS 4
#define BE_SUPPORTED_SPEED_10GBPS 8

#define BE_AN_EN 0x2
#define BE_PAUSE_SYM_EN 0x80

/* MAC speed valid values */
#define SPEED_DEFAULT 0x0
#define SPEED_FORCED_10GB 0x1
#define SPEED_FORCED_1GB 0x2
#define SPEED_AUTONEG_10GB 0x3
#define SPEED_AUTONEG_1GB 0x4
#define SPEED_AUTONEG_100MB 0x5
#define SPEED_AUTONEG_10GB_1GB 0x6
#define SPEED_AUTONEG_10GB_1GB_100MB 0x7
#define SPEED_AUTONEG_1GB_100MB 0x8
#define SPEED_AUTONEG_10MB 0x9
#define SPEED_AUTONEG_1GB_100MB_10MB 0xa
#define SPEED_AUTONEG_100MB_10MB 0xb
#define SPEED_FORCED_100MB 0xc
#define SPEED_FORCED_10MB 0xd

struct be_cmd_req_get_phy_info {
struct be_cmd_req_hdr hdr;
u8 rsvd0[24];
Expand All @@ -1321,7 +1348,11 @@ struct be_phy_info {
u16 phy_type;
u16 interface_type;
u32 misc_params;
u32 future_use[4];
u16 ext_phy_details;
u16 rsvd;
u16 auto_speeds_supported;
u16 fixed_speeds_supported;
u32 future_use[2];
};

struct be_cmd_resp_get_phy_info {
Expand Down Expand Up @@ -1655,8 +1686,7 @@ extern int be_cmd_get_seeprom_data(struct be_adapter *adapter,
struct be_dma_mem *nonemb_cmd);
extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
u8 loopback_type, u8 enable);
extern int be_cmd_get_phy_info(struct be_adapter *adapter,
struct be_phy_info *phy_info);
extern int be_cmd_get_phy_info(struct be_adapter *adapter);
extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
extern void be_detect_dump_ue(struct be_adapter *adapter);
extern int be_cmd_get_die_temperature(struct be_adapter *adapter);
Expand Down
Loading

0 comments on commit 42f11cf

Please sign in to comment.