From patchwork Wed Feb 8 17:18:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 725741 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vJSfG2NQfz9s7C for ; Thu, 9 Feb 2017 04:20:54 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="l00vpcMT"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932574AbdBHRUr (ORCPT ); Wed, 8 Feb 2017 12:20:47 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36042 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932551AbdBHRUM (ORCPT ); Wed, 8 Feb 2017 12:20:12 -0500 Received: by mail-pf0-f196.google.com with SMTP id 19so12063758pfo.3; Wed, 08 Feb 2017 09:19:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=r8BpWTg8w9SQ1vTw6S6IheZxNWko8c962UxhXRMQHBY=; b=l00vpcMTGG7TNyy87K+h/M4c2/Qib1MOapepKoViQhswtDk8WSesZ/jSrKwYOTQn97 XjXyvqwQojga/scmcZZigzSL6ogQGkLdLooVnFJ91iFe71vWjuggOFSL7Zq2HWaWrqwK zT3u7I651DnB09jRy0+oF2s4etNFU7dsLzMqr9fwzCBd6LkNBa8+h8W1hjbDsE/b4cDy zc3z7DxO+J99IhkTRqVRFkyYG5rk6QiEdXSLHjOQFWvGvWVOqiP5ila328tnPrwavns2 bPwST/ZewdnbX6/pBE0aqhWNx89lqhWsVyFK2FVJaVMy18OVpwyHn5Ipua50Bx+GkcQ4 d15g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=r8BpWTg8w9SQ1vTw6S6IheZxNWko8c962UxhXRMQHBY=; b=ViQDeKRhVJZaLgg+mWVuhv9unfe22MGkCy9zSnsEZXUXtgBACOtZzjMKla8qjldCLi XyImVjBEtufgxg2NMaBy1/0sOB5+Z40Vko9KcozANPX8bZiBrQ1dTNnWlSMs/1WMnM05 /FNSbnty0QAqlKJgv+J/upFu6OqeGyRYLwQszQ+zxceqhDgsMwY5CfMlVnj1qxfXjNhZ 4TaqA64qJAHtgAeFOmF+9AywEgOdchce5vfl1bhAlDlGAAz7OdMFdxq3c0SQAH9cyh4t Gnp6I9p+10eOtdbEv6Ri1V/7LcZu6gYqXgxfWTCUAFOzig6DsLGpHlh8uV4MHMlt2dqk trmA== X-Gm-Message-State: AIkVDXLExCv8ECAfQlApxAAFFoA7IFcQWC2xXli7ObUyyE8XTw+lReFcK//EpneQ7c1RWQ== X-Received: by 10.84.143.129 with SMTP id 1mr35444934plz.42.1486574348444; Wed, 08 Feb 2017 09:19:08 -0800 (PST) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id 66sm21867396pgg.47.2017.02.08.09.19.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Feb 2017 09:19:08 -0800 (PST) From: Xin Long To: network dev , linux-sctp@vger.kernel.org Cc: Marcelo Ricardo Leitner , Neil Horman , Vlad Yasevich , davem@davemloft.net Subject: [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing streams request chunk Date: Thu, 9 Feb 2017 01:18:19 +0800 Message-Id: <2664f74a3821c493b1b8beea4bc5c4077e994243.1486573728.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <7095f88e0d93a7189df08fec56b3db89deb0397c.1486573728.git.lucien.xin@gmail.com> References: <5f2d5aa54716217f68f724e4165289bd964b8755.1486573728.git.lucien.xin@gmail.com> <3d1180fcc5c72dea7d6cb7c7fafae4c4a7782cb3.1486573728.git.lucien.xin@gmail.com> <376d8794b81d7c5efe02b588ca381b88ed5f05ad.1486573728.git.lucien.xin@gmail.com> <7095f88e0d93a7189df08fec56b3db89deb0397c.1486573728.git.lucien.xin@gmail.com> In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch is to define Add Incoming/Outgoing Streams Request Parameter described in rfc6525 section 4.5 and 4.6. They can be in one same chunk trunk as rfc6525 section 3.1-7 describes, so make them in one function. Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner --- include/linux/sctp.h | 7 +++++++ include/net/sctp/sm.h | 3 +++ net/sctp/sm_make_chunk.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 71c0d41..b055788 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -742,4 +742,11 @@ struct sctp_strreset_tsnreq { __u32 request_seq; }; +struct sctp_strreset_addstrm { + sctp_paramhdr_t param_hdr; + __u32 request_seq; + __u16 number_of_streams; + __u16 reserved; +}; + #endif /* __LINUX_SCTP_H__ */ diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index ac37c17..3675fde 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h @@ -267,6 +267,9 @@ struct sctp_chunk *sctp_make_strreset_req( bool out, bool in); struct sctp_chunk *sctp_make_strreset_tsnreq( const struct sctp_association *asoc); +struct sctp_chunk *sctp_make_strreset_addstrm( + const struct sctp_association *asoc, + __u16 out, __u16 in); void sctp_chunk_assign_tsn(struct sctp_chunk *); void sctp_chunk_assign_ssn(struct sctp_chunk *); diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 749842a..7f8dbf2 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -3687,3 +3687,49 @@ struct sctp_chunk *sctp_make_strreset_tsnreq( return retval; } + +/* RE-CONFIG 4.5/4.6 (ADD STREAM) + * 0 1 2 3 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Parameter Type = 17 | Parameter Length = 12 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Re-configuration Request Sequence Number | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Number of new streams | Reserved | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct sctp_chunk *sctp_make_strreset_addstrm( + const struct sctp_association *asoc, + __u16 out, __u16 in) +{ + struct sctp_strreset_addstrm addstrm; + __u16 size = sizeof(addstrm); + struct sctp_chunk *retval; + + retval = sctp_make_reconf(asoc, (!!out + !!in) * size); + if (!retval) + return NULL; + + if (out) { + addstrm.param_hdr.type = SCTP_PARAM_RESET_ADD_OUT_STREAMS; + addstrm.param_hdr.length = htons(size); + addstrm.number_of_streams = htons(out); + addstrm.request_seq = htonl(asoc->strreset_outseq); + addstrm.reserved = 0; + + sctp_addto_chunk(retval, size, &addstrm); + } + + if (in) { + addstrm.param_hdr.type = SCTP_PARAM_RESET_ADD_IN_STREAMS; + addstrm.param_hdr.length = htons(size); + addstrm.number_of_streams = htons(in); + addstrm.request_seq = htonl(asoc->strreset_outseq + !!out); + addstrm.reserved = 0; + + sctp_addto_chunk(retval, size, &addstrm); + } + + return retval; +}