Skip to contentSkip to conversation

sctp: keep fragmentation point aligned to word size

PATCH Superseded Marcelo Ricardo Leitner 1 participant 2 messages Mar 18, 2016

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Marcelo Ricardo Leitner

author maintainer
#0 lore raw

PATCH 1/1 sctp: keep fragmentation point aligned to word size

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.

---
 include/net/sctp/sctp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/sctp/sctp.h +1 -1
index 835aa2ed987092634a4242314e9eabb51d1e4e35..f27d38113c7926783a9bf2863e14e963ed0ad5d6 100644
@@ -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;
 }
Signature · 1 line
2.5.0
author maintainer
#1 lore raw
Quoted 16 lines · Marcelo Ricardo Leitner

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.

---
 include/net/sctp/sctp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/sctp/sctp.h +0 -0
index 835aa2ed987092634a4242314e9eabb51d1e4e35..f27d38113c7926783a9bf2863e14e963ed0ad5d6 100644

include/net/sctp/sctp.h static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu) · line 429

Quoted 5 lines
include/net/sctp/sctp.h +1 -1
@@ -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