diff options
Diffstat (limited to 'net/kcm/kcmsock.c')
-rw-r--r-- | net/kcm/kcmsock.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index 7e08a4d3d77d..64f0e8531af0 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c | |||
@@ -929,23 +929,25 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) | |||
929 | goto out_error; | 929 | goto out_error; |
930 | } | 930 | } |
931 | 931 | ||
932 | /* New message, alloc head skb */ | 932 | if (msg_data_left(msg)) { |
933 | head = alloc_skb(0, sk->sk_allocation); | 933 | /* New message, alloc head skb */ |
934 | while (!head) { | ||
935 | kcm_push(kcm); | ||
936 | err = sk_stream_wait_memory(sk, &timeo); | ||
937 | if (err) | ||
938 | goto out_error; | ||
939 | |||
940 | head = alloc_skb(0, sk->sk_allocation); | 934 | head = alloc_skb(0, sk->sk_allocation); |
941 | } | 935 | while (!head) { |
936 | kcm_push(kcm); | ||
937 | err = sk_stream_wait_memory(sk, &timeo); | ||
938 | if (err) | ||
939 | goto out_error; | ||
942 | 940 | ||
943 | skb = head; | 941 | head = alloc_skb(0, sk->sk_allocation); |
942 | } | ||
944 | 943 | ||
945 | /* Set ip_summed to CHECKSUM_UNNECESSARY to avoid calling | 944 | skb = head; |
946 | * csum_and_copy_from_iter from skb_do_copy_data_nocache. | 945 | |
947 | */ | 946 | /* Set ip_summed to CHECKSUM_UNNECESSARY to avoid calling |
948 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 947 | * csum_and_copy_from_iter from skb_do_copy_data_nocache. |
948 | */ | ||
949 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
950 | } | ||
949 | 951 | ||
950 | start: | 952 | start: |
951 | while (msg_data_left(msg)) { | 953 | while (msg_data_left(msg)) { |
@@ -1018,10 +1020,12 @@ wait_for_memory: | |||
1018 | if (eor) { | 1020 | if (eor) { |
1019 | bool not_busy = skb_queue_empty(&sk->sk_write_queue); | 1021 | bool not_busy = skb_queue_empty(&sk->sk_write_queue); |
1020 | 1022 | ||
1021 | /* Message complete, queue it on send buffer */ | 1023 | if (head) { |
1022 | __skb_queue_tail(&sk->sk_write_queue, head); | 1024 | /* Message complete, queue it on send buffer */ |
1023 | kcm->seq_skb = NULL; | 1025 | __skb_queue_tail(&sk->sk_write_queue, head); |
1024 | KCM_STATS_INCR(kcm->stats.tx_msgs); | 1026 | kcm->seq_skb = NULL; |
1027 | KCM_STATS_INCR(kcm->stats.tx_msgs); | ||
1028 | } | ||
1025 | 1029 | ||
1026 | if (msg->msg_flags & MSG_BATCH) { | 1030 | if (msg->msg_flags & MSG_BATCH) { |
1027 | kcm->tx_wait_more = true; | 1031 | kcm->tx_wait_more = true; |