From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by dpdk.org (Postfix) with ESMTP id 9BC1E4C7B for ; Thu, 1 Mar 2018 03:08:15 +0100 (CET) Received: by mail-pf0-f194.google.com with SMTP id d26so1829104pfn.5 for ; Wed, 28 Feb 2018 18:08:15 -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=BgtOB7/7FxAStig29zkFvH8k3/FUsfHzeSv5VBMms70=; b=fo6yQHezMuYv+NFA+C7w456kkjfF+Qcn63xfJ8TMOIGVCz/DqkNa6ZzLofatqoD6zh vYHU0wU9ndaeSWNhnCqpcNlZt5ztb24RuiyGBi1UuZ8mG+inF3Qdxrkr4TnuSJETp5Cb hmNjPSuNmOCum83nIlUiJOxcrapaP837WT1U7pm0Ph6ua5aZLg90q1DyHj4J/1lqbEuN NUcEv8YKdpOB3fvFWtPl8zdCvyfeXbh3pBZZWu47fpzF71En+jQexW46eHiPP6UHWEei 2i1ImatALiPbwMXbcjW08DbpBoA6oOVVQZpdEFUuDg3B8AaBgvN0kFpmE2GJ0qb2NrGL lNrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BgtOB7/7FxAStig29zkFvH8k3/FUsfHzeSv5VBMms70=; b=TRFwqL7Mwge6MlWMjbrmTZ3l1E7N8HkkCiOD7b/lQ5UQ56+AfQ6VS+xgP22Bzy1JmY dkhCfVR61JJjMboJosSd7pmtL8sNzvMHhrIap7XE7mD9gq595iIZFJYWrLLhw9PDBSVF fWJTRoaiv6afgmzCs4eOyV4Rhrb9lg9KFQz/be1l++HB5mHaiWSxCYYXhF3fL4bTNk0v T/I0fRZAkKuuy8VXXW7v/aeynoOin2LRLQAdsdKyvGLCvvzlUgipFCfWwKhR3rbY74Ef Uhh5qVuXwbTh29bBbW2o0inJw0gbj1lGmFXqK2YyAOGbgN/aglWd1YX+a/s0k3Y8wmB3 JqsA== X-Gm-Message-State: APf1xPAOg8GzMjjCM8tGnmfeOLhI90lX1sdUvN98SniyRNm0Y7b0QfeP 9BWJTmsB+c3SZLlca5rfhlu73w== X-Google-Smtp-Source: AG47ELsMP1tVE5zy3hWbu48wGYkg0OknE9nXVzoAd2G8L48akXGYZ5Pe85xGBAZhc57KVirtSwqcCQ== X-Received: by 10.99.106.71 with SMTP id f68mr191610pgc.262.1519870094710; Wed, 28 Feb 2018 18:08:14 -0800 (PST) Received: from xeon-e3 (204-195-71-95.wavecable.com. [204.195.71.95]) by smtp.gmail.com with ESMTPSA id b4sm5595665pfa.3.2018.02.28.18.08.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 18:08:14 -0800 (PST) Date: Wed, 28 Feb 2018 18:08:11 -0800 From: Stephen Hemminger To: Qi Zhang Cc: dev@dpdk.org, magnus.karlsson@intei.com, bjorn.topel@intel.com Message-ID: <20180228180811.700dea88@xeon-e3> In-Reply-To: <20180227093306.23854-5-qi.z.zhang@intel.com> References: <20180227093306.23854-1-qi.z.zhang@intel.com> <20180227093306.23854-5-qi.z.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC 4/7] net/af_xdp: use mbuf mempool for buffer management X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2018 02:08:15 -0000 On Tue, 27 Feb 2018 17:33:03 +0800 Qi Zhang wrote: > +static uint32_t > +mbuf_to_idx(struct pmd_internals *internals, struct rte_mbuf *mbuf) > +{ > + return (uint32_t)(((uint64_t)mbuf->buf_addr - > + (uint64_t)internals->umem->buffer) >> > + internals->umem->frame_size_log2); > +} > + > +static struct rte_mbuf * > +idx_to_mbuf(struct pmd_internals *internals, uint32_t idx) > +{ > + return (struct rte_mbuf *)(void *)(internals->umem->buffer + (idx > + << internals->umem->frame_size_log2) + 0x40); > +} More unnecessary casts's here.