From: Andrew Rybchenko Date: Thu, 15 Dec 2016 12:51:10 +0000 (+0000) Subject: net/sfc: support scattered Rx DMA X-Git-Tag: spdx-start~4982 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e0b063941e03c8872c799a3208634a46efa1b79a;p=dpdk.git net/sfc: support scattered Rx DMA Signed-off-by: Andrew Rybchenko Reviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse --- diff --git a/doc/guides/nics/features/sfc_efx.ini b/doc/guides/nics/features/sfc_efx.ini index b5887d5a24..74cc94227e 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 1333f8b1f5..2e30dfe90b 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 8c845e9728..f3ab8bdac5 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -839,6 +839,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 802beb2b32..2909ec0818 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 @@ discard: 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;