From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 822779250 for ; Tue, 5 Jan 2016 13:31:46 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 05 Jan 2016 04:31:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,525,1444719600"; d="scan'208";a="720534316" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 05 Jan 2016 04:31:45 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id u05CVgkA017428; Tue, 5 Jan 2016 20:31:42 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id u05CVdX4024290; Tue, 5 Jan 2016 20:31:41 +0800 Received: (from xiaowan1@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id u05CVdnp024286; Tue, 5 Jan 2016 20:31:39 +0800 From: Wang Xiao W To: jing.d.chen@intel.com, bruce.richardson@intel.com Date: Tue, 5 Jan 2016 20:31:34 +0800 Message-Id: <1451997096-24248-2-git-send-email-xiao.w.wang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1451997096-24248-1-git-send-email-xiao.w.wang@intel.com> References: <1451997096-24248-1-git-send-email-xiao.w.wang@intel.com> Cc: dev@dpdk.org Subject: [dpdk-dev] [RFC PATCH 1/3] fm10k: enable FTAG based forwarding X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2016 12:31:47 -0000 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. Signed-off-by: Wang Xiao W --- config/common_bsdapp | 1 + config/common_linuxapp | 1 + drivers/net/fm10k/fm10k_ethdev.c | 5 +++++ drivers/net/fm10k/fm10k_rxtx.c | 17 +++++++++++++++++ drivers/net/fm10k/fm10k_rxtx_vec.c | 9 +++++++++ 5 files changed, 33 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..d5c376a 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -668,6 +668,11 @@ 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, register is RO for VF */ + if (hw->mac.type == fm10k_mac_pf) + FM10K_WRITE_REG(hw, FM10K_PFVTCTL(i), FM10K_PFVTCTL_FTAG_DESC_ENABLE); +#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