Files
@ 1efda0e3054b
Branch filter:
Location: vmkdrivers/vmkdrivers/src_9/drivers/net/nx_nic/unm_nic_isr.c
1efda0e3054b
5.5 KiB
text/x-csrc
ESXi-5.0-U2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | /*
* Copyright (C) 2003 - 2007 NetXen, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.
*
* Contact Information:
* licensing@netxen.com
* NetXen, Inc.
* 3965 Freedom Circle, Fourth floor,
* Santa Clara, CA 95054
*/
#include <linux/netdevice.h>
#include <linux/delay.h>
#include "queue.h"
#include "unm_nic.h"
#include "unm_nic_hw.h"
#include "nic_cmn.h"
#include "nic_phan_reg.h"
long
unm_nic_enable_phy_interrupts (unm_adapter *adapter)
{
switch (adapter->ahw.board_type) {
case UNM_NIC_GBE:
return unm_niu_gbe_enable_phy_interrupts (adapter);
case UNM_NIC_XGBE:
return unm_niu_xg_enable_phy_interrupts (adapter);
default:
printk(KERN_ERR"%s: Unknown board type\n", unm_nic_driver_name);
return -1;
}
}
long
unm_nic_disable_phy_interrupts (unm_adapter *adapter)
{
switch (adapter->ahw.board_type) {
case UNM_NIC_GBE:
return unm_niu_gbe_disable_phy_interrupts (adapter);
case UNM_NIC_XGBE:
return unm_niu_xg_disable_phy_interrupts (adapter);
default:
printk(KERN_ERR"%s: Unknown board type\n", unm_nic_driver_name);
return -1;
}
}
long
unm_nic_clear_phy_interrupts (unm_adapter *adapter)
{
switch (adapter->ahw.board_type) {
case UNM_NIC_GBE:
return unm_niu_gbe_clear_phy_interrupts (adapter);
case UNM_NIC_XGBE:
return unm_niu_xg_disable_phy_interrupts (adapter);
default:
printk(KERN_ERR"%s: Unknown board type\n", unm_nic_driver_name);
return -1;
}
}
void
unm_indicate_link_status(unm_adapter *adapter, u32 link)
{
struct net_device *netdev = adapter->netdev;
if(link) {
if (netdev->flags & IFF_UP) {
netif_carrier_on(netdev);
netif_wake_queue(netdev);
}
} else {
netif_carrier_off(netdev);
netif_stop_queue(netdev);
}
}
void
unm_nic_isr_other(struct unm_adapter_s *adapter)
{
u32 portno = adapter->portnum;
u32 val, linkup, qg_linksup = adapter->ahw.linkup;
read_lock(&adapter->adapter_lock);
adapter->unm_nic_hw_read_wx(adapter, CRB_XG_STATE, &val, 4);
read_unlock(&adapter->adapter_lock);
linkup = 1 & (val >> adapter->physical_port);
adapter->ahw.linkup = linkup;
if (linkup != qg_linksup) {
printk(KERN_INFO "%s: PORT %d link %s\n", unm_nic_driver_name,
portno, ((linkup == 0) ? "down" : "up"));
unm_indicate_link_status(adapter, linkup);
if (linkup) {
unm_nic_set_link_parameters(adapter);
}
}
//adapter->stats.otherints++;
}
/*
* return 1 if link is ok, 0 otherwise
*/
int
unm_link_ok(struct unm_adapter_s *adapter)
{
switch (adapter->ahw.board_type) {
case UNM_NIC_GBE:
case UNM_NIC_XGBE:
return (adapter->ahw.linkup);
default:
printk(KERN_ERR"%s: Function: %s, Unknown board type\n",
unm_nic_driver_name, __FUNCTION__);
break;
}
return 0;
}
void
unm_nic_handle_phy_intr(struct unm_adapter_s *adapter)
{
uint32_t val, val1, linkupval;
struct net_device *netdev;
switch (adapter->ahw.board_type) {
case UNM_NIC_GBE:
if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
unm_nic_isr_other(adapter);
break;
}
/* Fall through for processing */
case UNM_NIC_XGBE:
/* WINDOW = 1 */
//unm_nic_read_crb_w1(adapter, CRB_XG_STATE, &val1);
read_lock(&adapter->adapter_lock);
if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
adapter->unm_nic_hw_read_wx(adapter, CRB_XG_STATE_P3,
&val, 4);
val1 = XG_LINK_STATE_P3(adapter->ahw.pci_func,val);
linkupval = XG_LINK_UP_P3;
} else {
adapter->unm_nic_hw_read_wx(adapter, CRB_XG_STATE,
&val, 4);
val >>= (adapter->portnum * 8);
val1 = val & 0xff;
linkupval = XG_LINK_UP;
}
read_unlock(&adapter->adapter_lock);
netdev = adapter->netdev;
if (adapter->ahw.linkup && (val1 != linkupval)) {
printk(KERN_ERR"%s: %s NIC Link is down\n",
unm_nic_driver_name, netdev->name);
unm_indicate_link_status(adapter, 0);
adapter->ahw.linkup = 0;
} else if (!adapter->ahw.linkup && (val1 == linkupval)) {
printk(KERN_ERR"%s: %s NIC Link is up\n",
unm_nic_driver_name, netdev->name);
unm_indicate_link_status(adapter, 1);
adapter->ahw.linkup = 1;
}
if (adapter->ahw.board_type == UNM_NIC_GBE &&
adapter->ahw.linkup) {
unm_nic_set_link_parameters(adapter);
}
break;
default:
printk(KERN_ERR"%s ISR: Unknown board type\n",
unm_nic_driver_name);
}
return;
}
|