mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
sctp: Tag messages that can be Nagle delayed at creation.
When we create the sctp_datamsg and fragment the user data, we know exactly if we are sending full segments or not and how they might be bundled. During this time, we can mark messages a Nagle capable or not. This makes the check at transmit time much simpler. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
This commit is contained in:
parent
bfa0d9843a
commit
0e3aef8d09
@ -643,17 +643,15 @@ struct sctp_pf {
|
|||||||
struct sctp_datamsg {
|
struct sctp_datamsg {
|
||||||
/* Chunks waiting to be submitted to lower layer. */
|
/* Chunks waiting to be submitted to lower layer. */
|
||||||
struct list_head chunks;
|
struct list_head chunks;
|
||||||
/* Chunks that have been transmitted. */
|
|
||||||
size_t msg_size;
|
|
||||||
/* Reference counting. */
|
/* Reference counting. */
|
||||||
atomic_t refcnt;
|
atomic_t refcnt;
|
||||||
/* When is this message no longer interesting to the peer? */
|
/* When is this message no longer interesting to the peer? */
|
||||||
unsigned long expires_at;
|
unsigned long expires_at;
|
||||||
/* Did the messenge fail to send? */
|
/* Did the messenge fail to send? */
|
||||||
int send_error;
|
int send_error;
|
||||||
char send_failed;
|
u8 send_failed:1,
|
||||||
/* Control whether chunks from this message can be abandoned. */
|
can_abandon:1, /* can chunks from this message can be abandoned. */
|
||||||
char can_abandon;
|
can_delay; /* should this message be Nagle delayed */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
|
struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
|
||||||
|
@ -58,9 +58,9 @@ static void sctp_datamsg_init(struct sctp_datamsg *msg)
|
|||||||
msg->send_failed = 0;
|
msg->send_failed = 0;
|
||||||
msg->send_error = 0;
|
msg->send_error = 0;
|
||||||
msg->can_abandon = 0;
|
msg->can_abandon = 0;
|
||||||
|
msg->can_delay = 1;
|
||||||
msg->expires_at = 0;
|
msg->expires_at = 0;
|
||||||
INIT_LIST_HEAD(&msg->chunks);
|
INIT_LIST_HEAD(&msg->chunks);
|
||||||
msg->msg_size = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate and initialize datamsg. */
|
/* Allocate and initialize datamsg. */
|
||||||
@ -157,7 +157,6 @@ static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chu
|
|||||||
{
|
{
|
||||||
sctp_datamsg_hold(msg);
|
sctp_datamsg_hold(msg);
|
||||||
chunk->msg = msg;
|
chunk->msg = msg;
|
||||||
msg->msg_size += chunk->skb->len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -247,6 +246,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
|
|||||||
if (msg_len >= first_len) {
|
if (msg_len >= first_len) {
|
||||||
msg_len -= first_len;
|
msg_len -= first_len;
|
||||||
whole = 1;
|
whole = 1;
|
||||||
|
msg->can_delay = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* How many full sized? How many bytes leftover? */
|
/* How many full sized? How many bytes leftover? */
|
||||||
|
@ -674,7 +674,7 @@ static sctp_xmit_t sctp_packet_can_append_data(struct sctp_packet *packet,
|
|||||||
* Don't delay large message writes that may have been
|
* Don't delay large message writes that may have been
|
||||||
* fragmeneted into small peices.
|
* fragmeneted into small peices.
|
||||||
*/
|
*/
|
||||||
if ((len < max) && (chunk->msg->msg_size < max)) {
|
if ((len < max) && chunk->msg->can_delay) {
|
||||||
retval = SCTP_XMIT_NAGLE_DELAY;
|
retval = SCTP_XMIT_NAGLE_DELAY;
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user