Author: jhb
Date: Fri Feb 10 19:49:42 2017
New Revision: 313567
URL: https://svnweb.freebsd.org/changeset/base/313567

Log:
  MFC 311568,311584,312387:
  Set MORETOCOME for AIO write requests on a socket.
  
  311568:
  Set MORETOCOME for AIO write requests on a socket.
  
  Add a MSG_MOREOTOCOME message flag.  When this flag is set, sosend*
  set PRUS_MOREOTOCOME when invoking the protocol send method.  The aio
  worker tasks for sending on a socket set this flag when there are
  additional write jobs waiting on the socket buffer.
  
  311584:
  Unbreak lib/libsysdecode after r311568 by decoding MSG_MORETOCOME flag
  in msgflags
  
  (Actually, this change excludes MSG_MORETOCOME from being decoded)
  
  312387:
  Fix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME
  lead to delayed send of data sent with sendto(MSG_NOSIGNAL).
  
  Sponsored by: Chelsio Communications

Modified:
  stable/11/lib/libsysdecode/mktables
  stable/11/sys/kern/sys_socket.c
  stable/11/sys/kern/uipc_socket.c
  stable/11/sys/sys/socket.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libsysdecode/mktables
==============================================================================
--- stable/11/lib/libsysdecode/mktables Fri Feb 10 19:45:02 2017        
(r313566)
+++ stable/11/lib/libsysdecode/mktables Fri Feb 10 19:49:42 2017        
(r313567)
@@ -142,7 +142,7 @@ gen_table "seekwhence"      "SEEK_[A-Z]+
 gen_table "fcntlcmd"        "F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]+"   
"sys/fcntl.h"       "F_CANCEL|F_..LCK"
 gen_table "mmapflags"       "MAP_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+"        
"sys/mman.h"
 gen_table "rtpriofuncs"     "RTP_[A-Z]+[[:space:]]+[0-9]+"                 
"sys/rtprio.h"
-gen_table "msgflags"        "MSG_[A-Z]+[[:space:]]+0x[0-9]+"               
"sys/socket.h"      "MSG_SOCALLBCK"
+gen_table "msgflags"        "MSG_[A-Z]+[[:space:]]+0x[0-9]+"               
"sys/socket.h"      "MSG_SOCALLBCK|MSG_MORETOCOME"
 gen_table "sigcode"         "SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?"       
"sys/signal.h"
 gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+"           
"sys/umtx.h"
 gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+"    
"sys/umtx.h"

Modified: stable/11/sys/kern/sys_socket.c
==============================================================================
--- stable/11/sys/kern/sys_socket.c     Fri Feb 10 19:45:02 2017        
(r313566)
+++ stable/11/sys/kern/sys_socket.c     Fri Feb 10 19:49:42 2017        
(r313567)
@@ -604,6 +604,8 @@ retry:
                if (td->td_ru.ru_msgrcv != ru_before)
                        job->msgrcv = 1;
        } else {
+               if (!TAILQ_EMPTY(&sb->sb_aiojobq))
+                       flags |= MSG_MORETOCOME;
                uio.uio_rw = UIO_WRITE;
                ru_before = td->td_ru.ru_msgsnd;
 #ifdef MAC

Modified: stable/11/sys/kern/uipc_socket.c
==============================================================================
--- stable/11/sys/kern/uipc_socket.c    Fri Feb 10 19:45:02 2017        
(r313566)
+++ stable/11/sys/kern/uipc_socket.c    Fri Feb 10 19:49:42 2017        
(r313567)
@@ -1182,6 +1182,7 @@ sosend_dgram(struct socket *so, struct s
             (resid <= 0)) ?
                PRUS_EOF :
                /* If there is more to send set PRUS_MORETOCOME */
+               (flags & MSG_MORETOCOME) ||
                (resid > 0 && space > 0) ? PRUS_MORETOCOME : 0,
                top, addr, control, td);
        if (dontroute) {
@@ -1368,6 +1369,7 @@ restart:
                             (resid <= 0)) ?
                                PRUS_EOF :
                        /* If there is more to send set PRUS_MORETOCOME. */
+                           (flags & MSG_MORETOCOME) ||
                            (resid > 0 && space > 0) ? PRUS_MORETOCOME : 0,
                            top, addr, control, td);
                        if (dontroute) {

Modified: stable/11/sys/sys/socket.h
==============================================================================
--- stable/11/sys/sys/socket.h  Fri Feb 10 19:45:02 2017        (r313566)
+++ stable/11/sys/sys/socket.h  Fri Feb 10 19:49:42 2017        (r313567)
@@ -435,6 +435,7 @@ struct msghdr {
 #endif
 #ifdef _KERNEL
 #define        MSG_SOCALLBCK   0x10000         /* for use by socket callbacks 
- soreceive (TCP) */
+#define        MSG_MORETOCOME  0x100000        /* additional data pending */
 #endif
 
 /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to