From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 516438D39 for ; Mon, 14 Dec 2015 02:46:58 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 13 Dec 2015 17:46:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,424,1444719600"; d="scan'208";a="860007487" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by fmsmga001.fm.intel.com with ESMTP; 13 Dec 2015 17:46:38 -0800 Date: Mon, 14 Dec 2015 09:47:16 +0800 From: Yuanhan Liu To: Rich Lane Message-ID: <20151214014716.GY29571@yliu-dev.sh.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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-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: Mon, 14 Dec 2015 01:46:58 -0000 On Fri, Dec 11, 2015 at 12:42:33PM -0800, Rich Lane wrote: > 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. Right, I should move it in the beginning of this function. --yliu