From patchwork Thu Jun 1 11:42:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Pryazhennikov X-Patchwork-Id: 127835 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EEACB42C02; Thu, 1 Jun 2023 13:42:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 023CC42D3A; Thu, 1 Jun 2023 13:42:30 +0200 (CEST) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id 769FB4161A for ; Thu, 1 Jun 2023 13:42:25 +0200 (CEST) Received: from localhost.localdomain (unknown [37.252.90.53]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA512) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id DBF1FE12C3; Thu, 1 Jun 2023 15:42:24 +0400 (+04) From: Denis Pryazhennikov To: dev@dpdk.org Cc: Viacheslav Galaktionov , Ferruh Yigit , Andrew Rybchenko , Roman Zhukov , Andy Moreton Subject: [PATCH 4/4] net/sfc: add configurable Rx CRC stripping Date: Thu, 1 Jun 2023 15:42:20 +0400 Message-Id: <20230601114220.17796-5-denis.pryazhennikov@arknetworks.am> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230601114220.17796-1-denis.pryazhennikov@arknetworks.am> References: <20230601114220.17796-1-denis.pryazhennikov@arknetworks.am> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Configurable Rx CRC stripping is allowed only if running firmware variant supports it and if NIC is configured with single PF per port and without VFs. Signed-off-by: Roman Zhukov Signed-off-by: Denis Pryazhennikov Reviewed-by: Andy Moreton --- doc/guides/nics/features/sfc.ini | 1 + doc/guides/nics/sfc_efx.rst | 6 ++++-- drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_ef10_rx.c | 3 ++- drivers/net/sfc/sfc_port.c | 12 ++++++++++++ drivers/net/sfc/sfc_rx.c | 6 +++++- 6 files changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/guides/nics/features/sfc.ini b/doc/guides/nics/features/sfc.ini index f5ac644278ae..c41c47a63d49 100644 --- a/doc/guides/nics/features/sfc.ini +++ b/doc/guides/nics/features/sfc.ini @@ -23,6 +23,7 @@ RSS key update = Y RSS reta update = Y SR-IOV = Y Flow control = Y +CRC offload = Y VLAN offload = P L3 checksum offload = Y L4 checksum offload = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index de0656876b96..b3a44e7ddd92 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -114,6 +114,10 @@ SFC EFX PMD has support for: - Loopback +- Configurable Rx CRC stripping (if running firmware variant supports it and + if NIC is configured with single PF per port and without VFs, otherwise + always stripped) + - SR-IOV PF - Port representors (see :ref: switch_representation) @@ -126,8 +130,6 @@ The features not yet supported include: - Priority-based flow control -- Configurable RX CRC stripping (always stripped) - - Header split on receive - VLAN filtering diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 730d054aea74..5c97d5911eb2 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -72,6 +72,7 @@ struct sfc_port { unsigned int flow_ctrl; boolean_t flow_ctrl_autoneg; size_t pdu; + boolean_t include_fcs; /* * Flow API isolated mode overrides promisc and allmulti settings; diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c index 7be224c9c412..08fe41fe5d94 100644 --- a/drivers/net/sfc/sfc_ef10_rx.c +++ b/drivers/net/sfc/sfc_ef10_rx.c @@ -826,7 +826,8 @@ struct sfc_dp_rx sfc_ef10_rx = { .dev_offload_capa = RTE_ETH_RX_OFFLOAD_CHECKSUM | RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM | RTE_ETH_RX_OFFLOAD_RSS_HASH, - .queue_offload_capa = RTE_ETH_RX_OFFLOAD_SCATTER, + .queue_offload_capa = RTE_ETH_RX_OFFLOAD_SCATTER | + RTE_ETH_RX_OFFLOAD_KEEP_CRC, .get_dev_info = sfc_ef10_rx_get_dev_info, .qsize_up_rings = sfc_ef10_rx_qsize_up_rings, .qcreate = sfc_ef10_rx_qcreate, diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index 5f312ab1ba83..24d2daf6282b 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -250,6 +250,11 @@ sfc_port_start(struct sfc_adapter *sa) if (rc != 0) goto fail_mac_pdu_set; + sfc_log_init(sa, "set include FCS=%u", port->include_fcs); + rc = efx_mac_include_fcs_set(sa->nic, port->include_fcs); + if (rc != 0) + goto fail_include_fcs_set; + if (!sfc_sa2shared(sa)->isolated) { struct rte_ether_addr *addr = &port->default_mac_addr; @@ -337,6 +342,7 @@ sfc_port_start(struct sfc_adapter *sa) (void)efx_mac_drain(sa->nic, B_TRUE); fail_mac_drain: +fail_include_fcs_set: fail_mac_stats_upload: (void)efx_mac_stats_periodic(sa->nic, &port->mac_stats_dma_mem, 0, B_FALSE); @@ -384,11 +390,17 @@ sfc_port_configure(struct sfc_adapter *sa) { const struct rte_eth_dev_data *dev_data = sa->eth_dev->data; struct sfc_port *port = &sa->port; + const struct rte_eth_rxmode *rxmode = &dev_data->dev_conf.rxmode; sfc_log_init(sa, "entry"); port->pdu = EFX_MAC_PDU(dev_data->mtu); + if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC) + port->include_fcs = true; + else + port->include_fcs = false; + return 0; } diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index edd0f0c03842..f80771778c64 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -655,7 +655,8 @@ struct sfc_dp_rx sfc_efx_rx = { .features = SFC_DP_RX_FEAT_INTR, .dev_offload_capa = RTE_ETH_RX_OFFLOAD_CHECKSUM | RTE_ETH_RX_OFFLOAD_RSS_HASH, - .queue_offload_capa = RTE_ETH_RX_OFFLOAD_SCATTER, + .queue_offload_capa = RTE_ETH_RX_OFFLOAD_SCATTER | + RTE_ETH_RX_OFFLOAD_KEEP_CRC, .qsize_up_rings = sfc_efx_rx_qsize_up_rings, .qcreate = sfc_efx_rx_qcreate, .qdestroy = sfc_efx_rx_qdestroy, @@ -938,6 +939,9 @@ sfc_rx_get_offload_mask(struct sfc_adapter *sa) if (encp->enc_tunnel_encapsulations_supported == 0) no_caps |= RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM; + if (encp->enc_rx_include_fcs_supported == 0) + no_caps |= RTE_ETH_RX_OFFLOAD_KEEP_CRC; + return ~no_caps; }