SNDCP:Subnetwork Dependence Converage Protocol,子网相关汇聚协议。
参考协议:3GPP TS 44.065.
[attach]374[/attach]
图一 SNDCP的位置
三、重要的概念
1)NSAPI:Network Layer Service Access Point Identifier
SNDCP提供及使用的服务接入点结构图如下:
[attach]375[/attach]
图二 SNDCP和相邻层的关系
网络层使用的协议由动态分配的一个NSAPI来标识(该NSAPI是在PDP激活时在SM层生成的,然后通过SNSM-ACTIVE.indication传递给SNDCP层的,其实相当于在此建立了网络层协议和NSAPI之间的对应关系)。
SNDCP在收到N-PDU后,在向下层发送之前会填上该NSAPI,对等实体收到下层数据后,会根据NSAPI来确定所使用的网络协议。
2) N-PDU和LL-PDU
N-PDU是SNDCP和GPRS application之间传输的数据单元。SN-PDU是SNDCP和LLC之间传输的数据单元。下图描述不同协议的复用:
[attach]376[/attach]
图三 SNDCP对N-PDU的复用
一般,N-PDU包括Header和Data body. 比如IP Header.
3) N201.
Defines maximum number of octets in the information field of LL PDU. LL-PDU的最大长度,N-PDU按N201的长度进行分段。N-PDU通过XID参数协商确定。
分为N201-I和N201-U两种:
N201-I:Defines maximum number of octets available to a SN DATA PDU for a specific SAPI.确认模式的分段长度
N201-U:Defines maximum number of octets available to a SN UNITDATA PDU for a specific SAPI.非确认模式的分段长度
四、SNDCP提供的服务
1)将SN-DATA源语映射到LL-DATA源语(确认模式)
Mapping of SN DATA primitives onto LL DATA primitives.
2)将SN-UNIDATA源语映射到LL-UNIDATA源语(非确认模式)
Mapping of SN UNITDATA primitives onto LL UNITDATA primitives.
3)复用一个或多个网络层实体的N-PDU到LLC连接
Multiplexing of N PDUs from one or several network layer entities onto the appropriate LLC connection.
4)建立,重建和释放确认模式的端对端的LLC操作
Establishment, re-establishment and release of acknowledged peer-to-peer LLC operation.
5)确认模式端对端LLC操作中,通过缓冲和重传机制确保LLC层数据的完整性。
Supplementing the LLC layer in maintaining data integrity for acknowledged peer-to-peer LLC operation by buffering and retransmission of N PDUs.
6)独立管理每个NSAPI的投递系列号N-PDU Number.
Management of delivery sequence for each NSAPI, independently.
7)在传输端压缩冗长的协议控制信息,接收端进行解压缩。
Compression of redundant protocol control information (e.g. TCP/IP header) at the transmitting entity and decompression at the receiving entity. The compression method is specific to the particular network layer or transport layer protocols in use.
8)在传输端压缩冗长的数据信息,在接收端进行解压缩。对每个SAPI,数据压缩独立执行,也可能在PDP上下文间独立执行。压缩参数在MS和SGGN间进行协商。
Compression of redundant user data at the transmitting entity and decompression at the receiving entity. Data compression is performed independently for each SAPI, and may be performed independently for each PDP context. Compression parameters are negotiated between the MS and the SGSN.
9)分片和重组。压缩功能的输出是分片为LL-PDU的最大长度。独立于使用的网络层协议。
Segmentation and reassembly. The output of the compressor functions is segmented to the maximum length of LL PDU. These procedures are independent of the particular network layer protocol in use.
10)在对等SNDCP实体间协商XID参数。
Negotiation of the XID parameters between peer SNDCP entities using XID exchange.
下图描述了SNDCP在发送端的数据流程:
[attach]377[/attach]
图四 SNDCP在发送端的封装流程(本图可参考TS44.065的
Figure 4:SNDCP model)PDP type | Allocated NSAPI | PDP address |
IPv4 | 12 | 133.12.75.111 (4 octets) |
IPv6 | 13 | 133.12. … .11.123 (16 octets) |
Example of the NSAPI allocation
3. Establishment and release of acknowledged peer-to-peer LLC operation.
包括确认模式下LLC连接的建立,重建和释放( Establishing, Re-establishing and Releasing the acknowledged peer-to-peer LLC operation),
以及XID参数的协商(Negotiation of SNDCP XID parameters may be carried out in conjunction with the establishment or re-establishment procedure.) XID参数协商,也可以通过LL XID primitives。
1) Establishment of acknowledged peer-to-peer LLC operation
在激活PDP时,根据协商的QoS参数,如果LLC是确认模式,SNDCP就让LLC建链。
另外,在PDP参数修改时,比如QoS参数中LLC从非确认模式修改为确认模式,也需要发起LLC建链。
[attach]378[/attach]
图五 SNDCP发起的建立和重建
2) Re-establishment of the acknowledged peer-to-peer LLC operation
LLC也可以发起连接重建,比如出现错误等。
[attach]379[/attach]
图六 LLC发起的重建
3) Release of acknowledged peer-to-peer LLC operation
为某个SAPI用于确认模式,已经存在连接,在PDP去激活时,需释放。另外,QoS修改为非确认模式时,也释放。还有,LLC也可以发起连接释放。
4. N PDU buffering
在压缩分段传给LLC之前,N PDUs在SNDCP层缓存。
在PDP去激活时,根据NSAPI删除其缓存的N-PDUs。
对于确认模式,在该N-PDU的所有SN-PDUS都被确认后,缓存的N-PDUs才能被删除。
对于非确认模式,将所有SN-PDUS发送到LLC后,就删除。
5. Segmentation and reassembly
1) SN PDU Formats
Bit | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
Oct 1 | X | F | T | M | NSAPI | |||
2 | DCOMP | PCOMP | ||||||
3 | N‑DU number - acknowledged mode | |||||||
¼ | Data segment | |||||||
N |
|
SN DATA PDU format(确认模式)
Bit | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
Oct 1 | X | F | T | M | NSAPI | |||
2 | DCOMP | PCOMP | ||||||
3 | Segment number | N‑DU number - unacknowledged mode | ||||||
4 | N‑DU number - unacknowledged mode (continued) | |||||||
¼ | Data segment | |||||||
N |
|
SN UNITDATA PDU format(非确认模式)
其中各字段含义如下:
- More bit (M):
0 Last segment of N PDU.
1 Not the last segment of N PDU, more segments to follow.
- SN PDU Type (T):
0 SN DATA PDU.
1 SN UNITDATA PDU.
- First segment indicator bit (F):
0 This SN PDU is not the first segment of an N PDU.
The octet including DCOMP and PCOMP is not included in the SN DATA PDU or SN UNITDATA PDU format. Also the octet for N PDU number for acknowledged mode is not included in the SN DATA PDU format.
1 This SN PDU is the first segment of an N PDU. The octet for DCOMP and PCOMP is included in the SN DATA PDU or SN UNITDATA PDU format. Also the octet for N PDU number for acknowledged mode is included in the SN DATA PDU format.
- Spare bit (X):
0 Shall be set to 0 by the transmitting SNDCP entity and ignored by the receiving SNDCP entity.
- NSAPI:
0 Escape mechanism for future extensions.
1 Point-to-Multipoint Multicast (PTM-M) information.
2-4 Reserved for future use.
5-15 Dynamically allocated NSAPI value.
SN PDU with an unallocated NSAPI value shall be ignored by the receiving SNDCP entity without error notification.
- Data compression coding (DCOMP):
0 No compression.
1-14 Points to the data compression identifier negotiated dynamically.
15 Reserved for future extensions.
SN PDU with an unallocated DCOMP value shall be ignored by the receiving SNDCP entity without error notification.
- Protocol control information compression coding (PCOMP):
0 No compression.
1-14 Points to the protocol control information compression identifier negotiated dynamically (see subclause 6.5).
15 Reserved for future extensions.
SN PDU with an unallocated PCOMP value shall be ignored by the receiving SNDCP entity without error notification.
- Segment number:
0-15 Sequence number for segments carrying an N PDU.
- N PDU number - acknowledged mode:
0-255 N PDU number of the N PDU.
- N PDU number - unacknowledged mode:
0-4095 N PDU number of the N PDU.
2) Segmentation
分段就是将N-PDU分成SN-PDUs. SN-PDUs的长度,在确认模式下,S不超过N201-I;非确认模式下,不超过N201-U。其中N201-I和N201-U通过XID参数协商确定。
第一个分段的F字段为1,其它分段的F字段为0.
非确认模式下, 对于F为1的第一个分段,DCOMP 和PCOMP字段需填写。
确认模式下,对于F为1的第一个分段,DCOMP, PCOMP 和 N PDU number字段需填写。
最后一个分段的M字段为0,其它分段的M字段为1.
3) Reassembly
汇聚时,DCOMP 和PCOMP从第一个分段中获得,确认模式下,N PDU number也从第一个分段中获得。
接收的SNDCP实体,有以下3个状态:
- Receive First Segment state,等待接收F字段为1的第一个分段;
- Receive Subsequent Segment state,等待接收F为0的后续分段;
- Discard state,组合成N-PDU后,丢弃接收的SN-PDUs.
4) Segmentation and reassembly in acknowledged mode
确认模式是可靠传输,只有前面的分段确认后,才发送后面的字段。接收也一样。可以确保所有分段按先后顺序达到。在接收完毕后,直接组合为N-PDU即可。
5) Segmentation and reassembly in unacknowledged mode
非确认模式下,由于是不可靠传输,先发的未必先收到。还需引进Segment number,为N-PDU的每一个SN-PDU指定一个序列号,从0开始,依次递增。这样在接收后,按Segment number排序,然后组合成N-PDU.
- Receive First Segment state.
如果接收到F字段为0的分段,不是第一个分段,抛掉。接收完第一个分段后(F为1),获得DCOMP或者PCOMP,然后进入Receive Subsequent Segment 状态。
- Receive Subsequent Segment state.
如果再次收到F为1的第一个分段,并且DCOMP或者PCOMP不同,那么之前接收的同一个N-PDU的所有分段都抛掉。接收完N-PDU的最后一个分段(M为0)后,进入Receive First Segment状态。
6. XID parameter negotiation
XID参数包括数据压缩和解压缩的参数,以及SN-PDU的长度N201-I和N201-U。(N201是LLC层的最大payload长度,即I帧的信息帧的长度,类似于IP网络中MTU最大传输单元的作用)。
在数据传输前,需要调整XID参数时,先进行XID参数协商。
[attach]380[/attach]
图七 SNDCP XID协商流程
7. Data transfer
1) Acknowledged mode
The SNDCP entity shall initiate acknowledged data transmission only if the PDP context for the NSAPI identified in the SN DATA.request has been activated and if acknowledged LLC operation has been established.
确认模式下传输数据要求:NSAPI对应的PDP已经激活,并且确认模式的LLC连接已经建立。
上层应用在发数据时,通过SN DATA.request源语,将N-PDU number带下来。不同的NSAPI的N-PDU number是独立的。确认模式下,在分段时,将N-PDU number填在第一个分段的SNDCP头部。
对每一个NSAPI,都有Send N-PDU number和Receive N-PDU number. 在激活确认模式下的数据传输时(PDP激活和LLC建立),这两个N-PDU number都置为0.
SN DATA.request源语中如果没有带Send N-PDU number,就把当前的置作为N-PDU number,对数据进行压缩和分段发到LLC。然后Send N-PDU。number加1.
SN DATA.request源语中如果带了Send N-PDU number,就覆盖当前的值。
每发送一个N-PDU,Send N-PDU number加1;每接收一个N-PDU,Receive N-PDU number加1。
[attach]381[/attach]
图八 SNDCP确认模式数据传输
2) Unacknowledged mode
The SNDCP entity shall initiate unacknowledged data transmission only if the PDP context for the NSAPI identified in the SN DATA.request has been activated. The SNDCP entity may initiate unacknowledged data transmission even if the acknowledged peer-to-peer operation is not established for that NSAPI.
[attach]382[/attach]
图九 SNDCP非确认模式数据传输
[attach]890[/attach]
从图上可以看出。在解封装的时候,假设是MS发给SGSN,那假设SGSN来解封装。LLC层的SAPI寻址其实很简单,如果SAPI=3,则解封装交给SNDCP层处理,如果SAPI=1,则解封装交给GMM层处理(信令消息)。因此LLC层寻址并不区分用户。只是解封装后交给不同的协议栈处理。这就要求源端在封装数据包的时候,要封装好正确的SAPI值。因此MS侧在发送数据的时候,不管是cmwap还是cmnet,SAPI都是3。因为都是用户数据。只要是信令消息,不管是cmwap的激活还是cmnet的激活,就应该都是1了。
LLC层完成解封装后,交给SNDCP层去处理,这时候才会有NSAPI,也就是在SNDCP层才会和PDP上下文进行映射。LLC根据就不区分的。
[attach]938[/attach]
图例:SN-PDU两种模式的PDU格式
非常感谢您那么认真负责的回复!!!
不过我还有疑问:
在确认模式下N-PDU number只有第一个分片携带,其他分片都不携带。
(For acknowledged peer-to-peer LLC operation, DCOMP, PCOMP andN‑PDUnumber shall be included in the header when the F bit is set to 1, andshallnot be included when the F bit is set to 0.)
所以在同一个 NSAPI 下应该不会存在你所说的(但可能同一时刻有很多个N-PDU在发。所以接收端重组的时候需要知道收的这些segment,哪些是属于同一个N-PDU。就用N-PDU number来区分。)。
(不同的NSAPI之间 N-PDU number是独立的)。
我是新手,可能理解的不太正确。
ziseputi 发表于 2011-11-11 09:45
回复 爱卫生 的帖子
在确认模式下:除第一个分片外的其它分片都不携带N-PDU number。如果有多个N-PDU同时发 ...
[attach]940[/attach]
图1 Segmentation mechanism for unacknowledged transmission mode
[attach]939[/attach]
图2:Segmentation mechanism for acknowledged transmission mode
谢谢!不过不好意思没有完全理解,这里主要关注SNDCP层在接收端的重组功能(如果没有N-PDU字段的话)比如说用户同时访问新浪和网易,是属于同一个PDP(APN=cmnet),NSAPI一样,Qos也一样,都算背景类。那这时新浪发个图片给手机,要通过SNDCP分段成1、2、3,网易发个图片给手机分段成4、5、6,那手机收到了1和4,在本端如何重组交给LLC层处理呢(在没有N-PDU字段的情况下)?
另外,请问下,SNDCP层和Qos有关联吗?
欢迎光临 51学通信技术论坛 (http://51xuetongxin.com/bbs/) | Powered by Discuz! X2 |