Commit 6018e118 authored by David S. Miller's avatar David S. Miller

Merge branch 'batman-adv/next' of git://git.open-mesh.org/ecsv/linux-merge

parents 075cd29e ecbd5321
...@@ -151,7 +151,7 @@ static void new_aggregated_packet(const unsigned char *packet_buff, ...@@ -151,7 +151,7 @@ static void new_aggregated_packet(const unsigned char *packet_buff,
forw_packet_aggr->own = own_packet; forw_packet_aggr->own = own_packet;
forw_packet_aggr->if_incoming = if_incoming; forw_packet_aggr->if_incoming = if_incoming;
forw_packet_aggr->num_packets = 0; forw_packet_aggr->num_packets = 0;
forw_packet_aggr->direct_link_flags = 0; forw_packet_aggr->direct_link_flags = NO_FLAGS;
forw_packet_aggr->send_time = send_time; forw_packet_aggr->send_time = send_time;
/* save packet direct link flag status */ /* save packet direct link flag status */
......
...@@ -28,9 +28,17 @@ ...@@ -28,9 +28,17 @@
#include "gateway_client.h" #include "gateway_client.h"
#include "vis.h" #include "vis.h"
#define to_dev(obj) container_of(obj, struct device, kobj) static struct net_device *kobj_to_netdev(struct kobject *obj)
#define kobj_to_netdev(obj) to_net_dev(to_dev(obj->parent)) {
#define kobj_to_batpriv(obj) netdev_priv(kobj_to_netdev(obj)) struct device *dev = container_of(obj->parent, struct device, kobj);
return to_net_dev(dev);
}
static struct bat_priv *kobj_to_batpriv(struct kobject *obj)
{
struct net_device *net_dev = kobj_to_netdev(obj);
return netdev_priv(net_dev);
}
/* Use this, if you have customized show and store functions */ /* Use this, if you have customized show and store functions */
#define BAT_ATTR(_name, _mode, _show, _store) \ #define BAT_ATTR(_name, _mode, _show, _store) \
......
...@@ -322,7 +322,7 @@ void gw_node_update(struct bat_priv *bat_priv, ...@@ -322,7 +322,7 @@ void gw_node_update(struct bat_priv *bat_priv,
gw_node->deleted = 0; gw_node->deleted = 0;
if (new_gwflags == 0) { if (new_gwflags == NO_FLAGS) {
gw_node->deleted = jiffies; gw_node->deleted = jiffies;
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
"Gateway %pM removed from gateway list\n", "Gateway %pM removed from gateway list\n",
...@@ -335,7 +335,7 @@ void gw_node_update(struct bat_priv *bat_priv, ...@@ -335,7 +335,7 @@ void gw_node_update(struct bat_priv *bat_priv,
goto unlock; goto unlock;
} }
if (new_gwflags == 0) if (new_gwflags == NO_FLAGS)
goto unlock; goto unlock;
gw_node_add(bat_priv, orig_node, new_gwflags); gw_node_add(bat_priv, orig_node, new_gwflags);
...@@ -352,7 +352,7 @@ void gw_node_update(struct bat_priv *bat_priv, ...@@ -352,7 +352,7 @@ void gw_node_update(struct bat_priv *bat_priv,
void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node) void gw_node_delete(struct bat_priv *bat_priv, struct orig_node *orig_node)
{ {
return gw_node_update(bat_priv, orig_node, 0); gw_node_update(bat_priv, orig_node, 0);
} }
void gw_node_purge(struct bat_priv *bat_priv) void gw_node_purge(struct bat_priv *bat_priv)
......
...@@ -97,7 +97,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff, ...@@ -97,7 +97,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff,
*tmp_ptr = '\0'; *tmp_ptr = '\0';
} }
ret = strict_strtoul(buff, 10, &ldown); ret = strict_strtol(buff, 10, &ldown);
if (ret) { if (ret) {
bat_err(net_dev, bat_err(net_dev,
"Download speed of gateway mode invalid: %s\n", "Download speed of gateway mode invalid: %s\n",
...@@ -122,7 +122,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff, ...@@ -122,7 +122,7 @@ static bool parse_gw_bandwidth(struct net_device *net_dev, char *buff,
*tmp_ptr = '\0'; *tmp_ptr = '\0';
} }
ret = strict_strtoul(slash_ptr + 1, 10, &lup); ret = strict_strtol(slash_ptr + 1, 10, &lup);
if (ret) { if (ret) {
bat_err(net_dev, bat_err(net_dev,
"Upload speed of gateway mode invalid: " "Upload speed of gateway mode invalid: "
......
...@@ -337,7 +337,7 @@ int hardif_enable_interface(struct hard_iface *hard_iface, ...@@ -337,7 +337,7 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
batman_packet = (struct batman_packet *)(hard_iface->packet_buff); batman_packet = (struct batman_packet *)(hard_iface->packet_buff);
batman_packet->packet_type = BAT_PACKET; batman_packet->packet_type = BAT_PACKET;
batman_packet->version = COMPAT_VERSION; batman_packet->version = COMPAT_VERSION;
batman_packet->flags = 0; batman_packet->flags = NO_FLAGS;
batman_packet->ttl = 2; batman_packet->ttl = 2;
batman_packet->tq = TQ_MAX_VALUE; batman_packet->tq = TQ_MAX_VALUE;
batman_packet->num_tt = 0; batman_packet->num_tt = 0;
......
...@@ -22,12 +22,14 @@ ...@@ -22,12 +22,14 @@
#ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_ #ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_
#define _NET_BATMAN_ADV_HARD_INTERFACE_H_ #define _NET_BATMAN_ADV_HARD_INTERFACE_H_
#define IF_NOT_IN_USE 0 enum hard_if_state {
#define IF_TO_BE_REMOVED 1 IF_NOT_IN_USE,
#define IF_INACTIVE 2 IF_TO_BE_REMOVED,
#define IF_ACTIVE 3 IF_INACTIVE,
#define IF_TO_BE_ACTIVATED 4 IF_ACTIVE,
#define IF_I_WANT_YOU 5 IF_TO_BE_ACTIVATED,
IF_I_WANT_YOU
};
extern struct notifier_block hard_if_notifier; extern struct notifier_block hard_if_notifier;
......
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
#define TQ_LOCAL_BIDRECT_RECV_MINIMUM 1 #define TQ_LOCAL_BIDRECT_RECV_MINIMUM 1
#define TQ_TOTAL_BIDRECT_LIMIT 1 #define TQ_TOTAL_BIDRECT_LIMIT 1
#define NO_FLAGS 0
#define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE) #define NUM_WORDS (TQ_LOCAL_WINDOW_SIZE / WORD_BIT_SIZE)
#define LOG_BUF_LEN 8192 /* has to be a power of 2 */ #define LOG_BUF_LEN 8192 /* has to be a power of 2 */
...@@ -72,9 +74,11 @@ ...@@ -72,9 +74,11 @@
#define RESET_PROTECTION_MS 30000 #define RESET_PROTECTION_MS 30000
#define EXPECTED_SEQNO_RANGE 65536 #define EXPECTED_SEQNO_RANGE 65536
#define MESH_INACTIVE 0 enum mesh_state {
#define MESH_ACTIVE 1 MESH_INACTIVE,
#define MESH_DEACTIVATING 2 MESH_ACTIVE,
MESH_DEACTIVATING
};
#define BCAST_QUEUE_LEN 256 #define BCAST_QUEUE_LEN 256
#define BATMAN_QUEUE_LEN 256 #define BATMAN_QUEUE_LEN 256
...@@ -89,10 +93,11 @@ ...@@ -89,10 +93,11 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
/* all messages related to routing / flooding / broadcasting / etc */ /* all messages related to routing / flooding / broadcasting / etc */
#define DBG_BATMAN 1 enum dbg_level {
/* route or tt entry added / changed / deleted */ DBG_BATMAN = 1 << 0,
#define DBG_ROUTES 2 DBG_ROUTES = 1 << 1, /* route added / changed / deleted */
#define DBG_ALL 3 DBG_ALL = 3
};
/* /*
......
...@@ -24,33 +24,44 @@ ...@@ -24,33 +24,44 @@
#define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ #define ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */
#define BAT_PACKET 0x01 enum bat_packettype {
#define BAT_ICMP 0x02 BAT_PACKET = 0x01,
#define BAT_UNICAST 0x03 BAT_ICMP = 0x02,
#define BAT_BCAST 0x04 BAT_UNICAST = 0x03,
#define BAT_VIS 0x05 BAT_BCAST = 0x04,
#define BAT_UNICAST_FRAG 0x06 BAT_VIS = 0x05,
BAT_UNICAST_FRAG = 0x06
};
/* this file is included by batctl which needs these defines */ /* this file is included by batctl which needs these defines */
#define COMPAT_VERSION 12 #define COMPAT_VERSION 12
#define DIRECTLINK 0x40
#define VIS_SERVER 0x20 enum batman_flags {
#define PRIMARIES_FIRST_HOP 0x10 PRIMARIES_FIRST_HOP = 1 << 4,
VIS_SERVER = 1 << 5,
DIRECTLINK = 1 << 6
};
/* ICMP message types */ /* ICMP message types */
#define ECHO_REPLY 0 enum icmp_packettype {
#define DESTINATION_UNREACHABLE 3 ECHO_REPLY = 0,
#define ECHO_REQUEST 8 DESTINATION_UNREACHABLE = 3,
#define TTL_EXCEEDED 11 ECHO_REQUEST = 8,
#define PARAMETER_PROBLEM 12 TTL_EXCEEDED = 11,
PARAMETER_PROBLEM = 12
};
/* vis defines */ /* vis defines */
#define VIS_TYPE_SERVER_SYNC 0 enum vis_packettype {
#define VIS_TYPE_CLIENT_UPDATE 1 VIS_TYPE_SERVER_SYNC = 0,
VIS_TYPE_CLIENT_UPDATE = 1
};
/* fragmentation defines */ /* fragmentation defines */
#define UNI_FRAG_HEAD 0x01 enum unicast_frag_flags {
#define UNI_FRAG_LARGETAIL 0x02 UNI_FRAG_HEAD = 1 << 0,
UNI_FRAG_LARGETAIL = 1 << 1
};
struct batman_packet { struct batman_packet {
uint8_t packet_type; uint8_t packet_type;
......
...@@ -698,17 +698,16 @@ void receive_bat_packet(const struct ethhdr *ethhdr, ...@@ -698,17 +698,16 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
/* neighbor has to indicate direct link and it has to /* neighbor has to indicate direct link and it has to
* come via the corresponding interface */ * come via the corresponding interface */
/* if received seqno equals last send seqno save new /* save packet seqno for bidirectional check */
* seqno for bidirectional check */
if (has_directlink_flag && if (has_directlink_flag &&
compare_eth(if_incoming->net_dev->dev_addr, compare_eth(if_incoming->net_dev->dev_addr,
batman_packet->orig) && batman_packet->orig)) {
(batman_packet->seqno - if_incoming_seqno + 2 == 0)) {
offset = if_incoming->if_num * NUM_WORDS; offset = if_incoming->if_num * NUM_WORDS;
spin_lock_bh(&orig_neigh_node->ogm_cnt_lock); spin_lock_bh(&orig_neigh_node->ogm_cnt_lock);
word = &(orig_neigh_node->bcast_own[offset]); word = &(orig_neigh_node->bcast_own[offset]);
bit_mark(word, 0); bit_mark(word,
if_incoming_seqno - batman_packet->seqno - 2);
orig_neigh_node->bcast_own_sum[if_incoming->if_num] = orig_neigh_node->bcast_own_sum[if_incoming->if_num] =
bit_packet_count(word); bit_packet_count(word);
spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock); spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock);
......
...@@ -289,7 +289,7 @@ void schedule_own_packet(struct hard_iface *hard_iface) ...@@ -289,7 +289,7 @@ void schedule_own_packet(struct hard_iface *hard_iface)
batman_packet->gw_flags = batman_packet->gw_flags =
(uint8_t)atomic_read(&bat_priv->gw_bandwidth); (uint8_t)atomic_read(&bat_priv->gw_bandwidth);
else else
batman_packet->gw_flags = 0; batman_packet->gw_flags = NO_FLAGS;
atomic_inc(&hard_iface->seqno); atomic_inc(&hard_iface->seqno);
......
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