From patchwork Thu Jan 22 22:36:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlad Yasevich X-Patchwork-Id: 19910 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id DD745DDF2A for ; Fri, 23 Jan 2009 09:36:21 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759216AbZAVWgR (ORCPT ); Thu, 22 Jan 2009 17:36:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759036AbZAVWgM (ORCPT ); Thu, 22 Jan 2009 17:36:12 -0500 Received: from g4t0014.houston.hp.com ([15.201.24.17]:10183 "EHLO g4t0014.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758633AbZAVWgL (ORCPT ); Thu, 22 Jan 2009 17:36:11 -0500 Received: from smtp1.fc.hp.com (smtp.cnd.hp.com [15.15.136.127]) by g4t0014.houston.hp.com (Postfix) with ESMTP id 9CB5424149; Thu, 22 Jan 2009 22:36:10 +0000 (UTC) Received: from localhost.localdomain (squirrel.fc.hp.com [15.11.146.57]) by smtp1.fc.hp.com (Postfix) with ESMTP id 6E33C24DCED; Thu, 22 Jan 2009 22:11:58 +0000 (UTC) From: Vlad Yasevich To: netdev@vger.kernel.org Cc: linux-sctp@vger.kernel.org, davem@davemloft.net, Vlad Yasevich Subject: [PATCH 1/4] sctp: Fix crc32c calculations on big-endian arhes. Date: Thu, 22 Jan 2009 17:36:05 -0500 Message-Id: <1232663768-4028-2-git-send-email-vladislav.yasevich@hp.com> X-Mailer: git-send-email 1.5.3.5 In-Reply-To: <1232663768-4028-1-git-send-email-vladislav.yasevich@hp.com> References: <1232663768-4028-1-git-send-email-vladislav.yasevich@hp.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org crc32c algorithm provides a byteswaped result. On little-endian arches, the result ends up in big-endian/network byte order. On big-endinan arches, the result ends up in little-endian order and needs to be byte swapped again. Thus calling cpu_to_le32 gives the right output. Tested-by: Jukka Taimisto Signed-off-by: Vlad Yasevich --- include/net/sctp/checksum.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h index b799fb2..2fec3c3 100644 --- a/include/net/sctp/checksum.h +++ b/include/net/sctp/checksum.h @@ -79,5 +79,5 @@ static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32) static inline __be32 sctp_end_cksum(__be32 crc32) { - return ~crc32; + return (__force __be32)~cpu_to_le32((__force u32)crc32); }