DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wang Xiao W <xiao.w.wang@intel.com>
To: jing.d.chen@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 1/3] fm10k: enable FTAG based forwarding
Date: Tue,  2 Feb 2016 18:50:14 +0800	[thread overview]
Message-ID: <1454410216-13333-2-git-send-email-xiao.w.wang@intel.com> (raw)
In-Reply-To: <1454410216-13333-1-git-send-email-xiao.w.wang@intel.com>

This patch enables reading sglort info into mbuf for RX and inserting
an FTAG at the beginning of the packet for TX. The vlan_tci_outer field
selected from rte_mbuf structure for sglort is not used in fm10k now.
In FTAG based forwarding mode, the switch will forward packets according
to glort info in FTAG rather than mac and vlan table.

To activate this feature, user needs to turn ``CONFIG_RTE_LIBRTE_FM10K_FTAG_FWD``
to y in common_linuxapp or common_bsdapp. Currently this feature is supported
only on PF, because FM10K_PFVTCTL register is read-only for VF.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
---
 config/common_bsdapp               |  1 +
 config/common_linuxapp             |  1 +
 drivers/net/fm10k/fm10k_ethdev.c   | 12 ++++++++++++
 drivers/net/fm10k/fm10k_rxtx.c     | 17 +++++++++++++++++
 drivers/net/fm10k/fm10k_rxtx_vec.c |  9 +++++++++
 5 files changed, 40 insertions(+)

diff --git a/config/common_bsdapp b/config/common_bsdapp
index ed7c31c..451f81a 100644
--- a/config/common_bsdapp
+++ b/config/common_bsdapp
@@ -208,6 +208,7 @@ CONFIG_RTE_LIBRTE_FM10K_DEBUG_TX=n
 CONFIG_RTE_LIBRTE_FM10K_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_FM10K_DEBUG_DRIVER=n
 CONFIG_RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE=y
+CONFIG_RTE_LIBRTE_FM10K_FTAG_FWD=n
 
 #
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD
diff --git a/config/common_linuxapp b/config/common_linuxapp
index 74bc515..c928bce 100644
--- a/config/common_linuxapp
+++ b/config/common_linuxapp
@@ -207,6 +207,7 @@ CONFIG_RTE_LIBRTE_FM10K_DEBUG_TX_FREE=n
 CONFIG_RTE_LIBRTE_FM10K_DEBUG_DRIVER=n
 CONFIG_RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE=y
 CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR=y
+CONFIG_RTE_LIBRTE_FM10K_FTAG_FWD=n
 
 #
 # Compile burst-oriented Mellanox ConnectX-3 (MLX4) PMD
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index e4aed94..3a15c24 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -668,6 +668,18 @@ fm10k_dev_tx_init(struct rte_eth_dev *dev)
 			PMD_INIT_LOG(ERR, "failed to disable queue %d", i);
 			return -1;
 		}
+#ifdef RTE_LIBRTE_FM10K_FTAG_FWD
+		/* Enable use of FTAG bit in TX descriptor, PFVTCTL
+		 * register is read-only for VF.
+		 */
+		if (hw->mac.type == fm10k_mac_pf)
+			FM10K_WRITE_REG(hw, FM10K_PFVTCTL(i),
+					FM10K_PFVTCTL_FTAG_DESC_ENABLE);
+		else {
+			PMD_INIT_LOG(ERR, "FTAG is not supported in VF.\n");
+			return -1;
+		}
+#endif
 
 		/* set location and size for descriptor ring */
 		FM10K_WRITE_REG(hw, FM10K_TDBAL(i),
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index e958865..f87987d 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -152,6 +152,13 @@ fm10k_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 */
 		mbuf->ol_flags |= PKT_RX_VLAN_PKT;
 		mbuf->vlan_tci = desc.w.vlan;
+#ifdef RTE_LIBRTE_FM10K_FTAG_FWD
+		/**
+		 * mbuf->vlan_tci_outer is an idle field in fm10k driver,
+		 * so it can be selected to store sglort value.
+		 */
+		mbuf->vlan_tci_outer = rte_le_to_cpu_16(desc.w.sglort);
+#endif
 
 		rx_pkts[count] = mbuf;
 		if (++next_dd == q->nb_desc) {
@@ -307,6 +314,13 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		 */
 		mbuf->ol_flags |= PKT_RX_VLAN_PKT;
 		first_seg->vlan_tci = desc.w.vlan;
+#ifdef RTE_LIBRTE_FM10K_FTAG_FWD
+		/**
+		 * mbuf->vlan_tci_outer is an idle field in fm10k driver,
+		 * so it can be selected to store sglort value.
+		 */
+		first_seg->vlan_tci_outer = rte_le_to_cpu_16(desc.w.sglort);
+#endif
 
 		/* Prefetch data of first segment, if configured to do so. */
 		rte_packet_prefetch((char *)first_seg->buf_addr +
@@ -432,6 +446,9 @@ static inline void tx_xmit_pkt(struct fm10k_tx_queue *q, struct rte_mbuf *mb)
 	q->nb_free -= mb->nb_segs;
 
 	q->hw_ring[q->next_free].flags = 0;
+#ifdef RTE_LIBRTE_FM10K_FTAG_FWD
+	q->hw_ring[q->next_free].flags |= FM10K_TXD_FLAG_FTAG;
+#endif
 	/* set checksum flags on first descriptor of packet. SCTP checksum
 	 * offload is not supported, but we do not explicitly check for this
 	 * case in favor of greatly simplified processing. */
diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 2a57eef..0b0f2e3 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -198,7 +198,12 @@ fm10k_rx_vec_condition_check(struct rte_eth_dev *dev)
 	    rxmode->header_split == 1)
 		return -1;
 
+#ifdef RTE_LIBRTE_FM10K_FTAG_FWD
+	return -1;
+#else
 	return 0;
+#endif
+
 #else
 	RTE_SET_USED(dev);
 	return -1;
@@ -648,7 +653,11 @@ fm10k_tx_vec_condition_check(struct fm10k_tx_queue *txq)
 	if ((txq->txq_flags & FM10K_SIMPLE_TX_FLAG) != FM10K_SIMPLE_TX_FLAG)
 		return -1;
 
+#ifdef RTE_LIBRTE_FM10K_FTAG_FWD
+	return -1;
+#else
 	return 0;
+#endif
 }
 
 static inline void
-- 
1.9.3

  reply	other threads:[~2016-02-02 10:50 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25  8:07 [dpdk-dev] [PATCH 0/3] " Wang Xiao W
2016-01-25  8:07 ` [dpdk-dev] [PATCH 1/3] " Wang Xiao W
2016-02-02  3:07   ` Qiu, Michael
2016-02-02 10:03     ` Wang, Xiao W
2016-02-02 10:50   ` [dpdk-dev] [PATCH v2 0/3] " Wang Xiao W
2016-02-02 10:50     ` Wang Xiao W [this message]
2016-02-03  6:52       ` [dpdk-dev] [PATCH v2 1/3] " Chen, Jing D
2016-02-04  2:39         ` Wang, Xiao W
2016-02-04  3:38       ` [dpdk-dev] [PATCH v3 0/3] " Wang Xiao W
2016-02-04  3:38         ` [dpdk-dev] [PATCH v3 1/3] " Wang Xiao W
2016-02-24 15:42           ` Bruce Richardson
2016-02-24 16:37             ` Thomas Monjalon
2016-02-24 17:05               ` Bruce Richardson
2016-02-25 10:04               ` Chen, Jing D
2016-02-25 13:35                 ` Bruce Richardson
2016-02-25 15:45                   ` Chen, Jing D
2016-02-25 16:14                     ` Bruce Richardson
2016-02-26  4:31                       ` Wang, Xiao W
2016-02-26  9:06                         ` Thomas Monjalon
2016-02-26  9:24                           ` Wang, Xiao W
2016-02-26 14:48                             ` Bruce Richardson
2016-02-26 15:00                               ` David Marchand
2016-02-26 16:33                                 ` Bruce Richardson
2016-02-29  1:47                                   ` Wang, Xiao W
2016-02-26 20:48                             ` Thomas Monjalon
2016-03-01  5:36           ` [dpdk-dev] [PATCH v4 0/3] " Wang Xiao W
2016-03-01  5:36             ` [dpdk-dev] [PATCH v4 1/3] " Wang Xiao W
2016-03-01  7:35               ` Thomas Monjalon
2016-03-01 11:06                 ` Wang, Xiao W
2016-03-01 22:37               ` Stephen Hemminger
2016-03-02  6:05                 ` Wang, Xiao W
2016-03-02 13:47                 ` Thomas Monjalon
2016-03-02 11:19               ` [dpdk-dev] [PATCH v5 0/2] " Wang Xiao W
2016-03-02 11:19                 ` [dpdk-dev] [PATCH v5 1/2] " Wang Xiao W
2016-03-10 16:32                   ` Bruce Richardson
2016-03-02 11:19                 ` [dpdk-dev] [PATCH v5 2/2] doc: add introduction for fm10k " Wang Xiao W
2016-03-08  7:57                 ` [dpdk-dev] [PATCH v5 0/2] fm10k: enable " Liu, Yong
2016-03-10  3:34                   ` Wang, Xiao W
2016-03-10 16:40                 ` Bruce Richardson
2016-03-01  5:36             ` [dpdk-dev] [PATCH v4 2/3] doc: add introduction for fm10k " Wang Xiao W
2016-03-01  5:36             ` [dpdk-dev] [PATCH v4 3/3] doc: update release note for fm10k FTAG support Wang Xiao W
2016-02-04  3:38         ` [dpdk-dev] [PATCH v3 2/3] doc: add introduction for fm10k FTAG based forwarding Wang Xiao W
2016-02-22 14:06           ` Mcnamara, John
2016-02-04  3:38         ` [dpdk-dev] [PATCH v3 3/3] doc: update release note for fm10k FTAG support Wang Xiao W
2016-02-22 13:51           ` Mcnamara, John
2016-02-04  9:47         ` [dpdk-dev] [PATCH v3 0/3] fm10k: enable FTAG based forwarding Chen, Jing D
2016-02-02 10:50     ` [dpdk-dev] [PATCH v2 2/3] doc: add introduction for fm10k " Wang Xiao W
2016-02-02 10:50     ` [dpdk-dev] [PATCH v2 3/3] doc: update release note for fm10k FTAG support Wang Xiao W
2016-01-25  8:07 ` [dpdk-dev] [PATCH 2/3] doc: add introduction for fm10k FTAG based forwarding Wang Xiao W
2016-01-25  8:07 ` [dpdk-dev] [PATCH 3/3] doc: update release note for fm10k FTAG support Wang Xiao W
2016-02-01 16:20   ` Mcnamara, John
2016-01-26  6:01 ` [dpdk-dev] [PATCH 0/3] fm10k: enable FTAG based forwarding Liu, Yong

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=1454410216-13333-2-git-send-email-xiao.w.wang@intel.com \
    --to=xiao.w.wang@intel.com \
    --cc=dev@dpdk.org \
    --cc=jing.d.chen@intel.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).