From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id A8C882B94 for ; Tue, 31 May 2016 21:28:23 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id n129so148518695wmn.1 for ; Tue, 31 May 2016 12:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=ZdY5zHtXftb/SCf5i6FynDw1vByUo69k/rECe3+mxrM=; b=VDlTymsM2Ydr3x1aOHsSgnk7nGiUsC7DpfmaLqnkwuutX/WGbEQfiXiGOVOA1vkJFc dqPBbwIShqzlwp+7g4wXZc9BsoKpt63Y92ROLkZNLmi50RHhw8Wz9Vp5pihKUgT78TAf DfF0OSiPs3UhbLPOY0snXILUOzIu4w3UDKVvZzvlCWZgVIN4isAEu/egoNMbt8iwpjix mREWjUrldxxDHzfhhXNcTmc2Z4cCoTKW6KfV7AktuH5pCEEmnHEhH01ON1gWRO5+LyXp COPVCjDBfJZ/9JpUHxx7wB9unj5JIn52dzjdWtwC6RWXc/0pBQekDn7fluNR61O0wLzD IBRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ZdY5zHtXftb/SCf5i6FynDw1vByUo69k/rECe3+mxrM=; b=RvlMESCRn8ahdkg6s7kgqu/WFqUcx16P3Nj1i1xiqr2e4o+GYnsIIboj+mkOsUWKZx tY0vR4ghV+4cyv0kY7NJtrqVMxlkGR0gFOLEk/X54Gt7Co3PmmzIrcOOXK+s527DNPOG COWw3Ni6Qx1nIP0zRJiLR/rpGj+ewL8k5piOa37xO4U5oYwiBWT0Y+D4IEYfxJANmjkj Ji8D4+h9dXQF/QSUa0s7ulZpDQY5Ck5VmYXz7T6NF7SoKPVaI473Ip1t3Qv5xN+JwJwn omnAgYO/AOioKujcl9CWwrifdAhVua/0+/Ok4bF8NDLKObA0Oqf2Mh6tCI4kF91RmotK XtNg== X-Gm-Message-State: ALyK8tLcPi3cmwb2EmItQ9gzm3gbAZXIdtJq6G2QtH+x9zt7vmwUcVv7zEqKO9fDJ/IuJZlZ X-Received: by 10.194.164.200 with SMTP id ys8mr12909393wjb.79.1464722903451; Tue, 31 May 2016 12:28:23 -0700 (PDT) Received: from [192.168.0.16] (85-171-34-230.rev.numericable.fr. [85.171.34.230]) by smtp.gmail.com with ESMTPSA id b1sm9407124wjq.25.2016.05.31.12.28.22 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 31 May 2016 12:28:22 -0700 (PDT) To: Jianbo Liu , jerin.jacob@caviumnetworks.com, dev@dpdk.org References: <1464663966-8122-1-git-send-email-jianbo.liu@linaro.org> From: Olivier MATZ Message-ID: <574DE5D6.2040001@6wind.com> Date: Tue, 31 May 2016 21:28:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <1464663966-8122-1-git-send-email-jianbo.liu@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] mbuf: extend rte_mbuf_prefetch_part* to support more prefetching methods 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: Tue, 31 May 2016 19:28:23 -0000 Hi Jianbo, On 05/31/2016 05:06 AM, Jianbo Liu wrote: > Change the inline function to macro with parameters > > Signed-off-by: Jianbo Liu > > [...] > --- a/lib/librte_mbuf/rte_mbuf.h > +++ b/lib/librte_mbuf/rte_mbuf.h > @@ -849,14 +849,15 @@ struct rte_mbuf { > * in the receive path. If the cache line of the architecture is higher than > * 64B, the second part will also be prefetched. > * > + * @param method > + * The prefetch method: prefetch0, prefetch1, prefetch2 or > + * prefetch_non_temporal. > + * > * @param m > * The pointer to the mbuf. > */ > -static inline void > -rte_mbuf_prefetch_part1(struct rte_mbuf *m) > -{ > - rte_prefetch0(&m->cacheline0); > -} > +#define RTE_MBUF_PREFETCH_PART1(method, m) \ > + rte_##method(&(m)->cacheline0) I'm not very fan of this macro, because it allows to really do everything): RTE_MBUF_PREFETCH_PART1(pktmbuf_free, m) would expand as: rte_pktmbuf_free(m) I'd prefer to have a switch case like this, almost similar to what Keith proposed in the initial discussion for my patch: enum rte_mbuf_prefetch_type { PREFETCH0, PREFETCH1, ... }; static inline void rte_mbuf_prefetch_part1(enum rte_mbuf_prefetch_type type, struct rte_mbuf *m) { switch (type) { case PREFETCH0: rte_prefetch0(&m->cacheline0); break; case PREFETCH1: rte_prefetch1(&m->cacheline0); break; ... } Some questions: could you give some details about the use of non-temporal prefetch in ixgbe_vec_neon? What are the pros and cons, and would it be useful in other drivers? Currently all drivers are doing prefetch0 when they prefetch the mbuf structure. Some drivers use prefetch1 for data. By the way, I did not try to apply the patch, but it looks it's on top of dpdk-next-net/rel_16_07, right? Thanks, Olivier