Stop Sending UDP Checksum from compressor end

Asked by Mohammad Abyan Abdullah

Hi!!
  Didier is it possible I can stop sending UDP checksum from compressor end and we can recalculate at decompressor the checksum again and add it again ? This way I think we can save few bits when we are not sending the checksum bit. Asterisk can do this by using
setsockopt(s, SOL_SOCKET, SO_NO_CHECK, &nochecksums, sizeof(nochecksums)). for each rtp ports.

But no other software has that feature available. At rfc also says

The LLA profile is obviously not applicable if the UDP checksum (2
   bytes) is enabled, which is always the case for IPv6/UDP. For
   IPv4/UDP, the sender may choose to disable the UDP checksum.

So if its possible it might save us few bits. What you think ?

Regards
Abyan

Question information

Language:
English Edit question
Status:
Solved
For:
rohc Edit question
Assignee:
No assignee Edit question
Solved by:
Mohammad Abyan Abdullah
Solved:
Last query:
Last reply:
Revision history for this message
Mohammad Abyan Abdullah (c-admin-v) said :
#1

Didier
   My point is like this packet with udp_code_uo_remainder()

[general] [rohc_comp.c:608 rohc_compress4()] compress the packet #1656
 [profile ID 1] [c_rtp.c:1341 rtp_changed_rtp_dynamic()] find changes in RTP dynamic fields
 [profile ID 1] [c_rtp.c:1498 rtp_changed_rtp_dynamic()] 0 RTP dynamic fields changed
 [profile ID 1] [rohc_comp_rfc3095.c:1241 rohc_comp_rfc3095_detect_changes()] SN = 52100
 [profile ID 1] [rohc_comp_rfc3095.c:6563 detect_ip_id_behaviour()] 1) old_id = 0x0f98 new_id = 0x0fa3
 [profile ID 1] [rohc_comp_rfc3095.c:6576 detect_ip_id_behaviour()] IP-ID is increasing in NBO
 [profile ID 1] [rohc_comp_rfc3095.c:6610 detect_ip_id_behaviour()] NBO = 1, RND = 0, SID = 0
 [profile ID 1] [rohc_comp_rfc3095.c:6186 changed_dynamic_both_hdr()] check for changed fields in the outer IP header
 [profile ID 1] [rohc_comp_rfc3095.c:1303 rohc_comp_rfc3095_detect_changes()] send_static = 0, send_dynamic = 0
 [profile ID 1] [rohc_comp_rfc3095.c:1428 rohc_comp_rfc3095_decide_state()] no STATIC nor DYNAMIC field changed in the last few packets, so stay in SO state
 [profile ID 1] [rohc_comp_rfc3095.c:6639 encode_uncomp_fields()] compressor is in state 3
 [profile ID 1] [rohc_comp_rfc3095.c:6644 encode_uncomp_fields()] new SN = 52100 / 0xcb84
 [profile ID 1] [rohc_comp_rfc3095.c:6665 encode_uncomp_fields()] SN cannot be encoded with 5 bits in a field smaller than or equal to 4 bits
 [profile ID 1] [rohc_comp_rfc3095.c:6669 encode_uncomp_fields()] SN can be encoded with 5 bits in a field strictly larger than 4 bits
 [profile ID 1] [rohc_comp_rfc3095.c:6690 encode_uncomp_fields()] new outer IP-ID delta = 0x441f / 17439 (NBO = 1, RND = 0, SID = 0)
 [profile ID 1] [rohc_comp_rfc3095.c:6708 encode_uncomp_fields()] 8 bits are required to encode new outer IP-ID delta
 [general] [comp_scaled_rtp_ts.c:136 c_add_ts()] Timestamp = 107800
 [general] [comp_scaled_rtp_ts.c:168 c_add_ts()] SN delta = 1
 [general] [comp_scaled_rtp_ts.c:180 c_add_ts()] TS delta = 160
 [general] [comp_scaled_rtp_ts.c:241 c_add_ts()] state SEND_SCALED
 [general] [comp_scaled_rtp_ts.c:244 c_add_ts()] TS_STRIDE calculated = 160
 [general] [comp_scaled_rtp_ts.c:245 c_add_ts()] previous TS_STRIDE = 160
 [general] [comp_scaled_rtp_ts.c:284 c_add_ts()] TS_STRIDE = 160
 [general] [comp_scaled_rtp_ts.c:290 c_add_ts()] TS_OFFSET = 107800 modulo 160 = 120
 [general] [comp_scaled_rtp_ts.c:296 c_add_ts()] TS_SCALED = (107800 - 120) / 160 = 673
 [general] [comp_scaled_rtp_ts.c:339 c_add_ts()] TS can be deducted from SN (old TS_SCALED = 672, new TS_SCALED = 673, old SN = 52099, new SN = 52100)
 [profile ID 1] [c_rtp.c:1067 rtp_encode_uncomp_fields()] TS_SCALED = 673 on 8/2 bits or 8/32 bits
 [profile ID 1] [c_rtp.c:1074 rtp_encode_uncomp_fields()] 0 (TS is deducible from SN bits) or 8/2 bits or 8/32 bits are required to encode new TS
 [profile ID 1] [rohc_comp_rfc3095.c:1489 decide_packet()] decide packet in SO state
 [profile ID 1] [c_rtp.c:624 c_rtp_decide_SO_packet()] nr_ip_bits = 8, is_ts_deducible = 1, is_ts_scaled = 1, Marker bit = 0, nr_of_ip_hdr = 1, rnd = 0
 [profile ID 1] [c_rtp.c:675 c_rtp_decide_SO_packet()] nr_ipv4_non_rnd = 1, nr_ipv4_non_rnd_with_bits = 1
 [profile ID 1] [c_rtp.c:764 c_rtp_decide_SO_packet()] choose packet UO-1-ID because at least one of the 1 IP header(s) is IPv4 with non-random IP-ID with at least 1 bit of IP-ID to transmit, less than 12 SN bits must be transmitted, and 8 TS bits can be SDVL-encoded
 [profile ID 1] [rohc_comp_rfc3095.c:1512 decide_packet()] packet 'RTP/UO-1-ID' chosen
 [profile ID 1] [rohc_comp_rfc3095.c:3171 rohc_comp_rfc3095_build_uo1id_pkt()] code UO-1-ID packet (CID = 17)
 [profile ID 1] [rohc_comp_rfc3095.c:3218 rohc_comp_rfc3095_build_uo1id_pkt()] large CID 17 encoded on 1 byte(s)
 [profile ID 1] [rohc_comp_rfc3095.c:3234 rohc_comp_rfc3095_build_uo1id_pkt()] extension 'EXT-0' chosen
 [profile ID 1] [rohc_comp_rfc3095.c:3259 rohc_comp_rfc3095_build_uo1id_pkt()] 5 bits of 8-bit innermost non-random IP-ID = 0x3
 [profile ID 1] [rohc_comp_rfc3095.c:3342 rohc_comp_rfc3095_build_uo1id_pkt()] 1 0 + T = 0 + TS/IP-ID = 0x83
 [profile ID 1] [rohc_comp_rfc3095.c:3372 rohc_comp_rfc3095_build_uo1id_pkt()] 4 bits of 7-bit SN = 0x0
 [profile ID 1] [rohc_comp_rfc3095.c:3420 rohc_comp_rfc3095_build_uo1id_pkt()] X (1) + SN (0) + CRC (0x3) = 0x83
 [profile ID 1] [c_udp.c:444 udp_code_uo_remainder()] UDP checksum = 0xa135
 [general] [rohc_comp.c:736 rohc_compress4()] copy full 20-byte payload
 [general] [rohc_comp.c:746 rohc_compress4()] ROHC size = 26 bytes (header = 6, payload = 20), output buffer size = 1351

and without udp_code_uo_remainder()

[profile ID 1] [c_rtp.c:1344 rtp_changed_rtp_dynamic()] find changes in RTP dynamic fields
[profile ID 1] [c_rtp.c:1501 rtp_changed_rtp_dynamic()] 0 RTP dynamic fields changed
[profile ID 1] [rohc_comp_rfc3095.c:1241 rohc_comp_rfc3095_detect_changes()] SN = 52008
[profile ID 1] [rohc_comp_rfc3095.c:6563 detect_ip_id_behaviour()] 1) old_id = 0x211e new_id = 0x2122
[profile ID 1] [rohc_comp_rfc3095.c:6576 detect_ip_id_behaviour()] IP-ID is increasing in NBO
[profile ID 1] [rohc_comp_rfc3095.c:6610 detect_ip_id_behaviour()] NBO = 1, RND = 0, SID = 0
[profile ID 1] [rohc_comp_rfc3095.c:6186 changed_dynamic_both_hdr()] check for changed fields in the outer IP header
[profile ID 1] [rohc_comp_rfc3095.c:1303 rohc_comp_rfc3095_detect_changes()] send_static = 0, send_dynamic = 0
[profile ID 1] [rohc_comp_rfc3095.c:1428 rohc_comp_rfc3095_decide_state()] no STATIC nor DYNAMIC field changed in the last few packets, so stay in SO state
[profile ID 1] [rohc_comp.c:2663 rohc_comp_periodic_down_transition()] CID 4: timeouts for periodic refreshes: FO = 240 / 300, IR = 245 / 800
[profile ID 1] [rohc_comp_rfc3095.c:6639 encode_uncomp_fields()] compressor is in state 3
[profile ID 1] [rohc_comp_rfc3095.c:6644 encode_uncomp_fields()] new SN = 52008 / 0xcb28
[profile ID 1] [rohc_comp_rfc3095.c:6665 encode_uncomp_fields()] SN cannot be encoded with 5 bits in a field smaller than or equal to 4 bits
[profile ID 1] [rohc_comp_rfc3095.c:6669 encode_uncomp_fields()] SN can be encoded with 5 bits in a field strictly larger than 4 bits
[profile ID 1] [rohc_comp_rfc3095.c:6690 encode_uncomp_fields()] new outer IP-ID delta = 0x55fa / 22010 (NBO = 1, RND = 0, SID = 0)
[profile ID 1] [rohc_comp_rfc3095.c:6708 encode_uncomp_fields()] 6 bits are required to encode new outer IP-ID delta
[general] [comp_scaled_rtp_ts.c:136 c_add_ts()] Timestamp = 67416
[general] [comp_scaled_rtp_ts.c:168 c_add_ts()] SN delta = 1
[general] [comp_scaled_rtp_ts.c:180 c_add_ts()] TS delta = 160
[general] [comp_scaled_rtp_ts.c:241 c_add_ts()] state SEND_SCALED
[general] [comp_scaled_rtp_ts.c:244 c_add_ts()] TS_STRIDE calculated = 160
[general] [comp_scaled_rtp_ts.c:245 c_add_ts()] previous TS_STRIDE = 160
[general] [comp_scaled_rtp_ts.c:284 c_add_ts()] TS_STRIDE = 160
[general] [comp_scaled_rtp_ts.c:290 c_add_ts()] TS_OFFSET = 67416 modulo 160 = 56
[general] [comp_scaled_rtp_ts.c:296 c_add_ts()] TS_SCALED = (67416 - 56) / 160 = 421
[general] [comp_scaled_rtp_ts.c:339 c_add_ts()] TS can be deducted from SN (old TS_SCALED = 420, new TS_SCALED = 421, old SN = 52007, new SN = 52008)
[profile ID 1] [c_rtp.c:1069 rtp_encode_uncomp_fields()] TS_SCALED = 421 on 5/2 bits or 6/32 bits
[profile ID 1] [c_rtp.c:1076 rtp_encode_uncomp_fields()] 0 (TS is deducible from SN bits) or 5/2 bits or 6/32 bits are required to encode new TS
[profile ID 1] [rohc_comp_rfc3095.c:1489 decide_packet()] decide packet in SO state
[profile ID 1] [c_rtp.c:625 c_rtp_decide_SO_packet()] nr_ip_bits = 6, is_ts_deducible = 1, is_ts_scaled = 1, Marker bit = 0, nr_of_ip_hdr = 1, rnd = 0
[profile ID 1] [c_rtp.c:676 c_rtp_decide_SO_packet()] nr_ipv4_non_rnd = 1, nr_ipv4_non_rnd_with_bits = 1
[profile ID 1] [c_rtp.c:766 c_rtp_decide_SO_packet()] choose packet UO-1-ID because at least one of the 1 IP header(s) is IPv4 with non-random IP-ID with at least 1 bit of IP-ID to transmit, less than 12 SN bits must be transmitted, and 6 TS bits can be SDVL-encoded
[profile ID 1] [rohc_comp_rfc3095.c:1512 decide_packet()] packet 'RTP/UO-1-ID' chosen
[profile ID 1] [rohc_comp_rfc3095.c:3171 rohc_comp_rfc3095_build_uo1id_pkt()] code UO-1-ID packet (CID = 4)
[profile ID 1] [rohc_comp_rfc3095.c:3218 rohc_comp_rfc3095_build_uo1id_pkt()] large CID 4 encoded on 1 byte(s)
[profile ID 1] [rohc_comp_rfc3095.c:3234 rohc_comp_rfc3095_build_uo1id_pkt()] extension 'EXT-0' chosen
[profile ID 1] [rohc_comp_rfc3095.c:3259 rohc_comp_rfc3095_build_uo1id_pkt()] 5 bits of 8-bit innermost non-random IP-ID = 0x1f
[profile ID 1] [rohc_comp_rfc3095.c:3342 rohc_comp_rfc3095_build_uo1id_pkt()] 1 0 + T = 0 + TS/IP-ID = 0x9f
[profile ID 1] [rohc_comp_rfc3095.c:3372 rohc_comp_rfc3095_build_uo1id_pkt()] 4 bits of 7-bit SN = 0x5
[profile ID 1] [rohc_comp_rfc3095.c:3420 rohc_comp_rfc3095_build_uo1id_pkt()] X (1) + SN (5) + CRC (0x4) = 0xac
[general] [rohc_comp.c:736 rohc_compress4()] copy full 20-byte payload
[general] [rohc_comp.c:746 rohc_compress4()] ROHC size = 24 bytes (header = 4, payload = 20), output buffer size = 1351

we can save 2 Bytes per packet. Even at each UDP Checksum change detection Packet has to go on FO state most of the time and at time Packet size increases to 31 bytes too even large.

 And also as if RFC says'

https://tools.ietf.org/html/rfc3095#appendix-A.2.4

The UDP checksum is optional. If disabled, its value is constantly
   zero and could be compressed away. If enabled, its value depends on
   the payload, which for compression purposes is equivalent to it
   changing randomly with every packet.

UDP checksum is optional for client to send. For better compression we might omit the value for checksum at Compressor and we can regenerate it at decompressor. At that way we might save more bytes. Plzz let me know if it's feasible or not. I've checked the library which doesn't allow to omit the UDP Checksum and also protected by the CRC so which is not easy too. I just have an idea and shared with you my thoughts plzz let me know is it Ok or Not.

Regards
Abyan

Revision history for this message
Didier Barvaux (didier-barvaux) said :
#2

Hello,

Yes, this is possible:
* in your application that uses the ROHC compressor:
     * erase the UDP checksum by 0x0000
     * compress the packet with the zero UDP checksum
     * send the ROHC packet on the network
* in your application that uses the ROHC decompressor:
     * receive the ROHC packet
     * decompress the ROHC packet
     * either compute the UDP checksum again or simply leave the zero UDP checksum alone (UDP checksums are optional)

Regards,
Didier

Revision history for this message
Mohammad Abyan Abdullah (c-admin-v) said :
#3

Hi!!
   Didier thanks for the answer. Can you plzz give me a hint how can assign it at Compressor side ? Cause I've tried to assign it but all I got error, it's a read-only value can't modify. If I can reproduce the checksum at decompressor side that would be great but first I wanna try the checksum by 0x0000 then see if any error found at other end.

Regards
Abyan

Revision history for this message
Mohammad Abyan Abdullah (c-admin-v) said :
#4

Ok.
   Thanks for the advice. I've implemented on the tunnel to stop sending the checksum and decompressor successfully decompress the packet with almost 1-2% better compression gain than before.

Regards
Abyan