From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
Peng Zhang <peng.zhang@corigine.com>,
Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 7/8] net/nfp: add support for VLAN insert V2 with NFD3
Date: Mon, 28 Nov 2022 14:53:58 +0800 [thread overview]
Message-ID: <20221128065359.12737-8-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20221128065359.12737-1-chaoyong.he@corigine.com>
From: Peng Zhang <peng.zhang@corigine.com>
The firmware support VLAN insert with the descriptor or the metadata.
So adding a NFP_NET_CFG_CTRL_RXVLAN_V2 bit to distinguish them. When
VLAN insert is set, sending the vlan information with the descriptor.
When VLAN insert V2 is set, sending it with the metadata.
Now NFP_NET_CFG_CTRL_L2SWITCH_LOCAL isn't used, so 0x1 << 23 is used
by NFP_NET_CFG_CTRL_RXVLAN_V2.
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_common.c | 9 ++++++---
drivers/net/nfp/nfp_ctrl.h | 2 +-
drivers/net/nfp/nfp_rxtx.c | 30 +++++++++++++++++++++++++++++-
3 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 9c740ee9b5..853eb4a3f7 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -195,7 +195,7 @@ nfp_net_log_device_information(const struct nfp_net_hw *hw)
NFD_CFG_MAJOR_VERSION_of(hw->ver),
NFD_CFG_MINOR_VERSION_of(hw->ver), hw->max_mtu);
- PMD_INIT_LOG(INFO, "CAP: %#x, %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", hw->cap,
+ PMD_INIT_LOG(INFO, "CAP: %#x, %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", hw->cap,
hw->cap & NFP_NET_CFG_CTRL_PROMISC ? "PROMISC " : "",
hw->cap & NFP_NET_CFG_CTRL_L2BC ? "L2BCFILT " : "",
hw->cap & NFP_NET_CFG_CTRL_L2MC ? "L2MCFILT " : "",
@@ -204,6 +204,7 @@ nfp_net_log_device_information(const struct nfp_net_hw *hw)
hw->cap & NFP_NET_CFG_CTRL_RXVLAN ? "RXVLAN " : "",
hw->cap & NFP_NET_CFG_CTRL_TXVLAN ? "TXVLAN " : "",
hw->cap & NFP_NET_CFG_CTRL_RXVLAN_V2 ? "RXVLANv2 " : "",
+ hw->cap & NFP_NET_CFG_CTRL_TXVLAN_V2 ? "TXVLANv2 " : "",
hw->cap & NFP_NET_CFG_CTRL_RXQINQ ? "RXQINQ " : "",
hw->cap & NFP_NET_CFG_CTRL_SCATTER ? "SCATTER " : "",
hw->cap & NFP_NET_CFG_CTRL_GATHER ? "GATHER " : "",
@@ -418,7 +419,9 @@ nfp_check_offloads(struct rte_eth_dev *dev)
hw->mtu = dev->data->mtu;
if (txmode->offloads & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) {
- if (hw->cap & NFP_NET_CFG_CTRL_TXVLAN)
+ if (hw->cap & NFP_NET_CFG_CTRL_TXVLAN_V2)
+ ctrl |= NFP_NET_CFG_CTRL_TXVLAN_V2;
+ else if (hw->cap & NFP_NET_CFG_CTRL_TXVLAN)
ctrl |= NFP_NET_CFG_CTRL_TXVLAN;
}
@@ -775,7 +778,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
RTE_ETH_RX_OFFLOAD_TCP_CKSUM;
- if (hw->cap & NFP_NET_CFG_CTRL_TXVLAN)
+ if (hw->cap & (NFP_NET_CFG_CTRL_TXVLAN | NFP_NET_CFG_CTRL_TXVLAN_V2))
dev_info->tx_offload_capa = RTE_ETH_TX_OFFLOAD_VLAN_INSERT;
if (hw->cap & NFP_NET_CFG_CTRL_TXCSUM)
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index bffdd8345e..6e2601d174 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -103,7 +103,7 @@
#define NFP_NET_CFG_CTRL_MSIXAUTO (0x1 << 20) /* MSI-X auto-masking */
#define NFP_NET_CFG_CTRL_TXRWB (0x1 << 21) /* Write-back of TX ring*/
#define NFP_NET_CFG_CTRL_L2SWITCH (0x1 << 22) /* L2 Switch */
-#define NFP_NET_CFG_CTRL_L2SWITCH_LOCAL (0x1 << 23) /* Switch to local */
+#define NFP_NET_CFG_CTRL_TXVLAN_V2 (0x1 << 23) /* Enable VLAN insert with metadata */
#define NFP_NET_CFG_CTRL_VXLAN (0x1 << 24) /* Enable VXLAN */
#define NFP_NET_CFG_CTRL_NVGRE (0x1 << 25) /* Enable NVGRE */
#define NFP_NET_CFG_CTRL_MSIX_TX_OFF (0x1 << 26) /* Disable MSIX for TX */
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 200886111e..293769f240 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -833,6 +833,33 @@ nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
return 0;
}
+/*
+ * nfp_net_nfd3_tx_vlan() - Set vlan info in the nfd3 tx desc
+ *
+ * If enable NFP_NET_CFG_CTRL_TXVLAN_V2
+ * Vlan_info is stored in the meta and
+ * is handled in the nfp_net_nfd3_set_meta_vlan
+ * else if enable NFP_NET_CFG_CTRL_TXVLAN
+ * Vlan_info is stored in the tx_desc and
+ * is handled in the nfp_net_nfd3_tx_vlan
+ */
+static void
+nfp_net_nfd3_tx_vlan(struct nfp_net_txq *txq,
+ struct nfp_net_nfd3_tx_desc *txd,
+ struct rte_mbuf *mb)
+{
+ struct nfp_net_hw *hw = txq->hw;
+
+ if ((hw->cap & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0 ||
+ (hw->cap & NFP_NET_CFG_CTRL_TXVLAN) == 0)
+ return;
+
+ if ((mb->ol_flags & RTE_MBUF_F_TX_VLAN) != 0) {
+ txd->flags |= PCIE_DESC_TX_VLAN;
+ txd->vlan = mb->vlan_tci;
+ }
+}
+
static void
nfp_net_set_meta_vlan(struct nfp_net_meta_raw *meta_data,
struct rte_mbuf *pkt,
@@ -861,7 +888,7 @@ nfp_net_nfd3_set_meta_data(struct nfp_net_meta_raw *meta_data,
hw = txq->hw;
if ((pkt->ol_flags & RTE_MBUF_F_TX_VLAN) != 0 &&
- (hw->ctrl & NFP_NET_CFG_CTRL_TXVLAN) != 0) {
+ (hw->ctrl & NFP_NET_CFG_CTRL_TXVLAN_V2) != 0) {
if (meta_data->length == 0)
meta_data->length = NFP_NET_META_HEADER_SIZE;
meta_data->length += NFP_NET_META_FIELD_SIZE;
@@ -960,6 +987,7 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
txd.data_len = pkt->pkt_len;
nfp_net_nfd3_tx_tso(txq, &txd, pkt);
nfp_net_nfd3_tx_cksum(txq, &txd, pkt);
+ nfp_net_nfd3_tx_vlan(txq, &txd, pkt);
/*
* mbuf data_len is the data in one segment and pkt_len data
--
2.29.3
next prev parent reply other threads:[~2022-11-28 6:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 6:53 [PATCH 0/8] Add the features for nfp include VLAN strip, QinQ strip, VLAN insert Chaoyong He
2022-11-28 6:53 ` [PATCH 1/8] net/nfp: break out function to report device information Chaoyong He
2023-01-16 2:24 ` Nole Zhang
2022-11-28 6:53 ` [PATCH 2/8] net/nfp: modify the logic of parse metadata Chaoyong He
2022-11-28 6:53 ` [PATCH 3/8] net/nfp: add new metadata type for achieving VLAN strip Chaoyong He
2022-11-28 6:53 ` [PATCH 4/8] net/nfp: add support for QinQ strip Chaoyong He
2022-11-28 6:53 ` [PATCH 5/8] net/nfp: add support for VLAN strip V2 Chaoyong He
2022-11-28 6:53 ` [PATCH 6/8] net/nfp: add support for VLAN insert with NFD3 Chaoyong He
2022-11-28 6:53 ` Chaoyong He [this message]
2022-11-28 6:53 ` [PATCH 8/8] net/nfp: add support for VLAN insert with NFDk Chaoyong He
2023-01-24 16:28 ` [PATCH 0/8] Add the features for nfp include VLAN strip, QinQ strip, VLAN insert 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=20221128065359.12737-8-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=niklas.soderlund@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.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).