From nobody Mon Oct 17 03:36:55 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 4MrN2w02h5z4fg0W; Mon, 17 Oct 2022 03:36:56 +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 4MrN2v6Z7gz3wcj; Mon, 17 Oct 2022 03:36:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665977815; 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=S48rs2LE16MEIfRdDTFLmgxvyAjKx/VANXo7k20mAw8=; b=WyA82VoMCudqhlUYm6bngGasuMFqp53MyL06xQjN48IBzvZwxK6tmbN84eZi1Sa4GUkOlD BbbpGPdUCanrJEeCu/ndIZQub1ZANK/LEQqa9EQOOmZ7lIRCltvFgHgE7PYNKqcx7mHRcf xmid9Ovy2Wjz1jSka/lLrMTXzuAqzACMo02v1j7qFtjW0B+4Gfgd24iSbCkO57CL4+CBKo c/+AKZldCVDrLE3xuAauu8lNWGpCevhxygCcJtNoshcvDnU5Pbc9ff58yNoTmUKtidZQ5Q dJy4QNv+4tlEq/CsVCDNxRvrBHKSvZIXMC9KkY59e4ZIc5e/EyIKZrSaLEIFiA== 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 4MrN2v5bCqzgw2; Mon, 17 Oct 2022 03:36:55 +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 29H3atEL008947; Mon, 17 Oct 2022 03:36:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29H3atAU008946; Mon, 17 Oct 2022 03:36:55 GMT (envelope-from git) Date: Mon, 17 Oct 2022 03:36:55 GMT Message-Id: <202210170336.29H3atAU008946@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: 0f95623db556 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 0f95623db556a6ac49ebb11e47139c83f28eb99b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665977815; 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=S48rs2LE16MEIfRdDTFLmgxvyAjKx/VANXo7k20mAw8=; b=CLonlJidSvy2wl7rEyzWTFMmy4LofMQEnWxYMtlDzhBXqf22ViZhlArrf0TA1Xy+anvsQh +Eexf49vShwpCfzQjTqZPJZ0WbB0V/p8ATIjfw4hEYw33BaaX2WX+Vq/Tb4NBg+VkZ9vBW 6OHgRTd8xOtTTKxUHU7puPT09f4Yfhnxgw4FdjFhRT6AfRvNxFQZtpfQzWi0qPC/W1HVH8 pQbsguV3lEEgirGFhpR/Wg/NSdHOpDbpUgW9EP93CfaTyJ89TSKFsh7O1FHMzgMnJG3QZx 16CGmU2vdtxL0lE3w3XG6H3I1n7NgQgJkDNXpgbTkzNiBgKkmbyHIKPOdLeFhA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665977815; a=rsa-sha256; cv=none; b=KsvyCz4M92surVKqT+oR3R8DcqcUP85WOlpcVN49Fr3h7fnKSJHjJ7JTpZV6xtK6QkZhXI hR3fq2YCzxoIyeVbnYgAjptW9QS8mBsr5e1KzKkX1IXf8DrN/VcG3iSdBxThdS1l+Iynnp dxD8h5vDeH3tlXnS576heqU/ooiUbuyGzeLHZfMVkRZerbw9Np6N/h9pmA+23TMk1aAyB6 L+T7Phhu7iBuacqlqj36xxZp9Ty8sVws8TpbvhsQpohgSTOQo2FQKSh2WQLyR5l7AH5dZV pTdme0xhciOKNDHY0BZRUKLy+xXrSLJ8RF+1OIASbaz+lrOwTDArssCCngYiPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0f95623db556a6ac49ebb11e47139c83f28eb99b commit 0f95623db556a6ac49ebb11e47139c83f28eb99b Author: Kevin Bowling AuthorDate: 2022-10-10 23:09:21 +0000 Commit: Kevin Bowling CommitDate: 2022-10-17 03:36:01 +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 29a234702303..826a35e7e15e 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, if_getflags(ifp)); @@ -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;