Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#1964 closed enhancement (fixed)

QoS for darwin OS which supports SO_NET_SERVICE_TYPE

Reported by: riza Owned by: bennylp
Priority: normal Milestone: release-2.6
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description

The latest XNU kernel, shipped with iOS 10, Mac OS 10.11, AppleTV OS 10, etc. supports a new socket option, SO_NET_SERVICE_TYPE, a high level API for configuring a socket's QoS, which the OS will appropriately and transparently map to a DSCP or WMM priority depending on the network connection.

This patch introduces a new implementation of the socket QoS functions specifically for the Darwin platform, that makes use of SO_NET_SERVICE_TYPE when available, and falls back to IP_TOS/IPV6_TCLASS elsewhere.

Changes introduced by this patch:

  • build system and configuration script changes, so that the BSD sockets implementation of QoS is no longer the default on all platforms, but only on non-Darwin platforms. On Darwin platforms, the new Darwin-specific QoS implementation is used instead
  • new PJ_QOS_TYPE_SIGNALLING in pj_qos_type which corresponds to NET_SERVICE_TYPE_SIG
  • new PJLIB constant OSERR_ENOPROTOOPT, that maps to ENOPROTOOPT (WSAENOPROTOOPT for Winsock)
  • new configuration constant PJ_QOS_DARWIN, that can be used as the value of PJ_QOS_IMPLEMENTATION
  • new, Darwin-specific implementations of pj_sock_set_qos_params, pj_sock_set_qos_type, pj_sock_get_qos_params and pj_sock_get_qos_type, based on SO_NET_SERVICE_TYPE, and falling back to IP_TOS/IPV6_TCLASS

Backwards/forwards compatibility considerations:
on older Darwin platforms, the SDK doesn't define SO_NET_SERVICE_TYPE, and QoS functions always use IP_TOS/IPV6_TCLASS instead. Running code compiled with an old SDK on a new operating system has the same behavior as it had before, and like before with the caveat that, at some point in the future, the OS may start ignoring the value set with IP_TOS/IPV6_TCLASS
on newer Darwin platforms, SO_NET_SERVICE_TYPE is always used.

Running code compiled with a new SDK on an old operating system makes attempts to get/set SO_NET_SERVICE_TYPE fail with ENOPROTOOPT, which the QoS function translate to PJ_ENOTSUP, which is handled with a runtime fallback on the old IP_TOS/IPV6_TCLASS code.

For future reference, mapping of pj_qos_type might be changed according to the new standard. Please have a look at the draft: https://tools.ietf.org/html/draft-ietf-tsvwg-ieee-802-11-00

Thanks to Michele Cicciotti for the patch.

Change History (4)

comment:1 Changed 8 years ago by riza

In r5445:

Re #1964: Implement QoS for darwin OS which supports SO_NET_SERVICE_TYPE.

comment:2 Changed 8 years ago by riza

In 5448:

Re #1964: Add PJ_QOS_TYPE_SIGNALLING to pjsua2 swig symbol and the deprecated pjsua python module.

comment:3 Changed 8 years ago by riza

  • Resolution set to fixed
  • Status changed from new to closed

comment:4 Changed 8 years ago by nanang

In 5549:

Re #1964: Fixed QoS build config for mingw32/msys.

Note: See TracTickets for help on using tickets.