Author: erj Date: Wed May 27 17:44:11 2015 New Revision: 283620 URL: https://svnweb.freebsd.org/changeset/base/283620
Log: MFC ixgbe commits for 10.2: - r280182 - Split the driver into independent pf/vf loadables - r280197 - Resolve build issues - r280204 - Fix multiple same-name devclasses - r280228 - Fix i386 LINT build issues / remove unused variable - r280252 - Fix building ixgbe with gcc - r280962 - Make changes to busdma code similar to r257541 - r281772 & r281773 - Remove unused variable - partial r282280 - stats counter update (ix-only) - r282289 - Add X550 support - r282290 - Add X550 makefile updates - r282293 - Add ixgbe_x550.c to conf/files - r282299 - Fix gcc compile (extraneous extern declaration) Finally, add ix_txrx.c to conf/files because it's required for compile in stable/10. Approved by: jfv (mentor) Added: stable/10/sys/dev/ixgbe/if_ix.c - copied, changed from r280182, head/sys/dev/ixgbe/if_ix.c stable/10/sys/dev/ixgbe/if_ixv.c - copied, changed from r280182, head/sys/dev/ixgbe/if_ixv.c stable/10/sys/dev/ixgbe/ix_txrx.c - copied, changed from r280182, head/sys/dev/ixgbe/ix_txrx.c stable/10/sys/dev/ixgbe/ixgbe_x550.c - copied unchanged from r282289, head/sys/dev/ixgbe/ixgbe_x550.c stable/10/sys/dev/ixgbe/ixgbe_x550.h - copied unchanged from r282289, head/sys/dev/ixgbe/ixgbe_x550.h stable/10/sys/modules/ix/ - copied from r280182, head/sys/modules/ix/ stable/10/sys/modules/ixv/ - copied from r280182, head/sys/modules/ixv/ Deleted: stable/10/sys/dev/ixgbe/ixgbe.c stable/10/sys/dev/ixgbe/ixv.c stable/10/sys/dev/ixgbe/ixv.h Modified: stable/10/sys/amd64/conf/GENERIC stable/10/sys/conf/NOTES stable/10/sys/conf/files stable/10/sys/dev/ixgbe/LICENSE stable/10/sys/dev/ixgbe/ixgbe.h stable/10/sys/dev/ixgbe/ixgbe_82598.c stable/10/sys/dev/ixgbe/ixgbe_82598.h stable/10/sys/dev/ixgbe/ixgbe_82599.c stable/10/sys/dev/ixgbe/ixgbe_82599.h stable/10/sys/dev/ixgbe/ixgbe_api.c stable/10/sys/dev/ixgbe/ixgbe_api.h stable/10/sys/dev/ixgbe/ixgbe_common.c stable/10/sys/dev/ixgbe/ixgbe_common.h stable/10/sys/dev/ixgbe/ixgbe_dcb.c stable/10/sys/dev/ixgbe/ixgbe_dcb.h stable/10/sys/dev/ixgbe/ixgbe_dcb_82598.c stable/10/sys/dev/ixgbe/ixgbe_dcb_82598.h stable/10/sys/dev/ixgbe/ixgbe_dcb_82599.c stable/10/sys/dev/ixgbe/ixgbe_dcb_82599.h stable/10/sys/dev/ixgbe/ixgbe_mbx.c stable/10/sys/dev/ixgbe/ixgbe_mbx.h stable/10/sys/dev/ixgbe/ixgbe_osdep.h stable/10/sys/dev/ixgbe/ixgbe_phy.c stable/10/sys/dev/ixgbe/ixgbe_phy.h stable/10/sys/dev/ixgbe/ixgbe_type.h stable/10/sys/dev/ixgbe/ixgbe_vf.c stable/10/sys/dev/ixgbe/ixgbe_vf.h stable/10/sys/dev/ixgbe/ixgbe_x540.c stable/10/sys/dev/ixgbe/ixgbe_x540.h stable/10/sys/modules/Makefile stable/10/sys/modules/ix/Makefile stable/10/sys/modules/ixv/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/conf/GENERIC ============================================================================== --- stable/10/sys/amd64/conf/GENERIC Wed May 27 17:42:23 2015 (r283619) +++ stable/10/sys/amd64/conf/GENERIC Wed May 27 17:44:11 2015 (r283620) @@ -211,7 +211,8 @@ device bxe # Broadcom NetXtreme II BC device de # DEC/Intel DC21x4x (``Tulip'') device em # Intel PRO/1000 Gigabit Ethernet Family device igb # Intel PRO/1000 PCIE Server Gigabit Family -device ixgbe # Intel PRO/10GbE PCIE Ethernet Family +device ix # Intel PRO/10GbE PCIE PF Ethernet +device ixv # Intel PRO/10GbE PCIE VF Ethernet device ixl # Intel XL710 40Gbe PCIE Ethernet device ixlv # Intel XL710 40Gbe VF PCIE Ethernet device le # AMD Am7900 LANCE and Am79C9xx PCnet Modified: stable/10/sys/conf/NOTES ============================================================================== --- stable/10/sys/conf/NOTES Wed May 27 17:42:23 2015 (r283619) +++ stable/10/sys/conf/NOTES Wed May 27 17:44:11 2015 (r283620) @@ -2089,7 +2089,8 @@ device de # DEC/Intel DC21x4x (``Tulip device em # Intel Pro/1000 Gigabit Ethernet device igb # Intel Pro/1000 PCIE Gigabit Ethernet device ixgb # Intel Pro/10Gbe PCI-X Ethernet -device ixgbe # Intel Pro/10Gbe PCIE Ethernet +device ix # Intel Pro/10Gbe PCIE Ethernet +device ixv # Intel Pro/10Gbe PCIE Ethernet VF device le # AMD Am7900 LANCE and Am79C9xx PCnet device mxge # Myricom Myri-10G 10GbE NIC device nxge # Neterion Xframe 10GbE Server/Storage Adapter Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Wed May 27 17:42:23 2015 (r283619) +++ stable/10/sys/conf/files Wed May 27 17:44:11 2015 (r283620) @@ -1716,31 +1716,35 @@ iwn6050.fw optional iwn6050fw | iwnfw dev/ixgb/if_ixgb.c optional ixgb dev/ixgb/ixgb_ee.c optional ixgb dev/ixgb/ixgb_hw.c optional ixgb -dev/ixgbe/ixgbe.c optional ixgbe inet \ +dev/ixgbe/if_ix.c optional ix inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe -DSMP" -dev/ixgbe/ixv.c optional ixgbe inet \ +dev/ixgbe/if_ixv.c optional ixv inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe -DSMP" +dev/ixgbe/ix_txrx.c optional ixv inet \ + compile-with "${NORMAL_C} -I$S/dev/ixgbe" +dev/ixgbe/ixgbe_phy.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_phy.c optional ixgbe inet \ +dev/ixgbe/ixgbe_api.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_api.c optional ixgbe inet \ +dev/ixgbe/ixgbe_common.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_common.c optional ixgbe inet \ +dev/ixgbe/ixgbe_mbx.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_mbx.c optional ixgbe inet \ +dev/ixgbe/ixgbe_vf.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_vf.c optional ixgbe inet \ +dev/ixgbe/ixgbe_82598.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_82598.c optional ixgbe inet \ +dev/ixgbe/ixgbe_82599.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_82599.c optional ixgbe inet \ +dev/ixgbe/ixgbe_x540.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_x540.c optional ixgbe inet \ +dev/ixgbe/ixgbe_x550.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_dcb.c optional ixgbe inet \ +dev/ixgbe/ixgbe_dcb.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_dcb_82598.c optional ixgbe inet \ +dev/ixgbe/ixgbe_dcb_82598.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" -dev/ixgbe/ixgbe_dcb_82599.c optional ixgbe inet \ +dev/ixgbe/ixgbe_dcb_82599.c optional ix ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/ixl/if_ixl.c optional ixl inet \ compile-with "${NORMAL_C} -I$S/dev/ixl" Modified: stable/10/sys/dev/ixgbe/LICENSE ============================================================================== --- stable/10/sys/dev/ixgbe/LICENSE Wed May 27 17:42:23 2015 (r283619) +++ stable/10/sys/dev/ixgbe/LICENSE Wed May 27 17:44:11 2015 (r283620) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2013, Intel Corporation + Copyright (c) 2001-2015, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without Copied and modified: stable/10/sys/dev/ixgbe/if_ix.c (from r280182, head/sys/dev/ixgbe/if_ix.c) ============================================================================== --- head/sys/dev/ixgbe/if_ix.c Tue Mar 17 18:32:28 2015 (r280182, copy source) +++ stable/10/sys/dev/ixgbe/if_ix.c Wed May 27 17:44:11 2015 (r283620) @@ -36,15 +36,10 @@ #ifndef IXGBE_STANDALONE_BUILD #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_rss.h" #endif #include "ixgbe.h" -#ifdef RSS -#include <netinet/in_rss.h> -#endif - /********************************************************************* * Set this to one to display debug statistics *********************************************************************/ @@ -53,7 +48,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.7.4"; +char ixgbe_driver_version[] = "2.8.3"; /********************************************************************* * PCI Device ID Table @@ -116,6 +111,8 @@ static int ixgbe_probe(device_t); static int ixgbe_attach(device_t); static int ixgbe_detach(device_t); static int ixgbe_shutdown(device_t); +static int ixgbe_suspend(device_t); +static int ixgbe_resume(device_t); static int ixgbe_ioctl(struct ifnet *, u_long, caddr_t); static void ixgbe_init(void *); static void ixgbe_init_locked(struct adapter *); @@ -135,7 +132,12 @@ static int ixgbe_setup_msix(struct adapt static void ixgbe_free_pci_resources(struct adapter *); static void ixgbe_local_timer(void *); static int ixgbe_setup_interface(device_t, struct adapter *); +static void ixgbe_config_dmac(struct adapter *); +static void ixgbe_config_delay_values(struct adapter *); static void ixgbe_config_link(struct adapter *); +static void ixgbe_check_eee_support(struct adapter *); +static void ixgbe_check_wol_support(struct adapter *); +static int ixgbe_setup_low_power_mode(struct adapter *); static void ixgbe_rearm_queues(struct adapter *, u64); static void ixgbe_initialize_transmit_units(struct adapter *); @@ -149,9 +151,6 @@ static void ixgbe_update_stats_count static void ixgbe_set_promisc(struct adapter *); static void ixgbe_set_multi(struct adapter *); static void ixgbe_update_link_status(struct adapter *); -static int ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS); -static int ixgbe_set_advertise(SYSCTL_HANDLER_ARGS); -static int ixgbe_set_thermal_test(SYSCTL_HANDLER_ARGS); static void ixgbe_set_ivar(struct adapter *, u8, u8, s8); static void ixgbe_configure_ivars(struct adapter *); static u8 * ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *); @@ -160,7 +159,22 @@ static void ixgbe_setup_vlan_hw_support( static void ixgbe_register_vlan(void *, struct ifnet *, u16); static void ixgbe_unregister_vlan(void *, struct ifnet *, u16); -static void ixgbe_add_hw_stats(struct adapter *adapter); +static void ixgbe_add_device_sysctls(struct adapter *); +static void ixgbe_add_hw_stats(struct adapter *); + +/* Sysctl handlers */ +static int ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS); +static int ixgbe_set_advertise(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_thermal_test(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_dmac(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_phy_temp(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_phy_overtemp_occurred(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_wol_enable(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_wufc(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_eee_enable(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_eee_negotiated(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_eee_rx_lpi_status(SYSCTL_HANDLER_ARGS); +static int ixgbe_sysctl_eee_tx_lpi_status(SYSCTL_HANDLER_ARGS); /* Support for pluggable optic modules */ static bool ixgbe_sfp_probe(struct adapter *); @@ -178,37 +192,36 @@ static void ixgbe_handle_que(void *, int static void ixgbe_handle_link(void *, int); static void ixgbe_handle_msf(void *, int); static void ixgbe_handle_mod(void *, int); +static void ixgbe_handle_phy(void *, int); #ifdef IXGBE_FDIR static void ixgbe_reinit_fdir(void *, int); #endif - -/* Missing shared code prototype */ -extern void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw); - /********************************************************************* * FreeBSD Device Interface Entry Points *********************************************************************/ -static device_method_t ixgbe_methods[] = { +static device_method_t ix_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ixgbe_probe), DEVMETHOD(device_attach, ixgbe_attach), DEVMETHOD(device_detach, ixgbe_detach), DEVMETHOD(device_shutdown, ixgbe_shutdown), + DEVMETHOD(device_suspend, ixgbe_suspend), + DEVMETHOD(device_resume, ixgbe_resume), DEVMETHOD_END }; -static driver_t ixgbe_driver = { - "ix", ixgbe_methods, sizeof(struct adapter), +static driver_t ix_driver = { + "ix", ix_methods, sizeof(struct adapter), }; -devclass_t ixgbe_devclass; -DRIVER_MODULE(ixgbe, pci, ixgbe_driver, ixgbe_devclass, 0, 0); +devclass_t ix_devclass; +DRIVER_MODULE(ix, pci, ix_driver, ix_devclass, 0, 0); -MODULE_DEPEND(ixgbe, pci, 1, 1, 1); -MODULE_DEPEND(ixgbe, ether, 1, 1, 1); +MODULE_DEPEND(ix, pci, 1, 1, 1); +MODULE_DEPEND(ix, ether, 1, 1, 1); /* ** TUNEABLE PARAMETERS: @@ -403,32 +416,6 @@ ixgbe_attach(device_t dev) /* Core Lock Init*/ IXGBE_CORE_LOCK_INIT(adapter, device_get_nameunit(dev)); - /* SYSCTL APIs */ - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "fc", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_set_flowcntl, "I", IXGBE_SYSCTL_DESC_SET_FC); - - SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "enable_aim", CTLFLAG_RW, - &ixgbe_enable_aim, 1, "Interrupt Moderation"); - - /* - ** Allow a kind of speed control by forcing the autoneg - ** advertised speed list to only a certain value, this - ** supports 1G on 82599 devices, and 100Mb on x540. - */ - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "advertise_speed", CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_set_advertise, "I", IXGBE_SYSCTL_DESC_ADV_SPEED); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "ts", CTLTYPE_INT | CTLFLAG_RW, adapter, - 0, ixgbe_set_thermal_test, "I", "Thermal Test"); - /* Set up the timer callout */ callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); @@ -558,22 +545,26 @@ ixgbe_attach(device_t dev) adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, ixgbe_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); - /* - ** Check PCIE slot type/speed/width - */ + /* Check PCIE slot type/speed/width */ ixgbe_get_slot_info(hw); /* Set an initial default flow control value */ adapter->fc = ixgbe_fc_full; + /* Check for certain supported features */ + ixgbe_check_wol_support(adapter); + ixgbe_check_eee_support(adapter); + + /* Add sysctls */ + ixgbe_add_device_sysctls(adapter); + ixgbe_add_hw_stats(adapter); + /* let hardware know driver is loaded */ ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); ctrl_ext |= IXGBE_CTRL_EXT_DRV_LOAD; IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); - ixgbe_add_hw_stats(adapter); - #ifdef DEV_NETMAP ixgbe_netmap_attach(adapter); #endif /* DEV_NETMAP */ @@ -617,8 +608,9 @@ ixgbe_detach(device_t dev) return (EBUSY); } + /* Stop the adapter */ IXGBE_CORE_LOCK(adapter); - ixgbe_stop(adapter); + ixgbe_setup_low_power_mode(adapter); IXGBE_CORE_UNLOCK(adapter); for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { @@ -636,6 +628,7 @@ ixgbe_detach(device_t dev) taskqueue_drain(adapter->tq, &adapter->link_task); taskqueue_drain(adapter->tq, &adapter->mod_task); taskqueue_drain(adapter->tq, &adapter->msf_task); + taskqueue_drain(adapter->tq, &adapter->phy_task); #ifdef IXGBE_FDIR taskqueue_drain(adapter->tq, &adapter->fdir_task); #endif @@ -680,9 +673,77 @@ static int ixgbe_shutdown(device_t dev) { struct adapter *adapter = device_get_softc(dev); + int error = 0; + + INIT_DEBUGOUT("ixgbe_shutdown: begin"); + + IXGBE_CORE_LOCK(adapter); + error = ixgbe_setup_low_power_mode(adapter); + IXGBE_CORE_UNLOCK(adapter); + + return (error); +} + +/** + * Methods for going from: + * D0 -> D3: ixgbe_suspend + * D3 -> D0: ixgbe_resume + */ +static int +ixgbe_suspend(device_t dev) +{ + struct adapter *adapter = device_get_softc(dev); + int error = 0; + + INIT_DEBUGOUT("ixgbe_suspend: begin"); + + IXGBE_CORE_LOCK(adapter); + + error = ixgbe_setup_low_power_mode(adapter); + + /* Save state and power down */ + pci_save_state(dev); + pci_set_powerstate(dev, PCI_POWERSTATE_D3); + + IXGBE_CORE_UNLOCK(adapter); + + return (error); +} + +static int +ixgbe_resume(device_t dev) +{ + struct adapter *adapter = device_get_softc(dev); + struct ifnet *ifp = adapter->ifp; + struct ixgbe_hw *hw = &adapter->hw; + u32 wus; + + INIT_DEBUGOUT("ixgbe_resume: begin"); + IXGBE_CORE_LOCK(adapter); - ixgbe_stop(adapter); + + pci_set_powerstate(dev, PCI_POWERSTATE_D0); + pci_restore_state(dev); + + /* Read & clear WUS register */ + wus = IXGBE_READ_REG(hw, IXGBE_WUS); + if (wus) + device_printf(dev, "Woken up by (WUS): %#010x\n", + IXGBE_READ_REG(hw, IXGBE_WUS)); + IXGBE_WRITE_REG(hw, IXGBE_WUS, 0xffffffff); + /* And clear WUFC until next low-power transition */ + IXGBE_WRITE_REG(hw, IXGBE_WUFC, 0); + + /* + * Required after D3->D0 transition; + * will re-advertise all previous advertised speeds + */ + if (ifp->if_flags & IFF_UP) + ixgbe_init_locked(adapter); + IXGBE_CORE_UNLOCK(adapter); + + INIT_DEBUGOUT("ixgbe_resume: end"); return (0); } @@ -735,13 +796,13 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c break; case SIOCSIFMTU: IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); - if (ifr->ifr_mtu > IXGBE_MAX_FRAME_SIZE - ETHER_HDR_LEN) { + if (ifr->ifr_mtu > IXGBE_MAX_MTU) { error = EINVAL; } else { IXGBE_CORE_LOCK(adapter); ifp->if_mtu = ifr->ifr_mtu; adapter->max_frame_size = - ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + ifp->if_mtu + IXGBE_MTU_HDR; ixgbe_init_locked(adapter); IXGBE_CORE_UNLOCK(adapter); } @@ -890,7 +951,7 @@ ixgbe_init_locked(struct adapter *adapte /* Prepare transmit descriptors and buffers */ if (ixgbe_setup_transmit_structures(adapter)) { - device_printf(dev,"Could not setup transmit structures\n"); + device_printf(dev, "Could not setup transmit structures\n"); ixgbe_stop(adapter); return; } @@ -916,7 +977,7 @@ ixgbe_init_locked(struct adapter *adapte /* Prepare receive descriptors and buffers */ if (ixgbe_setup_receive_structures(adapter)) { - device_printf(dev,"Could not setup receive structures\n"); + device_printf(dev, "Could not setup receive structures\n"); ixgbe_stop(adapter); return; } @@ -931,11 +992,16 @@ ixgbe_init_locked(struct adapter *adapte /* Add for Module detection */ if (hw->mac.type == ixgbe_mac_82599EB) - gpie |= IXGBE_SDP2_GPIEN_BY_MAC(hw); + gpie |= IXGBE_SDP2_GPIEN; - /* Thermal Failure Detection */ - if (hw->mac.type == ixgbe_mac_X540) - gpie |= IXGBE_SDP0_GPIEN_BY_MAC(hw); + /* + * Thermal Failure Detection (X540) + * Link Detection (X552) + */ + if (hw->mac.type == ixgbe_mac_X540 || + hw->device_id == IXGBE_DEV_ID_X550EM_X_SFP || + hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) + gpie |= IXGBE_SDP0_GPIEN_X540; if (adapter->msix > 1) { /* Enable Enhanced MSIX mode */ @@ -947,6 +1013,7 @@ ixgbe_init_locked(struct adapter *adapte /* Set MTU size */ if (ifp->if_mtu > ETHERMTU) { + /* aka IXGBE_MAXFRS on 82599 and newer */ mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD); mhadd &= ~IXGBE_MHADD_MFS_MASK; mhadd |= adapter->max_frame_size << IXGBE_MHADD_MFS_SHIFT; @@ -954,7 +1021,6 @@ ixgbe_init_locked(struct adapter *adapte } /* Now enable all the queues */ - for (int i = 0; i < adapter->num_queues; i++) { txdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(i)); txdctl |= IXGBE_TXDCTL_ENABLE; @@ -1071,55 +1137,25 @@ ixgbe_init_locked(struct adapter *adapte /* Set moderation on the Link interrupt */ IXGBE_WRITE_REG(hw, IXGBE_EITR(adapter->vector), IXGBE_LINK_ITR); + /* Configure Energy Efficient Ethernet for supported devices */ + if (adapter->eee_support) + ixgbe_setup_eee(hw, adapter->eee_enabled); + /* Config/Enable Link */ ixgbe_config_link(adapter); /* Hardware Packet Buffer & Flow Control setup */ - { - u32 rxpb, frame, size, tmp; - - frame = adapter->max_frame_size; - - /* Calculate High Water */ - switch (hw->mac.type) { - case ixgbe_mac_X540: - case ixgbe_mac_X550: - case ixgbe_mac_X550EM_a: - case ixgbe_mac_X550EM_x: - tmp = IXGBE_DV_X540(frame, frame); - break; - default: - tmp = IXGBE_DV(frame, frame); - break; - } - size = IXGBE_BT2KB(tmp); - rxpb = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(0)) >> 10; - hw->fc.high_water[0] = rxpb - size; + ixgbe_config_delay_values(adapter); - /* Now calculate Low Water */ - switch (hw->mac.type) { - case ixgbe_mac_X540: - case ixgbe_mac_X550: - case ixgbe_mac_X550EM_a: - case ixgbe_mac_X550EM_x: - tmp = IXGBE_LOW_DV_X540(frame); - break; - default: - tmp = IXGBE_LOW_DV(frame); - break; - } - hw->fc.low_water[0] = IXGBE_BT2KB(tmp); - - hw->fc.requested_mode = adapter->fc; - hw->fc.pause_time = IXGBE_FC_PAUSE; - hw->fc.send_xon = TRUE; - } /* Initialize the FC settings */ ixgbe_start_hw(hw); /* Set up VLAN support and filter */ ixgbe_setup_vlan_hw_support(adapter); + /* Setup DMA Coalescing */ + ixgbe_config_dmac(adapter); + /* And now turn on interrupts */ ixgbe_enable_intr(adapter); @@ -1140,6 +1176,46 @@ ixgbe_init(void *arg) return; } +static void +ixgbe_config_delay_values(struct adapter *adapter) +{ + struct ixgbe_hw *hw = &adapter->hw; + u32 rxpb, frame, size, tmp; + + frame = adapter->max_frame_size; + + /* Calculate High Water */ + switch (hw->mac.type) { + case ixgbe_mac_X540: + case ixgbe_mac_X550: + case ixgbe_mac_X550EM_x: + tmp = IXGBE_DV_X540(frame, frame); + break; + default: + tmp = IXGBE_DV(frame, frame); + break; + } + size = IXGBE_BT2KB(tmp); + rxpb = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(0)) >> 10; + hw->fc.high_water[0] = rxpb - size; + + /* Now calculate Low Water */ + switch (hw->mac.type) { + case ixgbe_mac_X540: + case ixgbe_mac_X550: + case ixgbe_mac_X550EM_x: + tmp = IXGBE_LOW_DV_X540(frame); + break; + default: + tmp = IXGBE_LOW_DV(frame); + break; + } + hw->fc.low_water[0] = IXGBE_BT2KB(tmp); + + hw->fc.requested_mode = adapter->fc; + hw->fc.pause_time = IXGBE_FC_PAUSE; + hw->fc.send_xon = TRUE; +} /* ** @@ -1270,6 +1346,11 @@ ixgbe_legacy_irq(void *arg) if (reg_eicr & IXGBE_EICR_LSC) taskqueue_enqueue(adapter->tq, &adapter->link_task); + /* External PHY interrupt */ + if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T && + (reg_eicr & IXGBE_EICR_GPI_SDP0_X540)) + taskqueue_enqueue(adapter->tq, &adapter->phy_task); + if (more) taskqueue_enqueue(que->tq, &que->que_task); else @@ -1378,9 +1459,9 @@ ixgbe_msix_link(void *arg) { struct adapter *adapter = arg; struct ixgbe_hw *hw = &adapter->hw; - u32 reg_eicr; + u32 reg_eicr, mod_mask; - ++adapter->vector_irq; + ++adapter->link_irq; /* First get the cause */ reg_eicr = IXGBE_READ_REG(hw, IXGBE_EICS); @@ -1408,42 +1489,46 @@ ixgbe_msix_link(void *arg) device_printf(adapter->dev, "\nCRITICAL: ECC ERROR!! " "Please Reboot!!\n"); IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_ECC); - } else + } - if (ixgbe_is_sfp(hw)) { - if (reg_eicr & IXGBE_EICR_GPI_SDP1) { - IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1_BY_MAC(hw)); - taskqueue_enqueue(adapter->tq, &adapter->msf_task); - } else if (reg_eicr & IXGBE_EICR_GPI_SDP2) { - IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP2_BY_MAC(hw)); - taskqueue_enqueue(adapter->tq, &adapter->mod_task); - } + /* Check for over temp condition */ + if (reg_eicr & IXGBE_EICR_TS) { + device_printf(adapter->dev, "\nCRITICAL: OVER TEMP!! " + "PHY IS SHUT DOWN!!\n"); + device_printf(adapter->dev, "System shutdown required!\n"); + IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_TS); + } + } + + /* Pluggable optics-related interrupt */ + if (hw->device_id == IXGBE_DEV_ID_X550EM_X_SFP) + mod_mask = IXGBE_EICR_GPI_SDP0_X540; + else + mod_mask = IXGBE_EICR_GPI_SDP2_BY_MAC(hw); + + if (ixgbe_is_sfp(hw)) { + if (reg_eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw)) { + IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1_BY_MAC(hw)); + taskqueue_enqueue(adapter->tq, &adapter->msf_task); + } else if (reg_eicr & mod_mask) { + IXGBE_WRITE_REG(hw, IXGBE_EICR, mod_mask); + taskqueue_enqueue(adapter->tq, &adapter->mod_task); } - } + } /* Check for fan failure */ if ((hw->device_id == IXGBE_DEV_ID_82598AT) && - (reg_eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) { + (reg_eicr & IXGBE_EICR_GPI_SDP1)) { + IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1); device_printf(adapter->dev, "\nCRITICAL: FAN FAILURE!! " "REPLACE IMMEDIATELY!!\n"); - IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1_BY_MAC(hw)); } - /* Check for over temp condition */ - switch (hw->mac.type) { - case ixgbe_mac_X540: - case ixgbe_mac_X550: - case ixgbe_mac_X550EM_a: - if (reg_eicr & IXGBE_EICR_TS) { - device_printf(adapter->dev, "\nCRITICAL: OVER TEMP!! " - "PHY IS SHUT DOWN!!\n"); - device_printf(adapter->dev, "System shutdown required\n"); - IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_TS); - } - break; - default: - /* Other MACs have no thermal sensor interrupt */ - break; + /* External PHY interrupt */ + if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T && + (reg_eicr & IXGBE_EICR_GPI_SDP0_X540)) { + IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0_X540); + taskqueue_enqueue(adapter->tq, &adapter->phy_task); } IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_OTHER); @@ -1542,20 +1627,26 @@ ixgbe_media_status(struct ifnet * ifp, s if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) switch (adapter->link_speed) { case IXGBE_LINK_SPEED_10GB_FULL: - ifmr->ifm_active |= IFM_10_T | IFM_FDX; + ifmr->ifm_active |= IFM_10G_SR | IFM_FDX; + break; + case IXGBE_LINK_SPEED_2_5GB_FULL: + ifmr->ifm_active |= IFM_2500_SX | IFM_FDX; break; case IXGBE_LINK_SPEED_1GB_FULL: - ifmr->ifm_active |= IFM_10_5 | IFM_FDX; + ifmr->ifm_active |= IFM_1000_CX | IFM_FDX; break; } - if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4 + else if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4 || layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX) switch (adapter->link_speed) { case IXGBE_LINK_SPEED_10GB_FULL: - ifmr->ifm_active |= IFM_10_2 | IFM_FDX; + ifmr->ifm_active |= IFM_10G_CX4 | IFM_FDX; + break; + case IXGBE_LINK_SPEED_2_5GB_FULL: + ifmr->ifm_active |= IFM_2500_SX | IFM_FDX; break; case IXGBE_LINK_SPEED_1GB_FULL: - ifmr->ifm_active |= IFM_10_5 | IFM_FDX; + ifmr->ifm_active |= IFM_1000_CX | IFM_FDX; break; } @@ -1564,10 +1655,12 @@ ixgbe_media_status(struct ifnet * ifp, s ifmr->ifm_active |= IFM_UNKNOWN; #if __FreeBSD_version >= 900025 - /* Flow control setting */ - if (adapter->fc == ixgbe_fc_rx_pause || adapter->fc == ixgbe_fc_full) + /* Display current flow control setting used on link */ + if (hw->fc.current_mode == ixgbe_fc_rx_pause || + hw->fc.current_mode == ixgbe_fc_full) ifmr->ifm_active |= IFM_ETH_RXPAUSE; - if (adapter->fc == ixgbe_fc_tx_pause || adapter->fc == ixgbe_fc_full) + if (hw->fc.current_mode == ixgbe_fc_tx_pause || + hw->fc.current_mode == ixgbe_fc_full) ifmr->ifm_active |= IFM_ETH_TXPAUSE; #endif @@ -1597,21 +1690,22 @@ ixgbe_media_change(struct ifnet * ifp) if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) return (EINVAL); + if (hw->phy.media_type == ixgbe_media_type_backplane) + return (EPERM); + /* ** We don't actually need to check against the supported ** media types of the adapter; ifmedia will take care of ** that for us. - ** NOTE: this relies on falling thru the switch - ** to get all the values set, it can be confusing. */ switch (IFM_SUBTYPE(ifm->ifm_media)) { case IFM_AUTO: case IFM_10G_T: speed |= IXGBE_LINK_SPEED_100_FULL; case IFM_10G_LRM: - case IFM_10G_SR: /* KR, too */ + case IFM_10G_SR: /* KR, too */ case IFM_10G_LR: - case IFM_10G_CX4: /* KX4 for now */ + case IFM_10G_CX4: /* KX4 */ speed |= IXGBE_LINK_SPEED_1GB_FULL; case IFM_10G_TWINAX: speed |= IXGBE_LINK_SPEED_10GB_FULL; @@ -1620,7 +1714,7 @@ ixgbe_media_change(struct ifnet * ifp) speed |= IXGBE_LINK_SPEED_100_FULL; case IFM_1000_LX: case IFM_1000_SX: - case IFM_1000_CX: /* KX until there's real support */ + case IFM_1000_CX: /* KX */ speed |= IXGBE_LINK_SPEED_1GB_FULL; break; case IFM_100_TX: @@ -1640,7 +1734,7 @@ ixgbe_media_change(struct ifnet * ifp) return (0); invalid: - device_printf(adapter->dev, "Invalid media type\n"); + device_printf(adapter->dev, "Invalid media type!\n"); return (EINVAL); } @@ -1865,7 +1959,6 @@ ixgbe_update_link_status(struct adapter struct ifnet *ifp = adapter->ifp; device_t dev = adapter->dev; - if (adapter->link_up){ if (adapter->link_active == FALSE) { if (bootverbose) @@ -1875,6 +1968,8 @@ ixgbe_update_link_status(struct adapter adapter->link_active = TRUE; /* Update any Flow Control changes */ ixgbe_fc_enable(&adapter->hw); + /* Update DMA coalescing config */ + ixgbe_config_dmac(adapter); if_link_state_change(ifp, LINK_STATE_UP); } } else { /* Link down */ @@ -1961,7 +2056,7 @@ ixgbe_identify_hardware(struct adapter * /* We need this here to set the num_segs below */ ixgbe_set_mac_type(hw); - /* Pick up the 82599 and VF settings */ + /* Pick up the 82599 settings */ if (hw->mac.type != ixgbe_mac_82598EB) { hw->phy.smart_speed = ixgbe_smart_speed; adapter->num_segs = IXGBE_82599_SCATTER; @@ -2071,6 +2166,7 @@ ixgbe_allocate_legacy(struct adapter *ad TASK_INIT(&adapter->link_task, 0, ixgbe_handle_link, adapter); TASK_INIT(&adapter->mod_task, 0, ixgbe_handle_mod, adapter); TASK_INIT(&adapter->msf_task, 0, ixgbe_handle_msf, adapter); + TASK_INIT(&adapter->phy_task, 0, ixgbe_handle_phy, adapter); #ifdef IXGBE_FDIR TASK_INIT(&adapter->fdir_task, 0, ixgbe_reinit_fdir, adapter); #endif @@ -2111,30 +2207,6 @@ ixgbe_allocate_msix(struct adapter *adap int error, rid, vector = 0; int cpu_id = 0; -#ifdef RSS - /* - * If we're doing RSS, the number of queues needs to - * match the number of RSS buckets that are configured. - * - * + If there's more queues than RSS buckets, we'll end - * up with queues that get no traffic. - * - * + If there's more RSS buckets than queues, we'll end - * up having multiple RSS buckets map to the same queue, - * so there'll be some contention. - */ - if (adapter->num_queues != rss_getnumbuckets()) { - device_printf(dev, - "%s: number of queues (%d) != number of RSS buckets (%d)" - "; performance will be impacted.\n", - __func__, - adapter->num_queues, - rss_getnumbuckets()); - } -#endif - - - for (int i = 0; i < adapter->num_queues; i++, vector++, que++, txr++) { rid = vector + 1; que->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, @@ -2158,14 +2230,6 @@ ixgbe_allocate_msix(struct adapter *adap #endif que->msix = vector; adapter->active_queues |= (u64)(1 << que->msix); -#ifdef RSS - /* - * The queue ID is used as the RSS layer bucket ID. - * We look up the queue ID -> RSS CPU ID and select - * that. - */ - cpu_id = rss_getcpu(i % rss_getnumbuckets()); -#else /* * Bind the msix vector, and thus the * rings to the corresponding cpu. @@ -2175,39 +2239,18 @@ ixgbe_allocate_msix(struct adapter *adap */ if (adapter->num_queues > 1) cpu_id = i; -#endif + if (adapter->num_queues > 1) bus_bind_intr(dev, que->res, cpu_id); -#ifdef RSS - device_printf(dev, - "Bound RSS bucket %d to CPU %d\n", - i, cpu_id); -#else -#if 0 // This is too noisy - device_printf(dev, - "Bound queue %d to cpu %d\n", - i, cpu_id); -#endif -#endif - - #ifndef IXGBE_LEGACY_TX TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); #endif TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, taskqueue_thread_enqueue, &que->tq); -#ifdef RSS - taskqueue_start_threads_pinned(&que->tq, 1, PI_NET, - cpu_id, - "%s (bucket %d)", - device_get_nameunit(adapter->dev), - cpu_id); -#else taskqueue_start_threads(&que->tq, 1, PI_NET, "%s que", device_get_nameunit(adapter->dev)); -#endif } /* and Link */ @@ -2236,6 +2279,7 @@ ixgbe_allocate_msix(struct adapter *adap TASK_INIT(&adapter->link_task, 0, ixgbe_handle_link, adapter); TASK_INIT(&adapter->mod_task, 0, ixgbe_handle_mod, adapter); TASK_INIT(&adapter->msf_task, 0, ixgbe_handle_msf, adapter); + TASK_INIT(&adapter->phy_task, 0, ixgbe_handle_phy, adapter); #ifdef IXGBE_FDIR TASK_INIT(&adapter->fdir_task, 0, ixgbe_reinit_fdir, adapter); #endif @@ -2282,12 +2326,6 @@ ixgbe_setup_msix(struct adapter *adapter /* Figure out a reasonable auto config value */ queues = (mp_ncpus > (msgs-1)) ? (msgs-1) : mp_ncpus; -#ifdef RSS - /* If we're doing RSS, clamp at the number of RSS buckets */ - if (queues > rss_getnumbuckets()) - queues = rss_getnumbuckets(); -#endif - if (ixgbe_num_queues != 0) queues = ixgbe_num_queues; @@ -2461,6 +2499,12 @@ ixgbe_setup_interface(device_t dev, stru #if __FreeBSD_version >= 1100036 if_setgetcounterfn(ifp, ixgbe_get_counter); #endif +#if __FreeBSD_version >= 1100045 + /* TSO parameters */ + ifp->if_hw_tsomax = 65518; + ifp->if_hw_tsomaxsegcount = IXGBE_82599_SCATTER; + ifp->if_hw_tsomaxsegsize = 2048; +#endif #ifndef IXGBE_LEGACY_TX ifp->if_transmit = ixgbe_mq_start; ifp->if_qflush = ixgbe_qflush; @@ -2544,10 +2588,6 @@ ixgbe_add_media_types(struct adapter *ad ifmedia_add(&adapter->media, IFM_ETHER | IFM_10G_CX4, 0, NULL); if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX) ifmedia_add(&adapter->media, IFM_ETHER | IFM_1000_SX, 0, NULL); -#if 0 - if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_LX) - ifmedia_add(&adapter->media, IFM_ETHER | IFM_1000_LX, 0, NULL); -#endif /* ** Other (no matching FreeBSD media type): @@ -2556,25 +2596,24 @@ ixgbe_add_media_types(struct adapter *ad */ if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) { device_printf(dev, "Media supported: 10GbaseKR\n"); - device_printf(dev, "10GbaseKR mapped to 10baseT\n"); - ifmedia_add(&adapter->media, IFM_ETHER | IFM_10_T, 0, NULL); + device_printf(dev, "10GbaseKR mapped to 10GbaseSR\n"); + ifmedia_add(&adapter->media, IFM_ETHER | IFM_10G_SR, 0, NULL); } if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) { device_printf(dev, "Media supported: 10GbaseKX4\n"); - device_printf(dev, "10GbaseKX4 mapped to 10base2\n"); - ifmedia_add(&adapter->media, IFM_ETHER | IFM_10_2, 0, NULL); + device_printf(dev, "10GbaseKX4 mapped to 10GbaseCX4\n"); + ifmedia_add(&adapter->media, IFM_ETHER | IFM_10G_CX4, 0, NULL); } if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_KX) { device_printf(dev, "Media supported: 1000baseKX\n"); - device_printf(dev, "1000baseKX mapped to 10base5\n"); - ifmedia_add(&adapter->media, IFM_ETHER | IFM_10_5, 0, NULL); + device_printf(dev, "1000baseKX mapped to 1000baseCX\n"); + ifmedia_add(&adapter->media, IFM_ETHER | IFM_1000_CX, 0, NULL); } if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX) { /* Someday, someone will care about you... */ device_printf(dev, "Media supported: 1000baseBX\n"); } - /* Very old */ if (hw->device_id == IXGBE_DEV_ID_82598AT) { ifmedia_add(&adapter->media, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); @@ -2702,38 +2741,36 @@ ixgbe_initialise_rss_mapping(struct adap { struct ixgbe_hw *hw = &adapter->hw; uint32_t reta; - int i, j, queue_id; + int i, j, queue_id, table_size; + int index_mult; uint32_t rss_key[10]; uint32_t mrqc; -#ifdef RSS - uint32_t rss_hash_config; -#endif /* Setup RSS */ reta = 0; -#ifdef RSS - /* Fetch the configured RSS key */ - rss_getkey((uint8_t *) &rss_key); -#else /* set up random bits */ arc4rand(&rss_key, sizeof(rss_key), 0); -#endif + + /* Set multiplier for RETA setup and table size based on MAC */ + index_mult = 0x1; + table_size = 128; + switch (adapter->hw.mac.type) { + case ixgbe_mac_82598EB: + index_mult = 0x11; + break; + case ixgbe_mac_X550: + case ixgbe_mac_X550EM_x: + table_size = 512; + break; + default: + break; + } /* Set up the redirection table */ - for (i = 0, j = 0; i < 128; i++, j++) { + for (i = 0, j = 0; i < table_size; i++, j++) { if (j == adapter->num_queues) j = 0; -#ifdef RSS - /* - * Fetch the RSS bucket id for the given indirection entry. - * Cap it at the number of configured buckets (which is - * num_queues.) - */ - queue_id = rss_get_indirection_to_bucket(i); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"