#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:

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

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

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- -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-'netinet/in_cksum.c

powerpc-rtems4.10-gcc --pipe -DHAVE_CONFIG_H -I.. -I../../cpukit/../../../mpc5554som/lib/include -I../../../../../../rtems- -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-'netinet/tcp_input.c

Attachments (3)

in_cksum_powerpc.h (5.9 KB) - added by dufault on 02/19/10 at 10:57:27.
Header file derived from netbsd.
in_cksum_powerpc_v1.h (5.9 KB) - added by Sebastian Huber on 09/01/11 at 06:52:42.
Header file derived from current FreeBSD
in_cksum_powerpc.h.freebsd (5.7 KB) - added by Sebastian Huber on 09/01/11 at 11:45:30.
Header file derived from current FreeBSD

Download all attachments as: .zip

Change History (15)

comment:1 Changed on 09/29/09 at 06:17:06 by Nickolay Semyonov-Kolchin

Cc: Nickolay Semyonov-Kolchin added

Changed on 02/19/10 at 10:57:27 by dufault

Attachment: in_cksum_powerpc.h added

Header file derived from netbsd.

comment:2 Changed on 08/31/11 at 06:54:04 by Sebastian Huber

Cc: Sebastian Huber added

comment:3 Changed on 08/31/11 at 06:54:41 by Sebastian Huber

Cc: strauman added

comment:4 Changed on 08/31/11 at 11:49:35 by Ralf Corsepius

Cc: Ralf Corsepius added

Changed on 09/01/11 at 06:52:42 by Sebastian Huber

Attachment: in_cksum_powerpc_v1.h added

Header file derived from current FreeBSD

Changed on 09/01/11 at 11:45:30 by Sebastian Huber

Attachment: in_cksum_powerpc.h.freebsd added

Header file derived from current FreeBSD

comment:5 Changed on 09/01/11 at 11:45:30 by Sebastian Huber

attachments.isobsolete: 01

Oh, sorry. I added the wrong file.

comment:6 Changed on 09/01/11 at 11:46:19 by Sebastian Huber

attachments.mimetype: application/octet-streamtext/plain

comment:7 Changed on 11/22/14 at 13:39:38 by Gedare Bloom

Description: modified (diff)

Is this fixed?

comment:8 Changed on 11/22/14 at 14:25:56 by Gedare Bloom

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

comment:9 Changed on 11/22/14 at 16:08:15 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 11/28/14 at 13:38:05 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 02/18/15 at 14:37:38 by Sebastian Huber

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

comment:12 Changed on 01/23/17 at 13:45:50 by Sebastian Huber

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