From patchwork Mon Nov 21 15:01:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 17158 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 300D5D6AE; Mon, 21 Nov 2016 16:03:56 +0100 (CET) Received: from nbfkord-smmo02.seg.att.com (nbfkord-smmo02.seg.att.com [209.65.160.78]) by dpdk.org (Postfix) with ESMTP id 4C6A95591 for ; Mon, 21 Nov 2016 16:01:57 +0100 (CET) Received: from unknown [12.187.104.26] (EHLO nbfkord-smmo02.seg.att.com) by nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with ESMTP id 56c03385.2b927c626940.1541335.00-2452.3424387.nbfkord-smmo02.seg.att.com (envelope-from ); Mon, 21 Nov 2016 15:01:57 +0000 (UTC) X-MXL-Hash: 58330c656658b08e-9c954cbbd4fbceee8e85615be166af0e79d43f8d Received: from unknown [12.187.104.26] by nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with SMTP id e5c03385.0.1541296.00-2373.3424288.nbfkord-smmo02.seg.att.com (envelope-from ); Mon, 21 Nov 2016 15:01:52 +0000 (UTC) X-MXL-Hash: 58330c606c485706-df9f3bae0a1c2ad9006d5e2042800fd5529492ee Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Mon, 21 Nov 2016 07:01:22 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Mon, 21 Nov 2016 07:01:22 -0800 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id uALF1LUF007254; Mon, 21 Nov 2016 15:01:21 GMT Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id uALF1J3h006765; Mon, 21 Nov 2016 15:01:21 GMT From: Andrew Rybchenko To: CC: Ivan Malov Date: Mon, 21 Nov 2016 15:01:06 +0000 Message-ID: <1479740470-6723-53-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1479740470-6723-1-git-send-email-arybchenko@solarflare.com> References: <1479740470-6723-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-AnalysisOut: [v=2.1 cv=UI/baXry c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==] X-AnalysisOut: [:17 a=L24OOQBejmoA:10 a=pK7X0mNQAAAA:8 a=zRKbQ67AAAAA:8 a=] X-AnalysisOut: [VgnQRC0rv40TPQbQx8YA:9 a=5HA-qpC1VU4iIGLgRoNS:22 a=PA03WX8] X-AnalysisOut: [tBzeizutn5_OT:22] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [12.187.104.26] Subject: [dpdk-dev] [PATCH 52/56] net/sfc: provide basic stubs for Tx subsystem 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Ivan Malov Reviewed-by: Andy Moreton Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko --- doc/guides/nics/features/sfc_efx.ini | 2 + doc/guides/nics/sfc_efx.rst | 2 + drivers/net/sfc/efx/Makefile | 1 + drivers/net/sfc/efx/sfc.c | 14 ++++++ drivers/net/sfc/efx/sfc.h | 6 +++ drivers/net/sfc/efx/sfc_ethdev.c | 17 ++++++++ drivers/net/sfc/efx/sfc_tx.c | 85 ++++++++++++++++++++++++++++++++++++ drivers/net/sfc/efx/sfc_tx.h | 53 ++++++++++++++++++++++ 8 files changed, 180 insertions(+) create mode 100644 drivers/net/sfc/efx/sfc_tx.c create mode 100644 drivers/net/sfc/efx/sfc_tx.h diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index 7dc2e92..67df1c6 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -5,6 +5,8 @@ ; [Features] Link status = Y +L3 checksum offload = P +L4 checksum offload = P BSD nic_uio = Y Linux UIO = Y Linux VFIO = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 8145a6b..aadd775 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -46,6 +46,8 @@ SFC EFX PMD has support for: - Link state information +- IPv4/IPv6 TCP/UDP transmit checksum offload + Non-supported Features ---------------------- diff --git a/drivers/net/sfc/efx/Makefile b/drivers/net/sfc/efx/Makefile index eb82c89..8ecca83 100644 --- a/drivers/net/sfc/efx/Makefile +++ b/drivers/net/sfc/efx/Makefile @@ -88,6 +88,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_intr.c SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_ev.c SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_port.c SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_rx.c +SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc_tx.c VPATH += $(SRCDIR)/base diff --git a/drivers/net/sfc/efx/sfc.c b/drivers/net/sfc/efx/sfc.c index 1c0f59d..6990ccd 100644 --- a/drivers/net/sfc/efx/sfc.c +++ b/drivers/net/sfc/efx/sfc.c @@ -38,6 +38,7 @@ #include "sfc_log.h" #include "sfc_ev.h" #include "sfc_rx.h" +#include "sfc_tx.h" int @@ -362,10 +363,17 @@ sfc_configure(struct sfc_adapter *sa) if (rc != 0) goto fail_rx_init; + rc = sfc_tx_init(sa); + if (rc != 0) + goto fail_tx_init; + sa->state = SFC_ADAPTER_CONFIGURED; sfc_log_init(sa, "done"); return 0; +fail_tx_init: + sfc_rx_fini(sa); + fail_rx_init: sfc_port_fini(sa); @@ -392,6 +400,7 @@ sfc_close(struct sfc_adapter *sa) SFC_ASSERT(sa->state == SFC_ADAPTER_CONFIGURED); sa->state = SFC_ADAPTER_CLOSING; + sfc_tx_fini(sa); sfc_rx_fini(sa); sfc_port_fini(sa); sfc_ev_fini(sa); @@ -438,6 +447,7 @@ int sfc_attach(struct sfc_adapter *sa) { struct rte_pci_device *pci_dev = sa->eth_dev->pci_dev; + const efx_nic_cfg_t *encp; efx_nic_t *enp; int rc; @@ -488,6 +498,10 @@ sfc_attach(struct sfc_adapter *sa) if (rc != 0) goto fail_estimate_rsrc_limits; + encp = efx_nic_cfg_get(sa->nic); + sa->txq_max_entries = encp->enc_txq_max_ndescs; + SFC_ASSERT(rte_is_power_of_2(sa->txq_max_entries)); + rc = sfc_intr_attach(sa); if (rc != 0) goto fail_intr_attach; diff --git a/drivers/net/sfc/efx/sfc.h b/drivers/net/sfc/efx/sfc.h index a592b53..de0395e 100644 --- a/drivers/net/sfc/efx/sfc.h +++ b/drivers/net/sfc/efx/sfc.h @@ -115,6 +115,7 @@ struct sfc_intr { struct sfc_evq_info; struct sfc_rxq_info; +struct sfc_txq_info; struct sfc_port { unsigned int flow_ctrl; @@ -148,6 +149,8 @@ struct sfc_adapter { unsigned int rxq_max; unsigned int txq_max; + unsigned int txq_max_entries; + unsigned int evq_count; struct sfc_evq_info *evq_info; @@ -156,6 +159,9 @@ struct sfc_adapter { unsigned int rxq_count; struct sfc_rxq_info *rxq_info; + + unsigned int txq_count; + struct sfc_txq_info *txq_info; }; /* diff --git a/drivers/net/sfc/efx/sfc_ethdev.c b/drivers/net/sfc/efx/sfc_ethdev.c index 61ae1bd..4afd30c 100644 --- a/drivers/net/sfc/efx/sfc_ethdev.c +++ b/drivers/net/sfc/efx/sfc_ethdev.c @@ -51,16 +51,33 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX; dev_info->max_rx_queues = sa->rxq_max; + dev_info->max_tx_queues = sa->txq_max; /* By default packets are dropped if no descriptors are available */ dev_info->default_rxconf.rx_drop_en = 1; + dev_info->tx_offload_capa = + DEV_TX_OFFLOAD_IPV4_CKSUM | + DEV_TX_OFFLOAD_UDP_CKSUM | + DEV_TX_OFFLOAD_TCP_CKSUM; + + dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOVLANOFFL | + ETH_TXQ_FLAGS_NOXSUMSCTP; + dev_info->rx_desc_lim.nb_max = EFX_RXQ_MAXNDESCS; dev_info->rx_desc_lim.nb_min = EFX_RXQ_MINNDESCS; /* The RXQ hardware requires that the descriptor count is a power * of 2, but rx_desc_lim cannot properly describe that constraint. */ dev_info->rx_desc_lim.nb_align = EFX_RXQ_MINNDESCS; + + dev_info->tx_desc_lim.nb_max = sa->txq_max_entries; + dev_info->tx_desc_lim.nb_min = EFX_TXQ_MINNDESCS; + /* + * The TXQ hardware requires that the descriptor count is a power + * of 2, but tx_desc_lim cannot properly describe that constraint + */ + dev_info->tx_desc_lim.nb_align = EFX_TXQ_MINNDESCS; } static int diff --git a/drivers/net/sfc/efx/sfc_tx.c b/drivers/net/sfc/efx/sfc_tx.c new file mode 100644 index 0000000..c418185 --- /dev/null +++ b/drivers/net/sfc/efx/sfc_tx.c @@ -0,0 +1,85 @@ +/*- + * Copyright (c) 2016 Solarflare Communications Inc. + * All rights reserved. + * + * This software was jointly developed between OKTET Labs (under contract + * for Solarflare) and Solarflare Communications, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sfc.h" +#include "sfc_log.h" +#include "sfc_ev.h" +#include "sfc_tx.h" + +static int +sfc_tx_qinit_info(struct sfc_adapter *sa, unsigned int sw_index) +{ + struct sfc_txq_info *txq_info = &sa->txq_info[sw_index]; + int rc = 0; + + sfc_log_init(sa, "TxQ = %u", sw_index); + + return 0; +} + +int +sfc_tx_init(struct sfc_adapter *sa) +{ + int sw_index; + int rc = 0; + + sa->txq_count = sa->eth_dev->data->nb_tx_queues; + + sa->txq_info = rte_calloc_socket("sfc-txqs", sa->txq_count, + sizeof(sa->txq_info[0]), 0, + sa->socket_id); + if (sa->txq_info == NULL) + goto fail_txqs_alloc; + + for (sw_index = 0; sw_index < sa->txq_count; ++sw_index) { + rc = sfc_tx_qinit_info(sa, sw_index); + if (rc != 0) + goto fail_tx_qinit_info; + } + + return 0; + +fail_tx_qinit_info: + rte_free(sa->txq_info); + sa->txq_info = NULL; + +fail_txqs_alloc: + sa->txq_count = 0; + + sfc_log_init(sa, "failed (rc = %d)", rc); + return rc; +} + +void +sfc_tx_fini(struct sfc_adapter *sa) +{ + rte_free(sa->txq_info); + sa->txq_info = NULL; + sa->txq_count = 0; +} diff --git a/drivers/net/sfc/efx/sfc_tx.h b/drivers/net/sfc/efx/sfc_tx.h new file mode 100644 index 0000000..b2d4875 --- /dev/null +++ b/drivers/net/sfc/efx/sfc_tx.h @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2016 Solarflare Communications Inc. + * All rights reserved. + * + * This software was jointly developed between OKTET Labs (under contract + * for Solarflare) and Solarflare Communications, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _SFC_TX_H +#define _SFC_TX_H + +#include +#include + +#include "efx.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct sfc_adapter; + +struct sfc_txq_info { +}; + +int sfc_tx_init(struct sfc_adapter *sa); +void sfc_tx_fini(struct sfc_adapter *sa); + +#ifdef __cplusplus +} +#endif +#endif /* _SFC_TX_H */