⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trans_design.nr

📁 早期freebsd实现
💻 NR
📖 第 1 页 / 共 4 页
字号:
Credit is determined by dividing the total amount of availablespace in the receive bufferby the negotiated maximum TPDU size.TP can often offer a larger credit than this if it usesan average of the measured actual TPDU sizes.This strategy was once an option in the ARGO kernel,but it was removed because unless the actual TPDU sizeis constant, it leads to reneging of credit,retransmissions, and decreased performance.It does not work well when there is any fluctuation in the sizesof TPDUs and it carries the penalty of lengthening the critical pathof the TP entity..sh 1 "Major Data Structures and Types".ppIn addition to the types commonly used in the kernel,such as .(b\fC.TStab(+);l l l l. +typedef+unsigned char+u_char; +typedef+unsigned int+u_int; +typedef+unsigned short+u_short;.TE\fR.)bTP uses the following types:.(b\fC.TStab(+);l l l l. +typedef+unsigned int+SeqNum +typedef+unsigned short+RefNum; +typedef+int+ProtoHook;.TE\fR.)b.ppSequence numbers can be either 7 or 31 bits.An unsigned integer is used in all cases, and the proper typeof arithmetic is performed with bit masks.Reference numbers are 16 bits.ProtoHook is the type of the procedures that are in switchtables, which,although they are not functions,are declared \fIint\fR rather than \fIvoid\fRto be consistent with the rest of the kernel..ppThe following structures are fundamentaltypes used throughout TP,in addition to those already described in the section,"The Design of the Transport Entity"..(b\fC.TStab(+);l s s s.struct tp_ref {.T&l l l l.+u_char+tpr_state;+/* REF_FROZEN...*/+struct Ccallout+tpr_callout[N_CTIMERS];+/* C timers */+struct Ecallout+tpr_calltodo;+/* E timers list */+struct tp_pcb+*tpr_pcb;+/* --> PCB */};.TE\fR.)b.lpThe reference structure is logically a part of the protocolcontrol block and it is linked to a pcb, but it may outlivea pcb.When a connection is dissolved, the pcb may be recycledbut the reference structure must remain until the referencetimer goes off.The field \fItpr_state\fR takes the valuesREF_FROZEN (a reference timer is ticking),REF_OPEN (in use, has timers and an associated pcb),REF_OPENING (has a pcb but no timers), andREF_FREE (free to reallocate)..ppThe TP protocol control block is too large to fit intoone mbuf structure so it comprises two structureslinked together, the \fItp_pcb\fR structure and the.\fItp_pcb_aux\fR structure.The \fItp_pcb_aux\fR structure containsitems that are used less frequently than those inthe former structure, since each access to theseitems requires a second pointer dereference..(b\fC.TStab(+);l s s s.struct tp_pcb_aux {.T&l l l s. +struct sockbuf+tpa_Xsnd;+/* for expedited data */+struct sockbuf+tpa_Xrcv;+/* for expedited data */+u_char +tpa_vers;+/* protocol version */+u_char +tpa_peer_acktime;+/* to compute DT TPDU+++retrans timer value */+SeqNum+tpa_Xsndnxt;+/* seq # of+++next XPD to send */+SeqNum+tpa_Xuna;+/* seq # of +++unacked XPD */+SeqNum+tpa_Xrcvnxt;+/* next XPD seq #+++expect to recv */+/* addressing */+u_short+tpa_domain;+/* domain AF_ISO,...*/+u_short+tpa_fsuffixlen;+/* foreign suffix */+u_char+tpa_fsuffix[MAX_TSAP_SEL_LEN];++u_short+tpa_lsuffixlen;+/* local suffix */+u_char+tpa_lsuffix[MAX_TSAP_SEL_LEN];+.T&l s s s. +/* AK subsequencing */.T&l l l s. +u_short+tpa_s_subseq;+/* next subseq to send */+u_short+tpa_r_subseq;+/* highest recv subseq */};.TE\fR.)b.ppThe major portion of the protocol control block is in the\fItp_pcb\fR structure:.(b\fC.TStab(%);l s s s.struct tp_pcb {.\" *************************************** .T&l l l l..\" The next line sets the spacing for the table: 1+3 17+3 17+3 13+3 %                 %                 %.\"456789 123456789- 123456789 123456-789 123456789 1234567890.\" %struct tp_ref%*tp_refp;%    .T&l l l s.%%/* reference structure */%.\" *************************************** .T&l l l l. %struct tp_pcb_aux%*tp_aux;% .T&l l l s. %%/*rest of tpcb (auxiliary struct)*/%.\" *************************************** .T&l l l l. %caddr_t%tp_npcb;%/* to ll pcb */%struct nl_protosw%*tp_nlproto;%.T&l l l s. % %/* domain-dependent routines */%.\" *************************************** .T&l l l l. %struct socket%*tp_sock;%/* back ptr */.\" *************************************** .T&l s s s./* local and foreign reference numbers: */.T&l l l l. %RefNum%tp_lref;% %RefNum%tp_fref;%.\" *************************************** .T&l s s s..\"456789 123456789 123456789 123456789 123456789 1234567890/* Stuff for sequence space arithmetic:  * Maintaining 2 sequence spaces is a pain so we set these * values once at connection establishment time. Sequence * number arithmetic is a set of macros which uses these. * Sequence numbers are stored as 32 bits. * tp_seqmask tells which of the 32 bits is used. * tp_seqibt  is the lsb that is not used.  When set, *   it indicates wraparound has occurred. * tp_seqhalf is the value that is half the sequence space. *   (or half plus one). */.T&l l l l.%u_int%tp_seqmask;%/* mask */%u_int%tp_seqbit;%/* wraparound */%u_int%tp_seqhalf;%/* half space */.\" *************************************** .T&l s s s./* flags:  values are defined in tp_user.h. * Here we keep such info as which options  * are in use: checksum, extended format, * flow control in class 2, etc. * See tp(4p) man page. */.\" *************************************** .T&l l l l. %u_short%tp_state;%/* fsm */%short%tp_retrans;%.T&l l l s. % % /* # times to retransmit */% .\" *************************************** .T&l s s s./* credit & sequencing info for SENDING: */.T&l l l s. %u_short%tp_fcredit;% % %/* remote real window */% %u_short%tp_cong_win;% % %/* remote congestion window */%.\" *************************************** %SeqNum%tp_snduna;%.T&l l l s. % %/* seq # of lowest unacked DT */% .\" *************************************** .T&l l l l. %struct tp_rtc    %*tp_snduna_rtc;% .T&l l l s. % %/* ptr to mbufs containing lowest% %% * unacked TPDUs sent so far%%% */%.\" *************************************** .T&l l l l. %SeqNum%tp_sndhiwat;% .T&l l l s. % %/* highest DT sent yet */% .\" *************************************** .T&l l l l. %struct tp_rtc%*tp_sndhiwat_rtc;% .T&l l l s. % %/* ptr to mbufs containing the last% %% * DT sent - this is the last item %%% * on the list that starts%%% * at tp_snduna_rtc%%% */%.\" *************************************** .T&l l l l. %int %tp_Nwindow;%/* for perf. measmt */.\" *************************************** .T&l s s s./* credit & sequencing info for RECEIVING: */.\" *************************************** .T&l l l s. %SeqNum%tp_sent_lcdt;% %%/* cdt according to last AK sent */% %SeqNum%tp_sent_uwe;%  % %/* upper window edge, according to% %% * the last AK sent %%% */* %SeqNum%tp_sent_rcvnxt;%  % %/* rcvnxt, according to% %% * the last AK sent%%% */*.\" *************************************** .T&l l l l. %short%tp_lcredit;%/* local */.\" *************************************** .T&l l l l. %SeqNum%tp_rcvnxt;% .T&l l l s. % %/* next DT seq# we expect to recv */% .\" *************************************** .T&l l l l. %struct tp_rtc%*tp_rcvnxt_rtc;% .T&l l l s. % %/* ptr to mbufs containing unacked % %% * DTs received out of order, and %%% * which we haven't acknowledged%%% */%.\" *************************************** .TE.TStab(%);l s s s./* Items kept in the aux structure: */.\" *************************************** .T&l s s l.#define  tp_vers%tp_aux->tpa_vers#define  tp_peer_acktime%tp_aux->tpa_peer_acktime#define  tp_Xsnd%tp_aux->tpa_Xsnd#define  tp_Xrcv%tp_aux->tpa_Xrcv#define  tp_Xrcvnxt%tp_aux->tpa_Xrcvnxt#define  tp_Xsndnxt%tp_aux->tpa_Xsndnxt#define  tp_Xuna%tp_aux->tpa_Xuna#define  tp_domain%tp_aux->tpa_domain#define  tp_fsuffixlen%tp_aux->tpa_fsuffixlen#define  tp_fsuffix%tp_aux->tpa_fsuffix#define  tp_lsuffixlen%tp_aux->tpa_lsuffixlen#define  tp_lsuffix%tp_aux->tpa_lsuffix#define  tp_s_subseq%tp_aux->tpa_s_subseq#define  tp_r_subseq%tp_aux->tpa_r_subseq.\" *************************************** .T&l s s s. % % % /* parameters per-connection controllable by user: */.\" *************************************** .T&l l l l. %struct%tp_conn_param%_tp_param;  % % %.\" *************************************** .T&l s s l.#define  tp_Nretrans%_tp_param.p_Nretrans#define  tp_dr_ticks%_tp_param.p_dr_ticks#define  tp_cc_ticks%_tp_param.p_cc_ticks#define  tp_dt_ticks%_tp_param.p_dt_ticks#define  tp_xpd_ticks%_tp_param.p_x_ticks#define  tp_cr_ticks%_tp_param.p_cr_ticks#define  tp_keepalive_ticks%_tp_param.p_keepalive_ticks#define  tp_sendack_ticks%_tp_param.p_sendack_ticks#define  tp_refer_ticks%_tp_param.p_ref_ticks#define  tp_inact_ticks%_tp_param.p_inact_ticks#define  tp_xtd_format%_tp_param.p_xtd_format#define  tp_xpd_service%_tp_param.p_xpd_service#define  tp_ack_strat%_tp_param.p_ack_strat#define  tp_rx_strat%_tp_param.p_rx_strat#define  tp_use_checksum%_tp_param.p_use_checksum#define  tp_tpdusize%_tp_param.p_tpdusize#define  tp_class%_tp_param.p_class#define  tp_winsize%_tp_param.p_winsize#define  tp_netservice%_tp_param.p_netservice#define  tp_no_disc_indications%_tp_param.p_no_disc_indications#define  tp_dont_change_params%_tp_param.p_dont_change_params.\" *************************************** .TE.\" *************************************** .\" *************************************** .\" *************************************** .TS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -