#1443 assigned defect

PowerPC in_cksum() requires optimization

Reported by: dufault Owned by: Needs Funding
Priority: normal Milestone: Indefinite
Component: network/legacy Version: 4.10
Severity: normal Keywords:
Cc: ralf.corsepius@…, strauman@…, nbkolchin@…, sebastian.huber@… Blocked By:
Blocking:

Description (last modified by Sebastian Huber)

I had built with optimization off for debugging. Without optimization the in_cksum() in rtems/cpukit/libnetworking/netinet/in_cksum_powerpc.h is returning 1. With -O2 in effect it is returning 0.

I put a breakpoint after the call to in_cksum() (tcp_input.c:320) with the only change recompiling tcp_input.c with and without optimization.

Checksum with tcp_input.c compiled with -O2:
(gdb) print ti->ti_t.th_sum
$1 = 0x0
(gdb)

Checksum with tcp_input.c compiled without any optimization:
(gdb) print ti->ti_t.th_sum
$1 = 0x1
(gdb)

This is for the MPC5554, with the same compilation flags as for the MPC55xxevb. Here is what the compilation line is for in_cksum.c and tcp_input.c (with -O2 taken out and I added -DDEBUG=1):

powerpc-rtems4.10-gcc --pipe -DHAVE_CONFIG_H -I.. -I../../cpukit/../../../mpc5554som/lib/include -I../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking -DINET -DNFS -DDIAGNOSTIC -DBOOTP_COMPAT -D_KERNEL -DBSD_VISIBLE -Wall -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -fasm -mcpu=8540 -meabi -msdata -fno-common -msoft-float -DDEBUG=1 -Dppc_generic -mstrict-align -g -fno-keep-inline-functions -MT netinet/libnetworking_a-in_cksum.o -MD -MP -MF netinet/.deps/libnetworking_a-in_cksum.Tpo -c -o netinet/libnetworking_a-in_cksum.o test -f 'netinet/in_cksum.c' || echo '../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking/'netinet/in_cksum.c

powerpc-rtems4.10-gcc --pipe -DHAVE_CONFIG_H -I.. -I../../cpukit/../../../mpc5554som/lib/include -I../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking -DINET -DNFS -DDIAGNOSTIC -DBOOTP_COMPAT -D_KERNEL -DBSD_VISIBLE -Wall -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -fasm -mcpu=8540 -meabi -msdata -fno-common -msoft-float -DDEBUG=1 -Dppc_generic -mstrict-align -g -fno-keep-inline-functions -MT netinet/libnetworking_a-tcp_input.o -MD -MP -MF netinet/.deps/libnetworking_a-tcp_input.Tpo -c -o netinet/libnetworking_a-tcp_input.o test -f 'netinet/tcp_input.c' || echo '../../../../../../rtems-4.9.99.0/c/src/../../cpukit/libnetworking/'netinet/tcp_input.c

Attachments (3)

in_cksum_powerpc.h (5.9 KB) - added by dufault on Feb 19, 2010 at 10:57:27 AM.
Header file derived from netbsd.
in_cksum_powerpc_v1.h (5.9 KB) - added by Sebastian Huber on Sep 1, 2011 at 6:52:42 AM.
Header file derived from current FreeBSD
in_cksum_powerpc.h.freebsd (5.7 KB) - added by Sebastian Huber on Sep 1, 2011 at 11:45:30 AM.
Header file derived from current FreeBSD

Download all attachments as: .zip

Change History (15)

comment:1 Changed on Sep 29, 2009 at 6:17:06 AM by Nickolay Semyonov-Kolchin

Cc: Nickolay Semyonov-Kolchin added

Changed on Feb 19, 2010 at 10:57:27 AM by dufault

Attachment: in_cksum_powerpc.h added

Header file derived from netbsd.

comment:2 Changed on Aug 31, 2011 at 6:54:04 AM by Sebastian Huber

Cc: Sebastian Huber added

comment:3 Changed on Aug 31, 2011 at 6:54:41 AM by Sebastian Huber

Cc: strauman added

comment:4 Changed on Aug 31, 2011 at 11:49:35 AM by Ralf Corsepius

Cc: Ralf Corsepius added

Changed on Sep 1, 2011 at 6:52:42 AM by Sebastian Huber

Attachment: in_cksum_powerpc_v1.h added

Header file derived from current FreeBSD

Changed on Sep 1, 2011 at 11:45:30 AM by Sebastian Huber

Attachment: in_cksum_powerpc.h.freebsd added

Header file derived from current FreeBSD

comment:5 Changed on Sep 1, 2011 at 11:45:30 AM by Sebastian Huber

attachments.isobsolete: 01

Oh, sorry. I added the wrong file.

comment:6 Changed on Sep 1, 2011 at 11:46:19 AM by Sebastian Huber

attachments.mimetype: application/octet-streamtext/plain

comment:7 Changed on Nov 22, 2014 at 1:39:38 PM by Gedare

Description: modified (diff)
Milestone: 4.104.10.3

Is this fixed?

comment:8 Changed on Nov 22, 2014 at 2:25:56 PM by Gedare

Owner: changed from Eric Norum to Joel Sherrill
Status: newassigned

comment:9 Changed on Nov 22, 2014 at 4:08:15 PM by Joel Sherrill

Owner: changed from Joel Sherrill to Sebastian Huber

Sebastian .. I think you never merged this patch. Could you check and merged on 4.10 and the head.

comment:10 Changed on Nov 28, 2014 at 1:38:05 PM by Sebastian Huber

It is not fixed. If we change the in_cksum() implementation, then we must do some performance tests, since this function is performance critical. A quick and dirty hack would be to use the default C implementation in case OPTIMIZE is not defined.

comment:11 Changed on Feb 18, 2015 at 2:37:38 PM by Sebastian Huber

Description: modified (diff)
Owner: Sebastian Huber deleted
Status: assignednew

comment:12 Changed on Jan 23, 2017 at 1:45:50 PM by Sebastian Huber

Milestone: 4.10.3Indefinite
Owner: set to Needs Funding
Status: newassigned
Note: See TracTickets for help on using tickets.