From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nbfkord-smmo03.seg.att.com (nbfkord-smmo03.seg.att.com [209.65.160.84]) by dpdk.org (Postfix) with ESMTP id 9C774558B for ; Thu, 15 Dec 2016 13:52:17 +0100 (CET) Received: from unknown [12.187.104.26] (EHLO nbfkord-smmo03.seg.att.com) by nbfkord-smmo03.seg.att.com(mxl_mta-7.2.4-7) with ESMTP id 10292585.2b635b69e940.1049162.00-2494.2166169.nbfkord-smmo03.seg.att.com (envelope-from ); Thu, 15 Dec 2016 12:52:17 +0000 (UTC) X-MXL-Hash: 58529201008b2157-086f19875e1771cc6e3a17c813131dbcdf59606a Received: from unknown [12.187.104.26] by nbfkord-smmo03.seg.att.com(mxl_mta-7.2.4-7) with SMTP id ff192585.0.1049147.00-2355.2166159.nbfkord-smmo03.seg.att.com (envelope-from ); Thu, 15 Dec 2016 12:52:16 +0000 (UTC) X-MXL-Hash: 5852920043def29f-79165a5ef4ef51314a0c680f0416b96371d1f916 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; Thu, 15 Dec 2016 04:52:05 -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; Thu, 15 Dec 2016 04:52:05 -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 uBFCq4mG006394; Thu, 15 Dec 2016 12:52:04 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 uBFCpcem010431; Thu, 15 Dec 2016 12:52:04 GMT From: Andrew Rybchenko To: CC: Date: Thu, 15 Dec 2016 12:51:04 +0000 Message-ID: <1481806283-10387-14-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1481806283-10387-1-git-send-email-arybchenko@solarflare.com> References: <1480664691-26561-1-git-send-email-arybchenko@solarflare.com> <1481806283-10387-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-AnalysisOut: [v=2.1 cv=HuVwbhnS c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==] X-AnalysisOut: [:17 a=n5n_aSjo0skA:10 a=zRKbQ67AAAAA:8 a=1c0Gvsut1gQ0ElyZZ] X-AnalysisOut: [jwA:9 a=PA03WX8tBzeizutn5_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 13/32] net/sfc: support checksum offloads on receive 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: Thu, 15 Dec 2016 12:52:18 -0000 IPv4 header and TCP/UDP checksums for both IPv4 and IPv6 are supported. Signed-off-by: Andrew Rybchenko Reviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse --- doc/guides/nics/features/sfc_efx.ini | 4 ++-- doc/guides/nics/sfc_efx.rst | 2 ++ drivers/net/sfc/sfc_ethdev.c | 5 +++++ drivers/net/sfc/sfc_rx.c | 40 ++++++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index 35633cb..ec1d1db 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -13,8 +13,8 @@ Promiscuous mode = Y Allmulticast mode = Y Multicast MAC filter = Y Flow control = Y -L3 checksum offload = P -L4 checksum offload = P +L3 checksum offload = Y +L4 checksum offload = Y Basic stats = Y Extended stats = Y BSD nic_uio = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 43dd4cf..8724eae 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -65,6 +65,8 @@ SFC EFX PMD has support for: - Multicast MAC filter +- IPv4/IPv6 TCP/UDP receive checksum offload + Non-supported Features ---------------------- diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 268b76a..235582d 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -68,6 +68,11 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) /* By default packets are dropped if no descriptors are available */ dev_info->default_rxconf.rx_drop_en = 1; + dev_info->rx_offload_capa = + DEV_RX_OFFLOAD_IPV4_CKSUM | + DEV_RX_OFFLOAD_UDP_CKSUM | + DEV_RX_OFFLOAD_TCP_CKSUM; + dev_info->tx_offload_capa = DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM | diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index bd41131..4df4132 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -130,6 +130,45 @@ sfc_rx_qrefill(struct sfc_rxq *rxq) } } +static uint64_t +sfc_rx_desc_flags_to_offload_flags(const unsigned int desc_flags) +{ + uint64_t mbuf_flags = 0; + + switch (desc_flags & (EFX_PKT_IPV4 | EFX_CKSUM_IPV4)) { + case (EFX_PKT_IPV4 | EFX_CKSUM_IPV4): + mbuf_flags |= PKT_RX_IP_CKSUM_GOOD; + break; + case EFX_PKT_IPV4: + mbuf_flags |= PKT_RX_IP_CKSUM_BAD; + break; + default: + RTE_BUILD_BUG_ON(PKT_RX_IP_CKSUM_UNKNOWN != 0); + SFC_ASSERT((mbuf_flags & PKT_RX_IP_CKSUM_MASK) == + PKT_RX_IP_CKSUM_UNKNOWN); + break; + } + + switch ((desc_flags & + (EFX_PKT_TCP | EFX_PKT_UDP | EFX_CKSUM_TCPUDP))) { + case (EFX_PKT_TCP | EFX_CKSUM_TCPUDP): + case (EFX_PKT_UDP | EFX_CKSUM_TCPUDP): + mbuf_flags |= PKT_RX_L4_CKSUM_GOOD; + break; + case EFX_PKT_TCP: + case EFX_PKT_UDP: + mbuf_flags |= PKT_RX_L4_CKSUM_BAD; + break; + default: + RTE_BUILD_BUG_ON(PKT_RX_L4_CKSUM_UNKNOWN != 0); + SFC_ASSERT((mbuf_flags & PKT_RX_L4_CKSUM_MASK) == + PKT_RX_L4_CKSUM_UNKNOWN); + break; + } + + return mbuf_flags; +} + uint16_t sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { @@ -182,6 +221,7 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rte_pktmbuf_data_len(m) = seg_len; rte_pktmbuf_pkt_len(m) = seg_len; + m->ol_flags = sfc_rx_desc_flags_to_offload_flags(desc_flags); m->packet_type = RTE_PTYPE_L2_ETHER; *rx_pkts++ = m; -- 2.5.5