Skip to contentSkip to conversation

sctp: keep fragmentation point aligned to word size

PATCH New Marcelo Ricardo Leitner 1 participant 1 message Mar 19, 2016

Subsystems (3)
lore
Share & tools
lore

Marcelo Ricardo Leitner

author maintainer
#0 lore raw

PATCH v2 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.

v2:
- Make use of the new WORD_TRUNC macro

---
 include/net/sctp/sctp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/sctp/sctp.h +1 -1
index ad2136caa7d65fdc0f51e4c7ad3a526c2f39660d..65521cfdcadeee35d61f280165a387cc2164ab6d 100644
@@ -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;
 }
Signature · 1 line
2.5.0