From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08B3DA317C for ; Thu, 17 Oct 2019 17:58:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 079CE1EA0D; Thu, 17 Oct 2019 17:58:52 +0200 (CEST) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 18F4E1EA09 for ; Thu, 17 Oct 2019 17:58:51 +0200 (CEST) Received: by mail-wr1-f66.google.com with SMTP id w18so2411200wrt.3 for ; Thu, 17 Oct 2019 08:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TvDlS7Ch9i8yUqJ/JcyswQzGxH7LVMeGgQE0fnfb1Xs=; b=GbLimuzw9cgsEXljohS2bVZ1C4S3VBLkjSAJh0DO1xtBHq6NgXQF41Oicg5oywCPRe jsoMYMzeapvLhC/+bj9wQnM8wff7uA3TSIQnEKTOWUgITu81urguE4jtKNWHZ9oACUbr 8kCqFvUaI4UKTFLI0bxMZZjyGD8qRsoKZaIH9OVKqrtTlmF2MYqAYjArFeKVc+eWm0iU PLjIrVAQ+BO1fwh3NMDKJSb9I4wmJDgusxOTxrnsjpHeFa+PmtFaa9PZGKfvu+44bXvk xpCgDz5jLjol0tyHLIgadkC9ZJletJmKFCh1PlkWXG5yDyj0gOvGlAKAJ8Obo38ChW0B QDAw== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TvDlS7Ch9i8yUqJ/JcyswQzGxH7LVMeGgQE0fnfb1Xs=; b=qFj3rlaiukzQzDRw5x0J1sI92YAJt4RPy38RxkutUgAp9mGE6zIJBminGtcLm49t/d MPXGYT05OAlTyvzdCFaISENxOFXsBCpSSJZEpQW2+3cDWdMFqXoRusmIZgdLv9rdOyJC uxeSOwk09vZOUckVuO4FsYmVW8xd80UE3N4CpJrPEJadjgvqXNLOv24JIkCXuZy9+Xfd oYuyWbu42D7ga2xQggx6xzNFGi0PqJ7G4e3xygdGnFdY7aLhQkbyRF9YXJf4S4dq7Dqm Ee1iKHiTJ54Zyg8V0l3bouNSu1kxkfah3HDZvN5FDS53CsrcolWd6y8ZkTuuRacyVfaN gL0A== X-Gm-Message-State: APjAAAV9oBNdN69RrGrN1JdEJNc4Y9XJAzQWo4nRRWm7mabRMX+ktN9Y ToBqtzU5o0oecNSt12/2vTRndQ== X-Google-Smtp-Source: APXvYqy3juCHJjkuCZ7JyM4mvFmq0TaAI9gLuyTjwJzUO2DgGQ7ntRQ4yhgOgqeqkW5kty7FiER71w== X-Received: by 2002:adf:f30b:: with SMTP id i11mr3410804wro.377.1571327930576; Thu, 17 Oct 2019 08:58:50 -0700 (PDT) Received: from 6wind.com (2a01cb0c0005a6000226b0fffeed02fc.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:226:b0ff:feed:2fc]) by smtp.gmail.com with ESMTPSA id l18sm3549548wrn.48.2019.10.17.08.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 08:58:49 -0700 (PDT) Date: Thu, 17 Oct 2019 17:58:48 +0200 From: Olivier Matz To: "A.McLoughlin" Cc: John McNamara , Marko Kovacevic , dev@dpdk.org, harry.van.haaren@intel.com Message-ID: <20191017155848.3kxixqhsv2pd4jvy@platinum> References: <20190823131007.9000-1-aideen.mcloughlin@intel.com> <20190827090230.2057-1-aideen.mcloughlin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190827090230.2057-1-aideen.mcloughlin@intel.com> User-Agent: NeoMutt/20180716 Subject: Re: [dpdk-dev] [PATCH v3] doc: add graphic showing layout of mbuf struct 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, On Tue, Aug 27, 2019 at 10:02:30AM +0100, A.McLoughlin wrote: > This patch adds a graphical overview of the rte_mbuf struct, showing where > each value is stored within the struct. > > Signed-off-by: A.McLoughlin > --- > v1 -> v2: > * changed uint16_t refcnt(+atomic) to uint16_t refcnt > v2 -> v3: > * added layout of extrenally stored struct rte_mbuf sched sched > * added struct names for named structs > * made variable names bold for differenciation from types > * minor styling changes > * specified that graphic represents layout on 64B machine > --- > doc/guides/prog_guide/img/mbuf_graphic.svg | 6962 ++++++++++++++++++++ > doc/guides/prog_guide/mbuf_lib.rst | 12 + > 2 files changed, 6974 insertions(+) > create mode 100644 doc/guides/prog_guide/img/mbuf_graphic.svg The diagram is nice, however we have to be careful because it has to be kept sync with the code. I tried to edit the svg with inkscape, and it seems the text is described as vector shapes, which make the diagram impossible to update. Couldn't it be replaced by the output of pahole? Or better, just explain how to generate it in the documentation? The user can then be sure that the information is up to date, matches its architecture, and can also check structures other than mbuf. Example of pahole output for mbuf: struct rte_mbuf { MARKER cacheline0; /* 0 0 */ void * buf_addr; /* 0 8 */ union { rte_iova_t buf_iova; /* 8 8 */ rte_iova_t buf_physaddr; /* 8 8 */ }; /* 8 8 */ MARKER64 rearm_data; /* 16 0 */ uint16_t data_off; /* 16 2 */ union { rte_atomic16_t refcnt_atomic; /* 18 2 */ uint16_t refcnt; /* 18 2 */ }; /* 18 2 */ uint16_t nb_segs; /* 20 2 */ uint16_t port; /* 22 2 */ uint64_t ol_flags; /* 24 8 */ MARKER rx_descriptor_fields1; /* 32 0 */ union { uint32_t packet_type; /* 32 4 */ struct { uint32_t l2_type:4; /* 32:28 4 */ uint32_t l3_type:4; /* 32:24 4 */ uint32_t l4_type:4; /* 32:20 4 */ uint32_t tun_type:4; /* 32:16 4 */ /* Bitfield combined with next fields */ union { uint8_t inner_esp_next_proto; /* 34 1 */ struct { uint8_t inner_l2_type:4; /* 34: 4 1 */ uint8_t inner_l3_type:4; /* 34: 0 1 */ }; /* 34 1 */ }; /* 34 1 */ /* Bitfield combined with previous fields */ uint32_t inner_l4_type:4; /* 32: 4 4 */ }; /* 32 4 */ }; /* 32 4 */ uint32_t pkt_len; /* 36 4 */ uint16_t data_len; /* 40 2 */ uint16_t vlan_tci; /* 42 2 */ union { union { uint32_t rss; /* 44 4 */ struct { union { struct { uint16_t hash; /* 44 2 */ uint16_t id; /* 46 2 */ }; /* 44 4 */ uint32_t lo; /* 44 4 */ }; /* 44 4 */ uint32_t hi; /* 48 4 */ } fdir; /* 44 8 */ struct { uint32_t lo; /* 44 4 */ uint32_t hi; /* 48 4 */ } sched; /* 44 8 */ uint32_t usr; /* 44 4 */ } hash; /* 44 8 */ struct { uint32_t tx_metadata; /* 44 4 */ uint32_t reserved; /* 48 4 */ }; /* 44 8 */ }; /* 44 8 */ uint16_t vlan_tci_outer; /* 52 2 */ uint16_t buf_len; /* 54 2 */ uint64_t timestamp; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ MARKER cacheline1; /* 64 0 */ union { void * userdata; /* 64 8 */ uint64_t udata64; /* 64 8 */ }; /* 64 8 */ struct rte_mempool * pool; /* 72 8 */ struct rte_mbuf * next; /* 80 8 */ union { uint64_t tx_offload; /* 88 8 */ struct { uint64_t l2_len:7; /* 88:57 8 */ uint64_t l3_len:9; /* 88:48 8 */ uint64_t l4_len:8; /* 88:40 8 */ uint64_t tso_segsz:16; /* 88:24 8 */ uint64_t outer_l3_len:9; /* 88:15 8 */ uint64_t outer_l2_len:7; /* 88: 8 8 */ }; /* 88 8 */ }; /* 88 8 */ uint16_t priv_size; /* 96 2 */ uint16_t timesync; /* 98 2 */ uint32_t seqn; /* 100 4 */ struct rte_mbuf_ext_shared_info * shinfo; /* 104 8 */ /* size: 128, cachelines: 2, members: 27 */ /* padding: 16 */ }; Olivier