Skip to contentSkip to conversation

Update programmers guide doc, mbuf chapter

PATCH Applied Bruce Richardson 2 participants 6 messages Dec 2, 2014 – Dec 18, 2014 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover Update programmers guide doc, mbuf chapter

These patches contain updates to the programmers guide document to keep it in sync with the code changes made to the rte_mbuf data structure.

Bruce Richardson (2):
doc: update mbuf section of programmer's guide for 1.8
doc: Updated image files for rte_mbuf changes in 1.8

 doc/guides/prog_guide/img/mbuf1.svg | 44 +++++++++++++---------------
 doc/guides/prog_guide/img/mbuf2.svg | 57 ++++++++++++++++++-------------------
 doc/guides/prog_guide/mbuf_lib.rst  | 22 +++++++-------
 3 files changed, 59 insertions(+), 64 deletions(-)
Signature · 1 line
2.1.1
#2 lore raw

PATCH 1/2 doc: update mbuf section of programmer's guide for 1.8

In reply to a message not in the archive

In Release 1.8, the mbuf structure was significantly reworked to add extra information, leading to the structure being split across two cache lines, and the data pointer being replaced by an offset. The description of the library in the programmer's guide document needs to be updated to take account of these changes.

---
 doc/guides/prog_guide/mbuf_lib.rst | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
doc/guides/prog_guide/mbuf_lib.rst +12 -10
index 4e1ccf0..d6b6e50 100644
@@ -37,10 +37,12 @@ The mbuf library provides the ability to allocate and free buffers (mbufs)
 that may be used by the Intel® DPDK application to store message buffers.
 The message buffers are stored in a mempool, using the :ref:`Mempool Library <Mempool_Library>`.
 
-A rte_mbuf struct can carry network packet buffers (type is RTE_MBUF_PKT)
-or generic control buffers (type is RTE_MBUF_CTRL).
+A rte_mbuf struct can carry network packet buffers
+or generic control buffers (indicated by the CTRL_MBUF_FLAG).
 This can be extended to other types.
-The rte_mbuf is kept as small as possible (one cache line if possible).
+The rte_mbuf header structure is kept as small as possible and currently uses
+just two cache lines, with the most frequently used fields being on the first
+of the two cache lines.
 
 Design of Packet Buffers
 ------------------------
@@ -57,17 +59,17 @@ the complete separation of the allocation of metadata structures from the alloca
 
 The first method was chosen for the Intel® DPDK.
 The metadata contains control information such as message type, length,
-pointer to the start of the data and a pointer for additional mbuf structures allowing buffer chaining.
+offset to the start of the data and a pointer for additional mbuf structures allowing buffer chaining.
 
 Message buffers that are used to carry network packets can handle buffer chaining
 where multiple buffers are required to hold the complete packet.
-This is the case for jumbo frames that are composed of many mbufs linked together through their pkt.next field.
+This is the case for jumbo frames that are composed of many mbufs linked together through their next field.
 
 For a newly allocated mbuf, the area at which the data begins in the message buffer is
 RTE_PKTMBUF_HEADROOM bytes after the beginning of the buffer, which is cache aligned.
 Message buffers may be used to carry control information, packets, events,
 and so on between different entities in the system.
-Message buffers may also use their data pointers to point to other message buffer data sections or other structures.
+Message buffers may also use their buffer pointers to point to other message buffer data sections or other structures.
 
 Figure 8 and Figure 9 show some of these scenarios.
 
@@ -109,9 +111,8 @@ Allocating and Freeing mbufs
 ----------------------------
 
 Allocating a new mbuf requires the user to specify the mempool from which the mbuf should be taken.
-For a packet mbuf, it contains one segment, with a length of 0.
-The pointer to data is initialized to have some bytes of headroom in the buffer (RTE_PKTMBUF_HEADROOM).
-For a control mbuf, it is initialized with data pointing to the beginning of the buffer and a length of zero.
+For any newly-allocated mbuf, it contains one segment, with a length of 0.
+The offset to data is initialized to have some bytes of headroom in the buffer (RTE_PKTMBUF_HEADROOM).
 
 Freeing a mbuf means returning it into its original mempool.
 The content of an mbuf is not modified when it is stored in a pool (as a free mbuf).
@@ -151,7 +152,8 @@ Direct and Indirect Buffers
 ---------------------------
 
 A direct buffer is a buffer that is completely separate and self-contained.
-An indirect buffer behaves like a direct buffer but for the fact that the data pointer it contains points to data in another direct buffer.
+An indirect buffer behaves like a direct buffer but for the fact that the buffer pointer and
+data offset in it refer to data in another direct buffer.
 This is useful in situations where packets need to be duplicated or fragmented,
 since indirect buffers provide the means to reuse the same packet data across multiple buffers.
 
Signature · 1 line
2.1.1
#5 lore raw

PATCH 2/2 doc: Updated image files for rte_mbuf changes in 1.8

In reply to a message not in the archive

The two image files showing the structure of the rte_mbuf data structure required some minor updates to take account of the changes introduced to the structure in the 1.8 release

---
 doc/guides/prog_guide/img/mbuf1.svg | 44 +++++++++++++---------------
 doc/guides/prog_guide/img/mbuf2.svg | 57 ++++++++++++++++++-------------------
 2 files changed, 47 insertions(+), 54 deletions(-)
doc/guides/prog_guide/img/mbuf1.svg +20 -24
index 0b8ff00..3d6beae 100644
@@ -48,7 +48,7 @@
    height="288.34286"
    id="svg3868"
    version="1.1"
-   inkscape:version="0.48.4 r9939"
+   inkscape:version="0.48.5 r10040"
    sodipodi:docname="mbuf1.svg"
    sodipodi:version="0.32"
    inkscape:output_extension="org.inkscape.output.svg.inkscape">
@@ -328,16 +328,16 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="2.8"
-     inkscape:cx="424.95386"
+     inkscape:cx="344.29455"
      inkscape:cy="143.63151"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
-     inkscape:window-width="1650"
-     inkscape:window-height="1059"
-     inkscape:window-x="177"
-     inkscape:window-y="111"
-     inkscape:window-maximized="0"
+     inkscape:window-width="1920"
+     inkscape:window-height="1017"
+     inkscape:window-x="1592"
+     inkscape:window-y="285"
+     inkscape:window-maximized="1"
      fit-margin-top="0.1"
      fit-margin-left="0.1"
      fit-margin-right="0.1"
@@ -416,17 +416,17 @@
     <text
        xml:space="preserve"
        style="font-size:15.22520161px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
-       x="452.7626"
-       y="374.68066"
+       x="546.69116"
+       y="375.75211"
        id="text2912"
        inkscape:export-filename="/home/matz/barracuda/rapports/mbuf-api-v2-images/octeon_multi.png"
        inkscape:export-xdpi="112"
        inkscape:export-ydpi="112"><tspan
          sodipodi:role="line"
-         x="452.7626"
-         y="374.68066"
+         x="546.69116"
+         y="375.75211"
          id="tspan2916"
-         style="font-weight:bold">rte_mbuf (type is pkt)</tspan></text>
+         style="font-weight:bold">struct rte_mbuf </tspan></text>
     <path
        style="fill:none;stroke:#000000;stroke-width:1.26900005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
        d="M 270.40246,239.43649 C 273.9494,287.74619 176.1143,278.684 176.1143,278.684"
@@ -492,13 +492,9 @@
        y="119.50503"
        id="text5219"><tspan
          sodipodi:role="line"
-         id="tspan5221"
          x="249.28572"
-         y="119.50503">rte_pktmbuf_mtod(m)</tspan><tspan
-         sodipodi:role="line"
-         x="249.28572"
-         y="132.00504"
-         id="tspan5223">or m-&gt;pkt.data</tspan></text>
+         y="119.50503"
+         id="tspan5223">rte_pktmbuf_mtod(m)</tspan></text>
     <text
        xml:space="preserve"
        style="font-size:10px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
@@ -516,13 +512,13 @@
     <text
        xml:space="preserve"
        style="font-size:10px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
-       x="82.14286"
-       y="293.07645"
+       x="83.928574"
+       y="284.14789"
        id="text5254"><tspan
          sodipodi:role="line"
          id="tspan5256"
-         x="82.14286"
-         y="293.07645">m-&gt;pkt.next = NULL</tspan></text>
+         x="83.928574"
+         y="284.14789">m-&gt;pkt.next = NULL</tspan></text>
     <text
        xml:space="preserve"
        style="font-size:10px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
@@ -568,11 +564,11 @@
     <text
        xml:space="preserve"
        style="font-size:10px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
-       x="520.37152"
+       x="525.0144"
        y="231.04784"
        id="text5258-1-5"><tspan
          sodipodi:role="line"
-         x="520.37152"
+         x="525.0144"
          y="231.04784"
          id="tspan5262-6-4">tailroom</tspan></text>
     <path
doc/guides/prog_guide/img/mbuf2.svg +27 -30

99 lines not on this page · raw message

Signature · 1 line
2.1.1
#6 lore raw

PATCH v2 2/2 doc: Updated image files for rte_mbuf changes in 1.8

In reply to a message not in the archive

The two image files showing the structure of the rte_mbuf data structure required some minor updates to take account of the changes introduced to the structure in the 1.8 release

---
Change in V2:
* Made minor changes to the position of some text to try and work around the different rendering of the svg files in different browsers, which led to test being truncated unexpectedly.

---
 doc/guides/prog_guide/img/mbuf1.svg | 44 ++++++++++++--------------
 doc/guides/prog_guide/img/mbuf2.svg | 61 ++++++++++++++++++-------------------
 2 files changed, 49 insertions(+), 56 deletions(-)
doc/guides/prog_guide/img/mbuf1.svg +20 -24
index 0b8ff00..70507a3 100644
@@ -48,7 +48,7 @@
    height="288.34286"
    id="svg3868"
    version="1.1"
-   inkscape:version="0.48.4 r9939"
+   inkscape:version="0.48.5 r10040"
    sodipodi:docname="mbuf1.svg"
    sodipodi:version="0.32"
    inkscape:output_extension="org.inkscape.output.svg.inkscape">
@@ -328,16 +328,16 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="2.8"
-     inkscape:cx="424.95386"
+     inkscape:cx="344.29455"
      inkscape:cy="143.63151"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
-     inkscape:window-width="1650"
-     inkscape:window-height="1059"
-     inkscape:window-x="177"
-     inkscape:window-y="111"
-     inkscape:window-maximized="0"
+     inkscape:window-width="1920"
+     inkscape:window-height="1017"
+     inkscape:window-x="1592"
+     inkscape:window-y="285"
+     inkscape:window-maximized="1"
      fit-margin-top="0.1"
      fit-margin-left="0.1"
      fit-margin-right="0.1"
@@ -416,17 +416,17 @@
     <text
        xml:space="preserve"
        style="font-size:15.22520161px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
-       x="452.7626"
-       y="374.68066"
+       x="468.47687"
+       y="376.4664"
        id="text2912"
        inkscape:export-filename="/home/matz/barracuda/rapports/mbuf-api-v2-images/octeon_multi.png"
        inkscape:export-xdpi="112"
        inkscape:export-ydpi="112"><tspan
          sodipodi:role="line"
-         x="452.7626"
-         y="374.68066"
+         x="468.47687"
+         y="376.4664"
          id="tspan2916"
-         style="font-weight:bold">rte_mbuf (type is pkt)</tspan></text>
+         style="font-weight:bold">struct rte_mbuf </tspan></text>
     <path
        style="fill:none;stroke:#000000;stroke-width:1.26900005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow1Mend)"
        d="M 270.40246,239.43649 C 273.9494,287.74619 176.1143,278.684 176.1143,278.684"
@@ -492,13 +492,9 @@
        y="119.50503"
        id="text5219"><tspan
          sodipodi:role="line"
-         id="tspan5221"
          x="249.28572"
-         y="119.50503">rte_pktmbuf_mtod(m)</tspan><tspan
-         sodipodi:role="line"
-         x="249.28572"
-         y="132.00504"
-         id="tspan5223">or m-&gt;pkt.data</tspan></text>
+         y="119.50503"
+         id="tspan5223">rte_pktmbuf_mtod(m)</tspan></text>
     <text
        xml:space="preserve"
        style="font-size:10px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
@@ -516,13 +512,13 @@
     <text
        xml:space="preserve"
        style="font-size:10px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
-       x="82.14286"
-       y="293.07645"
+       x="83.928574"
+       y="284.14789"
        id="text5254"><tspan
          sodipodi:role="line"
          id="tspan5256"
-         x="82.14286"
-         y="293.07645">m-&gt;pkt.next = NULL</tspan></text>
+         x="83.928574"
+         y="284.14789">m-&gt;pkt.next = NULL</tspan></text>
     <text
        xml:space="preserve"
        style="font-size:10px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
@@ -568,11 +564,11 @@
     <text
        xml:space="preserve"
        style="font-size:10px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
-       x="520.37152"
+       x="525.0144"
        y="231.04784"
        id="text5258-1-5"><tspan
          sodipodi:role="line"
-         x="520.37152"
+         x="525.0144"
          y="231.04784"
          id="tspan5262-6-4">tailroom</tspan></text>
     <path
doc/guides/prog_guide/img/mbuf2.svg +29 -32

101 lines not on this page · raw message

Signature · 1 line
1.9.3
Acked-by Bernard Iremonger Applied
#4 lore raw

Re: [PATCH 1/2] doc: update mbuf section of programmer's guide for 1.8

In reply to a message not in the archive
Quoted 6 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Tuesday, December 2, 2014 4:18 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/2] doc: update mbuf section of programmer's guide for 1.8

Quoted 6 lines

In Release 1.8, the mbuf structure was significantly reworked to add extra information, leading to the structure being split across two cache lines, and the data pointer being replaced by an offset. The description of the library in the programmer's guide document needs to be updated to take account of these changes.

I have applied the patch to my tree next/dpdk-doc.

Acked-by Applied
#8 lore raw

Re: [PATCH v2 2/2] doc: Updated image files for rte_mbuf changes in 1.8

In reply to a message not in the archive
Quoted 10 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Friday, December 12, 2014 11:22 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH v2 2/2] doc: Updated image files for rte_mbuf changes in 1.8

The two image files showing the structure of the rte_mbuf data structure required some minor updates to take account of the changes introduced to the structure in the 1.8 release

I have applied the patch to my tree next/dpdk-doc.