From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 9823412A8 for ; Mon, 7 Sep 2015 14:33:28 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 07 Sep 2015 05:33:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,485,1437462000"; d="scan'208";a="800010101" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by fmsmga002.fm.intel.com with ESMTP; 07 Sep 2015 05:33:26 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.51]) by IRSMSX104.ger.corp.intel.com ([163.33.3.159]) with mapi id 14.03.0224.002; Mon, 7 Sep 2015 13:32:27 +0100 From: "Ananyev, Konstantin" To: Simon Kagstrom , "dev@dpdk.org" Thread-Topic: [PATCH v2] mbuf/ip_frag: Move mbuf chaining to common code Thread-Index: AQHQ6WJyu9dOoHLyNkKQrAkIM5z28J4w/MMA Date: Mon, 7 Sep 2015 12:32:27 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836A83E71@irsmsx105.ger.corp.intel.com> References: <20150831144110.4a7afa27@miho> <55ED3D9A.7070607@6wind.com> <2601191342CEEE43887BDE71AB97725836A83CBA@irsmsx105.ger.corp.intel.com> <55ED5A6A.1000803@6wind.com> <55ED69BA.4010803@netinsight.net> <20150907134324.2d418bd4@miho> In-Reply-To: <20150907134324.2d418bd4@miho> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] mbuf/ip_frag: Move mbuf chaining to common code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Sep 2015 12:33:29 -0000 Hi Simon, Looks good to me, just one nit, see below. Konstantin=20 > /** > + * 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_mb= uf *tail) > +{ > + struct rte_mbuf *cur_tail; > + > + /* Check for number-of-segments-overflow */ > + if (head->nb_segs + tail->nb_segs >=3D 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 =3D rte_pktmbuf_lastseg(head); > + cur_tail->next =3D tail; > + > + /* accumulate number of segments and total length. */ > + head->nb_segs =3D (uint8_t)(head->nb_segs + tail->nb_segs); > + head->pkt_len +=3D tail->pkt_len; > + > + /* pkt_len is only set in the head */ > + tail->pkt_len =3D 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