summaryrefslogtreecommitdiff
path: root/drivers/net/benet/be_main.c
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@emulex.com>2011-08-02 23:57:42 +0400
committerDavid S. Miller <davem@davemloft.net>2011-08-03 14:23:29 +0400
commitea172a011d1435d9bd167265bf51cc64d026b4e7 (patch)
tree66b4988065a7f51973a9705a4321beed701c6374 /drivers/net/benet/be_main.c
parentd09f698056a33c8b078497fb23e3304b6f8a908f (diff)
downloadlinux-ea172a011d1435d9bd167265bf51cc64d026b4e7.tar.xz
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: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_main.c')
-rw-r--r--drivers/net/benet/be_main.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 553cc0dc6c91..3b2c5e6cb866 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -462,21 +462,18 @@ static struct rtnl_link_stats64 *be_get_stats64(struct net_device *netdev,
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;
- /* If link came up or went down */
- if (adapter->link_up != link_up) {
- adapter->link_speed = -1;
- if (link_up) {
- netif_carrier_on(netdev);
- printk(KERN_INFO "%s: Link up\n", netdev->name);
- } else {
- netif_carrier_off(netdev);
- printk(KERN_INFO "%s: Link down\n", netdev->name);
- }
- adapter->link_up = link_up;
+ /* when link status changes, link speed must be re-queried from card */
+ adapter->link_speed = -1;
+ if ((link_status & LINK_STATUS_MASK) == LINK_UP) {
+ netif_carrier_on(netdev);
+ dev_info(&adapter->pdev->dev, "%s: Link up\n", netdev->name);
+ } else {
+ netif_carrier_off(netdev);
+ dev_info(&adapter->pdev->dev, "%s: Link down\n", netdev->name);
}
}
@@ -2217,8 +2214,6 @@ static int be_close(struct net_device *netdev)
be_async_mcc_disable(adapter);
- adapter->link_up = false;
-
if (!lancer_chip(adapter))
be_intr_set(adapter, false);
@@ -2296,10 +2291,7 @@ static int be_open(struct net_device *netdev)
struct be_adapter *adapter = netdev_priv(netdev);
struct be_eq_obj *tx_eq = &adapter->tx_eq;
struct be_rx_obj *rxo;
- bool link_up;
int status, i;
- u8 mac_speed;
- u16 link_speed;
status = be_rx_queues_setup(adapter);
if (status)
@@ -2322,12 +2314,6 @@ static int be_open(struct net_device *netdev)
/* Now that interrupts are on we can process async mcc */
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)) {
status = be_vid_config(adapter, false, 0);
if (status)
@@ -3347,7 +3333,6 @@ static int __devinit be_probe(struct pci_dev *pdev,
if (be_physfn(adapter) && adapter->sriov_enabled) {
u8 mac_speed;
- bool link_up;
u16 vf, lnk_speed;
if (!lancer_chip(adapter)) {
@@ -3357,8 +3342,8 @@ static int __devinit be_probe(struct pci_dev *pdev,
}
for (vf = 0; vf < num_vfs; vf++) {
- status = be_cmd_link_status_query(adapter, &link_up,
- &mac_speed, &lnk_speed, vf + 1);
+ status = be_cmd_link_status_query(adapter, &mac_speed,
+ &lnk_speed, vf + 1);
if (!status)
adapter->vf_cfg[vf].vf_tx_rate = lnk_speed * 10;
else