diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2008-07-21 22:44:07 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-22 17:52:11 -0400 |
commit | c9fc891f86c062449116fde8826a0ead650e17ac (patch) | |
tree | 73496ddd8e43ef74634cae90ab9d12bf311d4139 /drivers/net/netxen | |
parent | 48bfd1e0fc66b27254ec742b014e689ef218e76c (diff) |
netxen: mtu, mac, link status changes
MAC addr, multicast filters, mtu are set through firmware commands
in firmware v4.0.0+ because of virtualization of physical ports.
Link status is also read from registers allocated by firmware for
each virtual port.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 12 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hdr.h | 6 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 198 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 2 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 35 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_niu.c | 22 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_phan_reg.h | 4 |
7 files changed, 236 insertions, 43 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 936219010e46..e41f62352b15 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1119,7 +1119,7 @@ typedef struct { | |||
1119 | u64 qhdr; | 1119 | u64 qhdr; |
1120 | u64 req_hdr; | 1120 | u64 req_hdr; |
1121 | u64 words[6]; | 1121 | u64 words[6]; |
1122 | } nic_request_t; | 1122 | } nx_nic_req_t; |
1123 | 1123 | ||
1124 | typedef struct { | 1124 | typedef struct { |
1125 | u8 op; | 1125 | u8 op; |
@@ -1127,6 +1127,7 @@ typedef struct { | |||
1127 | u8 mac_addr[6]; | 1127 | u8 mac_addr[6]; |
1128 | } nx_mac_req_t; | 1128 | } nx_mac_req_t; |
1129 | 1129 | ||
1130 | #define MAX_PENDING_DESC_BLOCK_SIZE 64 | ||
1130 | 1131 | ||
1131 | #define NETXEN_NIC_MSI_ENABLED 0x02 | 1132 | #define NETXEN_NIC_MSI_ENABLED 0x02 |
1132 | #define NETXEN_NIC_MSIX_ENABLED 0x04 | 1133 | #define NETXEN_NIC_MSIX_ENABLED 0x04 |
@@ -1152,7 +1153,6 @@ struct netxen_adapter { | |||
1152 | int pci_using_dac; | 1153 | int pci_using_dac; |
1153 | struct napi_struct napi; | 1154 | struct napi_struct napi; |
1154 | struct net_device_stats net_stats; | 1155 | struct net_device_stats net_stats; |
1155 | unsigned char mac_addr[ETH_ALEN]; | ||
1156 | int mtu; | 1156 | int mtu; |
1157 | int portnum; | 1157 | int portnum; |
1158 | u8 physical_port; | 1158 | u8 physical_port; |
@@ -1160,6 +1160,7 @@ struct netxen_adapter { | |||
1160 | 1160 | ||
1161 | uint8_t mc_enabled; | 1161 | uint8_t mc_enabled; |
1162 | uint8_t max_mc_count; | 1162 | uint8_t max_mc_count; |
1163 | nx_mac_list_t *mac_list; | ||
1163 | 1164 | ||
1164 | struct netxen_legacy_intr_set legacy_intr; | 1165 | struct netxen_legacy_intr_set legacy_intr; |
1165 | u32 crb_intr_mask; | 1166 | u32 crb_intr_mask; |
@@ -1231,7 +1232,6 @@ struct netxen_adapter { | |||
1231 | int (*phy_read) (struct netxen_adapter *, long reg, u32 *); | 1232 | int (*phy_read) (struct netxen_adapter *, long reg, u32 *); |
1232 | int (*phy_write) (struct netxen_adapter *, long reg, u32 val); | 1233 | int (*phy_write) (struct netxen_adapter *, long reg, u32 val); |
1233 | int (*init_port) (struct netxen_adapter *, int); | 1234 | int (*init_port) (struct netxen_adapter *, int); |
1234 | void (*init_niu) (struct netxen_adapter *); | ||
1235 | int (*stop_port) (struct netxen_adapter *); | 1235 | int (*stop_port) (struct netxen_adapter *); |
1236 | 1236 | ||
1237 | int (*hw_read_wx)(struct netxen_adapter *, ulong, void *, int); | 1237 | int (*hw_read_wx)(struct netxen_adapter *, ulong, void *, int); |
@@ -1316,7 +1316,6 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, | |||
1316 | /* Functions available from netxen_nic_hw.c */ | 1316 | /* Functions available from netxen_nic_hw.c */ |
1317 | int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu); | 1317 | int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu); |
1318 | int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu); | 1318 | int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu); |
1319 | void netxen_nic_init_niu_gb(struct netxen_adapter *adapter); | ||
1320 | void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val); | 1319 | void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val); |
1321 | int netxen_nic_reg_read(struct netxen_adapter *adapter, u64 off); | 1320 | int netxen_nic_reg_read(struct netxen_adapter *adapter, u64 off); |
1322 | void netxen_nic_write_w0(struct netxen_adapter *adapter, u32 index, u32 value); | 1321 | void netxen_nic_write_w0(struct netxen_adapter *adapter, u32 index, u32 value); |
@@ -1404,7 +1403,8 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, | |||
1404 | u32 ringid); | 1403 | u32 ringid); |
1405 | int netxen_process_cmd_ring(struct netxen_adapter *adapter); | 1404 | int netxen_process_cmd_ring(struct netxen_adapter *adapter); |
1406 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); | 1405 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); |
1407 | void netxen_nic_set_multi(struct net_device *netdev); | 1406 | void netxen_p2_nic_set_multi(struct net_device *netdev); |
1407 | void netxen_p3_nic_set_multi(struct net_device *netdev); | ||
1408 | 1408 | ||
1409 | u32 nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, u32 mtu); | 1409 | u32 nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, u32 mtu); |
1410 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); | 1410 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); |
@@ -1412,6 +1412,8 @@ int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); | |||
1412 | int netxen_nic_set_mac(struct net_device *netdev, void *p); | 1412 | int netxen_nic_set_mac(struct net_device *netdev, void *p); |
1413 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev); | 1413 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev); |
1414 | 1414 | ||
1415 | void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, | ||
1416 | uint32_t crb_producer); | ||
1415 | 1417 | ||
1416 | /* | 1418 | /* |
1417 | * NetXen Board information | 1419 | * NetXen Board information |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 2374d8dc6cfe..3ce13e451aac 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -718,6 +718,12 @@ enum { | |||
718 | #define XG_LINK_UP 0x10 | 718 | #define XG_LINK_UP 0x10 |
719 | #define XG_LINK_DOWN 0x20 | 719 | #define XG_LINK_DOWN 0x20 |
720 | 720 | ||
721 | #define XG_LINK_UP_P3 0x01 | ||
722 | #define XG_LINK_DOWN_P3 0x02 | ||
723 | #define XG_LINK_STATE_P3_MASK 0xf | ||
724 | #define XG_LINK_STATE_P3(pcifn,val) \ | ||
725 | (((val) >> ((pcifn) * 4)) & XG_LINK_STATE_P3_MASK) | ||
726 | |||
721 | #define NETXEN_CAM_RAM_BASE (NETXEN_CRB_CAM + 0x02000) | 727 | #define NETXEN_CAM_RAM_BASE (NETXEN_CRB_CAM + 0x02000) |
722 | #define NETXEN_CAM_RAM(reg) (NETXEN_CAM_RAM_BASE + (reg)) | 728 | #define NETXEN_CAM_RAM(reg) (NETXEN_CAM_RAM_BASE + (reg)) |
723 | #define NETXEN_FW_VERSION_MAJOR (NETXEN_CAM_RAM(0x150)) | 729 | #define NETXEN_FW_VERSION_MAJOR (NETXEN_CAM_RAM(0x150)) |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index d46b4dff783d..9d4e9c9dbe0a 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -314,8 +314,10 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p) | |||
314 | 314 | ||
315 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | 315 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
316 | 316 | ||
317 | if (adapter->macaddr_set) | 317 | /* For P3, MAC addr is not set in NIU */ |
318 | adapter->macaddr_set(adapter, addr->sa_data); | 318 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) |
319 | if (adapter->macaddr_set) | ||
320 | adapter->macaddr_set(adapter, addr->sa_data); | ||
319 | 321 | ||
320 | return 0; | 322 | return 0; |
321 | } | 323 | } |
@@ -405,10 +407,7 @@ netxen_nic_set_mcast_addr(struct netxen_adapter *adapter, | |||
405 | return 0; | 407 | return 0; |
406 | } | 408 | } |
407 | 409 | ||
408 | /* | 410 | void netxen_p2_nic_set_multi(struct net_device *netdev) |
409 | * netxen_nic_set_multi - Multicast | ||
410 | */ | ||
411 | void netxen_nic_set_multi(struct net_device *netdev) | ||
412 | { | 411 | { |
413 | struct netxen_adapter *adapter = netdev_priv(netdev); | 412 | struct netxen_adapter *adapter = netdev_priv(netdev); |
414 | struct dev_mc_list *mc_ptr; | 413 | struct dev_mc_list *mc_ptr; |
@@ -456,18 +455,186 @@ void netxen_nic_set_multi(struct net_device *netdev) | |||
456 | netxen_nic_set_mcast_addr(adapter, index, null_addr); | 455 | netxen_nic_set_mcast_addr(adapter, index, null_addr); |
457 | } | 456 | } |
458 | 457 | ||
458 | static int nx_p3_nic_add_mac(struct netxen_adapter *adapter, | ||
459 | u8 *addr, nx_mac_list_t **add_list, nx_mac_list_t **del_list) | ||
460 | { | ||
461 | nx_mac_list_t *cur, *prev; | ||
462 | |||
463 | /* if in del_list, move it to adapter->mac_list */ | ||
464 | for (cur = *del_list, prev = NULL; cur;) { | ||
465 | if (memcmp(addr, cur->mac_addr, ETH_ALEN) == 0) { | ||
466 | if (prev == NULL) | ||
467 | *del_list = cur->next; | ||
468 | else | ||
469 | prev->next = cur->next; | ||
470 | cur->next = adapter->mac_list; | ||
471 | adapter->mac_list = cur; | ||
472 | return 0; | ||
473 | } | ||
474 | prev = cur; | ||
475 | cur = cur->next; | ||
476 | } | ||
477 | |||
478 | /* make sure to add each mac address only once */ | ||
479 | for (cur = adapter->mac_list; cur; cur = cur->next) { | ||
480 | if (memcmp(addr, cur->mac_addr, ETH_ALEN) == 0) | ||
481 | return 0; | ||
482 | } | ||
483 | /* not in del_list, create new entry and add to add_list */ | ||
484 | cur = kmalloc(sizeof(*cur), in_atomic()? GFP_ATOMIC : GFP_KERNEL); | ||
485 | if (cur == NULL) { | ||
486 | printk(KERN_ERR "%s: cannot allocate memory. MAC filtering may" | ||
487 | "not work properly from now.\n", __func__); | ||
488 | return -1; | ||
489 | } | ||
490 | |||
491 | memcpy(cur->mac_addr, addr, ETH_ALEN); | ||
492 | cur->next = *add_list; | ||
493 | *add_list = cur; | ||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | static int | ||
498 | netxen_send_cmd_descs(struct netxen_adapter *adapter, | ||
499 | struct cmd_desc_type0 *cmd_desc_arr, int nr_elements) | ||
500 | { | ||
501 | uint32_t i, producer; | ||
502 | struct netxen_cmd_buffer *pbuf; | ||
503 | struct cmd_desc_type0 *cmd_desc; | ||
504 | |||
505 | if (nr_elements > MAX_PENDING_DESC_BLOCK_SIZE || nr_elements == 0) { | ||
506 | printk(KERN_WARNING "%s: Too many command descriptors in a " | ||
507 | "request\n", __func__); | ||
508 | return -EINVAL; | ||
509 | } | ||
510 | |||
511 | i = 0; | ||
512 | |||
513 | producer = adapter->cmd_producer; | ||
514 | do { | ||
515 | cmd_desc = &cmd_desc_arr[i]; | ||
516 | |||
517 | pbuf = &adapter->cmd_buf_arr[producer]; | ||
518 | pbuf->mss = 0; | ||
519 | pbuf->total_length = 0; | ||
520 | pbuf->skb = NULL; | ||
521 | pbuf->cmd = 0; | ||
522 | pbuf->frag_count = 0; | ||
523 | pbuf->port = 0; | ||
524 | |||
525 | /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ | ||
526 | memcpy(&adapter->ahw.cmd_desc_head[producer], | ||
527 | &cmd_desc_arr[i], sizeof(struct cmd_desc_type0)); | ||
528 | |||
529 | producer = get_next_index(producer, | ||
530 | adapter->max_tx_desc_count); | ||
531 | i++; | ||
532 | |||
533 | } while (i != nr_elements); | ||
534 | |||
535 | adapter->cmd_producer = producer; | ||
536 | |||
537 | /* write producer index to start the xmit */ | ||
538 | |||
539 | netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); | ||
540 | |||
541 | return 0; | ||
542 | } | ||
543 | |||
544 | #define NIC_REQUEST 0x14 | ||
545 | #define NETXEN_MAC_EVENT 0x1 | ||
546 | |||
547 | static int nx_p3_sre_macaddr_change(struct net_device *dev, | ||
548 | u8 *addr, unsigned op) | ||
549 | { | ||
550 | struct netxen_adapter *adapter = (struct netxen_adapter *)dev->priv; | ||
551 | nx_nic_req_t req; | ||
552 | nx_mac_req_t mac_req; | ||
553 | int rv; | ||
554 | |||
555 | memset(&req, 0, sizeof(nx_nic_req_t)); | ||
556 | req.qhdr |= (NIC_REQUEST << 23); | ||
557 | req.req_hdr |= NETXEN_MAC_EVENT; | ||
558 | req.req_hdr |= ((u64)adapter->portnum << 16); | ||
559 | mac_req.op = op; | ||
560 | memcpy(&mac_req.mac_addr, addr, 6); | ||
561 | req.words[0] = cpu_to_le64(*(u64 *)&mac_req); | ||
562 | |||
563 | rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); | ||
564 | if (rv != 0) { | ||
565 | printk(KERN_ERR "ERROR. Could not send mac update\n"); | ||
566 | return rv; | ||
567 | } | ||
568 | |||
569 | return 0; | ||
570 | } | ||
571 | |||
572 | void netxen_p3_nic_set_multi(struct net_device *netdev) | ||
573 | { | ||
574 | struct netxen_adapter *adapter = netdev_priv(netdev); | ||
575 | nx_mac_list_t *cur, *next, *del_list, *add_list = NULL; | ||
576 | struct dev_mc_list *mc_ptr; | ||
577 | u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | ||
578 | |||
579 | adapter->set_promisc(adapter, NETXEN_NIU_PROMISC_MODE); | ||
580 | |||
581 | /* | ||
582 | * Programming mac addresses will automaticly enabling L2 filtering. | ||
583 | * HW will replace timestamp with L2 conid when L2 filtering is | ||
584 | * enabled. This causes problem for LSA. Do not enabling L2 filtering | ||
585 | * until that problem is fixed. | ||
586 | */ | ||
587 | if ((netdev->flags & IFF_PROMISC) || | ||
588 | (netdev->mc_count > adapter->max_mc_count)) | ||
589 | return; | ||
590 | |||
591 | del_list = adapter->mac_list; | ||
592 | adapter->mac_list = NULL; | ||
593 | |||
594 | nx_p3_nic_add_mac(adapter, netdev->dev_addr, &add_list, &del_list); | ||
595 | if (netdev->mc_count > 0) { | ||
596 | nx_p3_nic_add_mac(adapter, bcast_addr, &add_list, &del_list); | ||
597 | for (mc_ptr = netdev->mc_list; mc_ptr; | ||
598 | mc_ptr = mc_ptr->next) { | ||
599 | nx_p3_nic_add_mac(adapter, mc_ptr->dmi_addr, | ||
600 | &add_list, &del_list); | ||
601 | } | ||
602 | } | ||
603 | for (cur = del_list; cur;) { | ||
604 | nx_p3_sre_macaddr_change(netdev, cur->mac_addr, NETXEN_MAC_DEL); | ||
605 | next = cur->next; | ||
606 | kfree(cur); | ||
607 | cur = next; | ||
608 | } | ||
609 | for (cur = add_list; cur;) { | ||
610 | nx_p3_sre_macaddr_change(netdev, cur->mac_addr, NETXEN_MAC_ADD); | ||
611 | next = cur->next; | ||
612 | cur->next = adapter->mac_list; | ||
613 | adapter->mac_list = cur; | ||
614 | cur = next; | ||
615 | } | ||
616 | } | ||
617 | |||
459 | /* | 618 | /* |
460 | * netxen_nic_change_mtu - Change the Maximum Transfer Unit | 619 | * netxen_nic_change_mtu - Change the Maximum Transfer Unit |
461 | * @returns 0 on success, negative on failure | 620 | * @returns 0 on success, negative on failure |
462 | */ | 621 | */ |
622 | |||
623 | #define MTU_FUDGE_FACTOR 100 | ||
624 | |||
463 | int netxen_nic_change_mtu(struct net_device *netdev, int mtu) | 625 | int netxen_nic_change_mtu(struct net_device *netdev, int mtu) |
464 | { | 626 | { |
465 | struct netxen_adapter *adapter = netdev_priv(netdev); | 627 | struct netxen_adapter *adapter = netdev_priv(netdev); |
466 | int eff_mtu = mtu + NETXEN_ENET_HEADER_SIZE + NETXEN_ETH_FCS_SIZE; | 628 | int max_mtu; |
467 | 629 | ||
468 | if ((eff_mtu > NETXEN_MAX_MTU) || (eff_mtu < NETXEN_MIN_MTU)) { | 630 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) |
469 | printk(KERN_ERR "%s: %s %d is not supported.\n", | 631 | max_mtu = P3_MAX_MTU; |
470 | netxen_nic_driver_name, netdev->name, mtu); | 632 | else |
633 | max_mtu = P2_MAX_MTU; | ||
634 | |||
635 | if (mtu > max_mtu) { | ||
636 | printk(KERN_ERR "%s: mtu > %d bytes unsupported\n", | ||
637 | netdev->name, max_mtu); | ||
471 | return -EINVAL; | 638 | return -EINVAL; |
472 | } | 639 | } |
473 | 640 | ||
@@ -475,6 +642,12 @@ int netxen_nic_change_mtu(struct net_device *netdev, int mtu) | |||
475 | adapter->set_mtu(adapter, mtu); | 642 | adapter->set_mtu(adapter, mtu); |
476 | netdev->mtu = mtu; | 643 | netdev->mtu = mtu; |
477 | 644 | ||
645 | mtu += MTU_FUDGE_FACTOR; | ||
646 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
647 | nx_fw_cmd_set_mtu(adapter, mtu); | ||
648 | else if (adapter->set_mtu) | ||
649 | adapter->set_mtu(adapter, mtu); | ||
650 | |||
478 | return 0; | 651 | return 0; |
479 | } | 652 | } |
480 | 653 | ||
@@ -1882,11 +2055,6 @@ int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) | |||
1882 | return 0; | 2055 | return 0; |
1883 | } | 2056 | } |
1884 | 2057 | ||
1885 | void netxen_nic_init_niu_gb(struct netxen_adapter *adapter) | ||
1886 | { | ||
1887 | netxen_niu_gbe_init_port(adapter, adapter->physical_port); | ||
1888 | } | ||
1889 | |||
1890 | void | 2058 | void |
1891 | netxen_crb_writelit_adapter(struct netxen_adapter *adapter, | 2059 | netxen_crb_writelit_adapter(struct netxen_adapter *adapter, |
1892 | unsigned long off, int data) | 2060 | unsigned long off, int data) |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index d222436bd5bd..7b5124057664 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -329,7 +329,7 @@ void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) | |||
329 | adapter->set_promisc = netxen_niu_set_promiscuous_mode; | 329 | adapter->set_promisc = netxen_niu_set_promiscuous_mode; |
330 | adapter->phy_read = netxen_niu_gbe_phy_read; | 330 | adapter->phy_read = netxen_niu_gbe_phy_read; |
331 | adapter->phy_write = netxen_niu_gbe_phy_write; | 331 | adapter->phy_write = netxen_niu_gbe_phy_write; |
332 | adapter->init_niu = netxen_nic_init_niu_gb; | 332 | adapter->init_port = netxen_niu_gbe_init_port; |
333 | adapter->stop_port = netxen_niu_disable_gbe_port; | 333 | adapter->stop_port = netxen_niu_disable_gbe_port; |
334 | break; | 334 | break; |
335 | 335 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 03d796d19ad9..df48f89afff1 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -123,7 +123,7 @@ static uint32_t crb_cmd_producer[4] = { | |||
123 | CRB_CMD_PRODUCER_OFFSET_2, CRB_CMD_PRODUCER_OFFSET_3 | 123 | CRB_CMD_PRODUCER_OFFSET_2, CRB_CMD_PRODUCER_OFFSET_3 |
124 | }; | 124 | }; |
125 | 125 | ||
126 | static inline void | 126 | void |
127 | netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, | 127 | netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, |
128 | uint32_t crb_producer) | 128 | uint32_t crb_producer) |
129 | { | 129 | { |
@@ -716,7 +716,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
716 | netdev->stop = netxen_nic_close; | 716 | netdev->stop = netxen_nic_close; |
717 | netdev->hard_start_xmit = netxen_nic_xmit_frame; | 717 | netdev->hard_start_xmit = netxen_nic_xmit_frame; |
718 | netdev->get_stats = netxen_nic_get_stats; | 718 | netdev->get_stats = netxen_nic_get_stats; |
719 | netdev->set_multicast_list = netxen_nic_set_multi; | 719 | if (NX_IS_REVISION_P3(revision_id)) |
720 | netdev->set_multicast_list = netxen_p3_nic_set_multi; | ||
721 | else | ||
722 | netdev->set_multicast_list = netxen_p2_nic_set_multi; | ||
720 | netdev->set_mac_address = netxen_nic_set_mac; | 723 | netdev->set_mac_address = netxen_nic_set_mac; |
721 | netdev->change_mtu = netxen_nic_change_mtu; | 724 | netdev->change_mtu = netxen_nic_change_mtu; |
722 | netdev->tx_timeout = netxen_tx_timeout; | 725 | netdev->tx_timeout = netxen_tx_timeout; |
@@ -1100,7 +1103,7 @@ static int netxen_nic_open(struct net_device *netdev) | |||
1100 | 1103 | ||
1101 | /* Done here again so that even if phantom sw overwrote it, | 1104 | /* Done here again so that even if phantom sw overwrote it, |
1102 | * we set it */ | 1105 | * we set it */ |
1103 | err = adapter->init_port(adapter, adapter->portnum); | 1106 | err = adapter->init_port(adapter, adapter->physical_port); |
1104 | if (err) { | 1107 | if (err) { |
1105 | printk(KERN_ERR "%s: Failed to initialize port %d\n", | 1108 | printk(KERN_ERR "%s: Failed to initialize port %d\n", |
1106 | netxen_nic_driver_name, adapter->portnum); | 1109 | netxen_nic_driver_name, adapter->portnum); |
@@ -1110,8 +1113,11 @@ static int netxen_nic_open(struct net_device *netdev) | |||
1110 | 1113 | ||
1111 | netxen_nic_set_link_parameters(adapter); | 1114 | netxen_nic_set_link_parameters(adapter); |
1112 | 1115 | ||
1113 | netxen_nic_set_multi(netdev); | 1116 | netdev->set_multicast_list(netdev); |
1114 | adapter->set_mtu(adapter, netdev->mtu); | 1117 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) |
1118 | nx_fw_cmd_set_mtu(adapter, netdev->mtu); | ||
1119 | else | ||
1120 | adapter->set_mtu(adapter, netdev->mtu); | ||
1115 | 1121 | ||
1116 | mod_timer(&adapter->watchdog_timer, jiffies); | 1122 | mod_timer(&adapter->watchdog_timer, jiffies); |
1117 | 1123 | ||
@@ -1379,12 +1385,21 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1379 | 1385 | ||
1380 | port = adapter->physical_port; | 1386 | port = adapter->physical_port; |
1381 | 1387 | ||
1382 | val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); | 1388 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { |
1383 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) | 1389 | val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); |
1384 | linkup = (val >> port) & 1; | 1390 | linkup = (val >> port) & 1; |
1385 | else { | 1391 | } else { |
1386 | val = (val >> port*8) & 0xff; | 1392 | if (adapter->fw_major < 4) { |
1387 | linkup = (val == XG_LINK_UP); | 1393 | val = adapter->pci_read_normalize(adapter, |
1394 | CRB_XG_STATE); | ||
1395 | val = (val >> port*8) & 0xff; | ||
1396 | linkup = (val == XG_LINK_UP); | ||
1397 | } else { | ||
1398 | val = adapter->pci_read_normalize(adapter, | ||
1399 | CRB_XG_STATE_P3); | ||
1400 | val = XG_LINK_STATE_P3(adapter->ahw.pci_func, val); | ||
1401 | linkup = (val == XG_LINK_UP_P3); | ||
1402 | } | ||
1388 | } | 1403 | } |
1389 | 1404 | ||
1390 | if (adapter->ahw.linkup && !linkup) { | 1405 | if (adapter->ahw.linkup && !linkup) { |
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index 78905d9dd4ba..4cb8f4a1cf4b 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -400,14 +400,16 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
400 | { | 400 | { |
401 | int result = 0; | 401 | int result = 0; |
402 | __u32 status; | 402 | __u32 status; |
403 | |||
404 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
405 | return 0; | ||
406 | |||
403 | if (adapter->disable_phy_interrupts) | 407 | if (adapter->disable_phy_interrupts) |
404 | adapter->disable_phy_interrupts(adapter); | 408 | adapter->disable_phy_interrupts(adapter); |
405 | mdelay(2); | 409 | mdelay(2); |
406 | 410 | ||
407 | if (0 == | 411 | if (0 == netxen_niu_gbe_phy_read(adapter, |
408 | netxen_niu_gbe_phy_read(adapter, | 412 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, &status)) { |
409 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | ||
410 | &status)) { | ||
411 | if (netxen_get_phy_link(status)) { | 413 | if (netxen_get_phy_link(status)) { |
412 | if (netxen_get_phy_speed(status) == 2) { | 414 | if (netxen_get_phy_speed(status) == 2) { |
413 | netxen_niu_gbe_set_gmii_mode(adapter, port, 1); | 415 | netxen_niu_gbe_set_gmii_mode(adapter, port, 1); |
@@ -455,12 +457,12 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
455 | 457 | ||
456 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | 458 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) |
457 | { | 459 | { |
458 | u32 portnum = adapter->physical_port; | 460 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
459 | 461 | netxen_crb_writelit_adapter(adapter, | |
460 | netxen_crb_writelit_adapter(adapter, | 462 | NETXEN_NIU_XGE_CONFIG_1+(0x10000*port), 0x1447); |
461 | NETXEN_NIU_XGE_CONFIG_1+(0x10000*portnum), 0x1447); | 463 | netxen_crb_writelit_adapter(adapter, |
462 | netxen_crb_writelit_adapter(adapter, | 464 | NETXEN_NIU_XGE_CONFIG_0+(0x10000*port), 0x5); |
463 | NETXEN_NIU_XGE_CONFIG_0+(0x10000*portnum), 0x5); | 465 | } |
464 | 466 | ||
465 | return 0; | 467 | return 0; |
466 | } | 468 | } |
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h index a63762394a83..3bfa51b62a4f 100644 --- a/drivers/net/netxen/netxen_nic_phan_reg.h +++ b/drivers/net/netxen/netxen_nic_phan_reg.h | |||
@@ -76,8 +76,8 @@ | |||
76 | #define CRB_RX_LRO_MID_TIMER NETXEN_NIC_REG(0x88) | 76 | #define CRB_RX_LRO_MID_TIMER NETXEN_NIC_REG(0x88) |
77 | #define CRB_DMA_MAX_RCV_BUFS NETXEN_NIC_REG(0x8c) | 77 | #define CRB_DMA_MAX_RCV_BUFS NETXEN_NIC_REG(0x8c) |
78 | #define CRB_MAX_DMA_ENTRIES NETXEN_NIC_REG(0x90) | 78 | #define CRB_MAX_DMA_ENTRIES NETXEN_NIC_REG(0x90) |
79 | #define CRB_XG_STATE NETXEN_NIC_REG(0x94) /* XG Link status */ | 79 | #define CRB_XG_STATE NETXEN_NIC_REG(0x94) /* XG Link status */ |
80 | #define CRB_AGENT_GO NETXEN_NIC_REG(0x98) /* NIC pkt gen agent */ | 80 | #define CRB_XG_STATE_P3 NETXEN_NIC_REG(0x98) /* XG PF Link status */ |
81 | #define CRB_AGENT_TX_SIZE NETXEN_NIC_REG(0x9c) | 81 | #define CRB_AGENT_TX_SIZE NETXEN_NIC_REG(0x9c) |
82 | #define CRB_AGENT_TX_TYPE NETXEN_NIC_REG(0xa0) | 82 | #define CRB_AGENT_TX_TYPE NETXEN_NIC_REG(0xa0) |
83 | #define CRB_AGENT_TX_ADDR NETXEN_NIC_REG(0xa4) | 83 | #define CRB_AGENT_TX_ADDR NETXEN_NIC_REG(0xa4) |