From patchwork Sat Jan 21 10:24:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 718039 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 3v5DGk726pz9sDG for ; Sat, 21 Jan 2017 21:25:02 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PQK1kir4"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751150AbdAUKYw (ORCPT ); Sat, 21 Jan 2017 05:24:52 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35526 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751064AbdAUKYu (ORCPT ); Sat, 21 Jan 2017 05:24:50 -0500 Received: by mail-pf0-f196.google.com with SMTP id f144so6999602pfa.2; Sat, 21 Jan 2017 02:24:49 -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=ue+LeP+iAem2XZDGp+oGbwGosPuOtKj0hunCinvLQK4=; b=PQK1kir4ZMlIjS5pgBZCF+ClIKhl3Dv7dgYs8ailVYFYJjPmoa9kdy2okl7TAPIdJP zBeiP2Jcu1pgQRVXw7MXcra33w3rWMP3nFwKi9KVB+mLrIzsYGlC7667DZZhWAuSoA4O KjC7q0qN6jDhzgX0wIriOrup37FqSNCDClczNq9kat7QoxCoc84yvEtrer/MuN7oy+9r 3GMfgKRRtbdFsX6txul72HcJKQtxefCboLVfnjN7shEFEnd/Xvi9qtbWp4GlWngh3zUJ GTpNZ1NGqLWBSMCxeisPvsD3AzFeW3+zjRTnGlwWBRKP+G0dfgZfAoBU75ZvBGmUL6ui 3uiw== 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=ue+LeP+iAem2XZDGp+oGbwGosPuOtKj0hunCinvLQK4=; b=pSCrsknO1iSb2oiChgugVipfJi1NilJuEqZyODmHfabSXTOPCxe/zDay1KqdWL+ggN pTqMQJEMivVaWWcWcIVujIo19TRuhQqWriDm6Jq0/BSwVaec7WrNLzyrNaKuPwFsGssu pr2TFdFf9kcWW7jGhWFlJU+c1igCHn/lMajs26gMsLB/36kVH1244yHJuhrgRQYwW7+E lEo8CBkGhzzkPDjVXYO8iZqhv0y15RClsn739X/Vrrdk23Xjf+dSemh5evqL4xSId8n3 cxZPtwfudXcImcXhIdLXqEGfaAfjLDrRuRrtHKt0BDsQIIL9gR3+FpxTegwlHcx0Ynlw LhwA== X-Gm-Message-State: AIkVDXItfCP2yzaji5hhrUzQz4y2KzbAaDtJcV2h/SWoEPhdW+GY4KGnUDz7e+ihAKMz1Q== X-Received: by 10.84.232.70 with SMTP id f6mr28421587pln.113.1484994289484; Sat, 21 Jan 2017 02:24:49 -0800 (PST) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id i86sm22902141pfj.87.2017.01.21.02.24.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jan 2017 02:24:49 -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: [PATCHv5 net-next 2/5] sctp: add support for generating stream reconf ssn/tsn reset request chunk Date: Sat, 21 Jan 2017 18:24:23 +0800 Message-Id: X-Mailer: git-send-email 2.1.0 In-Reply-To: <9f2a54d764987dc6509e2322e3c0d93f819ebdb5.1484993773.git.lucien.xin@gmail.com> References: <9f2a54d764987dc6509e2322e3c0d93f819ebdb5.1484993773.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 SSN/TSN Reset Request Parameter described in rfc6525 section 4.3. Signed-off-by: Xin Long --- include/linux/sctp.h | 5 +++++ include/net/sctp/sm.h | 2 ++ net/sctp/sm_make_chunk.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/include/linux/sctp.h b/include/linux/sctp.h index a9e7906..95b8ed3 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -737,4 +737,9 @@ struct sctp_strreset_inreq { __u16 list_of_streams[0]; } __packed; +struct sctp_strreset_tsnreq { + sctp_paramhdr_t param_hdr; + __u32 request_seq; +} __packed; + #endif /* __LINUX_SCTP_H__ */ diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 430ed13..ac37c17 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h @@ -265,6 +265,8 @@ struct sctp_chunk *sctp_make_strreset_req( const struct sctp_association *asoc, __u16 stream_num, __u16 *stream_list, bool out, bool in); +struct sctp_chunk *sctp_make_strreset_tsnreq( + const struct sctp_association *asoc); 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 ad3445b..801450c 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -3660,3 +3660,32 @@ struct sctp_chunk *sctp_make_strreset_req( return retval; } + +/* RE-CONFIG 4.3 (SSN/TSN RESET ALL) + * 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 = 15 | Parameter Length = 8 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Re-configuration Request Sequence Number | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct sctp_chunk *sctp_make_strreset_tsnreq( + const struct sctp_association *asoc) +{ + struct sctp_strreset_tsnreq tsnreq; + __u16 length = sizeof(tsnreq); + struct sctp_chunk *retval; + + retval = sctp_make_reconf(asoc, length); + if (!retval) + return NULL; + + tsnreq.param_hdr.type = SCTP_PARAM_RESET_TSN_REQUEST; + tsnreq.param_hdr.length = htons(length); + tsnreq.request_seq = htonl(asoc->strreset_outseq); + + sctp_addto_chunk(retval, sizeof(tsnreq), &tsnreq); + + return retval; +}