mbuf: document how to set length when attaching ext buffer

Message ID 20191226125410.25591-1-olivier.matz@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series mbuf: document how to set length when attaching ext buffer |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance fail Performance Testing issues
ci/iol-testing success Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Olivier Matz Dec. 26, 2019, 12:54 p.m. UTC
  From: Jörg Thalheim <joerg@thalheim.io>

Enhance API documentation of rte_pktmbuf_attach_extbuf() to
explain that the attached mbuf is initialized with length = 0.

Link: https://bugs.dpdk.org/show_bug.cgi?id=362

Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---

Hi,

This patch is a slight reword of a patch submitted in bug id 362 by Jörg
Thalheim.

@Jörg, feel free to comment if I missed something.

Thanks
Olivier


 lib/librte_mbuf/rte_mbuf.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
  

Comments

Jörg Thalheim Dec. 28, 2019, 9:40 a.m. UTC | #1
Looks good to me!

Olivier Matz <olivier.matz@6wind.com> writes:

> From: Jörg Thalheim <joerg@thalheim.io>
>
> Enhance API documentation of rte_pktmbuf_attach_extbuf() to
> explain that the attached mbuf is initialized with length = 0.
>
> Link: https://bugs.dpdk.org/show_bug.cgi?id=362
>
> Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> ---
>
> Hi,
>
> This patch is a slight reword of a patch submitted in bug id 362 by Jörg
> Thalheim.
>
> @Jörg, feel free to comment if I missed something.
>
> Thanks
> Olivier
>
>
>  lib/librte_mbuf/rte_mbuf.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index 219b110b7..2d4bda251 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -924,10 +924,14 @@ rte_pktmbuf_ext_shinfo_init_helper(void *buf_addr, uint16_t *buf_len,
>   * provided via shinfo. This callback function will be called once all the
>   * mbufs are detached from the buffer (refcnt becomes zero).
>   *
> - * The headroom for the attaching mbuf will be set to zero and this can be
> - * properly adjusted after attachment. For example, ``rte_pktmbuf_adj()``
> + * The headroom length of the attaching mbuf will be set to zero and this
> + * can be properly adjusted after attachment. For example, ``rte_pktmbuf_adj()``
>   * or ``rte_pktmbuf_reset_headroom()`` might be used.
>   *
> + * Similarly, the packet length is initialized to 0. If the buffer contains
> + * data, the user has to adjust ``data_len`` and the ``pkt_len`` field of
> + * the mbuf accordingly.
> + *
>   * More mbufs can be attached to the same external buffer by
>   * ``rte_pktmbuf_attach()`` once the external buffer has been attached by
>   * this API.
  
Thomas Monjalon Jan. 20, 2020, 12:33 p.m. UTC | #2
28/12/2019 10:40, Jörg Thalheim:
> 
> Looks good to me!
> 
> Olivier Matz <olivier.matz@6wind.com> writes:
> 
> > From: Jörg Thalheim <joerg@thalheim.io>
> >
> > Enhance API documentation of rte_pktmbuf_attach_extbuf() to
> > explain that the attached mbuf is initialized with length = 0.
> >
> > Link: https://bugs.dpdk.org/show_bug.cgi?id=362
> >
> > Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > ---
> >
> > Hi,
> >
> > This patch is a slight reword of a patch submitted in bug id 362 by Jörg
> > Thalheim.
> >
> > @Jörg, feel free to comment if I missed something.
> >
> > Thanks
> > Olivier

Applied, thanks
  

Patch

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 219b110b7..2d4bda251 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -924,10 +924,14 @@  rte_pktmbuf_ext_shinfo_init_helper(void *buf_addr, uint16_t *buf_len,
  * provided via shinfo. This callback function will be called once all the
  * mbufs are detached from the buffer (refcnt becomes zero).
  *
- * The headroom for the attaching mbuf will be set to zero and this can be
- * properly adjusted after attachment. For example, ``rte_pktmbuf_adj()``
+ * The headroom length of the attaching mbuf will be set to zero and this
+ * can be properly adjusted after attachment. For example, ``rte_pktmbuf_adj()``
  * or ``rte_pktmbuf_reset_headroom()`` might be used.
  *
+ * Similarly, the packet length is initialized to 0. If the buffer contains
+ * data, the user has to adjust ``data_len`` and the ``pkt_len`` field of
+ * the mbuf accordingly.
+ *
  * More mbufs can be attached to the same external buffer by
  * ``rte_pktmbuf_attach()`` once the external buffer has been attached by
  * this API.