| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /*$NetBSD: ixv.c,v 1.101 2018/05/25 04:40:27 ozaki-r Exp $*/ | | 1 | /*$NetBSD: ixv.c,v 1.102 2018/05/30 08:35:26 msaitoh Exp $*/ |
2 | | | 2 | |
3 | /****************************************************************************** | | 3 | /****************************************************************************** |
4 | | | 4 | |
5 | Copyright (c) 2001-2017, Intel Corporation | | 5 | Copyright (c) 2001-2017, Intel Corporation |
6 | All rights reserved. | | 6 | All rights reserved. |
7 | | | 7 | |
8 | Redistribution and use in source and binary forms, with or without | | 8 | Redistribution and use in source and binary forms, with or without |
9 | modification, are permitted provided that the following conditions are met: | | 9 | modification, are permitted provided that the following conditions are met: |
10 | | | 10 | |
11 | 1. Redistributions of source code must retain the above copyright notice, | | 11 | 1. Redistributions of source code must retain the above copyright notice, |
12 | this list of conditions and the following disclaimer. | | 12 | this list of conditions and the following disclaimer. |
13 | | | 13 | |
14 | 2. Redistributions in binary form must reproduce the above copyright | | 14 | 2. Redistributions in binary form must reproduce the above copyright |
| @@ -709,36 +709,38 @@ ixv_detach(device_t dev, int flags) | | | @@ -709,36 +709,38 @@ ixv_detach(device_t dev, int flags) |
709 | * Used in two ways: It is used by the stack as an init entry | | 709 | * Used in two ways: It is used by the stack as an init entry |
710 | * point in network interface structure. It is also used | | 710 | * point in network interface structure. It is also used |
711 | * by the driver as a hw/sw initialization routine to get | | 711 | * by the driver as a hw/sw initialization routine to get |
712 | * to a consistent state. | | 712 | * to a consistent state. |
713 | * | | 713 | * |
714 | * return 0 on success, positive on failure | | 714 | * return 0 on success, positive on failure |
715 | ************************************************************************/ | | 715 | ************************************************************************/ |
716 | static void | | 716 | static void |
717 | ixv_init_locked(struct adapter *adapter) | | 717 | ixv_init_locked(struct adapter *adapter) |
718 | { | | 718 | { |
719 | struct ifnet *ifp = adapter->ifp; | | 719 | struct ifnet *ifp = adapter->ifp; |
720 | device_t dev = adapter->dev; | | 720 | device_t dev = adapter->dev; |
721 | struct ixgbe_hw *hw = &adapter->hw; | | 721 | struct ixgbe_hw *hw = &adapter->hw; |
722 | struct ix_queue *que = adapter->queues; | | 722 | struct ix_queue *que; |
723 | int error = 0; | | 723 | int error = 0; |
724 | uint32_t mask; | | 724 | uint32_t mask; |
725 | int i; | | 725 | int i; |
726 | | | 726 | |
727 | INIT_DEBUGOUT("ixv_init_locked: begin"); | | 727 | INIT_DEBUGOUT("ixv_init_locked: begin"); |
728 | KASSERT(mutex_owned(&adapter->core_mtx)); | | 728 | KASSERT(mutex_owned(&adapter->core_mtx)); |
729 | hw->adapter_stopped = FALSE; | | 729 | hw->adapter_stopped = FALSE; |
730 | hw->mac.ops.stop_adapter(hw); | | 730 | hw->mac.ops.stop_adapter(hw); |
731 | callout_stop(&adapter->timer); | | 731 | callout_stop(&adapter->timer); |
| | | 732 | for (i = 0, que = adapter->queues; i < adapter->num_queues; i++, que++) |
| | | 733 | que->disabled_count = 0; |
732 | | | 734 | |
733 | /* reprogram the RAR[0] in case user changed it. */ | | 735 | /* reprogram the RAR[0] in case user changed it. */ |
734 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); | | 736 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); |
735 | | | 737 | |
736 | /* Get the latest mac address, User can use a LAA */ | | 738 | /* Get the latest mac address, User can use a LAA */ |
737 | memcpy(hw->mac.addr, CLLADDR(ifp->if_sadl), | | 739 | memcpy(hw->mac.addr, CLLADDR(ifp->if_sadl), |
738 | IXGBE_ETH_LENGTH_OF_ADDRESS); | | 740 | IXGBE_ETH_LENGTH_OF_ADDRESS); |
739 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, 1); | | 741 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, 1); |
740 | | | 742 | |
741 | /* Prepare transmit descriptors and buffers */ | | 743 | /* Prepare transmit descriptors and buffers */ |
742 | if (ixgbe_setup_transmit_structures(adapter)) { | | 744 | if (ixgbe_setup_transmit_structures(adapter)) { |
743 | aprint_error_dev(dev, "Could not setup transmit structures\n"); | | 745 | aprint_error_dev(dev, "Could not setup transmit structures\n"); |
744 | ixv_stop(adapter); | | 746 | ixv_stop(adapter); |
| @@ -788,27 +790,27 @@ ixv_init_locked(struct adapter *adapter) | | | @@ -788,27 +790,27 @@ ixv_init_locked(struct adapter *adapter) |
788 | ifp->if_hwassist |= CSUM_SCTP; | | 790 | ifp->if_hwassist |= CSUM_SCTP; |
789 | #endif | | 791 | #endif |
790 | } | | 792 | } |
791 | #endif | | 793 | #endif |
792 | | | 794 | |
793 | /* Set up VLAN offload and filter */ | | 795 | /* Set up VLAN offload and filter */ |
794 | ixv_setup_vlan_support(adapter); | | 796 | ixv_setup_vlan_support(adapter); |
795 | | | 797 | |
796 | /* Set up MSI-X routing */ | | 798 | /* Set up MSI-X routing */ |
797 | ixv_configure_ivars(adapter); | | 799 | ixv_configure_ivars(adapter); |
798 | | | 800 | |
799 | /* Set up auto-mask */ | | 801 | /* Set up auto-mask */ |
800 | mask = (1 << adapter->vector); | | 802 | mask = (1 << adapter->vector); |
801 | for (i = 0; i < adapter->num_queues; i++, que++) | | 803 | for (i = 0, que = adapter->queues; i < adapter->num_queues; i++, que++) |
802 | mask |= (1 << que->msix); | | 804 | mask |= (1 << que->msix); |
803 | IXGBE_WRITE_REG(hw, IXGBE_VTEIAM, mask); | | 805 | IXGBE_WRITE_REG(hw, IXGBE_VTEIAM, mask); |
804 | | | 806 | |
805 | /* Set moderation on the Link interrupt */ | | 807 | /* Set moderation on the Link interrupt */ |
806 | ixv_eitr_write(adapter, adapter->vector, IXGBE_LINK_ITR); | | 808 | ixv_eitr_write(adapter, adapter->vector, IXGBE_LINK_ITR); |
807 | | | 809 | |
808 | /* Stats init */ | | 810 | /* Stats init */ |
809 | ixv_init_stats(adapter); | | 811 | ixv_init_stats(adapter); |
810 | | | 812 | |
811 | /* Config/Enable Link */ | | 813 | /* Config/Enable Link */ |
812 | hw->mac.get_link_status = TRUE; | | 814 | hw->mac.get_link_status = TRUE; |
813 | hw->mac.ops.check_link(hw, &adapter->link_speed, &adapter->link_up, | | 815 | hw->mac.ops.check_link(hw, &adapter->link_speed, &adapter->link_up, |
814 | FALSE); | | 816 | FALSE); |