From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f49.google.com (mail-vk0-f49.google.com [209.85.213.49]) by dpdk.org (Postfix) with ESMTP id 1A6F18E7B for ; Fri, 11 Dec 2015 21:42:34 +0100 (CET) Received: by vkgj66 with SMTP id j66so26774390vkg.1 for ; Fri, 11 Dec 2015 12:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bigswitch-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BU6EKkpxWH37jjlI/uAw/EngTLwvdbFgnRU2wPbPUyM=; b=EX7Xh/87jy1WCoAA4mGvjv+kp0ZhpvukoLnoXmRxPhD8areUmfP8RBrpbNaE2rnZZQ 5dyRQ0w3kPT5cmdO4o7WeiidNDrE69QvrBT+ZGcS07xoFqoSsJwd2o37dFdyG7tcJTlx MDBt7j7v5/hKoxr040sTMxnouQruk+SAO3v7/bViDK7WEdKx2NwgpZ07XmEc6AQYB9El NMJf0+FvrJNDMYxP15cD+VUZrNGAojh5/4hpVClBEwK29c2wEbRRzew8m7wHGrfl7qin WLPthkyCqW7SpoXnrUBto7CDaoQ4zXrIKUYal3zxa8OFezPtrpkNMTb/PrjMeVXfmC9p pc/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=BU6EKkpxWH37jjlI/uAw/EngTLwvdbFgnRU2wPbPUyM=; b=axMvHyp6CN+Fph0A1vffKE8FpZZgNhtDOMvIVX6XYdOt/2kiEZe1Lq90+Usjl52Cno MswvcThn+9WmKu1WWPTAH1NdeDjJaZZDLSqmMKXDsqXN9MT3fr8JBR4pVwOMQqVgHyfV 7nqkvvgqSS919yJo5qoOOtOTQCl4SLoDx/QzZJ+De9Js/RqDxCdGbeKk5F0DhjZ/qI/d A2Zd5v61DR2aTSWxo2ivwueVyh8kP2Xcy1d+nSd2+FcDxEmIDX7hit7Ww7j29N1dXul4 b1G9DDQxKsrPqHdnEq1pT7deNbOIpns/7juN6KLaJpojq55yQioSl+mp4n0AON7f6ZQU kjlA== X-Gm-Message-State: ALoCoQm1DINpFfqFB70JeX3DkKzLwk+3s7rcDoTtAzvo0W1L9dUxOe8XfJ6Rg5oZJGRUL7BggTA6cRygoerEZvnv708u/0kXNEJbd9Q4G8Lix5ghSoMT9pQ= MIME-Version: 1.0 X-Received: by 10.31.138.20 with SMTP id m20mr16097107vkd.70.1449866553509; Fri, 11 Dec 2015 12:42:33 -0800 (PST) Received: by 10.31.61.12 with HTTP; Fri, 11 Dec 2015 12:42:33 -0800 (PST) In-Reply-To: <1449122773-25510-3-git-send-email-yuanhan.liu@linux.intel.com> References: <1449122773-25510-1-git-send-email-yuanhan.liu@linux.intel.com> <1449122773-25510-3-git-send-email-yuanhan.liu@linux.intel.com> Date: Fri, 11 Dec 2015 12:42:33 -0800 Message-ID: From: Rich Lane To: Yuanhan Liu Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: dev@dpdk.org, Victor Kaplansky , "Michael S. Tsirkin" Subject: Re: [dpdk-dev] [PATCH 2/5] vhost: refactor virtio_dev_rx 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, 11 Dec 2015 20:42:34 -0000 On Wed, Dec 2, 2015 at 10:06 PM, Yuanhan Liu wrote: > +static inline int __attribute__((always_inline)) > +copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq, > + struct rte_mbuf *m, uint16_t desc_idx, uint32_t *copied) > +{ > ... > + while (1) { > + /* done with current mbuf, fetch next */ > + if (mbuf_avail == 0) { > + m = m->next; > + if (m == NULL) > + break; > + > + mbuf_offset = 0; > + mbuf_avail = rte_pktmbuf_data_len(m); > + } > + > + /* done with current desc buf, fetch next */ > + if (desc_avail == 0) { > + if ((desc->flags & VRING_DESC_F_NEXT) == 0) { > + /* Room in vring buffer is not enough */ > + return -1; > + } > + > + desc = &vq->desc[desc->next]; > + desc_addr = gpa_to_vva(dev, desc->addr); > + desc_offset = 0; > + desc_avail = desc->len; > + } > + > + COPY(desc_addr + desc_offset, > + rte_pktmbuf_mtod_offset(m, uint64_t, mbuf_offset)); > + PRINT_PACKET(dev, (uintptr_t)(desc_addr + desc_offset), > + cpy_len, 0); > + } > + *copied = rte_pktmbuf_pkt_len(m); > AFAICT m will always be NULL at this point so the call to rte_pktmbuf_len will segfault.