From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com [209.85.192.169]) by dpdk.org (Postfix) with ESMTP id 5E7842142 for ; Mon, 7 Mar 2016 05:19:47 +0100 (CET) Received: by mail-pf0-f169.google.com with SMTP id 124so72800300pfg.0 for ; Sun, 06 Mar 2016 20:19:47 -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-transfer-encoding; bh=jvBVtozMk82aM0zeW7bYROKSjj/uNiEhKRctO8yfrBU=; b=in7iZsoNjO83TCvTKfmpI5A1HLFWCypYVq5qEWlANuZli3DHfdxepKzmFAa8+J68ZE oYcyYkEXAyD9jGmjx6t77YCM3XpFf1i1jr2wSJ2CPfPD6Bfpasz8ODdzs13k9165iEtB oVIjbwFP/Xx7Wr9MUzqe0AXt0awl1VEDf0wDi+uiR1pHlhu4k2uf/FVhFowrvsphSPmh VG+gO/Ae8X8tFakJPUOgU5GUYdWbP2iWCkTw5QA4HtyLrVt0aMOx6kffLz2ozt01uh47 KAl4Hpl3frluuEa4FwqjfviDFL+GqOi1wktkaeaxBMudm0L7IiU89f4HY3Amvxu1cwhJ wrfA== 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-transfer-encoding; bh=jvBVtozMk82aM0zeW7bYROKSjj/uNiEhKRctO8yfrBU=; b=U1t1o8ybd4BY51qeOYOlLevYw4S+Ob1tGSiHmQY4SSMkW96xnqYk4xTIernx9Q1SWX H+LZl/a1k0FJSOvdgxyiqsDtfC4okbdjIl9W1B3OzcKJreZ3hOdQI0UbPqsfetB/wuLj mnx+YAAxv2adWOhKg+HrLd1JMRKPPHGQW8LQGjdj6/u5rxoedX+XvC4O8bj3RGl/Uzmq Cfn80cJquJ15M1RkRaGKoAqqAP7KsUR97Wo+dGmbhw7cbImqeEz3K9sCR0FrcWQIOs0F mOhviSHPFRWIJmgDNSjgCWjmWNB488cbwTX8ZxPaMJqA+mup/SvKrvf+k+3+6HJ6HBVx hJng== X-Gm-Message-State: AD7BkJI/0bEqyzymwU7XLjBufjHgwbsiBe8LSqNv79ppsm5KYg1RVK1K9F2ik2scoHB/rA== X-Received: by 10.98.7.14 with SMTP id b14mr30966766pfd.40.1457324386656; Sun, 06 Mar 2016 20:19:46 -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 y68sm20642838pfi.6.2016.03.06.20.19.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Mar 2016 20:19:46 -0800 (PST) Date: Sun, 6 Mar 2016 20:20:00 -0800 From: Stephen Hemminger To: Yuanhan Liu Message-ID: <20160306202000.68ce5514@xeon-e3> In-Reply-To: <1455803352-5518-5-git-send-email-yuanhan.liu@linux.intel.com> References: <1449122773-25510-1-git-send-email-yuanhan.liu@linux.intel.com> <1455803352-5518-1-git-send-email-yuanhan.liu@linux.intel.com> <1455803352-5518-5-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 v2 4/7] vhost: do not use rte_memcpy for virtio_hdr copy 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, 07 Mar 2016 04:19:47 -0000 On Thu, 18 Feb 2016 21:49:09 +0800 Yuanhan Liu wrote: > +static inline void > +copy_virtio_net_hdr(struct vhost_virtqueue *vq, uint64_t desc_addr, > + struct virtio_net_hdr_mrg_rxbuf hdr) > +{ > + if (vq->vhost_hlen == sizeof(struct virtio_net_hdr_mrg_rxbuf)) { > + *(struct virtio_net_hdr_mrg_rxbuf *)(uintptr_t)desc_addr = hdr; > + } else { > + *(struct virtio_net_hdr *)(uintptr_t)desc_addr = hdr.hdr; > + } > +} > + Don't use {} around single statements. Since you are doing all this casting, why not just use regular old memcpy which will be inlined by Gcc into same instructions anyway. And since are always casting the desc_addr, why not pass a type that doesn't need the additional cast (like void *)