From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Laight Subject: RE: [PATCHv2 net-next 04/12] sctp: implement make_datafrag for sctp_stream_interleave Date: Fri, 8 Dec 2017 16:04:58 +0000 Message-ID: References: <2ca21c61e82a44daa29226eac54a4950@AcuMS.aculab.com> <20171208145630.GE3328@localhost.localdomain> <20171208153734.GB6955@hmswarspite.think-freely.org> <20171208160001.GF3328@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT Cc: 'Xin Long' , network dev , "linux-sctp@vger.kernel.org" , "davem@davemloft.net" To: 'Marcelo Ricardo Leitner' , Neil Horman Return-path: Received: from smtp-out6.electric.net ([192.162.217.182]:57782 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754093AbdLHQEn (ORCPT ); Fri, 8 Dec 2017 11:04:43 -0500 In-Reply-To: <20171208160001.GF3328@localhost.localdomain> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: From: Marcelo Ricardo Leitner > Sent: 08 December 2017 16:00 ... > > Is it worth replacing the si struct with an index/enum value, and indexing an > > array of method pointer structs? That would save you at least one dereference. > > Hmmm, maybe, yes. It would be like > sctp_stream_interleave[asoc->stream.si].make_datafrag(...) If you only expect 2 choices then an if () is likely to produce better code that the above. The actual implementation can be hidden inside a #define or static inline function. David