From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by dpdk.org (Postfix) with ESMTP id 48CB237A6 for ; Thu, 3 Dec 2015 08:02:35 +0100 (CET) Received: by pacdm15 with SMTP id dm15so62846064pac.3 for ; Wed, 02 Dec 2015 23:02:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=/04fe4XAGLEerov/jLn1Jgb4n3lNHnhJ9OZWy7E0M48=; b=0h6vaDkq+1k6oKXSqVGGFXpDqKcpRXuzrN/TpBdWSzH00TCdx4GQO0suacHj4/TzvU pEjsMkSJT0Q33CZcoAXgLcMgK78JNb6RkCzVUJqAkY0aBIfA7XV0Ev7ZbRNODgc0TXPt FJ8F1w1HXIgJlDhxYUmEkz3uDz38n40bEvT+cibyX/ZWqfJlZYX7Gn2GQWNcGXRu1vzf YBZUFWLW65B6E8HHaDIjbtQhBgeBdqiv6vcEr+W3pMZKEZzMmhau1LSQOKavto+AsiQt bB4sAjgur9ytUa3Aoxrmufi6rsCn15nmr7t1tsQz4/vmR+dFluB4yYO7JztndIyxTfsq eD/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=/04fe4XAGLEerov/jLn1Jgb4n3lNHnhJ9OZWy7E0M48=; b=GlcgVTxoQ5vAXT9LGL4SezTEp5ViVtv5+aEbA/+KpQEow1zCZCYmU+V7xis0woTt+6 hdwZsiezW2bAPHbN4AuOzaMKYPvqBY8Z0SAu4lt/C6lG7pzfYPgfFRiy0eizInWH5YZr 81y8Uc+NTg8yuk3ghWVfrri+RzKjQSMjCsy33/TxtEG9DRWAUYaix5EF11XyUtUnByBY 42HftrFASA4QlWJuybtDbKL3AFiyjXaiHbz8oqKzqXu6NdV5IKkNBvxMfXylUDTIudr0 sOi59ZJW2hJlMWI3SijROsv2jrqeat3G2bIV88gnSw3nfv1xqJCfLIro8uRS3+xJ/9lL IKow== X-Gm-Message-State: ALoCoQmIzyf6bd6oNqoKPM6LrA2ni0f637D2U2vPqrO85qk4o3UtWW5bBxiI79cnSoYJ4JV9WHPB X-Received: by 10.66.55.72 with SMTP id q8mr10942829pap.136.1449126154470; Wed, 02 Dec 2015 23:02:34 -0800 (PST) Received: from xeon-e3 (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id c1sm8373389pas.1.2015.12.02.23.02.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Dec 2015 23:02:34 -0800 (PST) Date: Wed, 2 Dec 2015 23:02:44 -0800 From: Stephen Hemminger To: Yuanhan Liu Message-ID: <20151202230244.5e4ca3fb@xeon-e3> In-Reply-To: <1449122773-25510-2-git-send-email-yuanhan.liu@linux.intel.com> References: <1449122773-25510-1-git-send-email-yuanhan.liu@linux.intel.com> <1449122773-25510-2-git-send-email-yuanhan.liu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, Victor Kaplansky , "Michael S. Tsirkin" Subject: Re: [dpdk-dev] [PATCH 1/5] vhost: refactor rte_vhost_dequeue_burst 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: Thu, 03 Dec 2015 07:02:35 -0000 On Thu, 3 Dec 2015 14:06:09 +0800 Yuanhan Liu wrote: > +#define COPY(dst, src) do { \ > + cpy_len = RTE_MIN(desc_avail, mbuf_avail); \ > + rte_memcpy((void *)(uintptr_t)(dst), \ > + (const void *)(uintptr_t)(src), cpy_len); \ > + \ > + mbuf_avail -= cpy_len; \ > + mbuf_offset += cpy_len; \ > + desc_avail -= cpy_len; \ > + desc_offset += cpy_len; \ > +} while(0) > + I see lots of issues here. All those void * casts are unnecessary, C casts arguements already. rte_memcpy is slower for constant size values than memcpy() This macro violates the rule that ther should be no hidden variables in a macro. I.e you are assuming cpy_len, desc_avail, and mbuf_avail are defined in all code using the macro. Why use an un-typed macro when an inline function would be just as fast and give type safety?