Commit ea172a01 authored by Sathya Perla's avatar Sathya Perla Committed by David S. Miller

be2net: no need to query link status

Change in the link status generates an MCC event. This is processed and
netif_carrier_on/off is called accordingly. Don't need to query/store the
link_status state.
Signed-off-by: default avatarSathya Perla <sathya.perla@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d09f6980
...@@ -521,7 +521,7 @@ static inline bool be_multi_rxq(const struct be_adapter *adapter) ...@@ -521,7 +521,7 @@ static inline bool be_multi_rxq(const struct be_adapter *adapter)
extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
u16 num_popped); u16 num_popped);
extern void be_link_status_update(struct be_adapter *adapter, bool link_up); extern void be_link_status_update(struct be_adapter *adapter, u32 link_status);
extern void be_parse_stats(struct be_adapter *adapter); extern void be_parse_stats(struct be_adapter *adapter);
extern int be_load_fw(struct be_adapter *adapter, u8 *func); extern int be_load_fw(struct be_adapter *adapter, u8 *func);
#endif /* BE_H */ #endif /* BE_H */
...@@ -110,8 +110,7 @@ static int be_mcc_compl_process(struct be_adapter *adapter, ...@@ -110,8 +110,7 @@ static int be_mcc_compl_process(struct be_adapter *adapter,
static void be_async_link_state_process(struct be_adapter *adapter, static void be_async_link_state_process(struct be_adapter *adapter,
struct be_async_event_link_state *evt) struct be_async_event_link_state *evt)
{ {
be_link_status_update(adapter, be_link_status_update(adapter, evt->port_link_status);
evt->port_link_status == ASYNC_EVENT_LINK_UP);
} }
/* Grp5 CoS Priority evt */ /* Grp5 CoS Priority evt */
...@@ -1261,8 +1260,8 @@ int lancer_cmd_get_pport_stats(struct be_adapter *adapter, ...@@ -1261,8 +1260,8 @@ int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
} }
/* Uses synchronous mcc */ /* Uses synchronous mcc */
int be_cmd_link_status_query(struct be_adapter *adapter, int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed,
bool *link_up, u8 *mac_speed, u16 *link_speed, u32 dom) u16 *link_speed, u32 dom)
{ {
struct be_mcc_wrb *wrb; struct be_mcc_wrb *wrb;
struct be_cmd_req_link_status *req; struct be_cmd_req_link_status *req;
...@@ -1277,8 +1276,6 @@ int be_cmd_link_status_query(struct be_adapter *adapter, ...@@ -1277,8 +1276,6 @@ int be_cmd_link_status_query(struct be_adapter *adapter,
} }
req = embedded_payload(wrb); req = embedded_payload(wrb);
*link_up = false;
be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0, be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0,
OPCODE_COMMON_NTWK_LINK_STATUS_QUERY); OPCODE_COMMON_NTWK_LINK_STATUS_QUERY);
...@@ -1289,7 +1286,6 @@ int be_cmd_link_status_query(struct be_adapter *adapter, ...@@ -1289,7 +1286,6 @@ int be_cmd_link_status_query(struct be_adapter *adapter,
if (!status) { if (!status) {
struct be_cmd_resp_link_status *resp = embedded_payload(wrb); struct be_cmd_resp_link_status *resp = embedded_payload(wrb);
if (resp->mac_speed != PHY_LINK_SPEED_ZERO) { if (resp->mac_speed != PHY_LINK_SPEED_ZERO) {
*link_up = true;
*link_speed = le16_to_cpu(resp->link_speed); *link_speed = le16_to_cpu(resp->link_speed);
*mac_speed = resp->mac_speed; *mac_speed = resp->mac_speed;
} }
......
...@@ -89,9 +89,10 @@ struct be_async_event_trailer { ...@@ -89,9 +89,10 @@ struct be_async_event_trailer {
}; };
enum { enum {
ASYNC_EVENT_LINK_DOWN = 0x0, LINK_DOWN = 0x0,
ASYNC_EVENT_LINK_UP = 0x1 LINK_UP = 0x1
}; };
#define LINK_STATUS_MASK 0x1
/* When the event code of an async trailer is link-state, the mcc_compl /* When the event code of an async trailer is link-state, the mcc_compl
* must be interpreted as follows * must be interpreted as follows
...@@ -1442,7 +1443,7 @@ extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q, ...@@ -1442,7 +1443,7 @@ extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
extern int be_cmd_rxq_destroy(struct be_adapter *adapter, extern int be_cmd_rxq_destroy(struct be_adapter *adapter,
struct be_queue_info *q); struct be_queue_info *q);
extern int be_cmd_link_status_query(struct be_adapter *adapter, extern int be_cmd_link_status_query(struct be_adapter *adapter,
bool *link_up, u8 *mac_speed, u16 *link_speed, u32 dom); u8 *mac_speed, u16 *link_speed, u32 dom);
extern int be_cmd_reset(struct be_adapter *adapter); extern int be_cmd_reset(struct be_adapter *adapter);
extern int be_cmd_get_stats(struct be_adapter *adapter, extern int be_cmd_get_stats(struct be_adapter *adapter,
struct be_dma_mem *nonemb_cmd); struct be_dma_mem *nonemb_cmd);
......
...@@ -353,15 +353,13 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -353,15 +353,13 @@ static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
struct be_cmd_resp_get_phy_info *resp; struct be_cmd_resp_get_phy_info *resp;
u8 mac_speed = 0; u8 mac_speed = 0;
u16 link_speed = 0; u16 link_speed = 0;
bool link_up = false;
int status; int status;
u16 intf_type; u16 intf_type;
if ((adapter->link_speed < 0) || (!(netdev->flags & IFF_UP))) { if ((adapter->link_speed < 0) || (!(netdev->flags & IFF_UP))) {
status = be_cmd_link_status_query(adapter, &link_up, status = be_cmd_link_status_query(adapter, &mac_speed,
&mac_speed, &link_speed, 0); &link_speed, 0);
be_link_status_update(adapter, link_up);
/* link_speed is in units of 10 Mbps */ /* link_speed is in units of 10 Mbps */
if (link_speed) { if (link_speed) {
ethtool_cmd_speed_set(ecmd, link_speed*10); ethtool_cmd_speed_set(ecmd, link_speed*10);
...@@ -617,7 +615,6 @@ static void ...@@ -617,7 +615,6 @@ static void
be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
bool link_up;
u8 mac_speed = 0; u8 mac_speed = 0;
u16 qos_link_speed = 0; u16 qos_link_speed = 0;
...@@ -643,7 +640,7 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) ...@@ -643,7 +640,7 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
test->flags |= ETH_TEST_FL_FAILED; test->flags |= ETH_TEST_FL_FAILED;
} }
if (be_cmd_link_status_query(adapter, &link_up, &mac_speed, if (be_cmd_link_status_query(adapter, &mac_speed,
&qos_link_speed, 0) != 0) { &qos_link_speed, 0) != 0) {
test->flags |= ETH_TEST_FL_FAILED; test->flags |= ETH_TEST_FL_FAILED;
data[4] = -1; data[4] = -1;
......
...@@ -462,21 +462,18 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev, ...@@ -462,21 +462,18 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
return stats; return stats;
} }
void be_link_status_update(struct be_adapter *adapter, bool link_up) void be_link_status_update(struct be_adapter *adapter, u32 link_status)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
/* If link came up or went down */ /* when link status changes, link speed must be re-queried from card */
if (adapter->link_up != link_up) {
adapter->link_speed = -1; adapter->link_speed = -1;
if (link_up) { if ((link_status & LINK_STATUS_MASK) == LINK_UP) {
netif_carrier_on(netdev); netif_carrier_on(netdev);
printk(KERN_INFO "%s: Link up\n", netdev->name); dev_info(&adapter->pdev->dev, "%s: Link up\n", netdev->name);
} else { } else {
netif_carrier_off(netdev); netif_carrier_off(netdev);
printk(KERN_INFO "%s: Link down\n", netdev->name); dev_info(&adapter->pdev->dev, "%s: Link down\n", netdev->name);
}
adapter->link_up = link_up;
} }
} }
...@@ -2217,8 +2214,6 @@ static int be_close(struct net_device *netdev) ...@@ -2217,8 +2214,6 @@ static int be_close(struct net_device *netdev)
be_async_mcc_disable(adapter); be_async_mcc_disable(adapter);
adapter->link_up = false;
if (!lancer_chip(adapter)) if (!lancer_chip(adapter))
be_intr_set(adapter, false); be_intr_set(adapter, false);
...@@ -2296,10 +2291,7 @@ static int be_open(struct net_device *netdev) ...@@ -2296,10 +2291,7 @@ static int be_open(struct net_device *netdev)
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
struct be_eq_obj *tx_eq = &adapter->tx_eq; struct be_eq_obj *tx_eq = &adapter->tx_eq;
struct be_rx_obj *rxo; struct be_rx_obj *rxo;
bool link_up;
int status, i; int status, i;
u8 mac_speed;
u16 link_speed;
status = be_rx_queues_setup(adapter); status = be_rx_queues_setup(adapter);
if (status) if (status)
...@@ -2322,12 +2314,6 @@ static int be_open(struct net_device *netdev) ...@@ -2322,12 +2314,6 @@ static int be_open(struct net_device *netdev)
/* Now that interrupts are on we can process async mcc */ /* Now that interrupts are on we can process async mcc */
be_async_mcc_enable(adapter); be_async_mcc_enable(adapter);
status = be_cmd_link_status_query(adapter, &link_up, &mac_speed,
&link_speed, 0);
if (status)
goto err;
be_link_status_update(adapter, link_up);
if (be_physfn(adapter)) { if (be_physfn(adapter)) {
status = be_vid_config(adapter, false, 0); status = be_vid_config(adapter, false, 0);
if (status) if (status)
...@@ -3347,7 +3333,6 @@ static int __devinit be_probe(struct pci_dev *pdev, ...@@ -3347,7 +3333,6 @@ static int __devinit be_probe(struct pci_dev *pdev,
if (be_physfn(adapter) && adapter->sriov_enabled) { if (be_physfn(adapter) && adapter->sriov_enabled) {
u8 mac_speed; u8 mac_speed;
bool link_up;
u16 vf, lnk_speed; u16 vf, lnk_speed;
if (!lancer_chip(adapter)) { if (!lancer_chip(adapter)) {
...@@ -3357,8 +3342,8 @@ static int __devinit be_probe(struct pci_dev *pdev, ...@@ -3357,8 +3342,8 @@ static int __devinit be_probe(struct pci_dev *pdev,
} }
for (vf = 0; vf < num_vfs; vf++) { for (vf = 0; vf < num_vfs; vf++) {
status = be_cmd_link_status_query(adapter, &link_up, status = be_cmd_link_status_query(adapter, &mac_speed,
&mac_speed, &lnk_speed, vf + 1); &lnk_speed, vf + 1);
if (!status) if (!status)
adapter->vf_cfg[vf].vf_tx_rate = lnk_speed * 10; adapter->vf_cfg[vf].vf_tx_rate = lnk_speed * 10;
else else
......
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