From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from netronome.com (host-79-78-33-110.static.as9105.net [79.78.33.110]) by dpdk.org (Postfix) with ESMTP id 2AA86FB1B for ; Tue, 20 Dec 2016 11:18:19 +0100 (CET) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id uBKAIJjk009668 for ; Tue, 20 Dec 2016 10:18:19 GMT Received: (from alucero@localhost) by netronome.com (8.14.4/8.14.4/Submit) id uBKAIJBW009667 for dev@dpdk.org; Tue, 20 Dec 2016 10:18:19 GMT From: Alejandro Lucero To: dev@dpdk.org Date: Tue, 20 Dec 2016 10:18:19 +0000 Message-Id: <1482229099-9629-1-git-send-email-alejandro.lucero@netronome.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] nfp: add tso support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2016 10:18:20 -0000 This patch implements NFP PMD support for TSO but it also requires a firmware advertising the capability. Signed-off-by: Alejandro Lucero --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/nfp_net.c | 40 ++++++++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 7ac0d34..c04a738 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -11,6 +11,7 @@ Queue start/stop = Y MTU update = Y Jumbo frame = Y Promiscuous mode = Y +TSO = Y RSS hash = Y RSS key update = Y RSS reta update = Y diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index ace9583..cee8f63 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -1147,6 +1147,9 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) dev_info->speed_capa = ETH_SPEED_NUM_1G | ETH_LINK_SPEED_10G | ETH_SPEED_NUM_25G | ETH_SPEED_NUM_40G | ETH_SPEED_NUM_50G | ETH_LINK_SPEED_100G; + + if (hw->cap & NFP_NET_CFG_CTRL_LSO) + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_TCP_TSO; } static const uint32_t * @@ -1641,6 +1644,27 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) return 0; } +/* nfp_net_tx_tso - Set TX descriptor for TSO */ +static inline void +nfp_net_tx_tso(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd, + struct rte_mbuf *mb) +{ + uint64_t ol_flags; + struct nfp_net_hw *hw = txq->hw; + + if (!(hw->cap & NFP_NET_CFG_CTRL_LSO)) + return; + + ol_flags = mb->ol_flags; + + if (!(ol_flags & PKT_TX_TCP_SEG)) + return; + + txd->l4_offset = mb->l2_len + mb->l3_len + mb->l4_len; + txd->lso = rte_cpu_to_le_16(mb->tso_segsz); + txd->flags |= PCIE_DESC_TX_LSO; +} + /* nfp_net_tx_cksum - Set TX CSUM offload flags in TX descriptor */ static inline void nfp_net_tx_cksum(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd, @@ -2009,7 +2033,7 @@ uint32_t nfp_net_txq_full(struct nfp_net_txq *txq) { struct nfp_net_txq *txq; struct nfp_net_hw *hw; - struct nfp_net_tx_desc *txds; + struct nfp_net_tx_desc *txds, txd; struct rte_mbuf *pkt; uint64_t dma_addr; int pkt_size, dma_size; @@ -2058,19 +2082,17 @@ uint32_t nfp_net_txq_full(struct nfp_net_txq *txq) /* * Checksum and VLAN flags just in the first descriptor for a - * multisegment packet + * multisegment packet, but TSO info needs to be in all of them. */ - nfp_net_tx_cksum(txq, txds, pkt); + nfp_net_tx_tso(txq, &txd, pkt); + nfp_net_tx_cksum(txq, &txd, pkt); if ((pkt->ol_flags & PKT_TX_VLAN_PKT) && (hw->cap & NFP_NET_CFG_CTRL_TXVLAN)) { - txds->flags |= PCIE_DESC_TX_VLAN; - txds->vlan = pkt->vlan_tci; + txd.flags |= PCIE_DESC_TX_VLAN; + txd.vlan = pkt->vlan_tci; } - if (pkt->ol_flags & PKT_TX_TCP_SEG) - rte_panic("TSO is not supported\n"); - /* * mbuf data_len is the data in one segment and pkt_len data * in the whole packet. When the packet is just one segment, @@ -2088,6 +2110,8 @@ uint32_t nfp_net_txq_full(struct nfp_net_txq *txq) *lmbuf = pkt; while (pkt_size) { + /* Copying TSO, VLAN and cksum info */ + *txds = txd; dma_size = pkt->data_len; dma_addr = rte_mbuf_data_dma_addr(pkt); PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:" -- 1.9.1