diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-20 21:04:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-20 21:04:47 -0700 |
commit | 3b59bf081622b6446db77ad06c93fe23677bc533 (patch) | |
tree | 3f4bb5a27c90cc86994a1f6d3c53fbf9208003cb /drivers/isdn/i4l | |
parent | e45836fafe157df137a837093037f741ad8f4c90 (diff) | |
parent | bbdb32cb5b73597386913d052165423b9d736145 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking merge from David Miller:
"1) Move ixgbe driver over to purely page based buffering on receive.
From Alexander Duyck.
2) Add receive packet steering support to e1000e, from Bruce Allan.
3) Convert TCP MD5 support over to RCU, from Eric Dumazet.
4) Reduce cpu usage in handling out-of-order TCP packets on modern
systems, also from Eric Dumazet.
5) Support the IP{,V6}_UNICAST_IF socket options, making the wine
folks happy, from Erich Hoover.
6) Support VLAN trunking from guests in hyperv driver, from Haiyang
Zhang.
7) Support byte-queue-limtis in r8169, from Igor Maravic.
8) Outline code intended for IP_RECVTOS in IP_PKTOPTIONS existed but
was never properly implemented, Jiri Benc fixed that.
9) 64-bit statistics support in r8169 and 8139too, from Junchang Wang.
10) Support kernel side dump filtering by ctmark in netfilter
ctnetlink, from Pablo Neira Ayuso.
11) Support byte-queue-limits in gianfar driver, from Paul Gortmaker.
12) Add new peek socket options to assist with socket migration, from
Pavel Emelyanov.
13) Add sch_plug packet scheduler whose queue is controlled by
userland daemons using explicit freeze and release commands. From
Shriram Rajagopalan.
14) Fix FCOE checksum offload handling on transmit, from Yi Zou."
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1846 commits)
Fix pppol2tp getsockname()
Remove printk from rds_sendmsg
ipv6: fix incorrent ipv6 ipsec packet fragment
cpsw: Hook up default ndo_change_mtu.
net: qmi_wwan: fix build error due to cdc-wdm dependecy
netdev: driver: ethernet: Add TI CPSW driver
netdev: driver: ethernet: add cpsw address lookup engine support
phy: add am79c874 PHY support
mlx4_core: fix race on comm channel
bonding: send igmp report for its master
fs_enet: Add MPC5125 FEC support and PHY interface selection
net: bpf_jit: fix BPF_S_LDX_B_MSH compilation
net: update the usage of CHECKSUM_UNNECESSARY
fcoe: use CHECKSUM_UNNECESSARY instead of CHECKSUM_PARTIAL on tx
net: do not do gso for CHECKSUM_UNNECESSARY in netif_needs_gso
ixgbe: Fix issues with SR-IOV loopback when flow control is disabled
net/hyperv: Fix the code handling tx busy
ixgbe: fix namespace issues when FCoE/DCB is not enabled
rtlwifi: Remove unused ETH_ADDR_LEN defines
igbvf: Use ETH_ALEN
...
Fix up fairly trivial conflicts in drivers/isdn/gigaset/interface.c and
drivers/net/usb/{Kconfig,qmi_wwan.c} as per David.
Diffstat (limited to 'drivers/isdn/i4l')
-rw-r--r-- | drivers/isdn/i4l/isdn_audio.c | 126 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_bsdcomp.c | 374 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_common.c | 1502 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_common.h | 18 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_concap.c | 36 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_concap.h | 4 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_net.c | 1498 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_net.h | 11 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_ppp.c | 1446 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_ppp.h | 2 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_tty.c | 2440 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_tty.h | 10 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_ttyfax.c | 1092 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_ttyfax.h | 1 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_v110.c | 294 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_v110.h | 8 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_x25iface.c | 226 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_x25iface.h | 16 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdnhdlc.c | 54 |
19 files changed, 4572 insertions, 4586 deletions
diff --git a/drivers/isdn/i4l/isdn_audio.c b/drivers/isdn/i4l/isdn_audio.c index d5013935ac6..78ce4221471 100644 --- a/drivers/isdn/i4l/isdn_audio.c +++ b/drivers/isdn/i4l/isdn_audio.c @@ -204,9 +204,9 @@ isdn_audio_tlookup(const u_char *table, u_char *buff, unsigned long n) "xlatb\n\t" "stosb\n\t" "loop 1b\n\t" - : "=&b"(d0), "=&c"(d1), "=&D"(d2), "=&S"(d3) - : "0"((long) table), "1"(n), "2"((long) buff), "3"((long) buff) - : "memory", "ax"); + : "=&b"(d0), "=&c"(d1), "=&D"(d2), "=&S"(d3) + : "0"((long) table), "1"(n), "2"((long) buff), "3"((long) buff) + : "memory", "ax"); #else while (n--) *buff = table[*(unsigned char *)buff], buff++; @@ -242,27 +242,27 @@ static unsigned char isdn_audio_linear2ulaw(int sample) { static int exp_lut[256] = - { - 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 - }; + { + 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 + }; int sign, - exponent, - mantissa; + exponent, + mantissa; unsigned char ulawbyte; /* Get the sample into sign-magnitude. */ @@ -299,7 +299,7 @@ static int bitmask[9] = }; static int -isdn_audio_get_bits(adpcm_state * s, unsigned char **in, int *len) +isdn_audio_get_bits(adpcm_state *s, unsigned char **in, int *len) { while (s->nleft < s->nbits) { int d = *((*in)++); @@ -312,7 +312,7 @@ isdn_audio_get_bits(adpcm_state * s, unsigned char **in, int *len) } static void -isdn_audio_put_bits(int data, int nbits, adpcm_state * s, +isdn_audio_put_bits(int data, int nbits, adpcm_state *s, unsigned char **out, int *len) { s->word = (s->word << nbits) | (data & bitmask[nbits]); @@ -326,7 +326,7 @@ isdn_audio_put_bits(int data, int nbits, adpcm_state * s, } adpcm_state * -isdn_audio_adpcm_init(adpcm_state * s, int nbits) +isdn_audio_adpcm_init(adpcm_state *s, int nbits) { if (!s) s = kmalloc(sizeof(adpcm_state), GFP_ATOMIC); @@ -341,7 +341,7 @@ isdn_audio_adpcm_init(adpcm_state * s, int nbits) } dtmf_state * -isdn_audio_dtmf_init(dtmf_state * s) +isdn_audio_dtmf_init(dtmf_state *s) { if (!s) s = kmalloc(sizeof(dtmf_state), GFP_ATOMIC); @@ -358,7 +358,7 @@ isdn_audio_dtmf_init(dtmf_state * s) */ int -isdn_audio_adpcm2xlaw(adpcm_state * s, int fmt, unsigned char *in, +isdn_audio_adpcm2xlaw(adpcm_state *s, int fmt, unsigned char *in, unsigned char *out, int len) { int a = s->a; @@ -379,7 +379,7 @@ isdn_audio_adpcm2xlaw(adpcm_state * s, int fmt, unsigned char *in, a++; if (fmt) *out++ = isdn_audio_ulaw_to_alaw[ - isdn_audio_linear2ulaw(a << 2)]; + isdn_audio_linear2ulaw(a << 2)]; else *out++ = isdn_audio_linear2ulaw(a << 2); olen++; @@ -393,7 +393,7 @@ isdn_audio_adpcm2xlaw(adpcm_state * s, int fmt, unsigned char *in, } int -isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in, +isdn_audio_xlaw2adpcm(adpcm_state *s, int fmt, unsigned char *in, unsigned char *out, int len) { int a = s->a; @@ -403,9 +403,9 @@ isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in, while (len--) { int e = 0, - nmax = 1 << (nbits - 1); + nmax = 1 << (nbits - 1); int sign, - delta; + delta; if (fmt) delta = (isdn_audio_alaw_to_s16[*in++] >> 2) - a; @@ -439,26 +439,26 @@ isdn_audio_xlaw2adpcm(adpcm_state * s, int fmt, unsigned char *in, /* * Goertzel algorithm. - * See http://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/ + * See http://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/ * for more info. * Result is stored into an sk_buff and queued up for later * evaluation. */ static void -isdn_audio_goertzel(int *sample, modem_info * info) +isdn_audio_goertzel(int *sample, modem_info *info) { int sk, - sk1, - sk2; + sk1, + sk2; int k, - n; + n; struct sk_buff *skb; int *result; skb = dev_alloc_skb(sizeof(int) * NCOEFF); if (!skb) { printk(KERN_WARNING - "isdn_audio: Could not alloc DTMF result for ttyI%d\n", + "isdn_audio: Could not alloc DTMF result for ttyI%d\n", info->line); return; } @@ -483,16 +483,16 @@ isdn_audio_goertzel(int *sample, modem_info * info) printk(KERN_DEBUG "isdn_audio: dtmf goertzel overflow, sk2=%d\n", sk2); result[k] = - ((sk * sk) >> AMP_BITS) - - ((((cos2pik[k] * sk) >> 15) * sk2) >> AMP_BITS) + - ((sk2 * sk2) >> AMP_BITS); + ((sk * sk) >> AMP_BITS) - + ((((cos2pik[k] * sk) >> 15) * sk2) >> AMP_BITS) + + ((sk2 * sk2) >> AMP_BITS); } skb_queue_tail(&info->dtmf_queue, skb); isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1); } void -isdn_audio_eval_dtmf(modem_info * info) +isdn_audio_eval_dtmf(modem_info *info) { struct sk_buff *skb; int *result; @@ -590,7 +590,7 @@ isdn_audio_eval_dtmf(modem_info * info) * fmt = audio data format (0 = ulaw, 1 = alaw) */ void -isdn_audio_calc_dtmf(modem_info * info, unsigned char *buf, int len, int fmt) +isdn_audio_calc_dtmf(modem_info *info, unsigned char *buf, int len, int fmt) { dtmf_state *s = info->dtmf_state; int i; @@ -605,10 +605,10 @@ isdn_audio_calc_dtmf(modem_info * info, unsigned char *buf, int len, int fmt) for (i = 0; i < c; i++) { if (fmt) s->buf[s->idx++] = - isdn_audio_alaw_to_s16[*buf++] >> (15 - AMP_BITS); + isdn_audio_alaw_to_s16[*buf++] >> (15 - AMP_BITS); else s->buf[s->idx++] = - isdn_audio_ulaw_to_s16[*buf++] >> (15 - AMP_BITS); + isdn_audio_ulaw_to_s16[*buf++] >> (15 - AMP_BITS); } if (s->idx == DTMF_NPOINTS) { isdn_audio_goertzel(s->buf, info); @@ -619,7 +619,7 @@ isdn_audio_calc_dtmf(modem_info * info, unsigned char *buf, int len, int fmt) } silence_state * -isdn_audio_silence_init(silence_state * s) +isdn_audio_silence_init(silence_state *s) { if (!s) s = kmalloc(sizeof(silence_state), GFP_ATOMIC); @@ -631,7 +631,7 @@ isdn_audio_silence_init(silence_state * s) } void -isdn_audio_calc_silence(modem_info * info, unsigned char *buf, int len, int fmt) +isdn_audio_calc_silence(modem_info *info, unsigned char *buf, int len, int fmt) { silence_state *s = info->silence_state; int i; @@ -641,24 +641,24 @@ isdn_audio_calc_silence(modem_info * info, unsigned char *buf, int len, int fmt) for (i = 0; i < len; i++) { if (fmt) - c = isdn_audio_alaw_to_ulaw[*buf++]; - else - c = *buf++; + c = isdn_audio_alaw_to_ulaw[*buf++]; + else + c = *buf++; if (c > 0) c -= 128; c = abs(c); - if (c > (info->emu.vpar[1] * 4)) { + if (c > (info->emu.vpar[1] * 4)) { s->idx = 0; - s->state = 1; + s->state = 1; } else { - if (s->idx < 210000) s->idx++; + if (s->idx < 210000) s->idx++; } } } void -isdn_audio_put_dle_code(modem_info * info, u_char code) +isdn_audio_put_dle_code(modem_info *info, u_char code) { struct sk_buff *skb; int di; @@ -668,7 +668,7 @@ isdn_audio_put_dle_code(modem_info * info, u_char code) skb = dev_alloc_skb(2); if (!skb) { printk(KERN_WARNING - "isdn_audio: Could not alloc skb for ttyI%d\n", + "isdn_audio: Could not alloc skb for ttyI%d\n", info->line); return; } @@ -688,24 +688,24 @@ isdn_audio_put_dle_code(modem_info * info, u_char code) } void -isdn_audio_eval_silence(modem_info * info) +isdn_audio_eval_silence(modem_info *info) { silence_state *s = info->silence_state; char what; what = ' '; - if (s->idx > (info->emu.vpar[2] * 800)) { + if (s->idx > (info->emu.vpar[2] * 800)) { s->idx = 0; - if (!s->state) { /* silence from beginning of rec */ + if (!s->state) { /* silence from beginning of rec */ what = 's'; } else { what = 'q'; } } - if ((what == 's') || (what == 'q')) { - printk(KERN_DEBUG "ttyI%d: %s\n", info->line, - (what=='s') ? "silence":"quiet"); - isdn_audio_put_dle_code(info, what); - } + if ((what == 's') || (what == 'q')) { + printk(KERN_DEBUG "ttyI%d: %s\n", info->line, + (what == 's') ? "silence" : "quiet"); + isdn_audio_put_dle_code(info, what); + } } diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c index aa0b6a6f5ef..7f3c54d4047 100644 --- a/drivers/isdn/i4l/isdn_bsdcomp.c +++ b/drivers/isdn/i4l/isdn_bsdcomp.c @@ -7,7 +7,7 @@ */ /* - * Update: The Berkeley copyright was changed, and the change + * Update: The Berkeley copyright was changed, and the change * is retroactive to all "true" BSD software (ie everything * from UCB as opposed to other peoples code that just carried * the same license). The new copyright doesn't clash with the @@ -121,7 +121,7 @@ struct bsd_db { unsigned char maxbits; /* maximum bits/code */ unsigned char debug; /* non-zero if debug desired */ unsigned char unit; /* ppp unit number */ - u16 seqno; /* sequence # of next packet */ + u16 seqno; /* sequence # of next packet */ unsigned int mru; /* size of receive (decompress) bufr */ unsigned int maxmaxcode; /* largest valid code */ unsigned int max_ent; /* largest code in use */ @@ -157,16 +157,16 @@ struct bsd_db { #define MAXCODE(b) ((1 << (b)) - 1) #define BADCODEM1 MAXCODE(MAX_BSD_BITS) -#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \ - ^ (unsigned long)(prefix)) -#define BSD_KEY(prefix,suffix) ((((unsigned long)(suffix)) << 16) \ +#define BSD_HASH(prefix, suffix, hshift) ((((unsigned long)(suffix)) << (hshift)) \ + ^ (unsigned long)(prefix)) +#define BSD_KEY(prefix, suffix) ((((unsigned long)(suffix)) << 16) \ + (unsigned long)(prefix)) #define CHECK_GAP 10000 /* Ratio check interval */ #define RATIO_SCALE_LOG 8 -#define RATIO_SCALE (1<<RATIO_SCALE_LOG) -#define RATIO_MAX (0x7fffffff>>RATIO_SCALE_LOG) +#define RATIO_SCALE (1 << RATIO_SCALE_LOG) +#define RATIO_MAX (0x7fffffff >> RATIO_SCALE_LOG) /* * clear the dictionary @@ -175,7 +175,7 @@ struct bsd_db { static void bsd_clear(struct bsd_db *db) { db->clear_count++; - db->max_ent = FIRST-1; + db->max_ent = FIRST - 1; db->n_bits = BSD_INIT_BITS; db->bytes_out = 0; db->in_count = 0; @@ -197,56 +197,56 @@ static void bsd_clear(struct bsd_db *db) * the absence of CLEAR codes (while packets are incompressible), they * must compute the same ratio. */ -static int bsd_check (struct bsd_db *db) /* 1=output CLEAR */ +static int bsd_check(struct bsd_db *db) /* 1=output CLEAR */ { - unsigned int new_ratio; - - if (db->in_count >= db->checkpoint) - { - /* age the ratio by limiting the size of the counts */ - if (db->in_count >= RATIO_MAX || db->bytes_out >= RATIO_MAX) - { - db->in_count -= (db->in_count >> 2); - db->bytes_out -= (db->bytes_out >> 2); - } - - db->checkpoint = db->in_count + CHECK_GAP; - - if (db->max_ent >= db->maxmaxcode) - { - /* Reset the dictionary only if the ratio is worse, - * or if it looks as if it has been poisoned - * by incompressible data. - * - * This does not overflow, because - * db->in_count <= RATIO_MAX. - */ - - new_ratio = db->in_count << RATIO_SCALE_LOG; - if (db->bytes_out != 0) - { - new_ratio /= db->bytes_out; - } - - if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE) - { - bsd_clear (db); - return 1; - } - db->ratio = new_ratio; - } - } - return 0; + unsigned int new_ratio; + + if (db->in_count >= db->checkpoint) + { + /* age the ratio by limiting the size of the counts */ + if (db->in_count >= RATIO_MAX || db->bytes_out >= RATIO_MAX) + { + db->in_count -= (db->in_count >> 2); + db->bytes_out -= (db->bytes_out >> 2); + } + + db->checkpoint = db->in_count + CHECK_GAP; + + if (db->max_ent >= db->maxmaxcode) + { + /* Reset the dictionary only if the ratio is worse, + * or if it looks as if it has been poisoned + * by incompressible data. + * + * This does not overflow, because + * db->in_count <= RATIO_MAX. + */ + + new_ratio = db->in_count << RATIO_SCALE_LOG; + if (db->bytes_out != 0) + { + new_ratio /= db->bytes_out; + } + + if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE) + { + bsd_clear(db); + return 1; + } + db->ratio = new_ratio; + } + } + return 0; } /* * Return statistics. */ -static void bsd_stats (void *state, struct compstat *stats) +static void bsd_stats(void *state, struct compstat *stats) { struct bsd_db *db = (struct bsd_db *) state; - + stats->unc_bytes = db->uncomp_bytes; stats->unc_packets = db->uncomp_count; stats->comp_bytes = db->comp_bytes; @@ -260,9 +260,9 @@ static void bsd_stats (void *state, struct compstat *stats) /* * Reset state, as on a CCP ResetReq. */ -static void bsd_reset (void *state,unsigned char code, unsigned char id, - unsigned char *data, unsigned len, - struct isdn_ppp_resetparams *rsparm) +static void bsd_reset(void *state, unsigned char code, unsigned char id, + unsigned char *data, unsigned len, + struct isdn_ppp_resetparams *rsparm) { struct bsd_db *db = (struct bsd_db *) state; @@ -274,7 +274,7 @@ static void bsd_reset (void *state,unsigned char code, unsigned char id, /* * Release the compression structure */ -static void bsd_free (void *state) +static void bsd_free(void *state) { struct bsd_db *db = (struct bsd_db *) state; @@ -302,7 +302,7 @@ static void bsd_free (void *state) /* * Allocate space for a (de) compressor. */ -static void *bsd_alloc (struct isdn_ppp_comp_data *data) +static void *bsd_alloc(struct isdn_ppp_comp_data *data) { int bits; unsigned int hsize, hshift, maxmaxcode; @@ -310,27 +310,27 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data) int decomp; static unsigned int htab[][2] = { - { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } , - { 9001 , 5 } , { 18013 , 6 } , { 35023 , 7 } , { 69001 , 8 } + { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } , + { 9001 , 5 } , { 18013 , 6 } , { 35023 , 7 } , { 69001 , 8 } }; - + if (data->optlen != 1 || data->num != CI_BSD_COMPRESS - || BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION) + || BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION) return NULL; bits = BSD_NBITS(data->options[0]); - if(bits < 9 || bits > 15) + if (bits < 9 || bits > 15) return NULL; - hsize = htab[bits-9][0]; - hshift = htab[bits-9][1]; - + hsize = htab[bits - 9][0]; + hshift = htab[bits - 9][1]; + /* * Allocate the main control structure for this instance. */ maxmaxcode = MAXCODE(bits); - db = kzalloc (sizeof (struct bsd_db),GFP_KERNEL); + db = kzalloc(sizeof(struct bsd_db), GFP_KERNEL); if (!db) return NULL; @@ -343,7 +343,7 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data) */ db->dict = vmalloc(hsize * sizeof(struct bsd_dict)); if (!db->dict) { - bsd_free (db); + bsd_free(db); return NULL; } @@ -356,7 +356,7 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data) else { db->lens = vmalloc((maxmaxcode + 1) * sizeof(db->lens[0])); if (!db->lens) { - bsd_free (db); + bsd_free(db); return (NULL); } } @@ -364,41 +364,41 @@ static void *bsd_alloc (struct isdn_ppp_comp_data *data) /* * Initialize the data information for the compression code */ - db->totlen = sizeof (struct bsd_db) + (sizeof (struct bsd_dict) * hsize); - db->hsize = hsize; - db->hshift = hshift; + db->totlen = sizeof(struct bsd_db) + (sizeof(struct bsd_dict) * hsize); + db->hsize = hsize; + db->hshift = hshift; db->maxmaxcode = maxmaxcode; - db->maxbits = bits; + db->maxbits = bits; - return (void *) db; + return (void *)db; } /* * Initialize the database. */ -static int bsd_init (void *state, struct isdn_ppp_comp_data *data, int unit, int debug) +static int bsd_init(void *state, struct isdn_ppp_comp_data *data, int unit, int debug) { struct bsd_db *db = state; int indx; int decomp; - if(!state || !data) { - printk(KERN_ERR "isdn_bsd_init: [%d] ERR, state %lx data %lx\n",unit,(long)state,(long)data); + if (!state || !data) { + printk(KERN_ERR "isdn_bsd_init: [%d] ERR, state %lx data %lx\n", unit, (long)state, (long)data); return 0; } decomp = db->xmit ? 0 : 1; - + if (data->optlen != 1 || data->num != CI_BSD_COMPRESS - || (BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION) - || (BSD_NBITS(data->options[0]) != db->maxbits) - || (decomp && db->lens == NULL)) { - printk(KERN_ERR "isdn_bsd: %d %d %d %d %lx\n",data->optlen,data->num,data->options[0],decomp,(unsigned long)db->lens); + || (BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION) + || (BSD_NBITS(data->options[0]) != db->maxbits) + || (decomp && db->lens == NULL)) { + printk(KERN_ERR "isdn_bsd: %d %d %d %d %lx\n", data->optlen, data->num, data->options[0], decomp, (unsigned long)db->lens); return 0; } if (decomp) - for(indx=LAST;indx>=0;indx--) + for (indx = LAST; indx >= 0; indx--) db->lens[indx] = 1; indx = db->hsize; @@ -411,9 +411,9 @@ static int bsd_init (void *state, struct isdn_ppp_comp_data *data, int unit, int db->mru = 0; db->debug = 1; - - bsd_reset(db,0,0,NULL,0,NULL); - + + bsd_reset(db, 0, 0, NULL, 0, NULL); + return 1; } @@ -421,37 +421,37 @@ static int bsd_init (void *state, struct isdn_ppp_comp_data *data, int unit, int * Obtain pointers to the various structures in the compression tables */ -#define dict_ptrx(p,idx) &(p->dict[idx]) -#define lens_ptrx(p,idx) &(p->lens[idx]) +#define dict_ptrx(p, idx) &(p->dict[idx]) +#define lens_ptrx(p, idx) &(p->lens[idx]) #ifdef DEBUG static unsigned short *lens_ptr(struct bsd_db *db, int idx) { if ((unsigned int) idx > (unsigned int) db->maxmaxcode) { - printk (KERN_DEBUG "<9>ppp: lens_ptr(%d) > max\n", idx); + printk(KERN_DEBUG "<9>ppp: lens_ptr(%d) > max\n", idx); idx = 0; } - return lens_ptrx (db, idx); + return lens_ptrx(db, idx); } static struct bsd_dict *dict_ptr(struct bsd_db *db, int idx) { if ((unsigned int) idx >= (unsigned int) db->hsize) { - printk (KERN_DEBUG "<9>ppp: dict_ptr(%d) > max\n", idx); + printk(KERN_DEBUG "<9>ppp: dict_ptr(%d) > max\n", idx); idx = 0; } - return dict_ptrx (db, idx); + return dict_ptrx(db, idx); } #else -#define lens_ptr(db,idx) lens_ptrx(db,idx) -#define dict_ptr(db,idx) dict_ptrx(db,idx) +#define lens_ptr(db, idx) lens_ptrx(db, idx) +#define dict_ptr(db, idx) dict_ptrx(db, idx) #endif /* * compress a packet */ -static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *skb_out,int proto) +static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out, int proto) { struct bsd_db *db; int hshift; @@ -463,31 +463,31 @@ static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *sk unsigned long fcode; struct bsd_dict *dictp; unsigned char c; - int hval,disp,ilen,mxcode; + int hval, disp, ilen, mxcode; unsigned char *rptr = skb_in->data; int isize = skb_in->len; -#define OUTPUT(ent) \ - { \ - bitno -= n_bits; \ - accm |= ((ent) << bitno); \ - do { \ - if(skb_out && skb_tailroom(skb_out) > 0) \ - *(skb_put(skb_out,1)) = (unsigned char) (accm>>24); \ - accm <<= 8; \ - bitno += 8; \ - } while (bitno <= 24); \ - } +#define OUTPUT(ent) \ + { \ + bitno -= n_bits; \ + accm |= ((ent) << bitno); \ + do { \ + if (skb_out && skb_tailroom(skb_out) > 0) \ + *(skb_put(skb_out, 1)) = (unsigned char)(accm >> 24); \ + accm <<= 8; \ + bitno += 8; \ + } while (bitno <= 24); \ + } /* * If the protocol is not in the range we're interested in, * just return without compressing the packet. If it is, * the protocol becomes the first byte to compress. */ - printk(KERN_DEBUG "bsd_compress called with %x\n",proto); - + printk(KERN_DEBUG "bsd_compress called with %x\n", proto); + ent = proto; - if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1) ) + if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1)) return 0; db = (struct bsd_db *) state; @@ -496,25 +496,25 @@ static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *sk n_bits = db->n_bits; bitno = 32; accm = 0; - mxcode = MAXCODE (n_bits); - + mxcode = MAXCODE(n_bits); + /* This is the PPP header information */ - if(skb_out && skb_tailroom(skb_out) >= 2) { - char *v = skb_put(skb_out,2); + if (skb_out && skb_tailroom(skb_out) >= 2) { + char *v = skb_put(skb_out, 2); /* we only push our own data on the header, - AC,PC and protos is pushed by caller */ + AC,PC and protos is pushed by caller */ v[0] = db->seqno >> 8; v[1] = db->seqno; } - ilen = ++isize; /* This is off by one, but that is what is in draft! */ + ilen = ++isize; /* This is off by one, but that is what is in draft! */ while (--ilen > 0) { - c = *rptr++; - fcode = BSD_KEY (ent, c); - hval = BSD_HASH (ent, c, hshift); - dictp = dict_ptr (db, hval); - + c = *rptr++; + fcode = BSD_KEY(ent, c); + hval = BSD_HASH(ent, c, hshift); + dictp = dict_ptr(db, hval); + /* Validate and then check the entry. */ if (dictp->codem1 >= max_ent) goto nomatch; @@ -523,7 +523,7 @@ static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *sk ent = dictp->codem1 + 1; continue; /* found (prefix,suffix) */ } - + /* continue probing until a match or invalid entry */ disp = (hval == 0) ? 1 : hval; @@ -531,17 +531,17 @@ static int bsd_compress (void *state, struct sk_buff *skb_in, struct sk_buff *sk hval += disp; if (hval >= db->hsize) hval -= db->hsize; - dictp = dict_ptr (db, hval); + dictp = dict_ptr(db, hval); if (dictp->codem1 >= max_ent) goto nomatch; } while (dictp->fcode != fcode); ent = dictp->codem1 + 1; /* finally found (prefix,suffix) */ continue; - -nomatch: + + nomatch: OUTPUT(ent); /* output the prefix */ - + /* code -> hashtable */ if (max_ent < db->maxmaxcode) { struct bsd_dict *dictp2; @@ -551,16 +551,16 @@ nomatch: /* expand code size if needed */ if (max_ent >= mxcode) { db->n_bits = ++n_bits; - mxcode = MAXCODE (n_bits); + mxcode = MAXCODE(n_bits); } - - /* + + /* * Invalidate old hash table entry using * this code, and then take it over. */ - dictp2 = dict_ptr (db, max_ent + 1); + dictp2 = dict_ptr(db, max_ent + 1); indx = dictp2->cptr; - dictp3 = dict_ptr (db, indx); + dictp3 = dict_ptr(db, indx); if (dictp3->codem1 == max_ent) dictp3->codem1 = BADCODEM1; @@ -571,17 +571,17 @@ nomatch: db->max_ent = ++max_ent; if (db->lens) { - unsigned short *len1 = lens_ptr (db, max_ent); - unsigned short *len2 = lens_ptr (db, ent); + unsigned short *len1 = lens_ptr(db, max_ent); + unsigned short *len2 = lens_ptr(db, ent); *len1 = *len2 + 1; } } ent = c; } - + OUTPUT(ent); /* output the last code */ - if(skb_out) + if (skb_out) db->bytes_out += skb_out->len; /* Do not count bytes from here */ db->uncomp_bytes += isize; db->in_count += isize; @@ -596,15 +596,15 @@ nomatch: */ if (bsd_check(db)) - OUTPUT (CLEAR); + OUTPUT(CLEAR); /* * Pad dribble bits of last code with ones. * Do not emit a completely useless byte of ones. */ - if (bitno < 32 && skb_out && skb_tailroom(skb_out) > 0) - *(skb_put(skb_out,1)) = (unsigned char) ((accm | (0xff << (bitno-8))) >> 24); - + if (bitno < 32 && skb_out && skb_tailroom(skb_out) > 0) + *(skb_put(skb_out, 1)) = (unsigned char)((accm | (0xff << (bitno - 8))) >> 24); + /* * Increase code size if we would have without the packet * boundary because the decompressor will do so. @@ -613,7 +613,7 @@ nomatch: db->n_bits++; /* If output length is too large then this is an incompressible frame. */ - if (!skb_out || (skb_out && skb_out->len >= skb_in->len) ) { + if (!skb_out || (skb_out && skb_out->len >= skb_in->len)) { ++db->incomp_count; db->incomp_bytes += isize; return 0; @@ -631,16 +631,16 @@ nomatch: * Update the "BSD Compress" dictionary on the receiver for * incompressible data by pretending to compress the incoming data. */ -static void bsd_incomp (void *state, struct sk_buff *skb_in,int proto) +static void bsd_incomp(void *state, struct sk_buff *skb_in, int proto) { - bsd_compress (state, skb_in, NULL, proto); + bsd_compress(state, skb_in, NULL, proto); } /* * Decompress "BSD Compress". */ -static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff *skb_out, - struct isdn_ppp_resetparams *rsparm) +static int bsd_decompress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out, + struct isdn_ppp_resetparams *rsparm) { struct bsd_db *db; unsigned int max_ent; @@ -653,7 +653,7 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff * unsigned int incode; unsigned int oldcode; unsigned int finchar; - unsigned char *p,*ibuf; + unsigned char *p, *ibuf; int ilen; int codelen; int extra; @@ -667,20 +667,20 @@ static int bsd_decompress (void *state, struct sk_buff *skb_in, struct sk_buff * printk(KERN_DEBUG "bsd_decompress called\n"); - if(!skb_in || !skb_out) { + if (!skb_in || !skb_out) { printk(KERN_ERR "bsd_decompress called with NULL parameter\n"); return DECOMP_ERROR; } - + /* * Get the sequence number. */ - if( (p |