Changes between Initial Version and Version 1 of QoS


Ignore:
Timestamp:
Oct 28, 2009 11:45:02 PM (13 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • QoS

    v1 v1  
     1{{{ 
     2#!html 
     3<!-- MAIN TABLE START --> 
     4<table border=0 width="90%" align="center"><tr><td> 
     5}}} 
     6 
     7= Support for QoS (TOS/DSCP, WMM, 802.1p) = 
     8 
     9'''Table of Contents''' 
     10[[PageOutline(2-3,,inline)]] 
     11 
     12This article describes the QoS support in PJSIP and how to use it. 
     13 
     14[[BR]] 
     15 
     16== Introduction on QoS == 
     17 
     18QoS settings are available for both Layer 2 and Layer 3 of TCP/IP protocols: 
     19 
     20=== Layer 2: IEEE 802.1p for Ethernet === 
     21 
     22IEEE 802.1p tagging will mark frames sent by a host for prioritized delivery using a 3-bit Priority field in the virtual local area network (VLAN) header of the Ethernet frame. The VLAN header is placed inside the Ethernet header, between the Source Address field and either the Length field (for an IEEE 802.3 frame) or the !EtherType field (for an Ethernet II frame). 
     23 
     24=== Layer 2: WMM === 
     25 
     26At the Network Interface layer for IEEE 802.11 wireless, the Wi-Fi Alliance certification for Wi-Fi Multimedia (WMM) defines four access categories for prioritizing network traffic. These access categories are (in order of highest to lowest priority) voice, video, best-effort, and background. Host support for WMM prioritization requires that both wireless network adapters and their drivers support WMM. Wireless access points (APs) must have WMM enabled. 
     27 
     28=== Layer 3: DSCP === 
     29 
     30At the Internet layer, you can use Differentiated Services/Diffserv and set the value of the Differentiated Services Code Point (DSCP) in the IP header. As defined in RFC 2472, the DSCP value is the high-order 6 bits of the IP version 4 (IPv4) TOS field and the IP version 6 (IPv6) Traffic Class field. 
     31 
     32=== Layer 3: Other === 
     33 
     34Other mechanisms exist (such as RSVP, !IntServ) but this will not be implemented. 
     35 
     36 
     37== Availability == 
     38 
     39=== Linux === 
     40 
     41DSCP is available via IP TOS option.  
     42 
     43Ethernet 802.1p tagging is done by setting {{{setsockopt(SO_PRIORITY)}}} option of the socket, then with the {{{set_egress_map option}}} of the {{{vconfig utility}}} to convert this to set vlan-qos field of the packet.  
     44 
     45WMM is not known to be available. 
     46 
     47=== MacOS X === 
     48 
     49DSCP is available via IP TOS option.  
     50 
     51=== Windows and Windows Mobile === 
     52 
     53(It's a mess!) 
     54 
     55DSCP is settable with {{{setsockopt()}}} on Windows 2000 or older, but Windows would silently ignore this call on WinXP or later, unless administrator modifies the registry. On Windows 2000, Windows XP, and Windows Server 2003, GQoS (Generic QoS) API is the standard API, but this API may not be supported in the future. On Vista and Windows 7, the is a new QoS2 API, also known as Quality Windows Audio-Video Experience (qWAVE). 
     56 
     57IEEE 802.1p tagging is available via Traffic Control (TC) API, available on Windows XP SP2, but this needs administrator access. For Vista and later, it's in qWAVE.  
     58 
     59WMM is available for mobile platforms on Windows Mobile 6 platform and Windows Embedded CE 6, via {{{setsockopt(IP_DSCP_TRAFFIC_TYPE)}}}. qWAVE supports this as well. 
     60 
     61=== Symbian S60 3rd Ed === 
     62 
     63Both DSCP and WMM is supported via {{{RSocket::SetOpt()}}} with will set both Layer 2 and Layer 3 QoS settings accordingly. 
     64 
     65 
     66== Objective == 
     67 
     68The objective of this ticket is to add new API to PJLIB socket API to enable manipulation of the QoS parameters above in a uniform and portable manner. 
     69 
     70 
     71== Design == 
     72 
     73Based on the above, the following API is proposed. 
     74 
     75Declare the following "standard" traffic types. 
     76 
     77 {{{ 
     78 typedef enum pj_qos_type 
     79 { 
     80    PJ_QOS_TYPE_BEST_EFFORT, 
     81    PJ_QOS_TYPE_BACKGROUND, 
     82    PJ_QOS_TYPE_VIDEO, 
     83    PJ_QOS_TYPE_VOICE, 
     84    PJ_QOS_TYPE_CONTROL 
     85 } pj_qos_type; 
     86 }}} 
     87 
     88The traffic classes above will determine how the Layer 2 and 3 QoS settings will be used. The standard mapping between the classes above to the corresponding Layer 2 and 3 settings are as follows: 
     89 
     90 || PJLIB Traffic Type    || IP DSCP || WMM || 802.1p  || 
     91 || BEST_EFFORT || 0x00    || BE (Bulk Effort) ||   0    || 
     92 || BACKGROUND  || 0x08    || BK (Bulk)  ||   2    || 
     93 || VIDEO       || 0x28    || VI (Video)   ||   5    || 
     94 || VOICE       || 0x30    || VO (Voice)   ||   6    || 
     95 || CONTROL     || 0x38    || VO (Voice)   ||   7    || 
     96 
     97There are two sets of API provided to manipulate the QoS parameters.  
     98 
     99=== Portable High Level API === 
     100 
     101The first set of API is: 
     102 
     103 {{{ 
     104 // Set QoS parameters 
     105 PJ_DECL(pj_status_t) pj_sock_set_qos_type(pj_sock_t sock, 
     106                                           pj_qos_type val); 
     107 
     108 // Get QoS parameters 
     109 PJ_DECL(pj_status_t) pj_sock_get_qos_type(pj_sock_t sock, 
     110                                           pj_qos_type *p_val); 
     111 }}} 
     112 
     113The API will set the traffic type according to the DSCP class, for '''both''' Layer 2 and Layer 3 QoS settings, where it's available. If any of the layer QoS setting is not settable, the API will silently ignore it. If '''both''' layers are not setable, the API will return error. 
     114 
     115The API above is the recommended use of QoS, since it is the most portable across all platforms. 
     116 
     117=== Fine Grained Control API === 
     118 
     119The second set of API is intended for application that wants to fine tune the QoS parameters. 
     120 
     121The Layer 2 and 3 QoS parameters are stored in {{{pj_qos_params}}} structure: 
     122 
     123 {{{ 
     124 typedef enum pj_qos_flag 
     125 { 
     126    PJ_QOS_PARAM_HAS_DSCP = 1, 
     127    PJ_QOS_PARAM_HAS_802_1_P = 2, 
     128    PJ_QOS_PARAM_HAS_WMM = 4 
     129 } pj_qos_flag; 
     130 
     131 typedef enum pj_qos_wmm_prio 
     132 { 
     133    PJ_QOS_WMM_TYPE_BULK_EFFORT_PRIO, 
     134    PJ_QOS_WMM_TYPE_BULK_PRIO, 
     135    PJ_QOS_WMM_TYPE_VIDEO_PRIO, 
     136    PJ_QOS_WMM_TYPE_VOICE_PRIO 
     137 } pj_qos_wmm_prio; 
     138 
     139 typedef struct pj_qos_params 
     140 { 
     141    pj_uint8_t      flags;    // Determines which values to  
     142                              // set, bitmask of pj_qos_flag 
     143    pj_uint8_t      dscp_val; // DSCP value to set 
     144    pj_uint8_t      so_prio;  // SO_PRIORITY value 
     145    pj_qos_wmm_prio wmm_prio; // WMM priority value 
     146 } pj_qos_params; 
     147 }}} 
     148 
     149The second set of API with more fine-grained control over the parameters are: 
     150 
     151 {{{ 
     152 // Retrieve QoS params for the specified traffic type 
     153 PJ_DECL(pj_status_t) pj_qos_get_params(pj_qos_type type,  
     154                                        pj_qos_params *p); 
     155 
     156 // Set QoS parameters to the socket 
     157 PJ_DECL(pj_status_t) pj_sock_set_qos_params(pj_sock_t sock, 
     158                                             const pj_qos_params *p); 
     159 
     160 // Get QoS parameters from the socket 
     161 PJ_DECL(pj_status_t) pj_sock_get_qos_params(pj_sock_t sock, 
     162                                             pj_qos_params *p); 
     163 
     164 }}} 
     165 
     166 '''Important:''' 
     167  
     168 The {{{pj_sock_set/get_qos_params()}}} APIs are not portable, and it's probably only going to be implemented on Linux. Application should always try to use {{{pj_sock_set_qos_type()}}} instead. 
     169 
     170 
     171 
     172== Limitations == 
     173 
     174Win32 may not be implemented due to the API mess above. 
     175 
     176== References == 
     177 
     178 1. [http://technet.microsoft.com/en-gb/magazine/2007.02.cableguy.aspx QoS Support in Windows] - good intro for QoS on Windows and in general 
     179 2. [http://msdn.microsoft.com/en-us/library/aa916767.aspx WMM (Wi-Fi Multimedia)] (Windows Mobile 6) 
     180 3. [http://wiki.forum.nokia.com/index.php/VoIP_developer_guidelines_for_S60 VoIP developer guidelines for S60] 
     181 4. [http://blogs.msdn.com/wndp/archive/2006/06/30/WiFi_QoS_Support_in_Windows_Vista_part_2.aspx WiFi QoS Support in Windows Vista: WMM part 2] 
     182 
     183 
     184 
     185{{{ 
     186#!html 
     187<!-- MAIN TABLE END --> 
     188</td></tr></table> 
     189}}} 
     190