Skip to content

Commit

Permalink
net/txgbe: fix QinQ strip
Browse files Browse the repository at this point in the history
[ upstream commit 15f0573 ]

Support to enable and disable QINQ hardware strip, when configure VLAN
offload with QINQ strip mask. If there are packets have QINQ tag to RSS,
users should enable QINQ strip before configuring the RSS.

Fixes: 220b0e4 ("net/txgbe: support VLAN")

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
  • Loading branch information
Jiawen Wu authored and steevenlee committed Jun 8, 2021
1 parent 33f33e3 commit ec14e37
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions drivers/net/txgbe/txgbe_ethdev.c
Expand Up @@ -977,25 +977,45 @@ 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);
}

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);
}

Expand Down Expand Up @@ -1062,6 +1082,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;
}

Expand Down

0 comments on commit ec14e37

Please sign in to comment.