From patchwork Fri Mar 11 15:24:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Gupta X-Patchwork-Id: 8566851 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3BDD09F38C for ; Fri, 11 Mar 2016 15:43:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5814220125 for ; Fri, 11 Mar 2016 15:43:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5DCB0201BB for ; Fri, 11 Mar 2016 15:43:18 +0000 (UTC) Received: from localhost ([::1]:55942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aePDh-0001jZ-Rs for patchwork-qemu-devel@patchwork.kernel.org; Fri, 11 Mar 2016 10:43:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeOvu-0003jn-OC for qemu-devel@nongnu.org; Fri, 11 Mar 2016 10:24:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeOvp-0005IT-M1 for qemu-devel@nongnu.org; Fri, 11 Mar 2016 10:24:54 -0500 Received: from mail-yw0-x233.google.com ([2607:f8b0:4002:c05::233]:36446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeOvm-0005H1-Dg; Fri, 11 Mar 2016 10:24:46 -0500 Received: by mail-yw0-x233.google.com with SMTP id g3so96377176ywa.3; Fri, 11 Mar 2016 07:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc; bh=J4sAgCrjXkJc67Ri0TZyJDoI7hhyCwzxST5UdZtbJAU=; b=wkFV3bvI3ev7SuhNG5JDDiUsW4jOSxIuQBqSn74ARWtlhr85lLGnpRfijc6SJOCYhg jI6fEUMS2Z0i2a9XNjEFFfIo2uWWP8md7+6buvxK9q7mfkWkhOpsMGztqveLqWGQBlKD 6bwiS7YQQFrwsm6Lc7+p7AYOCQOOngRvuznjsAWykgAgz461Eux0b5eg14sYlovCZZCc nHcIG8q14/GA09Jij7GkLw/RZxZyOK6wFmz/tbGAmQHkTqSv1Butmr13DHLIeb7fQsJD cIMeQ+WwLCPJw4/dSLiQJxa40qO42+9X57Qd3DUqXtHOnwnj5Spt8vXcWsW6xw2h64b6 A+gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=J4sAgCrjXkJc67Ri0TZyJDoI7hhyCwzxST5UdZtbJAU=; b=H4sUwqmUrmiND3fZZSIUw/Hfq7TXQOOqqUkaHplpv2yvptGUbPjYOVhbKIy8doYKrQ 6j1RasBKO/qDehW4xEtMD1Er2qA1mQB+RouL+TLfbLwOIq35WWihzEJIIM9Q+SJhJ2Wj hZ0twYJ5l9ZRfe8NQQA8wEaUBTabkURvk7YiQMTYUJKIBNdw1khdEvRPMCosUOV05jN3 brMb7yCcyE02ovbRL9aXtNOOuFZcOnHLLQ3iDak3CO2p6wIZiNTnkJpiUYTaB555+YzT 1dNFYVaHqGjp/ApNoDYBBdybD5U0x4W58Aw9AgiVocuRsoOPKxTqziRhyGp6a2dAetJf BN3A== X-Gm-Message-State: AD7BkJL1aMOrJa7AveEa5ZJ8apT0p2N28DuCX5/A2SLrj3D2QfnlvZsih0FS7kF1nx0bg3ZQ5Z48Wkvlh7zKsQ== MIME-Version: 1.0 X-Received: by 10.13.255.4 with SMTP id p4mr5307284ywf.54.1457709885975; Fri, 11 Mar 2016 07:24:45 -0800 (PST) Received: by 10.37.210.201 with HTTP; Fri, 11 Mar 2016 07:24:45 -0800 (PST) Date: Fri, 11 Mar 2016 20:54:45 +0530 Message-ID: From: Siddharth Gupta To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::233 Cc: qemu-trivial@nongnu.org Subject: [Qemu-devel] BiteSizedPatch-LargeFrames X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From 032be62f56a207833ae12cc9474e3e8be5ed8eb4 Mon Sep 17 00:00:00 2001 From: Siddharth Gupta Date: Fri, 11 Mar 2016 20:10:41 +0530 Subject: [PATCH] bitesizedtasks-large_frames-hw_dma_xilinx-hw_net_virtio --- hw/dma/xilinx_axidma.c | 5 ++++- hw/net/virtio-net.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) size_t offset, i, guest_offset; @@ -1113,6 +1113,8 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t offset = i = 0; + mhdr_sg = (struct iovec *) malloc(VIRTQUEUE_MAX_SIZE * sizeof(struct iovec)); + while (offset < size) { VirtQueueElement *elem; int len, total; @@ -1122,6 +1124,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement)); if (!elem) { + free(mhdr_sg); if (i == 0) return -1; error_report("virtio-net unexpected empty queue: " @@ -1136,11 +1139,15 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t if (elem->in_num < 1) { error_report("virtio-net receive queue contains no in buffers"); + free(mhdr_sg); exit(1); } sg = elem->in_sg; if (i == 0) { + if (offset != 0) { + free(mhdr_sg); + } assert(offset == 0); if (n->mergeable_rx_bufs) { mhdr_cnt = iov_copy(mhdr_sg, ARRAY_SIZE(mhdr_sg), @@ -1168,6 +1175,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t if (!n->mergeable_rx_bufs && offset < size) { virtqueue_discard(q->rx_vq, elem, total); g_free(elem); + free(mhdr_sg); return size; } @@ -1186,6 +1194,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t virtqueue_flush(q->rx_vq, i); virtio_notify(vdev, q->rx_vq); + free(mhdr_sg); return size; } diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index ce5c1e6..9c6bda2 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -255,13 +255,15 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, StreamSlave *tx_control_dev) { uint32_t prev_d; - unsigned char txbuf[16 * 1024]; + unsigned char *txbuf; unsigned int txlen; if (!stream_running(s) || stream_idle(s)) { return; } + txbuf = (unsigned char *) malloc(16 * 1024 * sizeof(unsigned char)); + while (1) { stream_desc_load(s, s->regs[R_CURDESC]); @@ -303,6 +305,7 @@ static void stream_process_mem2s(struct Stream *s, StreamSlave *tx_data_dev, break; } } + free(txbuf); } static size_t stream_process_s2mem(struct Stream *s, unsigned char *buf, diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5798f87..ba6ebac 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1094,7 +1094,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t VirtIONet *n = qemu_get_nic_opaque(nc); VirtIONetQueue *q = virtio_net_get_subqueue(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); - struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE]; + struct iovec *mhdr_sg; struct virtio_net_hdr_mrg_rxbuf mhdr; unsigned mhdr_cnt = 0;