From owner-svn-src-all@freebsd.org Tue Sep 11 18:33:44 2018 Return-Path: Delivered-To: svn-src-all@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 5892D1099164; Tue, 11 Sep 2018 18:33:44 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E0A8282E58; Tue, 11 Sep 2018 18:33:43 +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 BBE551B906; Tue, 11 Sep 2018 18:33:43 +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 w8BIXh0w088878; Tue, 11 Sep 2018 18:33:43 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8BIXho3088876; Tue, 11 Sep 2018 18:33:43 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201809111833.w8BIXho3088876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 11 Sep 2018 18:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338593 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 338593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2018 18:33:44 -0000 Author: erj Date: Tue Sep 11 18:33:43 2018 New Revision: 338593 URL: https://svnweb.freebsd.org/changeset/base/338593 Log: ix(4), ixv(4): VLAN tag stripping fixes for Amazon EC2 Enhanced Networking From Piotr: ix(4), ixv(4): Add VLAN tag strip check when receiving packets ixv(4): Fix support for VLAN_HWTAGGING and VLAN_HWFILTER flags This change will prevent driver from passing VLAN tags when interface configuration is not expecting them. VF driver will check for VLAN_HWTAGGING and VLAN_HWFILTER flags and act adequately. This patch resolves problem occuring on EC2 platforms. Submitted by: Piotr Pietruszewski Reported by: cperciva@ Reviewed by: cperciva@, Intel Networking Approved by: re Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D17061 Modified: head/sys/dev/ixgbe/if_ixv.c head/sys/dev/ixgbe/ix_txrx.c Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Tue Sep 11 18:31:57 2018 (r338592) +++ head/sys/dev/ixgbe/if_ixv.c Tue Sep 11 18:33:43 2018 (r338593) @@ -1470,6 +1470,7 @@ ixv_initialize_receive_units(if_ctx_t ctx) static void ixv_setup_vlan_support(if_ctx_t ctx) { + struct ifnet *ifp = iflib_get_ifp(ctx); struct adapter *adapter = iflib_get_softc(ctx); struct ixgbe_hw *hw = &adapter->hw; u32 ctrl, vid, vfta, retry; @@ -1483,17 +1484,26 @@ ixv_setup_vlan_support(if_ctx_t ctx) if (adapter->num_vlans == 0) return; - /* Enable the queues */ - for (int i = 0; i < adapter->num_rx_queues; i++) { - ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)); - ctrl |= IXGBE_RXDCTL_VME; - IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), ctrl); - /* - * Let Rx path know that it needs to store VLAN tag - * as part of extra mbuf info. - */ - adapter->rx_queues[i].rxr.vtag_strip = TRUE; + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { + /* Enable the queues */ + for (int i = 0; i < adapter->num_rx_queues; i++) { + ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)); + ctrl |= IXGBE_RXDCTL_VME; + IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), ctrl); + /* + * Let Rx path know that it needs to store VLAN tag + * as part of extra mbuf info. + */ + adapter->rx_queues[i].rxr.vtag_strip = TRUE; + } } + + /* + * If filtering VLAN tags is disabled, + * there is no need to fill VLAN Filter Table Array (VFTA). + */ + if ((ifp->if_capenable & IFCAP_VLAN_HWFILTER) == 0) + return; /* * A soft reset zero's out the VFTA, so Modified: head/sys/dev/ixgbe/ix_txrx.c ============================================================================== --- head/sys/dev/ixgbe/ix_txrx.c Tue Sep 11 18:31:57 2018 (r338592) +++ head/sys/dev/ixgbe/ix_txrx.c Tue Sep 11 18:33:43 2018 (r338593) @@ -430,7 +430,8 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxd->wb.upper.status_error = 0; eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0); - if (staterr & IXGBE_RXD_STAT_VP) { + + if ( (rxr->vtag_strip) && (staterr & IXGBE_RXD_STAT_VP) ) { vtag = le16toh(rxd->wb.upper.vlan); } else { vtag = 0;