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 9301A558C for ; Thu, 15 Dec 2016 13:52:18 +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 20292585.2b633f471940.1049164.00-2494.2166175.nbfkord-smmo03.seg.att.com (envelope-from ); Thu, 15 Dec 2016 12:52:18 +0000 (UTC) X-MXL-Hash: 5852920234abae54-73d6d4d8cda1c5665724ea2c7de123f4bc150ecd Received: from unknown [12.187.104.26] by nbfkord-smmo03.seg.att.com(mxl_mta-7.2.4-7) with SMTP id 10292585.0.1049147.00-2344.2166164.nbfkord-smmo03.seg.att.com (envelope-from ); Thu, 15 Dec 2016 12:52:17 +0000 (UTC) X-MXL-Hash: 5852920120c94b4d-1f65c85915734d2ceb32ed1edc96e200f4fc7fc5 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:06 -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 uBFCq4M7006412; 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 uBFCpces010431; Thu, 15 Dec 2016 12:52:04 GMT From: Andrew Rybchenko To: CC: Date: Thu, 15 Dec 2016 12:51:10 +0000 Message-ID: <1481806283-10387-20-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=sBjm08WUN41eEaLJI] X-AnalysisOut: [NwA: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 19/32] net/sfc: support scattered Rx DMA 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:19 -0000 Signed-off-by: Andrew Rybchenko Reviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse --- doc/guides/nics/features/sfc_efx.ini | 1 + doc/guides/nics/sfc_efx.rst | 4 ++-- drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/sfc/sfc_rx.c | 39 +++++++++++++++++++++++++++--------- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index b5887d5..74cc942 100644 --- a/doc/guides/nics/features/sfc_efx.ini +++ b/doc/guides/nics/features/sfc_efx.ini @@ -9,6 +9,7 @@ Link status = Y Link status event = Y MTU update = Y Jumbo frame = Y +Scattered Rx = Y Promiscuous mode = Y Allmulticast mode = Y Multicast MAC filter = Y diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 1333f8b..2e30dfe 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -69,6 +69,8 @@ SFC EFX PMD has support for: - Received packet type information +- Scattered Rx DMA for packet that are larger that a single Rx descriptor + Non-supported Features ---------------------- @@ -89,8 +91,6 @@ The features not yet supported include: - VLAN stripping -- Scattered receive - - LRO diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 59dcdb4..f1b655b 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -840,6 +840,7 @@ sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, qinfo->mp = rxq->refill_mb_pool; qinfo->conf.rx_free_thresh = rxq->refill_threshold; qinfo->conf.rx_drop_en = 1; + qinfo->scattered_rx = (rxq_info->type == EFX_RXQ_TYPE_SCATTER); qinfo->nb_desc = rxq_info->entries; sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 802beb2..2909ec0 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -193,6 +193,7 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) unsigned int prefix_size = rxq->prefix_size; unsigned int done_pkts = 0; boolean_t discard_next = B_FALSE; + struct rte_mbuf *scatter_pkt = NULL; if (unlikely((rxq->state & SFC_RXQ_RUNNING) == 0)) return 0; @@ -218,9 +219,6 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) if (desc_flags & (EFX_ADDR_MISMATCH | EFX_DISCARD)) goto discard; - if (desc_flags & EFX_PKT_CONT) - goto discard; - if (desc_flags & EFX_PKT_PREFIX_LEN) { uint16_t tmp_size; int rc __rte_unused; @@ -237,6 +235,29 @@ 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; + if (scatter_pkt != NULL) { + if (rte_pktmbuf_chain(scatter_pkt, m) != 0) { + rte_mempool_put(rxq->refill_mb_pool, + scatter_pkt); + goto discard; + } + /* The packet to deliver */ + m = scatter_pkt; + } + + if (desc_flags & EFX_PKT_CONT) { + /* The packet is scattered, more fragments to come */ + scatter_pkt = m; + /* Futher fragments have no prefix */ + prefix_size = 0; + continue; + } + + /* Scattered packet is done */ + scatter_pkt = NULL; + /* The first fragment of the packet has prefix */ + prefix_size = rxq->prefix_size; + m->ol_flags = sfc_rx_desc_flags_to_offload_flags(desc_flags); m->packet_type = sfc_rx_desc_flags_to_packet_type(desc_flags); @@ -250,6 +271,9 @@ sfc_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxd->mbuf = NULL; } + /* pending is only moved when entire packet is received */ + SFC_ASSERT(scatter_pkt == NULL); + rxq->completed = completed; sfc_rx_qrefill(rxq); @@ -618,7 +642,9 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, SFC_ASSERT(nb_rx_desc <= rxq_info->max_entries); rxq_info->entries = nb_rx_desc; - rxq_info->type = EFX_RXQ_TYPE_DEFAULT; + rxq_info->type = + sa->eth_dev->data->dev_conf.rxmode.enable_scatter ? + EFX_RXQ_TYPE_SCATTER : EFX_RXQ_TYPE_DEFAULT; evq_index = sfc_evq_index_by_rxq_sw_index(sa, sw_index); @@ -806,11 +832,6 @@ sfc_rx_check_mode(struct sfc_adapter *sa, struct rte_eth_rxmode *rxmode) rxmode->hw_strip_crc = 1; } - if (rxmode->enable_scatter) { - sfc_err(sa, "Scatter on Rx not supported"); - rc = EINVAL; - } - if (rxmode->enable_lro) { sfc_err(sa, "LRO not supported"); rc = EINVAL; -- 2.5.5