Commit d79df0b1 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (577 commits)
  Staging: ramzswap: Handler for swap slot free callback
  swap: Add swap slot free callback to block_device_operations
  swap: Add flag to identify block swap devices
  Staging: vt6655: use ETH_FRAME_LEN macro instead of custom one
  Staging: vt6655: use ETH_DATA_LEN macro instead of custom one
  Staging: vt6655: use ETH_FCS_LEN macro instead of custom one
  Staging: vt6656: use ETH_HLEN macro instead of custom one
  Staging: comedi: quatech_daqp_cs.c Replace eos semaphore with a completion.
  Staging: dt3155v4l: remove private memory allocator
  Staging: crystalhd: Remove typedefs from driver
  Staging: winbond: Fix for pointer name format issue in mds.c
  Staging: vt6656: removed custom UCHAR/USHORT/UINT/ULONG/ULONGLONG typedefs
  Staging: vt6656: removed custom CHAR/SHORT/INT/LONG typedefs
  Staging: comedi: Altered the way printk is used in 8255.c
  staging: iio: adis16350 and similar IMU driver
  Staging: iio: max1363 Fix two bugs in single_channel_from_ring
  Staging: iio: adis16220 extract bin_attribute structures from state
  Staging: iio: adis16220 vibration sensor driver
  Staging: comedi: Kconfig dependancy fixes
  Staging: comedi: fix up build error from last Kconfig changes
  ...
parents 6e80e8ed c8d1a126
...@@ -59,8 +59,6 @@ source "drivers/staging/wlan-ng/Kconfig" ...@@ -59,8 +59,6 @@ source "drivers/staging/wlan-ng/Kconfig"
source "drivers/staging/echo/Kconfig" source "drivers/staging/echo/Kconfig"
source "drivers/staging/poch/Kconfig"
source "drivers/staging/otus/Kconfig" source "drivers/staging/otus/Kconfig"
source "drivers/staging/rt2860/Kconfig" source "drivers/staging/rt2860/Kconfig"
...@@ -113,6 +111,8 @@ source "drivers/staging/vme/Kconfig" ...@@ -113,6 +111,8 @@ source "drivers/staging/vme/Kconfig"
source "drivers/staging/rar_register/Kconfig" source "drivers/staging/rar_register/Kconfig"
source "drivers/staging/memrar/Kconfig"
source "drivers/staging/sep/Kconfig" source "drivers/staging/sep/Kconfig"
source "drivers/staging/iio/Kconfig" source "drivers/staging/iio/Kconfig"
...@@ -127,19 +127,19 @@ source "drivers/staging/batman-adv/Kconfig" ...@@ -127,19 +127,19 @@ source "drivers/staging/batman-adv/Kconfig"
source "drivers/staging/samsung-laptop/Kconfig" source "drivers/staging/samsung-laptop/Kconfig"
source "drivers/staging/strip/Kconfig" source "drivers/staging/sm7xx/Kconfig"
source "drivers/staging/arlan/Kconfig" source "drivers/staging/dt3155/Kconfig"
source "drivers/staging/wavelan/Kconfig" source "drivers/staging/dt3155v4l/Kconfig"
source "drivers/staging/netwave/Kconfig" source "drivers/staging/crystalhd/Kconfig"
source "drivers/staging/sm7xx/Kconfig" source "drivers/staging/cxt1e1/Kconfig"
source "drivers/staging/dt3155/Kconfig" source "drivers/staging/ti-st/Kconfig"
source "drivers/staging/crystalhd/Kconfig" source "drivers/staging/adis16255/Kconfig"
endif # !STAGING_EXCLUDE_BUILD endif # !STAGING_EXCLUDE_BUILD
endif # STAGING endif # STAGING
...@@ -12,7 +12,6 @@ obj-$(CONFIG_USB_IP_COMMON) += usbip/ ...@@ -12,7 +12,6 @@ obj-$(CONFIG_USB_IP_COMMON) += usbip/
obj-$(CONFIG_W35UND) += winbond/ obj-$(CONFIG_W35UND) += winbond/
obj-$(CONFIG_PRISM2_USB) += wlan-ng/ obj-$(CONFIG_PRISM2_USB) += wlan-ng/
obj-$(CONFIG_ECHO) += echo/ obj-$(CONFIG_ECHO) += echo/
obj-$(CONFIG_POCH) += poch/
obj-$(CONFIG_OTUS) += otus/ obj-$(CONFIG_OTUS) += otus/
obj-$(CONFIG_RT2860) += rt2860/ obj-$(CONFIG_RT2860) += rt2860/
obj-$(CONFIG_RT2870) += rt2870/ obj-$(CONFIG_RT2870) += rt2870/
...@@ -37,6 +36,7 @@ obj-$(CONFIG_FB_UDL) += udlfb/ ...@@ -37,6 +36,7 @@ obj-$(CONFIG_FB_UDL) += udlfb/
obj-$(CONFIG_HYPERV) += hv/ obj-$(CONFIG_HYPERV) += hv/
obj-$(CONFIG_VME_BUS) += vme/ obj-$(CONFIG_VME_BUS) += vme/
obj-$(CONFIG_RAR_REGISTER) += rar_register/ obj-$(CONFIG_RAR_REGISTER) += rar_register/
obj-$(CONFIG_MRST_RAR_HANDLER) += memrar/
obj-$(CONFIG_DX_SEP) += sep/ obj-$(CONFIG_DX_SEP) += sep/
obj-$(CONFIG_IIO) += iio/ obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_RAMZSWAP) += ramzswap/ obj-$(CONFIG_RAMZSWAP) += ramzswap/
...@@ -44,11 +44,10 @@ obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ ...@@ -44,11 +44,10 @@ obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/
obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/
obj-$(CONFIG_BATMAN_ADV) += batman-adv/ obj-$(CONFIG_BATMAN_ADV) += batman-adv/
obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop/ obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop/
obj-$(CONFIG_STRIP) += strip/
obj-$(CONFIG_ARLAN) += arlan/
obj-$(CONFIG_WAVELAN) += wavelan/
obj-$(CONFIG_PCMCIA_WAVELAN) += wavelan/
obj-$(CONFIG_PCMCIA_NETWAVE) += netwave/
obj-$(CONFIG_FB_SM7XX) += sm7xx/ obj-$(CONFIG_FB_SM7XX) += sm7xx/
obj-$(CONFIG_DT3155) += dt3155/ obj-$(CONFIG_DT3155) += dt3155/
obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/
obj-$(CONFIG_CRYSTALHD) += crystalhd/ obj-$(CONFIG_CRYSTALHD) += crystalhd/
obj-$(CONFIG_CXT1E1) += cxt1e1/
obj-$(CONFIG_TI_ST) += ti-st/
obj-$(CONFIG_ADIS16255) += adis16255/
config ADIS16255
tristate "Ananlog Devices ADIS16250/16255"
depends on SPI && SYSFS
---help---
If you say yes here you get support for the Analog Devices
ADIS16250/16255 Low Power Gyroscope. The driver exposes
orientation and gyroscope value, as well as sample rate
to the sysfs.
This driver can also be built as a module. If so, the module
will be called adis16255.
obj-$(CONFIG_ADIS16255) += adis16255.o
This diff is collapsed.
#ifndef ADIS16255_H
#define ADIS16255_H
#include <linux/types.h>
struct adis16255_init_data {
char direction;
u8 negative;
int irq;
};
#endif
config ARLAN
tristate "Aironet Arlan 655 & IC2200 DS support"
depends on ISA && !64BIT && WLAN
select WIRELESS_EXT
---help---
Aironet makes Arlan, a class of wireless LAN adapters. These use the
www.Telxon.com chip, which is also used on several similar cards.
This driver is tested on the 655 and IC2200 series cards. Look at
<http://www.ylenurme.ee/~elmer/655/> for the latest information.
The driver is built as two modules, arlan and arlan-proc. The latter
is the /proc interface and is not needed most of time.
On some computers the card ends up in non-valid state after some
time. Use a ping-reset script to clear it.
obj-$(CONFIG_ARLAN) += arlan.o
arlan-objs := arlan-main.o arlan-proc.o
TODO:
- step up and maintain this driver to ensure that it continues
to work. Having the hardware for this is pretty much a
requirement. If this does not happen, the will be removed in
the 2.6.35 kernel release.
Please send patches to Greg Kroah-Hartman <greg@kroah.com>.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
batman-adv 0.2.1:
* support latest kernels (2.6.20 - 2.6.33)
* receive packets directly using skbs, remove old sockets and threads
* fix various regressions in the vis server
* don't disable interrupts while sending
* replace internal logging mechanism with standard kernel logging
* move vis formats into userland, one general format remains in the kernel
* allow MAC address to be set, correctly initialize them
* code refactoring and cleaning for coding style
* many bugs (null pointers, locking, hash iterators) squashed
-- Sun, 21 Mar 2010 20:46:47 +0100
batman-adv 0.2: batman-adv 0.2:
* support latest kernels (2.6.20 - 2.6.31) * support latest kernels (2.6.20 - 2.6.31)
......
# #
# Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: # Copyright (C) 2007-2010 B.A.T.M.A.N. contributors:
# #
# Marek Lindner, Simon Wunderlich # Marek Lindner, Simon Wunderlich
# #
...@@ -19,4 +19,4 @@ ...@@ -19,4 +19,4 @@
# #
obj-m += batman-adv.o obj-m += batman-adv.o
batman-adv-objs := main.o proc.o send.o routing.o soft-interface.o device.o translation-table.o bitarray.o hash.o ring_buffer.o vis.o hard-interface.o aggregation.o originator.o batman-adv-objs := main.o send.o routing.o soft-interface.o device.o translation-table.o bitarray.o hash.o ring_buffer.o vis.o hard-interface.o aggregation.o originator.o bat_sysfs.o
This diff is collapsed.
=> proc interface Request a review.
* implement new interface to add/delete interfaces and setting options Process the comments from the review.
* /proc/sys/net/batman-adv/ as main folder Move into mainline proper.
* in interfaces/ list every available interface of the host
* each interfaces/$iface/ contains the following files:
-> enable (def: 0) [add/remove this interface to batman-adv]
-> ogm_interval (def: 1000) [ogm interval of that interface]
-> context (def: bat0) [later we want to support multiple mesh instances via
-> bat0/bat1/bat2/..]
-> status (read-only) [outputs the interface status from batman's
-> perspective]
* in mesh/batX/ list every available mesh subnet
-> vis_server (def: 0) [enable/disable vis server for that mesh]
-> vis_data (read-only) [outputs the vis data in a raw format]
-> aggregate_ogm (def: 1) [enable/disable ogm aggregation for that mesh]
-> originators (read-only) [outputs the originator table]
-> transtable_global (read-only) [outputs the global translation table]
-> transtable_local (read-only) [outputs the local translation table]
=> fix checkpatch.pl errors
Please send all patches to: Please send all patches to:
Marek Lindner <lindner_marek@yahoo.de> Marek Lindner <lindner_marek@yahoo.de>
......
/* /*
* Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -52,6 +52,8 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet, ...@@ -52,6 +52,8 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet,
*/ */
if (time_before(send_time, forw_packet->send_time) && if (time_before(send_time, forw_packet->send_time) &&
time_after_eq(send_time + msecs_to_jiffies(MAX_AGGREGATION_MS),
forw_packet->send_time) &&
(aggregated_bytes <= MAX_AGGREGATION_BYTES)) { (aggregated_bytes <= MAX_AGGREGATION_BYTES)) {
/** /**
...@@ -79,14 +81,21 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet, ...@@ -79,14 +81,21 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet,
* interface only - we still can aggregate */ * interface only - we still can aggregate */
if ((directlink) && if ((directlink) &&
(new_batman_packet->ttl == 1) && (new_batman_packet->ttl == 1) &&
(forw_packet->if_incoming == if_incoming)) (forw_packet->if_incoming == if_incoming) &&
return true;
/* packets from direct neighbors or
* own secondary interface packets
* (= secondary interface packets in general) */
(batman_packet->flags & DIRECTLINK ||
(forw_packet->own &&
forw_packet->if_incoming->if_num != 0)))
return true;
} }
return false; return false;
} }
#define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0)
/* create a new aggregated packet and add this packet to it */ /* create a new aggregated packet and add this packet to it */
static void new_aggregated_packet(unsigned char *packet_buff, static void new_aggregated_packet(unsigned char *packet_buff,
int packet_len, int packet_len,
...@@ -98,13 +107,26 @@ static void new_aggregated_packet(unsigned char *packet_buff, ...@@ -98,13 +107,26 @@ static void new_aggregated_packet(unsigned char *packet_buff,
struct forw_packet *forw_packet_aggr; struct forw_packet *forw_packet_aggr;
unsigned long flags; unsigned long flags;
/* own packet should always be scheduled */
if (!own_packet) {
if (!atomic_dec_not_zero(&batman_queue_left)) {
bat_dbg(DBG_BATMAN, "batman packet queue full\n");
return;
}
}
forw_packet_aggr = kmalloc(sizeof(struct forw_packet), GFP_ATOMIC); forw_packet_aggr = kmalloc(sizeof(struct forw_packet), GFP_ATOMIC);
if (!forw_packet_aggr) if (!forw_packet_aggr) {
if (!own_packet)
atomic_inc(&batman_queue_left);
return; return;
}
forw_packet_aggr->packet_buff = kmalloc(MAX_AGGREGATION_BYTES, forw_packet_aggr->packet_buff = kmalloc(MAX_AGGREGATION_BYTES,
GFP_ATOMIC); GFP_ATOMIC);
if (!forw_packet_aggr->packet_buff) { if (!forw_packet_aggr->packet_buff) {
if (!own_packet)
atomic_inc(&batman_queue_left);
kfree(forw_packet_aggr); kfree(forw_packet_aggr);
return; return;
} }
...@@ -157,7 +179,8 @@ static void aggregate(struct forw_packet *forw_packet_aggr, ...@@ -157,7 +179,8 @@ static void aggregate(struct forw_packet *forw_packet_aggr,
(1 << forw_packet_aggr->num_packets); (1 << forw_packet_aggr->num_packets);
} }
void add_bat_packet_to_list(unsigned char *packet_buff, int packet_len, void add_bat_packet_to_list(struct bat_priv *bat_priv,
unsigned char *packet_buff, int packet_len,
struct batman_if *if_incoming, char own_packet, struct batman_if *if_incoming, char own_packet,
unsigned long send_time) unsigned long send_time)
{ {
...@@ -175,7 +198,7 @@ void add_bat_packet_to_list(unsigned char *packet_buff, int packet_len, ...@@ -175,7 +198,7 @@ void add_bat_packet_to_list(unsigned char *packet_buff, int packet_len,
/* find position for the packet in the forward queue */ /* find position for the packet in the forward queue */
spin_lock_irqsave(&forw_bat_list_lock, flags); spin_lock_irqsave(&forw_bat_list_lock, flags);
/* own packets are not to be aggregated */ /* own packets are not to be aggregated */
if ((atomic_read(&aggregation_enabled)) && (!own_packet)) { if ((atomic_read(&bat_priv->aggregation_enabled)) && (!own_packet)) {
hlist_for_each_entry(forw_packet_pos, tmp_node, &forw_bat_list, hlist_for_each_entry(forw_packet_pos, tmp_node, &forw_bat_list,
list) { list) {
if (can_aggregate_with(batman_packet, if (can_aggregate_with(batman_packet,
...@@ -195,6 +218,16 @@ void add_bat_packet_to_list(unsigned char *packet_buff, int packet_len, ...@@ -195,6 +218,16 @@ void add_bat_packet_to_list(unsigned char *packet_buff, int packet_len,
if (forw_packet_aggr == NULL) { if (forw_packet_aggr == NULL) {
/* the following section can run without the lock */ /* the following section can run without the lock */
spin_unlock_irqrestore(&forw_bat_list_lock, flags); spin_unlock_irqrestore(&forw_bat_list_lock, flags);
/**
* if we could not aggregate this packet with one of the others
* we hold it back for a while, so that it might be aggregated
* later on
*/
if ((!own_packet) &&
(atomic_read(&bat_priv->aggregation_enabled)))
send_time += msecs_to_jiffies(MAX_AGGREGATION_MS);
new_aggregated_packet(packet_buff, packet_len, new_aggregated_packet(packet_buff, packet_len,
send_time, direct_link, send_time, direct_link,
if_incoming, own_packet); if_incoming, own_packet);
......
/* /*
* Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -30,8 +30,9 @@ static inline int aggregated_packet(int buff_pos, int packet_len, int num_hna) ...@@ -30,8 +30,9 @@ static inline int aggregated_packet(int buff_pos, int packet_len, int num_hna)
(next_buff_pos <= MAX_AGGREGATION_BYTES); (next_buff_pos <= MAX_AGGREGATION_BYTES);
} }
void add_bat_packet_to_list(unsigned char *packet_buff, int packet_len, void add_bat_packet_to_list(struct bat_priv *bat_priv,
struct batman_if *if_outgoing, char own_packet, unsigned char *packet_buff, int packet_len,
struct batman_if *if_incoming, char own_packet,
unsigned long send_time); unsigned long send_time);
void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff,
int packet_len, struct batman_if *if_incoming); int packet_len, struct batman_if *if_incoming);
This diff is collapsed.
/* /*
* Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2010 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public * modify it under the terms of version 2 of the GNU General Public
...@@ -19,22 +19,11 @@ ...@@ -19,22 +19,11 @@
* *
*/ */
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#define PROC_ROOT_DIR "batman-adv" #define SYSFS_IF_MESH_SUBDIR "mesh"
#define PROC_FILE_INTERFACES "interfaces" #define SYSFS_IF_BAT_SUBDIR "batman_adv"
#define PROC_FILE_ORIG_INTERVAL "orig_interval"
#define PROC_FILE_ORIGINATORS "originators"
#define PROC_FILE_GATEWAYS "gateways"
#define PROC_FILE_LOG "log"
#define PROC_FILE_LOG_LEVEL "log_level"
#define PROC_FILE_TRANST_LOCAL "transtable_local"
#define PROC_FILE_TRANST_GLOBAL "transtable_global"
#define PROC_FILE_VIS_SRV "vis_server"
#define PROC_FILE_VIS_DATA "vis_data"
#define PROC_FILE_AGGR "aggregate_ogm"
void cleanup_procfs(void);
int setup_procfs(void);
int sysfs_add_meshif(struct net_device *dev);
void sysfs_del_meshif(struct net_device *dev);
int sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev);
void sysfs_del_hardif(struct kobject **hardif_obj);
/* /*
* Copyright (C) 2006-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2006-2010 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
* *
...@@ -68,7 +68,7 @@ void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n) ...@@ -68,7 +68,7 @@ void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n)
int32_t word_offset, word_num; int32_t word_offset, word_num;
int32_t i; int32_t i;
if (n <= 0) if (n <= 0 || n >= TQ_LOCAL_WINDOW_SIZE)
return; return;
word_offset = n % WORD_BIT_SIZE;/* shift how much inside each word */ word_offset = n % WORD_BIT_SIZE;/* shift how much inside each word */
...@@ -111,48 +111,76 @@ void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n) ...@@ -111,48 +111,76 @@ void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n)
seq_bits[i] = 0; seq_bits[i] = 0;
} }
static void bit_reset_window(TYPE_OF_WORD *seq_bits)
{
int i;
for (i = 0; i < NUM_WORDS; i++)
seq_bits[i] = 0;
}
/* receive and process one packet, returns 1 if received seq_num is considered /* receive and process one packet within the sequence number window.
* new, 0 if old */ *
* returns:
* 1 if the window was moved (either new or very old)
* 0 if the window was not moved/shifted.
*/
char bit_get_packet(TYPE_OF_WORD *seq_bits, int16_t seq_num_diff, char bit_get_packet(TYPE_OF_WORD *seq_bits, int16_t seq_num_diff,
int8_t set_mark) int8_t set_mark)
{ {
int i; /* sequence number is slightly older. We already got a sequence number
* higher than this one, so we just mark it. */
/* we already got a sequence number higher than this one, so we just if ((seq_num_diff <= 0) && (seq_num_diff > -TQ_LOCAL_WINDOW_SIZE)) {
* mark it. this should wrap around the integer just fine */
if ((seq_num_diff < 0) && (seq_num_diff >= -TQ_LOCAL_WINDOW_SIZE)) {
if (set_mark) if (set_mark)
bit_mark(seq_bits, -seq_num_diff); bit_mark(seq_bits, -seq_num_diff);
return 0; return 0;
} }
/* it seems we missed a lot of packets or the other host restarted */ /* sequence number is slightly newer, so we shift the window and
if ((seq_num_diff > TQ_LOCAL_WINDOW_SIZE) || * set the mark if required */
(seq_num_diff < -TQ_LOCAL_WINDOW_SIZE)) {
if ((seq_num_diff > 0) && (seq_num_diff < TQ_LOCAL_WINDOW_SIZE)) {
bit_shift(seq_bits, seq_num_diff);
if (set_mark)
bit_mark(seq_bits, 0);
return 1;
}
/* sequence number is much newer, probably missed a lot of packets */
if (seq_num_diff > TQ_LOCAL_WINDOW_SIZE) if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE)
|| (seq_num_diff < EXPECTED_SEQNO_RANGE)) {
bat_dbg(DBG_BATMAN, bat_dbg(DBG_BATMAN,
"We missed a lot of packets (%i) !\n", "We missed a lot of packets (%i) !\n",
seq_num_diff-1); seq_num_diff - 1);
bit_reset_window(seq_bits);
if (set_mark)
bit_mark(seq_bits, 0);
return 1;
}
if (-seq_num_diff > TQ_LOCAL_WINDOW_SIZE) /* received a much older packet. The other host either restarted
bat_dbg(DBG_BATMAN, * or the old packet got delayed somewhere in the network. The
"Other host probably restarted !\n"); * packet should be dropped without calling this function if the
* seqno window is protected. */
for (i = 0; i < NUM_WORDS; i++) if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE)
seq_bits[i] = 0; || (seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
if (set_mark) bat_dbg(DBG_BATMAN,
seq_bits[0] = 1; /* we only have the latest packet */ "Other host probably restarted!\n");
} else {
bit_shift(seq_bits, seq_num_diff);
bit_reset_window(seq_bits);
if (set_mark) if (set_mark)
bit_mark(seq_bits, 0); bit_mark(seq_bits, 0);
}
return 1; return 1;
}
/* never reached */
return 0;
} }
/* count the hamming weight, how many good packets did we receive? just count /* count the hamming weight, how many good packets did we receive? just count
......
/* /*
* Copyright (C) 2006-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2006-2010 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
* *
......
/* /*
* Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
...@@ -44,10 +44,7 @@ static struct device_client *device_client_hash[256]; ...@@ -44,10 +44,7 @@ static struct device_client *device_client_hash[256];
void bat_device_init(void) void bat_device_init(void)
{ {
int i; memset(device_client_hash, 0, sizeof(device_client_hash));
for (i = 0; i < 256; i++)
device_client_hash[i] = NULL;
} }
int bat_device_setup(void) int bat_device_setup(void)
...@@ -60,7 +57,8 @@ int bat_device_setup(void) ...@@ -60,7 +57,8 @@ int bat_device_setup(void)
/* register our device - kernel assigns a free major number */ /* register our device - kernel assigns a free major number */
tmp_major = register_chrdev(0, DRIVER_DEVICE, &fops); tmp_major = register_chrdev(0, DRIVER_DEVICE, &fops);
if (tmp_major < 0) { if (tmp_major < 0) {
printk(KERN_ERR "batman-adv:Registering the character device failed with %d\n", printk(KERN_ERR "batman-adv:"
"Registering the character device failed with %d\n",
tmp_major); tmp_major);
return 0; return 0;
} }
...@@ -68,7 +66,8 @@ int bat_device_setup(void) ...@@ -68,7 +66,8 @@ int bat_device_setup(void)
batman_class = class_create(THIS_MODULE, "batman-adv"); batman_class = class_create(THIS_MODULE, "batman-adv");
if (IS_ERR(batman_class)) { if (IS_ERR(batman_class)) {
printk(KERN_ERR "batman-adv:Could not register class 'batman-adv' \n"); printk(KERN_ERR "batman-adv:"
"Could not register class 'batman-adv'\n");
return 0; return 0;
} }
...@@ -103,15 +102,17 @@ int bat_device_open(struct inode *inode, struct file *file) ...@@ -103,15 +102,17 @@ int bat_device_open(struct inode *inode, struct file *file)
if (!device_client) if (!device_client)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < 256; i++) { for (i = 0; i < ARRAY_SIZE(device_client_hash); i++) {
if (!device_client_hash[i]) { if (!device_client_hash[i]) {
device_client_hash[i] = device_client; device_client_hash[i] = device_client;
break; break;
} }
} }
if (device_client_hash[i] != device_client) { if (i == ARRAY_SIZE(device_client_hash)) {
printk(KERN_ERR "batman-adv:Error - can't add another packet client: maximum number of clients reached \n"); printk(KERN_ERR "batman-adv:"
"Error - can't add another packet client: "
"maximum number of clients reached\n");
kfree(device_client); kfree(device_client);
return -EXFULL; return -EXFULL;
} }
...@@ -212,7 +213,9 @@ ssize_t bat_device_write(struct file *file, const char __user *buff, ...@@ -212,7 +213,9 @@ ssize_t bat_device_write(struct file *file, const char __user *buff,
unsigned long flags; unsigned long flags;
if (len < sizeof(struct icmp_packet)) { if (len < sizeof(struct icmp_packet)) {
bat_dbg(DBG_BATMAN, "batman-adv:Error - can't send packet from char device: invalid packet size\n"); bat_dbg(DBG_BATMAN, "batman-adv:"
"Error - can't send packet from char device: "
"invalid packet size\n");
return -EINVAL; return -EINVAL;
} }
...@@ -223,12 +226,16 @@ ssize_t bat_device_write(struct file *file, const char __user *buff, ...@@ -223,12 +226,16 @@ ssize_t bat_device_write(struct file *file, const char __user *buff,
return -EFAULT; return -EFAULT;
if (icmp_packet.packet_type != BAT_ICMP) { if (icmp_packet.packet_type != BAT_ICMP) {
bat_dbg(DBG_BATMAN, "batman-adv:Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n"); bat_dbg(DBG_BATMAN, "batman-adv:"
"Error - can't send packet from char device: "
"got bogus packet type (expected: BAT_ICMP)\n");
return -EINVAL; return -EINVAL;
} }
if (icmp_packet.msg_type != ECHO_REQUEST) { if (icmp_packet.msg_type != ECHO_REQUEST) {
bat_dbg(DBG_BATMAN, "batman-adv:Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n"); bat_dbg(DBG_BATMAN, "batman-adv:"
"Error - can't send packet from char device: "
"got bogus message type (expected: ECHO_REQUEST)\n");
return -EINVAL; return -EINVAL;
} }
...@@ -253,7 +260,7 @@ ssize_t bat_device_write(struct file *file, const char __user *buff, ...@@ -253,7 +260,7 @@ ssize_t bat_device_write(struct file *file, const char __user *buff,
if (!orig_node->router) if (!orig_node->router)
goto unlock; goto unlock;
batman_if = orig_node->batman_if; batman_if = orig_node->router->if_incoming;
memcpy(dstaddr, orig_node->router->addr, ETH_ALEN); memcpy(dstaddr, orig_node->router->addr, ETH_ALEN);
spin_unlock_irqrestore(&orig_hash_lock, flags); spin_unlock_irqrestore(&orig_hash_lock, flags);
...@@ -261,7 +268,7 @@ ssize_t bat_device_write(struct file *file, const char __user *buff, ...@@ -261,7 +268,7 @@ ssize_t bat_device_write(struct file *file, const char __user *buff,
if (!batman_if) if (!batman_if)
goto dst_unreach; goto dst_unreach;
if (batman_if->if_active != IF_ACTIVE) if (batman_if->if_status != IF_ACTIVE)
goto dst_unreach; goto dst_unreach;
memcpy(icmp_packet.orig, memcpy(icmp_packet.orig,
......
/* /*
* Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors:
* *
* Marek Lindner * Marek Lindner
* *
......
This diff is collapsed.
/* /*
* Copyright (C) 2007-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2007-2010 B.A.T.M.A.N. contributors:
* *
* Marek Lindner, Simon Wunderlich * Marek Lindner, Simon Wunderlich
* *
...@@ -19,19 +19,19 @@ ...@@ -19,19 +19,19 @@
* *
*/ */
#define IF_INACTIVE 0 #define IF_NOT_IN_USE 0
#define IF_ACTIVE 1 #define IF_TO_BE_REMOVED 1
/* #define IF_TO_BE_DEACTIVATED 2 - not needed anymore */ #define IF_INACTIVE 2
#define IF_TO_BE_ACTIVATED 3 #define IF_ACTIVE 3
#define IF_TO_BE_ACTIVATED 4
#define IF_I_WANT_YOU 5
extern struct notifier_block hard_if_notifier; extern struct notifier_block hard_if_notifier;
struct batman_if *get_batman_if_by_netdev(struct net_device *net_dev);
int hardif_enable_interface(struct batman_if *batman_if);
void hardif_disable_interface(struct batman_if *batman_if);
void hardif_remove_interfaces(void); void hardif_remove_interfaces(void);
int hardif_add_interface(char *dev, int if_num);
void hardif_deactivate_interface(struct batman_if *batman_if);
char hardif_get_active_if_num(void);
void hardif_check_interfaces_status(void);
void hardif_check_interfaces_status_wq(struct work_struct *work);
int batman_skb_recv(struct sk_buff *skb, int batman_skb_recv(struct sk_buff *skb,
struct net_device *dev, struct net_device *dev,
struct packet_type *ptype, struct packet_type *ptype,
......
/* /*
* Copyright (C) 2006-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2006-2010 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
* *
......
/* /*
* Copyright (C) 2006-2009 B.A.T.M.A.N. contributors: * Copyright (C) 2006-2010 B.A.T.M.A.N. contributors:
* *
* Simon Wunderlich, Marek Lindner * Simon Wunderlich, Marek Lindner
* *
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment