Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78485
b: refs/heads/master
c: 9ad0977
h: refs/heads/master
i:
  78483: 8d24fde
v: v3
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed Jan 28, 2008
1 parent 0713605 commit 82fb8a7
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 231 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1bf40954cf232a043a49623cf251f787c1871e64
refs/heads/master: 9ad0977fe10bd5d052a6db7738afe017367c2e32
78 changes: 78 additions & 0 deletions trunk/include/net/sctp/checksum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/* SCTP kernel reference Implementation
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001-2003 International Business Machines, Corp.
*
* This file is part of the SCTP kernel reference Implementation
*
* SCTP Checksum functions
*
* The SCTP reference implementation is free software;
* you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* The SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Please send any bug reports or fixes you make to the
* email address(es):
* lksctp developers <lksctp-developers@lists.sourceforge.net>
*
* Or submit a bug report through the following website:
* http://www.sf.net/projects/lksctp
*
* Written or modified by:
* Dinakaran Joseph
* Jon Grimm <jgrimm@us.ibm.com>
* Sridhar Samudrala <sri@us.ibm.com>
*
* Rewritten to use libcrc32c by:
* Vlad Yasevich <vladislav.yasevich@hp.com>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/

#include <linux/types.h>
#include <net/sctp/sctp.h>
#include <linux/crc32c.h>

static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length)
{
__u32 crc = ~(__u32) 0;
__u8 zero[sizeof(__u32)] = {0};

/* Optimize this routine to be SCTP specific, knowing how
* to skip the checksum field of the SCTP header.
*/

/* Calculate CRC up to the checksum. */
crc = crc32c(crc, buffer, sizeof(struct sctphdr) - sizeof(__u32));

/* Skip checksum field of the header. */
crc = crc32c(crc, zero, sizeof(__u32));

/* Calculate the rest of the CRC. */
crc = crc32c(crc, &buffer[sizeof(struct sctphdr)],
length - sizeof(struct sctphdr));
return crc;
}

static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
{
return crc32c(crc32, buffer, length);
}

static inline __u32 sctp_end_cksum(__u32 crc32)
{
return ntohl(~crc32);
}
7 changes: 0 additions & 7 deletions trunk/include/net/sctp/sctp.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,6 @@ int sctp_primitive_SEND(struct sctp_association *, void *arg);
int sctp_primitive_REQUESTHEARTBEAT(struct sctp_association *, void *arg);
int sctp_primitive_ASCONF(struct sctp_association *, void *arg);

/*
* sctp/crc32c.c
*/
__u32 sctp_start_cksum(__u8 *ptr, __u16 count);
__u32 sctp_update_cksum(__u8 *ptr, __u16 count, __u32 cksum);
__u32 sctp_end_cksum(__u32 cksum);

/*
* sctp/input.c
*/
Expand Down
1 change: 1 addition & 0 deletions trunk/net/sctp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ menuconfig IP_SCTP
select CRYPTO_HMAC
select CRYPTO_SHA1
select CRYPTO_MD5 if SCTP_HMAC_MD5
select LIBCRC32C
---help---
Stream Control Transmission Protocol

Expand Down
2 changes: 1 addition & 1 deletion trunk/net/sctp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sctp-y := sm_statetable.o sm_statefuns.o sm_sideeffect.o \
transport.o chunk.o sm_make_chunk.o ulpevent.o \
inqueue.o outqueue.o ulpqueue.o command.o \
tsnmap.o bind_addr.o socket.o primitive.o \
output.o input.o debug.o ssnmap.o proc.o crc32c.o \
output.o input.o debug.o ssnmap.o proc.o \
auth.o

sctp-$(CONFIG_SCTP_DBG_OBJCNT) += objcnt.o
Expand Down
222 changes: 0 additions & 222 deletions trunk/net/sctp/crc32c.c

This file was deleted.

1 change: 1 addition & 0 deletions trunk/net/sctp/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include <net/xfrm.h>
#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>
#include <net/sctp/checksum.h>

/* Forward declarations for internal helpers. */
static int sctp_rcv_ootb(struct sk_buff *);
Expand Down
1 change: 1 addition & 0 deletions trunk/net/sctp/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@

#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>
#include <net/sctp/checksum.h>

/* Forward declarations for private helpers. */
static sctp_xmit_t sctp_packet_append_data(struct sctp_packet *packet,
Expand Down

0 comments on commit 82fb8a7

Please sign in to comment.