From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shan Wei Date: Wed, 13 Oct 2010 08:36:10 +0000 Subject: Re: [PATCHv2 4/5] sctp: a sample module of strict priority queue Message-Id: <4CB56F7A.8030702@cn.fujitsu.com> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Yaogong Wang Cc: linux-sctp@vger.kernel.org, Vlad Yasevich , linux-kernel@vger.kernel.org Yaogong Wang wrote, at 09/12/2010 09:13 AM: > Provide a sample kernel module that uses the pluggable multistream > scheduling framework. This module implements strict priority queue. > > Signed-off-by: Yaogong Wang > --- > net/sctp/Kconfig | 12 ++++++ > net/sctp/Makefile | 1 + > net/sctp/sctp_prio.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 116 insertions(+), 0 deletions(-) > create mode 100644 net/sctp/sctp_prio.c > > diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig > index 126b014..85c8ded 100644 > --- a/net/sctp/Kconfig > +++ b/net/sctp/Kconfig > @@ -37,6 +37,18 @@ menuconfig IP_SCTP > > if IP_SCTP > > +config SCTP_SCHED_PRIO > + tristate "SCTP Multistream Scheduling: Priority Queue" > + default m > + help > + This module provides the ability to use priority queue > + to schedule multiple streams within an association. > + > + To compile this code as a module, choose M here: the > + module will be called sctp_prio. > + > + If in doubt, say N. > + > config NET_SCTPPROBE > tristate "SCTP: Association probing" > depends on PROC_FS && KPROBES > diff --git a/net/sctp/Makefile b/net/sctp/Makefile > index 4e8b65d..89be03a 100644 > --- a/net/sctp/Makefile > +++ b/net/sctp/Makefile > @@ -4,6 +4,7 @@ > > obj-$(CONFIG_IP_SCTP) += sctp.o > obj-$(CONFIG_NET_SCTPPROBE) += sctp_probe.o > +obj-$(CONFIG_SCTP_SCHED_PRIO) += sctp_prio.o > > sctp-y := sm_statetable.o sm_statefuns.o sm_sideeffect.o \ > protocol.o endpointola.o associola.o \ > diff --git a/net/sctp/sctp_prio.c b/net/sctp/sctp_prio.c > new file mode 100644 > index 0000000..11e7e11 > --- /dev/null > +++ b/net/sctp/sctp_prio.c > @@ -0,0 +1,103 @@ > +/* > + * SCTP multistream scheduling: priority queue > + */ > + > +#include > +#include > +#include > +#include > + > +static int prio_init(struct sctp_outq *q, gfp_t gfp) > +{ > + __u16 i; > + q->out_chunk_list = kmalloc(q->asoc->c.sinit_num_ostreams > + * sizeof(struct list_head), gfp); > + if (!q->out_chunk_list) > + return -ENOMEM; > + for (i = 0; i < q->asoc->c.sinit_num_ostreams; i++) > + INIT_LIST_HEAD(&q->out_chunk_list[i]); > + > + return 0; > +} > + > +static void prio_release(struct sctp_outq *q) > +{ > + kfree(q->out_chunk_list); > + return; > +} > + > +static void prio_enqueue_head_data(struct sctp_outq *q, > + struct sctp_chunk *ch) > +{ > + list_add(&ch->list, &q->out_chunk_list[ch->sinfo.sinfo_stream]); User can using SCTP_SNDRCV option to specific stream number. So, It is necessary to check stream number with q->asoc->c.sinit_num_ostreams. > + q->out_qlen += ch->skb->len; > + return; > +} > + > +static void prio_enqueue_tail_data(struct sctp_outq *q, struct sctp_chunk *ch) > +{ > + list_add_tail(&ch->list, &q->out_chunk_list[ch->sinfo.sinfo_stream]); need to check too. -- Best Regards ----- Shan Wei From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753385Ab0JMIgm (ORCPT ); Wed, 13 Oct 2010 04:36:42 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:58107 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753133Ab0JMIgl (ORCPT ); Wed, 13 Oct 2010 04:36:41 -0400 Message-ID: <4CB56F7A.8030702@cn.fujitsu.com> Date: Wed, 13 Oct 2010 16:36:10 +0800 From: Shan Wei User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Yaogong Wang CC: linux-sctp@vger.kernel.org, Vlad Yasevich , linux-kernel@vger.kernel.org Subject: Re: [PATCHv2 4/5] sctp: a sample module of strict priority queue References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yaogong Wang wrote, at 09/12/2010 09:13 AM: > Provide a sample kernel module that uses the pluggable multistream > scheduling framework. This module implements strict priority queue. > > Signed-off-by: Yaogong Wang > --- > net/sctp/Kconfig | 12 ++++++ > net/sctp/Makefile | 1 + > net/sctp/sctp_prio.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 116 insertions(+), 0 deletions(-) > create mode 100644 net/sctp/sctp_prio.c > > diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig > index 126b014..85c8ded 100644 > --- a/net/sctp/Kconfig > +++ b/net/sctp/Kconfig > @@ -37,6 +37,18 @@ menuconfig IP_SCTP > > if IP_SCTP > > +config SCTP_SCHED_PRIO > + tristate "SCTP Multistream Scheduling: Priority Queue" > + default m > + help > + This module provides the ability to use priority queue > + to schedule multiple streams within an association. > + > + To compile this code as a module, choose M here: the > + module will be called sctp_prio. > + > + If in doubt, say N. > + > config NET_SCTPPROBE > tristate "SCTP: Association probing" > depends on PROC_FS && KPROBES > diff --git a/net/sctp/Makefile b/net/sctp/Makefile > index 4e8b65d..89be03a 100644 > --- a/net/sctp/Makefile > +++ b/net/sctp/Makefile > @@ -4,6 +4,7 @@ > > obj-$(CONFIG_IP_SCTP) += sctp.o > obj-$(CONFIG_NET_SCTPPROBE) += sctp_probe.o > +obj-$(CONFIG_SCTP_SCHED_PRIO) += sctp_prio.o > > sctp-y := sm_statetable.o sm_statefuns.o sm_sideeffect.o \ > protocol.o endpointola.o associola.o \ > diff --git a/net/sctp/sctp_prio.c b/net/sctp/sctp_prio.c > new file mode 100644 > index 0000000..11e7e11 > --- /dev/null > +++ b/net/sctp/sctp_prio.c > @@ -0,0 +1,103 @@ > +/* > + * SCTP multistream scheduling: priority queue > + */ > + > +#include > +#include > +#include > +#include > + > +static int prio_init(struct sctp_outq *q, gfp_t gfp) > +{ > + __u16 i; > + q->out_chunk_list = kmalloc(q->asoc->c.sinit_num_ostreams > + * sizeof(struct list_head), gfp); > + if (!q->out_chunk_list) > + return -ENOMEM; > + for (i = 0; i < q->asoc->c.sinit_num_ostreams; i++) > + INIT_LIST_HEAD(&q->out_chunk_list[i]); > + > + return 0; > +} > + > +static void prio_release(struct sctp_outq *q) > +{ > + kfree(q->out_chunk_list); > + return; > +} > + > +static void prio_enqueue_head_data(struct sctp_outq *q, > + struct sctp_chunk *ch) > +{ > + list_add(&ch->list, &q->out_chunk_list[ch->sinfo.sinfo_stream]); User can using SCTP_SNDRCV option to specific stream number. So, It is necessary to check stream number with q->asoc->c.sinit_num_ostreams. > + q->out_qlen += ch->skb->len; > + return; > +} > + > +static void prio_enqueue_tail_data(struct sctp_outq *q, struct sctp_chunk *ch) > +{ > + list_add_tail(&ch->list, &q->out_chunk_list[ch->sinfo.sinfo_stream]); need to check too. -- Best Regards ----- Shan Wei