> On Nov 16, 2017, at 11:16 AM, Hanoch Haim (hhaim) <hh...@cisco.com> wrote: > > Hi Oliver, > > It's hard for me to follow this thread. > > 1) It is not about clear/not-clear, it is error prone to *replicate* code > that has the same logic. > > "I'm not convinced that: > > __rte_pktmbuf_reset_nb_segs(m); > > is clearer than: > > m->next = NULL; > m->nb_segs = 1; > > Anyway, I agree this should not be part of this patch. We should only keep > the fix. > " > 2) This definitely does not look good. > All the point in my patch is to move the ref-cnt operations to set of API > that already taking care of RTE_MBUF_REFCNT_ATOMIC > > + /* We don't use rte_mbuf_refcnt_update() because we already > + * tested that refcnt != 1. > + */ > +#ifdef RTE_MBUF_REFCNT_ATOMIC > + ret = rte_atomic16_add_return(&m->refcnt_atomic, -1); > +#else > + ret = --m->refcnt; > +#endif > + if (ret != 0) > + return NULL; >
Looks ugly, agreed.