From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: Simon Kagstrom <simon.kagstrom@netinsight.net>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] mbuf/ip_frag: Move mbuf chaining to common code
Date: Mon, 7 Sep 2015 12:32:27 +0000 [thread overview]
Message-ID: <2601191342CEEE43887BDE71AB97725836A83E71@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <20150907134324.2d418bd4@miho>
Hi Simon,
Looks good to me, just one nit, see below.
Konstantin
> /**
> + * Chain an mbuf to another, thereby creating a segmented packet.
> + *
> + * @param head the head of the mbuf chain (the first packet)
> + * @param tail the mbuf to put last in the chain
> + *
> + * @return 0 on success, -EOVERFLOW if the chain is full (256 entries)
> + */
> +static inline int rte_pktmbuf_chain(struct rte_mbuf *head, struct rte_mbuf *tail)
> +{
> + struct rte_mbuf *cur_tail;
> +
> + /* Check for number-of-segments-overflow */
> + if (head->nb_segs + tail->nb_segs >= sizeof(head->nb_segs) << 8)
> + return -EOVERFLOW;
Would probably be better 'sizeof(head->nb_segs) << CHAR_BIT', or even just: ' > UINT8_MAX'.
Konstantin
> +
> + /* Chain 'tail' onto the old tail */
> + cur_tail = rte_pktmbuf_lastseg(head);
> + cur_tail->next = tail;
> +
> + /* accumulate number of segments and total length. */
> + head->nb_segs = (uint8_t)(head->nb_segs + tail->nb_segs);
> + head->pkt_len += tail->pkt_len;
> +
> + /* pkt_len is only set in the head */
> + tail->pkt_len = tail->data_len;
> +
> + return 0;
> +}
> +
> +/**
> * Dump an mbuf structure to the console.
> *
> * Dump all fields for the given packet mbuf and all its associated
> --
> 1.9.1
next prev parent reply other threads:[~2015-09-07 12:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 12:41 [dpdk-dev] [PATCH RFC] " Simon Kagstrom
2015-09-07 7:32 ` Olivier MATZ
2015-09-07 9:13 ` Ananyev, Konstantin
2015-09-07 9:35 ` Olivier MATZ
2015-09-07 10:40 ` Simon Kågström
2015-09-07 11:43 ` [dpdk-dev] [PATCH v2] " Simon Kagstrom
2015-09-07 12:32 ` Ananyev, Konstantin [this message]
2015-09-07 12:41 ` Simon Kågström
2015-09-07 23:21 ` Ananyev, Konstantin
2015-09-08 10:40 ` Simon Kågström
2015-09-09 8:22 ` Ananyev, Konstantin
2015-09-07 12:50 ` [dpdk-dev] [PATCH v3] " Simon Kagstrom
2015-10-13 12:50 ` Simon Kagstrom
2015-10-13 13:17 ` Thomas Monjalon
2015-10-13 13:11 ` Olivier MATZ
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2601191342CEEE43887BDE71AB97725836A83E71@irsmsx105.ger.corp.intel.com \
--to=konstantin.ananyev@intel.com \
--cc=dev@dpdk.org \
--cc=simon.kagstrom@netinsight.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).