From nobody Wed Aug 17 14:40:18 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 4M79fW0lxjz4ZcJ6; Wed, 17 Aug 2022 14:40:19 +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 4M79fW0Jx9z3TB2; Wed, 17 Aug 2022 14:40:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660747219; 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=3may/UK0EA06mdJP0hppOkplWsibGNKMXtJo4j4bZT8=; b=UzcvaeWJCtYjJ/sJ9WUvjSRzaAutzzsb74TTiL5w79BgU1QWfnzIyaJXzIbIpM985IpoJL 8W9RnyZZ9yIFAAoir+ypATpJvWQ4vEl6zGObWNx6UMwkb56j37OVVj0qJJPpudBymD6Iwb oag60orc537IBOa5rFM4v33LomfdmftKIpYr056Xy8eJGFADmEMtkUY9a9zUsVYU8uxoM8 FlLE2hF+x446dPG58OotNyBWBPkwD6SktGCAqt2Op+5/SNyD6zPaAU2SJiJFqaEPpeCRb8 bgMQanbLaSotncNUupk3D+1GY/1+bEyZsq3XAr6bxCbLxPTPkAK++IxLXM/lWw== 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 4M79fV6T2GzsJ4; Wed, 17 Aug 2022 14:40:18 +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 27HEeI2U046456; Wed, 17 Aug 2022 14:40:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27HEeILs046453; Wed, 17 Aug 2022 14:40:18 GMT (envelope-from git) Date: Wed, 17 Aug 2022 14:40:18 GMT Message-Id: <202208171440.27HEeILs046453@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e7abb897018b - main - ixgbe: fix software vlan handling 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e7abb897018be34f039ad957562fdc2f38aa3562 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660747219; 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=3may/UK0EA06mdJP0hppOkplWsibGNKMXtJo4j4bZT8=; b=hbJrhGJtZatyh+odQjWykaKlTyJTCd8bSitEqaAu4n5hNJ01nVqm3ihWH5tLwnbn2/lFbj l0wn1cEvBUxj00L+3DOY3ZdaFqUPNhxcI5Tbap7MHWc1EHPuewpCg6gf6+5FEq9uz8s/8r 8diubNV5lCIh9No9iSKesA8vddDmWkwRZitmrRCPhkLwVvkrEQaOx/jRarvlbvfqcVbVdL cpPdbKz5l2Ve1xN3Q4ZBh5sn8h/TfXQ+Y9TkpeSLRblj3wcJh7WDBawB1qgFEddKnBi19m FmRrdAKtn8TP6BsRunOVUltgACJtEZRdtXWF6DjBXAlN52K5AMXGk//TnnN4Bg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660747219; a=rsa-sha256; cv=none; b=KX8uZWKp4iAm4K5KPRo0BOFhHrLvgUZdlwMqlxZ6/Nq1Y1E5TLuFdbATNvKwsSKTJwDWm7 sSGI7M4bIFlVYLVMz+T73bi74hS2gOYasBlKrtKkG1v/fE+qq0bBfbu7VFzYPNVP8w0EMq 26gEzg+gUCYqUsRpsQqgBw9pFvlQmFNRCExrgb5Tg6slogJMsiW+64dj+qzug6JW6wXvFR eEOX9MtmoHXdG6MpExUtjIpDaSC59DueYPabgrnfSxm6h+8b1s9ygaadezEQjnjjL9/LAm QU1NyuduCcAi8luxWRXbov3sNhAPxD7CLL7g4r3qBOCMBHXxgv4Ba/7+LQyBkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e7abb897018be34f039ad957562fdc2f38aa3562 commit e7abb897018be34f039ad957562fdc2f38aa3562 Author: Kristof Provost AuthorDate: 2022-08-11 12:45:01 +0000 Commit: Kristof Provost CommitDate: 2022-08-17 14:39:18 +0000 ixgbe: fix software vlan handling If hardware vlan tagging is disabled (after a vlan has been added) we receive double-tagged packets, even if the packet on the wire only has a single VLAN tag. That looks like this: 17:29:30.370787 00:51:82:11:22:02 > 90:ec:77:1f:8a:5f, ethertype 802.1Q (0x8100), length 64: vlan 0, p 0, ethertype 802.1Q, vlan 1001, p 0, ethertype ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.101.0.12 is-at 00:51:82:11:22:02, length 42 This happens because the ixgbe driver does not clear the vlan flags in the hardware (such as IXGBE_RXDCTL_VME) if IFCAP_VLAN_HWTAGGING is cleared. Add code to do so, which fixes this issue. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36139 --- sys/dev/ixgbe/if_ix.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index ae5c65894f83..54008a24074b 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -1925,8 +1925,27 @@ ixgbe_setup_vlan_hw_support(if_ctx_t ctx) * the VFTA and other state, so if there * have been no vlan's registered do nothing. */ - if (sc->num_vlans == 0) + if (sc->num_vlans == 0 || (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) { + /* Clear the vlan hw flag */ + for (i = 0; i < sc->num_rx_queues; i++) { + rxr = &sc->rx_queues[i].rxr; + /* On 82599 the VLAN enable is per/queue in RXDCTL */ + if (hw->mac.type != ixgbe_mac_82598EB) { + ctrl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(rxr->me)); + ctrl &= ~IXGBE_RXDCTL_VME; + IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), ctrl); + } + rxr->vtag_strip = false; + } + ctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL); + /* Enable the Filter Table if enabled */ + ctrl |= IXGBE_VLNCTRL_CFIEN; + ctrl &= ~IXGBE_VLNCTRL_VFE; + if (hw->mac.type == ixgbe_mac_82598EB) + ctrl &= ~IXGBE_VLNCTRL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, ctrl); return; + } /* Setup the queues for vlans */ if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) {