diff mbox

sctp: keep fragmentation point aligned to word size

Message ID 1458337159-22792-2-git-send-email-marcelo.leitner@gmail.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Marcelo Ricardo Leitner March 18, 2016, 9:39 p.m. UTC
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.

Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 include/net/sctp/sctp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marcelo Ricardo Leitner March 18, 2016, 11:11 p.m. UTC | #1
On Fri, Mar 18, 2016 at 06:39:17PM -0300, Marcelo Ricardo Leitner wrote:
> 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.
> 
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> ---
>  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 835aa2ed987092634a4242314e9eabb51d1e4e35..f27d38113c7926783a9bf2863e14e963ed0ad5d6 100644
> --- a/include/net/sctp/sctp.h
> +++ b/include/net/sctp/sctp.h
> @@ -426,7 +426,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 = min_t(int, frag, SCTP_MAX_CHUNK_LEN) & ~3;

Will submit a v2 with a helper for this & ~3 thing
diff mbox

Patch

diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 835aa2ed987092634a4242314e9eabb51d1e4e35..f27d38113c7926783a9bf2863e14e963ed0ad5d6 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -426,7 +426,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 = min_t(int, frag, SCTP_MAX_CHUNK_LEN) & ~3;
 
 	return frag;
 }