> -----Original Message----- > From: Simon K?gstr?m [mailto:simon.kagstrom at netinsight.net] > Sent: Monday, September 07, 2015 1:41 PM > To: Ananyev, Konstantin; dev at dpdk.org > Cc: Olivier MATZ; Zhang, Helin; Gonzalez Monroy, Sergio; Burakov, Anatoly > Subject: Re: [PATCH v2] mbuf/ip_frag: Move mbuf chaining to common code > > 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
Probably just me, but I can't foresee the situation when we would need to increase nb_segs to 16 bits. Looks like an overkill to me. Konstantin > 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