From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by dpdk.org (Postfix) with ESMTP id EF6F88049 for ; Wed, 17 Dec 2014 06:13:52 +0100 (CET) Received: by mail-pa0-f54.google.com with SMTP id fb1so15685827pad.13 for ; Tue, 16 Dec 2014 21:13:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1oErP6J5hMkjCTg53kawRGeZy0D7K7dTJUhgN03v6sU=; b=dHFlxOt9+CQbNsC08LoPkhmXITL/41Mp3M5DOOFLV3TJ40J6mnqYZgQ9Mh3n9ZjzKc ZWy0hSX6t+I/F+ie16+xcebEQAqAjTHj00lhnB3ZIVrPJXosnbdkfg2mG+C6ROR7iyqu MGcTtTbaCUbaBPXNaLqmAeSzYMbQHDbStqvvJyLdM9UJm7AkfpLV/gNMkzI7Y8+3Iaft jgp62alMCrNJ/67C1fszw6j7l1LAasWSrsNXfGTOxDInlMtFPAoUUTXw8lPrjr54j0V9 xyNcKkjVh7Xnu9CbNiJIaMjPCk9iNe2Zfd5s/jCAVNNtW8eC+XWtRrIMNcTkIzggDHg8 Q2kQ== X-Gm-Message-State: ALoCoQnQvjZ4EzhYvdH3L3brDRnuetYEdcMpCNRTT91pQ+nk+Qc78j4LnACu98jmIP7Lb5WhtFl/ X-Received: by 10.70.89.129 with SMTP id bo1mr67748937pdb.23.1418793232304; Tue, 16 Dec 2014 21:13:52 -0800 (PST) Received: from urahara.brocade.com (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id gd1sm2518208pbd.67.2014.12.16.21.13.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Dec 2014 21:13:51 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Tue, 16 Dec 2014 21:13:16 -0800 Message-Id: <1418793196-17953-8-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418793196-17953-1-git-send-email-stephen@networkplumber.org> References: <1418793196-17953-1-git-send-email-stephen@networkplumber.org> Cc: Bill Hong , Stephen Hemminger Subject: [dpdk-dev] [PATCH 7/7] vmxnet3: support jumbo frames 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: Wed, 17 Dec 2014 05:13:59 -0000 From: Stephen Hemminger Add support for linking multi-segment buffers together to handle Jumbo packets Signed-off-by: Stephen Hemminger Signed-off-by: Bill Hong --- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 1 + lib/librte_pmd_vmxnet3/vmxnet3_ring.h | 2 + lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 81 ++++++++++++++++----------------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c index 7afb43f..bcf48f5 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c +++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c @@ -418,6 +418,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev) devRead->misc.driverInfo.vmxnet3RevSpt = 1; devRead->misc.driverInfo.uptVerSpt = 1; + devRead->misc.mtu = rte_le_to_cpu_32(dev->data->mtu); devRead->misc.queueDescPA = hw->queueDescPA; devRead->misc.queueDescLen = hw->queue_desc_len; devRead->misc.numTxQueues = hw->num_tx_queues; diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h index c5abdb6..ee4e970 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_ring.h +++ b/lib/librte_pmd_vmxnet3/vmxnet3_ring.h @@ -174,6 +174,8 @@ typedef struct vmxnet3_rx_queue { uint32_t qid1; uint32_t qid2; Vmxnet3_RxQueueDesc *shared; + struct rte_mbuf *start_seg; + struct rte_mbuf *last_seg; struct vmxnet3_rxq_stats stats; bool stopped; uint16_t queue_id; /**< Device RX queue index. */ diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c index 53ddb2c..c47ba2e 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c @@ -488,7 +488,6 @@ vmxnet3_post_rx_bufs(vmxnet3_rx_queue_t *rxq, uint8_t ring_id) return i; } - /* Receive side checksum and other offloads */ static void vmxnet3_rx_offload(const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm) @@ -566,34 +565,11 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxd = (Vmxnet3_RxDesc *)rxq->cmd_ring[ring_idx].base + idx; rbi = rxq->cmd_ring[ring_idx].buf_info + idx; - if (unlikely(rcd->sop != 1 || rcd->eop != 1)) { - rte_pktmbuf_free_seg(rbi->m); - PMD_RX_LOG(DEBUG, "Packet spread across multiple buffers\n)"); - goto rcd_done; - } - PMD_RX_LOG(DEBUG, "rxd idx: %d ring idx: %d.", idx, ring_idx); VMXNET3_ASSERT(rcd->len <= rxd->len); VMXNET3_ASSERT(rbi->m); - if (unlikely(rcd->len == 0)) { - PMD_RX_LOG(DEBUG, "Rx buf was skipped. rxring[%d][%d]\n)", - ring_idx, idx); - VMXNET3_ASSERT(rcd->sop && rcd->eop); - rte_pktmbuf_free_seg(rbi->m); - goto rcd_done; - } - - /* Assuming a packet is coming in a single packet buffer */ - if (unlikely(rxd->btype != VMXNET3_RXD_BTYPE_HEAD)) { - PMD_RX_LOG(DEBUG, - "Alert : Misbehaving device, incorrect " - " buffer type used. iPacket dropped."); - rte_pktmbuf_free_seg(rbi->m); - goto rcd_done; - } - VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_HEAD); /* Get the packet buffer pointer from buf_info */ rxm = rbi->m; @@ -605,7 +581,7 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxq->cmd_ring[ring_idx].next2comp = idx; /* For RCD with EOP set, check if there is frame error */ - if (unlikely(rcd->err)) { + if (unlikely(rcd->eop && rcd->err)) { rxq->stats.drop_total++; rxq->stats.drop_err++; @@ -620,7 +596,6 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) goto rcd_done; } - /* Initialize newly received packet buffer */ rxm->port = rxq->port_id; rxm->nb_segs = 1; @@ -631,9 +606,44 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxm->ol_flags = 0; rxm->vlan_tci = 0; - vmxnet3_rx_offload(rcd, rxm); + /* + * If this is the first buffer of the received packet, + * set the pointer to the first mbuf of the packet + * Otherwise, update the total length and the number of segments + * of the current scattered packet, and update the pointer to + * the last mbuf of the current packet. + */ + if (rcd->sop) { + VMXNET3_ASSERT(!rxq->start_seg); + VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_HEAD); + + if (unlikely(rcd->len == 0)) { + PMD_RX_LOG(DEBUG, + "Rx buf was skipped. rxring[%d][%d])", + ring_idx, idx); + rte_pktmbuf_free_seg(rbi->m); + goto rcd_done; + } + + rxq->start_seg = rxm; + vmxnet3_rx_offload(rcd, rxm); + } else { + struct rte_mbuf *start = rxq->start_seg; + + VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_BODY); + VMXNET3_ASSERT(start != NULL); + + start->pkt_len += rxm->data_len; + start->nb_segs++; + + rxq->last_seg->next = rxm; + } + rxq->last_seg = rxm; - rx_pkts[nb_rx++] = rxm; + if (rcd->eop) { + rx_pkts[nb_rx++] = rxq->start_seg; + rxq->start_seg = NULL; + } rcd_done: rxq->cmd_ring[ring_idx].next2comp = idx; VMXNET3_INC_RING_IDX_ONLY(rxq->cmd_ring[ring_idx].next2comp, rxq->cmd_ring[ring_idx].size); @@ -802,23 +812,9 @@ vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev, int size; uint8_t i; char mem_name[32]; - uint16_t buf_size; - struct rte_pktmbuf_pool_private *mbp_priv; PMD_INIT_FUNC_TRACE(); - mbp_priv = (struct rte_pktmbuf_pool_private *) - rte_mempool_get_priv(mp); - buf_size = (uint16_t) (mbp_priv->mbuf_data_room_size - - RTE_PKTMBUF_HEADROOM); - - if (dev->data->dev_conf.rxmode.max_rx_pkt_len > buf_size) { - PMD_INIT_LOG(ERR, "buf_size = %u, max_pkt_len = %u, " - "VMXNET3 don't support scatter packets yet", - buf_size, dev->data->dev_conf.rxmode.max_rx_pkt_len); - return -EINVAL; - } - rxq = rte_zmalloc("ethdev_rx_queue", sizeof(struct vmxnet3_rx_queue), RTE_CACHE_LINE_SIZE); if (rxq == NULL) { PMD_INIT_LOG(ERR, "Can not allocate rx queue structure"); @@ -937,6 +933,7 @@ vmxnet3_dev_rxtx_init(struct rte_eth_dev *dev) } } rxq->stopped = FALSE; + rxq->start_seg = NULL; } for (i = 0; i < dev->data->nb_tx_queues; i++) { -- 2.1.3