From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by dpdk.org (Postfix) with ESMTP id 2F6EF2BE0 for ; Fri, 4 Mar 2016 19:07:57 +0100 (CET) Received: by mail-pa0-f42.google.com with SMTP id bj10so38859286pad.2 for ; Fri, 04 Mar 2016 10:07:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=13HrOizOikAF0MCXlrOUxypG/fMq1TwHeiJmf0eLcqk=; b=pxJSwIMmQ2+7n9sixiqXQoPQGqvryZYl45g9UjMnowYgeOOpemznZcgRglDQ8Px2WW JnRt/dkFtlT3NbnnrCuu2grNAld9wG2tKwHD/XWO4xh9NwcXuTLbi4cIpAKiKYPccQf7 KBW3V4FAbfVQ0JRJJZyy16qkav2zDy0aXlQK1cB0OdGEvME5itKDdyN8ymq4JJ9oGXBF ymvrvspThpDEbU7WY2Jin2ducgEpVBvritqInWTStVbj8fvAK/UVWWPdQRHU/Z8fdhX4 trB8srHDJ3ipDVb2GLRX8mYRlBtNAl/cs4QTFwZMT3W3MQ77EufKyUpQTdxP3aBZdqTO u0jA== 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=13HrOizOikAF0MCXlrOUxypG/fMq1TwHeiJmf0eLcqk=; b=fWo/GWg3uqi1G5fL6hfs8tVRPY7uQkpDDzqA2HZvo01qzFqSmNG9jfp47FfurD215y yejlYS0nGyFQ7xSARRm+k1qdqRk8U4xNmSsm4IBuSzia6OU0eDUkEtNIBwWTsVDpOAtV DI3eF6szK1dV9SNKCI/rL7KgrhQurcn5ZMgTxQwrBoi+ggSNDAp/kKyZ8VLUI+MbDXfm kjNToXGdIRqu446OiDgU0EAUg17pdfhw/vMo8dylgqW/8P9O76yQxyZHVXKapmQbdxii yRv1fDP5mxf1un0hBE2V0TNB4qX7XSxR/OJFmBkkFzk/iF82mopoHYDG6cJvLDWGUHYa s/yw== X-Gm-Message-State: AD7BkJL758RMcIR3IPZNtZDQbf/efKyGS9VzZ+jSm4x3P1KV0arTDV1bjgrpy1IqaCCIsA== X-Received: by 10.67.4.233 with SMTP id ch9mr14030231pad.29.1457114876533; Fri, 04 Mar 2016 10:07:56 -0800 (PST) Received: from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id f8sm7014701pfj.49.2016.03.04.10.07.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Mar 2016 10:07:55 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Fri, 4 Mar 2016 10:08:00 -0800 Message-Id: <1457114882-22125-2-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457114882-22125-1-git-send-email-stephen@networkplumber.org> References: <1457114882-22125-1-git-send-email-stephen@networkplumber.org> Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH 1/3] 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: Fri, 04 Mar 2016 18:07:57 -0000 Add support for linking multi-segment buffers together to handle Jumbo packets. The vmxnet3 API supports having header and body buffer types. What this patch does is fill the primary ring completely with header buffers and the secondary ring with body buffers. This allows for non-jumbo frames to only use one mbuf (from primary ring); and jumbo frames will have first mbuf from primary ring and following mbufs from other ring. This could be optimized in future if the DPDK had API to supply different sized mbufs (two pools) into driver. Signed-off-by: Stephen Hemminger --- drivers/net/vmxnet3/vmxnet3_ethdev.c | 3 +- drivers/net/vmxnet3/vmxnet3_ring.h | 2 + drivers/net/vmxnet3/vmxnet3_rxtx.c | 80 +++++++++++++++++++----------------- 3 files changed, 46 insertions(+), 39 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index c363bf6..585ee60 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -425,6 +425,7 @@ vmxnet3_setup_driver_shared(struct rte_eth_dev *dev) { struct rte_eth_conf port_conf = dev->data->dev_conf; struct vmxnet3_hw *hw = dev->data->dev_private; + uint32_t mtu = dev->data->mtu; Vmxnet3_DriverShared *shared = hw->shared; Vmxnet3_DSDevRead *devRead = &shared->devRead; uint32_t *mac_ptr; @@ -442,7 +443,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.mtu = rte_le_to_cpu_32(mtu); devRead->misc.queueDescPA = hw->queueDescPA; devRead->misc.queueDescLen = hw->queue_desc_len; devRead->misc.numTxQueues = hw->num_tx_queues; diff --git a/drivers/net/vmxnet3/vmxnet3_ring.h b/drivers/net/vmxnet3/vmxnet3_ring.h index da4c595..1d1879a 100644 --- a/drivers/net/vmxnet3/vmxnet3_ring.h +++ b/drivers/net/vmxnet3/vmxnet3_ring.h @@ -171,6 +171,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/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 8385478..4ed1646 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -570,35 +570,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; @@ -610,7 +586,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++; @@ -636,9 +612,47 @@ 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 != NULL); + VMXNET3_ASSERT(rxd->btype == VMXNET3_RXD_BTYPE_HEAD); + + if (unlikely(rcd->len == 0)) { + VMXNET3_ASSERT(rcd->eop); + + PMD_RX_LOG(DEBUG, + "Rx buf was skipped. rxring[%d][%d])", + ring_idx, idx); + rte_pktmbuf_free_seg(rxm); + 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; + + if (rcd->eop) { + rx_pkts[nb_rx++] = rxq->start_seg; + rxq->start_seg = NULL; + } - rx_pkts[nb_rx++] = rxm; 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); @@ -807,20 +821,9 @@ vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev, int size; uint8_t i; char mem_name[32]; - uint16_t buf_size; PMD_INIT_FUNC_TRACE(); - buf_size = rte_pktmbuf_data_room_size(mp) - - 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"); @@ -939,6 +942,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.4