From owner-svn-src-stable-11@freebsd.org Fri May 10 00:46:46 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E6F3159262C; Fri, 10 May 2019 00:46:46 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C651089079; Fri, 10 May 2019 00:46:45 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AC0224C23; Fri, 10 May 2019 00:46:45 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4A0kjAQ083409; Fri, 10 May 2019 00:46:45 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4A0kiXE083400; Fri, 10 May 2019 00:46:44 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201905100046.x4A0kiXE083400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Fri, 10 May 2019 00:46:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347419 - stable/11/sys/dev/ixgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/11/sys/dev/ixgbe X-SVN-Commit-Revision: 347419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C651089079 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.992,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 May 2019 00:46:46 -0000 Author: erj Date: Fri May 10 00:46:43 2019 New Revision: 347419 URL: https://svnweb.freebsd.org/changeset/base/347419 Log: ix(4): Move {mod,msf,mbx,fdir,phy,link}_task to lock protected handler This patch introduces adapter->task_requests register responsible for recording requests for mod_task, msf_task, mbx_task, fdir_task, phy_task and link_task calls. Instead of enqueueing each of these tasks with GROUPTASK_ENQUEUE, new task is created and all handlers are called from one task while holding adapter->core_mtx lock. SIOCGIFXMEDIA ioctl() call reads adapter->media list. The list is deleted and rewritten in ixgbe_handle_msf() task without holding adapter->core_mtx lock. This change is needed to maintain data coherency when sharing adapter info via ioctl() calls. Since handlers for abovementioned tasks will no longer act as task handlers, but as regular functions, 'pending' parameter is removed from them. This patch also removes ixgbe_update_link_status() call from ixgbe_handle_link() handler. From now on, link status will be updated by calling ixgbe_update_link_status() periodically from ixgbe_local_timer(). This fixes problem with link flapping during changing interface state to UP. Parameter keep_traffic is added to ixgbe_disable_intr(). This enables ixgbe_handle_admin_task() to not disable and queue interrupts. Accordingly, skip_traffic parameter is added to ixgbe_enable_intr() to let ixgbe_handle_admin_task() skip enabling queues while enabling interrupts. This patch is a port of r343621. r343621 can't be merged from current since stable/11 contains ixgbe driver without iflib support. Patch co-authored by Krzysztof Galazka . Submitted by: Piotr Pietruszewski Reviewed by: #IntelNetworking Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D19711 Modified: stable/11/sys/dev/ixgbe/if_fdir.c stable/11/sys/dev/ixgbe/if_ix.c stable/11/sys/dev/ixgbe/if_sriov.c stable/11/sys/dev/ixgbe/ixgbe.h stable/11/sys/dev/ixgbe/ixgbe_fdir.h stable/11/sys/dev/ixgbe/ixgbe_sriov.h stable/11/sys/dev/ixgbe/ixgbe_type.h Modified: stable/11/sys/dev/ixgbe/if_fdir.c ============================================================================== --- stable/11/sys/dev/ixgbe/if_fdir.c Fri May 10 00:41:42 2019 (r347418) +++ stable/11/sys/dev/ixgbe/if_fdir.c Fri May 10 00:46:43 2019 (r347419) @@ -50,7 +50,7 @@ ixgbe_init_fdir(struct adapter *adapter) } /* ixgbe_init_fdir */ void -ixgbe_reinit_fdir(void *context, int pending) +ixgbe_reinit_fdir(void *context) { struct adapter *adapter = context; struct ifnet *ifp = adapter->ifp; @@ -146,9 +146,9 @@ ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) /* TASK_INIT needs this function defined regardless if it's enabled */ void -ixgbe_reinit_fdir(void *context, int pending) +ixgbe_reinit_fdir(void *context) { - UNREFERENCED_2PARAMETER(context, pending); + UNREFERENCED_1PARAMETER(context); } /* ixgbe_reinit_fdir */ void Modified: stable/11/sys/dev/ixgbe/if_ix.c ============================================================================== --- stable/11/sys/dev/ixgbe/if_ix.c Fri May 10 00:41:42 2019 (r347418) +++ stable/11/sys/dev/ixgbe/if_ix.c Fri May 10 00:46:43 2019 (r347419) @@ -156,8 +156,8 @@ static void ixgbe_enable_rx_drop(struct adapter *) static void ixgbe_disable_rx_drop(struct adapter *); static void ixgbe_initialize_rss_mapping(struct adapter *); -static void ixgbe_enable_intr(struct adapter *); -static void ixgbe_disable_intr(struct adapter *); +static void ixgbe_enable_intr(struct adapter *, bool); +static void ixgbe_disable_intr(struct adapter *, bool); static void ixgbe_update_stats_counters(struct adapter *); static void ixgbe_set_promisc(struct adapter *); static void ixgbe_set_multi(struct adapter *); @@ -209,10 +209,11 @@ static void ixgbe_msix_link(void *); /* Deferred interrupt tasklets */ 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); +static void ixgbe_handle_link(void *); +static void ixgbe_handle_msf(void *); +static void ixgbe_handle_mod(void *); +static void ixgbe_handle_phy(void *); +static void ixgbe_handle_admin_task(void *, int); /************************************************************************ @@ -929,6 +930,15 @@ ixgbe_attach(device_t dev) if (adapter->feat_en & IXGBE_FEATURE_NETMAP) ixgbe_netmap_attach(adapter); + /* Initialize Admin Task */ + TASK_INIT(&adapter->admin_task, 0, ixgbe_handle_admin_task, adapter); + + /* Initialize task queue */ + adapter->tq = taskqueue_create_fast("ixgbe_admin", M_NOWAIT, + taskqueue_thread_enqueue, &adapter->tq); + taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s admintaskq", + device_get_nameunit(adapter->dev)); + INIT_DEBUGOUT("ixgbe_attach: end"); return (0); @@ -1250,9 +1260,12 @@ ixgbe_config_link(struct adapter *adapter) if (hw->phy.multispeed_fiber) { hw->mac.ops.setup_sfp(hw); ixgbe_enable_tx_laser(hw); - taskqueue_enqueue(adapter->tq, &adapter->msf_task); - } else - taskqueue_enqueue(adapter->tq, &adapter->mod_task); + adapter->task_requests |= IXGBE_REQUEST_TASK_MSF; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); + } else { + adapter->task_requests |= IXGBE_REQUEST_TASK_MOD; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); + } } else { if (hw->mac.ops.check_link) err = ixgbe_check_link(hw, &adapter->link_speed, @@ -2351,7 +2364,8 @@ ixgbe_msix_link(void *arg) /* Link status change */ if (eicr & IXGBE_EICR_LSC) { IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_LSC); - taskqueue_enqueue(adapter->tq, &adapter->link_task); + adapter->task_requests |= IXGBE_REQUEST_TASK_LINK; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); } if (adapter->hw.mac.type != ixgbe_mac_82598EB) { @@ -2362,7 +2376,8 @@ ixgbe_msix_link(void *arg) return; /* Disable the interrupt */ IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_FLOW_DIR); - taskqueue_enqueue(adapter->tq, &adapter->fdir_task); + adapter->task_requests |= IXGBE_REQUEST_TASK_FDIR; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); } if (eicr & IXGBE_EICR_ECC) { @@ -2402,8 +2417,10 @@ ixgbe_msix_link(void *arg) /* Check for VF message */ if ((adapter->feat_en & IXGBE_FEATURE_SRIOV) && - (eicr & IXGBE_EICR_MAILBOX)) - taskqueue_enqueue(adapter->tq, &adapter->mbx_task); + (eicr & IXGBE_EICR_MAILBOX)) { + adapter->task_requests |= IXGBE_REQUEST_TASK_MBX; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); + } } if (ixgbe_is_sfp(hw)) { @@ -2415,14 +2432,16 @@ ixgbe_msix_link(void *arg) if (eicr & eicr_mask) { IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr_mask); - taskqueue_enqueue(adapter->tq, &adapter->mod_task); + adapter->task_requests |= IXGBE_REQUEST_TASK_MOD; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); } if ((hw->mac.type == ixgbe_mac_82599EB) && (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); + adapter->task_requests |= IXGBE_REQUEST_TASK_MSF; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); } } @@ -2436,11 +2455,9 @@ ixgbe_msix_link(void *arg) if ((hw->phy.type == ixgbe_phy_x550em_ext_t) && (eicr & IXGBE_EICR_GPI_SDP0_X540)) { IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP0_X540); - taskqueue_enqueue(adapter->tq, &adapter->phy_task); + adapter->task_requests |= IXGBE_REQUEST_TASK_PHY; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); } - - /* Re-enable other interrupts */ - IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_OTHER); } /* ixgbe_msix_link */ /************************************************************************ @@ -2627,19 +2644,6 @@ ixgbe_detach(device_t dev) } } - /* Drain the Link queue */ - if (adapter->tq) { - taskqueue_drain(adapter->tq, &adapter->link_task); - taskqueue_drain(adapter->tq, &adapter->mod_task); - taskqueue_drain(adapter->tq, &adapter->msf_task); - if (adapter->feat_cap & IXGBE_FEATURE_SRIOV) - taskqueue_drain(adapter->tq, &adapter->mbx_task); - taskqueue_drain(adapter->tq, &adapter->phy_task); - if (adapter->feat_en & IXGBE_FEATURE_FDIR) - taskqueue_drain(adapter->tq, &adapter->fdir_task); - taskqueue_free(adapter->tq); - } - /* let hardware know driver is unloading */ ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT); ctrl_ext &= ~IXGBE_CTRL_EXT_DRV_LOAD; @@ -2656,6 +2660,12 @@ ixgbe_detach(device_t dev) if (adapter->feat_en & IXGBE_FEATURE_NETMAP) netmap_detach(adapter->ifp); + /* Drain the Admin Task queue */ + if (adapter->tq) { + taskqueue_drain(adapter->tq, &adapter->admin_task); + taskqueue_free(adapter->tq); + } + ixgbe_free_pci_resources(adapter); bus_generic_detach(dev); if_free(adapter->ifp); @@ -2913,6 +2923,10 @@ ixgbe_init_locked(struct adapter *adapter) /* Configure RX settings */ ixgbe_initialize_receive_units(adapter); + /* Initialize variable holding task enqueue requests + * generated by interrupt handlers */ + adapter->task_requests = 0; + /* Enable SDP & MSI-X interrupts based on adapter */ ixgbe_config_gpie(adapter); @@ -3055,7 +3069,7 @@ ixgbe_init_locked(struct adapter *adapter) ixgbe_config_dmac(adapter); /* And now turn on interrupts */ - ixgbe_enable_intr(adapter); + ixgbe_enable_intr(adapter, false); /* Enable the use of the MBX by the VF's */ if (adapter->feat_en & IXGBE_FEATURE_SRIOV) { @@ -3463,7 +3477,7 @@ out: * ixgbe_handle_mod - Tasklet for SFP module interrupts ************************************************************************/ static void -ixgbe_handle_mod(void *context, int pending) +ixgbe_handle_mod(void *context) { struct adapter *adapter = context; struct ixgbe_hw *hw = &adapter->hw; @@ -3493,16 +3507,21 @@ ixgbe_handle_mod(void *context, int pending) if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { device_printf(dev, "Unsupported SFP+ module type was detected.\n"); - return; + goto handle_mod_out; } err = hw->mac.ops.setup_sfp(hw); if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { device_printf(dev, "Setup failure - unsupported SFP+ module type.\n"); - return; + goto handle_mod_out; } - taskqueue_enqueue(adapter->tq, &adapter->msf_task); + adapter->task_requests |= IXGBE_REQUEST_TASK_MSF; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); + return; + +handle_mod_out: + adapter->task_requests &= ~(IXGBE_REQUEST_TASK_MSF); } /* ixgbe_handle_mod */ @@ -3510,7 +3529,7 @@ ixgbe_handle_mod(void *context, int pending) * ixgbe_handle_msf - Tasklet for MSF (multispeed fiber) interrupts ************************************************************************/ static void -ixgbe_handle_msf(void *context, int pending) +ixgbe_handle_msf(void *context) { struct adapter *adapter = context; struct ixgbe_hw *hw = &adapter->hw; @@ -3536,7 +3555,7 @@ ixgbe_handle_msf(void *context, int pending) * ixgbe_handle_phy - Tasklet for external PHY interrupts ************************************************************************/ static void -ixgbe_handle_phy(void *context, int pending) +ixgbe_handle_phy(void *context) { struct adapter *adapter = context; struct ixgbe_hw *hw = &adapter->hw; @@ -3551,6 +3570,36 @@ ixgbe_handle_phy(void *context, int pending) } /* ixgbe_handle_phy */ /************************************************************************ + * ixgbe_handle_admin_task - Handler for interrupt tasklets meant to be + * called in separate task. + ************************************************************************/ +static void +ixgbe_handle_admin_task(void *context, int pending) +{ + struct adapter *adapter = context; + + IXGBE_CORE_LOCK(adapter); + ixgbe_disable_intr(adapter, true); + + if (adapter->task_requests & IXGBE_REQUEST_TASK_MOD) + ixgbe_handle_mod(adapter); + if (adapter->task_requests & IXGBE_REQUEST_TASK_MSF) + ixgbe_handle_msf(adapter); + if (adapter->task_requests & IXGBE_REQUEST_TASK_MBX) + ixgbe_handle_mbx(adapter); + if (adapter->task_requests & IXGBE_REQUEST_TASK_FDIR) + ixgbe_reinit_fdir(adapter); + if (adapter->task_requests & IXGBE_REQUEST_TASK_PHY) + ixgbe_handle_phy(adapter); + if (adapter->task_requests & IXGBE_REQUEST_TASK_LINK) + ixgbe_handle_link(adapter); + adapter->task_requests = 0; + + ixgbe_enable_intr(adapter, true); + IXGBE_CORE_UNLOCK(adapter); +} /* ixgbe_handle_admin_task */ + +/************************************************************************ * ixgbe_stop - Stop the hardware * * Disables all traffic on the adapter by issuing a @@ -3568,7 +3617,7 @@ ixgbe_stop(void *arg) mtx_assert(&adapter->core_mtx, MA_OWNED); INIT_DEBUGOUT("ixgbe_stop: begin\n"); - ixgbe_disable_intr(adapter); + ixgbe_disable_intr(adapter, false); callout_stop(&adapter->timer); /* Let the stack know...*/ @@ -3662,9 +3711,13 @@ ixgbe_config_dmac(struct adapter *adapter) /************************************************************************ * ixgbe_enable_intr + * If skip_traffic parameter is set, queues' irqs are not enabled. + * This is useful while reenabling interrupts after disabling them + * with ixgbe_disable_intr() 'keep_traffic' parameter set to true + * as queues' interrupts are already enabled. ************************************************************************/ static void -ixgbe_enable_intr(struct adapter *adapter) +ixgbe_enable_intr(struct adapter *adapter, bool skip_traffic) { struct ixgbe_hw *hw = &adapter->hw; struct ix_queue *que = adapter->queues; @@ -3732,13 +3785,15 @@ ixgbe_enable_intr(struct adapter *adapter) IXGBE_WRITE_REG(hw, IXGBE_EIAC, mask); } - /* - * Now enable all queues, this is done separately to - * allow for handling the extended (beyond 32) MSI-X - * vectors that can be used by 82599 - */ - for (int i = 0; i < adapter->num_queues; i++, que++) - ixgbe_enable_queue(adapter, que->msix); + if (!skip_traffic) { + /* + * Now enable all queues, this is done separately to + * allow for handling the extended (beyond 32) MSI-X + * vectors that can be used by 82599 + */ + for (int i = 0; i < adapter->num_queues; i++, que++) + ixgbe_enable_queue(adapter, que->msix); + } IXGBE_WRITE_FLUSH(hw); @@ -3747,21 +3802,39 @@ ixgbe_enable_intr(struct adapter *adapter) /************************************************************************ * ixgbe_disable_intr + * If keep_traffic parameter is set, queue interrupts are not disabled. + * This is needed by ixgbe_handle_admin_task() to handle link specific + * interrupt procedures without stopping the traffic. ************************************************************************/ static void -ixgbe_disable_intr(struct adapter *adapter) +ixgbe_disable_intr(struct adapter *adapter, bool keep_traffic) { - if (adapter->msix_mem) - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIAC, 0); - if (adapter->hw.mac.type == ixgbe_mac_82598EB) { - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, ~0); + struct ixgbe_hw *hw = &adapter->hw; + u32 eiac_mask, eimc_mask, eimc_ext_mask; + + if (keep_traffic) { + /* Autoclear only queue irqs */ + eiac_mask = IXGBE_EICR_RTX_QUEUE; + + /* Disable everything but queue irqs */ + eimc_mask = ~0; + eimc_mask &= ~IXGBE_EIMC_RTX_QUEUE; + eimc_ext_mask = 0; } else { - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, 0xFFFF0000); - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(0), ~0); - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC_EX(1), ~0); + eiac_mask = 0; + eimc_mask = (hw->mac.type == ixgbe_mac_82598EB) ? ~0 : 0xFFFF0000; + eimc_ext_mask = ~0; } - IXGBE_WRITE_FLUSH(&adapter->hw); + if (adapter->msix_mem) + IXGBE_WRITE_REG(hw, IXGBE_EIAC, eiac_mask); + + IXGBE_WRITE_REG(hw, IXGBE_EIMC, eimc_mask); + IXGBE_WRITE_REG(hw, IXGBE_EIMC_EX(0), eimc_ext_mask); + IXGBE_WRITE_REG(hw, IXGBE_EIMC_EX(1), eimc_ext_mask); + + IXGBE_WRITE_FLUSH(hw); + return; } /* ixgbe_disable_intr */ @@ -3786,7 +3859,7 @@ ixgbe_legacy_irq(void *arg) ++que->irqs; if (eicr == 0) { - ixgbe_enable_intr(adapter); + ixgbe_enable_intr(adapter, false); return; } @@ -3807,8 +3880,10 @@ ixgbe_legacy_irq(void *arg) } /* Link status change */ - if (eicr & IXGBE_EICR_LSC) - taskqueue_enqueue(adapter->tq, &adapter->link_task); + if (eicr & IXGBE_EICR_LSC){ + adapter->task_requests |= IXGBE_REQUEST_TASK_LINK; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); + } if (ixgbe_is_sfp(hw)) { /* Pluggable optics-related interrupt */ @@ -3819,26 +3894,30 @@ ixgbe_legacy_irq(void *arg) if (eicr & eicr_mask) { IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr_mask); - taskqueue_enqueue(adapter->tq, &adapter->mod_task); + adapter->task_requests |= IXGBE_REQUEST_TASK_MOD; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); } if ((hw->mac.type == ixgbe_mac_82599EB) && (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); + adapter->task_requests |= IXGBE_REQUEST_TASK_MSF; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); } } /* External PHY interrupt */ if ((hw->phy.type == ixgbe_phy_x550em_ext_t) && - (eicr & IXGBE_EICR_GPI_SDP0_X540)) - taskqueue_enqueue(adapter->tq, &adapter->phy_task); + (eicr & IXGBE_EICR_GPI_SDP0_X540)) { + adapter->task_requests |= IXGBE_REQUEST_TASK_PHY; + taskqueue_enqueue(adapter->tq, &adapter->admin_task); + } if (more) taskqueue_enqueue(que->tq, &que->que_task); else - ixgbe_enable_intr(adapter); + ixgbe_enable_intr(adapter, false); return; } /* ixgbe_legacy_irq */ @@ -4768,9 +4847,9 @@ ixgbe_ioctl(struct ifnet *ifp, u_long command, caddr_t IOCTL_DEBUGOUT("ioctl: SIOC(ADD|DEL)MULTI"); if (ifp->if_drv_flags & IFF_DRV_RUNNING) { IXGBE_CORE_LOCK(adapter); - ixgbe_disable_intr(adapter); + ixgbe_disable_intr(adapter, false); ixgbe_set_multi(adapter); - ixgbe_enable_intr(adapter); + ixgbe_enable_intr(adapter, false); IXGBE_CORE_UNLOCK(adapter); } break; @@ -4893,7 +4972,7 @@ ixgbe_handle_que(void *context, int pending) if (que->res != NULL) ixgbe_enable_queue(adapter, que->msix); else - ixgbe_enable_intr(adapter); + ixgbe_enable_intr(adapter, false); return; } /* ixgbe_handle_que */ @@ -4932,27 +5011,13 @@ ixgbe_allocate_legacy(struct adapter *adapter) taskqueue_start_threads(&que->tq, 1, PI_NET, "%s ixq", device_get_nameunit(adapter->dev)); - /* Tasklets for Link, SFP and Multispeed Fiber */ - 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); - if (adapter->feat_en & IXGBE_FEATURE_FDIR) - TASK_INIT(&adapter->fdir_task, 0, ixgbe_reinit_fdir, adapter); - adapter->tq = taskqueue_create_fast("ixgbe_link", M_NOWAIT, - taskqueue_thread_enqueue, &adapter->tq); - taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s linkq", - device_get_nameunit(adapter->dev)); - if ((error = bus_setup_intr(dev, adapter->res, INTR_TYPE_NET | INTR_MPSAFE, NULL, ixgbe_legacy_irq, que, &adapter->tag)) != 0) { device_printf(dev, "Failed to register fast interrupt handler: %d\n", error); taskqueue_free(que->tq); - taskqueue_free(adapter->tq); que->tq = NULL; - adapter->tq = NULL; return (error); } @@ -5093,20 +5158,6 @@ ixgbe_allocate_msix(struct adapter *adapter) bus_describe_intr(dev, adapter->res, adapter->tag, "link"); #endif adapter->vector = vector; - /* Tasklets for Link, SFP and Multispeed Fiber */ - 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); - if (adapter->feat_cap & IXGBE_FEATURE_SRIOV) - TASK_INIT(&adapter->mbx_task, 0, ixgbe_handle_mbx, adapter); - TASK_INIT(&adapter->phy_task, 0, ixgbe_handle_phy, adapter); - if (adapter->feat_en & IXGBE_FEATURE_FDIR) - TASK_INIT(&adapter->fdir_task, 0, ixgbe_reinit_fdir, adapter); - adapter->tq = taskqueue_create_fast("ixgbe_link", M_NOWAIT, - taskqueue_thread_enqueue, &adapter->tq); - taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s linkq", - device_get_nameunit(adapter->dev)); - return (0); } /* ixgbe_allocate_msix */ @@ -5232,13 +5283,12 @@ msi: * Done outside of interrupt context since the driver might sleep ************************************************************************/ static void -ixgbe_handle_link(void *context, int pending) +ixgbe_handle_link(void *context) { struct adapter *adapter = context; struct ixgbe_hw *hw = &adapter->hw; ixgbe_check_link(hw, &adapter->link_speed, &adapter->link_up, 0); - ixgbe_update_link_status(adapter); /* Re-enable link interrupts */ IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_LSC); Modified: stable/11/sys/dev/ixgbe/if_sriov.c ============================================================================== --- stable/11/sys/dev/ixgbe/if_sriov.c Fri May 10 00:41:42 2019 (r347418) +++ stable/11/sys/dev/ixgbe/if_sriov.c Fri May 10 00:46:43 2019 (r347419) @@ -620,7 +620,7 @@ ixgbe_process_vf_msg(struct adapter *adapter, struct i /* Tasklet for handling VF -> PF mailbox messages */ void -ixgbe_handle_mbx(void *context, int pending) +ixgbe_handle_mbx(void *context) { struct adapter *adapter; struct ixgbe_hw *hw; @@ -898,9 +898,9 @@ ixgbe_add_vf(device_t dev, u16 vfnum, const nvlist_t * #else void -ixgbe_handle_mbx(void *context, int pending) +ixgbe_handle_mbx(void *context) { - UNREFERENCED_2PARAMETER(context, pending); + UNREFERENCED_1PARAMETER(context); } /* ixgbe_handle_mbx */ inline int Modified: stable/11/sys/dev/ixgbe/ixgbe.h ============================================================================== --- stable/11/sys/dev/ixgbe/ixgbe.h Fri May 10 00:41:42 2019 (r347418) +++ stable/11/sys/dev/ixgbe/ixgbe.h Fri May 10 00:46:43 2019 (r347419) @@ -464,17 +464,15 @@ struct adapter { /* Support for pluggable optics */ bool sfp_probe; - struct task link_task; /* Link tasklet */ - struct task mod_task; /* SFP tasklet */ - struct task msf_task; /* Multispeed Fiber */ - struct task mbx_task; /* VF -> PF mailbox interrupt */ + struct task link_task; /* Link tasklet */ /* Flow Director */ int fdir_reinit; - struct task fdir_task; - struct task phy_task; /* PHY intr tasklet */ - struct taskqueue *tq; + /* Admin task */ + struct taskqueue *tq; + struct task admin_task; + u32 task_requests; /* * Queues: Modified: stable/11/sys/dev/ixgbe/ixgbe_fdir.h ============================================================================== --- stable/11/sys/dev/ixgbe/ixgbe_fdir.h Fri May 10 00:41:42 2019 (r347418) +++ stable/11/sys/dev/ixgbe/ixgbe_fdir.h Fri May 10 00:46:43 2019 (r347419) @@ -52,7 +52,7 @@ void ixgbe_init_fdir(struct adapter *); #endif -void ixgbe_reinit_fdir(void *, int); +void ixgbe_reinit_fdir(void *); void ixgbe_atr(struct tx_ring *, struct mbuf *); #endif /* _IXGBE_FDIR_H_ */ Modified: stable/11/sys/dev/ixgbe/ixgbe_sriov.h ============================================================================== --- stable/11/sys/dev/ixgbe/ixgbe_sriov.h Fri May 10 00:41:42 2019 (r347418) +++ stable/11/sys/dev/ixgbe/ixgbe_sriov.h Fri May 10 00:46:43 2019 (r347419) @@ -96,7 +96,7 @@ u32 ixgbe_get_mrqc(int); #endif /* PCI_IOV */ -void ixgbe_handle_mbx(void *, int); +void ixgbe_handle_mbx(void *); int ixgbe_vf_que_index(int, int, int); #endif Modified: stable/11/sys/dev/ixgbe/ixgbe_type.h ============================================================================== --- stable/11/sys/dev/ixgbe/ixgbe_type.h Fri May 10 00:41:42 2019 (r347418) +++ stable/11/sys/dev/ixgbe/ixgbe_type.h Fri May 10 00:46:43 2019 (r347419) @@ -4392,4 +4392,11 @@ struct ixgbe_bypass_eeprom { #define IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD \ (0x1F << IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT) +#define IXGBE_REQUEST_TASK_MOD 0x01 +#define IXGBE_REQUEST_TASK_MSF 0x02 +#define IXGBE_REQUEST_TASK_MBX 0x04 +#define IXGBE_REQUEST_TASK_FDIR 0x08 +#define IXGBE_REQUEST_TASK_PHY 0x10 +#define IXGBE_REQUEST_TASK_LINK 0x20 + #endif /* _IXGBE_TYPE_H_ */