From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 39C68A0547; Thu, 29 Apr 2021 12:34:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 37D5B41311; Thu, 29 Apr 2021 12:34:00 +0200 (CEST) Received: from smtpbg511.qq.com (smtpbg511.qq.com [203.205.250.109]) by mails.dpdk.org (Postfix) with ESMTP id E4B644130C for ; Thu, 29 Apr 2021 12:33:55 +0200 (CEST) X-QQ-mid: bizesmtp32t1619692424t0n5yy84 Received: from jiawenwu.trustnetic.com (unknown [183.129.236.74]) by esmtp6.qq.com (ESMTP) with id ; Thu, 29 Apr 2021 18:33:43 +0800 (CST) X-QQ-SSF: 01400000002000D0E000000A0000000 X-QQ-FEAT: l7qcL9BE/SdsXGB35MEeQOW+cOLX059Nzg66YgcSxrdDCCOX/3naj0pj20qm8 c+sFUzA9MaCocu9o9LJ6vp9BzzKCzVPgOLWXPJc1V3K/qLuVHKdAeZuzEA2XjTU6258Mqw7 1Km6GURbSFsIyJVTEwpeLu5QqGo1XG3i663bI+oFpNEodHabZdNWaiEK2VoX2cFsvLs53Sl 10MvooGAQK6M2no0XS/7r3/y28ssuuOZVhCw2Gt382rC4/KLng1jQRBp3m5srs3pklDA71o 8fcEv+MXMSUOKyCMVaG5Ueyl5BjY1akHrxheOmXczfAbcHqWkfB+z2/E6AoWz9CBjSZ1JHY Ejhxh0mRQhlcISE4+yC/BNqUFu+iY8SzzsvToJE X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu , stable@dpdk.org Date: Thu, 29 Apr 2021 18:33:31 +0800 Message-Id: <20210429103335.23060-2-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20210429103335.23060-1-jiawenwu@trustnetic.com> References: <20210429103335.23060-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 Subject: [dpdk-dev] [PATCH v2 1/5] net/txgbe: fix RSS in QINQ X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Support to enable and disable QINQ hardware strip, when configure vlan offload with QINQ strip mask, to avoid RSS does not work for QINQ packets. Fixes: 220b0e49bc47 ("net/txgbe: support VLAN") Cc: stable@dpdk.org Signed-off-by: Jiawen Wu --- drivers/net/txgbe/txgbe_ethdev.c | 39 +++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index 97796f040b..3d6d356102 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -1209,7 +1209,6 @@ txgbe_vlan_hw_extend_disable(struct rte_eth_dev *dev) ctrl = rd32(hw, TXGBE_PORTCTL); ctrl &= ~TXGBE_PORTCTL_VLANEXT; - ctrl &= ~TXGBE_PORTCTL_QINQ; wr32(hw, TXGBE_PORTCTL, ctrl); } @@ -1217,17 +1216,38 @@ static void txgbe_vlan_hw_extend_enable(struct rte_eth_dev *dev) { struct txgbe_hw *hw = TXGBE_DEV_HW(dev); - struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; - struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode; uint32_t ctrl; PMD_INIT_FUNC_TRACE(); ctrl = rd32(hw, TXGBE_PORTCTL); ctrl |= TXGBE_PORTCTL_VLANEXT; - if (rxmode->offloads & DEV_RX_OFFLOAD_QINQ_STRIP || - txmode->offloads & DEV_TX_OFFLOAD_QINQ_INSERT) - ctrl |= TXGBE_PORTCTL_QINQ; + wr32(hw, TXGBE_PORTCTL, ctrl); +} + +static void +txgbe_qinq_hw_strip_disable(struct rte_eth_dev *dev) +{ + struct txgbe_hw *hw = TXGBE_DEV_HW(dev); + uint32_t ctrl; + + PMD_INIT_FUNC_TRACE(); + + ctrl = rd32(hw, TXGBE_PORTCTL); + ctrl &= ~TXGBE_PORTCTL_QINQ; + wr32(hw, TXGBE_PORTCTL, ctrl); +} + +static void +txgbe_qinq_hw_strip_enable(struct rte_eth_dev *dev) +{ + struct txgbe_hw *hw = TXGBE_DEV_HW(dev); + uint32_t ctrl; + + PMD_INIT_FUNC_TRACE(); + + ctrl = rd32(hw, TXGBE_PORTCTL); + ctrl |= TXGBE_PORTCTL_QINQ | TXGBE_PORTCTL_VLANEXT; wr32(hw, TXGBE_PORTCTL, ctrl); } @@ -1294,6 +1314,13 @@ txgbe_vlan_offload_config(struct rte_eth_dev *dev, int mask) txgbe_vlan_hw_extend_disable(dev); } + if (mask & ETH_QINQ_STRIP_MASK) { + if (rxmode->offloads & DEV_RX_OFFLOAD_QINQ_STRIP) + txgbe_qinq_hw_strip_enable(dev); + else + txgbe_qinq_hw_strip_disable(dev); + } + return 0; } -- 2.21.0.windows.1