Skip to content

Commit

Permalink
Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge
Browse files Browse the repository at this point in the history
Included changes:
- remove useless return in void functions
- remove unused member 'primary_iface' from 'struct orig_node'
- improve existing kernel doc
- fix several checkpatch complaints
- ensure socket's control block is cleared for received skbs
- add missing DEBUG_FS dependency to BATMAN_ADV_DEBUG symbol

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jan 9, 2015
2 parents f40e74f + 9535395 commit fb57720
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 61 deletions.
1 change: 1 addition & 0 deletions net/batman-adv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ config BATMAN_ADV_MCAST
config BATMAN_ADV_DEBUG
bool "B.A.T.M.A.N. debugging"
depends on BATMAN_ADV
depends on DEBUG_FS
help
This is an option for use by developers; most people should
say N here. This enables compilation of support for
Expand Down
15 changes: 7 additions & 8 deletions net/batman-adv/bat_iv_ogm.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
#include "bat_algo.h"
#include "network-coding.h"


/**
* batadv_dup_status - duplicate status
* enum batadv_dup_status - duplicate status
* @BATADV_NO_DUP: the packet is a duplicate
* @BATADV_ORIG_DUP: OGM is a duplicate in the originator (but not for the
* neighbor)
Expand Down Expand Up @@ -517,7 +516,7 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet)
* @bat_priv: the bat priv with all the soft interface information
* @packet_len: (total) length of the OGM
* @send_time: timestamp (jiffies) when the packet is to be sent
* @direktlink: true if this is a direct link packet
* @directlink: true if this is a direct link packet
* @if_incoming: interface where the packet was received
* @if_outgoing: interface for which the retransmission should be considered
* @forw_packet: the forwarded packet which should be checked
Expand Down Expand Up @@ -879,7 +878,7 @@ batadv_iv_ogm_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
spin_lock_bh(&orig_node->bat_iv.ogm_cnt_lock);
word_index = hard_iface->if_num * BATADV_NUM_WORDS;
word = &(orig_node->bat_iv.bcast_own[word_index]);
word = &orig_node->bat_iv.bcast_own[word_index];

batadv_bit_get_packet(bat_priv, word, 1, 0);
if_num = hard_iface->if_num;
Expand Down Expand Up @@ -1362,10 +1361,10 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
return ret;
}


/**
* batadv_iv_ogm_process_per_outif - process a batman iv OGM for an outgoing if
* @skb: the skb containing the OGM
* @ogm_offset: offset from skb->data to start of ogm header
* @orig_node: the (cached) orig node for the originator of this OGM
* @if_incoming: the interface where this packet was received
* @if_outgoing: the interface for which the packet should be considered
Expand Down Expand Up @@ -1664,7 +1663,7 @@ static void batadv_iv_ogm_process(const struct sk_buff *skb, int ogm_offset,
offset = if_num * BATADV_NUM_WORDS;

spin_lock_bh(&orig_neigh_node->bat_iv.ogm_cnt_lock);
word = &(orig_neigh_node->bat_iv.bcast_own[offset]);
word = &orig_neigh_node->bat_iv.bcast_own[offset];
bit_pos = if_incoming_seqno - 2;
bit_pos -= ntohl(ogm_packet->seqno);
batadv_set_bit(word, bit_pos);
Expand Down Expand Up @@ -1902,10 +1901,10 @@ static int batadv_iv_ogm_neigh_cmp(struct batadv_neigh_node *neigh1,
* batadv_iv_ogm_neigh_is_eob - check if neigh1 is equally good or better than
* neigh2 from the metric prospective
* @neigh1: the first neighbor object of the comparison
* @if_outgoing: outgoing interface for the first neighbor
* @if_outgoing1: outgoing interface for the first neighbor
* @neigh2: the second neighbor object of the comparison
* @if_outgoing2: outgoing interface for the second neighbor
*
* Returns true if the metric via neigh1 is equally good or better than
* the metric via neigh2, false otherwise.
*/
Expand Down
1 change: 0 additions & 1 deletion net/batman-adv/bitarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ static void batadv_bitmap_shift_left(unsigned long *seq_bits, int32_t n)
bitmap_shift_left(seq_bits, seq_bits, n, BATADV_TQ_LOCAL_WINDOW_SIZE);
}


/* receive and process one packet within the sequence number window.
*
* returns:
Expand Down
3 changes: 1 addition & 2 deletions net/batman-adv/bitarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ static inline int batadv_test_bit(const unsigned long *seq_bits,
diff = last_seqno - curr_seqno;
if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE)
return 0;
else
return test_bit(diff, seq_bits) != 0;
return test_bit(diff, seq_bits) != 0;
}

/* turn corresponding bit on, so we can remember that we got the packet */
Expand Down
17 changes: 7 additions & 10 deletions net/batman-adv/bridge_loop_avoidance.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ static inline uint32_t batadv_choose_backbone_gw(const void *data,
return hash % size;
}


/* compares address and vid of two backbone gws */
static int batadv_compare_backbone_gw(const struct hlist_node *node,
const void *data2)
Expand Down Expand Up @@ -245,14 +244,14 @@ batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw)
spin_unlock_bh(list_lock);
}

/* all claims gone, intialize CRC */
/* all claims gone, initialize CRC */
backbone_gw->crc = BATADV_BLA_CRC_INIT;
}

/**
* batadv_bla_send_claim - sends a claim frame according to the provided info
* @bat_priv: the bat priv with all the soft interface information
* @orig: the mac address to be announced within the claim
* @mac: the mac address to be announced within the claim
* @vid: the VLAN ID
* @claimtype: the type of the claim (CLAIM, UNCLAIM, ANNOUNCE, ...)
*/
Expand Down Expand Up @@ -364,6 +363,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac,
* @bat_priv: the bat priv with all the soft interface information
* @orig: the mac address of the originator
* @vid: the VLAN ID
* @own_backbone: set if the requested backbone is local
*
* searches for the backbone gw or creates a new one if it could not
* be found.
Expand Down Expand Up @@ -454,6 +454,7 @@ batadv_bla_update_own_backbone_gw(struct batadv_priv *bat_priv,
/**
* batadv_bla_answer_request - answer a bla request by sending own claims
* @bat_priv: the bat priv with all the soft interface information
* @primary_if: interface where the request came on
* @vid: the vid where the request came on
*
* Repeat all of our own claims, and finally send an ANNOUNCE frame
Expand Down Expand Up @@ -660,7 +661,6 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv,
if (unlikely(!backbone_gw))
return 1;


/* handle as ANNOUNCE frame */
backbone_gw->lasttime = jiffies;
crc = ntohs(*((__be16 *)(&an_addr[4])));
Expand Down Expand Up @@ -775,6 +775,7 @@ static int batadv_handle_claim(struct batadv_priv *bat_priv,
/**
* batadv_check_claim_group
* @bat_priv: the bat priv with all the soft interface information
* @primary_if: the primary interface of this batman interface
* @hw_src: the Hardware source in the ARP Header
* @hw_dst: the Hardware destination in the ARP Header
* @ethhdr: pointer to the Ethernet header of the claim frame
Expand Down Expand Up @@ -846,10 +847,10 @@ static int batadv_check_claim_group(struct batadv_priv *bat_priv,
return 2;
}


/**
* batadv_bla_process_claim
* @bat_priv: the bat priv with all the soft interface information
* @primary_if: the primary hard interface of this batman soft interface
* @skb: the frame to be checked
*
* Check if this is a claim frame, and process it accordingly.
Expand Down Expand Up @@ -1327,7 +1328,7 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
goto out;
}
/* not found, add a new entry (overwrite the oldest entry)
* and allow it, its the first occurence.
* and allow it, its the first occurrence.
*/
curr = (bat_priv->bla.bcast_duplist_curr + BATADV_DUPLIST_SIZE - 1);
curr %= BATADV_DUPLIST_SIZE;
Expand All @@ -1343,8 +1344,6 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
return ret;
}



/**
* batadv_bla_is_backbone_gw_orig
* @bat_priv: the bat priv with all the soft interface information
Expand Down Expand Up @@ -1386,7 +1385,6 @@ bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig,
return false;
}


/**
* batadv_bla_is_backbone_gw
* @skb: the frame to be checked
Expand Down Expand Up @@ -1476,7 +1474,6 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
if (!atomic_read(&bat_priv->bridge_loop_avoidance))
goto allow;


if (unlikely(atomic_read(&bat_priv->bla.num_requests)))
/* don't allow broadcasts while requests are in flight */
if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast)
Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ static int batadv_debug_log_setup(struct batadv_priv *bat_priv)

static void batadv_debug_log_cleanup(struct batadv_priv *bat_priv)
{
return;
}
#endif

Expand Down Expand Up @@ -405,6 +404,7 @@ struct batadv_debuginfo batadv_hardif_debuginfo_##_name = { \
.release = single_release, \
}, \
}

static BATADV_HARDIF_DEBUGINFO(originators, S_IRUGO,
batadv_originators_hardif_open);

Expand Down
1 change: 1 addition & 0 deletions net/batman-adv/distributed-arp-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT);
batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT);
}

/**
* batadv_dat_snoop_incoming_arp_reply - snoop the ARP reply and fill the local
* DAT storage only
Expand Down
4 changes: 1 addition & 3 deletions net/batman-adv/distributed-arp-table.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

#include <linux/if_arp.h>

/**
* BATADV_DAT_ADDR_MAX - maximum address value in the DHT space
*/
/* BATADV_DAT_ADDR_MAX - maximum address value in the DHT space */
#define BATADV_DAT_ADDR_MAX ((batadv_dat_addr_t)~(batadv_dat_addr_t)0)

void batadv_dat_status_update(struct net_device *net_dev);
Expand Down
1 change: 0 additions & 1 deletion net/batman-adv/fragmentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "hard-interface.h"
#include "soft-interface.h"


/**
* batadv_frag_clear_chain - delete entries in the fragment buffer chain
* @head: head of chain with entries.
Expand Down
3 changes: 1 addition & 2 deletions net/batman-adv/fragmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
if (!hlist_empty(&frags_entry->head) &&
batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
return true;
else
return false;
return false;
}

#endif /* _NET_BATMAN_ADV_FRAGMENTATION_H_ */
1 change: 1 addition & 0 deletions net/batman-adv/gateway_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len,

return ret;
}

/**
* batadv_gw_out_of_range - check if the dhcp request destination is the best gw
* @bat_priv: the bat priv with all the soft interface information
Expand Down
10 changes: 6 additions & 4 deletions net/batman-adv/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "network-coding.h"
#include "fragmentation.h"


/* List manipulations on hardif_list have to be rtnl_lock()'ed,
* list traversals just rcu-locked
*/
Expand Down Expand Up @@ -403,6 +402,9 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
goto err_free;
}

/* reset control block to avoid left overs from previous users */
memset(skb->cb, 0, sizeof(struct batadv_skb_cb));

/* all receive handlers return whether they received or reused
* the supplied skb. if not, we have to free the skb.
*/
Expand Down Expand Up @@ -651,7 +653,7 @@ static struct batadv_tvlv_handler
/**
* batadv_tvlv_container_free_ref - decrement the tvlv container refcounter and
* possibly free it
* @tvlv_handler: the tvlv container to free
* @tvlv: the tvlv container to free
*/
static void batadv_tvlv_container_free_ref(struct batadv_tvlv_container *tvlv)
{
Expand Down Expand Up @@ -796,11 +798,11 @@ void batadv_tvlv_container_register(struct batadv_priv *bat_priv,
}

/**
* batadv_tvlv_realloc_packet_buff - reallocate packet buffer to accomodate
* batadv_tvlv_realloc_packet_buff - reallocate packet buffer to accommodate
* requested packet size
* @packet_buff: packet buffer
* @packet_buff_len: packet buffer size
* @packet_min_len: requested packet minimum size
* @min_packet_len: requested packet minimum size
* @additional_packet_len: requested additional packet size on top of minimum
* size
*
Expand Down
15 changes: 7 additions & 8 deletions net/batman-adv/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define BATADV_DRIVER_DEVICE "batman-adv"

#ifndef BATADV_SOURCE_VERSION
#define BATADV_SOURCE_VERSION "2014.4.0"
#define BATADV_SOURCE_VERSION "2015.0"
#endif

/* B.A.T.M.A.N. parameters */
Expand Down Expand Up @@ -92,9 +92,8 @@
/* numbers of originator to contact for any PUT/GET DHT operation */
#define BATADV_DAT_CANDIDATES_NUM 3

/**
* BATADV_TQ_SIMILARITY_THRESHOLD - TQ points that a secondary metric can differ
* at most from the primary one in order to be still considered acceptable
/* BATADV_TQ_SIMILARITY_THRESHOLD - TQ points that a secondary metric can differ
* at most from the primary one in order to be still considered acceptable
*/
#define BATADV_TQ_SIMILARITY_THRESHOLD 50

Expand Down Expand Up @@ -313,10 +312,10 @@ static inline bool batadv_has_timed_out(unsigned long timestamp,
* - when adding 128 - it is neither a predecessor nor a successor,
* - after adding more than 127 to the starting value - it is a successor
*/
#define batadv_seq_before(x, y) ({typeof(x) _d1 = (x); \
typeof(y) _d2 = (y); \
typeof(x) _dummy = (_d1 - _d2); \
(void) (&_d1 == &_d2); \
#define batadv_seq_before(x, y) ({typeof(x)_d1 = (x); \
typeof(y)_d2 = (y); \
typeof(x)_dummy = (_d1 - _d2); \
(void)(&_d1 == &_d2); \
_dummy > batadv_smallest_signed_int(_dummy); })
#define batadv_seq_after(x, y) batadv_seq_before(y, x)

Expand Down
3 changes: 0 additions & 3 deletions net/batman-adv/multicast.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node);

static inline void batadv_mcast_mla_update(struct batadv_priv *bat_priv)
{
return;
}

static inline enum batadv_forw_mode
Expand All @@ -67,12 +66,10 @@ static inline int batadv_mcast_init(struct batadv_priv *bat_priv)

static inline void batadv_mcast_free(struct batadv_priv *bat_priv)
{
return;
}

static inline void batadv_mcast_purge_orig(struct batadv_orig_node *orig_node)
{
return;
}

#endif /* CONFIG_BATMAN_ADV_MCAST */
Expand Down
3 changes: 1 addition & 2 deletions net/batman-adv/network-coding.c
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,7 @@ static bool batadv_nc_skb_coding_possible(struct sk_buff *skb,
{
if (BATADV_SKB_CB(skb)->decoded && !batadv_compare_eth(dst, src))
return false;
else
return true;
return true;
}

/**
Expand Down
1 change: 0 additions & 1 deletion net/batman-adv/originator.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,6 @@ batadv_purge_orig_ifinfo(struct batadv_priv *bat_priv,
return ifinfo_purged;
}


/**
* batadv_purge_orig_neighbors - purges neighbors from originator
* @bat_priv: the bat priv with all the soft interface information
Expand Down
1 change: 0 additions & 1 deletion net/batman-adv/originator.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node,
unsigned short vid);
void batadv_orig_node_vlan_free_ref(struct batadv_orig_node_vlan *orig_vlan);


/* hashfunction to choose an entry in a hash table of given size
* hash algorithm from http://en.wikipedia.org/wiki/Hash_table
*/
Expand Down
Loading

0 comments on commit fb57720

Please sign in to comment.