| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /*$NetBSD: ixv.c,v 1.125.2.4 2019/09/26 19:07:22 martin Exp $*/ | | 1 | /*$NetBSD: ixv.c,v 1.125.2.5 2019/10/08 17:05:16 martin 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 |
| @@ -706,26 +706,29 @@ ixv_init_locked(struct adapter *adapter) | | | @@ -706,26 +706,29 @@ ixv_init_locked(struct adapter *adapter) |
706 | struct ix_queue *que; | | 706 | struct ix_queue *que; |
707 | int error = 0; | | 707 | int error = 0; |
708 | uint32_t mask; | | 708 | uint32_t mask; |
709 | int i; | | 709 | int i; |
710 | | | 710 | |
711 | INIT_DEBUGOUT("ixv_init_locked: begin"); | | 711 | INIT_DEBUGOUT("ixv_init_locked: begin"); |
712 | KASSERT(mutex_owned(&adapter->core_mtx)); | | 712 | KASSERT(mutex_owned(&adapter->core_mtx)); |
713 | hw->adapter_stopped = FALSE; | | 713 | hw->adapter_stopped = FALSE; |
714 | hw->mac.ops.stop_adapter(hw); | | 714 | hw->mac.ops.stop_adapter(hw); |
715 | callout_stop(&adapter->timer); | | 715 | callout_stop(&adapter->timer); |
716 | for (i = 0, que = adapter->queues; i < adapter->num_queues; i++, que++) | | 716 | for (i = 0, que = adapter->queues; i < adapter->num_queues; i++, que++) |
717 | que->disabled_count = 0; | | 717 | que->disabled_count = 0; |
718 | | | 718 | |
| | | 719 | adapter->max_frame_size = |
| | | 720 | ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; |
| | | 721 | |
719 | /* reprogram the RAR[0] in case user changed it. */ | | 722 | /* reprogram the RAR[0] in case user changed it. */ |
720 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); | | 723 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); |
721 | | | 724 | |
722 | /* Get the latest mac address, User can use a LAA */ | | 725 | /* Get the latest mac address, User can use a LAA */ |
723 | memcpy(hw->mac.addr, CLLADDR(ifp->if_sadl), | | 726 | memcpy(hw->mac.addr, CLLADDR(ifp->if_sadl), |
724 | IXGBE_ETH_LENGTH_OF_ADDRESS); | | 727 | IXGBE_ETH_LENGTH_OF_ADDRESS); |
725 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, 1); | | 728 | hw->mac.ops.set_rar(hw, 0, hw->mac.addr, 0, 1); |
726 | | | 729 | |
727 | /* Prepare transmit descriptors and buffers */ | | 730 | /* Prepare transmit descriptors and buffers */ |
728 | if (ixgbe_setup_transmit_structures(adapter)) { | | 731 | if (ixgbe_setup_transmit_structures(adapter)) { |
729 | aprint_error_dev(dev, "Could not setup transmit structures\n"); | | 732 | aprint_error_dev(dev, "Could not setup transmit structures\n"); |
730 | ixv_stop(adapter); | | 733 | ixv_stop(adapter); |
731 | return; | | 734 | return; |
| @@ -738,30 +741,30 @@ ixv_init_locked(struct adapter *adapter) | | | @@ -738,30 +741,30 @@ ixv_init_locked(struct adapter *adapter) |
738 | if (error) | | 741 | if (error) |
739 | device_printf(dev, | | 742 | device_printf(dev, |
740 | "Mailbox API negotiation failed in init_locked!\n"); | | 743 | "Mailbox API negotiation failed in init_locked!\n"); |
741 | | | 744 | |
742 | ixv_initialize_transmit_units(adapter); | | 745 | ixv_initialize_transmit_units(adapter); |
743 | | | 746 | |
744 | /* Setup Multicast table */ | | 747 | /* Setup Multicast table */ |
745 | ixv_set_rxfilter(adapter); | | 748 | ixv_set_rxfilter(adapter); |
746 | | | 749 | |
747 | /* | | 750 | /* |
748 | * Determine the correct mbuf pool | | 751 | * Determine the correct mbuf pool |
749 | * for doing jumbo/headersplit | | 752 | * for doing jumbo/headersplit |
750 | */ | | 753 | */ |
751 | if (ifp->if_mtu > ETHERMTU) | | 754 | if (adapter->max_frame_size <= MCLBYTES) |
752 | adapter->rx_mbuf_sz = MJUMPAGESIZE; | | | |
753 | else | | | |
754 | adapter->rx_mbuf_sz = MCLBYTES; | | 755 | adapter->rx_mbuf_sz = MCLBYTES; |
| | | 756 | else |
| | | 757 | adapter->rx_mbuf_sz = MJUMPAGESIZE; |
755 | | | 758 | |
756 | /* Prepare receive descriptors and buffers */ | | 759 | /* Prepare receive descriptors and buffers */ |
757 | if (ixgbe_setup_receive_structures(adapter)) { | | 760 | if (ixgbe_setup_receive_structures(adapter)) { |
758 | device_printf(dev, "Could not setup receive structures\n"); | | 761 | device_printf(dev, "Could not setup receive structures\n"); |
759 | ixv_stop(adapter); | | 762 | ixv_stop(adapter); |
760 | return; | | 763 | return; |
761 | } | | 764 | } |
762 | | | 765 | |
763 | /* Configure RX settings */ | | 766 | /* Configure RX settings */ |
764 | ixv_initialize_receive_units(adapter); | | 767 | ixv_initialize_receive_units(adapter); |
765 | | | 768 | |
766 | #if 0 /* XXX isn't it required? -- msaitoh */ | | 769 | #if 0 /* XXX isn't it required? -- msaitoh */ |
767 | /* Set the various hardware offload abilities */ | | 770 | /* Set the various hardware offload abilities */ |