From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [dpdk-dev] [PATCH v3 15/16] net/bnxt: support for QinQ insertion and stripping
Date: Wed, 2 Oct 2019 10:17:44 -0700 [thread overview]
Message-ID: <20191002171745.4504-16-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20191002171745.4504-1-ajit.khaparde@broadcom.com>
From: Somnath Kotur <somnath.kotur@broadcom.com>
Driver will accelerate only outer/S-VLAN insertion by turning on
the appropriate bits in the Tx Buffer Descriptor when the packet
arrives for transmission.
The TPID to be used for this S-VLAN is conveyed by the vlan_tpid_set
dev_op which will terminate in the driver.
In the Rx path, driver will continue providing the stripped vlan tag
in the mbuf's vlan tci field. This would be the outermost vlan tag
in a double-tagged packet or the vlan tag for a single vlan tagged pkt.
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt.h | 4 ++
drivers/net/bnxt/bnxt_ethdev.c | 71 ++++++++++++++++++++++++++++++++--
drivers/net/bnxt/bnxt_txr.c | 13 ++++++-
3 files changed, 83 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 089f86fec7..f8a550ba54 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -521,6 +521,10 @@ struct bnxt {
uint16_t max_stat_ctx;
uint16_t first_vf_id;
uint16_t vlan;
+#define BNXT_OUTER_TPID_MASK 0x0000ffff
+#define BNXT_OUTER_TPID_BD_MASK 0xffff0000
+#define BNXT_OUTER_TPID_BD_SHFT 16
+ uint32_t outer_tpid_bd;
struct bnxt_pf_info pf;
uint8_t port_partition_type;
uint8_t dev_stopped;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 5985963bf7..b3a37e1554 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -151,6 +151,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
DEV_TX_OFFLOAD_GRE_TNL_TSO | \
DEV_TX_OFFLOAD_IPIP_TNL_TSO | \
DEV_TX_OFFLOAD_GENEVE_TNL_TSO | \
+ DEV_TX_OFFLOAD_QINQ_INSERT | \
DEV_TX_OFFLOAD_MULTI_SEGS)
#define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \
@@ -161,6 +162,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | \
DEV_RX_OFFLOAD_JUMBO_FRAME | \
DEV_RX_OFFLOAD_KEEP_CRC | \
+ DEV_RX_OFFLOAD_VLAN_EXTEND | \
DEV_RX_OFFLOAD_TCP_LRO)
static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
@@ -1831,15 +1833,77 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
!!(rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP));
}
- if (mask & ETH_VLAN_EXTEND_MASK)
- PMD_DRV_LOG(ERR, "Extend VLAN Not supported\n");
+ if (mask & ETH_VLAN_EXTEND_MASK) {
+ if (rx_offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
+ PMD_DRV_LOG(DEBUG, "Extend VLAN supported\n");
+ else
+ PMD_DRV_LOG(INFO, "Extend VLAN unsupported\n");
+ }
+
+ return 0;
+}
+
+static int
+bnxt_vlan_tpid_set_op(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type,
+ uint16_t tpid)
+{
+ struct bnxt *bp = dev->data->dev_private;
+ int qinq = dev->data->dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_VLAN_EXTEND;
+
+ if (vlan_type != ETH_VLAN_TYPE_INNER &&
+ vlan_type != ETH_VLAN_TYPE_OUTER) {
+ PMD_DRV_LOG(ERR,
+ "Unsupported vlan type.");
+ return -EINVAL;
+ }
+ if (!qinq) {
+ PMD_DRV_LOG(ERR,
+ "QinQ not enabled. Needs to be ON as we can "
+ "accelerate only outer vlan\n");
+ return -EINVAL;
+ }
+
+ if (vlan_type == ETH_VLAN_TYPE_OUTER) {
+ switch (tpid) {
+ case RTE_ETHER_TYPE_QINQ:
+ bp->outer_tpid_bd =
+ TX_BD_LONG_CFA_META_VLAN_TPID_TPID88A8;
+ break;
+ case RTE_ETHER_TYPE_VLAN:
+ bp->outer_tpid_bd =
+ TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100;
+ break;
+ case 0x9100:
+ bp->outer_tpid_bd =
+ TX_BD_LONG_CFA_META_VLAN_TPID_TPID9100;
+ break;
+ case 0x9200:
+ bp->outer_tpid_bd =
+ TX_BD_LONG_CFA_META_VLAN_TPID_TPID9200;
+ break;
+ case 0x9300:
+ bp->outer_tpid_bd =
+ TX_BD_LONG_CFA_META_VLAN_TPID_TPID9300;
+ break;
+ default:
+ PMD_DRV_LOG(ERR, "Invalid TPID: %x\n", tpid);
+ return -EINVAL;
+ }
+ bp->outer_tpid_bd |= tpid;
+ PMD_DRV_LOG(INFO, "outer_tpid_bd = %x\n", bp->outer_tpid_bd);
+ } else if (vlan_type == ETH_VLAN_TYPE_INNER) {
+ PMD_DRV_LOG(ERR,
+ "Can accelerate only outer vlan in QinQ\n");
+ return -EINVAL;
+ }
return 0;
}
static int
bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev,
- struct rte_ether_addr *addr)
+ struct rte_ether_addr *addr)
{
struct bnxt *bp = dev->data->dev_private;
/* Default Filter is tied to VNIC 0 */
@@ -3534,6 +3598,7 @@ static const struct eth_dev_ops bnxt_dev_ops = {
.udp_tunnel_port_del = bnxt_udp_tunnel_port_del_op,
.vlan_filter_set = bnxt_vlan_filter_set_op,
.vlan_offload_set = bnxt_vlan_offload_set_op,
+ .vlan_tpid_set = bnxt_vlan_tpid_set_op,
.vlan_pvid_set = bnxt_vlan_pvid_set_op,
.mtu_set = bnxt_mtu_set_op,
.mac_addr_set = bnxt_set_default_mac_addr_op,
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 99d2009055..0ed6581bed 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -134,6 +134,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
struct tx_bd_long **last_txbd)
{
struct bnxt_tx_ring_info *txr = txq->tx_ring;
+ uint32_t outer_tpid_bd = 0;
struct tx_bd_long *txbd;
struct tx_bd_long_hi *txbd1 = NULL;
uint32_t vlan_tag_flags, cfa_action;
@@ -155,7 +156,8 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM |
PKT_TX_VLAN_PKT | PKT_TX_OUTER_IP_CKSUM |
PKT_TX_TUNNEL_GRE | PKT_TX_TUNNEL_VXLAN |
- PKT_TX_TUNNEL_GENEVE | PKT_TX_IEEE1588_TMST))
+ PKT_TX_TUNNEL_GENEVE | PKT_TX_IEEE1588_TMST |
+ PKT_TX_QINQ_PKT))
long_bd = true;
nr_bds = long_bd + tx_pkt->nb_segs;
@@ -209,7 +211,14 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
txbd->flags_type |= TX_BD_LONG_TYPE_TX_BD_LONG;
vlan_tag_flags = 0;
cfa_action = 0;
- if (tx_buf->mbuf->ol_flags & PKT_TX_VLAN_PKT) {
+ /* HW can accelerate only outer vlan in QinQ mode */
+ if (tx_buf->mbuf->ol_flags & PKT_TX_QINQ_PKT) {
+ vlan_tag_flags = TX_BD_LONG_CFA_META_KEY_VLAN_TAG |
+ tx_buf->mbuf->vlan_tci_outer;
+ outer_tpid_bd = txq->bp->outer_tpid_bd &
+ BNXT_OUTER_TPID_BD_MASK;
+ vlan_tag_flags |= outer_tpid_bd;
+ } else if (tx_buf->mbuf->ol_flags & PKT_TX_VLAN_PKT) {
/* shurd: Should this mask at
* TX_BD_LONG_CFA_META_VLAN_VID_MASK?
*/
--
2.20.1 (Apple Git-117)
next prev parent reply other threads:[~2019-10-02 17:20 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 5:54 [dpdk-dev] [PATCH v2 00/17] bnxt patchset Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 01/17] net/bnxt: fix incorrect flow steering Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 02/17] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 03/17] net/bnxt: fix rxq stop/start handling Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 04/17] net/bnxt: subscribe to link speed change notification Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 05/17] net/bnxt: fix async link handling and update Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 06/17] net/bnxt: fix 40G link failure for Thor Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 07/17] net/bnxt: fix L2 context calculation " Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 08/17] net/bnxt: fix use of deferred start of transmit queues Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 09/17] net/bnxt: remove unnecessary return check Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 10/17] net/bnxt: remove unused macro Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 11/17] net/bnxt: remove unnecessary interrupt disable Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 12/17] net/bnxt: fix accessing variable before null check Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 13/17] net/bnxt: fix Rx queue count devop Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 14/17] net/bnxt: fix mbuf flags for PTP packets in vector mode Rx Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 15/17] net/bnxt: fix a segfault in secondary process Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 16/17] net/bnxt: support for QinQ insertion and stripping Ajit Khaparde
2019-10-02 5:54 ` [dpdk-dev] [PATCH v2 17/17] net/bnxt: use macro for getting default vnic Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 01/16] net/bnxt: fix incorrect flow steering Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 02/16] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 03/16] net/bnxt: fix rxq stop/start handling Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 04/16] net/bnxt: subscribe to link speed change notification Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 05/16] net/bnxt: fix async link handling and update Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 06/16] net/bnxt: fix 40G link failure for Thor Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 07/16] net/bnxt: fix L2 context calculation " Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 08/16] net/bnxt: fix use of deferred start of transmit queues Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 09/16] net/bnxt: remove unnecessary return check Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 10/16] net/bnxt: remove unused macro Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 11/16] net/bnxt: remove unnecessary interrupt disable Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 12/16] net/bnxt: fix accessing variable before null check Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 13/16] net/bnxt: fix Rx queue count devop Ajit Khaparde
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 14/16] net/bnxt: fix a segfault in secondary process Ajit Khaparde
2019-10-02 17:17 ` Ajit Khaparde [this message]
2019-10-02 17:17 ` [dpdk-dev] [PATCH v3 16/16] net/bnxt: use macro for getting default vnic Ajit Khaparde
2019-10-02 18:35 ` [dpdk-dev] [PATCH v3 00/16] bnxt patchset Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191002171745.4504-16-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=somnath.kotur@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).