aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c97
1 files changed, 63 insertions, 34 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index aa6e603bfcbf..821cff68b3f3 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -503,17 +503,15 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
503 503
504 i = 0; 504 i = 0;
505 505
506 netif_tx_lock_bh(adapter->netdev);
507
506 producer = adapter->cmd_producer; 508 producer = adapter->cmd_producer;
507 do { 509 do {
508 cmd_desc = &cmd_desc_arr[i]; 510 cmd_desc = &cmd_desc_arr[i];
509 511
510 pbuf = &adapter->cmd_buf_arr[producer]; 512 pbuf = &adapter->cmd_buf_arr[producer];
511 pbuf->mss = 0;
512 pbuf->total_length = 0;
513 pbuf->skb = NULL; 513 pbuf->skb = NULL;
514 pbuf->cmd = 0;
515 pbuf->frag_count = 0; 514 pbuf->frag_count = 0;
516 pbuf->port = 0;
517 515
518 /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ 516 /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */
519 memcpy(&adapter->ahw.cmd_desc_head[producer], 517 memcpy(&adapter->ahw.cmd_desc_head[producer],
@@ -531,6 +529,8 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
531 529
532 netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); 530 netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer);
533 531
532 netif_tx_unlock_bh(adapter->netdev);
533
534 return 0; 534 return 0;
535} 535}
536 536
@@ -539,16 +539,19 @@ static int nx_p3_sre_macaddr_change(struct net_device *dev,
539{ 539{
540 struct netxen_adapter *adapter = netdev_priv(dev); 540 struct netxen_adapter *adapter = netdev_priv(dev);
541 nx_nic_req_t req; 541 nx_nic_req_t req;
542 nx_mac_req_t mac_req; 542 nx_mac_req_t *mac_req;
543 u64 word;
543 int rv; 544 int rv;
544 545
545 memset(&req, 0, sizeof(nx_nic_req_t)); 546 memset(&req, 0, sizeof(nx_nic_req_t));
546 req.qhdr |= (NX_NIC_REQUEST << 23); 547 req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23);
547 req.req_hdr |= NX_MAC_EVENT; 548
548 req.req_hdr |= ((u64)adapter->portnum << 16); 549 word = NX_MAC_EVENT | ((u64)adapter->portnum << 16);
549 mac_req.op = op; 550 req.req_hdr = cpu_to_le64(word);
550 memcpy(&mac_req.mac_addr, addr, 6); 551
551 req.words[0] = cpu_to_le64(*(u64 *)&mac_req); 552 mac_req = (nx_mac_req_t *)&req.words[0];
553 mac_req->op = op;
554 memcpy(mac_req->mac_addr, addr, 6);
552 555
553 rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); 556 rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
554 if (rv != 0) { 557 if (rv != 0) {
@@ -612,18 +615,35 @@ send_fw_cmd:
612int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) 615int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
613{ 616{
614 nx_nic_req_t req; 617 nx_nic_req_t req;
618 u64 word;
615 619
616 memset(&req, 0, sizeof(nx_nic_req_t)); 620 memset(&req, 0, sizeof(nx_nic_req_t));
617 621
618 req.qhdr |= (NX_HOST_REQUEST << 23); 622 req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23);
619 req.req_hdr |= NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE; 623
620 req.req_hdr |= ((u64)adapter->portnum << 16); 624 word = NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE |
625 ((u64)adapter->portnum << 16);
626 req.req_hdr = cpu_to_le64(word);
627
621 req.words[0] = cpu_to_le64(mode); 628 req.words[0] = cpu_to_le64(mode);
622 629
623 return netxen_send_cmd_descs(adapter, 630 return netxen_send_cmd_descs(adapter,
624 (struct cmd_desc_type0 *)&req, 1); 631 (struct cmd_desc_type0 *)&req, 1);
625} 632}
626 633
634void netxen_p3_free_mac_list(struct netxen_adapter *adapter)
635{
636 nx_mac_list_t *cur, *next;
637
638 cur = adapter->mac_list;
639
640 while (cur) {
641 next = cur->next;
642 kfree(cur);
643 cur = next;
644 }
645}
646
627#define NETXEN_CONFIG_INTR_COALESCE 3 647#define NETXEN_CONFIG_INTR_COALESCE 3
628 648
629/* 649/*
@@ -632,13 +652,15 @@ int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode)
632int netxen_config_intr_coalesce(struct netxen_adapter *adapter) 652int netxen_config_intr_coalesce(struct netxen_adapter *adapter)
633{ 653{
634 nx_nic_req_t req; 654 nx_nic_req_t req;
655 u64 word;
635 int rv; 656 int rv;
636 657
637 memset(&req, 0, sizeof(nx_nic_req_t)); 658 memset(&req, 0, sizeof(nx_nic_req_t));
638 659
639 req.qhdr |= (NX_NIC_REQUEST << 23); 660 req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23);
640 req.req_hdr |= NETXEN_CONFIG_INTR_COALESCE; 661
641 req.req_hdr |= ((u64)adapter->portnum << 16); 662 word = NETXEN_CONFIG_INTR_COALESCE | ((u64)adapter->portnum << 16);
663 req.req_hdr = cpu_to_le64(word);
642 664
643 memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); 665 memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal));
644 666
@@ -772,13 +794,10 @@ int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac)
772 adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); 794 adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4);
773 adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); 795 adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4);
774 796
775 mac_hi = cpu_to_le32(mac_hi);
776 mac_lo = cpu_to_le32(mac_lo);
777
778 if (pci_func & 1) 797 if (pci_func & 1)
779 *mac = ((mac_lo >> 16) | ((u64)mac_hi << 16)); 798 *mac = le64_to_cpu((mac_lo >> 16) | ((u64)mac_hi << 16));
780 else 799 else
781 *mac = ((mac_lo) | ((u64)mac_hi << 32)); 800 *mac = le64_to_cpu((u64)mac_lo | ((u64)mac_hi << 32));
782 801
783 return 0; 802 return 0;
784} 803}
@@ -937,7 +956,7 @@ int netxen_load_firmware(struct netxen_adapter *adapter)
937{ 956{
938 int i; 957 int i;
939 u32 data, size = 0; 958 u32 data, size = 0;
940 u32 flashaddr = NETXEN_BOOTLD_START, memaddr = NETXEN_BOOTLD_START; 959 u32 flashaddr = NETXEN_BOOTLD_START;
941 960
942 size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; 961 size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4;
943 962
@@ -949,10 +968,8 @@ int netxen_load_firmware(struct netxen_adapter *adapter)
949 if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) 968 if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0)
950 return -EIO; 969 return -EIO;
951 970
952 adapter->pci_mem_write(adapter, memaddr, &data, 4); 971 adapter->pci_mem_write(adapter, flashaddr, &data, 4);
953 flashaddr += 4; 972 flashaddr += 4;
954 memaddr += 4;
955 cond_resched();
956 } 973 }
957 msleep(1); 974 msleep(1);
958 975
@@ -2034,7 +2051,13 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2034 rv = -1; 2051 rv = -1;
2035 } 2052 }
2036 2053
2037 DPRINTK(INFO, "Discovered board type:0x%x ", boardinfo->board_type); 2054 if (boardinfo->board_type == NETXEN_BRDTYPE_P3_4_GB_MM) {
2055 u32 gpio = netxen_nic_reg_read(adapter,
2056 NETXEN_ROMUSB_GLB_PAD_GPIO_I);
2057 if ((gpio & 0x8000) == 0)
2058 boardinfo->board_type = NETXEN_BRDTYPE_P3_10G_TP;
2059 }
2060
2038 switch ((netxen_brdtype_t) boardinfo->board_type) { 2061 switch ((netxen_brdtype_t) boardinfo->board_type) {
2039 case NETXEN_BRDTYPE_P2_SB35_4G: 2062 case NETXEN_BRDTYPE_P2_SB35_4G:
2040 adapter->ahw.board_type = NETXEN_NIC_GBE; 2063 adapter->ahw.board_type = NETXEN_NIC_GBE;
@@ -2053,7 +2076,6 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2053 case NETXEN_BRDTYPE_P3_10G_SFP_QT: 2076 case NETXEN_BRDTYPE_P3_10G_SFP_QT:
2054 case NETXEN_BRDTYPE_P3_10G_XFP: 2077 case NETXEN_BRDTYPE_P3_10G_XFP:
2055 case NETXEN_BRDTYPE_P3_10000_BASE_T: 2078 case NETXEN_BRDTYPE_P3_10000_BASE_T:
2056
2057 adapter->ahw.board_type = NETXEN_NIC_XGBE; 2079 adapter->ahw.board_type = NETXEN_NIC_XGBE;
2058 break; 2080 break;
2059 case NETXEN_BRDTYPE_P1_BD: 2081 case NETXEN_BRDTYPE_P1_BD:
@@ -2063,9 +2085,12 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
2063 case NETXEN_BRDTYPE_P3_REF_QG: 2085 case NETXEN_BRDTYPE_P3_REF_QG:
2064 case NETXEN_BRDTYPE_P3_4_GB: 2086 case NETXEN_BRDTYPE_P3_4_GB:
2065 case NETXEN_BRDTYPE_P3_4_GB_MM: 2087 case NETXEN_BRDTYPE_P3_4_GB_MM:
2066
2067 adapter->ahw.board_type = NETXEN_NIC_GBE; 2088 adapter->ahw.board_type = NETXEN_NIC_GBE;
2068 break; 2089 break;
2090 case NETXEN_BRDTYPE_P3_10G_TP:
2091 adapter->ahw.board_type = (adapter->portnum < 2) ?
2092 NETXEN_NIC_XGBE : NETXEN_NIC_GBE;
2093 break;
2069 default: 2094 default:
2070 printk("%s: Unknown(%x)\n", netxen_nic_driver_name, 2095 printk("%s: Unknown(%x)\n", netxen_nic_driver_name,
2071 boardinfo->board_type); 2096 boardinfo->board_type);
@@ -2110,12 +2135,16 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2110{ 2135{
2111 __u32 status; 2136 __u32 status;
2112 __u32 autoneg; 2137 __u32 autoneg;
2113 __u32 mode;
2114 __u32 port_mode; 2138 __u32 port_mode;
2115 2139
2116 netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); 2140 if (!netif_carrier_ok(adapter->netdev)) {
2117 if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ 2141 adapter->link_speed = 0;
2142 adapter->link_duplex = -1;
2143 adapter->link_autoneg = AUTONEG_ENABLE;
2144 return;
2145 }
2118 2146
2147 if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
2119 adapter->hw_read_wx(adapter, 2148 adapter->hw_read_wx(adapter,
2120 NETXEN_PORT_MODE_ADDR, &port_mode, 4); 2149 NETXEN_PORT_MODE_ADDR, &port_mode, 4);
2121 if (port_mode == NETXEN_PORT_MODE_802_3_AP) { 2150 if (port_mode == NETXEN_PORT_MODE_802_3_AP) {
@@ -2141,7 +2170,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2141 adapter->link_speed = SPEED_1000; 2170 adapter->link_speed = SPEED_1000;
2142 break; 2171 break;
2143 default: 2172 default:
2144 adapter->link_speed = -1; 2173 adapter->link_speed = 0;
2145 break; 2174 break;
2146 } 2175 }
2147 switch (netxen_get_phy_duplex(status)) { 2176 switch (netxen_get_phy_duplex(status)) {
@@ -2164,7 +2193,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter)
2164 goto link_down; 2193 goto link_down;
2165 } else { 2194 } else {
2166 link_down: 2195 link_down:
2167 adapter->link_speed = -1; 2196 adapter->link_speed = 0;
2168 adapter->link_duplex = -1; 2197 adapter->link_duplex = -1;
2169 } 2198 }
2170 } 2199 }