From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ernst.netinsight.se (ernst.netinsight.se [194.16.221.21]) by dpdk.org (Postfix) with SMTP id 418A95958 for ; Mon, 7 Sep 2015 14:41:22 +0200 (CEST) Received: from [10.100.1.152] (unverified [10.100.1.152]) by ernst.netinsight.se (EMWAC SMTPRS 0.83) with SMTP id ; Mon, 07 Sep 2015 14:41:15 +0200 Message-ID: <55ED85EB.2030102@netinsight.net> Date: Mon, 07 Sep 2015 14:41:15 +0200 From: =?windows-1252?Q?Simon_K=E5gstr=F6m?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: "Ananyev, Konstantin" , "dev@dpdk.org" 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> <2601191342CEEE43887BDE71AB97725836A83E71@irsmsx105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB97725836A83E71@irsmsx105.ger.corp.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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:41:22 -0000 On 2015-09-07 14:32, Ananyev, Konstantin wrote: >> +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 Thanks. I got it wrong anyway, what I wanted was to be able to handle the day when nb_segs changes to a 16-bit number, but then it should really be ... >= 1 << (sizeof(head->nb_segs) * 8) anyway. I'll fix that and also add a warning that the implementation will do a linear search to find the tail entry. // Simon