big-or-odd-size packet option. (n x 128 instead of 2^n only)
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 18 Dec 1991 08:19:38 +0000 (00:19 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Wed, 18 Dec 1991 08:19:38 +0000 (00:19 -0800)
SCCS-vsn: sys/netiso/tp_pcb.h 7.20
SCCS-vsn: sys/netiso/tp_user.h 7.12
SCCS-vsn: sys/netiso/tp_output.c 7.15
SCCS-vsn: sys/netiso/tp_subr2.c 7.18
SCCS-vsn: sys/netiso/tp_emit.c 7.13
SCCS-vsn: sys/netiso/tp_input.c 7.26

usr/src/sys/netiso/tp_emit.c
usr/src/sys/netiso/tp_input.c
usr/src/sys/netiso/tp_output.c
usr/src/sys/netiso/tp_pcb.h
usr/src/sys/netiso/tp_subr2.c
usr/src/sys/netiso/tp_user.h

index 8bee83e..125bcc2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_emit.c   7.12 (Berkeley) %G%
+ *     @(#)tp_emit.c   7.13 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -287,6 +287,19 @@ tp_emit(dutype,    tpcb, seq, eot, data)
                                         |      (tpcb->tp_xpd_service? TPAO_USE_TXPD: 0);
                                        ADDOPTION(TPP_addl_opt, hdr, 1, x);
 
                                         |      (tpcb->tp_xpd_service? TPAO_USE_TXPD: 0);
                                        ADDOPTION(TPP_addl_opt, hdr, 1, x);
 
+                                       if ((tpcb->tp_l_tpdusize ^ (1 << tpcb->tp_tpdusize)) != 0) {
+                                               u_short size_s = tpcb->tp_l_tpdusize >> 7;
+                                               u_char size_c = size_s;
+                                               ASSERT(tpcb->tp_l_tpdusize < 65536 * 128);
+                                               if (dutype == CR_TPDU_type)
+                                                       tpcb->tp_ptpdusize = size_s;
+                                               if (size_s < 256) {
+                                                       ADDOPTION(TPP_ptpdu_size, hdr, 1, size_c);
+                                               } else {
+                                                       size_s = htons(size_s);
+                                                       ADDOPTION(TPP_ptpdu_size, hdr, 2, size_s);
+                                               }
+                                       }
                                }
                                        
                                if( (dutype == CR_TPDU_type) && (tpcb->tp_class != TP_CLASS_0)){
                                }
                                        
                                if( (dutype == CR_TPDU_type) && (tpcb->tp_class != TP_CLASS_0)){
index 9d0957d..5be9297 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_input.c  7.25 (Berkeley) %G%
+ *     @(#)tp_input.c  7.26 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -393,7 +393,7 @@ tp_input(m, faddr, laddr, cons_channel, dgout_routine, ce_bit)
        int                                     error = 0;
        unsigned                                dutype;
        u_short                                 dref, sref = 0, acktime = 2, subseq = 0; /*VAX*/
        int                                     error = 0;
        unsigned                                dutype;
        u_short                                 dref, sref = 0, acktime = 2, subseq = 0; /*VAX*/
-       u_char                                  preferred_class = 0, class_to_use = 0;
+       u_char                                  preferred_class = 0, class_to_use = 0, pdusize = 0;
        u_char                                  opt, dusize = TP_DFL_TPDUSIZE, addlopt = 0, version;
 #ifdef TP_PERF_MEAS
        u_char                                  perf_meas;
        u_char                                  opt, dusize = TP_DFL_TPDUSIZE, addlopt = 0, version;
 #ifdef TP_PERF_MEAS
        u_char                                  perf_meas;
@@ -512,6 +512,16 @@ again:
                                if (dusize < TP_MIN_TPDUSIZE || dusize > TP_MAX_TPDUSIZE)
                                                dusize = TP_DFL_TPDUSIZE;
                                break;
                                if (dusize < TP_MIN_TPDUSIZE || dusize > TP_MAX_TPDUSIZE)
                                                dusize = TP_DFL_TPDUSIZE;
                                break;
+                       case    TPP_ptpdu_size:
+                               switch (vbptr(P)->tpv_len) {
+                               case 1: pdusize = vbval(P, u_char); break;
+                               case 2: pdusize = ntohs(vbval(P, u_short)); break;
+                               default: ;
+                               IFDEBUG(D_TPINPUT)
+                                       printf("malformed prefered TPDU option\n");
+                               ENDDEBUG
+                               }
+                               break;
                        case    TPP_addl_opt:
                                vb_getval(P, u_char, addlopt);
                                break;
                        case    TPP_addl_opt:
                                vb_getval(P, u_char, addlopt);
                                break;
@@ -706,6 +716,7 @@ again:
                        tpp = tpcb->_tp_param;
                        tpp.p_class = class_to_use;
                        tpp.p_tpdusize = dusize;
                        tpp = tpcb->_tp_param;
                        tpp.p_class = class_to_use;
                        tpp.p_tpdusize = dusize;
+                       tpp.p_ptpdusize = pdusize;
                        tpp.p_xtd_format = (opt & TPO_XTD_FMT) == TPO_XTD_FMT;
                        tpp.p_xpd_service = (addlopt & TPAO_USE_TXPD) == TPAO_USE_TXPD;
                        tpp.p_use_checksum = (tpp.p_class == TP_CLASS_0)?0:
                        tpp.p_xtd_format = (opt & TPO_XTD_FMT) == TPO_XTD_FMT;
                        tpp.p_xpd_service = (addlopt & TPAO_USE_TXPD) == TPAO_USE_TXPD;
                        tpp.p_use_checksum = (tpp.p_class == TP_CLASS_0)?0:
@@ -925,6 +936,7 @@ again:
             CONG_UPDATE_SAMPLE(tpcb, ce_bit);
 
                dusize = tpcb->tp_tpdusize;
             CONG_UPDATE_SAMPLE(tpcb, ce_bit);
 
                dusize = tpcb->tp_tpdusize;
+               pdusize = tpcb->tp_ptpdusize;
 
                dutype = hdr->tpdu_type << 8; /* for the switch below */ 
 
 
                dutype = hdr->tpdu_type << 8; /* for the switch below */ 
 
@@ -950,6 +962,23 @@ again:
                                        ENDDEBUG
                                }
                                        break;
                                        ENDDEBUG
                                }
                                        break;
+                       caseof( CC_TPDU_type, TPP_ptpdu_size ): 
+                               {
+                                       u_short opdusize = pdusize;
+                                       switch (vbptr(P)->tpv_len) {
+                                       case 1: pdusize = vbval(P, u_char); break;
+                                       case 2: pdusize = ntohs(vbval(P, u_short)); break;
+                                       default: ;
+                                       IFDEBUG(D_TPINPUT)
+                                               printf("malformed prefered TPDU option\n");
+                                       ENDDEBUG
+                                       }
+                                       CHECK( (pdusize == 0 ||
+                                                       (opdusize && (pdusize > opdusize))),
+                                               E_TP_INV_PVAL, ts_inv_pval, respond,
+                                               (1 + (caddr_t)&vbptr(P)->tpv_val - (caddr_t)hdr) )
+                               }
+                                       break;
                        caseof( CC_TPDU_type, TPP_calling_sufx):
                                        IFDEBUG(D_TPINPUT)
                                                printf("CC calling (local) sufxlen 0x%x\n", lsufxlen);
                        caseof( CC_TPDU_type, TPP_calling_sufx):
                                        IFDEBUG(D_TPINPUT)
                                                printf("CC calling (local) sufxlen 0x%x\n", lsufxlen);
@@ -1060,6 +1089,7 @@ again:
                                tpp = tpcb->_tp_param;
                                tpp.p_class = (1<<hdr->tpdu_CCclass);
                                tpp.p_tpdusize = dusize;
                                tpp = tpcb->_tp_param;
                                tpp.p_class = (1<<hdr->tpdu_CCclass);
                                tpp.p_tpdusize = dusize;
+                               tpp.p_ptpdusize = pdusize;
                                tpp.p_dont_change_params = 0;
                                tpp.p_xtd_format = (opt & TPO_XTD_FMT) == TPO_XTD_FMT;
                                tpp.p_xpd_service = (addlopt & TPAO_USE_TXPD) == TPAO_USE_TXPD;
                                tpp.p_dont_change_params = 0;
                                tpp.p_xtd_format = (opt & TPO_XTD_FMT) == TPO_XTD_FMT;
                                tpp.p_xpd_service = (addlopt & TPAO_USE_TXPD) == TPAO_USE_TXPD;
index 4abeca0..4e3837c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_output.c 7.14 (Berkeley) %G%
+ *     @(#)tp_output.c 7.15 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -261,9 +261,8 @@ tp_consistency( tpcb, cmd, param )
        }
 
        if ((error==0) && (cmd & TP_FORCE)) {
        }
 
        if ((error==0) && (cmd & TP_FORCE)) {
+               long dusize = ((long)param->p_ptpdusize) << 7;
                /* Enforce Negotation rules below */
                /* Enforce Negotation rules below */
-               if (tpcb->tp_tpdusize > param->p_tpdusize)
-                       tpcb->tp_tpdusize = param->p_tpdusize;
                tpcb->tp_class = param->p_class;
                if (tpcb->tp_use_checksum || param->p_use_checksum)
                        tpcb->tp_use_checksum = 1;
                tpcb->tp_class = param->p_class;
                if (tpcb->tp_use_checksum || param->p_use_checksum)
                        tpcb->tp_use_checksum = 1;
@@ -271,8 +270,19 @@ tp_consistency( tpcb, cmd, param )
                        tpcb->tp_xpd_service = 0;
                if (!tpcb->tp_xtd_format || !param->p_xtd_format)
                        tpcb->tp_xtd_format = 0;
                        tpcb->tp_xpd_service = 0;
                if (!tpcb->tp_xtd_format || !param->p_xtd_format)
                        tpcb->tp_xtd_format = 0;
+               if (dusize) {
+                       if (tpcb->tp_l_tpdusize > dusize)
+                               tpcb->tp_l_tpdusize = dusize;
+                       if (tpcb->tp_ptpdusize == 0 ||
+                               tpcb->tp_ptpdusize > param->p_ptpdusize)
+                               tpcb->tp_ptpdusize = param->p_ptpdusize;
+               } else {
+                       if (param->p_tpdusize != 0 &&
+                               tpcb->tp_tpdusize > param->p_tpdusize)
+                               tpcb->tp_tpdusize = param->p_tpdusize;
+                       tpcb->tp_l_tpdusize = 1 << tpcb->tp_tpdusize;
+               }
        }
        }
-       tpcb->tp_l_tpdusize = 1 << tpcb->tp_tpdusize;
 done:
 
        IFTRACE(D_CONN)
 done:
 
        IFTRACE(D_CONN)
index 5ad27c6..be6fdc1 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_pcb.h    7.19 (Berkeley) %G%
+ *     @(#)tp_pcb.h    7.20 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -208,6 +208,7 @@ struct tp_pcb {
 #define        tp_dont_change_params _tp_param.p_dont_change_params
 #define        tp_netservice _tp_param.p_netservice
 #define        tp_version _tp_param.p_version
 #define        tp_dont_change_params _tp_param.p_dont_change_params
 #define        tp_netservice _tp_param.p_netservice
 #define        tp_version _tp_param.p_version
+#define        tp_ptpdusize _tp_param.p_ptpdusize
 
        int                                     tp_l_tpdusize;
                /* whereas tp_tpdusize is log2(the negotiated max size)
 
        int                                     tp_l_tpdusize;
                /* whereas tp_tpdusize is log2(the negotiated max size)
index 1562813..90dbfb7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_subr2.c  7.17 (Berkeley) %G%
+ *     @(#)tp_subr2.c  7.18 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -467,10 +467,13 @@ tp_mss(tpcb, nhdr_size)
        struct ifnet *ifp;
        register int rtt, mss;
        u_long bufsize;
        struct ifnet *ifp;
        register int rtt, mss;
        u_long bufsize;
-       int i, ssthresh = 0;
+       int i, ssthresh = 0, rt_mss;
        struct socket *so;
 
        struct socket *so;
 
-       mss = 1 << tpcb->tp_tpdusize;
+       if (tpcb->tp_ptpdusize)
+               mss = tpcb->tp_ptpdusize << 7;
+       else
+               mss = 1 << tpcb->tp_tpdusize;
        so = tpcb->tp_sock;
        if ((rt = *(tpcb->tp_routep)) == 0) {
                bufsize = so->so_rcv.sb_hiwat;
        so = tpcb->tp_sock;
        if ((rt = *(tpcb->tp_routep)) == 0) {
                bufsize = so->so_rcv.sb_hiwat;
@@ -497,10 +500,13 @@ tp_mss(tpcb, nhdr_size)
         * if there's an mtu associated with the route, use it
         */
        if (rt->rt_rmx.rmx_mtu)
         * if there's an mtu associated with the route, use it
         */
        if (rt->rt_rmx.rmx_mtu)
-               mss = rt->rt_rmx.rmx_mtu - nhdr_size;
+               rt_mss = rt->rt_rmx.rmx_mtu - nhdr_size;
        else
 #endif /* RTV_MTU */
        else
 #endif /* RTV_MTU */
-               mss = (ifp->if_mtu - nhdr_size);
+               rt_mss = (ifp->if_mtu - nhdr_size);
+       if (tpcb->tp_ptpdusize == 0 || /* assume application doesn't care */
+           mss > rt_mss /* network won't support what was asked for */)
+               mss = rt_mss;
        /* can propose mtu which are multiples of 128 */
        mss &= ~0x7f;
        /*
        /* can propose mtu which are multiples of 128 */
        mss &= ~0x7f;
        /*
index 3df37be..8e365cd 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_user.h   7.11 (Berkeley) %G%
+ *     @(#)tp_user.h   7.12 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -70,7 +70,7 @@ struct tp_conn_param {
        short   p_ref_ticks;
        short   p_inact_ticks;
 
        short   p_ref_ticks;
        short   p_inact_ticks;
 
-       short   p_unused;       /* was .. local credit fraction reported (>0) */
+       short   p_ptpdusize;    /* preferred tpdusize/128 */
        short   p_winsize;
 
        u_char  p_tpdusize;     /* log 2 of size */
        short   p_winsize;
 
        u_char  p_tpdusize;     /* log 2 of size */