diff options
author | Tiago Lam <tiago.lam@intel.com> | 2018-11-27 16:54:23 +0000 |
---|---|---|
committer | Ian Stokes <ian.stokes@intel.com> | 2018-11-28 15:30:03 +0000 |
commit | a32bab26e5d83e97624f265dad7ef3d07c8e0741 (patch) | |
tree | d373768b478805ad9df7ed59e5ae8e44cddf768f /Documentation | |
parent | 85706c34d53d4810f54bec1de662392a3c06a996 (diff) | |
download | openvswitch-a32bab26e5d83e97624f265dad7ef3d07c8e0741.tar.gz |
netdev-dpdk: Add mbuf HEADROOM after alignment.
Commit dfaf00e started using the result of dpdk_buf_size() to calculate
the available size on each mbuf, as opposed to using the previous
MBUF_SIZE macro. However, this was calculating the mbuf size by adding
up the MTU with RTE_PKTMBUF_HEADROOM and only then aligning to
NETDEV_DPDK_MBUF_ALIGN. Instead, the accounting for the
RTE_PKTMBUF_HEADROOM should only happen after alignment, as per below.
Before alignment:
ROUNDUP(MTU(1500) + RTE_PKTMBUF_HEADROOM(128), 1024) = 2048
After aligment:
ROUNDUP(MTU(1500), 1024) + 128 = 2176
This might seem insignificant, however, it might have performance
implications in DPDK, where each mbuf is expected to have 2k +
RTE_PKTMBUF_HEADROOM of available space. This is because not only some
NICs have course grained alignments of 1k, they will also take
RTE_PKTMBUF_HEADROOM bytes from the overall available space in an mbuf
when setting up their Rx requirements. Thus, only the "After alignment"
case above would guarantee a 2k of available room, as the "Before
alignment" would report only 1920B.
Some extra information can be found at:
https://mails.dpdk.org/archives/dev/2018-November/119219.html
Note: This has been found by Ian Stokes while going through some
af_packet checks.
Reported-by: Ian Stokes <ian.stokes@intel.com>
Fixes: dfaf00e ("netdev-dpdk: fix mbuf sizing")
Signed-off-by: Tiago Lam <tiago.lam@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/topics/dpdk/memory.rst | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Documentation/topics/dpdk/memory.rst b/Documentation/topics/dpdk/memory.rst index c9b739fb7..9ebfd11e4 100644 --- a/Documentation/topics/dpdk/memory.rst +++ b/Documentation/topics/dpdk/memory.rst @@ -107,8 +107,8 @@ Example 1 MTU = 1500 Bytes Number of mbufs = 262144 - Mbuf size = 2752 Bytes - Memory required = 262144 * 2752 = 721 MB + Mbuf size = 3008 Bytes + Memory required = 262144 * 3008 = 788 MB Example 2 +++++++++ @@ -116,8 +116,8 @@ Example 2 MTU = 1800 Bytes Number of mbufs = 262144 - Mbuf size = 2752 Bytes - Memory required = 262144 * 2752 = 721 MB + Mbuf size = 3008 Bytes + Memory required = 262144 * 3008 = 788 MB .. note:: @@ -130,8 +130,8 @@ Example 3 MTU = 6000 Bytes Number of mbufs = 262144 - Mbuf size = 8000 Bytes - Memory required = 262144 * 8000 = 2097 MB + Mbuf size = 7104 Bytes + Memory required = 262144 * 7104 = 1862 MB Example 4 +++++++++ @@ -139,8 +139,8 @@ Example 4 MTU = 9000 Bytes Number of mbufs = 262144 - Mbuf size = 10048 Bytes - Memory required = 262144 * 10048 = 2634 MB + Mbuf size = 10176 Bytes + Memory required = 262144 * 10176 = 2667 MB Per Port Memory Calculations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -194,8 +194,8 @@ Example 1: (1 rxq, 1 PMD, 1500 MTU) MTU = 1500 Number of mbufs = (1 * 2048) + (2 * 2048) + (1 * 32) + (16384) = 22560 - Mbuf size = 2752 Bytes - Memory required = 22560 * 2752 = 62 MB + Mbuf size = 3008 Bytes + Memory required = 22560 * 3008 = 67 MB Example 2: (1 rxq, 2 PMD, 6000 MTU) +++++++++++++++++++++++++++++++++++ @@ -203,8 +203,8 @@ Example 2: (1 rxq, 2 PMD, 6000 MTU) MTU = 6000 Number of mbufs = (1 * 2048) + (3 * 2048) + (1 * 32) + (16384) = 24608 - Mbuf size = 8000 Bytes - Memory required = 24608 * 8000 = 196 MB + Mbuf size = 7104 Bytes + Memory required = 24608 * 7104 = 175 MB Example 3: (2 rxq, 2 PMD, 9000 MTU) +++++++++++++++++++++++++++++++++++ @@ -212,5 +212,5 @@ Example 3: (2 rxq, 2 PMD, 9000 MTU) MTU = 9000 Number of mbufs = (2 * 2048) + (3 * 2048) + (1 * 32) + (16384) = 26656 - Mbuf size = 10048 Bytes - Memory required = 26656 * 10048 = 267 MB + Mbuf size = 10176 Bytes + Memory required = 26656 * 10176 = 271 MB |