2.6.7-mm6, fix CRC16 misnaming
Subsystems (4)
cover 2.6.7-mm6, fix CRC16 misnaming
As pointed by Thomas Sailer, crc16.c module contains CRC16-CCITT (x^16 + x^12 + x^5 + 1) implementation, not IBM CRC16 (x^16 + x^15 + x^2 + 1) one. Looks like we need to rename it accordingly and this patchset does exactly this.
Please consider applying.
include/linux/crc-ccitt.h | 15 ++++++++++ include/linux/crc16.h | 15 ---------- lib/Kconfig | 10 +++--- lib/Makefile | 2 - lib/crc-ccitt.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++ lib/crc16.c | 69 ---------------------------------------------- 6 files changed, 90 insertions(+), 90 deletions(-)
lib/Kconfig +5 -5
@@ -4,13 +4,13 @@ menu "Library routines" -config CRC16 - tristate "CRC16 functions" +config CRC_CCITT + tristate "CRC-CCITT functions" help This option is provided for the case where no in-kernel-tree - modules require CRC16 functions, but a module built outside the - kernel tree does. Such modules that use library CRC16 functions - require M here. + modules require CRC-CCITT functions, but a module built outside + the kernel tree does. Such modules that use library CRC-CCITT + functions require M here. config CRC32 tristate "CRC32 functions"
lib/Makefile +1 -1
@@ -18,7 +18,7 @@ ifneq ($(CONFIG_HAVE_DEC_LOCK),y) lib-y += dec_and_lock.o endif -obj-$(CONFIG_CRC16) += crc16.o +obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o obj-$(CONFIG_CRC32) += crc32.o obj-$(CONFIG_LIBCRC32C) += libcrc32c.o
lib/crc-ccitt.c +69 -0
69 lines not on this page · raw message
lib/crc16.c +0 -69
69 lines not on this page · raw message
include/linux/crc-ccitt.h +15 -0
@@ -0,0 +1,15 @@ +#ifndef _LINUX_CRC_CCITT_H +#define _LINUX_CRC_CCITT_H + +#include <linux/types.h> + +extern u16 const crc_ccitt_table[256 ]; + +extern u16 crc_ccitt (u16 crc,const u8 *buffer,size_t len); + +static inline u16 crc_ccitt_byte (u16 crc,const u8 c) +{ +return (crc >>8 ) ^ crc_ccitt_table[(crc ^ c) &0xff ]; +} + +#endif /* _LINUX_CRC_CCITT_H */
include/linux/crc16.h +0 -15
@@ -1,15 +0,0 @@ -#ifndef _LINUX_CRC16_H -#define _LINUX_CRC16_H - -#include <linux/types.h> - -extern u16 const crc16_table[256 ]; - -extern u16 crc16 (u16 crc,const u8 *buffer,size_t len); - -static inline u16 crc16_byte (u16 crc,const u8 c) -{ -return (crc >>8 ) ^ crc16_table[(crc ^ c) &0xff ]; -} - -#endif /* _LINUX_CRC16_H */
PATCH 1/5 2.6.7-mm6, CRC16 renaming in AX25 drivers
drivers/net/hamradio/baycom_epp.c | 6 +++--- drivers/net/hamradio/hdlcdrv.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/hamradio/baycom_epp.c +3 -3
@@ -58,7 +58,7 @@/* prototypes for ax25_encapsulate and ax25_rebuild_header */ #include <net/ax25.h> #endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */ -#include <linux/crc16.h> +#include <linux/crc-ccitt.h> /* --------------------------------------------------------------------- */
@@ -281,14 +281,14 @@ static inline void append_crc_ccitt(unsistatic inline int check_crc_ccitt (const unsigned char *buf,int cnt) { -return (crc16 (0xffff , buf, cnt) &0xffff ) ==0xf0b8 ; +return (crc_ccitt (0xffff , buf, cnt) &0xffff ) ==0xf0b8 ; }/*---------------------------------------------------------------------------*/ static inline int calc_crc_ccitt (const unsigned char *buf,int cnt) { -return (crc16 (0xffff , buf, cnt) ^0xffff ) &0xffff ; +return (crc_ccitt (0xffff , buf, cnt) ^0xffff ) &0xffff ; }/* ---------------------------------------------------------------------- */
drivers/net/hamradio/hdlcdrv.c +3 -3
@@ -66,7 +66,7 @@#include <linux/ip.h> #include <linux/udp.h> #include <linux/tcp.h> -#include <linux/crc16.h> +#include <linux/crc-ccitt.h> /* --------------------------------------------------------------------- */
@@ -105,7 +105,7 @@ static char ax25_nocall[AX25_ADDR_LEN] =static inline void append_crc_ccitt (unsigned char *buffer,int len) { -unsigned int crc =crc16 (0xffff , buffer, len) ^0xffff ; +unsigned int crc =crc_ccitt (0xffff , buffer, len) ^0xffff ; *buffer++ = crc; *buffer++ = crc >>8 ; }
@@ -114,7 +114,7 @@ static inline void append_crc_ccitt(unsistatic inline int check_crc_ccitt (const unsigned char *buf,int cnt) { -return (crc16 (0xffff , buf, cnt) &0xffff ) ==0xf0b8 ; +return (crc_ccitt (0xffff , buf, cnt) &0xffff ) ==0xf0b8 ; }/*---------------------------------------------------------------------------*/
PATCH 2/5 2.6.7-mm6, CRC16 renaming in IRDA drivers
include/net/irda/crc.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
include/net/irda/crc.h +3 -3
@@ -15,15 +15,15 @@#define IRDA_CRC_H #include <linux/types.h> -#include <linux/crc16.h> +#include <linux/crc-ccitt.h> #define INIT_FCS 0xffff/* Initial FCS value */ #define GOOD_FCS 0xf0b8/* Good final FCS value */ /* Recompute the FCS with one more character appended. */ -#define irda_fcs (fcs, c) crc16_byte(fcs, c) +#define irda_fcs (fcs, c) crc_ccitt_byte(fcs, c)/* Recompute the FCS with len bytes appended. */ -#define irda_calc_crc16 (fcs, buf, len) crc16(fcs, buf, len) +#define irda_calc_crc16 (fcs, buf, len) crc_ccitt(fcs, buf, len)#endif
PATCH 3/5 2.6.7-mm6, CRC16 renaming in ISDN drivers
drivers/isdn/hisax/isdnhdlc.c | 6 +++--- drivers/isdn/hisax/st5481_hdlc.c | 6 +++--- drivers/isdn/tpam/tpam_crcpc.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/isdn/hisax/isdnhdlc.c +3 -3
@@ -22,7 +22,7 @@#include <linux/module.h> #include <linux/init.h> -#include <linux/crc16.h> +#include <linux/crc-ccitt.h> #include "isdnhdlc.h" /*-------------------------------------------------------------------*/
@@ -305,7 +305,7 @@ int isdnhdlc_decode (struct isdnhdlc_varif (hdlc->data_bits==8 ){ hdlc->data_bits =0 ; hdlc->data_received =1 ; - hdlc->crc =crc16_byte (hdlc->crc, hdlc->shift_reg); + hdlc->crc =crc_ccitt_byte (hdlc->crc, hdlc->shift_reg);// good byte received if (dsize--) {
@@ -482,7 +482,7 @@ int isdnhdlc_encode(struct isdnhdlc_varsbreak ; }if (hdlc->bit_shift==8 ){ - hdlc->crc =crc16_byte (hdlc->crc, hdlc->shift_reg); + hdlc->crc =crc_ccitt_byte (hdlc->crc, hdlc->shift_reg); }if (hdlc->shift_reg &0x01 ){ hdlc->hdlc_bits1++;
drivers/isdn/hisax/st5481_hdlc.c +3 -3
@@ -10,7 +10,7 @@* */ -#include <linux/crc16.h> +#include <linux/crc-ccitt.h> #include "st5481_hdlc.h"
@@ -262,7 +262,7 @@ int hdlc_decode(struct hdlc_vars *hdlc,if (hdlc->data_bits==8 ){ hdlc->data_bits =0 ; hdlc->data_received =1 ; - hdlc->crc =crc16_byte (hdlc->crc, hdlc->shift_reg); + hdlc->crc =crc_ccitt_byte (hdlc->crc, hdlc->shift_reg);// good byte received if (dsize--) {
@@ -439,7 +439,7 @@ int hdlc_encode(struct hdlc_vars *hdlc,break ; }if (hdlc->bit_shift==8 ){ - hdlc->crc =crc16_byte (hdlc->crc, hdlc->shift_reg); + hdlc->crc =crc_ccitt_byte (hdlc->crc, hdlc->shift_reg); }if (hdlc->shift_reg &0x01 ){ hdlc->hdlc_bits1++;
drivers/isdn/tpam/tpam_crcpc.c +4 -4
@@ -27,7 +27,7 @@ Revision History:---------------------------------------------------------------------------*/ -#include <linux/crc16.h> +#include <linux/crc-ccitt.h> #include "tpam.h" #define HDLC_CTRL_CHAR_CMPL_MASK 0x20/* HDLC control character complement mask */
@@ -85,7 +85,7 @@ void hdlc_encode_modem(u8 *buffer_in, u3/* * FCS calculation */ - fcs =crc16_byte (fcs, data); + fcs =crc_ccitt_byte (fcs, data);ESCAPE_CHAR (p_data_out, data); }
@@ -121,7 +121,7 @@ void hdlc_no_accm_encode(u8 *buffer_in,while (lng_in--) { data = *buffer_in++;/* calculate FCS */ - fcs =crc16_byte (fcs, data); + fcs =crc_ccitt_byte (fcs, data); *p_data_out++ = data; }
@@ -151,7 +151,7 @@ u32 hdlc_no_accm_decode(u8 *buffer_in, uwhile (lng_in--) { data = *buffer_in++;/* calculate FCS */ - fcs =crc16_byte (fcs, data); + fcs =crc_ccitt_byte (fcs, data); }if (fcs ==HDLC_FCS_OK )
PATCH 4/5 2.6.7-mm6, CRC16 renaming in PPP driver
drivers/net/ppp_async.c | 2 +- include/linux/ppp_defs.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ppp_async.c +1 -1
@@ -24,7 +24,7 @@#include <linux/tty.h> #include <linux/netdevice.h> #include <linux/poll.h> -#include <linux/crc16.h> +#include <linux/crc-ccitt.h> #include <linux/ppp_defs.h> #include <linux/if_ppp.h> #include <linux/ppp_channel.h>
include/linux/ppp_defs.h +2 -2
@@ -42,7 +42,7 @@#ifndef _PPP_DEFS_H_#define _PPP_DEFS_H_ -#include <linux/crc16.h> +#include <linux/crc-ccitt.h> /* * The basic PPP frame.
@@ -97,7 +97,7 @@#define PPP_INITFCS 0xffff/* Initial FCS value */ #define PPP_GOODFCS 0xf0b8/* Good final FCS value */ -#define PPP_FCS (fcs, c) crc16_byte(fcs, c) +#define PPP_FCS (fcs, c) crc_ccitt_byte(fcs, c)/* * Extended asyncmap - allows any character to be escaped.
PATCH 5/5 2.6.7-mm6, CRC16 renaming in VIA Velocity ethernet driver
drivers/net/via-velocity.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/via-velocity.c +2 -2
@@ -78,7 +78,7 @@#include <linux/ip.h> #include <linux/tcp.h> #include <linux/udp.h> -#include <linux/crc16.h> +#include <linux/crc-ccitt.h> #include <linux/crc32.h> #include "via-velocity.h"
@@ -3086,7 +3086,7 @@ u16 wol_calc_crc(int size, u8 * pattern,continue ; } mask >>=1 ; - crc =crc16 (crc, &(pattern[i *8 + j]),1 ); + crc =crc_ccitt (crc, &(pattern[i *8 + j]),1 ); } }/* Finally, invert the result once to get the correct data */
On Thu, Jul 08, 2004 at 05:01:18PM +0400, Andrey Panin wrote:
[snip]
lib/Kconfig line 8
Quoted 4 lines
lib/Kconfig +2
-2-config CRC16 - tristate "CRC16 functions" +config CRC_CCITT + tristate "CRC-CCITT functions"
Wouldn't it be better to keep the size here too?
CRC16-CCITT instead of just CRC-CCITT.
Regards: David Weinehall
Signature · 3 lines
/) David Weinehall <[email protected]> /) Northern lights wander (\ // Maintainer of the v2.0 kernel // Dance across the winter sky // \) http://www.acc.umu.se/~tao/ (/ Full colour fire (/
Quoted 3 lines · David Weinehall
Wouldn't it be better to keep the size here too?
CRC16-CCITT instead of just CRC-CCITT.
IMO not necessary, the size is clear from the return type, and CCITT AFAIK never defined a 32bit CRC Poly
Tom
Quoted 4 lines · Andrey Panin
As pointed by Thomas Sailer,
crc16.cmodule contains CRC16-CCITT (x^16 + x^12 + x^5 + 1)
implementation, not IBM CRC16 (x^16 + x^15 + x^2 + 1) one. Looks like we need to rename it accordingly and this patchset does exactly this.
Needs this:
drivers/net/hamradio/Kconfig:116:warning: 'select' used by config symbol 'BAYCOM_SER_FDX' refer to undefined symbol 'CRC16' drivers/net/hamradio/Kconfig:136:warning: 'select' used by config symbol 'BAYCOM_SER_HDX' refer to undefined symbol 'CRC16' drivers/net/hamradio/Kconfig:154:warning: 'select' used by config symbol 'BAYCOM_PAR' refer to undefined symbol 'CRC16' drivers/net/hamradio/Kconfig:169:warning: 'select' used by config symbol 'BAYCOM_EPP' refer to undefined symbol 'CRC16' net/irda/Kconfig:8:warning: 'select' used by config symbol 'IRDA' refer to undefined symbol 'CRC16' drivers/net/Kconfig:1749:warning: 'select' used by config symbol 'VIA_VELOCITY' refer to undefined symbol 'CRC16' drivers/net/Kconfig:2465:warning: 'select' used by config symbol 'PPP_ASYNC' refer to undefined symbol 'CRC16' drivers/isdn/hisax/Kconfig:403:warning: 'select' used by config symbol 'HISAX_ST5481' refer to undefined symbol 'CRC16' drivers/isdn/hisax/Kconfig:7:warning: 'select' used by config symbol 'ISDN_DRV_HISAX' refer to undefined symbol 'CRC16' drivers/isdn/tpam/Kconfig:7:warning: 'select' used by config symbol 'ISDN_DRV_TPAM' refer to undefined symbol 'CRC16'
---
25-akpm/drivers/isdn/hisax/Kconfig | 4 ++-- 25-akpm/drivers/isdn/tpam/Kconfig | 2 +- 25-akpm/drivers/net/Kconfig | 4 ++-- 25-akpm/drivers/net/hamradio/Kconfig | 8 ++++---- 25-akpm/net/irda/Kconfig | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/hamradio/Kconfig renamed from drivers/net/hamradio/Kconfig~crc16-kconfig-touchups +4 -4
@@ -113,7 +113,7 @@ config SCC_TRXECHO config BAYCOM_SER_FDX tristate "BAYCOM ser12 fullduplex driver for AX.25" depends on AX25 - select CRC16 + select CRC_CCITT ---help--- This is one of two drivers for Baycom style simple amateur radio modems that connect to a serial interface. The driver supports the
@@ -133,7 +133,7 @@ config BAYCOM_SER_FDX config BAYCOM_SER_HDX tristate "BAYCOM ser12 halfduplex driver for AX.25" depends on AX25 - select CRC16 + select CRC_CCITT ---help--- This is one of two drivers for Baycom style simple amateur radio modems that connect to a serial interface. The driver supports the
@@ -151,7 +151,7 @@ config BAYCOM_SER_HDX config BAYCOM_PAR tristate "BAYCOM picpar and par96 driver for AX.25" depends on PARPORT && AX25 - select CRC16 + select CRC_CCITT ---help--- This is a driver for Baycom style simple amateur radio modems that connect to a parallel interface. The driver supports the picpar and
@@ -166,7 +166,7 @@ config BAYCOM_PAR config BAYCOM_EPP tristate "BAYCOM epp driver for AX.25" depends on PARPORT && AX25 && !64BIT - select CRC16 + select CRC_CCITT ---help--- This is a driver for Baycom style simple amateur radio modems that connect to a parallel interface. The driver supports the EPP
net/irda/Kconfig renamed from net/irda/Kconfig~crc16-kconfig-touchups +1 -1
@@ -5,7 +5,7 @@ menuconfig IRDA depends on NET tristate "IrDA (infrared) subsystem support" - select CRC16 + select CRC_CCITT ---help--- Say Y here if you want to build support for the IrDA (TM) protocols. The Infrared Data Associations (tm) specifies standards for wireless
drivers/net/Kconfig renamed from drivers/net/Kconfig~crc16-kconfig-touchups +2 -2
@@ -1746,7 +1746,7 @@ config VIA_VELOCITY tristate "VIA Velocity support" depends on NET_PCI && PCI select CRC32 - select CRC16 + select CRC_CCITT select MII help If you have a VIA "Velocity" based network card say Y here.
@@ -2462,7 +2462,7 @@ config PPP_FILTER config PPP_ASYNC tristate "PPP support for async serial ports" depends on PPP - select CRC16 + select CRC_CCITT ---help--- Say Y (or M) here if you want to be able to use PPP over standard asynchronous serial ports, such as COM1 or COM2 on a PC. If you use
drivers/isdn/hisax/Kconfig renamed from drivers/isdn/hisax/Kconfig~crc16-kconfig-touchups +2 -2
@@ -4,7 +4,7 @@ menu "Passive cards" config ISDN_DRV_HISAX tristate "HiSax SiemensChipSet driver support" - select CRC16 + select CRC_CCITT ---help--- This is a driver supporting the Siemens chipset on various ISDN-cards (like AVM A1, Elsa ISDN cards, Teles S0-16.0, Teles
@@ -400,7 +400,7 @@ comment "HiSax sub driver modules" config HISAX_ST5481 tristate "ST5481 USB ISDN modem (EXPERIMENTAL)" depends on USB && EXPERIMENTAL - select CRC16 + select CRC_CCITT help This enables the driver for ST5481 based USB ISDN adapters, e.g. the BeWan Gazel 128 USB
drivers/isdn/tpam/Kconfig renamed from drivers/isdn/tpam/Kconfig~crc16-kconfig-touchups +1 -1
@@ -4,7 +4,7 @@ config ISDN_DRV_TPAM tristate "Auvertech TurboPAM support (EXPERIMENTAL)" depends on EXPERIMENTAL && ISDN_I4L && PCI - select CRC16 + select CRC_CCITT help This enables support for the Auvertech TurboPAM ISDN-card. For running this card, additional firmware is necessary, which has
_