From nobody Mon Oct 17 03:38:33 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MrN4p0v0yz4fg6D; Mon, 17 Oct 2022 03:38:34 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MrN4p0TT1z3xN8; Mon, 17 Oct 2022 03:38:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665977914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RKEdP0Zn7OmdMg4I8feVLeWxYuqgzjWAQ2CU0qNjRHU=; b=QamFPS+nKRzXf2yhLFpgy51JKTnmV7qMR87IIGBiK90AWCcuykSMKUORvfcQaAaDGgTbur JwKRXCwThrqTqVsyTBIElQW7puabZ/RtmrIMuGFnX1pWtyCFo3URb520wJVOa8hOUnRfGm KUbIIK1dNRU4HkQba6aJhfyQiwYpZ9TJubNq/REpBAoa7+MsNcoIWjFjyi1bXAR/ZG6+FP VGuIQSytlXhMqqafag/bKruDYyN2VBp63inMsRnT2LPErArOp8EJ+TVfjx5WgeB5/XjsBu 3sS4i6R5NrddosP6fDSawmos3F+qGiPm5LADjhgFZrsq9ZPKaE9ArbyFcHQmuw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MrN4n6gytzh6W; Mon, 17 Oct 2022 03:38:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29H3cXnh009319; Mon, 17 Oct 2022 03:38:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29H3cXif009318; Mon, 17 Oct 2022 03:38:33 GMT (envelope-from git) Date: Mon, 17 Oct 2022 03:38:33 GMT Message-Id: <202210170338.29H3cXif009318@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: a5728b82826f - stable/12 - igc: Fix up hw vlan ops List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a5728b82826f8b07289754fbc976e7593b3fa820 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665977914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RKEdP0Zn7OmdMg4I8feVLeWxYuqgzjWAQ2CU0qNjRHU=; b=l7jX0MKW3yVL+vQ5hYD1H5afG69FzQUpaQRAvyxDV8gazTBiu+rh2pV4wv6ZxAgBmATFbk N4RVJcldF/lFnrypdvoeHt16zJq06dIlhdpGOE6m/IBNkCVmxa5pSTTLgTYT5KKwdn5Plr tfmKeIm03ibik/pFoZZcOd2NxCKS9VeriGBOsUalxlZGGv5A/gygQEMgF6u3tN8Kijn7k1 dQvfvn+1C+V4iO3pIz+LAqvE2YHByoS08GK3zMyKHLJ9eSxiN9I8Rz6tt3SGx+ILn4mpeV /oOvcio0nysgwcfmufh0JcK+a6bNI5RllEXyupT6IqGggd1+ZJ75NkCa0LvItw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665977914; a=rsa-sha256; cv=none; b=LTjvdrJbfMl0htwxh7NMbS9ZdvyR6+OlasMgulNhSNLe24tO6gRQtFL33h0Qp+RhoO/dLv d6cb5xN92w1XfgcYANPPN81fP/sOlYUITehNk0nb/zoPN9InAyUGx9iILZ7tP7T9qIfkvQ gyqaKzdxrsaPnaDITeq89Q3W49/j5U950/x0lfTsgyJxzYpD1HabLQ/id91CDOckht6VCX zZ7YlpjanBVJVnpDp8lGQJzasTaXUZcdYGa+fmAdijf7Dfa+b9YkI+u8FvGOo7Y+bDrEVq ymkeqzpm81z3/zQOHz+yFpCmNtJHyrNd1YFRiHgiHeMoWzV8VUtZifs1tNy6mA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a5728b82826f8b07289754fbc976e7593b3fa820 commit a5728b82826f8b07289754fbc976e7593b3fa820 Author: Kevin Bowling AuthorDate: 2022-10-10 23:09:21 +0000 Commit: Kevin Bowling CommitDate: 2022-10-17 03:37:39 +0000 igc: Fix up hw vlan ops Adapt 2796f7cab10785ef40efbba97ef67ab319c96e9c to igc(4) * Don't reset the entire adapter for vlan changes, fix up the problems * Remove the VFTA, this hardware doesn't seem to implement it Approved by: grehan Differential Revision: https://reviews.freebsd.org/D31979 (cherry picked from commit 2eaef8ec4af1f7576a1444180020e23d2e142107) --- sys/dev/igc/if_igc.c | 89 +++++++++++----------------------------------------- sys/dev/igc/if_igc.h | 9 ------ 2 files changed, 19 insertions(+), 79 deletions(-) diff --git a/sys/dev/igc/if_igc.c b/sys/dev/igc/if_igc.c index e5c42e0eb235..0ce2439f93f0 100644 --- a/sys/dev/igc/if_igc.c +++ b/sys/dev/igc/if_igc.c @@ -93,8 +93,6 @@ static void igc_if_media_status(if_ctx_t, struct ifmediareq *); static int igc_if_media_change(if_ctx_t ctx); static int igc_if_mtu_set(if_ctx_t ctx, uint32_t mtu); static void igc_if_timer(if_ctx_t ctx, uint16_t qid); -static void igc_if_vlan_register(if_ctx_t ctx, u16 vtag); -static void igc_if_vlan_unregister(if_ctx_t ctx, u16 vtag); static void igc_if_watchdog_reset(if_ctx_t ctx); static bool igc_if_needs_restart(if_ctx_t ctx, enum iflib_restart_event event); @@ -118,7 +116,7 @@ static void igc_if_debug(if_ctx_t ctx); static void igc_update_stats_counters(struct igc_adapter *); static void igc_add_hw_stats(struct igc_adapter *adapter); static int igc_if_set_promisc(if_ctx_t ctx, int flags); -static void igc_setup_vlan_hw_support(struct igc_adapter *); +static void igc_setup_vlan_hw_support(if_ctx_t ctx); static int igc_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void igc_print_nvm_info(struct igc_adapter *); static int igc_sysctl_debug_info(SYSCTL_HANDLER_ARGS); @@ -200,8 +198,6 @@ static device_method_t igc_if_methods[] = { DEVMETHOD(ifdi_promisc_set, igc_if_set_promisc), DEVMETHOD(ifdi_timer, igc_if_timer), DEVMETHOD(ifdi_watchdog_reset, igc_if_watchdog_reset), - DEVMETHOD(ifdi_vlan_register, igc_if_vlan_register), - DEVMETHOD(ifdi_vlan_unregister, igc_if_vlan_unregister), DEVMETHOD(ifdi_get_counter, igc_if_get_counter), DEVMETHOD(ifdi_rx_queue_intr_enable, igc_if_rx_queue_intr_enable), DEVMETHOD(ifdi_tx_queue_intr_enable, igc_if_tx_queue_intr_enable), @@ -442,9 +438,8 @@ igc_set_num_queues(if_ctx_t ctx) #define IGC_CAPS \ IFCAP_HWCSUM | IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | \ - IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_VLAN_HWFILTER | IFCAP_TSO4 | \ - IFCAP_LRO | IFCAP_VLAN_HWTSO | IFCAP_JUMBO_MTU | IFCAP_HWCSUM_IPV6 |\ - IFCAP_TSO6 + IFCAP_VLAN_HWCSUM | IFCAP_WOL | IFCAP_TSO4 | IFCAP_LRO | \ + IFCAP_VLAN_HWTSO | IFCAP_JUMBO_MTU | IFCAP_HWCSUM_IPV6 | IFCAP_TSO6 /********************************************************************* * Device initialization routine @@ -845,18 +840,8 @@ igc_if_init(if_ctx_t ctx) adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); igc_initialize_receive_unit(ctx); - /* Use real VLAN Filter support? */ - if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) { - if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - /* Use real VLAN Filter support */ - igc_setup_vlan_hw_support(adapter); - else { - u32 ctrl; - ctrl = IGC_READ_REG(&adapter->hw, IGC_CTRL); - ctrl |= IGC_CTRL_VME; - IGC_WRITE_REG(&adapter->hw, IGC_CTRL, ctrl); - } - } + /* Set up VLAN support */ + igc_setup_vlan_hw_support(ctx); /* Don't lose promiscuous settings */ igc_if_set_promisc(ctx, IFF_PROMISC); @@ -2139,62 +2124,25 @@ igc_initialize_receive_unit(if_ctx_t ctx) } static void -igc_if_vlan_register(if_ctx_t ctx, u16 vtag) -{ - struct igc_adapter *adapter = iflib_get_softc(ctx); - u32 index, bit; - - index = (vtag >> 5) & 0x7F; - bit = vtag & 0x1F; - adapter->shadow_vfta[index] |= (1 << bit); - ++adapter->num_vlans; -} - -static void -igc_if_vlan_unregister(if_ctx_t ctx, u16 vtag) +igc_setup_vlan_hw_support(if_ctx_t ctx) { struct igc_adapter *adapter = iflib_get_softc(ctx); - u32 index, bit; - - index = (vtag >> 5) & 0x7F; - bit = vtag & 0x1F; - adapter->shadow_vfta[index] &= ~(1 << bit); - --adapter->num_vlans; -} - -static void -igc_setup_vlan_hw_support(struct igc_adapter *adapter) -{ struct igc_hw *hw = &adapter->hw; + struct ifnet *ifp = iflib_get_ifp(ctx); u32 reg; - /* - * We get here thru init_locked, meaning - * a soft reset, this has already cleared - * the VFTA and other state, so if there - * have been no vlan's registered do nothing. - */ - if (adapter->num_vlans == 0) - return; - - /* - * A soft reset zero's out the VFTA, so - * we need to repopulate it now. - */ - for (int i = 0; i < IGC_VFTA_SIZE; i++) - if (adapter->shadow_vfta[i] != 0) - IGC_WRITE_REG_ARRAY(hw, IGC_VFTA, - i, adapter->shadow_vfta[i]); - - reg = IGC_READ_REG(hw, IGC_CTRL); - reg |= IGC_CTRL_VME; - IGC_WRITE_REG(hw, IGC_CTRL, reg); + /* igc hardware doesn't seem to implement VFTA for HWFILTER */ - /* Enable the Filter Table */ - reg = IGC_READ_REG(hw, IGC_RCTL); - reg &= ~IGC_RCTL_CFIEN; - reg |= IGC_RCTL_VFE; - IGC_WRITE_REG(hw, IGC_RCTL, reg); + if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING && + !igc_disable_crc_stripping) { + reg = IGC_READ_REG(hw, IGC_CTRL); + reg |= IGC_CTRL_VME; + IGC_WRITE_REG(hw, IGC_CTRL, reg); + } else { + reg = IGC_READ_REG(hw, IGC_CTRL); + reg &= ~IGC_CTRL_VME; + IGC_WRITE_REG(hw, IGC_CTRL, reg); + } } static void @@ -2470,6 +2418,7 @@ igc_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event) { switch (event) { case IFLIB_RESTART_VLAN_CONFIG: + return (false); default: return (true); } diff --git a/sys/dev/igc/if_igc.h b/sys/dev/igc/if_igc.h index 69b2123cd73f..86a02266a81c 100644 --- a/sys/dev/igc/if_igc.h +++ b/sys/dev/igc/if_igc.h @@ -372,7 +372,6 @@ struct igc_adapter { /* Task for FAST handling */ struct grouptask link_task; - u16 num_vlans; u32 txd_cmd; u32 tx_process_limit; @@ -385,14 +384,6 @@ struct igc_adapter { /* Multicast array memory */ u8 *mta; - /* - ** Shadow VFTA table, this is needed because - ** the real vlan filter table gets cleared during - ** a soft reset and the driver needs to be able - ** to repopulate it. - */ - u32 shadow_vfta[IGC_VFTA_SIZE]; - /* Info about the interface */ u16 link_active; u16 fc;