From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nbfkord-smmo02.seg.att.com (nbfkord-smmo02.seg.att.com [209.65.160.78]) by dpdk.org (Postfix) with ESMTP id 4622C5587 for ; Tue, 29 Nov 2016 17:21:05 +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 1faad385.2b9287a38940.1895587.00-2476.4144512.nbfkord-smmo02.seg.att.com (envelope-from ); Tue, 29 Nov 2016 16:21:05 +0000 (UTC) X-MXL-Hash: 583daaf1069b4ab9-6934709bf58b7bc3f97bc01bc5a2f94de99dc2d4 Received: from unknown [12.187.104.26] by nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with SMTP id deaad385.0.1895549.00-2319.4144496.nbfkord-smmo02.seg.att.com (envelope-from ); Tue, 29 Nov 2016 16:21:04 +0000 (UTC) X-MXL-Hash: 583daaf048f1ab46-f76c1aae50371727d56ac799302bb56354d86550 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; Tue, 29 Nov 2016 08:20:26 -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; Tue, 29 Nov 2016 08:20:26 -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 uATGKP4t030053; Tue, 29 Nov 2016 16:20:25 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 uATGKM1x021233; Tue, 29 Nov 2016 16:20:24 GMT From: Andrew Rybchenko To: CC: , Ivan Malov Date: Tue, 29 Nov 2016 16:19:23 +0000 Message-ID: <1480436367-20749-52-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1480436367-20749-1-git-send-email-arybchenko@solarflare.com> References: <1479740470-6723-1-git-send-email-arybchenko@solarflare.com> <1480436367-20749-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain 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 v2 51/55] 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: , X-List-Received-Date: Tue, 29 Nov 2016 16:21:05 -0000 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/Makefile | 1 + drivers/net/sfc/sfc.c | 14 ++++++ drivers/net/sfc/sfc.h | 6 +++ drivers/net/sfc/sfc_ethdev.c | 17 ++++++++ drivers/net/sfc/sfc_tx.c | 82 ++++++++++++++++++++++++++++++++++++ drivers/net/sfc/sfc_tx.h | 53 +++++++++++++++++++++++ 8 files changed, 177 insertions(+) create mode 100644 drivers/net/sfc/sfc_tx.c create mode 100644 drivers/net/sfc/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/Makefile b/drivers/net/sfc/Makefile index f8969af..dd099b2 100644 --- a/drivers/net/sfc/Makefile +++ b/drivers/net/sfc/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/sfc.c b/drivers/net/sfc/sfc.c index 1c0f59d..6990ccd 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/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/sfc.h b/drivers/net/sfc/sfc.h index 06fe9ea..29d3a6b 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/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/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 4e1a3c2..4cddc9f 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -53,16 +53,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/sfc_tx.c b/drivers/net/sfc/sfc_tx.c new file mode 100644 index 0000000..ef4be45 --- /dev/null +++ b/drivers/net/sfc/sfc_tx.c @@ -0,0 +1,82 @@ +/*- + * 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) +{ + sfc_log_init(sa, "TxQ = %u", sw_index); + + return 0; +} + +int +sfc_tx_init(struct sfc_adapter *sa) +{ + unsigned 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/sfc_tx.h b/drivers/net/sfc/sfc_tx.h new file mode 100644 index 0000000..549abc4 --- /dev/null +++ b/drivers/net/sfc/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 */ -- 2.5.5