From patchwork Sat Mar 19 15:17:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Ricardo Leitner X-Patchwork-Id: 599774 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 3qS5Lq5Mphz9s9N for ; Sun, 20 Mar 2016 02:17:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754753AbcCSPRx (ORCPT ); Sat, 19 Mar 2016 11:17:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41127 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754118AbcCSPRu (ORCPT ); Sat, 19 Mar 2016 11:17:50 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id A0BB515554; Sat, 19 Mar 2016 15:17:50 +0000 (UTC) Received: from mrl.redhat.com (vpn1-4-181.gru2.redhat.com [10.97.4.181]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2JFHmYW010939; Sat, 19 Mar 2016 11:17:49 -0400 From: Marcelo Ricardo Leitner To: netdev@vger.kernel.org Cc: Eric Dumazet , Neil Horman , Vlad Yasevich , linux-sctp@vger.kernel.org Subject: [PATCH v2] sctp: keep fragmentation point aligned to word size Date: Sat, 19 Mar 2016 12:17:43 -0300 Message-Id: <1458400663-25558-1-git-send-email-marcelo.leitner@gmail.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If the user supply a different fragmentation point or if there is a network header that cause it to not be aligned, force it to be aligned. Fragmentation point at a value that is not aligned is not optimal. It causes extra padding to be used and has just no pros. v2: - Make use of the new WORD_TRUNC macro Signed-off-by: Marcelo Ricardo Leitner --- include/net/sctp/sctp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index ad2136caa7d65fdc0f51e4c7ad3a526c2f39660d..65521cfdcadeee35d61f280165a387cc2164ab6d 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -431,7 +431,7 @@ static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu) if (asoc->user_frag) frag = min_t(int, frag, asoc->user_frag); - frag = min_t(int, frag, SCTP_MAX_CHUNK_LEN); + frag = WORD_TRUNC(min_t(int, frag, SCTP_MAX_CHUNK_LEN)); return frag; }