Skip to content

Commit

Permalink
qlcnic: Fix loopback diagnostic test
Browse files Browse the repository at this point in the history
o Adapter requires that if the port is in loopback mode no traffic should
  be flowing through that port, so on arrival of Link up AEN, do not advertise
  Link up to the stack until port is out of loopback mode

Signed-off-by: Manish Chopra <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Manish Chopra authored and davem330 committed Jan 2, 2014
1 parent c3ac17c commit d9c602f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ struct qlcnic_hardware_context {
struct qlcnic_mailbox *mailbox;
u8 extend_lb_time;
u8 phys_port_id[ETH_ALEN];
u8 lb_mode;
};

struct qlcnic_adapter_stats {
Expand Down Expand Up @@ -808,6 +809,7 @@ struct qlcnic_mac_list_s {

#define QLCNIC_ILB_MODE 0x1
#define QLCNIC_ELB_MODE 0x2
#define QLCNIC_LB_MODE_MASK 0x3

#define QLCNIC_LINKEVENT 0x1
#define QLCNIC_LB_RESPONSE 0x2
Expand Down
7 changes: 1 addition & 6 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,12 +1684,6 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode)
}
} while ((adapter->ahw->linkup && ahw->has_link_events) != 1);

/* Make sure carrier is off and queue is stopped during loopback */
if (netif_running(netdev)) {
netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev);
}

ret = qlcnic_do_lb_test(adapter, mode);

qlcnic_83xx_clear_lb_mode(adapter, mode);
Expand Down Expand Up @@ -2121,6 +2115,7 @@ static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter,
ahw->link_autoneg = MSB(MSW(data[3]));
ahw->module_type = MSB(LSW(data[3]));
ahw->has_link_events = 1;
ahw->lb_mode = data[4] & QLCNIC_LB_MODE_MASK;
qlcnic_advert_link_change(adapter, link_status);
}

Expand Down
4 changes: 4 additions & 0 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,10 @@ void qlcnic_advert_link_change(struct qlcnic_adapter *adapter, int linkup)
adapter->ahw->linkup = 0;
netif_carrier_off(netdev);
} else if (!adapter->ahw->linkup && linkup) {
/* Do not advertise Link up if the port is in loopback mode */
if (qlcnic_83xx_check(adapter) && adapter->ahw->lb_mode)
return;

netdev_info(netdev, "NIC Link is up\n");
adapter->ahw->linkup = 1;
netif_carrier_on(netdev);
Expand Down

0 comments on commit d9c602f

Please sign in to comment.