* [PATCH 09/16] batman-adv: Prefix packet structs with batadv_
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1341186226-10549-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bat_iv_ogm.c | 258 ++++++++++++++++----------------
net/batman-adv/bridge_loop_avoidance.c | 12 +-
net/batman-adv/bridge_loop_avoidance.h | 4 +-
net/batman-adv/hard-interface.c | 4 +-
net/batman-adv/icmp_socket.c | 22 +--
net/batman-adv/icmp_socket.h | 2 +-
net/batman-adv/main.c | 10 +-
net/batman-adv/packet.h | 44 +++---
net/batman-adv/routing.c | 88 +++++------
net/batman-adv/routing.h | 2 +-
net/batman-adv/send.c | 4 +-
net/batman-adv/soft-interface.c | 4 +-
net/batman-adv/translation-table.c | 119 ++++++++-------
net/batman-adv/translation-table.h | 4 +-
net/batman-adv/types.h | 10 +-
net/batman-adv/unicast.c | 38 ++---
net/batman-adv/unicast.h | 6 +-
net/batman-adv/vis.c | 81 +++++-----
net/batman-adv/vis.h | 4 +-
19 files changed, 369 insertions(+), 347 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index f9981e6..a2bafd9 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -56,7 +56,7 @@ out:
static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface)
{
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
uint32_t random_seqno;
int res = -ENOMEM;
@@ -70,14 +70,14 @@ static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface)
if (!hard_iface->packet_buff)
goto out;
- batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
- batman_ogm_packet->header.packet_type = BATADV_IV_OGM;
- batman_ogm_packet->header.version = BATADV_COMPAT_VERSION;
- batman_ogm_packet->header.ttl = 2;
- batman_ogm_packet->flags = BATADV_NO_FLAGS;
- batman_ogm_packet->tq = BATADV_TQ_MAX_VALUE;
- batman_ogm_packet->tt_num_changes = 0;
- batman_ogm_packet->ttvn = 0;
+ batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
+ batadv_ogm_packet->header.packet_type = BATADV_IV_OGM;
+ batadv_ogm_packet->header.version = BATADV_COMPAT_VERSION;
+ batadv_ogm_packet->header.ttl = 2;
+ batadv_ogm_packet->flags = BATADV_NO_FLAGS;
+ batadv_ogm_packet->tq = BATADV_TQ_MAX_VALUE;
+ batadv_ogm_packet->tt_num_changes = 0;
+ batadv_ogm_packet->ttvn = 0;
res = 0;
@@ -93,22 +93,22 @@ static void batadv_iv_ogm_iface_disable(struct hard_iface *hard_iface)
static void batadv_iv_ogm_iface_update_mac(struct hard_iface *hard_iface)
{
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
- batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
- memcpy(batman_ogm_packet->orig,
+ batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
+ memcpy(batadv_ogm_packet->orig,
hard_iface->net_dev->dev_addr, ETH_ALEN);
- memcpy(batman_ogm_packet->prev_sender,
+ memcpy(batadv_ogm_packet->prev_sender,
hard_iface->net_dev->dev_addr, ETH_ALEN);
}
static void batadv_iv_ogm_primary_iface_set(struct hard_iface *hard_iface)
{
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
- batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
- batman_ogm_packet->flags = BATADV_PRIMARIES_FIRST_HOP;
- batman_ogm_packet->header.ttl = BATADV_TTL;
+ batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
+ batadv_ogm_packet->flags = BATADV_PRIMARIES_FIRST_HOP;
+ batadv_ogm_packet->header.ttl = BATADV_TTL;
}
/* when do we schedule our own ogm to be sent */
@@ -162,7 +162,7 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
char *fwd_str;
uint8_t packet_num;
int16_t buff_pos;
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
struct sk_buff *skb;
if (hard_iface->if_status != BATADV_IF_ACTIVE)
@@ -170,20 +170,20 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
packet_num = 0;
buff_pos = 0;
- batman_ogm_packet = (struct batman_ogm_packet *)forw_packet->skb->data;
+ batadv_ogm_packet = (struct batadv_ogm_packet *)forw_packet->skb->data;
/* adjust all flags and log packets */
while (batadv_iv_ogm_aggr_packet(buff_pos, forw_packet->packet_len,
- batman_ogm_packet->tt_num_changes)) {
+ batadv_ogm_packet->tt_num_changes)) {
/* we might have aggregated direct link packets with an
* ordinary base packet
*/
if ((forw_packet->direct_link_flags & (1 << packet_num)) &&
(forw_packet->if_incoming == hard_iface))
- batman_ogm_packet->flags |= BATADV_DIRECTLINK;
+ batadv_ogm_packet->flags |= BATADV_DIRECTLINK;
else
- batman_ogm_packet->flags &= ~BATADV_DIRECTLINK;
+ batadv_ogm_packet->flags &= ~BATADV_DIRECTLINK;
fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ?
"Sending own" :
@@ -191,18 +191,18 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"%s %spacket (originator %pM, seqno %u, TQ %d, TTL %d, IDF %s, ttvn %d) on interface %s [%pM]\n",
fwd_str, (packet_num > 0 ? "aggregated " : ""),
- batman_ogm_packet->orig,
- ntohl(batman_ogm_packet->seqno),
- batman_ogm_packet->tq, batman_ogm_packet->header.ttl,
- (batman_ogm_packet->flags & BATADV_DIRECTLINK ?
+ batadv_ogm_packet->orig,
+ ntohl(batadv_ogm_packet->seqno),
+ batadv_ogm_packet->tq, batadv_ogm_packet->header.ttl,
+ (batadv_ogm_packet->flags & BATADV_DIRECTLINK ?
"on" : "off"),
- batman_ogm_packet->ttvn, hard_iface->net_dev->name,
+ batadv_ogm_packet->ttvn, hard_iface->net_dev->name,
hard_iface->net_dev->dev_addr);
buff_pos += BATADV_OGM_HLEN;
- buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes);
+ buff_pos += batadv_tt_len(batadv_ogm_packet->tt_num_changes);
packet_num++;
- batman_ogm_packet = (struct batman_ogm_packet *)
+ batadv_ogm_packet = (struct batadv_ogm_packet *)
(forw_packet->skb->data + buff_pos);
}
@@ -223,12 +223,12 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet)
struct net_device *soft_iface;
struct bat_priv *bat_priv;
struct hard_iface *primary_if = NULL;
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
unsigned char directlink;
- batman_ogm_packet = (struct batman_ogm_packet *)
+ batadv_ogm_packet = (struct batadv_ogm_packet *)
(forw_packet->skb->data);
- directlink = (batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0);
+ directlink = (batadv_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0);
if (!forw_packet->if_incoming) {
pr_err("Error - can't forward packet: incoming iface not specified\n");
@@ -248,16 +248,16 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet)
/* multihomed peer assumed
* non-primary OGMs are only broadcasted on their interface
*/
- if ((directlink && (batman_ogm_packet->header.ttl == 1)) ||
+ if ((directlink && (batadv_ogm_packet->header.ttl == 1)) ||
(forw_packet->own && (forw_packet->if_incoming != primary_if))) {
/* FIXME: what about aggregated packets ? */
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"%s packet (originator %pM, seqno %u, TTL %d) on interface %s [%pM]\n",
(forw_packet->own ? "Sending own" : "Forwarding"),
- batman_ogm_packet->orig,
- ntohl(batman_ogm_packet->seqno),
- batman_ogm_packet->header.ttl,
+ batadv_ogm_packet->orig,
+ ntohl(batadv_ogm_packet->seqno),
+ batadv_ogm_packet->header.ttl,
forw_packet->if_incoming->net_dev->name,
forw_packet->if_incoming->net_dev->dev_addr);
@@ -287,20 +287,20 @@ out:
/* return true if new_packet can be aggregated with forw_packet */
static bool
-batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
+batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet,
struct bat_priv *bat_priv,
int packet_len, unsigned long send_time,
bool directlink,
const struct hard_iface *if_incoming,
const struct forw_packet *forw_packet)
{
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
int aggregated_bytes = forw_packet->packet_len + packet_len;
struct hard_iface *primary_if = NULL;
bool res = false;
unsigned long aggregation_end_time;
- batman_ogm_packet = (struct batman_ogm_packet *)forw_packet->skb->data;
+ batadv_ogm_packet = (struct batadv_ogm_packet *)forw_packet->skb->data;
aggregation_end_time = send_time;
aggregation_end_time += msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS);
@@ -330,8 +330,8 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
* are flooded through the net
*/
if ((!directlink) &&
- (!(batman_ogm_packet->flags & BATADV_DIRECTLINK)) &&
- (batman_ogm_packet->header.ttl != 1) &&
+ (!(batadv_ogm_packet->flags & BATADV_DIRECTLINK)) &&
+ (batadv_ogm_packet->header.ttl != 1) &&
/* own packets originating non-primary
* interfaces leave only that interface
@@ -353,7 +353,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
* own secondary interface packets
* (= secondary interface packets in general)
*/
- (batman_ogm_packet->flags & BATADV_DIRECTLINK ||
+ (batadv_ogm_packet->flags & BATADV_DIRECTLINK ||
(forw_packet->own &&
forw_packet->if_incoming != primary_if))) {
res = true;
@@ -475,12 +475,12 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv,
*/
struct forw_packet *forw_packet_aggr = NULL, *forw_packet_pos = NULL;
struct hlist_node *tmp_node;
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
bool direct_link;
unsigned long max_aggregation_jiffies;
- batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;
- direct_link = batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0;
+ batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff;
+ direct_link = batadv_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0;
max_aggregation_jiffies = msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS);
/* find position for the packet in the forward queue */
@@ -489,7 +489,7 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv,
if ((atomic_read(&bat_priv->aggregated_ogms)) && (!own_packet)) {
hlist_for_each_entry(forw_packet_pos, tmp_node,
&bat_priv->forw_bat_list, list) {
- if (batadv_iv_ogm_can_aggregate(batman_ogm_packet,
+ if (batadv_iv_ogm_can_aggregate(batadv_ogm_packet,
bat_priv, packet_len,
send_time, direct_link,
if_incoming,
@@ -526,7 +526,7 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv,
static void batadv_iv_ogm_forward(struct orig_node *orig_node,
const struct ethhdr *ethhdr,
- struct batman_ogm_packet *batman_ogm_packet,
+ struct batadv_ogm_packet *batadv_ogm_packet,
bool is_single_hop_neigh,
bool is_from_best_next_hop,
struct hard_iface *if_incoming)
@@ -534,7 +534,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
uint8_t tt_num_changes;
- if (batman_ogm_packet->header.ttl <= 1) {
+ if (batadv_ogm_packet->header.ttl <= 1) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "ttl exceeded\n");
return;
}
@@ -547,32 +547,32 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
* simply drop the ogm.
*/
if (is_single_hop_neigh)
- batman_ogm_packet->flags |= BATADV_NOT_BEST_NEXT_HOP;
+ batadv_ogm_packet->flags |= BATADV_NOT_BEST_NEXT_HOP;
else
return;
}
- tt_num_changes = batman_ogm_packet->tt_num_changes;
+ tt_num_changes = batadv_ogm_packet->tt_num_changes;
- batman_ogm_packet->header.ttl--;
- memcpy(batman_ogm_packet->prev_sender, ethhdr->h_source, ETH_ALEN);
+ batadv_ogm_packet->header.ttl--;
+ memcpy(batadv_ogm_packet->prev_sender, ethhdr->h_source, ETH_ALEN);
/* apply hop penalty */
- batman_ogm_packet->tq = batadv_hop_penalty(batman_ogm_packet->tq,
+ batadv_ogm_packet->tq = batadv_hop_penalty(batadv_ogm_packet->tq,
bat_priv);
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Forwarding packet: tq: %i, ttl: %i\n",
- batman_ogm_packet->tq, batman_ogm_packet->header.ttl);
+ batadv_ogm_packet->tq, batadv_ogm_packet->header.ttl);
/* switch of primaries first hop flag when forwarding */
- batman_ogm_packet->flags &= ~BATADV_PRIMARIES_FIRST_HOP;
+ batadv_ogm_packet->flags &= ~BATADV_PRIMARIES_FIRST_HOP;
if (is_single_hop_neigh)
- batman_ogm_packet->flags |= BATADV_DIRECTLINK;
+ batadv_ogm_packet->flags |= BATADV_DIRECTLINK;
else
- batman_ogm_packet->flags &= ~BATADV_DIRECTLINK;
+ batadv_ogm_packet->flags &= ~BATADV_DIRECTLINK;
- batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet,
+ batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batadv_ogm_packet,
BATADV_OGM_HLEN + batadv_tt_len(tt_num_changes),
if_incoming, 0, batadv_iv_ogm_fwd_send_time());
}
@@ -580,7 +580,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface)
{
struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
struct hard_iface *primary_if;
int vis_server, tt_num_changes = 0;
@@ -593,29 +593,29 @@ static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface)
&hard_iface->packet_len,
BATADV_OGM_HLEN);
- batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
+ batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
/* change sequence number to network order */
- batman_ogm_packet->seqno =
+ batadv_ogm_packet->seqno =
htonl((uint32_t)atomic_read(&hard_iface->seqno));
atomic_inc(&hard_iface->seqno);
- batman_ogm_packet->ttvn = atomic_read(&bat_priv->ttvn);
- batman_ogm_packet->tt_crc = htons(bat_priv->tt_crc);
+ batadv_ogm_packet->ttvn = atomic_read(&bat_priv->ttvn);
+ batadv_ogm_packet->tt_crc = htons(bat_priv->tt_crc);
if (tt_num_changes >= 0)
- batman_ogm_packet->tt_num_changes = tt_num_changes;
+ batadv_ogm_packet->tt_num_changes = tt_num_changes;
if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC)
- batman_ogm_packet->flags |= BATADV_VIS_SERVER;
+ batadv_ogm_packet->flags |= BATADV_VIS_SERVER;
else
- batman_ogm_packet->flags &= ~BATADV_VIS_SERVER;
+ batadv_ogm_packet->flags &= ~BATADV_VIS_SERVER;
if ((hard_iface == primary_if) &&
(atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER))
- batman_ogm_packet->gw_flags =
+ batadv_ogm_packet->gw_flags =
(uint8_t)atomic_read(&bat_priv->gw_bandwidth);
else
- batman_ogm_packet->gw_flags = BATADV_NO_FLAGS;
+ batadv_ogm_packet->gw_flags = BATADV_NO_FLAGS;
batadv_slide_own_bcast_window(hard_iface);
batadv_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff,
@@ -630,7 +630,7 @@ static void
batadv_iv_ogm_orig_update(struct bat_priv *bat_priv,
struct orig_node *orig_node,
const struct ethhdr *ethhdr,
- const struct batman_ogm_packet *batman_ogm_packet,
+ const struct batadv_ogm_packet *batadv_ogm_packet,
struct hard_iface *if_incoming,
const unsigned char *tt_buff,
int is_duplicate)
@@ -679,7 +679,7 @@ batadv_iv_ogm_orig_update(struct bat_priv *bat_priv,
neigh_node = batadv_iv_ogm_neigh_new(if_incoming,
ethhdr->h_source,
orig_node, orig_tmp,
- batman_ogm_packet->seqno);
+ batadv_ogm_packet->seqno);
batadv_orig_node_free_ref(orig_tmp);
if (!neigh_node)
@@ -690,19 +690,19 @@ batadv_iv_ogm_orig_update(struct bat_priv *bat_priv,
rcu_read_unlock();
- orig_node->flags = batman_ogm_packet->flags;
+ orig_node->flags = batadv_ogm_packet->flags;
neigh_node->last_seen = jiffies;
spin_lock_bh(&neigh_node->lq_update_lock);
batadv_ring_buffer_set(neigh_node->tq_recv,
&neigh_node->tq_index,
- batman_ogm_packet->tq);
+ batadv_ogm_packet->tq);
neigh_node->tq_avg = batadv_ring_buffer_avg(neigh_node->tq_recv);
spin_unlock_bh(&neigh_node->lq_update_lock);
if (!is_duplicate) {
- orig_node->last_ttl = batman_ogm_packet->header.ttl;
- neigh_node->last_ttl = batman_ogm_packet->header.ttl;
+ orig_node->last_ttl = batadv_ogm_packet->header.ttl;
+ neigh_node->last_ttl = batadv_ogm_packet->header.ttl;
}
batadv_bonding_candidate_add(orig_node, neigh_node);
@@ -744,19 +744,19 @@ update_tt:
/* I have to check for transtable changes only if the OGM has been
* sent through a primary interface
*/
- if (((batman_ogm_packet->orig != ethhdr->h_source) &&
- (batman_ogm_packet->header.ttl > 2)) ||
- (batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP))
+ if (((batadv_ogm_packet->orig != ethhdr->h_source) &&
+ (batadv_ogm_packet->header.ttl > 2)) ||
+ (batadv_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP))
batadv_tt_update_orig(bat_priv, orig_node, tt_buff,
- batman_ogm_packet->tt_num_changes,
- batman_ogm_packet->ttvn,
- ntohs(batman_ogm_packet->tt_crc));
+ batadv_ogm_packet->tt_num_changes,
+ batadv_ogm_packet->ttvn,
+ ntohs(batadv_ogm_packet->tt_crc));
- if (orig_node->gw_flags != batman_ogm_packet->gw_flags)
+ if (orig_node->gw_flags != batadv_ogm_packet->gw_flags)
batadv_gw_node_update(bat_priv, orig_node,
- batman_ogm_packet->gw_flags);
+ batadv_ogm_packet->gw_flags);
- orig_node->gw_flags = batman_ogm_packet->gw_flags;
+ orig_node->gw_flags = batadv_ogm_packet->gw_flags;
/* restart gateway selection if fast or late switching was enabled */
if ((orig_node->gw_flags) &&
@@ -777,7 +777,7 @@ out:
static int batadv_iv_ogm_calc_tq(struct orig_node *orig_node,
struct orig_node *orig_neigh_node,
- struct batman_ogm_packet *batman_ogm_packet,
+ struct batadv_ogm_packet *batadv_ogm_packet,
struct hard_iface *if_incoming)
{
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
@@ -814,7 +814,7 @@ static int batadv_iv_ogm_calc_tq(struct orig_node *orig_node,
orig_neigh_node->orig,
orig_neigh_node,
orig_neigh_node,
- batman_ogm_packet->seqno);
+ batadv_ogm_packet->seqno);
if (!neigh_node)
goto out;
@@ -862,20 +862,20 @@ static int batadv_iv_ogm_calc_tq(struct orig_node *orig_node,
inv_asym_penalty /= neigh_rq_max_cube;
tq_asym_penalty = BATADV_TQ_MAX_VALUE - inv_asym_penalty;
- combined_tq = batman_ogm_packet->tq * tq_own * tq_asym_penalty;
+ combined_tq = batadv_ogm_packet->tq * tq_own * tq_asym_penalty;
combined_tq /= BATADV_TQ_MAX_VALUE * BATADV_TQ_MAX_VALUE;
- batman_ogm_packet->tq = combined_tq;
+ batadv_ogm_packet->tq = combined_tq;
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i\n",
orig_node->orig, orig_neigh_node->orig, total_count,
neigh_rq_count, tq_own,
- tq_asym_penalty, batman_ogm_packet->tq);
+ tq_asym_penalty, batadv_ogm_packet->tq);
/* if link has the minimum required transmission quality
* consider it bidirectional
*/
- if (batman_ogm_packet->tq >= BATADV_TQ_TOTAL_BIDRECT_LIMIT)
+ if (batadv_ogm_packet->tq >= BATADV_TQ_TOTAL_BIDRECT_LIMIT)
ret = 1;
out:
@@ -894,7 +894,7 @@ out:
*/
static int
batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
- const struct batman_ogm_packet *batman_ogm_packet,
+ const struct batadv_ogm_packet *batadv_ogm_packet,
const struct hard_iface *if_incoming)
{
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
@@ -905,10 +905,10 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
int32_t seq_diff;
int need_update = 0;
int set_mark, ret = -1;
- uint32_t seqno = ntohl(batman_ogm_packet->seqno);
+ uint32_t seqno = ntohl(batadv_ogm_packet->seqno);
uint8_t *neigh_addr;
- orig_node = batadv_get_orig_node(bat_priv, batman_ogm_packet->orig);
+ orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig);
if (!orig_node)
return 0;
@@ -963,7 +963,7 @@ out:
}
static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
- struct batman_ogm_packet *batman_ogm_packet,
+ struct batadv_ogm_packet *batadv_ogm_packet,
const unsigned char *tt_buff,
struct hard_iface *if_incoming)
{
@@ -989,34 +989,34 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
* it as an additional length.
*
* TODO: A more sane solution would be to have a bit in the
- * batman_ogm_packet to detect whether the packet is the last
+ * batadv_ogm_packet to detect whether the packet is the last
* packet in an aggregation. Here we expect that the padding
* is always zero (or not 0x01)
*/
- if (batman_ogm_packet->header.packet_type != BATADV_IV_OGM)
+ if (batadv_ogm_packet->header.packet_type != BATADV_IV_OGM)
return;
/* could be changed by schedule_own_packet() */
if_incoming_seqno = atomic_read(&if_incoming->seqno);
- if (batman_ogm_packet->flags & BATADV_DIRECTLINK)
+ if (batadv_ogm_packet->flags & BATADV_DIRECTLINK)
has_directlink_flag = 1;
else
has_directlink_flag = 0;
- if (batadv_compare_eth(ethhdr->h_source, batman_ogm_packet->orig))
+ if (batadv_compare_eth(ethhdr->h_source, batadv_ogm_packet->orig))
is_single_hop_neigh = true;
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n",
ethhdr->h_source, if_incoming->net_dev->name,
- if_incoming->net_dev->dev_addr, batman_ogm_packet->orig,
- batman_ogm_packet->prev_sender,
- ntohl(batman_ogm_packet->seqno), batman_ogm_packet->ttvn,
- ntohs(batman_ogm_packet->tt_crc),
- batman_ogm_packet->tt_num_changes, batman_ogm_packet->tq,
- batman_ogm_packet->header.ttl,
- batman_ogm_packet->header.version, has_directlink_flag);
+ if_incoming->net_dev->dev_addr, batadv_ogm_packet->orig,
+ batadv_ogm_packet->prev_sender,
+ ntohl(batadv_ogm_packet->seqno), batadv_ogm_packet->ttvn,
+ ntohs(batadv_ogm_packet->tt_crc),
+ batadv_ogm_packet->tt_num_changes, batadv_ogm_packet->tq,
+ batadv_ogm_packet->header.ttl,
+ batadv_ogm_packet->header.version, has_directlink_flag);
rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
@@ -1030,11 +1030,11 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
hard_iface->net_dev->dev_addr))
is_my_addr = 1;
- if (batadv_compare_eth(batman_ogm_packet->orig,
+ if (batadv_compare_eth(batadv_ogm_packet->orig,
hard_iface->net_dev->dev_addr))
is_my_orig = 1;
- if (batadv_compare_eth(batman_ogm_packet->prev_sender,
+ if (batadv_compare_eth(batadv_ogm_packet->prev_sender,
hard_iface->net_dev->dev_addr))
is_my_oldorig = 1;
@@ -1043,10 +1043,10 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
}
rcu_read_unlock();
- if (batman_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
+ if (batadv_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: incompatible batman version (%i)\n",
- batman_ogm_packet->header.version);
+ batadv_ogm_packet->header.version);
return;
}
@@ -1082,14 +1082,14 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
*/
if (has_directlink_flag &&
batadv_compare_eth(if_incoming->net_dev->dev_addr,
- batman_ogm_packet->orig)) {
+ batadv_ogm_packet->orig)) {
if_num = if_incoming->if_num;
offset = if_num * BATADV_NUM_WORDS;
spin_lock_bh(&orig_neigh_node->ogm_cnt_lock);
word = &(orig_neigh_node->bcast_own[offset]);
bit_pos = if_incoming_seqno - 2;
- bit_pos -= ntohl(batman_ogm_packet->seqno);
+ bit_pos -= ntohl(batadv_ogm_packet->seqno);
batadv_set_bit(word, bit_pos);
weight = &orig_neigh_node->bcast_own_sum[if_num];
*weight = bitmap_weight(word,
@@ -1110,18 +1110,18 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
return;
}
- if (batman_ogm_packet->flags & BATADV_NOT_BEST_NEXT_HOP) {
+ if (batadv_ogm_packet->flags & BATADV_NOT_BEST_NEXT_HOP) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n",
ethhdr->h_source);
return;
}
- orig_node = batadv_get_orig_node(bat_priv, batman_ogm_packet->orig);
+ orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig);
if (!orig_node)
return;
- is_duplicate = batadv_iv_ogm_update_seqnos(ethhdr, batman_ogm_packet,
+ is_duplicate = batadv_iv_ogm_update_seqnos(ethhdr, batadv_ogm_packet,
if_incoming);
if (is_duplicate == -1) {
@@ -1131,7 +1131,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
goto out;
}
- if (batman_ogm_packet->tq == 0) {
+ if (batadv_ogm_packet->tq == 0) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: originator packet with tq equal 0\n");
goto out;
@@ -1145,11 +1145,11 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
(batadv_compare_eth(router->addr, ethhdr->h_source)))
is_from_best_next_hop = true;
- prev_sender = batman_ogm_packet->prev_sender;
+ prev_sender = batadv_ogm_packet->prev_sender;
/* avoid temporary routing loops */
if (router && router_router &&
(batadv_compare_eth(router->addr, prev_sender)) &&
- !(batadv_compare_eth(batman_ogm_packet->orig, prev_sender)) &&
+ !(batadv_compare_eth(batadv_ogm_packet->orig, prev_sender)) &&
(batadv_compare_eth(router->addr, router_router->addr))) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM)\n",
@@ -1178,26 +1178,26 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
}
is_bidirect = batadv_iv_ogm_calc_tq(orig_node, orig_neigh_node,
- batman_ogm_packet, if_incoming);
+ batadv_ogm_packet, if_incoming);
batadv_bonding_save_primary(orig_node, orig_neigh_node,
- batman_ogm_packet);
+ batadv_ogm_packet);
/* update ranking if it is not a duplicate or has the same
* seqno and similar ttl as the non-duplicate
*/
- sameseq = orig_node->last_real_seqno == ntohl(batman_ogm_packet->seqno);
- simlar_ttl = orig_node->last_ttl - 3 <= batman_ogm_packet->header.ttl;
+ sameseq = orig_node->last_real_seqno == ntohl(batadv_ogm_packet->seqno);
+ simlar_ttl = orig_node->last_ttl - 3 <= batadv_ogm_packet->header.ttl;
if (is_bidirect && (!is_duplicate || (sameseq && simlar_ttl)))
batadv_iv_ogm_orig_update(bat_priv, orig_node, ethhdr,
- batman_ogm_packet, if_incoming,
+ batadv_ogm_packet, if_incoming,
tt_buff, is_duplicate);
/* is single hop (direct) neighbor */
if (is_single_hop_neigh) {
/* mark direct link on incoming interface */
- batadv_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet,
+ batadv_iv_ogm_forward(orig_node, ethhdr, batadv_ogm_packet,
is_single_hop_neigh,
is_from_best_next_hop, if_incoming);
@@ -1221,7 +1221,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Forwarding packet: rebroadcast originator packet\n");
- batadv_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet,
+ batadv_iv_ogm_forward(orig_node, ethhdr, batadv_ogm_packet,
is_single_hop_neigh, is_from_best_next_hop,
if_incoming);
@@ -1243,7 +1243,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
struct hard_iface *if_incoming)
{
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
struct ethhdr *ethhdr;
int buff_pos = 0, packet_len;
unsigned char *tt_buff, *packet_buff;
@@ -1266,22 +1266,22 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
packet_len = skb_headlen(skb);
ethhdr = (struct ethhdr *)skb_mac_header(skb);
packet_buff = skb->data;
- batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;
+ batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff;
/* unpack the aggregated packets and process them one by one */
do {
tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN;
- batadv_iv_ogm_process(ethhdr, batman_ogm_packet, tt_buff,
+ batadv_iv_ogm_process(ethhdr, batadv_ogm_packet, tt_buff,
if_incoming);
buff_pos += BATADV_OGM_HLEN;
- buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes);
+ buff_pos += batadv_tt_len(batadv_ogm_packet->tt_num_changes);
- batman_ogm_packet = (struct batman_ogm_packet *)
+ batadv_ogm_packet = (struct batadv_ogm_packet *)
(packet_buff + buff_pos);
} while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len,
- batman_ogm_packet->tt_num_changes));
+ batadv_ogm_packet->tt_num_changes));
kfree_skb(skb);
return NET_RX_SUCCESS;
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 8bd7050..fdda2c8 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -255,7 +255,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
struct hard_iface *primary_if;
struct net_device *soft_iface;
uint8_t *hw_src;
- struct bla_claim_dst local_claim_dest;
+ struct batadv_bla_claim_dst local_claim_dest;
__be32 zeroip = 0;
primary_if = batadv_primary_if_get_selected(bat_priv);
@@ -759,9 +759,9 @@ static int batadv_check_claim_group(struct bat_priv *bat_priv,
{
uint8_t *backbone_addr;
struct orig_node *orig_node;
- struct bla_claim_dst *bla_dst, *bla_dst_own;
+ struct batadv_bla_claim_dst *bla_dst, *bla_dst_own;
- bla_dst = (struct bla_claim_dst *)hw_dst;
+ bla_dst = (struct batadv_bla_claim_dst *)hw_dst;
bla_dst_own = &bat_priv->claim_dest;
/* check if it is a claim packet in general */
@@ -832,7 +832,7 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv,
struct vlan_ethhdr *vhdr;
struct arphdr *arphdr;
uint8_t *hw_src, *hw_dst;
- struct bla_claim_dst *bla_dst;
+ struct batadv_bla_claim_dst *bla_dst;
uint16_t proto;
int headlen;
short vid = -1;
@@ -876,7 +876,7 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv,
hw_src = (uint8_t *)arphdr + sizeof(struct arphdr);
hw_dst = hw_src + ETH_ALEN + 4;
- bla_dst = (struct bla_claim_dst *)hw_dst;
+ bla_dst = (struct batadv_bla_claim_dst *)hw_dst;
/* check if it is a claim frame. */
ret = batadv_check_claim_group(bat_priv, primary_if, hw_src, hw_dst,
@@ -1201,7 +1201,7 @@ int batadv_bla_init(struct bat_priv *bat_priv)
* the same host however as this might be intended.
*/
int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
- struct bcast_packet *bcast_packet,
+ struct batadv_bcast_packet *bcast_packet,
int hdr_size)
{
int i, length, curr;
diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h
index 58563f0..d69f453 100644
--- a/net/batman-adv/bridge_loop_avoidance.h
+++ b/net/batman-adv/bridge_loop_avoidance.h
@@ -28,7 +28,7 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb,
int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig);
int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
- struct bcast_packet *bcast_packet,
+ struct batadv_bcast_packet *bcast_packet,
int hdr_size);
void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
struct hard_iface *primary_if,
@@ -72,7 +72,7 @@ static inline int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv,
static inline int
batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
- struct bcast_packet *bcast_packet,
+ struct batadv_bcast_packet *bcast_packet,
int hdr_size)
{
return 0;
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index e109d65..0a14fdf 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -100,14 +100,14 @@ out:
static void batadv_primary_if_update_addr(struct bat_priv *bat_priv,
struct hard_iface *oldif)
{
- struct vis_packet *vis_packet;
+ struct batadv_vis_packet *vis_packet;
struct hard_iface *primary_if;
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
- vis_packet = (struct vis_packet *)
+ vis_packet = (struct batadv_vis_packet *)
bat_priv->my_vis_info->skb_packet->data;
memcpy(vis_packet->vis_orig, primary_if->net_dev->dev_addr, ETH_ALEN);
memcpy(vis_packet->sender_orig,
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index 61b52b3..ca07580 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -29,7 +29,7 @@
static struct socket_client *batadv_socket_client_hash[256];
static void batadv_socket_add_packet(struct socket_client *socket_client,
- struct icmp_packet_rr *icmp_packet,
+ struct batadv_icmp_packet_rr *icmp_packet,
size_t icmp_len);
void batadv_socket_init(void)
@@ -112,7 +112,7 @@ static ssize_t batadv_socket_read(struct file *file, char __user *buf,
if ((file->f_flags & O_NONBLOCK) && (socket_client->queue_len == 0))
return -EAGAIN;
- if ((!buf) || (count < sizeof(struct icmp_packet)))
+ if ((!buf) || (count < sizeof(struct batadv_icmp_packet)))
return -EINVAL;
if (!access_ok(VERIFY_WRITE, buf, count))
@@ -151,13 +151,13 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
struct bat_priv *bat_priv = socket_client->bat_priv;
struct hard_iface *primary_if = NULL;
struct sk_buff *skb;
- struct icmp_packet_rr *icmp_packet;
+ struct batadv_icmp_packet_rr *icmp_packet;
struct orig_node *orig_node = NULL;
struct neigh_node *neigh_node = NULL;
- size_t packet_len = sizeof(struct icmp_packet);
+ size_t packet_len = sizeof(struct batadv_icmp_packet);
- if (len < sizeof(struct icmp_packet)) {
+ if (len < sizeof(struct batadv_icmp_packet)) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: invalid packet size\n");
return -EINVAL;
@@ -170,8 +170,8 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
goto out;
}
- if (len >= sizeof(struct icmp_packet_rr))
- packet_len = sizeof(struct icmp_packet_rr);
+ if (len >= sizeof(struct batadv_icmp_packet_rr))
+ packet_len = sizeof(struct batadv_icmp_packet_rr);
skb = dev_alloc_skb(packet_len + ETH_HLEN);
if (!skb) {
@@ -180,7 +180,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
}
skb_reserve(skb, ETH_HLEN);
- icmp_packet = (struct icmp_packet_rr *)skb_put(skb, packet_len);
+ icmp_packet = (struct batadv_icmp_packet_rr *)skb_put(skb, packet_len);
if (copy_from_user(icmp_packet, buff, packet_len)) {
len = -EFAULT;
@@ -231,7 +231,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
memcpy(icmp_packet->orig,
primary_if->net_dev->dev_addr, ETH_ALEN);
- if (packet_len == sizeof(struct icmp_packet_rr))
+ if (packet_len == sizeof(struct batadv_icmp_packet_rr))
memcpy(icmp_packet->rr,
neigh_node->if_incoming->net_dev->dev_addr, ETH_ALEN);
@@ -294,7 +294,7 @@ err:
}
static void batadv_socket_add_packet(struct socket_client *socket_client,
- struct icmp_packet_rr *icmp_packet,
+ struct batadv_icmp_packet_rr *icmp_packet,
size_t icmp_len)
{
struct socket_packet *socket_packet;
@@ -336,7 +336,7 @@ static void batadv_socket_add_packet(struct socket_client *socket_client,
wake_up(&socket_client->queue_wait);
}
-void batadv_socket_receive_packet(struct icmp_packet_rr *icmp_packet,
+void batadv_socket_receive_packet(struct batadv_icmp_packet_rr *icmp_packet,
size_t icmp_len)
{
struct socket_client *hash;
diff --git a/net/batman-adv/icmp_socket.h b/net/batman-adv/icmp_socket.h
index f88f9f0..7b8ad52 100644
--- a/net/batman-adv/icmp_socket.h
+++ b/net/batman-adv/icmp_socket.h
@@ -24,7 +24,7 @@
void batadv_socket_init(void);
int batadv_socket_setup(struct bat_priv *bat_priv);
-void batadv_socket_receive_packet(struct icmp_packet_rr *icmp_packet,
+void batadv_socket_receive_packet(struct batadv_icmp_packet_rr *icmp_packet,
size_t icmp_len);
#endif /* _NET_BATMAN_ADV_ICMP_SOCKET_H_ */
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 24d651d..97144a9 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -205,7 +205,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
struct net_device *orig_dev)
{
struct bat_priv *bat_priv;
- struct batman_ogm_packet *batman_ogm_packet;
+ struct batadv_ogm_packet *batadv_ogm_packet;
struct hard_iface *hard_iface;
uint8_t idx;
int ret;
@@ -237,19 +237,19 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
if (hard_iface->if_status != BATADV_IF_ACTIVE)
goto err_free;
- batman_ogm_packet = (struct batman_ogm_packet *)skb->data;
+ batadv_ogm_packet = (struct batadv_ogm_packet *)skb->data;
- if (batman_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
+ if (batadv_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: incompatible batman version (%i)\n",
- batman_ogm_packet->header.version);
+ batadv_ogm_packet->header.version);
goto err_free;
}
/* all receive handlers return whether they received or reused
* the supplied skb. if not, we have to free the skb.
*/
- idx = batman_ogm_packet->header.packet_type;
+ idx = batadv_ogm_packet->header.packet_type;
ret = (*batadv_rx_handler[idx])(skb, hard_iface);
if (ret == NET_RX_DROP)
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index 59e328a..8d3e55a 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -101,20 +101,20 @@ enum batadv_bla_claimframe {
/* the destination hardware field in the ARP frame is used to
* transport the claim type and the group id
*/
-struct bla_claim_dst {
+struct batadv_bla_claim_dst {
uint8_t magic[3]; /* FF:43:05 */
uint8_t type; /* bla_claimframe */
__be16 group; /* group id */
} __packed;
-struct batman_header {
+struct batadv_header {
uint8_t packet_type;
uint8_t version; /* batman version field */
uint8_t ttl;
} __packed;
-struct batman_ogm_packet {
- struct batman_header header;
+struct batadv_ogm_packet {
+ struct batadv_header header;
uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */
__be32 seqno;
uint8_t orig[ETH_ALEN];
@@ -126,10 +126,10 @@ struct batman_ogm_packet {
__be16 tt_crc;
} __packed;
-#define BATADV_OGM_HLEN sizeof(struct batman_ogm_packet)
+#define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
-struct icmp_packet {
- struct batman_header header;
+struct batadv_icmp_packet {
+ struct batadv_header header;
uint8_t msg_type; /* see ICMP message types above */
uint8_t dst[ETH_ALEN];
uint8_t orig[ETH_ALEN];
@@ -143,8 +143,8 @@ struct icmp_packet {
/* icmp_packet_rr must start with all fields from imcp_packet
* as this is assumed by code that handles ICMP packets
*/
-struct icmp_packet_rr {
- struct batman_header header;
+struct batadv_icmp_packet_rr {
+ struct batadv_header header;
uint8_t msg_type; /* see ICMP message types above */
uint8_t dst[ETH_ALEN];
uint8_t orig[ETH_ALEN];
@@ -154,14 +154,14 @@ struct icmp_packet_rr {
uint8_t rr[BATADV_RR_LEN][ETH_ALEN];
} __packed;
-struct unicast_packet {
- struct batman_header header;
+struct batadv_unicast_packet {
+ struct batadv_header header;
uint8_t ttvn; /* destination translation table version number */
uint8_t dest[ETH_ALEN];
} __packed;
-struct unicast_frag_packet {
- struct batman_header header;
+struct batadv_unicast_frag_packet {
+ struct batadv_header header;
uint8_t ttvn; /* destination translation table version number */
uint8_t dest[ETH_ALEN];
uint8_t flags;
@@ -170,15 +170,15 @@ struct unicast_frag_packet {
__be16 seqno;
} __packed;
-struct bcast_packet {
- struct batman_header header;
+struct batadv_bcast_packet {
+ struct batadv_header header;
uint8_t reserved;
__be32 seqno;
uint8_t orig[ETH_ALEN];
} __packed;
-struct vis_packet {
- struct batman_header header;
+struct batadv_vis_packet {
+ struct batadv_header header;
uint8_t vis_type; /* which type of vis-participant sent this? */
__be32 seqno; /* sequence number */
uint8_t entries; /* number of entries behind this struct */
@@ -188,8 +188,8 @@ struct vis_packet {
uint8_t sender_orig[ETH_ALEN]; /* who sent or forwarded this packet */
} __packed;
-struct tt_query_packet {
- struct batman_header header;
+struct batadv_tt_query_packet {
+ struct batadv_header header;
/* the flag field is a combination of:
* - TT_REQUEST or TT_RESPONSE
* - TT_FULL_TABLE
@@ -212,15 +212,15 @@ struct tt_query_packet {
__be16 tt_data;
} __packed;
-struct roam_adv_packet {
- struct batman_header header;
+struct batadv_roam_adv_packet {
+ struct batadv_header header;
uint8_t reserved;
uint8_t dst[ETH_ALEN];
uint8_t src[ETH_ALEN];
uint8_t client[ETH_ALEN];
} __packed;
-struct tt_change {
+struct batadv_tt_change {
uint8_t flags;
uint8_t addr[ETH_ALEN];
} __packed;
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 86d444a..e157907 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -217,7 +217,7 @@ out:
void
batadv_bonding_save_primary(const struct orig_node *orig_node,
struct orig_node *orig_neigh_node,
- const struct batman_ogm_packet *batman_ogm_packet)
+ const struct batadv_ogm_packet *batman_ogm_packet)
{
if (!(batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP))
return;
@@ -284,10 +284,10 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv,
struct hard_iface *primary_if = NULL;
struct orig_node *orig_node = NULL;
struct neigh_node *router = NULL;
- struct icmp_packet_rr *icmp_packet;
+ struct batadv_icmp_packet_rr *icmp_packet;
int ret = NET_RX_DROP;
- icmp_packet = (struct icmp_packet_rr *)skb->data;
+ icmp_packet = (struct batadv_icmp_packet_rr *)skb->data;
/* add data to device queue */
if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
@@ -313,7 +313,7 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv,
if (skb_cow(skb, ETH_HLEN) < 0)
goto out;
- icmp_packet = (struct icmp_packet_rr *)skb->data;
+ icmp_packet = (struct batadv_icmp_packet_rr *)skb->data;
memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
@@ -339,10 +339,10 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
struct hard_iface *primary_if = NULL;
struct orig_node *orig_node = NULL;
struct neigh_node *router = NULL;
- struct icmp_packet *icmp_packet;
+ struct batadv_icmp_packet *icmp_packet;
int ret = NET_RX_DROP;
- icmp_packet = (struct icmp_packet *)skb->data;
+ icmp_packet = (struct batadv_icmp_packet *)skb->data;
/* send TTL exceeded if packet is an echo request (traceroute) */
if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
@@ -368,7 +368,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
if (skb_cow(skb, ETH_HLEN) < 0)
goto out;
- icmp_packet = (struct icmp_packet *)skb->data;
+ icmp_packet = (struct batadv_icmp_packet *)skb->data;
memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
@@ -392,16 +392,16 @@ out:
int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
- struct icmp_packet_rr *icmp_packet;
+ struct batadv_icmp_packet_rr *icmp_packet;
struct ethhdr *ethhdr;
struct orig_node *orig_node = NULL;
struct neigh_node *router = NULL;
- int hdr_size = sizeof(struct icmp_packet);
+ int hdr_size = sizeof(struct batadv_icmp_packet);
int ret = NET_RX_DROP;
/* we truncate all incoming icmp packets if they don't match our size */
- if (skb->len >= sizeof(struct icmp_packet_rr))
- hdr_size = sizeof(struct icmp_packet_rr);
+ if (skb->len >= sizeof(struct batadv_icmp_packet_rr))
+ hdr_size = sizeof(struct batadv_icmp_packet_rr);
/* drop packet if it has not necessary minimum size */
if (unlikely(!pskb_may_pull(skb, hdr_size)))
@@ -421,10 +421,10 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (!batadv_is_my_mac(ethhdr->h_dest))
goto out;
- icmp_packet = (struct icmp_packet_rr *)skb->data;
+ icmp_packet = (struct batadv_icmp_packet_rr *)skb->data;
/* add record route information if not full */
- if ((hdr_size == sizeof(struct icmp_packet_rr)) &&
+ if ((hdr_size == sizeof(struct batadv_icmp_packet_rr)) &&
(icmp_packet->rr_cur < BATADV_RR_LEN)) {
memcpy(&(icmp_packet->rr[icmp_packet->rr_cur]),
ethhdr->h_dest, ETH_ALEN);
@@ -452,7 +452,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (skb_cow(skb, ETH_HLEN) < 0)
goto out;
- icmp_packet = (struct icmp_packet_rr *)skb->data;
+ icmp_packet = (struct batadv_icmp_packet_rr *)skb->data;
/* decrement ttl */
icmp_packet->header.ttl--;
@@ -580,17 +580,19 @@ batadv_find_ifalter_router(struct orig_node *primary_orig,
int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
{
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
- struct tt_query_packet *tt_query;
+ struct batadv_tt_query_packet *tt_query;
uint16_t tt_size;
struct ethhdr *ethhdr;
char tt_flag;
+ size_t packet_size;
/* drop packet if it has not necessary minimum size */
- if (unlikely(!pskb_may_pull(skb, sizeof(struct tt_query_packet))))
+ if (unlikely(!pskb_may_pull(skb,
+ sizeof(struct batadv_tt_query_packet))))
goto out;
/* I could need to modify it */
- if (skb_cow(skb, sizeof(struct tt_query_packet)) < 0)
+ if (skb_cow(skb, sizeof(struct batadv_tt_query_packet)) < 0)
goto out;
ethhdr = (struct ethhdr *)skb_mac_header(skb);
@@ -603,7 +605,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
if (is_broadcast_ether_addr(ethhdr->h_source))
goto out;
- tt_query = (struct tt_query_packet *)skb->data;
+ tt_query = (struct batadv_tt_query_packet *)skb->data;
switch (tt_query->flags & BATADV_TT_QUERY_TYPE_MASK) {
case BATADV_TT_REQUEST:
@@ -635,13 +637,14 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
if (skb_linearize(skb) < 0)
goto out;
/* skb_linearize() possibly changed skb->data */
- tt_query = (struct tt_query_packet *)skb->data;
+ tt_query = (struct batadv_tt_query_packet *)skb->data;
tt_size = batadv_tt_len(ntohs(tt_query->tt_data));
/* Ensure we have all the claimed data */
- if (unlikely(skb_headlen(skb) <
- sizeof(struct tt_query_packet) + tt_size))
+ packet_size = sizeof(struct batadv_tt_query_packet);
+ packet_size += tt_size;
+ if (unlikely(skb_headlen(skb) < packet_size))
goto out;
batadv_handle_tt_response(bat_priv, tt_query);
@@ -667,12 +670,13 @@ out:
int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
{
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
- struct roam_adv_packet *roam_adv_packet;
+ struct batadv_roam_adv_packet *roam_adv_packet;
struct orig_node *orig_node;
struct ethhdr *ethhdr;
/* drop packet if it has not necessary minimum size */
- if (unlikely(!pskb_may_pull(skb, sizeof(struct roam_adv_packet))))
+ if (unlikely(!pskb_may_pull(skb,
+ sizeof(struct batadv_roam_adv_packet))))
goto out;
ethhdr = (struct ethhdr *)skb_mac_header(skb);
@@ -687,7 +691,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
- roam_adv_packet = (struct roam_adv_packet *)skb->data;
+ roam_adv_packet = (struct batadv_roam_adv_packet *)skb->data;
if (!batadv_is_my_mac(roam_adv_packet->dst))
return batadv_route_unicast_packet(skb, recv_if);
@@ -843,12 +847,12 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct orig_node *orig_node = NULL;
struct neigh_node *neigh_node = NULL;
- struct unicast_packet *unicast_packet;
+ struct batadv_unicast_packet *unicast_packet;
struct ethhdr *ethhdr = (struct ethhdr *)skb_mac_header(skb);
int ret = NET_RX_DROP;
struct sk_buff *new_skb;
- unicast_packet = (struct unicast_packet *)skb->data;
+ unicast_packet = (struct batadv_unicast_packet *)skb->data;
/* TTL exceeded */
if (unicast_packet->header.ttl < 2) {
@@ -873,7 +877,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
if (skb_cow(skb, ETH_HLEN) < 0)
goto out;
- unicast_packet = (struct unicast_packet *)skb->data;
+ unicast_packet = (struct batadv_unicast_packet *)skb->data;
if (unicast_packet->header.packet_type == BATADV_UNICAST &&
atomic_read(&bat_priv->fragmentation) &&
@@ -900,7 +904,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
}
skb = new_skb;
- unicast_packet = (struct unicast_packet *)skb->data;
+ unicast_packet = (struct batadv_unicast_packet *)skb->data;
}
/* decrement ttl */
@@ -929,15 +933,15 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv,
struct orig_node *orig_node;
struct ethhdr *ethhdr;
struct hard_iface *primary_if;
- struct unicast_packet *unicast_packet;
+ struct batadv_unicast_packet *unicast_packet;
bool tt_poss_change;
int is_old_ttvn;
/* I could need to modify it */
- if (skb_cow(skb, sizeof(struct unicast_packet)) < 0)
+ if (skb_cow(skb, sizeof(struct batadv_unicast_packet)) < 0)
return 0;
- unicast_packet = (struct unicast_packet *)skb->data;
+ unicast_packet = (struct batadv_unicast_packet *)skb->data;
if (batadv_is_my_mac(unicast_packet->dest)) {
tt_poss_change = bat_priv->tt_poss_change;
@@ -958,12 +962,12 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv,
is_old_ttvn = batadv_seq_before(unicast_packet->ttvn, curr_ttvn);
if (is_old_ttvn || tt_poss_change) {
/* check if there is enough data before accessing it */
- if (pskb_may_pull(skb, sizeof(struct unicast_packet) +
+ if (pskb_may_pull(skb, sizeof(struct batadv_unicast_packet) +
ETH_HLEN) < 0)
return 0;
ethhdr = (struct ethhdr *)(skb->data +
- sizeof(struct unicast_packet));
+ sizeof(struct batadv_unicast_packet));
/* we don't have an updated route for this client, so we should
* not try to reroute the packet!!
@@ -1005,7 +1009,7 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv,
int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
- struct unicast_packet *unicast_packet;
+ struct batadv_unicast_packet *unicast_packet;
int hdr_size = sizeof(*unicast_packet);
if (batadv_check_unicast_packet(skb, hdr_size) < 0)
@@ -1014,7 +1018,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (!batadv_check_unicast_ttvn(bat_priv, skb))
return NET_RX_DROP;
- unicast_packet = (struct unicast_packet *)skb->data;
+ unicast_packet = (struct batadv_unicast_packet *)skb->data;
/* packet for me */
if (batadv_is_my_mac(unicast_packet->dest)) {
@@ -1030,7 +1034,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
struct hard_iface *recv_if)
{
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
- struct unicast_frag_packet *unicast_packet;
+ struct batadv_unicast_frag_packet *unicast_packet;
int hdr_size = sizeof(*unicast_packet);
struct sk_buff *new_skb = NULL;
int ret;
@@ -1041,7 +1045,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
if (!batadv_check_unicast_ttvn(bat_priv, skb))
return NET_RX_DROP;
- unicast_packet = (struct unicast_frag_packet *)skb->data;
+ unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;
/* packet for me */
if (batadv_is_my_mac(unicast_packet->dest)) {
@@ -1056,7 +1060,7 @@ int batadv_recv_ucast_frag_packet(struct sk_buff *skb,
return NET_RX_SUCCESS;
batadv_interface_rx(recv_if->soft_iface, new_skb, recv_if,
- sizeof(struct unicast_packet));
+ sizeof(struct batadv_unicast_packet));
return NET_RX_SUCCESS;
}
@@ -1068,7 +1072,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct orig_node *orig_node = NULL;
- struct bcast_packet *bcast_packet;
+ struct batadv_bcast_packet *bcast_packet;
struct ethhdr *ethhdr;
int hdr_size = sizeof(*bcast_packet);
int ret = NET_RX_DROP;
@@ -1092,7 +1096,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (batadv_is_my_mac(ethhdr->h_source))
goto out;
- bcast_packet = (struct bcast_packet *)skb->data;
+ bcast_packet = (struct batadv_bcast_packet *)skb->data;
/* ignore broadcasts originated by myself */
if (batadv_is_my_mac(bcast_packet->orig))
@@ -1156,7 +1160,7 @@ out:
int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if)
{
- struct vis_packet *vis_packet;
+ struct batadv_vis_packet *vis_packet;
struct ethhdr *ethhdr;
struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
int hdr_size = sizeof(*vis_packet);
@@ -1168,7 +1172,7 @@ int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if)
if (unlikely(!pskb_may_pull(skb, hdr_size)))
return NET_RX_DROP;
- vis_packet = (struct vis_packet *)skb->data;
+ vis_packet = (struct batadv_vis_packet *)skb->data;
ethhdr = (struct ethhdr *)skb_mac_header(skb);
/* not for me */
diff --git a/net/batman-adv/routing.h b/net/batman-adv/routing.h
index c3fd219..ead4ae0 100644
--- a/net/batman-adv/routing.h
+++ b/net/batman-adv/routing.h
@@ -43,7 +43,7 @@ void batadv_bonding_candidate_add(struct orig_node *orig_node,
struct neigh_node *neigh_node);
void batadv_bonding_save_primary(const struct orig_node *orig_node,
struct orig_node *orig_neigh_node,
- const struct batman_ogm_packet
+ const struct batadv_ogm_packet
*batman_ogm_packet);
int batadv_window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff,
unsigned long *last_reset);
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index aad9818..67c1c6c 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -138,7 +138,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
{
struct hard_iface *primary_if = NULL;
struct forw_packet *forw_packet;
- struct bcast_packet *bcast_packet;
+ struct batadv_bcast_packet *bcast_packet;
struct sk_buff *newskb;
if (!batadv_atomic_dec_not_zero(&bat_priv->bcast_queue_left)) {
@@ -161,7 +161,7 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
goto packet_free;
/* as we have a copy now, it is safe to decrease the TTL */
- bcast_packet = (struct bcast_packet *)newskb->data;
+ bcast_packet = (struct batadv_bcast_packet *)newskb->data;
bcast_packet->header.ttl--;
skb_reset_mac_header(newskb);
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 0a00324..0a5d73a 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -133,7 +133,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
struct bat_priv *bat_priv = netdev_priv(soft_iface);
struct hard_iface *primary_if = NULL;
- struct bcast_packet *bcast_packet;
+ struct batadv_bcast_packet *bcast_packet;
struct vlan_ethhdr *vhdr;
__be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
static const uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, 0x00,
@@ -208,7 +208,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
if (batadv_skb_head_push(skb, sizeof(*bcast_packet)) < 0)
goto dropped;
- bcast_packet = (struct bcast_packet *)skb->data;
+ bcast_packet = (struct batadv_bcast_packet *)skb->data;
bcast_packet->header.version = BATADV_COMPAT_VERSION;
bcast_packet->header.ttl = BATADV_TTL;
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 9b35d1f..48217cc 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -212,7 +212,7 @@ unlock:
int batadv_tt_len(int changes_num)
{
- return changes_num * sizeof(struct tt_change);
+ return changes_num * sizeof(struct batadv_tt_change);
}
static int batadv_tt_local_init(struct bat_priv *bat_priv)
@@ -384,7 +384,7 @@ static int batadv_tt_changes_fill_buff(struct bat_priv *bat_priv,
list) {
if (count < tot_changes) {
memcpy(tt_buff + batadv_tt_len(count),
- &entry->change, sizeof(struct tt_change));
+ &entry->change, sizeof(struct batadv_tt_change));
count++;
}
list_del(&entry->list);
@@ -1366,31 +1366,32 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
void *cb_data)
{
struct tt_common_entry *tt_common_entry;
- struct tt_query_packet *tt_response;
- struct tt_change *tt_change;
+ struct batadv_tt_query_packet *tt_response;
+ struct batadv_tt_change *tt_change;
struct hlist_node *node;
struct hlist_head *head;
struct sk_buff *skb = NULL;
uint16_t tt_tot, tt_count;
- ssize_t tt_query_size = sizeof(struct tt_query_packet);
+ ssize_t tt_query_size = sizeof(struct batadv_tt_query_packet);
uint32_t i;
+ size_t len;
if (tt_query_size + tt_len > primary_if->soft_iface->mtu) {
tt_len = primary_if->soft_iface->mtu - tt_query_size;
- tt_len -= tt_len % sizeof(struct tt_change);
+ tt_len -= tt_len % sizeof(struct batadv_tt_change);
}
- tt_tot = tt_len / sizeof(struct tt_change);
+ tt_tot = tt_len / sizeof(struct batadv_tt_change);
- skb = dev_alloc_skb(tt_query_size + tt_len + ETH_HLEN);
+ len = tt_query_size + tt_len;
+ skb = dev_alloc_skb(len + ETH_HLEN);
if (!skb)
goto out;
skb_reserve(skb, ETH_HLEN);
- tt_response = (struct tt_query_packet *)skb_put(skb,
- tt_query_size + tt_len);
+ tt_response = (struct batadv_tt_query_packet *)skb_put(skb, len);
tt_response->ttvn = ttvn;
- tt_change = (struct tt_change *)(skb->data + tt_query_size);
+ tt_change = (struct batadv_tt_change *)(skb->data + tt_query_size);
tt_count = 0;
rcu_read_lock();
@@ -1430,11 +1431,12 @@ static int batadv_send_tt_request(struct bat_priv *bat_priv,
bool full_table)
{
struct sk_buff *skb = NULL;
- struct tt_query_packet *tt_request;
+ struct batadv_tt_query_packet *tt_request;
struct neigh_node *neigh_node = NULL;
struct hard_iface *primary_if;
struct tt_req_node *tt_req_node = NULL;
int ret = 1;
+ size_t tt_req_len;
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
@@ -1447,14 +1449,14 @@ static int batadv_send_tt_request(struct bat_priv *bat_priv,
if (!tt_req_node)
goto out;
- skb = dev_alloc_skb(sizeof(struct tt_query_packet) + ETH_HLEN);
+ skb = dev_alloc_skb(sizeof(*tt_request) + ETH_HLEN);
if (!skb)
goto out;
skb_reserve(skb, ETH_HLEN);
- tt_request = (struct tt_query_packet *)skb_put(skb,
- sizeof(struct tt_query_packet));
+ tt_req_len = sizeof(*tt_request);
+ tt_request = (struct batadv_tt_query_packet *)skb_put(skb, tt_req_len);
tt_request->header.packet_type = BATADV_TT_QUERY;
tt_request->header.version = BATADV_COMPAT_VERSION;
@@ -1498,8 +1500,9 @@ out:
return ret;
}
-static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_request)
+static bool
+batadv_send_other_tt_response(struct bat_priv *bat_priv,
+ struct batadv_tt_query_packet *tt_request)
{
struct orig_node *req_dst_orig_node = NULL, *res_dst_orig_node = NULL;
struct neigh_node *neigh_node = NULL;
@@ -1510,7 +1513,8 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
bool full_table;
uint16_t tt_len, tt_tot;
struct sk_buff *skb = NULL;
- struct tt_query_packet *tt_response;
+ struct batadv_tt_query_packet *tt_response;
+ size_t len;
batadv_dbg(BATADV_DBG_TT, bat_priv,
"Received TT_REQUEST from %pM for ttvn: %u (%pM) [%c]\n",
@@ -1555,28 +1559,28 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
if (!full_table) {
spin_lock_bh(&req_dst_orig_node->tt_buff_lock);
tt_len = req_dst_orig_node->tt_buff_len;
- tt_tot = tt_len / sizeof(struct tt_change);
+ tt_tot = tt_len / sizeof(struct batadv_tt_change);
- skb = dev_alloc_skb(sizeof(struct tt_query_packet) +
- tt_len + ETH_HLEN);
+ len = sizeof(*tt_response) + tt_len;
+ skb = dev_alloc_skb(len + ETH_HLEN);
if (!skb)
goto unlock;
skb_reserve(skb, ETH_HLEN);
- tt_response = (struct tt_query_packet *)skb_put(skb,
- sizeof(struct tt_query_packet) + tt_len);
+ tt_response = (struct batadv_tt_query_packet *)skb_put(skb,
+ len);
tt_response->ttvn = req_ttvn;
tt_response->tt_data = htons(tt_tot);
- tt_buff = skb->data + sizeof(struct tt_query_packet);
+ tt_buff = skb->data + sizeof(*tt_response);
/* Copy the last orig_node's OGM buffer */
memcpy(tt_buff, req_dst_orig_node->tt_buff,
req_dst_orig_node->tt_buff_len);
spin_unlock_bh(&req_dst_orig_node->tt_buff_lock);
} else {
- tt_len = (uint16_t)atomic_read(&req_dst_orig_node->tt_size) *
- sizeof(struct tt_change);
+ tt_len = (uint16_t)atomic_read(&req_dst_orig_node->tt_size);
+ tt_len *= sizeof(struct batadv_tt_change);
ttvn = (uint8_t)atomic_read(&req_dst_orig_node->last_ttvn);
skb = batadv_tt_response_fill_table(tt_len, ttvn,
@@ -1587,7 +1591,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
if (!skb)
goto out;
- tt_response = (struct tt_query_packet *)skb->data;
+ tt_response = (struct batadv_tt_query_packet *)skb->data;
}
tt_response->header.packet_type = BATADV_TT_QUERY;
@@ -1628,8 +1632,10 @@ out:
return ret;
}
-static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_request)
+
+static bool
+batadv_send_my_tt_response(struct bat_priv *bat_priv,
+ struct batadv_tt_query_packet *tt_request)
{
struct orig_node *orig_node = NULL;
struct neigh_node *neigh_node = NULL;
@@ -1640,7 +1646,8 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
bool full_table;
uint16_t tt_len, tt_tot;
struct sk_buff *skb = NULL;
- struct tt_query_packet *tt_response;
+ struct batadv_tt_query_packet *tt_response;
+ size_t len;
batadv_dbg(BATADV_DBG_TT, bat_priv,
"Received TT_REQUEST from %pM for ttvn: %u (me) [%c]\n",
@@ -1678,26 +1685,26 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
if (!full_table) {
spin_lock_bh(&bat_priv->tt_buff_lock);
tt_len = bat_priv->tt_buff_len;
- tt_tot = tt_len / sizeof(struct tt_change);
+ tt_tot = tt_len / sizeof(struct batadv_tt_change);
- skb = dev_alloc_skb(sizeof(struct tt_query_packet) +
- tt_len + ETH_HLEN);
+ len = sizeof(*tt_response) + tt_len;
+ skb = dev_alloc_skb(len + ETH_HLEN);
if (!skb)
goto unlock;
skb_reserve(skb, ETH_HLEN);
- tt_response = (struct tt_query_packet *)skb_put(skb,
- sizeof(struct tt_query_packet) + tt_len);
+ tt_response = (struct batadv_tt_query_packet *)skb_put(skb,
+ len);
tt_response->ttvn = req_ttvn;
tt_response->tt_data = htons(tt_tot);
- tt_buff = skb->data + sizeof(struct tt_query_packet);
+ tt_buff = skb->data + sizeof(*tt_response);
memcpy(tt_buff, bat_priv->tt_buff,
bat_priv->tt_buff_len);
spin_unlock_bh(&bat_priv->tt_buff_lock);
} else {
- tt_len = (uint16_t)atomic_read(&bat_priv->num_local_tt) *
- sizeof(struct tt_change);
+ tt_len = (uint16_t)atomic_read(&bat_priv->num_local_tt);
+ tt_len *= sizeof(struct batadv_tt_change);
ttvn = (uint8_t)atomic_read(&bat_priv->ttvn);
skb = batadv_tt_response_fill_table(tt_len, ttvn,
@@ -1708,7 +1715,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
if (!skb)
goto out;
- tt_response = (struct tt_query_packet *)skb->data;
+ tt_response = (struct batadv_tt_query_packet *)skb->data;
}
tt_response->header.packet_type = BATADV_TT_QUERY;
@@ -1748,7 +1755,7 @@ out:
}
bool batadv_send_tt_response(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_request)
+ struct batadv_tt_query_packet *tt_request)
{
if (batadv_is_my_mac(tt_request->dst)) {
/* don't answer backbone gws! */
@@ -1763,7 +1770,7 @@ bool batadv_send_tt_response(struct bat_priv *bat_priv,
static void _batadv_tt_update_changes(struct bat_priv *bat_priv,
struct orig_node *orig_node,
- struct tt_change *tt_change,
+ struct batadv_tt_change *tt_change,
uint16_t tt_num_changes, uint8_t ttvn)
{
int i;
@@ -1793,7 +1800,7 @@ static void _batadv_tt_update_changes(struct bat_priv *bat_priv,
}
static void batadv_tt_fill_gtable(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_response)
+ struct batadv_tt_query_packet *tt_response)
{
struct orig_node *orig_node = NULL;
@@ -1805,7 +1812,7 @@ static void batadv_tt_fill_gtable(struct bat_priv *bat_priv,
batadv_tt_global_del_orig(bat_priv, orig_node, "Received full table");
_batadv_tt_update_changes(bat_priv, orig_node,
- (struct tt_change *)(tt_response + 1),
+ (struct batadv_tt_change *)(tt_response + 1),
ntohs(tt_response->tt_data),
tt_response->ttvn);
@@ -1825,7 +1832,7 @@ out:
static void batadv_tt_update_changes(struct bat_priv *bat_priv,
struct orig_node *orig_node,
uint16_t tt_num_changes, uint8_t ttvn,
- struct tt_change *tt_change)
+ struct batadv_tt_change *tt_change)
{
_batadv_tt_update_changes(bat_priv, orig_node, tt_change,
tt_num_changes, ttvn);
@@ -1856,10 +1863,11 @@ out:
}
void batadv_handle_tt_response(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_response)
+ struct batadv_tt_query_packet *tt_response)
{
struct tt_req_node *node, *safe;
struct orig_node *orig_node = NULL;
+ struct batadv_tt_change *tt_change;
batadv_dbg(BATADV_DBG_TT, bat_priv,
"Received TT_RESPONSE from %pM for ttvn %d t_size: %d [%c]\n",
@@ -1875,13 +1883,14 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv,
if (!orig_node)
goto out;
- if (tt_response->flags & BATADV_TT_FULL_TABLE)
+ if (tt_response->flags & BATADV_TT_FULL_TABLE) {
batadv_tt_fill_gtable(bat_priv, tt_response);
- else
+ } else {
+ tt_change = (struct batadv_tt_change *)(tt_response + 1);
batadv_tt_update_changes(bat_priv, orig_node,
ntohs(tt_response->tt_data),
- tt_response->ttvn,
- (struct tt_change *)(tt_response + 1));
+ tt_response->ttvn, tt_change);
+ }
/* Delete the tt_req_node from pending tt_requests list */
spin_lock_bh(&bat_priv->tt_req_list_lock);
@@ -2006,9 +2015,10 @@ static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
{
struct neigh_node *neigh_node = NULL;
struct sk_buff *skb = NULL;
- struct roam_adv_packet *roam_adv_packet;
+ struct batadv_roam_adv_packet *roam_adv_packet;
int ret = 1;
struct hard_iface *primary_if;
+ size_t len = sizeof(*roam_adv_packet);
/* before going on we have to check whether the client has
* already roamed to us too many times
@@ -2016,14 +2026,13 @@ static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
if (!batadv_tt_check_roam_count(bat_priv, client))
goto out;
- skb = dev_alloc_skb(sizeof(struct roam_adv_packet) + ETH_HLEN);
+ skb = dev_alloc_skb(sizeof(*roam_adv_packet) + ETH_HLEN);
if (!skb)
goto out;
skb_reserve(skb, ETH_HLEN);
- roam_adv_packet = (struct roam_adv_packet *)skb_put(skb,
- sizeof(struct roam_adv_packet));
+ roam_adv_packet = (struct batadv_roam_adv_packet *)skb_put(skb, len);
roam_adv_packet->header.packet_type = BATADV_ROAM_ADV;
roam_adv_packet->header.version = BATADV_COMPAT_VERSION;
@@ -2255,6 +2264,7 @@ void batadv_tt_update_orig(struct bat_priv *bat_priv,
{
uint8_t orig_ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn);
bool full_table = true;
+ struct batadv_tt_change *tt_change;
/* don't care about a backbone gateways updates. */
if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig))
@@ -2275,8 +2285,9 @@ void batadv_tt_update_orig(struct bat_priv *bat_priv,
goto request_table;
}
+ tt_change = (struct batadv_tt_change *)tt_buff;
batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes,
- ttvn, (struct tt_change *)tt_buff);
+ ttvn, tt_change);
/* Even if we received the precomputed crc with the OGM, we
* prefer to recompute it to spot any possible inconsistency
diff --git a/net/batman-adv/translation-table.h b/net/batman-adv/translation-table.h
index 46b60bd..4e83b29 100644
--- a/net/batman-adv/translation-table.h
+++ b/net/batman-adv/translation-table.h
@@ -43,10 +43,10 @@ struct orig_node *batadv_transtable_search(struct bat_priv *bat_priv,
const uint8_t *addr);
void batadv_tt_free(struct bat_priv *bat_priv);
bool batadv_send_tt_response(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_request);
+ struct batadv_tt_query_packet *tt_request);
bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr);
void batadv_handle_tt_response(struct bat_priv *bat_priv,
- struct tt_query_packet *tt_response);
+ struct batadv_tt_query_packet *tt_response);
bool batadv_is_ap_isolated(struct bat_priv *bat_priv, uint8_t *src,
uint8_t *dst);
void batadv_tt_update_orig(struct bat_priv *bat_priv,
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 9dddaf1..fb61d9c 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -25,8 +25,8 @@
#include <linux/kernel.h>
#define BATADV_HEADER_LEN \
- (ETH_HLEN + max(sizeof(struct unicast_packet), \
- sizeof(struct bcast_packet)))
+ (ETH_HLEN + max(sizeof(struct batadv_unicast_packet), \
+ sizeof(struct batadv_bcast_packet)))
struct hard_iface {
struct list_head list;
@@ -211,7 +211,7 @@ struct bat_priv {
#ifdef CONFIG_BATMAN_ADV_BLA
struct bcast_duplist_entry bcast_duplist[BATADV_DUPLIST_SIZE];
int bcast_duplist_curr;
- struct bla_claim_dst claim_dest;
+ struct batadv_bla_claim_dst claim_dest;
#endif
spinlock_t forw_bat_list_lock; /* protects forw_bat_list */
spinlock_t forw_bcast_list_lock; /* protects */
@@ -250,7 +250,7 @@ struct socket_client {
struct socket_packet {
struct list_head list;
size_t icmp_len;
- struct icmp_packet_rr icmp_packet;
+ struct batadv_icmp_packet_rr icmp_packet;
};
struct tt_common_entry {
@@ -306,7 +306,7 @@ struct claim {
struct tt_change_node {
struct list_head list;
- struct tt_change change;
+ struct batadv_tt_change change;
};
struct tt_req_node {
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index c460355..8a2a3df 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -34,13 +34,13 @@ batadv_frag_merge_packet(struct list_head *head,
struct frag_packet_list_entry *tfp,
struct sk_buff *skb)
{
- struct unicast_frag_packet *up =
- (struct unicast_frag_packet *)skb->data;
+ struct batadv_unicast_frag_packet *up;
struct sk_buff *tmp_skb;
- struct unicast_packet *unicast_packet;
+ struct batadv_unicast_packet *unicast_packet;
int hdr_len = sizeof(*unicast_packet);
int uni_diff = sizeof(*up) - hdr_len;
+ up = (struct batadv_unicast_frag_packet *)skb->data;
/* set skb to the first part and tmp_skb to the second part */
if (up->flags & BATADV_UNI_FRAG_HEAD) {
tmp_skb = tfp->skb;
@@ -65,7 +65,8 @@ batadv_frag_merge_packet(struct list_head *head,
kfree_skb(tmp_skb);
memmove(skb->data + uni_diff, skb->data, hdr_len);
- unicast_packet = (struct unicast_packet *)skb_pull(skb, uni_diff);
+ unicast_packet = (struct batadv_unicast_packet *)skb_pull(skb,
+ uni_diff);
unicast_packet->header.packet_type = BATADV_UNICAST;
return skb;
@@ -80,8 +81,9 @@ static void batadv_frag_create_entry(struct list_head *head,
struct sk_buff *skb)
{
struct frag_packet_list_entry *tfp;
- struct unicast_frag_packet *up =
- (struct unicast_frag_packet *)skb->data;
+ struct batadv_unicast_frag_packet *up;
+
+ up = (struct batadv_unicast_frag_packet *)skb->data;
/* free and oldest packets stand at the end */
tfp = list_entry((head)->prev, typeof(*tfp), list);
@@ -115,10 +117,10 @@ static int batadv_frag_create_buffer(struct list_head *head)
static struct frag_packet_list_entry *
batadv_frag_search_packet(struct list_head *head,
- const struct unicast_frag_packet *up)
+ const struct batadv_unicast_frag_packet *up)
{
struct frag_packet_list_entry *tfp;
- struct unicast_frag_packet *tmp_up = NULL;
+ struct batadv_unicast_frag_packet *tmp_up = NULL;
uint16_t search_seqno;
if (up->flags & BATADV_UNI_FRAG_HEAD)
@@ -134,7 +136,7 @@ batadv_frag_search_packet(struct list_head *head,
if (tfp->seqno == ntohs(up->seqno))
goto mov_tail;
- tmp_up = (struct unicast_frag_packet *)tfp->skb->data;
+ tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data;
if (tfp->seqno == search_seqno) {
@@ -179,9 +181,9 @@ int batadv_frag_reassemble_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct orig_node *orig_node;
struct frag_packet_list_entry *tmp_frag_entry;
int ret = NET_RX_DROP;
- struct unicast_frag_packet *unicast_packet =
- (struct unicast_frag_packet *)skb->data;
+ struct batadv_unicast_frag_packet *unicast_packet;
+ unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;
*new_skb = NULL;
orig_node = batadv_orig_hash_find(bat_priv, unicast_packet->orig);
@@ -220,10 +222,10 @@ out:
int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
struct hard_iface *hard_iface, const uint8_t dstaddr[])
{
- struct unicast_packet tmp_uc, *unicast_packet;
+ struct batadv_unicast_packet tmp_uc, *unicast_packet;
struct hard_iface *primary_if;
struct sk_buff *frag_skb;
- struct unicast_frag_packet *frag1, *frag2;
+ struct batadv_unicast_frag_packet *frag1, *frag2;
int uc_hdr_len = sizeof(*unicast_packet);
int ucf_hdr_len = sizeof(*frag1);
int data_len = skb->len - uc_hdr_len;
@@ -239,7 +241,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
goto dropped;
skb_reserve(frag_skb, ucf_hdr_len);
- unicast_packet = (struct unicast_packet *)skb->data;
+ unicast_packet = (struct batadv_unicast_packet *)skb->data;
memcpy(&tmp_uc, unicast_packet, uc_hdr_len);
skb_split(skb, frag_skb, data_len / 2 + uc_hdr_len);
@@ -247,8 +249,8 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
batadv_skb_head_push(frag_skb, ucf_hdr_len) < 0)
goto drop_frag;
- frag1 = (struct unicast_frag_packet *)skb->data;
- frag2 = (struct unicast_frag_packet *)frag_skb->data;
+ frag1 = (struct batadv_unicast_frag_packet *)skb->data;
+ frag2 = (struct batadv_unicast_frag_packet *)frag_skb->data;
memcpy(frag1, &tmp_uc, sizeof(tmp_uc));
@@ -287,7 +289,7 @@ out:
int batadv_unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
{
struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
- struct unicast_packet *unicast_packet;
+ struct batadv_unicast_packet *unicast_packet;
struct orig_node *orig_node;
struct neigh_node *neigh_node;
int data_len = skb->len;
@@ -317,7 +319,7 @@ find_router:
if (batadv_skb_head_push(skb, sizeof(*unicast_packet)) < 0)
goto out;
- unicast_packet = (struct unicast_packet *)skb->data;
+ unicast_packet = (struct batadv_unicast_packet *)skb->data;
unicast_packet->header.version = BATADV_COMPAT_VERSION;
/* batman packet type: unicast */
diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h
index 510e23f..e0b6e33 100644
--- a/net/batman-adv/unicast.h
+++ b/net/batman-adv/unicast.h
@@ -35,11 +35,11 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
static inline int batadv_frag_can_reassemble(const struct sk_buff *skb, int mtu)
{
- const struct unicast_frag_packet *unicast_packet;
+ const struct batadv_unicast_frag_packet *unicast_packet;
int uneven_correction = 0;
unsigned int merged_size;
- unicast_packet = (struct unicast_frag_packet *)skb->data;
+ unicast_packet = (struct batadv_unicast_frag_packet *)skb->data;
if (unicast_packet->flags & BATADV_UNI_FRAG_LARGETAIL) {
if (unicast_packet->flags & BATADV_UNI_FRAG_HEAD)
@@ -49,7 +49,7 @@ static inline int batadv_frag_can_reassemble(const struct sk_buff *skb, int mtu)
}
merged_size = (skb->len - sizeof(*unicast_packet)) * 2;
- merged_size += sizeof(struct unicast_packet) + uneven_correction;
+ merged_size += sizeof(struct batadv_unicast_packet) + uneven_correction;
return merged_size <= mtu;
}
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index c1fafa3..309493d 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -53,12 +53,12 @@ static void batadv_free_info(struct kref *ref)
static int batadv_vis_info_cmp(const struct hlist_node *node, const void *data2)
{
const struct vis_info *d1, *d2;
- const struct vis_packet *p1, *p2;
+ const struct batadv_vis_packet *p1, *p2;
d1 = container_of(node, struct vis_info, hash_entry);
d2 = data2;
- p1 = (struct vis_packet *)d1->skb_packet->data;
- p2 = (struct vis_packet *)d2->skb_packet->data;
+ p1 = (struct batadv_vis_packet *)d1->skb_packet->data;
+ p2 = (struct batadv_vis_packet *)d2->skb_packet->data;
return batadv_compare_eth(p1->vis_orig, p2->vis_orig);
}
@@ -68,12 +68,12 @@ static int batadv_vis_info_cmp(const struct hlist_node *node, const void *data2)
static uint32_t batadv_vis_info_choose(const void *data, uint32_t size)
{
const struct vis_info *vis_info = data;
- const struct vis_packet *packet;
+ const struct batadv_vis_packet *packet;
const unsigned char *key;
uint32_t hash = 0;
size_t i;
- packet = (struct vis_packet *)vis_info->skb_packet->data;
+ packet = (struct batadv_vis_packet *)vis_info->skb_packet->data;
key = packet->vis_orig;
for (i = 0; i < ETH_ALEN; i++) {
hash += key[i];
@@ -169,7 +169,7 @@ static ssize_t batadv_vis_data_read_entry(struct seq_file *seq,
}
static void batadv_vis_data_insert_interfaces(struct hlist_head *list,
- struct vis_packet *packet,
+ struct batadv_vis_packet *packet,
struct vis_info_entry *entries)
{
int i;
@@ -187,7 +187,7 @@ static void batadv_vis_data_insert_interfaces(struct hlist_head *list,
static void batadv_vis_data_read_entries(struct seq_file *seq,
struct hlist_head *list,
- struct vis_packet *packet,
+ struct batadv_vis_packet *packet,
struct vis_info_entry *entries)
{
int i;
@@ -214,7 +214,7 @@ static void batadv_vis_seq_print_text_bucket(struct seq_file *seq,
{
struct hlist_node *node;
struct vis_info *info;
- struct vis_packet *packet;
+ struct batadv_vis_packet *packet;
uint8_t *entries_pos;
struct vis_info_entry *entries;
struct if_list_entry *entry;
@@ -223,7 +223,7 @@ static void batadv_vis_seq_print_text_bucket(struct seq_file *seq,
HLIST_HEAD(vis_if_list);
hlist_for_each_entry_rcu(info, node, head, hash_entry) {
- packet = (struct vis_packet *)info->skb_packet->data;
+ packet = (struct batadv_vis_packet *)info->skb_packet->data;
entries_pos = (uint8_t *)packet + sizeof(*packet);
entries = (struct vis_info_entry *)entries_pos;
@@ -334,15 +334,17 @@ static int batadv_recv_list_is_in(struct bat_priv *bat_priv,
* is newer than old entries in the hash.
*/
static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv,
- struct vis_packet *vis_packet,
+ struct batadv_vis_packet *vis_packet,
int vis_info_len, int *is_new,
int make_broadcast)
{
struct vis_info *info, *old_info;
- struct vis_packet *search_packet, *old_packet;
+ struct batadv_vis_packet *search_packet, *old_packet;
struct vis_info search_elem;
- struct vis_packet *packet;
+ struct batadv_vis_packet *packet;
+ struct sk_buff *tmp_skb;
int hash_added;
+ size_t len;
*is_new = 0;
/* sanity check */
@@ -353,15 +355,17 @@ static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv,
search_elem.skb_packet = dev_alloc_skb(sizeof(*search_packet));
if (!search_elem.skb_packet)
return NULL;
- search_packet = (struct vis_packet *)skb_put(search_elem.skb_packet,
- sizeof(*search_packet));
+ len = sizeof(*search_packet);
+ tmp_skb = search_elem.skb_packet;
+ search_packet = (struct batadv_vis_packet *)skb_put(tmp_skb, len);
memcpy(search_packet->vis_orig, vis_packet->vis_orig, ETH_ALEN);
old_info = batadv_vis_hash_find(bat_priv, &search_elem);
kfree_skb(search_elem.skb_packet);
if (old_info) {
- old_packet = (struct vis_packet *)old_info->skb_packet->data;
+ tmp_skb = old_info->skb_packet;
+ old_packet = (struct batadv_vis_packet *)tmp_skb->data;
if (!batadv_seq_after(ntohl(vis_packet->seqno),
ntohl(old_packet->seqno))) {
if (old_packet->seqno == vis_packet->seqno) {
@@ -385,22 +389,21 @@ static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv,
if (!info)
return NULL;
- info->skb_packet = dev_alloc_skb(sizeof(*packet) + vis_info_len +
- ETH_HLEN);
+ len = sizeof(*packet) + vis_info_len;
+ info->skb_packet = dev_alloc_skb(len + ETH_HLEN);
if (!info->skb_packet) {
kfree(info);
return NULL;
}
skb_reserve(info->skb_packet, ETH_HLEN);
- packet = (struct vis_packet *)skb_put(info->skb_packet, sizeof(*packet)
- + vis_info_len);
+ packet = (struct batadv_vis_packet *)skb_put(info->skb_packet, len);
kref_init(&info->refcount);
INIT_LIST_HEAD(&info->send_list);
INIT_LIST_HEAD(&info->recv_list);
info->first_seen = jiffies;
info->bat_priv = bat_priv;
- memcpy(packet, vis_packet, sizeof(*packet) + vis_info_len);
+ memcpy(packet, vis_packet, len);
/* initialize and add new packet. */
*is_new = 1;
@@ -430,7 +433,7 @@ static struct vis_info *batadv_add_packet(struct bat_priv *bat_priv,
/* handle the server sync packet, forward if needed. */
void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
- struct vis_packet *vis_packet,
+ struct batadv_vis_packet *vis_packet,
int vis_info_len)
{
struct vis_info *info;
@@ -456,11 +459,11 @@ end:
/* handle an incoming client update packet and schedule forward if needed. */
void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
- struct vis_packet *vis_packet,
+ struct batadv_vis_packet *vis_packet,
int vis_info_len)
{
struct vis_info *info;
- struct vis_packet *packet;
+ struct batadv_vis_packet *packet;
int is_new;
int vis_server = atomic_read(&bat_priv->vis_mode);
int are_target = 0;
@@ -482,7 +485,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
goto end;
/* note that outdated packets will be dropped at this point. */
- packet = (struct vis_packet *)info->skb_packet->data;
+ packet = (struct batadv_vis_packet *)info->skb_packet->data;
/* send only if we're the target server or ... */
if (are_target && is_new) {
@@ -511,11 +514,11 @@ static int batadv_find_best_vis_server(struct bat_priv *bat_priv,
struct hlist_node *node;
struct hlist_head *head;
struct orig_node *orig_node;
- struct vis_packet *packet;
+ struct batadv_vis_packet *packet;
int best_tq = -1;
uint32_t i;
- packet = (struct vis_packet *)info->skb_packet->data;
+ packet = (struct batadv_vis_packet *)info->skb_packet->data;
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];
@@ -543,10 +546,10 @@ static int batadv_find_best_vis_server(struct bat_priv *bat_priv,
/* Return true if the vis packet is full. */
static bool batadv_vis_packet_full(const struct vis_info *info)
{
- const struct vis_packet *packet;
+ const struct batadv_vis_packet *packet;
size_t num_items;
- packet = (struct vis_packet *)info->skb_packet->data;
+ packet = (struct batadv_vis_packet *)info->skb_packet->data;
num_items = BATADV_MAX_VIS_PACKET_SIZE / sizeof(struct vis_info_entry);
if (num_items < packet->entries + 1)
@@ -565,13 +568,14 @@ static int batadv_generate_vis_packet(struct bat_priv *bat_priv)
struct orig_node *orig_node;
struct neigh_node *router;
struct vis_info *info = bat_priv->my_vis_info;
- struct vis_packet *packet = (struct vis_packet *)info->skb_packet->data;
+ struct batadv_vis_packet *packet;
struct vis_info_entry *entry;
struct tt_common_entry *tt_common_entry;
int best_tq = -1;
uint32_t i;
info->first_seen = jiffies;
+ packet = (struct batadv_vis_packet *)info->skb_packet->data;
packet->vis_type = atomic_read(&bat_priv->vis_mode);
memcpy(packet->target_orig, batadv_broadcast_addr, ETH_ALEN);
@@ -691,14 +695,14 @@ static void batadv_broadcast_vis_packet(struct bat_priv *bat_priv,
struct hlist_node *node;
struct hlist_head *head;
struct orig_node *orig_node;
- struct vis_packet *packet;
+ struct batadv_vis_packet *packet;
struct sk_buff *skb;
struct hard_iface *hard_iface;
uint8_t dstaddr[ETH_ALEN];
uint32_t i;
- packet = (struct vis_packet *)info->skb_packet->data;
+ packet = (struct batadv_vis_packet *)info->skb_packet->data;
/* send to all routers in range. */
for (i = 0; i < hash->size; i++) {
@@ -745,9 +749,9 @@ static void batadv_unicast_vis_packet(struct bat_priv *bat_priv,
struct orig_node *orig_node;
struct neigh_node *router = NULL;
struct sk_buff *skb;
- struct vis_packet *packet;
+ struct batadv_vis_packet *packet;
- packet = (struct vis_packet *)info->skb_packet->data;
+ packet = (struct batadv_vis_packet *)info->skb_packet->data;
orig_node = batadv_orig_hash_find(bat_priv, packet->target_orig);
if (!orig_node)
@@ -773,13 +777,13 @@ static void batadv_send_vis_packet(struct bat_priv *bat_priv,
struct vis_info *info)
{
struct hard_iface *primary_if;
- struct vis_packet *packet;
+ struct batadv_vis_packet *packet;
primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;
- packet = (struct vis_packet *)info->skb_packet->data;
+ packet = (struct batadv_vis_packet *)info->skb_packet->data;
if (packet->header.ttl < 2) {
pr_debug("Error - can't send vis packet: ttl exceeded\n");
goto out;
@@ -838,10 +842,11 @@ static void batadv_send_vis_packets(struct work_struct *work)
*/
int batadv_vis_init(struct bat_priv *bat_priv)
{
- struct vis_packet *packet;
+ struct batadv_vis_packet *packet;
int hash_added;
unsigned int len;
unsigned long first_seen;
+ struct sk_buff *tmp_skb;
if (bat_priv->vis_hash)
return 0;
@@ -864,8 +869,8 @@ int batadv_vis_init(struct bat_priv *bat_priv)
goto free_info;
skb_reserve(bat_priv->my_vis_info->skb_packet, ETH_HLEN);
- packet = (struct vis_packet *)skb_put(bat_priv->my_vis_info->skb_packet,
- sizeof(*packet));
+ tmp_skb = bat_priv->my_vis_info->skb_packet;
+ packet = (struct batadv_vis_packet *)skb_put(tmp_skb, sizeof(*packet));
/* prefill the vis info */
first_seen = jiffies - msecs_to_jiffies(BATADV_VIS_INTERVAL);
diff --git a/net/batman-adv/vis.h b/net/batman-adv/vis.h
index 16a1a6b..d6bfcc7 100644
--- a/net/batman-adv/vis.h
+++ b/net/batman-adv/vis.h
@@ -25,10 +25,10 @@
int batadv_vis_seq_print_text(struct seq_file *seq, void *offset);
void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
- struct vis_packet *vis_packet,
+ struct batadv_vis_packet *vis_packet,
int vis_info_len);
void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
- struct vis_packet *vis_packet,
+ struct batadv_vis_packet *vis_packet,
int vis_info_len);
int batadv_vis_init(struct bat_priv *bat_priv);
void batadv_vis_quit(struct bat_priv *bat_priv);
--
1.7.9.4
^ permalink raw reply related
* [PATCH 08/16] batman-adv: Prefix local sysfs struct with batadv_
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1341186226-10549-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bat_sysfs.c | 12 ++++++------
net/batman-adv/bat_sysfs.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index c4794c6..eb17629 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -54,7 +54,7 @@ static char *batadv_uev_type_str[] = {
/* Use this, if you have customized show and store functions */
#define BATADV_ATTR(_name, _mode, _show, _store) \
-struct bat_attribute batadv_attr_##_name = { \
+struct batadv_attribute batadv_attr_##_name = { \
.attr = {.name = __stringify(_name), \
.mode = _mode }, \
.show = _show, \
@@ -488,7 +488,7 @@ static BATADV_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth,
BATADV_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, BATADV_DBG_ALL, NULL);
#endif
-static struct bat_attribute *batadv_mesh_attrs[] = {
+static struct batadv_attribute *batadv_mesh_attrs[] = {
&batadv_attr_aggregated_ogms,
&batadv_attr_bonding,
#ifdef CONFIG_BATMAN_ADV_BLA
@@ -513,7 +513,7 @@ int batadv_sysfs_add_meshif(struct net_device *dev)
{
struct kobject *batif_kobject = &dev->dev.kobj;
struct bat_priv *bat_priv = netdev_priv(dev);
- struct bat_attribute **bat_attr;
+ struct batadv_attribute **bat_attr;
int err;
bat_priv->mesh_obj = kobject_create_and_add(BATADV_SYSFS_IF_MESH_SUBDIR,
@@ -550,7 +550,7 @@ out:
void batadv_sysfs_del_meshif(struct net_device *dev)
{
struct bat_priv *bat_priv = netdev_priv(dev);
- struct bat_attribute **bat_attr;
+ struct batadv_attribute **bat_attr;
for (bat_attr = batadv_mesh_attrs; *bat_attr; ++bat_attr)
sysfs_remove_file(bat_priv->mesh_obj, &((*bat_attr)->attr));
@@ -677,7 +677,7 @@ static BATADV_ATTR(mesh_iface, S_IRUGO | S_IWUSR, batadv_show_mesh_iface,
batadv_store_mesh_iface);
static BATADV_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL);
-static struct bat_attribute *batadv_batman_attrs[] = {
+static struct batadv_attribute *batadv_batman_attrs[] = {
&batadv_attr_mesh_iface,
&batadv_attr_iface_status,
NULL,
@@ -686,7 +686,7 @@ static struct bat_attribute *batadv_batman_attrs[] = {
int batadv_sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev)
{
struct kobject *hardif_kobject = &dev->dev.kobj;
- struct bat_attribute **bat_attr;
+ struct batadv_attribute **bat_attr;
int err;
*hardif_obj = kobject_create_and_add(BATADV_SYSFS_IF_BAT_SUBDIR,
diff --git a/net/batman-adv/bat_sysfs.h b/net/batman-adv/bat_sysfs.h
index 28c2948..88f95f8 100644
--- a/net/batman-adv/bat_sysfs.h
+++ b/net/batman-adv/bat_sysfs.h
@@ -23,7 +23,7 @@
#define BATADV_SYSFS_IF_MESH_SUBDIR "mesh"
#define BATADV_SYSFS_IF_BAT_SUBDIR "batman_adv"
-struct bat_attribute {
+struct batadv_attribute {
struct attribute attr;
ssize_t (*show)(struct kobject *kobj, struct attribute *attr,
char *buf);
--
1.7.9.4
^ permalink raw reply related
* [PATCH 07/16] batman-adv: Prefix hash struct and typedef with batadv_
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1341186226-10549-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bridge_loop_avoidance.c | 20 +++++++++----------
net/batman-adv/hash.c | 10 +++++-----
net/batman-adv/hash.h | 33 +++++++++++++++++---------------
net/batman-adv/originator.c | 10 +++++-----
net/batman-adv/originator.h | 2 +-
net/batman-adv/routing.c | 2 +-
net/batman-adv/translation-table.c | 30 ++++++++++++++---------------
net/batman-adv/types.h | 12 ++++++------
net/batman-adv/vis.c | 12 ++++++------
9 files changed, 67 insertions(+), 64 deletions(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index b463402..8bd7050 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -133,7 +133,7 @@ static void batadv_claim_free_ref(struct claim *claim)
static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv,
struct claim *data)
{
- struct hashtable_t *hash = bat_priv->claim_hash;
+ struct batadv_hashtable *hash = bat_priv->claim_hash;
struct hlist_head *head;
struct hlist_node *node;
struct claim *claim;
@@ -172,7 +172,7 @@ static struct claim *batadv_claim_hash_find(struct bat_priv *bat_priv,
static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv,
uint8_t *addr, short vid)
{
- struct hashtable_t *hash = bat_priv->backbone_hash;
+ struct batadv_hashtable *hash = bat_priv->backbone_hash;
struct hlist_head *head;
struct hlist_node *node;
struct backbone_gw search_entry, *backbone_gw;
@@ -208,7 +208,7 @@ static struct backbone_gw *batadv_backbone_hash_find(struct bat_priv *bat_priv,
/* delete all claims for a backbone */
static void batadv_bla_del_backbone_claims(struct backbone_gw *backbone_gw)
{
- struct hashtable_t *hash;
+ struct batadv_hashtable *hash;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
struct claim *claim;
@@ -434,7 +434,7 @@ static void batadv_bla_answer_request(struct bat_priv *bat_priv,
{
struct hlist_node *node;
struct hlist_head *head;
- struct hashtable_t *hash;
+ struct batadv_hashtable *hash;
struct claim *claim;
struct backbone_gw *backbone_gw;
int i;
@@ -931,7 +931,7 @@ static void batadv_bla_purge_backbone_gw(struct bat_priv *bat_priv, int now)
struct backbone_gw *backbone_gw;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
- struct hashtable_t *hash;
+ struct batadv_hashtable *hash;
spinlock_t *list_lock; /* protects write access to the hash lists */
int i;
@@ -983,7 +983,7 @@ static void batadv_bla_purge_claims(struct bat_priv *bat_priv,
struct claim *claim;
struct hlist_node *node;
struct hlist_head *head;
- struct hashtable_t *hash;
+ struct batadv_hashtable *hash;
int i;
hash = bat_priv->claim_hash;
@@ -1030,7 +1030,7 @@ void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
struct backbone_gw *backbone_gw;
struct hlist_node *node;
struct hlist_head *head;
- struct hashtable_t *hash;
+ struct batadv_hashtable *hash;
int i;
/* reset bridge loop avoidance group id */
@@ -1091,7 +1091,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)
struct hlist_node *node;
struct hlist_head *head;
struct backbone_gw *backbone_gw;
- struct hashtable_t *hash;
+ struct batadv_hashtable *hash;
struct hard_iface *primary_if;
int i;
@@ -1262,7 +1262,7 @@ int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
*/
int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig)
{
- struct hashtable_t *hash = bat_priv->backbone_hash;
+ struct batadv_hashtable *hash = bat_priv->backbone_hash;
struct hlist_head *head;
struct hlist_node *node;
struct backbone_gw *backbone_gw;
@@ -1534,7 +1534,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
{
struct net_device *net_dev = (struct net_device *)seq->private;
struct bat_priv *bat_priv = netdev_priv(net_dev);
- struct hashtable_t *hash = bat_priv->claim_hash;
+ struct batadv_hashtable *hash = bat_priv->claim_hash;
struct claim *claim;
struct hard_iface *primary_if;
struct hlist_node *node;
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c
index 1fb961c..0759c70 100644
--- a/net/batman-adv/hash.c
+++ b/net/batman-adv/hash.c
@@ -21,7 +21,7 @@
#include "hash.h"
/* clears the hash */
-static void batadv_hash_init(struct hashtable_t *hash)
+static void batadv_hash_init(struct batadv_hashtable *hash)
{
uint32_t i;
@@ -32,7 +32,7 @@ static void batadv_hash_init(struct hashtable_t *hash)
}
/* free only the hashtable and the hash itself. */
-void batadv_hash_destroy(struct hashtable_t *hash)
+void batadv_hash_destroy(struct batadv_hashtable *hash)
{
kfree(hash->list_locks);
kfree(hash->table);
@@ -40,9 +40,9 @@ void batadv_hash_destroy(struct hashtable_t *hash)
}
/* allocates and clears the hash */
-struct hashtable_t *batadv_hash_new(uint32_t size)
+struct batadv_hashtable *batadv_hash_new(uint32_t size)
{
- struct hashtable_t *hash;
+ struct batadv_hashtable *hash;
hash = kmalloc(sizeof(*hash), GFP_ATOMIC);
if (!hash)
@@ -68,7 +68,7 @@ free_hash:
return NULL;
}
-void batadv_hash_set_lock_class(struct hashtable_t *hash,
+void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
struct lock_class_key *key)
{
uint32_t i;
diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h
index 7ec4e5b..83990e3 100644
--- a/net/batman-adv/hash.h
+++ b/net/batman-adv/hash.h
@@ -25,37 +25,39 @@
/* callback to a compare function. should compare 2 element datas for their
* keys, return 0 if same and not 0 if not same
*/
-typedef int (*hashdata_compare_cb)(const struct hlist_node *, const void *);
+typedef int (*batadv_hashdata_compare_cb)(const struct hlist_node *,
+ const void *);
/* the hashfunction, should return an index
* based on the key in the data of the first
* argument and the size the second
*/
-typedef uint32_t (*hashdata_choose_cb)(const void *, uint32_t);
-typedef void (*hashdata_free_cb)(struct hlist_node *, void *);
+typedef uint32_t (*batadv_hashdata_choose_cb)(const void *, uint32_t);
+typedef void (*batadv_hashdata_free_cb)(struct hlist_node *, void *);
-struct hashtable_t {
+struct batadv_hashtable {
struct hlist_head *table; /* the hashtable itself with the buckets */
spinlock_t *list_locks; /* spinlock for each hash list entry */
uint32_t size; /* size of hashtable */
};
/* allocates and clears the hash */
-struct hashtable_t *batadv_hash_new(uint32_t size);
+struct batadv_hashtable *batadv_hash_new(uint32_t size);
/* set class key for all locks */
-void batadv_hash_set_lock_class(struct hashtable_t *hash,
+void batadv_hash_set_lock_class(struct batadv_hashtable *hash,
struct lock_class_key *key);
/* free only the hashtable and the hash itself. */
-void batadv_hash_destroy(struct hashtable_t *hash);
+void batadv_hash_destroy(struct batadv_hashtable *hash);
/* remove the hash structure. if hashdata_free_cb != NULL, this function will be
* called to remove the elements inside of the hash. if you don't remove the
* elements, memory might be leaked.
*/
-static inline void batadv_hash_delete(struct hashtable_t *hash,
- hashdata_free_cb free_cb, void *arg)
+static inline void batadv_hash_delete(struct batadv_hashtable *hash,
+ batadv_hashdata_free_cb free_cb,
+ void *arg)
{
struct hlist_head *head;
struct hlist_node *node, *node_tmp;
@@ -89,9 +91,9 @@ static inline void batadv_hash_delete(struct hashtable_t *hash,
* Returns 0 on success, 1 if the element already is in the hash
* and -1 on error.
*/
-static inline int batadv_hash_add(struct hashtable_t *hash,
- hashdata_compare_cb compare,
- hashdata_choose_cb choose,
+static inline int batadv_hash_add(struct batadv_hashtable *hash,
+ batadv_hashdata_compare_cb compare,
+ batadv_hashdata_choose_cb choose,
const void *data,
struct hlist_node *data_node)
{
@@ -134,9 +136,10 @@ out:
* structure you use with just the key filled, we just need the key for
* comparing.
*/
-static inline void *batadv_hash_remove(struct hashtable_t *hash,
- hashdata_compare_cb compare,
- hashdata_choose_cb choose, void *data)
+static inline void *batadv_hash_remove(struct batadv_hashtable *hash,
+ batadv_hashdata_compare_cb compare,
+ batadv_hashdata_choose_cb choose,
+ void *data)
{
uint32_t index;
struct hlist_node *node;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 4ddea31..dc9c4bf 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -154,7 +154,7 @@ void batadv_orig_node_free_ref(struct orig_node *orig_node)
void batadv_originator_free(struct bat_priv *bat_priv)
{
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
spinlock_t *list_lock; /* spinlock to protect write access */
@@ -343,7 +343,7 @@ static bool batadv_purge_orig_node(struct bat_priv *bat_priv,
static void _batadv_purge_orig(struct bat_priv *bat_priv)
{
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
spinlock_t *list_lock; /* spinlock to protect write access */
@@ -401,7 +401,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
{
struct net_device *net_dev = (struct net_device *)seq->private;
struct bat_priv *bat_priv = netdev_priv(net_dev);
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
struct hard_iface *primary_if;
@@ -514,7 +514,7 @@ static int batadv_orig_node_add_if(struct orig_node *orig_node, int max_if_num)
int batadv_orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
{
struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_node *node;
struct hlist_head *head;
struct orig_node *orig_node;
@@ -597,7 +597,7 @@ free_own_sum:
int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
{
struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_node *node;
struct hlist_head *head;
struct hard_iface *hard_iface_tmp;
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h
index 35f67eb..32e7e28 100644
--- a/net/batman-adv/originator.h
+++ b/net/batman-adv/originator.h
@@ -63,7 +63,7 @@ static inline uint32_t batadv_choose_orig(const void *data, uint32_t size)
static inline struct orig_node *batadv_orig_hash_find(struct bat_priv *bat_priv,
const void *data)
{
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_head *head;
struct hlist_node *node;
struct orig_node *orig_node, *orig_node_tmp = NULL;
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index b8c47dc..86d444a 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -35,7 +35,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
void batadv_slide_own_bcast_window(struct hard_iface *hard_iface)
{
struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_node *node;
struct hlist_head *head;
struct orig_node *orig_node;
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 6d03cb1..9b35d1f 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -51,8 +51,8 @@ static void batadv_tt_start_timer(struct bat_priv *bat_priv)
msecs_to_jiffies(5000));
}
-static struct tt_common_entry *batadv_tt_hash_find(struct hashtable_t *hash,
- const void *data)
+static struct tt_common_entry *
+batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data)
{
struct hlist_head *head;
struct hlist_node *node;
@@ -417,7 +417,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
{
struct net_device *net_dev = (struct net_device *)seq->private;
struct bat_priv *bat_priv = netdev_priv(net_dev);
- struct hashtable_t *hash = bat_priv->tt_local_hash;
+ struct batadv_hashtable *hash = bat_priv->tt_local_hash;
struct tt_common_entry *tt_common_entry;
struct hard_iface *primary_if;
struct hlist_node *node;
@@ -538,7 +538,7 @@ static void batadv_tt_local_purge_list(struct bat_priv *bat_priv,
static void batadv_tt_local_purge(struct bat_priv *bat_priv)
{
- struct hashtable_t *hash = bat_priv->tt_local_hash;
+ struct batadv_hashtable *hash = bat_priv->tt_local_hash;
struct hlist_head *head;
spinlock_t *list_lock; /* protects write access to the hash lists */
uint32_t i;
@@ -556,7 +556,7 @@ static void batadv_tt_local_purge(struct bat_priv *bat_priv)
static void batadv_tt_local_table_free(struct bat_priv *bat_priv)
{
- struct hashtable_t *hash;
+ struct batadv_hashtable *hash;
spinlock_t *list_lock; /* protects write access to the hash lists */
struct tt_common_entry *tt_common_entry;
struct tt_local_entry *tt_local_entry;
@@ -775,7 +775,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
{
struct net_device *net_dev = (struct net_device *)seq->private;
struct bat_priv *bat_priv = netdev_priv(net_dev);
- struct hashtable_t *hash = bat_priv->tt_global_hash;
+ struct batadv_hashtable *hash = bat_priv->tt_global_hash;
struct tt_common_entry *tt_common_entry;
struct tt_global_entry *tt_global_entry;
struct hard_iface *primary_if;
@@ -984,7 +984,7 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv,
struct tt_global_entry *global_entry;
struct tt_common_entry *tt_common_entry;
uint32_t i;
- struct hashtable_t *hash = bat_priv->tt_global_hash;
+ struct batadv_hashtable *hash = bat_priv->tt_global_hash;
struct hlist_node *node, *safe;
struct hlist_head *head;
spinlock_t *list_lock; /* protects write access to the hash lists */
@@ -1047,7 +1047,7 @@ static void batadv_tt_global_roam_purge_list(struct bat_priv *bat_priv,
static void batadv_tt_global_roam_purge(struct bat_priv *bat_priv)
{
- struct hashtable_t *hash = bat_priv->tt_global_hash;
+ struct batadv_hashtable *hash = bat_priv->tt_global_hash;
struct hlist_head *head;
spinlock_t *list_lock; /* protects write access to the hash lists */
uint32_t i;
@@ -1065,7 +1065,7 @@ static void batadv_tt_global_roam_purge(struct bat_priv *bat_priv)
static void batadv_tt_global_table_free(struct bat_priv *bat_priv)
{
- struct hashtable_t *hash;
+ struct batadv_hashtable *hash;
spinlock_t *list_lock; /* protects write access to the hash lists */
struct tt_common_entry *tt_common_entry;
struct tt_global_entry *tt_global_entry;
@@ -1174,7 +1174,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv,
struct orig_node *orig_node)
{
uint16_t total = 0, total_one;
- struct hashtable_t *hash = bat_priv->tt_global_hash;
+ struct batadv_hashtable *hash = bat_priv->tt_global_hash;
struct tt_common_entry *tt_common;
struct tt_global_entry *tt_global_entry;
struct hlist_node *node;
@@ -1221,7 +1221,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv,
static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv)
{
uint16_t total = 0, total_one;
- struct hashtable_t *hash = bat_priv->tt_local_hash;
+ struct batadv_hashtable *hash = bat_priv->tt_local_hash;
struct tt_common_entry *tt_common;
struct hlist_node *node;
struct hlist_head *head;
@@ -1360,7 +1360,7 @@ static int batadv_tt_global_valid(const void *entry_ptr,
static struct sk_buff *
batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn,
- struct hashtable_t *hash,
+ struct batadv_hashtable *hash,
struct hard_iface *primary_if,
int (*valid_cb)(const void *, const void *),
void *cb_data)
@@ -2088,8 +2088,8 @@ void batadv_tt_free(struct bat_priv *bat_priv)
/* This function will enable or disable the specified flags for all the entries
* in the given hash table and returns the number of modified entries
*/
-static uint16_t batadv_tt_set_flags(struct hashtable_t *hash, uint16_t flags,
- bool enable)
+static uint16_t batadv_tt_set_flags(struct batadv_hashtable *hash,
+ uint16_t flags, bool enable)
{
uint32_t i;
uint16_t changed_num = 0;
@@ -2126,7 +2126,7 @@ out:
/* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */
static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv)
{
- struct hashtable_t *hash = bat_priv->tt_local_hash;
+ struct batadv_hashtable *hash = bat_priv->tt_local_hash;
struct tt_common_entry *tt_common;
struct tt_local_entry *tt_local_entry;
struct hlist_node *node, *node_tmp;
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index fcbac82..9dddaf1 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -198,16 +198,16 @@ struct bat_priv {
struct hlist_head gw_list;
struct list_head tt_changes_list; /* tracks changes in a OGM int */
struct list_head vis_send_list;
- struct hashtable_t *orig_hash;
- struct hashtable_t *tt_local_hash;
- struct hashtable_t *tt_global_hash;
+ struct batadv_hashtable *orig_hash;
+ struct batadv_hashtable *tt_local_hash;
+ struct batadv_hashtable *tt_global_hash;
#ifdef CONFIG_BATMAN_ADV_BLA
- struct hashtable_t *claim_hash;
- struct hashtable_t *backbone_hash;
+ struct batadv_hashtable *claim_hash;
+ struct batadv_hashtable *backbone_hash;
#endif
struct list_head tt_req_list; /* list of pending tt_requests */
struct list_head tt_roam_list;
- struct hashtable_t *vis_hash;
+ struct batadv_hashtable *vis_hash;
#ifdef CONFIG_BATMAN_ADV_BLA
struct bcast_duplist_entry bcast_duplist[BATADV_DUPLIST_SIZE];
int bcast_duplist_curr;
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index f5692ee..c1fafa3 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -91,7 +91,7 @@ static uint32_t batadv_vis_info_choose(const void *data, uint32_t size)
static struct vis_info *batadv_vis_hash_find(struct bat_priv *bat_priv,
const void *data)
{
- struct hashtable_t *hash = bat_priv->vis_hash;
+ struct batadv_hashtable *hash = bat_priv->vis_hash;
struct hlist_head *head;
struct hlist_node *node;
struct vis_info *vis_info, *vis_info_tmp = NULL;
@@ -247,7 +247,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
struct hlist_head *head;
struct net_device *net_dev = (struct net_device *)seq->private;
struct bat_priv *bat_priv = netdev_priv(net_dev);
- struct hashtable_t *hash = bat_priv->vis_hash;
+ struct batadv_hashtable *hash = bat_priv->vis_hash;
uint32_t i;
int ret = 0;
int vis_server = atomic_read(&bat_priv->vis_mode);
@@ -506,7 +506,7 @@ end:
static int batadv_find_best_vis_server(struct bat_priv *bat_priv,
struct vis_info *info)
{
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct neigh_node *router;
struct hlist_node *node;
struct hlist_head *head;
@@ -559,7 +559,7 @@ static bool batadv_vis_packet_full(const struct vis_info *info)
*/
static int batadv_generate_vis_packet(struct bat_priv *bat_priv)
{
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_node *node;
struct hlist_head *head;
struct orig_node *orig_node;
@@ -659,7 +659,7 @@ unlock:
static void batadv_purge_vis_packets(struct bat_priv *bat_priv)
{
uint32_t i;
- struct hashtable_t *hash = bat_priv->vis_hash;
+ struct batadv_hashtable *hash = bat_priv->vis_hash;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
struct vis_info *info;
@@ -687,7 +687,7 @@ static void batadv_broadcast_vis_packet(struct bat_priv *bat_priv,
struct vis_info *info)
{
struct neigh_node *router;
- struct hashtable_t *hash = bat_priv->orig_hash;
+ struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_node *node;
struct hlist_head *head;
struct orig_node *orig_node;
--
1.7.9.4
^ permalink raw reply related
* [PATCH 05/16] batman-adv: Prefix main enum with BATADV_
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1341186226-10549-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bat_iv_ogm.c | 48 ++++++++++++++++----------------
net/batman-adv/bat_sysfs.c | 12 ++++----
net/batman-adv/bat_sysfs.h | 4 +--
net/batman-adv/bitarray.c | 4 +--
net/batman-adv/bridge_loop_avoidance.c | 46 +++++++++++++++---------------
net/batman-adv/gateway_client.c | 25 +++++++++--------
net/batman-adv/icmp_socket.c | 8 +++---
net/batman-adv/main.c | 10 +++----
net/batman-adv/main.h | 36 ++++++++++++------------
net/batman-adv/originator.c | 12 ++++----
net/batman-adv/routing.c | 18 ++++++------
net/batman-adv/send.c | 11 ++++----
net/batman-adv/soft-interface.c | 6 ++--
net/batman-adv/translation-table.c | 35 ++++++++++++-----------
14 files changed, 140 insertions(+), 135 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 58bbb20..f9981e6 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -188,7 +188,7 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ?
"Sending own" :
"Forwarding"));
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"%s %spacket (originator %pM, seqno %u, TQ %d, TTL %d, IDF %s, ttvn %d) on interface %s [%pM]\n",
fwd_str, (packet_num > 0 ? "aggregated " : ""),
batman_ogm_packet->orig,
@@ -252,7 +252,7 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet)
(forw_packet->own && (forw_packet->if_incoming != primary_if))) {
/* FIXME: what about aggregated packets ? */
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"%s packet (originator %pM, seqno %u, TTL %d) on interface %s [%pM]\n",
(forw_packet->own ? "Sending own" : "Forwarding"),
batman_ogm_packet->orig,
@@ -385,7 +385,7 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff,
/* own packet should always be scheduled */
if (!own_packet) {
if (!batadv_atomic_dec_not_zero(&bat_priv->batman_queue_left)) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"batman packet queue full\n");
goto out;
}
@@ -535,7 +535,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
uint8_t tt_num_changes;
if (batman_ogm_packet->header.ttl <= 1) {
- batadv_dbg(DBG_BATMAN, bat_priv, "ttl exceeded\n");
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "ttl exceeded\n");
return;
}
@@ -561,7 +561,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
batman_ogm_packet->tq = batadv_hop_penalty(batman_ogm_packet->tq,
bat_priv);
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Forwarding packet: tq: %i, ttl: %i\n",
batman_ogm_packet->tq, batman_ogm_packet->header.ttl);
@@ -642,7 +642,7 @@ batadv_iv_ogm_orig_update(struct bat_priv *bat_priv,
uint8_t bcast_own_sum_orig, bcast_own_sum_neigh;
uint8_t *neigh_addr;
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"update_originator(): Searching and updating originator entry of received packet\n");
rcu_read_lock();
@@ -685,7 +685,7 @@ batadv_iv_ogm_orig_update(struct bat_priv *bat_priv,
if (!neigh_node)
goto unlock;
} else
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Updating existing last-hop neighbor of originator\n");
rcu_read_unlock();
@@ -866,7 +866,7 @@ static int batadv_iv_ogm_calc_tq(struct orig_node *orig_node,
combined_tq /= BATADV_TQ_MAX_VALUE * BATADV_TQ_MAX_VALUE;
batman_ogm_packet->tq = combined_tq;
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i\n",
orig_node->orig, orig_neigh_node->orig, total_count,
neigh_rq_count, tq_own,
@@ -948,7 +948,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
rcu_read_unlock();
if (need_update) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"updating last_seqno: old %u, new %u\n",
orig_node->last_real_seqno, seqno);
orig_node->last_real_seqno = seqno;
@@ -1007,7 +1007,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
if (batadv_compare_eth(ethhdr->h_source, batman_ogm_packet->orig))
is_single_hop_neigh = true;
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n",
ethhdr->h_source, if_incoming->net_dev->name,
if_incoming->net_dev->dev_addr, batman_ogm_packet->orig,
@@ -1044,21 +1044,21 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
rcu_read_unlock();
if (batman_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: incompatible batman version (%i)\n",
batman_ogm_packet->header.version);
return;
}
if (is_my_addr) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: received my own broadcast (sender: %pM)\n",
ethhdr->h_source);
return;
}
if (is_broadcast) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: ignoring all packets with broadcast source addr (sender: %pM)\n",
ethhdr->h_source);
return;
@@ -1097,21 +1097,21 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
spin_unlock_bh(&orig_neigh_node->ogm_cnt_lock);
}
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: originator packet from myself (via neighbor)\n");
batadv_orig_node_free_ref(orig_neigh_node);
return;
}
if (is_my_oldorig) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: ignoring all rebroadcast echos (sender: %pM)\n",
ethhdr->h_source);
return;
}
if (batman_ogm_packet->flags & BATADV_NOT_BEST_NEXT_HOP) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n",
ethhdr->h_source);
return;
@@ -1125,14 +1125,14 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
if_incoming);
if (is_duplicate == -1) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: packet within seqno protection time (sender: %pM)\n",
ethhdr->h_source);
goto out;
}
if (batman_ogm_packet->tq == 0) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: originator packet with tq equal 0\n");
goto out;
}
@@ -1151,7 +1151,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
(batadv_compare_eth(router->addr, prev_sender)) &&
!(batadv_compare_eth(batman_ogm_packet->orig, prev_sender)) &&
(batadv_compare_eth(router->addr, router_router->addr))) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM)\n",
ethhdr->h_source);
goto out;
@@ -1172,7 +1172,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
* don't route towards it
*/
if (!is_single_hop_neigh && (!orig_neigh_router)) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: OGM via unknown neighbor!\n");
goto out_neigh;
}
@@ -1201,25 +1201,25 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
is_single_hop_neigh,
is_from_best_next_hop, if_incoming);
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Forwarding packet: rebroadcast neighbor packet with direct link flag\n");
goto out_neigh;
}
/* multihop originator */
if (!is_bidirect) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: not received via bidirectional link\n");
goto out_neigh;
}
if (is_duplicate) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: duplicate packet received\n");
goto out_neigh;
}
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Forwarding packet: rebroadcast originator packet\n");
batadv_iv_ogm_forward(orig_node, ethhdr, batman_ogm_packet,
is_single_hop_neigh, is_from_best_next_hop,
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index e27bfe3..c4794c6 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -485,7 +485,7 @@ BATADV_ATTR_SIF_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, BATADV_TQ_MAX_VALUE,
static BATADV_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth,
batadv_store_gw_bwidth);
#ifdef CONFIG_BATMAN_ADV_DEBUG
-BATADV_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, DBG_ALL, NULL);
+BATADV_ATTR_SIF_UINT(log_level, S_IRUGO | S_IWUSR, 0, BATADV_DBG_ALL, NULL);
#endif
static struct bat_attribute *batadv_mesh_attrs[] = {
@@ -723,8 +723,8 @@ void batadv_sysfs_del_hardif(struct kobject **hardif_obj)
*hardif_obj = NULL;
}
-int batadv_throw_uevent(struct bat_priv *bat_priv, enum uev_type type,
- enum uev_action action, const char *data)
+int batadv_throw_uevent(struct bat_priv *bat_priv, enum batadv_uev_type type,
+ enum batadv_uev_action action, const char *data)
{
int ret = -ENOMEM;
struct hard_iface *primary_if = NULL;
@@ -756,7 +756,7 @@ int batadv_throw_uevent(struct bat_priv *bat_priv, enum uev_type type,
batadv_uev_action_str[action]);
/* If the event is DEL, ignore the data field */
- if (action != UEV_DEL) {
+ if (action != BATADV_UEV_DEL) {
uevent_env[2] = kmalloc(strlen(BATADV_UEV_DATA_VAR) +
strlen(data) + 1, GFP_ATOMIC);
if (!uevent_env[2])
@@ -775,10 +775,10 @@ out:
batadv_hardif_free_ref(primary_if);
if (ret)
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Impossible to send uevent for (%s,%s,%s) event (err: %d)\n",
batadv_uev_type_str[type],
batadv_uev_action_str[action],
- (action == UEV_DEL ? "NULL" : data), ret);
+ (action == BATADV_UEV_DEL ? "NULL" : data), ret);
return ret;
}
diff --git a/net/batman-adv/bat_sysfs.h b/net/batman-adv/bat_sysfs.h
index 23a8390..28c2948 100644
--- a/net/batman-adv/bat_sysfs.h
+++ b/net/batman-adv/bat_sysfs.h
@@ -36,7 +36,7 @@ void batadv_sysfs_del_meshif(struct net_device *dev);
int batadv_sysfs_add_hardif(struct kobject **hardif_obj,
struct net_device *dev);
void batadv_sysfs_del_hardif(struct kobject **hardif_obj);
-int batadv_throw_uevent(struct bat_priv *bat_priv, enum uev_type type,
- enum uev_action action, const char *data);
+int batadv_throw_uevent(struct bat_priv *bat_priv, enum batadv_uev_type type,
+ enum batadv_uev_action action, const char *data);
#endif /* _NET_BATMAN_ADV_SYSFS_H_ */
diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c
index 4a009b5..835d3b6 100644
--- a/net/batman-adv/bitarray.c
+++ b/net/batman-adv/bitarray.c
@@ -66,7 +66,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
/* sequence number is much newer, probably missed a lot of packets */
if (seq_num_diff >= BATADV_TQ_LOCAL_WINDOW_SIZE &&
seq_num_diff < BATADV_EXPECTED_SEQNO_RANGE) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"We missed a lot of packets (%i) !\n",
seq_num_diff - 1);
bitmap_zero(seq_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
@@ -83,7 +83,7 @@ int batadv_bit_get_packet(void *priv, unsigned long *seq_bits,
if (seq_num_diff <= -BATADV_TQ_LOCAL_WINDOW_SIZE ||
seq_num_diff >= BATADV_EXPECTED_SEQNO_RANGE) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Other host probably restarted!\n");
bitmap_zero(seq_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index c375131..b463402 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -297,7 +297,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
* set Ethernet SRC to the clients mac
*/
memcpy(ethhdr->h_source, mac, ETH_ALEN);
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid);
break;
case BATADV_CLAIM_TYPE_DEL:
@@ -305,7 +305,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
* set HW SRC to the clients mac
*/
memcpy(hw_src, mac, ETH_ALEN);
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_send_claim(): UNCLAIM %pM on vid %d\n", mac,
vid);
break;
@@ -314,7 +314,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
* set HW SRC to the special mac containg the crc
*/
memcpy(hw_src, mac, ETH_ALEN);
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_send_claim(): ANNOUNCE of %pM on vid %d\n",
ethhdr->h_source, vid);
break;
@@ -324,7 +324,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
*/
memcpy(hw_src, mac, ETH_ALEN);
memcpy(ethhdr->h_dest, mac, ETH_ALEN);
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_send_claim(): REQUEST of %pM to %pMon vid %d\n",
ethhdr->h_source, ethhdr->h_dest, vid);
break;
@@ -365,7 +365,7 @@ static struct backbone_gw *batadv_bla_get_backbone_gw(struct bat_priv *bat_priv,
if (entry)
return entry;
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_get_backbone_gw(): not found (%pM, %d), creating new entry\n",
orig, vid);
@@ -439,7 +439,7 @@ static void batadv_bla_answer_request(struct bat_priv *bat_priv,
struct backbone_gw *backbone_gw;
int i;
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_answer_request(): received a claim request, send all of our own claims again\n");
backbone_gw = batadv_backbone_hash_find(bat_priv,
@@ -480,8 +480,8 @@ static void batadv_bla_send_request(struct backbone_gw *backbone_gw)
/* first, remove all old entries */
batadv_bla_del_backbone_claims(backbone_gw);
- batadv_dbg(DBG_BLA, backbone_gw->bat_priv, "Sending REQUEST to %pM\n",
- backbone_gw->orig);
+ batadv_dbg(BATADV_DBG_BLA, backbone_gw->bat_priv,
+ "Sending REQUEST to %pM\n", backbone_gw->orig);
/* send request */
batadv_bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig,
@@ -546,7 +546,7 @@ static void batadv_bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,
claim->backbone_gw = backbone_gw;
atomic_set(&claim->refcount, 2);
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_add_claim(): adding new entry %pM, vid %d to hash ...\n",
mac, vid);
hash_added = batadv_hash_add(bat_priv->claim_hash,
@@ -565,7 +565,7 @@ static void batadv_bla_add_claim(struct bat_priv *bat_priv, const uint8_t *mac,
/* no need to register a new backbone */
goto claim_free_ref;
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_add_claim(): changing ownership for %pM, vid %d\n",
mac, vid);
@@ -599,8 +599,8 @@ static void batadv_bla_del_claim(struct bat_priv *bat_priv, const uint8_t *mac,
if (!claim)
return;
- batadv_dbg(DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", mac,
- vid);
+ batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n",
+ mac, vid);
batadv_hash_remove(bat_priv->claim_hash, batadv_compare_claim,
batadv_choose_claim, claim);
@@ -633,12 +633,12 @@ static int batadv_handle_announce(struct bat_priv *bat_priv,
backbone_gw->lasttime = jiffies;
crc = ntohs(*((__be16 *)(&an_addr[4])));
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"handle_announce(): ANNOUNCE vid %d (sent by %pM)... CRC = %04x\n",
vid, backbone_gw->orig, crc);
if (backbone_gw->crc != crc) {
- batadv_dbg(DBG_BLA, backbone_gw->bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, backbone_gw->bat_priv,
"handle_announce(): CRC FAILED for %pM/%d (my = %04x, sent = %04x)\n",
backbone_gw->orig, backbone_gw->vid,
backbone_gw->crc, crc);
@@ -674,7 +674,7 @@ static int batadv_handle_request(struct bat_priv *bat_priv,
if (!batadv_compare_eth(ethhdr->h_dest, primary_if->net_dev->dev_addr))
return 1;
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"handle_request(): REQUEST vid %d (sent by %pM)...\n",
vid, ethhdr->h_source);
@@ -702,7 +702,7 @@ static int batadv_handle_unclaim(struct bat_priv *bat_priv,
return 1;
/* this must be an UNCLAIM frame */
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"handle_unclaim(): UNCLAIM %pM on vid %d (sent by %pM)...\n",
claim_addr, vid, backbone_gw->orig);
@@ -804,7 +804,7 @@ static int batadv_check_claim_group(struct bat_priv *bat_priv,
/* if our mesh friends mac is bigger, use it for ourselves. */
if (ntohs(bla_dst->group) > ntohs(bla_dst_own->group)) {
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"taking other backbones claim group: %04x\n",
ntohs(bla_dst->group));
bla_dst_own->group = bla_dst->group;
@@ -882,7 +882,7 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv,
ret = batadv_check_claim_group(bat_priv, primary_if, hw_src, hw_dst,
ethhdr);
if (ret == 1)
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n",
ethhdr->h_source, vid, hw_src, hw_dst);
@@ -917,7 +917,7 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv,
break;
}
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_process_claim(): ERROR - this looks like a claim frame, but is useless. eth src %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n",
ethhdr->h_source, vid, hw_src, hw_dst);
return 1;
@@ -952,7 +952,7 @@ static void batadv_bla_purge_backbone_gw(struct bat_priv *bat_priv, int now)
BATADV_BLA_BACKBONE_TIMEOUT))
continue;
- batadv_dbg(DBG_BLA, backbone_gw->bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, backbone_gw->bat_priv,
"bla_purge_backbone_gw(): backbone gw %pM timed out\n",
backbone_gw->orig);
@@ -1004,7 +1004,7 @@ static void batadv_bla_purge_claims(struct bat_priv *bat_priv,
BATADV_BLA_CLAIM_TIMEOUT))
continue;
- batadv_dbg(DBG_BLA, bat_priv,
+ batadv_dbg(BATADV_DBG_BLA, bat_priv,
"bla_purge_claims(): %pM, vid %d, time out\n",
claim->addr, claim->vid);
@@ -1146,7 +1146,7 @@ int batadv_bla_init(struct bat_priv *bat_priv)
uint8_t claim_dest[ETH_ALEN] = {0xff, 0x43, 0x05, 0x00, 0x00, 0x00};
struct hard_iface *primary_if;
- batadv_dbg(DBG_BLA, bat_priv, "bla hash registering\n");
+ batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n");
/* setting claim destination address */
memcpy(&bat_priv->claim_dest.magic, claim_dest, 3);
@@ -1181,7 +1181,7 @@ int batadv_bla_init(struct bat_priv *bat_priv)
batadv_hash_set_lock_class(bat_priv->backbone_hash,
&batadv_backbone_hash_lock_class_key);
- batadv_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n");
+ batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hashes initialized\n");
batadv_bla_start_timer(bat_priv);
return 0;
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 3b50c31..00273b9 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -218,21 +218,24 @@ void batadv_gw_election(struct bat_priv *bat_priv)
}
if ((curr_gw) && (!next_gw)) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Removing selected gateway - no gateway in range\n");
- batadv_throw_uevent(bat_priv, UEV_GW, UEV_DEL, NULL);
+ batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_DEL,
+ NULL);
} else if ((!curr_gw) && (next_gw)) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Adding route to gateway %pM (gw_flags: %i, tq: %i)\n",
next_gw->orig_node->orig,
next_gw->orig_node->gw_flags, router->tq_avg);
- batadv_throw_uevent(bat_priv, UEV_GW, UEV_ADD, gw_addr);
+ batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_ADD,
+ gw_addr);
} else {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Changing route to gateway %pM (gw_flags: %i, tq: %i)\n",
next_gw->orig_node->orig,
next_gw->orig_node->gw_flags, router->tq_avg);
- batadv_throw_uevent(bat_priv, UEV_GW, UEV_CHANGE, gw_addr);
+ batadv_throw_uevent(bat_priv, BATADV_UEV_GW, BATADV_UEV_CHANGE,
+ gw_addr);
}
batadv_gw_select(bat_priv, next_gw);
@@ -283,7 +286,7 @@ void batadv_gw_check_election(struct bat_priv *bat_priv,
(orig_tq_avg - gw_tq_avg < atomic_read(&bat_priv->gw_sel_class)))
goto out;
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Restarting gateway selection: better gateway found (tq curr: %i, tq new: %i)\n",
gw_tq_avg, orig_tq_avg);
@@ -320,7 +323,7 @@ static void batadv_gw_node_add(struct bat_priv *bat_priv,
spin_unlock_bh(&bat_priv->gw_list_lock);
batadv_gw_bandwidth_to_kbit(new_gwflags, &down, &up);
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Found new gateway %pM -> gw_class: %i - %i%s/%i%s\n",
orig_node->orig, new_gwflags,
(down > 2048 ? down / 1024 : down),
@@ -347,7 +350,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv,
if (gw_node->orig_node != orig_node)
continue;
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Gateway class of originator %pM changed from %i to %i\n",
orig_node->orig, gw_node->orig_node->gw_flags,
new_gwflags);
@@ -356,7 +359,7 @@ void batadv_gw_node_update(struct bat_priv *bat_priv,
if (new_gwflags == BATADV_NO_FLAGS) {
gw_node->deleted = jiffies;
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Gateway %pM removed from gateway list\n",
orig_node->orig);
@@ -403,7 +406,7 @@ void batadv_gw_node_purge(struct bat_priv *bat_priv)
&bat_priv->gw_list, list) {
if (((!gw_node->deleted) ||
(time_before(jiffies, gw_node->deleted + timeout))) &&
- atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE)
+ atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE)
continue;
if (curr_gw == gw_node)
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index a64cce2..61b52b3 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -158,7 +158,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
size_t packet_len = sizeof(struct icmp_packet);
if (len < sizeof(struct icmp_packet)) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: invalid packet size\n");
return -EINVAL;
}
@@ -188,14 +188,14 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
}
if (icmp_packet->header.packet_type != BATADV_ICMP) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n");
len = -EINVAL;
goto free_skb;
}
if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n");
len = -EINVAL;
goto free_skb;
@@ -211,7 +211,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
goto free_skb;
}
- if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
+ if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE)
goto dst_unreach;
orig_node = batadv_orig_hash_find(bat_priv, icmp_packet->dst);
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index b3f0a2e..24d651d 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -132,7 +132,7 @@ int batadv_mesh_init(struct net_device *soft_iface)
goto err;
atomic_set(&bat_priv->gw_reselect, 0);
- atomic_set(&bat_priv->mesh_state, MESH_ACTIVE);
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_ACTIVE);
return 0;
@@ -145,7 +145,7 @@ void batadv_mesh_free(struct net_device *soft_iface)
{
struct bat_priv *bat_priv = netdev_priv(soft_iface);
- atomic_set(&bat_priv->mesh_state, MESH_DEACTIVATING);
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_DEACTIVATING);
batadv_purge_outstanding_packets(bat_priv, NULL);
@@ -160,7 +160,7 @@ void batadv_mesh_free(struct net_device *soft_iface)
free_percpu(bat_priv->bat_counters);
- atomic_set(&bat_priv->mesh_state, MESH_INACTIVE);
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE);
}
void batadv_inc_module_count(void)
@@ -230,7 +230,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
bat_priv = netdev_priv(hard_iface->soft_iface);
- if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
+ if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE)
goto err_free;
/* discard frames on not active interfaces */
@@ -240,7 +240,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
batman_ogm_packet = (struct batman_ogm_packet *)skb->data;
if (batman_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: incompatible batman version (%i)\n",
batman_ogm_packet->header.version);
goto err_free;
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 09660b4..68e13ac 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -95,23 +95,23 @@
#define BATADV_RESET_PROTECTION_MS 30000
#define BATADV_EXPECTED_SEQNO_RANGE 65536
-enum mesh_state {
- MESH_INACTIVE,
- MESH_ACTIVE,
- MESH_DEACTIVATING
+enum batadv_mesh_state {
+ BATADV_MESH_INACTIVE,
+ BATADV_MESH_ACTIVE,
+ BATADV_MESH_DEACTIVATING,
};
#define BATADV_BCAST_QUEUE_LEN 256
#define BATADV_BATMAN_QUEUE_LEN 256
-enum uev_action {
- UEV_ADD = 0,
- UEV_DEL,
- UEV_CHANGE
+enum batadv_uev_action {
+ BATADV_UEV_ADD = 0,
+ BATADV_UEV_DEL,
+ BATADV_UEV_CHANGE,
};
-enum uev_type {
- UEV_GW = 0
+enum batadv_uev_type {
+ BATADV_UEV_GW = 0,
};
#define BATADV_GW_THRESHOLD 50
@@ -124,12 +124,12 @@ enum uev_type {
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
/* all messages related to routing / flooding / broadcasting / etc */
-enum dbg_level {
- DBG_BATMAN = 1 << 0,
- DBG_ROUTES = 1 << 1, /* route added / changed / deleted */
- DBG_TT = 1 << 2, /* translation table operations */
- DBG_BLA = 1 << 3, /* bridge loop avoidance */
- DBG_ALL = 15
+enum batadv_dbg_level {
+ BATADV_DBG_BATMAN = 1 << 0,
+ BATADV_DBG_ROUTES = 1 << 1, /* route added / changed / deleted */
+ BATADV_DBG_TT = 1 << 2, /* translation table operations */
+ BATADV_DBG_BLA = 1 << 3, /* bridge loop avoidance */
+ BATADV_DBG_ALL = 15,
};
/* Kernel headers */
@@ -195,14 +195,14 @@ static inline void batadv_dbg(int type __always_unused,
do { \
struct net_device *_netdev = (net_dev); \
struct bat_priv *_batpriv = netdev_priv(_netdev); \
- batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \
+ batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg); \
pr_info("%s: " fmt, _netdev->name, ## arg); \
} while (0)
#define batadv_err(net_dev, fmt, arg...) \
do { \
struct net_device *_netdev = (net_dev); \
struct bat_priv *_batpriv = netdev_priv(_netdev); \
- batadv_dbg(DBG_ALL, _batpriv, fmt, ## arg); \
+ batadv_dbg(BATADV_DBG_ALL, _batpriv, fmt, ## arg); \
pr_err("%s: " fmt, _netdev->name, ## arg); \
} while (0)
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 9e60cc0..4ddea31 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -102,7 +102,7 @@ struct neigh_node *batadv_neigh_node_new(struct hard_iface *hard_iface,
/* extra reference for return */
atomic_set(&neigh_node->refcount, 2);
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Creating new neighbor %pM, initial seqno %d\n",
neigh_addr, seqno);
@@ -200,8 +200,8 @@ struct orig_node *batadv_get_orig_node(struct bat_priv *bat_priv,
if (orig_node)
return orig_node;
- batadv_dbg(DBG_BATMAN, bat_priv, "Creating new originator: %pM\n",
- addr);
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
+ "Creating new originator: %pM\n", addr);
orig_node = kzalloc(sizeof(*orig_node), GFP_ATOMIC);
if (!orig_node)
@@ -293,12 +293,12 @@ static bool batadv_purge_orig_neighbors(struct bat_priv *bat_priv,
if ((if_incoming->if_status == BATADV_IF_INACTIVE) ||
(if_incoming->if_status == BATADV_IF_NOT_IN_USE) ||
(if_incoming->if_status == BATADV_IF_TO_BE_REMOVED))
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"neighbor purge: originator %pM, neighbor: %pM, iface: %s\n",
orig_node->orig, neigh_node->addr,
if_incoming->net_dev->name);
else
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"neighbor timeout: originator %pM, neighbor: %pM, last_seen: %u\n",
orig_node->orig, neigh_node->addr,
jiffies_to_msecs(last_seen));
@@ -326,7 +326,7 @@ static bool batadv_purge_orig_node(struct bat_priv *bat_priv,
if (batadv_has_timed_out(orig_node->last_seen,
2 * BATADV_PURGE_TIMEOUT)) {
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Originator timeout: originator %pM, last_seen %u\n",
orig_node->orig,
jiffies_to_msecs(orig_node->last_seen));
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 8e43a95..b8c47dc 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -72,20 +72,20 @@ static void _batadv_update_route(struct bat_priv *bat_priv,
/* route deleted */
if ((curr_router) && (!neigh_node)) {
- batadv_dbg(DBG_ROUTES, bat_priv, "Deleting route towards: %pM\n",
- orig_node->orig);
+ batadv_dbg(BATADV_DBG_ROUTES, bat_priv,
+ "Deleting route towards: %pM\n", orig_node->orig);
batadv_tt_global_del_orig(bat_priv, orig_node,
"Deleted route towards originator");
/* route added */
} else if ((!curr_router) && (neigh_node)) {
- batadv_dbg(DBG_ROUTES, bat_priv,
+ batadv_dbg(BATADV_DBG_ROUTES, bat_priv,
"Adding route towards: %pM (via %pM)\n",
orig_node->orig, neigh_node->addr);
/* route changed */
} else if (neigh_node && curr_router) {
- batadv_dbg(DBG_ROUTES, bat_priv,
+ batadv_dbg(BATADV_DBG_ROUTES, bat_priv,
"Changing route towards: %pM (now via %pM - was via %pM)\n",
orig_node->orig, neigh_node->addr,
curr_router->addr);
@@ -240,7 +240,7 @@ int batadv_window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff,
return 1;
*last_reset = jiffies;
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"old packet received, start protection\n");
}
@@ -618,7 +618,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
else
tt_flag = '.';
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Routing TT_REQUEST to %pM [%c]\n",
tt_query->dst,
tt_flag);
@@ -650,7 +650,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
tt_flag = 'F';
else
tt_flag = '.';
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Routing TT_RESPONSE to %pM [%c]\n",
tt_query->dst,
tt_flag);
@@ -703,7 +703,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
if (!orig_node)
goto out;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Received ROAMING_ADV from %pM (client %pM)\n",
roam_adv_packet->src, roam_adv_packet->client);
@@ -992,7 +992,7 @@ static int batadv_check_unicast_ttvn(struct bat_priv *bat_priv,
batadv_orig_node_free_ref(orig_node);
}
- batadv_dbg(DBG_ROUTES, bat_priv,
+ batadv_dbg(BATADV_DBG_ROUTES, bat_priv,
"TTVN mismatch (old_ttvn %u new_ttvn %u)! Rerouting unicast packet (for %pM) to %pM\n",
unicast_packet->ttvn, curr_ttvn, ethhdr->h_dest,
unicast_packet->dest);
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 8de6e25..aad9818 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -142,7 +142,8 @@ int batadv_add_bcast_packet_to_list(struct bat_priv *bat_priv,
struct sk_buff *newskb;
if (!batadv_atomic_dec_not_zero(&bat_priv->bcast_queue_left)) {
- batadv_dbg(DBG_BATMAN, bat_priv, "bcast packet queue full\n");
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
+ "bcast packet queue full\n");
goto out;
}
@@ -199,7 +200,7 @@ static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
hlist_del(&forw_packet->list);
spin_unlock_bh(&bat_priv->forw_bcast_list_lock);
- if (atomic_read(&bat_priv->mesh_state) == MESH_DEACTIVATING)
+ if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING)
goto out;
/* rebroadcast packet */
@@ -243,7 +244,7 @@ void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work)
hlist_del(&forw_packet->list);
spin_unlock_bh(&bat_priv->forw_bat_list_lock);
- if (atomic_read(&bat_priv->mesh_state) == MESH_DEACTIVATING)
+ if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_DEACTIVATING)
goto out;
bat_priv->bat_algo_ops->bat_ogm_emit(forw_packet);
@@ -271,11 +272,11 @@ void batadv_purge_outstanding_packets(struct bat_priv *bat_priv,
bool pending;
if (hard_iface)
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"purge_outstanding_packets(): %s\n",
hard_iface->net_dev->name);
else
- batadv_dbg(DBG_BATMAN, bat_priv,
+ batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"purge_outstanding_packets()\n");
/* free bcast list */
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 3aae91d..0a00324 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -105,7 +105,7 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
return -EADDRNOTAVAIL;
/* only modify transtable if it has been initialized before */
- if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) {
+ if (atomic_read(&bat_priv->mesh_state) == BATADV_MESH_ACTIVE) {
batadv_tt_local_remove(bat_priv, dev->dev_addr,
"mac address changed", false);
batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX);
@@ -143,7 +143,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
short vid __maybe_unused = -1;
bool do_bcast = false;
- if (atomic_read(&bat_priv->mesh_state) != MESH_ACTIVE)
+ if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE)
goto dropped;
soft_iface->trans_start = jiffies;
@@ -398,7 +398,7 @@ struct net_device *batadv_softif_create(const char *name)
atomic_set(&bat_priv->bcast_queue_left, BATADV_BCAST_QUEUE_LEN);
atomic_set(&bat_priv->batman_queue_left, BATADV_BATMAN_QUEUE_LEN);
- atomic_set(&bat_priv->mesh_state, MESH_INACTIVE);
+ atomic_set(&bat_priv->mesh_state, BATADV_MESH_INACTIVE);
atomic_set(&bat_priv->bcast_seqno, 1);
atomic_set(&bat_priv->ttvn, 0);
atomic_set(&bat_priv->tt_local_changes, 0);
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 309d691..6d03cb1 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -252,7 +252,7 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
if (!tt_local_entry)
goto out;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Creating new local tt entry: %pM (ttvn: %d)\n", addr,
(uint8_t)atomic_read(&bat_priv->ttvn));
@@ -484,7 +484,7 @@ static void batadv_tt_local_set_pending(struct bat_priv *bat_priv,
*/
tt_local_entry->common.flags |= BATADV_TT_CLIENT_PENDING;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Local tt entry (%pM) pending to be removed: %s\n",
tt_local_entry->common.addr, message);
}
@@ -726,7 +726,7 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
orig_node, ttvn);
}
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Creating new global tt entry: %pM (via %pM)\n",
tt_global_entry->common.addr, orig_node->orig);
@@ -856,7 +856,7 @@ batadv_tt_global_del_orig_entry(struct bat_priv *bat_priv,
head = &tt_global_entry->orig_list;
hlist_for_each_entry_safe(orig_entry, node, safe, head, list) {
if (orig_entry->orig_node == orig_node) {
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Deleting %pM from global tt entry %pM: %s\n",
orig_node->orig,
tt_global_entry->common.addr, message);
@@ -871,7 +871,8 @@ static void batadv_tt_global_del_struct(struct bat_priv *bat_priv,
struct tt_global_entry *tt_global_entry,
const char *message)
{
- batadv_dbg(DBG_TT, bat_priv, "Deleting global tt entry %pM: %s\n",
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
+ "Deleting global tt entry %pM: %s\n",
tt_global_entry->common.addr, message);
batadv_hash_remove(bat_priv->tt_global_hash, batadv_compare_tt,
@@ -1006,7 +1007,7 @@ void batadv_tt_global_del_orig(struct bat_priv *bat_priv,
orig_node, message);
if (hlist_empty(&global_entry->orig_list)) {
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Deleting global tt entry %pM: %s\n",
global_entry->common.addr, message);
hlist_del_rcu(node);
@@ -1035,7 +1036,7 @@ static void batadv_tt_global_roam_purge_list(struct bat_priv *bat_priv,
BATADV_TT_CLIENT_ROAM_TIMEOUT))
continue;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Deleting global tt entry (%pM): Roaming timeout\n",
tt_global_entry->common.addr);
@@ -1471,7 +1472,7 @@ static int batadv_send_tt_request(struct bat_priv *bat_priv,
if (!neigh_node)
goto out;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Sending TT_REQUEST to %pM via %pM [%c]\n",
dst_orig_node->orig, neigh_node->addr,
(full_table ? 'F' : '.'));
@@ -1511,7 +1512,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
struct sk_buff *skb = NULL;
struct tt_query_packet *tt_response;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Received TT_REQUEST from %pM for ttvn: %u (%pM) [%c]\n",
tt_request->src, tt_request->ttvn, tt_request->dst,
(tt_request->flags & BATADV_TT_FULL_TABLE ? 'F' : '.'));
@@ -1599,7 +1600,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
if (full_table)
tt_response->flags |= BATADV_TT_FULL_TABLE;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Sending TT_RESPONSE %pM via %pM for %pM (ttvn: %u)\n",
res_dst_orig_node->orig, neigh_node->addr,
req_dst_orig_node->orig, req_ttvn);
@@ -1641,7 +1642,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
struct sk_buff *skb = NULL;
struct tt_query_packet *tt_response;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Received TT_REQUEST from %pM for ttvn: %u (me) [%c]\n",
tt_request->src, tt_request->ttvn,
(tt_request->flags & BATADV_TT_FULL_TABLE ? 'F' : '.'));
@@ -1720,7 +1721,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
if (full_table)
tt_response->flags |= BATADV_TT_FULL_TABLE;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Sending TT_RESPONSE to %pM via %pM [%c]\n",
orig_node->orig, neigh_node->addr,
(tt_response->flags & BATADV_TT_FULL_TABLE ? 'F' : '.'));
@@ -1860,7 +1861,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv,
struct tt_req_node *node, *safe;
struct orig_node *orig_node = NULL;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Received TT_RESPONSE from %pM for ttvn %d t_size: %d [%c]\n",
tt_response->src, tt_response->ttvn,
ntohs(tt_response->tt_data),
@@ -2039,7 +2040,7 @@ static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
if (!neigh_node)
goto out;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Sending ROAMING_ADV to %pM (client %pM) via %pM\n",
orig_node->orig, client, neigh_node->addr);
@@ -2146,7 +2147,7 @@ static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv)
if (!(tt_common->flags & BATADV_TT_CLIENT_PENDING))
continue;
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Deleting local tt entry (%pM): pending\n",
tt_common->addr);
@@ -2181,7 +2182,7 @@ static int batadv_tt_commit_changes(struct bat_priv *bat_priv,
/* Increment the TTVN only once per OGM interval */
atomic_inc(&bat_priv->ttvn);
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"Local changes committed, updating to ttvn %u\n",
(uint8_t)atomic_read(&bat_priv->ttvn));
bat_priv->tt_poss_change = false;
@@ -2306,7 +2307,7 @@ void batadv_tt_update_orig(struct bat_priv *bat_priv,
if (!orig_node->tt_initialised || ttvn != orig_ttvn ||
orig_node->tt_crc != tt_crc) {
request_table:
- batadv_dbg(DBG_TT, bat_priv,
+ batadv_dbg(BATADV_DBG_TT, bat_priv,
"TT inconsistency for %pM. Need to retrieve the correct information (ttvn: %u last_ttvn: %u crc: %u last_crc: %u num_changes: %u)\n",
orig_node->orig, ttvn, orig_ttvn, tt_crc,
orig_node->tt_crc, tt_num_changes);
--
1.7.9.4
^ permalink raw reply related
* [PATCH 06/16] batman-adv: Prefix local debugfs structs with batadv_
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1341186226-10549-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bat_debugfs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c
index 4dcda43..bd618e4 100644
--- a/net/batman-adv/bat_debugfs.c
+++ b/net/batman-adv/bat_debugfs.c
@@ -265,13 +265,13 @@ static int batadv_vis_data_open(struct inode *inode, struct file *file)
return single_open(file, batadv_vis_seq_print_text, net_dev);
}
-struct bat_debuginfo {
+struct batadv_debuginfo {
struct attribute attr;
const struct file_operations fops;
};
#define BATADV_DEBUGINFO(_name, _mode, _open) \
-struct bat_debuginfo batadv_debuginfo_##_name = { \
+struct batadv_debuginfo batadv_debuginfo_##_name = { \
.attr = { .name = __stringify(_name), \
.mode = _mode, }, \
.fops = { .owner = THIS_MODULE, \
@@ -294,7 +294,7 @@ static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
batadv_transtable_local_open);
static BATADV_DEBUGINFO(vis_data, S_IRUGO, batadv_vis_data_open);
-static struct bat_debuginfo *batadv_mesh_debuginfos[] = {
+static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
&batadv_debuginfo_originators,
&batadv_debuginfo_gateways,
&batadv_debuginfo_transtable_global,
@@ -308,7 +308,7 @@ static struct bat_debuginfo *batadv_mesh_debuginfos[] = {
void batadv_debugfs_init(void)
{
- struct bat_debuginfo *bat_debug;
+ struct batadv_debuginfo *bat_debug;
struct dentry *file;
batadv_debugfs = debugfs_create_dir(BATADV_DEBUGFS_SUBDIR, NULL);
@@ -340,7 +340,7 @@ void batadv_debugfs_destroy(void)
int batadv_debugfs_add_meshif(struct net_device *dev)
{
struct bat_priv *bat_priv = netdev_priv(dev);
- struct bat_debuginfo **bat_debug;
+ struct batadv_debuginfo **bat_debug;
struct dentry *file;
if (!batadv_debugfs)
--
1.7.9.4
^ permalink raw reply related
* [PATCH 04/16] batman-adv: Prefix packet enum with BATADV_
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1341186226-10549-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bat_iv_ogm.c | 48 ++++----
net/batman-adv/bat_sysfs.c | 24 ++--
net/batman-adv/bridge_loop_avoidance.c | 34 +++---
net/batman-adv/icmp_socket.c | 8 +-
net/batman-adv/main.c | 14 +--
net/batman-adv/packet.h | 88 +++++++--------
net/batman-adv/routing.c | 35 +++---
net/batman-adv/soft-interface.c | 4 +-
net/batman-adv/translation-table.c | 193 ++++++++++++++++----------------
net/batman-adv/unicast.c | 18 +--
net/batman-adv/unicast.h | 4 +-
net/batman-adv/vis.c | 18 +--
12 files changed, 255 insertions(+), 233 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 6099719..58bbb20 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -71,7 +71,7 @@ static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface)
goto out;
batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
- batman_ogm_packet->header.packet_type = BAT_IV_OGM;
+ batman_ogm_packet->header.packet_type = BATADV_IV_OGM;
batman_ogm_packet->header.version = BATADV_COMPAT_VERSION;
batman_ogm_packet->header.ttl = 2;
batman_ogm_packet->flags = BATADV_NO_FLAGS;
@@ -107,7 +107,7 @@ static void batadv_iv_ogm_primary_iface_set(struct hard_iface *hard_iface)
struct batman_ogm_packet *batman_ogm_packet;
batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
- batman_ogm_packet->flags = PRIMARIES_FIRST_HOP;
+ batman_ogm_packet->flags = BATADV_PRIMARIES_FIRST_HOP;
batman_ogm_packet->header.ttl = BATADV_TTL;
}
@@ -181,9 +181,9 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
*/
if ((forw_packet->direct_link_flags & (1 << packet_num)) &&
(forw_packet->if_incoming == hard_iface))
- batman_ogm_packet->flags |= DIRECTLINK;
+ batman_ogm_packet->flags |= BATADV_DIRECTLINK;
else
- batman_ogm_packet->flags &= ~DIRECTLINK;
+ batman_ogm_packet->flags &= ~BATADV_DIRECTLINK;
fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ?
"Sending own" :
@@ -194,7 +194,7 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
batman_ogm_packet->orig,
ntohl(batman_ogm_packet->seqno),
batman_ogm_packet->tq, batman_ogm_packet->header.ttl,
- (batman_ogm_packet->flags & DIRECTLINK ?
+ (batman_ogm_packet->flags & BATADV_DIRECTLINK ?
"on" : "off"),
batman_ogm_packet->ttvn, hard_iface->net_dev->name,
hard_iface->net_dev->dev_addr);
@@ -228,7 +228,7 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet)
batman_ogm_packet = (struct batman_ogm_packet *)
(forw_packet->skb->data);
- directlink = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0);
+ directlink = (batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0);
if (!forw_packet->if_incoming) {
pr_err("Error - can't forward packet: incoming iface not specified\n");
@@ -330,7 +330,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
* are flooded through the net
*/
if ((!directlink) &&
- (!(batman_ogm_packet->flags & DIRECTLINK)) &&
+ (!(batman_ogm_packet->flags & BATADV_DIRECTLINK)) &&
(batman_ogm_packet->header.ttl != 1) &&
/* own packets originating non-primary
@@ -353,7 +353,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
* own secondary interface packets
* (= secondary interface packets in general)
*/
- (batman_ogm_packet->flags & DIRECTLINK ||
+ (batman_ogm_packet->flags & BATADV_DIRECTLINK ||
(forw_packet->own &&
forw_packet->if_incoming != primary_if))) {
res = true;
@@ -480,7 +480,7 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv,
unsigned long max_aggregation_jiffies;
batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;
- direct_link = batman_ogm_packet->flags & DIRECTLINK ? 1 : 0;
+ direct_link = batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0;
max_aggregation_jiffies = msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS);
/* find position for the packet in the forward queue */
@@ -547,7 +547,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
* simply drop the ogm.
*/
if (is_single_hop_neigh)
- batman_ogm_packet->flags |= NOT_BEST_NEXT_HOP;
+ batman_ogm_packet->flags |= BATADV_NOT_BEST_NEXT_HOP;
else
return;
}
@@ -566,11 +566,11 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
batman_ogm_packet->tq, batman_ogm_packet->header.ttl);
/* switch of primaries first hop flag when forwarding */
- batman_ogm_packet->flags &= ~PRIMARIES_FIRST_HOP;
+ batman_ogm_packet->flags &= ~BATADV_PRIMARIES_FIRST_HOP;
if (is_single_hop_neigh)
- batman_ogm_packet->flags |= DIRECTLINK;
+ batman_ogm_packet->flags |= BATADV_DIRECTLINK;
else
- batman_ogm_packet->flags &= ~DIRECTLINK;
+ batman_ogm_packet->flags &= ~BATADV_DIRECTLINK;
batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet,
BATADV_OGM_HLEN + batadv_tt_len(tt_num_changes),
@@ -605,10 +605,10 @@ static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface)
if (tt_num_changes >= 0)
batman_ogm_packet->tt_num_changes = tt_num_changes;
- if (vis_server == VIS_TYPE_SERVER_SYNC)
- batman_ogm_packet->flags |= VIS_SERVER;
+ if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC)
+ batman_ogm_packet->flags |= BATADV_VIS_SERVER;
else
- batman_ogm_packet->flags &= ~VIS_SERVER;
+ batman_ogm_packet->flags &= ~BATADV_VIS_SERVER;
if ((hard_iface == primary_if) &&
(atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER))
@@ -746,7 +746,7 @@ update_tt:
*/
if (((batman_ogm_packet->orig != ethhdr->h_source) &&
(batman_ogm_packet->header.ttl > 2)) ||
- (batman_ogm_packet->flags & PRIMARIES_FIRST_HOP))
+ (batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP))
batadv_tt_update_orig(bat_priv, orig_node, tt_buff,
batman_ogm_packet->tt_num_changes,
batman_ogm_packet->ttvn,
@@ -993,13 +993,16 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
* packet in an aggregation. Here we expect that the padding
* is always zero (or not 0x01)
*/
- if (batman_ogm_packet->header.packet_type != BAT_IV_OGM)
+ if (batman_ogm_packet->header.packet_type != BATADV_IV_OGM)
return;
/* could be changed by schedule_own_packet() */
if_incoming_seqno = atomic_read(&if_incoming->seqno);
- has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0);
+ if (batman_ogm_packet->flags & BATADV_DIRECTLINK)
+ has_directlink_flag = 1;
+ else
+ has_directlink_flag = 0;
if (batadv_compare_eth(ethhdr->h_source, batman_ogm_packet->orig))
is_single_hop_neigh = true;
@@ -1107,7 +1110,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
return;
}
- if (batman_ogm_packet->flags & NOT_BEST_NEXT_HOP) {
+ if (batman_ogm_packet->flags & BATADV_NOT_BEST_NEXT_HOP) {
batadv_dbg(DBG_BATMAN, bat_priv,
"Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n",
ethhdr->h_source);
@@ -1299,7 +1302,8 @@ int __init batadv_iv_init(void)
int ret;
/* batman originator packet */
- ret = batadv_recv_handler_register(BAT_IV_OGM, batadv_iv_ogm_receive);
+ ret = batadv_recv_handler_register(BATADV_IV_OGM,
+ batadv_iv_ogm_receive);
if (ret < 0)
goto out;
@@ -1310,7 +1314,7 @@ int __init batadv_iv_init(void)
goto out;
handler_unregister:
- batadv_recv_handler_unregister(BAT_IV_OGM);
+ batadv_recv_handler_unregister(BATADV_IV_OGM);
out:
return ret;
}
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 680caca..e27bfe3 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -283,10 +283,14 @@ static ssize_t batadv_show_vis_mode(struct kobject *kobj,
{
struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj);
int vis_mode = atomic_read(&bat_priv->vis_mode);
+ const char *mode;
- return sprintf(buff, "%s\n",
- vis_mode == VIS_TYPE_CLIENT_UPDATE ?
- "client" : "server");
+ if (vis_mode == BATADV_VIS_TYPE_CLIENT_UPDATE)
+ mode = "client";
+ else
+ mode = "server";
+
+ return sprintf(buff, "%s\n", mode);
}
static ssize_t batadv_store_vis_mode(struct kobject *kobj,
@@ -301,14 +305,16 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj,
ret = kstrtoul(buff, 10, &val);
- if (((count == 2) && (!ret) && (val == VIS_TYPE_CLIENT_UPDATE)) ||
+ if (((count == 2) && (!ret) &&
+ (val == BATADV_VIS_TYPE_CLIENT_UPDATE)) ||
(strncmp(buff, "client", 6) == 0) ||
(strncmp(buff, "off", 3) == 0))
- vis_mode_tmp = VIS_TYPE_CLIENT_UPDATE;
+ vis_mode_tmp = BATADV_VIS_TYPE_CLIENT_UPDATE;
- if (((count == 2) && (!ret) && (val == VIS_TYPE_SERVER_SYNC)) ||
+ if (((count == 2) && (!ret) &&
+ (val == BATADV_VIS_TYPE_SERVER_SYNC)) ||
(strncmp(buff, "server", 6) == 0))
- vis_mode_tmp = VIS_TYPE_SERVER_SYNC;
+ vis_mode_tmp = BATADV_VIS_TYPE_SERVER_SYNC;
if (vis_mode_tmp < 0) {
if (buff[count - 1] == '\n')
@@ -323,12 +329,12 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj,
if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp)
return count;
- if (atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE)
+ if (atomic_read(&bat_priv->vis_mode) == BATADV_VIS_TYPE_CLIENT_UPDATE)
old_mode = "client";
else
old_mode = "server";
- if (vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE)
+ if (vis_mode_tmp == BATADV_VIS_TYPE_CLIENT_UPDATE)
new_mode = "client";
else
new_mode = "server";
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 13afc65..c375131 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -292,7 +292,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
/* now we pretend that the client would have sent this ... */
switch (claimtype) {
- case CLAIM_TYPE_ADD:
+ case BATADV_CLAIM_TYPE_ADD:
/* normal claim frame
* set Ethernet SRC to the clients mac
*/
@@ -300,7 +300,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
batadv_dbg(DBG_BLA, bat_priv,
"bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid);
break;
- case CLAIM_TYPE_DEL:
+ case BATADV_CLAIM_TYPE_DEL:
/* unclaim frame
* set HW SRC to the clients mac
*/
@@ -309,7 +309,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
"bla_send_claim(): UNCLAIM %pM on vid %d\n", mac,
vid);
break;
- case CLAIM_TYPE_ANNOUNCE:
+ case BATADV_CLAIM_TYPE_ANNOUNCE:
/* announcement frame
* set HW SRC to the special mac containg the crc
*/
@@ -318,7 +318,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
"bla_send_claim(): ANNOUNCE of %pM on vid %d\n",
ethhdr->h_source, vid);
break;
- case CLAIM_TYPE_REQUEST:
+ case BATADV_CLAIM_TYPE_REQUEST:
/* request frame
* set HW SRC to the special mac containg the crc
*/
@@ -459,7 +459,7 @@ static void batadv_bla_answer_request(struct bat_priv *bat_priv,
continue;
batadv_bla_send_claim(bat_priv, claim->addr, claim->vid,
- CLAIM_TYPE_ADD);
+ BATADV_CLAIM_TYPE_ADD);
}
rcu_read_unlock();
}
@@ -485,7 +485,7 @@ static void batadv_bla_send_request(struct backbone_gw *backbone_gw)
/* send request */
batadv_bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig,
- backbone_gw->vid, CLAIM_TYPE_REQUEST);
+ backbone_gw->vid, BATADV_CLAIM_TYPE_REQUEST);
/* no local broadcasts should be sent or received, for now. */
if (!atomic_read(&backbone_gw->request_sent)) {
@@ -511,7 +511,7 @@ static void batadv_bla_send_announce(struct bat_priv *bat_priv,
memcpy(&mac[4], &crc, 2);
batadv_bla_send_claim(bat_priv, mac, backbone_gw->vid,
- CLAIM_TYPE_ANNOUNCE);
+ BATADV_CLAIM_TYPE_ANNOUNCE);
}
@@ -694,7 +694,7 @@ static int batadv_handle_unclaim(struct bat_priv *bat_priv,
if (primary_if && batadv_compare_eth(backbone_addr,
primary_if->net_dev->dev_addr))
batadv_bla_send_claim(bat_priv, claim_addr, vid,
- CLAIM_TYPE_DEL);
+ BATADV_CLAIM_TYPE_DEL);
backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid);
@@ -730,7 +730,7 @@ static int batadv_handle_claim(struct bat_priv *bat_priv,
batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw);
if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr))
batadv_bla_send_claim(bat_priv, claim_addr, vid,
- CLAIM_TYPE_ADD);
+ BATADV_CLAIM_TYPE_ADD);
/* TODO: we could call something like tt_local_del() here. */
@@ -773,12 +773,12 @@ static int batadv_check_claim_group(struct bat_priv *bat_priv,
* otherwise assume it is in the hw_src
*/
switch (bla_dst->type) {
- case CLAIM_TYPE_ADD:
+ case BATADV_CLAIM_TYPE_ADD:
backbone_addr = hw_src;
break;
- case CLAIM_TYPE_REQUEST:
- case CLAIM_TYPE_ANNOUNCE:
- case CLAIM_TYPE_DEL:
+ case BATADV_CLAIM_TYPE_REQUEST:
+ case BATADV_CLAIM_TYPE_ANNOUNCE:
+ case BATADV_CLAIM_TYPE_DEL:
backbone_addr = ethhdr->h_source;
break;
default:
@@ -894,23 +894,23 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv,
/* check for the different types of claim frames ... */
switch (bla_dst->type) {
- case CLAIM_TYPE_ADD:
+ case BATADV_CLAIM_TYPE_ADD:
if (batadv_handle_claim(bat_priv, primary_if, hw_src,
ethhdr->h_source, vid))
return 1;
break;
- case CLAIM_TYPE_DEL:
+ case BATADV_CLAIM_TYPE_DEL:
if (batadv_handle_unclaim(bat_priv, primary_if,
ethhdr->h_source, hw_src, vid))
return 1;
break;
- case CLAIM_TYPE_ANNOUNCE:
+ case BATADV_CLAIM_TYPE_ANNOUNCE:
if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source,
vid))
return 1;
break;
- case CLAIM_TYPE_REQUEST:
+ case BATADV_CLAIM_TYPE_REQUEST:
if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr,
vid))
return 1;
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index f5373a2..a64cce2 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -187,14 +187,14 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
goto free_skb;
}
- if (icmp_packet->header.packet_type != BAT_ICMP) {
+ if (icmp_packet->header.packet_type != BATADV_ICMP) {
batadv_dbg(DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n");
len = -EINVAL;
goto free_skb;
}
- if (icmp_packet->msg_type != ECHO_REQUEST) {
+ if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
batadv_dbg(DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n");
len = -EINVAL;
@@ -204,7 +204,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
icmp_packet->uid = socket_client->index;
if (icmp_packet->header.version != BATADV_COMPAT_VERSION) {
- icmp_packet->msg_type = PARAMETER_PROBLEM;
+ icmp_packet->msg_type = BATADV_PARAMETER_PROBLEM;
icmp_packet->header.version = BATADV_COMPAT_VERSION;
batadv_socket_add_packet(socket_client, icmp_packet,
packet_len);
@@ -239,7 +239,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
goto out;
dst_unreach:
- icmp_packet->msg_type = DESTINATION_UNREACHABLE;
+ icmp_packet->msg_type = BATADV_DESTINATION_UNREACHABLE;
batadv_socket_add_packet(socket_client, icmp_packet, packet_len);
free_skb:
kfree_skb(skb);
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 23f5c8e..b3f0a2e 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -275,19 +275,19 @@ static void batadv_recv_handler_init(void)
batadv_rx_handler[i] = batadv_recv_unhandled_packet;
/* batman icmp packet */
- batadv_rx_handler[BAT_ICMP] = batadv_recv_icmp_packet;
+ batadv_rx_handler[BATADV_ICMP] = batadv_recv_icmp_packet;
/* unicast packet */
- batadv_rx_handler[BAT_UNICAST] = batadv_recv_unicast_packet;
+ batadv_rx_handler[BATADV_UNICAST] = batadv_recv_unicast_packet;
/* fragmented unicast packet */
- batadv_rx_handler[BAT_UNICAST_FRAG] = batadv_recv_ucast_frag_packet;
+ batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_ucast_frag_packet;
/* broadcast packet */
- batadv_rx_handler[BAT_BCAST] = batadv_recv_bcast_packet;
+ batadv_rx_handler[BATADV_BCAST] = batadv_recv_bcast_packet;
/* vis packet */
- batadv_rx_handler[BAT_VIS] = batadv_recv_vis_packet;
+ batadv_rx_handler[BATADV_VIS] = batadv_recv_vis_packet;
/* Translation table query (request or response) */
- batadv_rx_handler[BAT_TT_QUERY] = batadv_recv_tt_query;
+ batadv_rx_handler[BATADV_TT_QUERY] = batadv_recv_tt_query;
/* Roaming advertisement */
- batadv_rx_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv;
+ batadv_rx_handler[BATADV_ROAM_ADV] = batadv_recv_roam_adv;
}
int batadv_recv_handler_register(uint8_t packet_type,
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index e562414..59e328a 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -22,80 +22,80 @@
#define BATADV_ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */
-enum bat_packettype {
- BAT_IV_OGM = 0x01,
- BAT_ICMP = 0x02,
- BAT_UNICAST = 0x03,
- BAT_BCAST = 0x04,
- BAT_VIS = 0x05,
- BAT_UNICAST_FRAG = 0x06,
- BAT_TT_QUERY = 0x07,
- BAT_ROAM_ADV = 0x08
+enum batadv_packettype {
+ BATADV_IV_OGM = 0x01,
+ BATADV_ICMP = 0x02,
+ BATADV_UNICAST = 0x03,
+ BATADV_BCAST = 0x04,
+ BATADV_VIS = 0x05,
+ BATADV_UNICAST_FRAG = 0x06,
+ BATADV_TT_QUERY = 0x07,
+ BATADV_ROAM_ADV = 0x08,
};
/* this file is included by batctl which needs these defines */
#define BATADV_COMPAT_VERSION 14
-enum batman_iv_flags {
- NOT_BEST_NEXT_HOP = 1 << 3,
- PRIMARIES_FIRST_HOP = 1 << 4,
- VIS_SERVER = 1 << 5,
- DIRECTLINK = 1 << 6
+enum batadv_iv_flags {
+ BATADV_NOT_BEST_NEXT_HOP = 1 << 3,
+ BATADV_PRIMARIES_FIRST_HOP = 1 << 4,
+ BATADV_VIS_SERVER = 1 << 5,
+ BATADV_DIRECTLINK = 1 << 6,
};
/* ICMP message types */
-enum icmp_packettype {
- ECHO_REPLY = 0,
- DESTINATION_UNREACHABLE = 3,
- ECHO_REQUEST = 8,
- TTL_EXCEEDED = 11,
- PARAMETER_PROBLEM = 12
+enum batadv_icmp_packettype {
+ BATADV_ECHO_REPLY = 0,
+ BATADV_DESTINATION_UNREACHABLE = 3,
+ BATADV_ECHO_REQUEST = 8,
+ BATADV_TTL_EXCEEDED = 11,
+ BATADV_PARAMETER_PROBLEM = 12,
};
/* vis defines */
-enum vis_packettype {
- VIS_TYPE_SERVER_SYNC = 0,
- VIS_TYPE_CLIENT_UPDATE = 1
+enum batadv_vis_packettype {
+ BATADV_VIS_TYPE_SERVER_SYNC = 0,
+ BATADV_VIS_TYPE_CLIENT_UPDATE = 1,
};
/* fragmentation defines */
-enum unicast_frag_flags {
- UNI_FRAG_HEAD = 1 << 0,
- UNI_FRAG_LARGETAIL = 1 << 1
+enum batadv_unicast_frag_flags {
+ BATADV_UNI_FRAG_HEAD = 1 << 0,
+ BATADV_UNI_FRAG_LARGETAIL = 1 << 1,
};
/* TT_QUERY subtypes */
#define BATADV_TT_QUERY_TYPE_MASK 0x3
-enum tt_query_packettype {
- TT_REQUEST = 0,
- TT_RESPONSE = 1
+enum batadv_tt_query_packettype {
+ BATADV_TT_REQUEST = 0,
+ BATADV_TT_RESPONSE = 1,
};
/* TT_QUERY flags */
-enum tt_query_flags {
- TT_FULL_TABLE = 1 << 2
+enum batadv_tt_query_flags {
+ BATADV_TT_FULL_TABLE = 1 << 2,
};
-/* TT_CLIENT flags.
+/* BATADV_TT_CLIENT flags.
* Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to
* 1 << 15 are used for local computation only
*/
-enum tt_client_flags {
- TT_CLIENT_DEL = 1 << 0,
- TT_CLIENT_ROAM = 1 << 1,
- TT_CLIENT_WIFI = 1 << 2,
- TT_CLIENT_NOPURGE = 1 << 8,
- TT_CLIENT_NEW = 1 << 9,
- TT_CLIENT_PENDING = 1 << 10
+enum batadv_tt_client_flags {
+ BATADV_TT_CLIENT_DEL = 1 << 0,
+ BATADV_TT_CLIENT_ROAM = 1 << 1,
+ BATADV_TT_CLIENT_WIFI = 1 << 2,
+ BATADV_TT_CLIENT_NOPURGE = 1 << 8,
+ BATADV_TT_CLIENT_NEW = 1 << 9,
+ BATADV_TT_CLIENT_PENDING = 1 << 10,
};
/* claim frame types for the bridge loop avoidance */
-enum bla_claimframe {
- CLAIM_TYPE_ADD = 0x00,
- CLAIM_TYPE_DEL = 0x01,
- CLAIM_TYPE_ANNOUNCE = 0x02,
- CLAIM_TYPE_REQUEST = 0x03
+enum batadv_bla_claimframe {
+ BATADV_CLAIM_TYPE_ADD = 0x00,
+ BATADV_CLAIM_TYPE_DEL = 0x01,
+ BATADV_CLAIM_TYPE_ANNOUNCE = 0x02,
+ BATADV_CLAIM_TYPE_REQUEST = 0x03,
};
/* the destination hardware field in the ARP frame is used to
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index aa8325e..8e43a95 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -219,7 +219,7 @@ batadv_bonding_save_primary(const struct orig_node *orig_node,
struct orig_node *orig_neigh_node,
const struct batman_ogm_packet *batman_ogm_packet)
{
- if (!(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP))
+ if (!(batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP))
return;
memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN);
@@ -290,7 +290,7 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv,
icmp_packet = (struct icmp_packet_rr *)skb->data;
/* add data to device queue */
- if (icmp_packet->msg_type != ECHO_REQUEST) {
+ if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
batadv_socket_receive_packet(icmp_packet, icmp_len);
goto out;
}
@@ -317,7 +317,7 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv,
memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
- icmp_packet->msg_type = ECHO_REPLY;
+ icmp_packet->msg_type = BATADV_ECHO_REPLY;
icmp_packet->header.ttl = BATADV_TTL;
batadv_send_skb_packet(skb, router->if_incoming, router->addr);
@@ -345,7 +345,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
icmp_packet = (struct icmp_packet *)skb->data;
/* send TTL exceeded if packet is an echo request (traceroute) */
- if (icmp_packet->msg_type != ECHO_REQUEST) {
+ if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
pr_debug("Warning - can't forward icmp packet from %pM to %pM: ttl exceeded\n",
icmp_packet->orig, icmp_packet->dst);
goto out;
@@ -372,7 +372,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
- icmp_packet->msg_type = TTL_EXCEEDED;
+ icmp_packet->msg_type = BATADV_TTL_EXCEEDED;
icmp_packet->header.ttl = BATADV_TTL;
batadv_send_skb_packet(skb, router->if_incoming, router->addr);
@@ -606,14 +606,18 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
tt_query = (struct tt_query_packet *)skb->data;
switch (tt_query->flags & BATADV_TT_QUERY_TYPE_MASK) {
- case TT_REQUEST:
+ case BATADV_TT_REQUEST:
batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX);
/* If we cannot provide an answer the tt_request is
* forwarded
*/
if (!batadv_send_tt_response(bat_priv, tt_query)) {
- tt_flag = tt_query->flags & TT_FULL_TABLE ? 'F' : '.';
+ if (tt_query->flags & BATADV_TT_FULL_TABLE)
+ tt_flag = 'F';
+ else
+ tt_flag = '.';
+
batadv_dbg(DBG_TT, bat_priv,
"Routing TT_REQUEST to %pM [%c]\n",
tt_query->dst,
@@ -621,7 +625,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
return batadv_route_unicast_packet(skb, recv_if);
}
break;
- case TT_RESPONSE:
+ case BATADV_TT_RESPONSE:
batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX);
if (batadv_is_my_mac(tt_query->dst)) {
@@ -642,7 +646,10 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
batadv_handle_tt_response(bat_priv, tt_query);
} else {
- tt_flag = tt_query->flags & TT_FULL_TABLE ? 'F' : '.';
+ if (tt_query->flags & BATADV_TT_FULL_TABLE)
+ tt_flag = 'F';
+ else
+ tt_flag = '.';
batadv_dbg(DBG_TT, bat_priv,
"Routing TT_RESPONSE to %pM [%c]\n",
tt_query->dst,
@@ -701,7 +708,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
roam_adv_packet->src, roam_adv_packet->client);
batadv_tt_global_add(bat_priv, orig_node, roam_adv_packet->client,
- TT_CLIENT_ROAM,
+ BATADV_TT_CLIENT_ROAM,
atomic_read(&orig_node->last_ttvn) + 1);
/* Roaming phase starts: I have new information but the ttvn has not
@@ -868,7 +875,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
unicast_packet = (struct unicast_packet *)skb->data;
- if (unicast_packet->header.packet_type == BAT_UNICAST &&
+ if (unicast_packet->header.packet_type == BATADV_UNICAST &&
atomic_read(&bat_priv->fragmentation) &&
skb->len > neigh_node->if_incoming->net_dev->mtu) {
ret = batadv_frag_send_skb(skb, bat_priv,
@@ -877,7 +884,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
goto out;
}
- if (unicast_packet->header.packet_type == BAT_UNICAST_FRAG &&
+ if (unicast_packet->header.packet_type == BATADV_UNICAST_FRAG &&
batadv_frag_can_reassemble(skb,
neigh_node->if_incoming->net_dev->mtu)) {
@@ -1176,12 +1183,12 @@ int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if)
return NET_RX_DROP;
switch (vis_packet->vis_type) {
- case VIS_TYPE_SERVER_SYNC:
+ case BATADV_VIS_TYPE_SERVER_SYNC:
batadv_receive_server_sync_packet(bat_priv, vis_packet,
skb_headlen(skb));
break;
- case VIS_TYPE_CLIENT_UPDATE:
+ case BATADV_VIS_TYPE_CLIENT_UPDATE:
batadv_receive_client_update_packet(bat_priv, vis_packet,
skb_headlen(skb));
break;
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 19a80d2..3aae91d 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -213,7 +213,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
bcast_packet->header.ttl = BATADV_TTL;
/* batman packet type: broadcast */
- bcast_packet->header.packet_type = BAT_BCAST;
+ bcast_packet->header.packet_type = BATADV_BCAST;
/* hw address of first interface is the orig mac because only
* this mac is known throughout the mesh
@@ -387,7 +387,7 @@ struct net_device *batadv_softif_create(const char *name)
atomic_set(&bat_priv->bonding, 0);
atomic_set(&bat_priv->bridge_loop_avoidance, 0);
atomic_set(&bat_priv->ap_isolation, 0);
- atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE);
+ atomic_set(&bat_priv->vis_mode, BATADV_VIS_TYPE_CLIENT_UPDATE);
atomic_set(&bat_priv->gw_mode, BATADV_GW_MODE_OFF);
atomic_set(&bat_priv->gw_sel_class, 20);
atomic_set(&bat_priv->gw_bandwidth, 41);
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index f36d1d5..309d691 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -169,7 +169,7 @@ static void batadv_tt_local_event(struct bat_priv *bat_priv,
tt_change_node->change.flags = flags;
memcpy(tt_change_node->change.addr, addr, ETH_ALEN);
- del_op_requested = flags & TT_CLIENT_DEL;
+ del_op_requested = flags & BATADV_TT_CLIENT_DEL;
/* check for ADD+DEL or DEL+ADD events */
spin_lock_bh(&bat_priv->tt_changes_list_lock);
@@ -185,7 +185,7 @@ static void batadv_tt_local_event(struct bat_priv *bat_priv,
* now possible due to automatically recognition of "temporary"
* clients
*/
- del_op_entry = entry->change.flags & TT_CLIENT_DEL;
+ del_op_entry = entry->change.flags & BATADV_TT_CLIENT_DEL;
if (!del_op_requested && del_op_entry)
goto del;
if (del_op_requested && !del_op_entry)
@@ -243,8 +243,8 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
if (tt_local_entry) {
tt_local_entry->last_seen = jiffies;
- /* possibly unset the TT_CLIENT_PENDING flag */
- tt_local_entry->common.flags &= ~TT_CLIENT_PENDING;
+ /* possibly unset the BATADV_TT_CLIENT_PENDING flag */
+ tt_local_entry->common.flags &= ~BATADV_TT_CLIENT_PENDING;
goto out;
}
@@ -259,19 +259,19 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
memcpy(tt_local_entry->common.addr, addr, ETH_ALEN);
tt_local_entry->common.flags = BATADV_NO_FLAGS;
if (batadv_is_wifi_iface(ifindex))
- tt_local_entry->common.flags |= TT_CLIENT_WIFI;
+ tt_local_entry->common.flags |= BATADV_TT_CLIENT_WIFI;
atomic_set(&tt_local_entry->common.refcount, 2);
tt_local_entry->last_seen = jiffies;
/* the batman interface mac address should never be purged */
if (batadv_compare_eth(addr, soft_iface->dev_addr))
- tt_local_entry->common.flags |= TT_CLIENT_NOPURGE;
+ tt_local_entry->common.flags |= BATADV_TT_CLIENT_NOPURGE;
/* The local entry has to be marked as NEW to avoid to send it in
* a full table response going out before the next ttvn increment
* (consistency check)
*/
- tt_local_entry->common.flags |= TT_CLIENT_NEW;
+ tt_local_entry->common.flags |= BATADV_TT_CLIENT_NEW;
hash_added = batadv_hash_add(bat_priv->tt_local_hash, batadv_compare_tt,
batadv_choose_orig,
@@ -305,7 +305,7 @@ void batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr,
/* The global entry has to be marked as ROAMING and
* has to be kept for consistency purpose
*/
- tt_global_entry->common.flags |= TT_CLIENT_ROAM;
+ tt_global_entry->common.flags |= BATADV_TT_CLIENT_ROAM;
tt_global_entry->roam_at = jiffies;
}
out:
@@ -453,15 +453,15 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
seq_printf(seq, " * %pM [%c%c%c%c%c]\n",
tt_common_entry->addr,
(tt_common_entry->flags &
- TT_CLIENT_ROAM ? 'R' : '.'),
+ BATADV_TT_CLIENT_ROAM ? 'R' : '.'),
(tt_common_entry->flags &
- TT_CLIENT_NOPURGE ? 'P' : '.'),
+ BATADV_TT_CLIENT_NOPURGE ? 'P' : '.'),
(tt_common_entry->flags &
- TT_CLIENT_NEW ? 'N' : '.'),
+ BATADV_TT_CLIENT_NEW ? 'N' : '.'),
(tt_common_entry->flags &
- TT_CLIENT_PENDING ? 'X' : '.'),
+ BATADV_TT_CLIENT_PENDING ? 'X' : '.'),
(tt_common_entry->flags &
- TT_CLIENT_WIFI ? 'W' : '.'));
+ BATADV_TT_CLIENT_WIFI ? 'W' : '.'));
}
rcu_read_unlock();
}
@@ -482,7 +482,7 @@ static void batadv_tt_local_set_pending(struct bat_priv *bat_priv,
* to be kept in the table in order to send it in a full table
* response issued before the net ttvn increment (consistency check)
*/
- tt_local_entry->common.flags |= TT_CLIENT_PENDING;
+ tt_local_entry->common.flags |= BATADV_TT_CLIENT_PENDING;
batadv_dbg(DBG_TT, bat_priv,
"Local tt entry (%pM) pending to be removed: %s\n",
@@ -499,9 +499,9 @@ void batadv_tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr,
if (!tt_local_entry)
goto out;
- flags = TT_CLIENT_DEL;
+ flags = BATADV_TT_CLIENT_DEL;
if (roaming)
- flags |= TT_CLIENT_ROAM;
+ flags |= BATADV_TT_CLIENT_ROAM;
batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, message);
out:
@@ -509,12 +509,36 @@ out:
batadv_tt_local_entry_free_ref(tt_local_entry);
}
+static void batadv_tt_local_purge_list(struct bat_priv *bat_priv,
+ struct hlist_head *head)
+{
+ struct tt_local_entry *tt_local_entry;
+ struct tt_common_entry *tt_common_entry;
+ struct hlist_node *node, *node_tmp;
+
+ hlist_for_each_entry_safe(tt_common_entry, node, node_tmp, head,
+ hash_entry) {
+ tt_local_entry = container_of(tt_common_entry,
+ struct tt_local_entry, common);
+ if (tt_local_entry->common.flags & BATADV_TT_CLIENT_NOPURGE)
+ continue;
+
+ /* entry already marked for deletion */
+ if (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING)
+ continue;
+
+ if (!batadv_has_timed_out(tt_local_entry->last_seen,
+ BATADV_TT_LOCAL_TIMEOUT))
+ continue;
+
+ batadv_tt_local_set_pending(bat_priv, tt_local_entry,
+ BATADV_TT_CLIENT_DEL, "timed out");
+ }
+}
+
static void batadv_tt_local_purge(struct bat_priv *bat_priv)
{
struct hashtable_t *hash = bat_priv->tt_local_hash;
- struct tt_local_entry *tt_local_entry;
- struct tt_common_entry *tt_common_entry;
- struct hlist_node *node, *node_tmp;
struct hlist_head *head;
spinlock_t *list_lock; /* protects write access to the hash lists */
uint32_t i;
@@ -524,25 +548,7 @@ static void batadv_tt_local_purge(struct bat_priv *bat_priv)
list_lock = &hash->list_locks[i];
spin_lock_bh(list_lock);
- hlist_for_each_entry_safe(tt_common_entry, node, node_tmp,
- head, hash_entry) {
- tt_local_entry = container_of(tt_common_entry,
- struct tt_local_entry,
- common);
- if (tt_local_entry->common.flags & TT_CLIENT_NOPURGE)
- continue;
-
- /* entry already marked for deletion */
- if (tt_local_entry->common.flags & TT_CLIENT_PENDING)
- continue;
-
- if (!batadv_has_timed_out(tt_local_entry->last_seen,
- BATADV_TT_LOCAL_TIMEOUT))
- continue;
-
- batadv_tt_local_set_pending(bat_priv, tt_local_entry,
- TT_CLIENT_DEL, "timed out");
- }
+ batadv_tt_local_purge_list(bat_priv, head);
spin_unlock_bh(list_lock);
}
@@ -701,16 +707,16 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
} else {
/* there is already a global entry, use this one. */
- /* If there is the TT_CLIENT_ROAM flag set, there is only one
- * originator left in the list and we previously received a
+ /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only
+ * one originator left in the list and we previously received a
* delete + roaming change for this originator.
*
* We should first delete the old originator before adding the
* new one.
*/
- if (tt_global_entry->common.flags & TT_CLIENT_ROAM) {
+ if (tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM) {
batadv_tt_global_del_orig_list(tt_global_entry);
- tt_global_entry->common.flags &= ~TT_CLIENT_ROAM;
+ tt_global_entry->common.flags &= ~BATADV_TT_CLIENT_ROAM;
tt_global_entry->roam_at = 0;
}
@@ -727,7 +733,8 @@ int batadv_tt_global_add(struct bat_priv *bat_priv, struct orig_node *orig_node,
out_remove:
/* remove address from local hash if present */
batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr,
- "global tt received", flags & TT_CLIENT_ROAM);
+ "global tt received",
+ flags & BATADV_TT_CLIENT_ROAM);
ret = 1;
out:
if (tt_global_entry)
@@ -759,8 +766,8 @@ batadv_tt_global_print_entry(struct tt_global_entry *tt_global_entry,
seq_printf(seq, " * %pM (%3u) via %pM (%3u) [%c%c]\n",
tt_global_entry->common.addr, orig_entry->ttvn,
orig_entry->orig_node->orig, last_ttvn,
- (flags & TT_CLIENT_ROAM ? 'R' : '.'),
- (flags & TT_CLIENT_WIFI ? 'W' : '.'));
+ (flags & BATADV_TT_CLIENT_ROAM ? 'R' : '.'),
+ (flags & BATADV_TT_CLIENT_WIFI ? 'W' : '.'));
}
}
@@ -874,8 +881,8 @@ static void batadv_tt_global_del_struct(struct bat_priv *bat_priv,
}
/* If the client is to be deleted, we check if it is the last origantor entry
- * within tt_global entry. If yes, we set the TT_CLIENT_ROAM flag and the timer,
- * otherwise we simply remove the originator scheduled for deletion.
+ * within tt_global entry. If yes, we set the BATADV_TT_CLIENT_ROAM flag and the
+ * timer, otherwise we simply remove the originator scheduled for deletion.
*/
static void
batadv_tt_global_del_roaming(struct bat_priv *bat_priv,
@@ -903,7 +910,7 @@ batadv_tt_global_del_roaming(struct bat_priv *bat_priv,
if (last_entry) {
/* its the last one, mark for roaming. */
- tt_global_entry->common.flags |= TT_CLIENT_ROAM;
+ tt_global_entry->common.flags |= BATADV_TT_CLIENT_ROAM;
tt_global_entry->roam_at = jiffies;
} else
/* there is another entry, we can simply delete this
@@ -942,7 +949,7 @@ static void batadv_tt_global_del(struct bat_priv *bat_priv,
* event, there are two possibilities:
* 1) the client roamed from node A to node B => if there
* is only one originator left for this client, we mark
- * it with TT_CLIENT_ROAM, we start a timer and we
+ * it with BATADV_TT_CLIENT_ROAM, we start a timer and we
* wait for node B to claim it. In case of timeout
* the entry is purged.
*
@@ -1022,7 +1029,7 @@ static void batadv_tt_global_roam_purge_list(struct bat_priv *bat_priv,
hash_entry) {
tt_global_entry = container_of(tt_common_entry,
struct tt_global_entry, common);
- if (!(tt_global_entry->common.flags & TT_CLIENT_ROAM))
+ if (!(tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM))
continue;
if (!batadv_has_timed_out(tt_global_entry->roam_at,
BATADV_TT_CLIENT_ROAM_TIMEOUT))
@@ -1096,8 +1103,8 @@ static bool _batadv_is_ap_isolated(struct tt_local_entry *tt_local_entry,
{
bool ret = false;
- if (tt_local_entry->common.flags & TT_CLIENT_WIFI &&
- tt_global_entry->common.flags & TT_CLIENT_WIFI)
+ if (tt_local_entry->common.flags & BATADV_TT_CLIENT_WIFI &&
+ tt_global_entry->common.flags & BATADV_TT_CLIENT_WIFI)
ret = true;
return ret;
@@ -1167,7 +1174,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv,
{
uint16_t total = 0, total_one;
struct hashtable_t *hash = bat_priv->tt_global_hash;
- struct tt_common_entry *tt_common_entry;
+ struct tt_common_entry *tt_common;
struct tt_global_entry *tt_global_entry;
struct hlist_node *node;
struct hlist_head *head;
@@ -1178,9 +1185,8 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv,
head = &hash->table[i];
rcu_read_lock();
- hlist_for_each_entry_rcu(tt_common_entry, node,
- head, hash_entry) {
- tt_global_entry = container_of(tt_common_entry,
+ hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) {
+ tt_global_entry = container_of(tt_common,
struct tt_global_entry,
common);
/* Roaming clients are in the global table for
@@ -1188,7 +1194,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv,
* taken into account while computing the
* global crc
*/
- if (tt_global_entry->common.flags & TT_CLIENT_ROAM)
+ if (tt_common->flags & BATADV_TT_CLIENT_ROAM)
continue;
/* find out if this global entry is announced by this
@@ -1201,7 +1207,7 @@ static uint16_t batadv_tt_global_crc(struct bat_priv *bat_priv,
total_one = 0;
for (j = 0; j < ETH_ALEN; j++)
total_one = crc16_byte(total_one,
- tt_global_entry->common.addr[j]);
+ tt_common->addr[j]);
total ^= total_one;
}
rcu_read_unlock();
@@ -1215,7 +1221,7 @@ static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv)
{
uint16_t total = 0, total_one;
struct hashtable_t *hash = bat_priv->tt_local_hash;
- struct tt_common_entry *tt_common_entry;
+ struct tt_common_entry *tt_common;
struct hlist_node *node;
struct hlist_head *head;
uint32_t i;
@@ -1225,17 +1231,16 @@ static uint16_t batadv_tt_local_crc(struct bat_priv *bat_priv)
head = &hash->table[i];
rcu_read_lock();
- hlist_for_each_entry_rcu(tt_common_entry, node,
- head, hash_entry) {
+ hlist_for_each_entry_rcu(tt_common, node, head, hash_entry) {
/* not yet committed clients have not to be taken into
* account while computing the CRC
*/
- if (tt_common_entry->flags & TT_CLIENT_NEW)
+ if (tt_common->flags & BATADV_TT_CLIENT_NEW)
continue;
total_one = 0;
for (j = 0; j < ETH_ALEN; j++)
total_one = crc16_byte(total_one,
- tt_common_entry->addr[j]);
+ tt_common->addr[j]);
total ^= total_one;
}
rcu_read_unlock();
@@ -1331,7 +1336,7 @@ static int batadv_tt_local_valid_entry(const void *entry_ptr,
{
const struct tt_common_entry *tt_common_entry = entry_ptr;
- if (tt_common_entry->flags & TT_CLIENT_NEW)
+ if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW)
return 0;
return 1;
}
@@ -1343,7 +1348,7 @@ static int batadv_tt_global_valid(const void *entry_ptr,
const struct tt_global_entry *tt_global_entry;
const struct orig_node *orig_node = data_ptr;
- if (tt_common_entry->flags & TT_CLIENT_ROAM)
+ if (tt_common_entry->flags & BATADV_TT_CLIENT_ROAM)
return 0;
tt_global_entry = container_of(tt_common_entry, struct tt_global_entry,
@@ -1450,17 +1455,17 @@ static int batadv_send_tt_request(struct bat_priv *bat_priv,
tt_request = (struct tt_query_packet *)skb_put(skb,
sizeof(struct tt_query_packet));
- tt_request->header.packet_type = BAT_TT_QUERY;
+ tt_request->header.packet_type = BATADV_TT_QUERY;
tt_request->header.version = BATADV_COMPAT_VERSION;
memcpy(tt_request->src, primary_if->net_dev->dev_addr, ETH_ALEN);
memcpy(tt_request->dst, dst_orig_node->orig, ETH_ALEN);
tt_request->header.ttl = BATADV_TTL;
tt_request->ttvn = ttvn;
tt_request->tt_data = htons(tt_crc);
- tt_request->flags = TT_REQUEST;
+ tt_request->flags = BATADV_TT_REQUEST;
if (full_table)
- tt_request->flags |= TT_FULL_TABLE;
+ tt_request->flags |= BATADV_TT_FULL_TABLE;
neigh_node = batadv_orig_node_get_router(dst_orig_node);
if (!neigh_node)
@@ -1509,7 +1514,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
batadv_dbg(DBG_TT, bat_priv,
"Received TT_REQUEST from %pM for ttvn: %u (%pM) [%c]\n",
tt_request->src, tt_request->ttvn, tt_request->dst,
- (tt_request->flags & TT_FULL_TABLE ? 'F' : '.'));
+ (tt_request->flags & BATADV_TT_FULL_TABLE ? 'F' : '.'));
/* Let's get the orig node of the REAL destination */
req_dst_orig_node = batadv_orig_hash_find(bat_priv, tt_request->dst);
@@ -1537,7 +1542,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
goto out;
/* If the full table has been explicitly requested */
- if (tt_request->flags & TT_FULL_TABLE ||
+ if (tt_request->flags & BATADV_TT_FULL_TABLE ||
!req_dst_orig_node->tt_buff)
full_table = true;
else
@@ -1584,15 +1589,15 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
tt_response = (struct tt_query_packet *)skb->data;
}
- tt_response->header.packet_type = BAT_TT_QUERY;
+ tt_response->header.packet_type = BATADV_TT_QUERY;
tt_response->header.version = BATADV_COMPAT_VERSION;
tt_response->header.ttl = BATADV_TTL;
memcpy(tt_response->src, req_dst_orig_node->orig, ETH_ALEN);
memcpy(tt_response->dst, tt_request->src, ETH_ALEN);
- tt_response->flags = TT_RESPONSE;
+ tt_response->flags = BATADV_TT_RESPONSE;
if (full_table)
- tt_response->flags |= TT_FULL_TABLE;
+ tt_response->flags |= BATADV_TT_FULL_TABLE;
batadv_dbg(DBG_TT, bat_priv,
"Sending TT_RESPONSE %pM via %pM for %pM (ttvn: %u)\n",
@@ -1639,7 +1644,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
batadv_dbg(DBG_TT, bat_priv,
"Received TT_REQUEST from %pM for ttvn: %u (me) [%c]\n",
tt_request->src, tt_request->ttvn,
- (tt_request->flags & TT_FULL_TABLE ? 'F' : '.'));
+ (tt_request->flags & BATADV_TT_FULL_TABLE ? 'F' : '.'));
my_ttvn = (uint8_t)atomic_read(&bat_priv->ttvn);
@@ -1660,7 +1665,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
/* If the full table has been explicitly requested or the gap
* is too big send the whole local translation table
*/
- if (tt_request->flags & TT_FULL_TABLE || my_ttvn != req_ttvn ||
+ if (tt_request->flags & BATADV_TT_FULL_TABLE || my_ttvn != req_ttvn ||
!bat_priv->tt_buff)
full_table = true;
else
@@ -1705,20 +1710,20 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
tt_response = (struct tt_query_packet *)skb->data;
}
- tt_response->header.packet_type = BAT_TT_QUERY;
+ tt_response->header.packet_type = BATADV_TT_QUERY;
tt_response->header.version = BATADV_COMPAT_VERSION;
tt_response->header.ttl = BATADV_TTL;
memcpy(tt_response->src, primary_if->net_dev->dev_addr, ETH_ALEN);
memcpy(tt_response->dst, tt_request->src, ETH_ALEN);
- tt_response->flags = TT_RESPONSE;
+ tt_response->flags = BATADV_TT_RESPONSE;
if (full_table)
- tt_response->flags |= TT_FULL_TABLE;
+ tt_response->flags |= BATADV_TT_FULL_TABLE;
batadv_dbg(DBG_TT, bat_priv,
"Sending TT_RESPONSE to %pM via %pM [%c]\n",
orig_node->orig, neigh_node->addr,
- (tt_response->flags & TT_FULL_TABLE ? 'F' : '.'));
+ (tt_response->flags & BATADV_TT_FULL_TABLE ? 'F' : '.'));
batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX);
@@ -1764,8 +1769,8 @@ static void _batadv_tt_update_changes(struct bat_priv *bat_priv,
int roams;
for (i = 0; i < tt_num_changes; i++) {
- if ((tt_change + i)->flags & TT_CLIENT_DEL) {
- roams = (tt_change + i)->flags & TT_CLIENT_ROAM;
+ if ((tt_change + i)->flags & BATADV_TT_CLIENT_DEL) {
+ roams = (tt_change + i)->flags & BATADV_TT_CLIENT_ROAM;
batadv_tt_global_del(bat_priv, orig_node,
(tt_change + i)->addr,
"tt removed by changes",
@@ -1840,7 +1845,7 @@ bool batadv_is_my_client(struct bat_priv *bat_priv, const uint8_t *addr)
/* Check if the client has been logically deleted (but is kept for
* consistency purpose)
*/
- if (tt_local_entry->common.flags & TT_CLIENT_PENDING)
+ if (tt_local_entry->common.flags & BATADV_TT_CLIENT_PENDING)
goto out;
ret = true;
out:
@@ -1859,7 +1864,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv,
"Received TT_RESPONSE from %pM for ttvn %d t_size: %d [%c]\n",
tt_response->src, tt_response->ttvn,
ntohs(tt_response->tt_data),
- (tt_response->flags & TT_FULL_TABLE ? 'F' : '.'));
+ (tt_response->flags & BATADV_TT_FULL_TABLE ? 'F' : '.'));
/* we should have never asked a backbone gw */
if (batadv_bla_is_backbone_gw_orig(bat_priv, tt_response->src))
@@ -1869,7 +1874,7 @@ void batadv_handle_tt_response(struct bat_priv *bat_priv,
if (!orig_node)
goto out;
- if (tt_response->flags & TT_FULL_TABLE)
+ if (tt_response->flags & BATADV_TT_FULL_TABLE)
batadv_tt_fill_gtable(bat_priv, tt_response);
else
batadv_tt_update_changes(bat_priv, orig_node,
@@ -2019,7 +2024,7 @@ static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
roam_adv_packet = (struct roam_adv_packet *)skb_put(skb,
sizeof(struct roam_adv_packet));
- roam_adv_packet->header.packet_type = BAT_ROAM_ADV;
+ roam_adv_packet->header.packet_type = BATADV_ROAM_ADV;
roam_adv_packet->header.version = BATADV_COMPAT_VERSION;
roam_adv_packet->header.ttl = BATADV_TTL;
primary_if = batadv_primary_if_get_selected(bat_priv);
@@ -2117,11 +2122,11 @@ out:
return changed_num;
}
-/* Purge out all the tt local entries marked with TT_CLIENT_PENDING */
+/* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */
static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv)
{
struct hashtable_t *hash = bat_priv->tt_local_hash;
- struct tt_common_entry *tt_common_entry;
+ struct tt_common_entry *tt_common;
struct tt_local_entry *tt_local_entry;
struct hlist_node *node, *node_tmp;
struct hlist_head *head;
@@ -2136,18 +2141,18 @@ static void batadv_tt_local_purge_pending_clients(struct bat_priv *bat_priv)
list_lock = &hash->list_locks[i];
spin_lock_bh(list_lock);
- hlist_for_each_entry_safe(tt_common_entry, node, node_tmp,
- head, hash_entry) {
- if (!(tt_common_entry->flags & TT_CLIENT_PENDING))
+ hlist_for_each_entry_safe(tt_common, node, node_tmp, head,
+ hash_entry) {
+ if (!(tt_common->flags & BATADV_TT_CLIENT_PENDING))
continue;
batadv_dbg(DBG_TT, bat_priv,
"Deleting local tt entry (%pM): pending\n",
- tt_common_entry->addr);
+ tt_common->addr);
atomic_dec(&bat_priv->num_local_tt);
hlist_del_rcu(node);
- tt_local_entry = container_of(tt_common_entry,
+ tt_local_entry = container_of(tt_common,
struct tt_local_entry,
common);
batadv_tt_local_entry_free_ref(tt_local_entry);
@@ -2167,7 +2172,7 @@ static int batadv_tt_commit_changes(struct bat_priv *bat_priv,
return -ENOENT;
changed_num = batadv_tt_set_flags(bat_priv->tt_local_hash,
- TT_CLIENT_NEW, false);
+ BATADV_TT_CLIENT_NEW, false);
/* all reset entries have to be counted as local entries */
atomic_add(changed_num, &bat_priv->num_local_tt);
@@ -2326,7 +2331,7 @@ bool batadv_tt_global_client_is_roaming(struct bat_priv *bat_priv,
if (!tt_global_entry)
goto out;
- ret = tt_global_entry->common.flags & TT_CLIENT_ROAM;
+ ret = tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM;
batadv_tt_global_entry_free_ref(tt_global_entry);
out:
return ret;
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index 8454d91..c460355 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -42,7 +42,7 @@ batadv_frag_merge_packet(struct list_head *head,
int uni_diff = sizeof(*up) - hdr_len;
/* set skb to the first part and tmp_skb to the second part */
- if (up->flags & UNI_FRAG_HEAD) {
+ if (up->flags & BATADV_UNI_FRAG_HEAD) {
tmp_skb = tfp->skb;
} else {
tmp_skb = skb;
@@ -66,7 +66,7 @@ batadv_frag_merge_packet(struct list_head *head,
memmove(skb->data + uni_diff, skb->data, hdr_len);
unicast_packet = (struct unicast_packet *)skb_pull(skb, uni_diff);
- unicast_packet->header.packet_type = BAT_UNICAST;
+ unicast_packet->header.packet_type = BATADV_UNICAST;
return skb;
@@ -121,7 +121,7 @@ batadv_frag_search_packet(struct list_head *head,
struct unicast_frag_packet *tmp_up = NULL;
uint16_t search_seqno;
- if (up->flags & UNI_FRAG_HEAD)
+ if (up->flags & BATADV_UNI_FRAG_HEAD)
search_seqno = ntohs(up->seqno)+1;
else
search_seqno = ntohs(up->seqno)-1;
@@ -138,8 +138,8 @@ batadv_frag_search_packet(struct list_head *head,
if (tfp->seqno == search_seqno) {
- if ((tmp_up->flags & UNI_FRAG_HEAD) !=
- (up->flags & UNI_FRAG_HEAD))
+ if ((tmp_up->flags & BATADV_UNI_FRAG_HEAD) !=
+ (up->flags & BATADV_UNI_FRAG_HEAD))
return tfp;
else
goto mov_tail;
@@ -254,15 +254,15 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
frag1->header.ttl--;
frag1->header.version = BATADV_COMPAT_VERSION;
- frag1->header.packet_type = BAT_UNICAST_FRAG;
+ frag1->header.packet_type = BATADV_UNICAST_FRAG;
memcpy(frag1->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
memcpy(frag2, frag1, sizeof(*frag2));
if (data_len & 1)
- large_tail = UNI_FRAG_LARGETAIL;
+ large_tail = BATADV_UNI_FRAG_LARGETAIL;
- frag1->flags = UNI_FRAG_HEAD | large_tail;
+ frag1->flags = BATADV_UNI_FRAG_HEAD | large_tail;
frag2->flags = large_tail;
seqno = atomic_add_return(2, &hard_iface->frag_seqno);
@@ -321,7 +321,7 @@ find_router:
unicast_packet->header.version = BATADV_COMPAT_VERSION;
/* batman packet type: unicast */
- unicast_packet->header.packet_type = BAT_UNICAST;
+ unicast_packet->header.packet_type = BATADV_UNICAST;
/* set unicast ttl */
unicast_packet->header.ttl = BATADV_TTL;
/* copy the destination for faster routing */
diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h
index 936287f..510e23f 100644
--- a/net/batman-adv/unicast.h
+++ b/net/batman-adv/unicast.h
@@ -41,8 +41,8 @@ static inline int batadv_frag_can_reassemble(const struct sk_buff *skb, int mtu)
unicast_packet = (struct unicast_frag_packet *)skb->data;
- if (unicast_packet->flags & UNI_FRAG_LARGETAIL) {
- if (unicast_packet->flags & UNI_FRAG_HEAD)
+ if (unicast_packet->flags & BATADV_UNI_FRAG_LARGETAIL) {
+ if (unicast_packet->flags & BATADV_UNI_FRAG_HEAD)
uneven_correction = 1;
else
uneven_correction = -1;
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index c920b4b..f5692ee 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -256,7 +256,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
if (!primary_if)
goto out;
- if (vis_server == VIS_TYPE_CLIENT_UPDATE)
+ if (vis_server == BATADV_VIS_TYPE_CLIENT_UPDATE)
goto out;
spin_lock_bh(&bat_priv->vis_hash_lock);
@@ -437,7 +437,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
int is_new, make_broadcast;
int vis_server = atomic_read(&bat_priv->vis_mode);
- make_broadcast = (vis_server == VIS_TYPE_SERVER_SYNC);
+ make_broadcast = (vis_server == BATADV_VIS_TYPE_SERVER_SYNC);
spin_lock_bh(&bat_priv->vis_hash_lock);
info = batadv_add_packet(bat_priv, vis_packet, vis_info_len,
@@ -448,7 +448,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
/* only if we are server ourselves and packet is newer than the one in
* hash.
*/
- if (vis_server == VIS_TYPE_SERVER_SYNC && is_new)
+ if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC && is_new)
batadv_send_list_add(bat_priv, info);
end:
spin_unlock_bh(&bat_priv->vis_hash_lock);
@@ -470,7 +470,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
return;
/* Are we the target for this VIS packet? */
- if (vis_server == VIS_TYPE_SERVER_SYNC &&
+ if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC &&
batadv_is_my_mac(vis_packet->target_orig))
are_target = 1;
@@ -486,7 +486,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
/* send only if we're the target server or ... */
if (are_target && is_new) {
- packet->vis_type = VIS_TYPE_SERVER_SYNC; /* upgrade! */
+ packet->vis_type = BATADV_VIS_TYPE_SERVER_SYNC; /* upgrade! */
batadv_send_list_add(bat_priv, info);
/* ... we're not the recipient (and thus need to forward). */
@@ -526,7 +526,7 @@ static int batadv_find_best_vis_server(struct bat_priv *bat_priv,
if (!router)
continue;
- if ((orig_node->flags & VIS_SERVER) &&
+ if ((orig_node->flags & BATADV_VIS_SERVER) &&
(router->tq_avg > best_tq)) {
best_tq = router->tq_avg;
memcpy(packet->target_orig, orig_node->orig,
@@ -580,7 +580,7 @@ static int batadv_generate_vis_packet(struct bat_priv *bat_priv)
packet->entries = 0;
skb_trim(info->skb_packet, sizeof(*packet));
- if (packet->vis_type == VIS_TYPE_CLIENT_UPDATE) {
+ if (packet->vis_type == BATADV_VIS_TYPE_CLIENT_UPDATE) {
best_tq = batadv_find_best_vis_server(bat_priv, info);
if (best_tq < 0)
@@ -707,7 +707,7 @@ static void batadv_broadcast_vis_packet(struct bat_priv *bat_priv,
rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
/* if it's a vis server and reachable, send it. */
- if (!(orig_node->flags & VIS_SERVER))
+ if (!(orig_node->flags & BATADV_VIS_SERVER))
continue;
router = batadv_orig_node_get_router(orig_node);
@@ -875,7 +875,7 @@ int batadv_vis_init(struct bat_priv *bat_priv)
kref_init(&bat_priv->my_vis_info->refcount);
bat_priv->my_vis_info->bat_priv = bat_priv;
packet->header.version = BATADV_COMPAT_VERSION;
- packet->header.packet_type = BAT_VIS;
+ packet->header.packet_type = BATADV_VIS;
packet->header.ttl = BATADV_TTL;
packet->seqno = 0;
packet->entries = 0;
--
1.7.9.4
^ permalink raw reply related
* [PATCH 03/16] batman-adv: Prefix types enum with BATADV_
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n, Sven Eckelmann, Antonio Quartulli
In-Reply-To: <1341186226-10549-1-git-send-email-ordex@autistici.org>
From: Sven Eckelmann <sven@narfation.org>
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bat_iv_ogm.c | 8 ++++----
net/batman-adv/routing.c | 10 +++++-----
net/batman-adv/soft-interface.c | 8 ++++----
net/batman-adv/translation-table.c | 8 ++++----
net/batman-adv/types.h | 28 ++++++++++++++--------------
5 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index a59e317..6099719 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -209,8 +209,8 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
/* create clone because function is called more than once */
skb = skb_clone(forw_packet->skb, GFP_ATOMIC);
if (skb) {
- batadv_inc_counter(bat_priv, BAT_CNT_MGMT_TX);
- batadv_add_counter(bat_priv, BAT_CNT_MGMT_TX_BYTES,
+ batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_TX);
+ batadv_add_counter(bat_priv, BATADV_CNT_MGMT_TX_BYTES,
skb->len + ETH_HLEN);
batadv_send_skb_packet(skb, hard_iface, batadv_broadcast_addr);
}
@@ -1256,8 +1256,8 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
if (bat_priv->bat_algo_ops->bat_ogm_emit != batadv_iv_ogm_emit)
return NET_RX_DROP;
- batadv_inc_counter(bat_priv, BAT_CNT_MGMT_RX);
- batadv_add_counter(bat_priv, BAT_CNT_MGMT_RX_BYTES,
+ batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX);
+ batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES,
skb->len + ETH_HLEN);
packet_len = skb_headlen(skb);
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 4d63221..aa8325e 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -607,7 +607,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
switch (tt_query->flags & BATADV_TT_QUERY_TYPE_MASK) {
case TT_REQUEST:
- batadv_inc_counter(bat_priv, BAT_CNT_TT_REQUEST_RX);
+ batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX);
/* If we cannot provide an answer the tt_request is
* forwarded
@@ -622,7 +622,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
}
break;
case TT_RESPONSE:
- batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_RX);
+ batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX);
if (batadv_is_my_mac(tt_query->dst)) {
/* packet needs to be linearized to access the TT
@@ -678,7 +678,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
if (is_broadcast_ether_addr(ethhdr->h_source))
goto out;
- batadv_inc_counter(bat_priv, BAT_CNT_TT_ROAM_ADV_RX);
+ batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
roam_adv_packet = (struct roam_adv_packet *)skb->data;
@@ -900,8 +900,8 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
unicast_packet->header.ttl--;
/* Update stats counter */
- batadv_inc_counter(bat_priv, BAT_CNT_FORWARD);
- batadv_add_counter(bat_priv, BAT_CNT_FORWARD_BYTES,
+ batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD);
+ batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES,
skb->len + ETH_HLEN);
/* route it */
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index b77e598..19a80d2 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -366,6 +366,7 @@ struct net_device *batadv_softif_create(const char *name)
struct net_device *soft_iface;
struct bat_priv *bat_priv;
int ret;
+ size_t cnt_len = sizeof(uint64_t) * BATADV_CNT_NUM;
soft_iface = alloc_netdev(sizeof(*bat_priv), name,
batadv_interface_setup);
@@ -411,8 +412,7 @@ struct net_device *batadv_softif_create(const char *name)
bat_priv->primary_if = NULL;
bat_priv->num_ifaces = 0;
- bat_priv->bat_counters = __alloc_percpu(sizeof(uint64_t) * BAT_CNT_NUM,
- __alignof__(uint64_t));
+ bat_priv->bat_counters = __alloc_percpu(cnt_len, __alignof__(uint64_t));
if (!bat_priv->bat_counters)
goto unreg_soft_iface;
@@ -542,14 +542,14 @@ static void batadv_get_ethtool_stats(struct net_device *dev,
struct bat_priv *bat_priv = netdev_priv(dev);
int i;
- for (i = 0; i < BAT_CNT_NUM; i++)
+ for (i = 0; i < BATADV_CNT_NUM; i++)
data[i] = batadv_sum_counter(bat_priv, i);
}
static int batadv_get_sset_count(struct net_device *dev, int stringset)
{
if (stringset == ETH_SS_STATS)
- return BAT_CNT_NUM;
+ return BATADV_CNT_NUM;
return -EOPNOTSUPP;
}
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 156c309..f36d1d5 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1471,7 +1471,7 @@ static int batadv_send_tt_request(struct bat_priv *bat_priv,
dst_orig_node->orig, neigh_node->addr,
(full_table ? 'F' : '.'));
- batadv_inc_counter(bat_priv, BAT_CNT_TT_REQUEST_TX);
+ batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX);
batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
ret = 0;
@@ -1599,7 +1599,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
res_dst_orig_node->orig, neigh_node->addr,
req_dst_orig_node->orig, req_ttvn);
- batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_TX);
+ batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX);
batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
ret = true;
@@ -1720,7 +1720,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
orig_node->orig, neigh_node->addr,
(tt_response->flags & TT_FULL_TABLE ? 'F' : '.'));
- batadv_inc_counter(bat_priv, BAT_CNT_TT_RESPONSE_TX);
+ batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX);
batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
ret = true;
@@ -2038,7 +2038,7 @@ static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
"Sending ROAMING_ADV to %pM (client %pM) via %pM\n",
orig_node->orig, client, neigh_node->addr);
- batadv_inc_counter(bat_priv, BAT_CNT_TT_ROAM_ADV_TX);
+ batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX);
batadv_send_skb_packet(skb, neigh_node->if_incoming, neigh_node->addr);
ret = 0;
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index fd538ea..fcbac82 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -143,20 +143,20 @@ struct bcast_duplist_entry {
};
#endif
-enum bat_counters {
- BAT_CNT_FORWARD,
- BAT_CNT_FORWARD_BYTES,
- BAT_CNT_MGMT_TX,
- BAT_CNT_MGMT_TX_BYTES,
- BAT_CNT_MGMT_RX,
- BAT_CNT_MGMT_RX_BYTES,
- BAT_CNT_TT_REQUEST_TX,
- BAT_CNT_TT_REQUEST_RX,
- BAT_CNT_TT_RESPONSE_TX,
- BAT_CNT_TT_RESPONSE_RX,
- BAT_CNT_TT_ROAM_ADV_TX,
- BAT_CNT_TT_ROAM_ADV_RX,
- BAT_CNT_NUM,
+enum batadv_counters {
+ BATADV_CNT_FORWARD,
+ BATADV_CNT_FORWARD_BYTES,
+ BATADV_CNT_MGMT_TX,
+ BATADV_CNT_MGMT_TX_BYTES,
+ BATADV_CNT_MGMT_RX,
+ BATADV_CNT_MGMT_RX_BYTES,
+ BATADV_CNT_TT_REQUEST_TX,
+ BATADV_CNT_TT_REQUEST_RX,
+ BATADV_CNT_TT_RESPONSE_TX,
+ BATADV_CNT_TT_RESPONSE_RX,
+ BATADV_CNT_TT_ROAM_ADV_TX,
+ BATADV_CNT_TT_ROAM_ADV_RX,
+ BATADV_CNT_NUM,
};
struct bat_priv {
--
1.7.9.4
^ permalink raw reply related
* pull request: batman-adv 2012-07-01
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem; +Cc: netdev, b.a.t.m.a.n
Hello David,
this should be our last planned pull request intended for net-next/linux-3.6 :-)
In this batch you have patch 15/16 that fixes a variable declaration
in the ethtool support code; patch 16/16 that fixes a non-critical bug which
makes nodes send unicast packets with an uninitialised header field.
The rest is the last part of our namespace renaming operation plus a couple of
style fixes.
Please let me know if there are problems!
Thank you very much,
Antonio
The following changes since commit a59a4d1921664da63d801ba477950114c71c88c9:
phy: add the EEE support and the way to access to the MMD registers. (2012-07-01 03:34:50 -0700)
are available in the git repository at:
git://git.open-mesh.org/linux-merge.git tags/batman-adv-for-davem
for you to fetch changes up to 162d549c6905485262635fe594db337efb2828b5:
batman-adv: Don't leak information through uninitialized packet fields (2012-07-01 22:47:24 +0200)
----------------------------------------------------------------
Included changes:
- The last batch of patches aimed to clean the batman-adv namespace
- a couple of style fixes
- a fix for the ethtool support
- a fix to prevent sending unicast packets with an uninitialised header
field
----------------------------------------------------------------
Marek Lindner (1):
batman-adv: fix counter summary length
Sven Eckelmann (15):
batman-adv: Prefix gateway enum with BATADV_
batman-adv: Prefix hard-interface enum with BATADV_
batman-adv: Prefix types enum with BATADV_
batman-adv: Prefix packet enum with BATADV_
batman-adv: Prefix main enum with BATADV_
batman-adv: Prefix local debugfs structs with batadv_
batman-adv: Prefix hash struct and typedef with batadv_
batman-adv: Prefix local sysfs struct with batadv_
batman-adv: Prefix packet structs with batadv_
batman-adv: Prefix types structs with batadv_
batman-adv: Transform BATADV_LOG_BUFF(idx) into function
batman-adv: Remove bat_ prefix from bat_{debugfs, sysfs}.{c, h}
batman-adv: Remove space before semicolon
batman-adv: Fix alignment after opened parentheses
batman-adv: Don't leak information through uninitialized packet fields
net/batman-adv/Makefile | 4 +-
net/batman-adv/bat_iv_ogm.c | 459 +++++++--------
net/batman-adv/bitarray.c | 6 +-
net/batman-adv/bridge_loop_avoidance.c | 302 +++++-----
net/batman-adv/bridge_loop_avoidance.h | 48 +-
net/batman-adv/{bat_debugfs.c => debugfs.c} | 76 ++-
net/batman-adv/{bat_debugfs.h => debugfs.h} | 0
net/batman-adv/gateway_client.c | 127 +++--
net/batman-adv/gateway_client.h | 24 +-
net/batman-adv/gateway_common.c | 2 +-
net/batman-adv/gateway_common.h | 8 +-
net/batman-adv/hard-interface.c | 125 +++--
net/batman-adv/hard-interface.h | 28 +-
net/batman-adv/hash.c | 12 +-
net/batman-adv/hash.h | 33 +-
net/batman-adv/icmp_socket.c | 81 +--
net/batman-adv/icmp_socket.h | 4 +-
net/batman-adv/main.c | 82 +--
net/batman-adv/main.h | 63 ++-
net/batman-adv/originator.c | 151 ++---
net/batman-adv/originator.h | 37 +-
net/batman-adv/packet.h | 132 ++---
net/batman-adv/routing.c | 300 +++++-----
net/batman-adv/routing.h | 52 +-
net/batman-adv/send.c | 75 +--
net/batman-adv/send.h | 12 +-
net/batman-adv/soft-interface.c | 55 +-
net/batman-adv/soft-interface.h | 2 +-
net/batman-adv/{bat_sysfs.c => sysfs.c} | 134 +++--
net/batman-adv/{bat_sysfs.h => sysfs.h} | 6 +-
net/batman-adv/translation-table.c | 808 ++++++++++++++-------------
net/batman-adv/translation-table.h | 43 +-
net/batman-adv/types.h | 154 ++---
net/batman-adv/unicast.c | 95 ++--
net/batman-adv/unicast.h | 19 +-
net/batman-adv/vis.c | 284 +++++-----
net/batman-adv/vis.h | 12 +-
37 files changed, 2011 insertions(+), 1844 deletions(-)
rename net/batman-adv/{bat_debugfs.c => debugfs.c} (81%)
rename net/batman-adv/{bat_debugfs.h => debugfs.h} (100%)
rename net/batman-adv/{bat_sysfs.c => sysfs.c} (85%)
rename net/batman-adv/{bat_sysfs.h => sysfs.h} (89%)
^ permalink raw reply
* [PATCH 02/16] batman-adv: Prefix hard-interface enum with BATADV_
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1341186226-10549-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Reported-by: Martin Hundebøll <martin-SHBFXCSm21MJGwgDXS7ZQA@public.gmane.org>
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
net/batman-adv/bat_iv_ogm.c | 6 ++---
net/batman-adv/bat_sysfs.c | 27 ++++++++++++---------
net/batman-adv/bridge_loop_avoidance.c | 2 +-
net/batman-adv/gateway_client.c | 2 +-
net/batman-adv/hard-interface.c | 40 ++++++++++++++++----------------
net/batman-adv/hard-interface.h | 14 +++++------
net/batman-adv/icmp_socket.c | 2 +-
net/batman-adv/main.c | 4 ++--
net/batman-adv/originator.c | 16 ++++++-------
net/batman-adv/routing.c | 2 +-
net/batman-adv/send.c | 10 ++++----
net/batman-adv/translation-table.c | 4 ++--
net/batman-adv/vis.c | 2 +-
13 files changed, 68 insertions(+), 63 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index d3fc581..a59e317 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -165,7 +165,7 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
struct batman_ogm_packet *batman_ogm_packet;
struct sk_buff *skb;
- if (hard_iface->if_status != IF_ACTIVE)
+ if (hard_iface->if_status != BATADV_IF_ACTIVE)
return;
packet_num = 0;
@@ -238,7 +238,7 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet)
soft_iface = forw_packet->if_incoming->soft_iface;
bat_priv = netdev_priv(soft_iface);
- if (forw_packet->if_incoming->if_status != IF_ACTIVE)
+ if (forw_packet->if_incoming->if_status != BATADV_IF_ACTIVE)
goto out;
primary_if = batadv_primary_if_get_selected(bat_priv);
@@ -1017,7 +1017,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
- if (hard_iface->if_status != IF_ACTIVE)
+ if (hard_iface->if_status != BATADV_IF_ACTIVE)
continue;
if (hard_iface->soft_iface != if_incoming->soft_iface)
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 561ec31..680caca 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -559,12 +559,17 @@ static ssize_t batadv_show_mesh_iface(struct kobject *kobj,
struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
struct hard_iface *hard_iface = batadv_hardif_get_by_netdev(net_dev);
ssize_t length;
+ const char *ifname;
if (!hard_iface)
return 0;
- length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ?
- "none" : hard_iface->soft_iface->name);
+ if (hard_iface->if_status == BATADV_IF_NOT_IN_USE)
+ ifname = "none";
+ else
+ ifname = hard_iface->soft_iface->name;
+
+ length = sprintf(buff, "%s\n", ifname);
batadv_hardif_free_ref(hard_iface);
@@ -594,9 +599,9 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj,
}
if (strncmp(buff, "none", 4) == 0)
- status_tmp = IF_NOT_IN_USE;
+ status_tmp = BATADV_IF_NOT_IN_USE;
else
- status_tmp = IF_I_WANT_YOU;
+ status_tmp = BATADV_IF_I_WANT_YOU;
if (hard_iface->if_status == status_tmp)
goto out;
@@ -610,13 +615,13 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj,
goto out;
}
- if (status_tmp == IF_NOT_IN_USE) {
+ if (status_tmp == BATADV_IF_NOT_IN_USE) {
batadv_hardif_disable_interface(hard_iface);
goto unlock;
}
/* if the interface already is in use */
- if (hard_iface->if_status != IF_NOT_IN_USE)
+ if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
batadv_hardif_disable_interface(hard_iface);
ret = batadv_hardif_enable_interface(hard_iface, buff);
@@ -639,19 +644,19 @@ static ssize_t batadv_show_iface_status(struct kobject *kobj,
return 0;
switch (hard_iface->if_status) {
- case IF_TO_BE_REMOVED:
+ case BATADV_IF_TO_BE_REMOVED:
length = sprintf(buff, "disabling\n");
break;
- case IF_INACTIVE:
+ case BATADV_IF_INACTIVE:
length = sprintf(buff, "inactive\n");
break;
- case IF_ACTIVE:
+ case BATADV_IF_ACTIVE:
length = sprintf(buff, "active\n");
break;
- case IF_TO_BE_ACTIVATED:
+ case BATADV_IF_TO_BE_ACTIVATED:
length = sprintf(buff, "enabling\n");
break;
- case IF_NOT_IN_USE:
+ case BATADV_IF_NOT_IN_USE:
default:
length = sprintf(buff, "not in use\n");
break;
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index db20b68..13afc65 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1552,7 +1552,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
goto out;
}
- if (primary_if->if_status != IF_ACTIVE) {
+ if (primary_if->if_status != BATADV_IF_ACTIVE) {
ret = seq_printf(seq,
"BATMAN mesh %s disabled - primary interface not active\n",
net_dev->name);
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 2fcf26f..3b50c31 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -475,7 +475,7 @@ int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset)
goto out;
}
- if (primary_if->if_status != IF_ACTIVE) {
+ if (primary_if->if_status != BATADV_IF_ACTIVE) {
ret = seq_printf(seq,
"BATMAN mesh %s disabled - primary interface not active\n",
net_dev->name);
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index e7eba9c..e109d65 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -85,7 +85,7 @@ batadv_hardif_get_active(const struct net_device *soft_iface)
if (hard_iface->soft_iface != soft_iface)
continue;
- if (hard_iface->if_status == IF_ACTIVE &&
+ if (hard_iface->if_status == BATADV_IF_ACTIVE &&
atomic_inc_not_zero(&hard_iface->refcount))
goto out;
}
@@ -157,8 +157,8 @@ static void batadv_check_known_mac_addr(const struct net_device *net_dev)
rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
- if ((hard_iface->if_status != IF_ACTIVE) &&
- (hard_iface->if_status != IF_TO_BE_ACTIVATED))
+ if ((hard_iface->if_status != BATADV_IF_ACTIVE) &&
+ (hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED))
continue;
if (hard_iface->net_dev == net_dev)
@@ -189,8 +189,8 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
- if ((hard_iface->if_status != IF_ACTIVE) &&
- (hard_iface->if_status != IF_TO_BE_ACTIVATED))
+ if ((hard_iface->if_status != BATADV_IF_ACTIVE) &&
+ (hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED))
continue;
if (hard_iface->soft_iface != soft_iface)
@@ -220,13 +220,13 @@ static void batadv_hardif_activate_interface(struct hard_iface *hard_iface)
struct bat_priv *bat_priv;
struct hard_iface *primary_if = NULL;
- if (hard_iface->if_status != IF_INACTIVE)
+ if (hard_iface->if_status != BATADV_IF_INACTIVE)
goto out;
bat_priv = netdev_priv(hard_iface->soft_iface);
bat_priv->bat_algo_ops->bat_iface_update_mac(hard_iface);
- hard_iface->if_status = IF_TO_BE_ACTIVATED;
+ hard_iface->if_status = BATADV_IF_TO_BE_ACTIVATED;
/* the first active interface becomes our primary interface or
* the next active interface after the old primary interface was removed
@@ -247,11 +247,11 @@ out:
static void batadv_hardif_deactivate_interface(struct hard_iface *hard_iface)
{
- if ((hard_iface->if_status != IF_ACTIVE) &&
- (hard_iface->if_status != IF_TO_BE_ACTIVATED))
+ if ((hard_iface->if_status != BATADV_IF_ACTIVE) &&
+ (hard_iface->if_status != BATADV_IF_TO_BE_ACTIVATED))
return;
- hard_iface->if_status = IF_INACTIVE;
+ hard_iface->if_status = BATADV_IF_INACTIVE;
batadv_info(hard_iface->soft_iface, "Interface deactivated: %s\n",
hard_iface->net_dev->name);
@@ -267,7 +267,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
__be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
int ret;
- if (hard_iface->if_status != IF_NOT_IN_USE)
+ if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
goto out;
if (!atomic_inc_not_zero(&hard_iface->refcount))
@@ -308,7 +308,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
hard_iface->if_num = bat_priv->num_ifaces;
bat_priv->num_ifaces++;
- hard_iface->if_status = IF_INACTIVE;
+ hard_iface->if_status = BATADV_IF_INACTIVE;
batadv_orig_hash_add_if(hard_iface, bat_priv->num_ifaces);
hard_iface->batman_adv_ptype.type = ethertype;
@@ -359,10 +359,10 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
struct hard_iface *primary_if = NULL;
- if (hard_iface->if_status == IF_ACTIVE)
+ if (hard_iface->if_status == BATADV_IF_ACTIVE)
batadv_hardif_deactivate_interface(hard_iface);
- if (hard_iface->if_status != IF_INACTIVE)
+ if (hard_iface->if_status != BATADV_IF_INACTIVE)
goto out;
batadv_info(hard_iface->soft_iface, "Removing interface: %s\n",
@@ -384,7 +384,7 @@ void batadv_hardif_disable_interface(struct hard_iface *hard_iface)
}
bat_priv->bat_algo_ops->bat_iface_disable(hard_iface);
- hard_iface->if_status = IF_NOT_IN_USE;
+ hard_iface->if_status = BATADV_IF_NOT_IN_USE;
/* delete all references to this hard_iface */
batadv_purge_orig_ref(bat_priv);
@@ -428,7 +428,7 @@ batadv_hardif_add_interface(struct net_device *net_dev)
hard_iface->if_num = -1;
hard_iface->net_dev = net_dev;
hard_iface->soft_iface = NULL;
- hard_iface->if_status = IF_NOT_IN_USE;
+ hard_iface->if_status = BATADV_IF_NOT_IN_USE;
INIT_LIST_HEAD(&hard_iface->list);
/* extra reference for return */
atomic_set(&hard_iface->refcount, 2);
@@ -457,13 +457,13 @@ static void batadv_hardif_remove_interface(struct hard_iface *hard_iface)
ASSERT_RTNL();
/* first deactivate interface */
- if (hard_iface->if_status != IF_NOT_IN_USE)
+ if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
batadv_hardif_disable_interface(hard_iface);
- if (hard_iface->if_status != IF_NOT_IN_USE)
+ if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
return;
- hard_iface->if_status = IF_TO_BE_REMOVED;
+ hard_iface->if_status = BATADV_IF_TO_BE_REMOVED;
batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
batadv_hardif_free_ref(hard_iface);
}
@@ -513,7 +513,7 @@ static int batadv_hard_if_event(struct notifier_block *this,
batadv_update_min_mtu(hard_iface->soft_iface);
break;
case NETDEV_CHANGEADDR:
- if (hard_iface->if_status == IF_NOT_IN_USE)
+ if (hard_iface->if_status == BATADV_IF_NOT_IN_USE)
goto hardif_put;
batadv_check_known_mac_addr(hard_iface->net_dev);
diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h
index d66dabd..4b60d58 100644
--- a/net/batman-adv/hard-interface.h
+++ b/net/batman-adv/hard-interface.h
@@ -20,13 +20,13 @@
#ifndef _NET_BATMAN_ADV_HARD_INTERFACE_H_
#define _NET_BATMAN_ADV_HARD_INTERFACE_H_
-enum hard_if_state {
- IF_NOT_IN_USE,
- IF_TO_BE_REMOVED,
- IF_INACTIVE,
- IF_ACTIVE,
- IF_TO_BE_ACTIVATED,
- IF_I_WANT_YOU
+enum batadv_hard_if_state {
+ BATADV_IF_NOT_IN_USE,
+ BATADV_IF_TO_BE_REMOVED,
+ BATADV_IF_INACTIVE,
+ BATADV_IF_ACTIVE,
+ BATADV_IF_TO_BE_ACTIVATED,
+ BATADV_IF_I_WANT_YOU,
};
extern struct notifier_block batadv_hard_if_notifier;
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index f2f578b..f5373a2 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -225,7 +225,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
if (!neigh_node->if_incoming)
goto dst_unreach;
- if (neigh_node->if_incoming->if_status != IF_ACTIVE)
+ if (neigh_node->if_incoming->if_status != BATADV_IF_ACTIVE)
goto dst_unreach;
memcpy(icmp_packet->orig,
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index df7335c..23f5c8e 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -179,7 +179,7 @@ int batadv_is_my_mac(const uint8_t *addr)
rcu_read_lock();
list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
- if (hard_iface->if_status != IF_ACTIVE)
+ if (hard_iface->if_status != BATADV_IF_ACTIVE)
continue;
if (batadv_compare_eth(hard_iface->net_dev->dev_addr, addr)) {
@@ -234,7 +234,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
goto err_free;
/* discard frames on not active interfaces */
- if (hard_iface->if_status != IF_ACTIVE)
+ if (hard_iface->if_status != BATADV_IF_ACTIVE)
goto err_free;
batman_ogm_packet = (struct batman_ogm_packet *)skb->data;
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index f04f591..9e60cc0 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -286,13 +286,13 @@ static bool batadv_purge_orig_neighbors(struct bat_priv *bat_priv,
if_incoming = neigh_node->if_incoming;
if ((batadv_has_timed_out(last_seen, BATADV_PURGE_TIMEOUT)) ||
- (if_incoming->if_status == IF_INACTIVE) ||
- (if_incoming->if_status == IF_NOT_IN_USE) ||
- (if_incoming->if_status == IF_TO_BE_REMOVED)) {
+ (if_incoming->if_status == BATADV_IF_INACTIVE) ||
+ (if_incoming->if_status == BATADV_IF_NOT_IN_USE) ||
+ (if_incoming->if_status == BATADV_IF_TO_BE_REMOVED)) {
- if ((if_incoming->if_status == IF_INACTIVE) ||
- (if_incoming->if_status == IF_NOT_IN_USE) ||
- (if_incoming->if_status == IF_TO_BE_REMOVED))
+ if ((if_incoming->if_status == BATADV_IF_INACTIVE) ||
+ (if_incoming->if_status == BATADV_IF_NOT_IN_USE) ||
+ (if_incoming->if_status == BATADV_IF_TO_BE_REMOVED))
batadv_dbg(DBG_BATMAN, bat_priv,
"neighbor purge: originator %pM, neighbor: %pM, iface: %s\n",
orig_node->orig, neigh_node->addr,
@@ -422,7 +422,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
goto out;
}
- if (primary_if->if_status != IF_ACTIVE) {
+ if (primary_if->if_status != BATADV_IF_ACTIVE) {
ret = seq_printf(seq,
"BATMAN mesh %s disabled - primary interface not active\n",
net_dev->name);
@@ -627,7 +627,7 @@ int batadv_orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
/* renumber remaining batman interfaces _inside_ of orig_hash_lock */
rcu_read_lock();
list_for_each_entry_rcu(hard_iface_tmp, &batadv_hardif_list, list) {
- if (hard_iface_tmp->if_status == IF_NOT_IN_USE)
+ if (hard_iface_tmp->if_status == BATADV_IF_NOT_IN_USE)
continue;
if (hard_iface == hard_iface_tmp)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index b3fd61c..4d63221 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -792,7 +792,7 @@ struct neigh_node *batadv_find_router(struct bat_priv *bat_priv,
router = batadv_find_ifalter_router(primary_orig_node, recv_if);
return_router:
- if (router && router->if_incoming->if_status != IF_ACTIVE)
+ if (router && router->if_incoming->if_status != BATADV_IF_ACTIVE)
goto err_unlock;
rcu_read_unlock();
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 72542cb..8de6e25 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -37,7 +37,7 @@ int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface,
{
struct ethhdr *ethhdr;
- if (hard_iface->if_status != IF_ACTIVE)
+ if (hard_iface->if_status != BATADV_IF_ACTIVE)
goto send_skb_err;
if (unlikely(!hard_iface->net_dev))
@@ -80,8 +80,8 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface)
{
struct bat_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
- if ((hard_iface->if_status == IF_NOT_IN_USE) ||
- (hard_iface->if_status == IF_TO_BE_REMOVED))
+ if ((hard_iface->if_status == BATADV_IF_NOT_IN_USE) ||
+ (hard_iface->if_status == BATADV_IF_TO_BE_REMOVED))
return;
/* the interface gets activated here to avoid race conditions between
@@ -90,8 +90,8 @@ void batadv_schedule_bat_ogm(struct hard_iface *hard_iface)
* outdated packets (especially uninitialized mac addresses) in the
* packet queue
*/
- if (hard_iface->if_status == IF_TO_BE_ACTIVATED)
- hard_iface->if_status = IF_ACTIVE;
+ if (hard_iface->if_status == BATADV_IF_TO_BE_ACTIVATED)
+ hard_iface->if_status = BATADV_IF_ACTIVE;
bat_priv->bat_algo_ops->bat_ogm_schedule(hard_iface);
}
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index a0487e9..156c309 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -433,7 +433,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset)
goto out;
}
- if (primary_if->if_status != IF_ACTIVE) {
+ if (primary_if->if_status != BATADV_IF_ACTIVE) {
ret = seq_printf(seq,
"BATMAN mesh %s disabled - primary interface not active\n",
net_dev->name);
@@ -785,7 +785,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset)
goto out;
}
- if (primary_if->if_status != IF_ACTIVE) {
+ if (primary_if->if_status != BATADV_IF_ACTIVE) {
ret = seq_printf(seq,
"BATMAN mesh %s disabled - primary interface not active\n",
net_dev->name);
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index 7418169..c920b4b 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -599,7 +599,7 @@ static int batadv_generate_vis_packet(struct bat_priv *bat_priv)
if (!batadv_compare_eth(router->addr, orig_node->orig))
goto next;
- if (router->if_incoming->if_status != IF_ACTIVE)
+ if (router->if_incoming->if_status != BATADV_IF_ACTIVE)
goto next;
if (router->tq_avg < 1)
--
1.7.9.4
^ permalink raw reply related
* [PATCH 01/16] batman-adv: Prefix gateway enum with BATADV_
From: Antonio Quartulli @ 2012-07-01 23:43 UTC (permalink / raw)
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r
In-Reply-To: <1341186226-10549-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Reported-by: Martin Hundebøll <martin-SHBFXCSm21MJGwgDXS7ZQA@public.gmane.org>
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
Signed-off-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
---
net/batman-adv/bat_iv_ogm.c | 4 ++--
net/batman-adv/bat_sysfs.c | 14 +++++++-------
net/batman-adv/gateway_client.c | 8 ++++----
net/batman-adv/gateway_common.h | 8 ++++----
net/batman-adv/soft-interface.c | 10 +++++-----
5 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index bbe0f12..d3fc581 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -611,7 +611,7 @@ static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface)
batman_ogm_packet->flags &= ~VIS_SERVER;
if ((hard_iface == primary_if) &&
- (atomic_read(&bat_priv->gw_mode) == GW_MODE_SERVER))
+ (atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER))
batman_ogm_packet->gw_flags =
(uint8_t)atomic_read(&bat_priv->gw_bandwidth);
else
@@ -760,7 +760,7 @@ update_tt:
/* restart gateway selection if fast or late switching was enabled */
if ((orig_node->gw_flags) &&
- (atomic_read(&bat_priv->gw_mode) == GW_MODE_CLIENT) &&
+ (atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_CLIENT) &&
(atomic_read(&bat_priv->gw_sel_class) > 2))
batadv_gw_check_election(bat_priv, orig_node);
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c
index 95d80d1..561ec31 100644
--- a/net/batman-adv/bat_sysfs.c
+++ b/net/batman-adv/bat_sysfs.c
@@ -360,11 +360,11 @@ static ssize_t batadv_show_gw_mode(struct kobject *kobj, struct attribute *attr,
int bytes_written;
switch (atomic_read(&bat_priv->gw_mode)) {
- case GW_MODE_CLIENT:
+ case BATADV_GW_MODE_CLIENT:
bytes_written = sprintf(buff, "%s\n",
BATADV_GW_MODE_CLIENT_NAME);
break;
- case GW_MODE_SERVER:
+ case BATADV_GW_MODE_SERVER:
bytes_written = sprintf(buff, "%s\n",
BATADV_GW_MODE_SERVER_NAME);
break;
@@ -391,15 +391,15 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj,
if (strncmp(buff, BATADV_GW_MODE_OFF_NAME,
strlen(BATADV_GW_MODE_OFF_NAME)) == 0)
- gw_mode_tmp = GW_MODE_OFF;
+ gw_mode_tmp = BATADV_GW_MODE_OFF;
if (strncmp(buff, BATADV_GW_MODE_CLIENT_NAME,
strlen(BATADV_GW_MODE_CLIENT_NAME)) == 0)
- gw_mode_tmp = GW_MODE_CLIENT;
+ gw_mode_tmp = BATADV_GW_MODE_CLIENT;
if (strncmp(buff, BATADV_GW_MODE_SERVER_NAME,
strlen(BATADV_GW_MODE_SERVER_NAME)) == 0)
- gw_mode_tmp = GW_MODE_SERVER;
+ gw_mode_tmp = BATADV_GW_MODE_SERVER;
if (gw_mode_tmp < 0) {
batadv_info(net_dev,
@@ -412,10 +412,10 @@ static ssize_t batadv_store_gw_mode(struct kobject *kobj,
return count;
switch (atomic_read(&bat_priv->gw_mode)) {
- case GW_MODE_CLIENT:
+ case BATADV_GW_MODE_CLIENT:
curr_gw_mode_str = BATADV_GW_MODE_CLIENT_NAME;
break;
- case GW_MODE_SERVER:
+ case BATADV_GW_MODE_SERVER:
curr_gw_mode_str = BATADV_GW_MODE_SERVER_NAME;
break;
default:
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c
index 5fc162c..2fcf26f 100644
--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -194,7 +194,7 @@ void batadv_gw_election(struct bat_priv *bat_priv)
* hear about. This check is based on the daemon's uptime which we
* don't have.
*/
- if (atomic_read(&bat_priv->gw_mode) != GW_MODE_CLIENT)
+ if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_CLIENT)
goto out;
if (!batadv_atomic_dec_not_zero(&bat_priv->gw_reselect))
@@ -663,13 +663,13 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
goto out;
switch (atomic_read(&bat_priv->gw_mode)) {
- case GW_MODE_SERVER:
+ case BATADV_GW_MODE_SERVER:
/* If we are a GW then we are our best GW. We can artificially
* set the tq towards ourself as the maximum value
*/
curr_tq_avg = BATADV_TQ_MAX_VALUE;
break;
- case GW_MODE_CLIENT:
+ case BATADV_GW_MODE_CLIENT:
curr_gw = batadv_gw_get_selected_gw_node(bat_priv);
if (!curr_gw)
goto out;
@@ -689,7 +689,7 @@ bool batadv_gw_out_of_range(struct bat_priv *bat_priv,
curr_tq_avg = neigh_curr->tq_avg;
break;
- case GW_MODE_OFF:
+ case BATADV_GW_MODE_OFF:
default:
goto out;
}
diff --git a/net/batman-adv/gateway_common.h b/net/batman-adv/gateway_common.h
index 31bbc3c..13697f6 100644
--- a/net/batman-adv/gateway_common.h
+++ b/net/batman-adv/gateway_common.h
@@ -20,10 +20,10 @@
#ifndef _NET_BATMAN_ADV_GATEWAY_COMMON_H_
#define _NET_BATMAN_ADV_GATEWAY_COMMON_H_
-enum gw_modes {
- GW_MODE_OFF,
- GW_MODE_CLIENT,
- GW_MODE_SERVER,
+enum batadv_gw_modes {
+ BATADV_GW_MODE_OFF,
+ BATADV_GW_MODE_CLIENT,
+ BATADV_GW_MODE_SERVER,
};
#define BATADV_GW_MODE_OFF_NAME "off"
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index c1b2ab2..b77e598 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -177,7 +177,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
do_bcast = true;
switch (atomic_read(&bat_priv->gw_mode)) {
- case GW_MODE_SERVER:
+ case BATADV_GW_MODE_SERVER:
/* gateway servers should not send dhcp
* requests into the mesh
*/
@@ -185,7 +185,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
if (ret)
goto dropped;
break;
- case GW_MODE_CLIENT:
+ case BATADV_GW_MODE_CLIENT:
/* gateway clients should send dhcp requests
* via unicast to their gateway
*/
@@ -193,7 +193,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
if (ret)
do_bcast = false;
break;
- case GW_MODE_OFF:
+ case BATADV_GW_MODE_OFF:
default:
break;
}
@@ -234,7 +234,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
/* unicast packet */
} else {
- if (atomic_read(&bat_priv->gw_mode) != GW_MODE_OFF) {
+ if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_OFF) {
ret = batadv_gw_out_of_range(bat_priv, skb, ethhdr);
if (ret)
goto dropped;
@@ -387,7 +387,7 @@ struct net_device *batadv_softif_create(const char *name)
atomic_set(&bat_priv->bridge_loop_avoidance, 0);
atomic_set(&bat_priv->ap_isolation, 0);
atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE);
- atomic_set(&bat_priv->gw_mode, GW_MODE_OFF);
+ atomic_set(&bat_priv->gw_mode, BATADV_GW_MODE_OFF);
atomic_set(&bat_priv->gw_sel_class, 20);
atomic_set(&bat_priv->gw_bandwidth, 41);
atomic_set(&bat_priv->orig_interval, 1000);
--
1.7.9.4
^ permalink raw reply related
* (USD$450 Million Dollars transfer.)
From: MR VICTOR. @ 2012-07-01 22:20 UTC (permalink / raw)
To: mr.victorb7
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
PLEASE DOWNLOAD FREELY, TO VIEW THE MESSAGE
[-- Attachment #2: {BuSiNeSs}01.pdf --]
[-- Type: application/pdf, Size: 28031 bytes --]
^ permalink raw reply
* Re: AF_BUS socket address family
From: David Miller @ 2012-07-01 21:45 UTC (permalink / raw)
To: alan; +Cc: vincent.sanders, netdev, linux-kernel
In-Reply-To: <20120701151659.2be61475@pyramind.ukuu.org.uk>
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
Date: Sun, 1 Jul 2012 15:16:59 +0100
>> The issue is that what to do when a receiver goes deaf is a policy
>> issue.
>
> Something all these protocols alredy recognize and have done for years.
> The real issue for AF_BUS versus the current slow AF_UNIX approach is
> that you really need to know *who* is blocked up.
>
> That's no different to UDP multicast and needing to know how errored the
> frame.
And the policy on what to do about such UDP multicast errors is in
userspace, which is precisely my point.
^ permalink raw reply
* Re: [PATCH v6] sctp: be more restrictive in transport selection on bundled sacks
From: David Miller @ 2012-07-01 21:43 UTC (permalink / raw)
To: nhorman; +Cc: netdev, vyasevich, linux-sctp
In-Reply-To: <20120701124750.GA19498@neilslaptop.think-freely.org>
From: Neil Horman <nhorman@tuxdriver.com>
Date: Sun, 1 Jul 2012 08:47:50 -0400
> Perhaps we could modify the SubmittingPatches document to indicate that an
> Acked-by from a subsystem maintainer implicitly confers authority on the
> upstream receiver to request reasonable stylistic changes that don't affect the
> functionality of the patch in the interests of maintaining coding conventions.
Yes, that would make sense.
^ permalink raw reply
* Re: [PATCH net-next 06/10] {NET,IB}/mlx4: Add device managed flow steering firmware API
From: David Miller @ 2012-07-01 21:42 UTC (permalink / raw)
To: ogerlitz; +Cc: roland, yevgenyp, oren, netdev, hadarh
In-Reply-To: <4FF042B5.1000303@mellanox.com>
From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Sun, 1 Jul 2012 15:29:41 +0300
> And for the time being use the module param, makes sense?
This talk about making an alternative, clean, mechanism later
is non-sense. Because you'll never be able to get rid of this
module param once you add it.
Module parameters stink because every driver is going to provide the
knob differently, with a different name, and different semantics.
This creates a terrible user experience, and I will not allow it.
^ permalink raw reply
* Re: [BUG, regression, bisected] Marvell 88E8055 NIC (sky2) fails to detect link after resume from S3
From: Michal Zatloukal @ 2012-07-01 20:58 UTC (permalink / raw)
To: Francois Romieu; +Cc: Stephen Hemminger, netdev
In-Reply-To: <CAKKZj2DZprXcEg1tRDnt9fnFahLnOEMQNno9hS2UJzQ-n13JHA@mail.gmail.com>
Traces (7z-compressed to ~250k) attached to ubuntu bug, direct link:
<https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1007841/+attachment/3210143/+files/traces.7z>
MZ
On Sun, Jul 1, 2012 at 3:30 PM, Michal Zatloukal <myxal.mxl@gmail.com> wrote:
> Breaking news:
> Fiddling with mmiotrace, I was able to get the "phy I/O error" on
> previously-thought-good kernel (non-reliably; it took several
> suspend-resume cycles), and also vice versa - in vty, I was able to
> suspend and resume the "bad" kernel with the NIC still working (also
> not reliably - in GUI, it still flaked out after first
> suspend-resume).
>
> Anyway, I've gathered traces of both good and bad behaviour, each from
> the respective kernel (not that it seems to matter much). Now, what's
> the recommended way of posting them? Each is over 3MB in size and
> pastebin won't take them. :-(
>
> MZ
>
> On Sat, Jun 30, 2012 at 10:02 PM, Francois Romieu <romieu@fr.zoreil.com> wrote:
>> Michal Zatloukal <myxal.mxl@gmail.com> :
>> [...]
>>> Is there something I can try?
>>
>> I have not used it for quite some time but comparing mmiotrace output
>> (see Documentation/trace/mmiotrace.txt) before and after the regression
>> commit may give some hint.
>>
>> Otherwise I would ask for help on linux-pm@vger.kernel.org
>>
>> --
>> Ueimor
^ permalink raw reply
* Re: [PATCH net-next 09/10] net/mlx4_en: Manage flow steering rules with ethtool
From: Joe Perches @ 2012-07-01 19:52 UTC (permalink / raw)
To: Andreas Schwab
Cc: Ben Hutchings, Or Gerlitz, davem, roland, yevgenyp, oren, netdev,
Hadar Hen Zion
In-Reply-To: <m2ipe72u78.fsf@igel.home>
On Sun, 2012-07-01 at 20:48 +0200, Andreas Schwab wrote:
> Joe Perches <joe@perches.com> writes:
> > On Sun, 2012-07-01 at 09:38 -0700, Joe Perches wrote:
> >> Perhaps it's better as:
> >>
> >> #define all_zeros_or_all_ones(field) \
> >> ({ \
> >> field && (typeof(field))~field; \
> >> })
> >
> > Umm, or not.
> >
> > It helps when I actually test the code not just type
> > it into an email client.
> >
> > !(field && (typeof(field))~field)
>
> Or write it as (!field || !(typeof(field))~field) which more closely
> resembles what the macro name expresses.
Better still, or maybe:
field == 0 || field == (typeof field)~0
^ permalink raw reply
* Re: [PATCH v5] bonding support for IPv6 transmit hashing
From: John Eaglesham @ 2012-07-01 19:01 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20120701.033354.539821533277159165.davem@davemloft.net>
On 7/1/2012 3:33 AM, David Miller wrote:
> From: John Eaglesham <linux@8192.net>
> Date: Sun, 1 Jul 2012 01:07:43 -0700
>
>> + v6hash =
>> + (ipv6h->saddr.s6_addr32[1] ^ ipv6h->daddr.s6_addr32[1]) ^
>> + (ipv6h->saddr.s6_addr32[2] ^ ipv6h->daddr.s6_addr32[2]) ^
>> + (ipv6h->saddr.s6_addr32[3] ^ ipv6h->daddr.s6_addr32[3]);
>
> You completely ignored my feedback:
>
> This is rediculous, just put &ipv6h->saddr into a local
> pointer named 's' and then you won't have use such gymnastics
> to indent the code.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
My apologies, I completely misunderstood your feedback. I will make the
correction and re-submit.
Thanks.
John
^ permalink raw reply
* Re: [PATCH net-next 09/10] net/mlx4_en: Manage flow steering rules with ethtool
From: Andreas Schwab @ 2012-07-01 18:48 UTC (permalink / raw)
To: Joe Perches
Cc: Ben Hutchings, Or Gerlitz, davem, roland, yevgenyp, oren, netdev,
Hadar Hen Zion
In-Reply-To: <1341163872.2032.29.camel@joe2Laptop>
Joe Perches <joe@perches.com> writes:
> On Sun, 2012-07-01 at 09:38 -0700, Joe Perches wrote:
>
>> I think this macro is suboptimal because
>> negated names are easy to misuse.
>>
>> I think type is also unnecessary and too
>> easy to mismatch or keep up to date with
>> field type changes.
>>
>> Perhaps it's better as:
>>
>> #define all_zeros_or_all_ones(field) \
>> ({ \
>> field && (typeof(field))~field; \
>> })
>
> Umm, or not.
>
> It helps when I actually test the code not just type
> it into an email client.
>
> !(field && (typeof(field))~field)
Or write it as (!field || !(typeof(field))~field) which more closely
resembles what the macro name expresses.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply
* [PATCH 0/3 v2] net: various tilegx networking fixes
From: Chris Metcalf @ 2012-07-01 18:43 UTC (permalink / raw)
To: David S. Miller, netdev, linux-kernel
Revised series to have the dates on the patches correct. Considering
I've gotten this wrong before, I promise this is the last time. :-)
This series of fixes corrects a few bugs or style issues observed
in the tilegx network driver.
David, once any potential issues with these patches are resolved,
would you prefer to take them from email, pull them from my net tree,
or have me push them as part of the tile tree?
The tree is at:
git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile.git net
Chris Metcalf (3):
net: tilegx driver bugfix (be explicit about percpu queue number)
tilegx net driver: handle payload data not in frags
tilegx net: use eth_hw_addr_random(), not random_ether_addr()
drivers/net/ethernet/tile/tilegx.c | 61 ++++++++++++++++++++----------------
1 file changed, 34 insertions(+), 27 deletions(-)
Thanks!
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
^ permalink raw reply
* [PATCH 1/3] net: tilegx driver bugfix (be explicit about percpu queue number)
From: Chris Metcalf @ 2012-07-01 18:43 UTC (permalink / raw)
To: David S. Miller, netdev, linux-kernel
In-Reply-To: <201207181640.q6IGet7P007227@lab-41.internal.tilera.com>
Avoid packets belonging to queue/cpu A trying to transmit on cpu B.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
---
drivers/net/ethernet/tile/tilegx.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 83b4b38..c7bde28 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -123,6 +123,7 @@ struct tile_net_comps {
/* The transmit wake timer for a given cpu and echannel. */
struct tile_net_tx_wake {
+ int tx_queue_idx;
struct hrtimer timer;
struct net_device *dev;
};
@@ -573,12 +574,14 @@ static void add_comp(gxio_mpipe_equeue_t *equeue,
comps->comp_next++;
}
-static void tile_net_schedule_tx_wake_timer(struct net_device *dev)
+static void tile_net_schedule_tx_wake_timer(struct net_device *dev,
+ int tx_queue_idx)
{
- struct tile_net_info *info = &__get_cpu_var(per_cpu_info);
+ struct tile_net_info *info = &per_cpu(per_cpu_info, tx_queue_idx);
struct tile_net_priv *priv = netdev_priv(dev);
+ struct tile_net_tx_wake *tx_wake = &info->tx_wake[priv->echannel];
- hrtimer_start(&info->tx_wake[priv->echannel].timer,
+ hrtimer_start(&tx_wake->timer,
ktime_set(0, TX_TIMER_DELAY_USEC * 1000UL),
HRTIMER_MODE_REL_PINNED);
}
@@ -587,7 +590,7 @@ static enum hrtimer_restart tile_net_handle_tx_wake_timer(struct hrtimer *t)
{
struct tile_net_tx_wake *tx_wake =
container_of(t, struct tile_net_tx_wake, timer);
- netif_wake_subqueue(tx_wake->dev, smp_processor_id());
+ netif_wake_subqueue(tx_wake->dev, tx_wake->tx_queue_idx);
return HRTIMER_NORESTART;
}
@@ -1218,6 +1221,7 @@ static int tile_net_open(struct net_device *dev)
hrtimer_init(&tx_wake->timer, CLOCK_MONOTONIC,
HRTIMER_MODE_REL);
+ tx_wake->tx_queue_idx = cpu;
tx_wake->timer.function = tile_net_handle_tx_wake_timer;
tx_wake->dev = dev;
}
@@ -1291,6 +1295,7 @@ static inline void *tile_net_frag_buf(skb_frag_t *f)
* stop the queue and schedule the tx_wake timer.
*/
static s64 tile_net_equeue_try_reserve(struct net_device *dev,
+ int tx_queue_idx,
struct tile_net_comps *comps,
gxio_mpipe_equeue_t *equeue,
int num_edescs)
@@ -1313,8 +1318,8 @@ static s64 tile_net_equeue_try_reserve(struct net_device *dev,
}
/* Still nothing; give up and stop the queue for a short while. */
- netif_stop_subqueue(dev, smp_processor_id());
- tile_net_schedule_tx_wake_timer(dev);
+ netif_stop_subqueue(dev, tx_queue_idx);
+ tile_net_schedule_tx_wake_timer(dev, tx_queue_idx);
return -1;
}
@@ -1580,7 +1585,8 @@ static int tile_net_tx_tso(struct sk_buff *skb, struct net_device *dev)
local_irq_save(irqflags);
/* Try to acquire a completion entry and an egress slot. */
- slot = tile_net_equeue_try_reserve(dev, comps, equeue, num_edescs);
+ slot = tile_net_equeue_try_reserve(dev, skb->queue_mapping, comps,
+ equeue, num_edescs);
if (slot < 0) {
local_irq_restore(irqflags);
return NETDEV_TX_BUSY;
@@ -1674,7 +1680,8 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev)
local_irq_save(irqflags);
/* Try to acquire a completion entry and an egress slot. */
- slot = tile_net_equeue_try_reserve(dev, comps, equeue, num_edescs);
+ slot = tile_net_equeue_try_reserve(dev, skb->queue_mapping, comps,
+ equeue, num_edescs);
if (slot < 0) {
local_irq_restore(irqflags);
return NETDEV_TX_BUSY;
--
1.7.10.3
^ permalink raw reply related
* Re: [PATCH net-next 09/10] net/mlx4_en: Manage flow steering rules with ethtool
From: Joe Perches @ 2012-07-01 17:31 UTC (permalink / raw)
To: Ben Hutchings
Cc: Or Gerlitz, davem, roland, yevgenyp, oren, netdev, Hadar Hen Zion
In-Reply-To: <1341160685.2032.15.camel@joe2Laptop>
On Sun, 2012-07-01 at 09:38 -0700, Joe Perches wrote:
> I think this macro is suboptimal because
> negated names are easy to misuse.
>
> I think type is also unnecessary and too
> easy to mismatch or keep up to date with
> field type changes.
>
> Perhaps it's better as:
>
> #define all_zeros_or_all_ones(field) \
> ({ \
> field && (typeof(field))~field; \
> })
Umm, or not.
It helps when I actually test the code not just type
it into an email client.
!(field && (typeof(field))~field)
^ permalink raw reply
* Re: [PATCH 00/12] Swap-over-NFS without deadlocking V8
From: Eric B Munson @ 2012-07-01 17:22 UTC (permalink / raw)
To: Mel Gorman
Cc: Andrew Morton, Linux-MM, Linux-Netdev, Linux-NFS, LKML,
David Miller, Trond Myklebust, Neil Brown, Christoph Hellwig,
Peter Zijlstra, Mike Christie, Sebastian Andrzej Siewior
In-Reply-To: <1340976805-5799-1-git-send-email-mgorman@suse.de>
[-- Attachment #1: Type: text/plain, Size: 4245 bytes --]
On Fri, 29 Jun 2012, Mel Gorman wrote:
> Changelog since V7
> o Rebase to linux-next 20120629
> o bi->page_dma instead of bi->page in intel driver
> o Build fix for !CONFIG_NET (sebastian)
> o Restore PF_MEMALLOC flags correctly in all cases (jlayton)
>
> Changelog since V6
> o Rebase to linux-next 20120622
>
> Changelog since V5
> o Rebase to v3.5-rc3
>
> Changelog since V4
> o Catch if SOCK_MEMALLOC flag is cleared with rmem tokens (davem)
>
> Changelog since V3
> o Rebase to 3.4-rc5
> o kmap pages for writing to swap (akpm)
> o Move forward declaration to reduce chance of duplication (akpm)
>
> Changelog since V2
> o Nothing significant, just rebases. A radix tree lookup is replaced with
> a linear search would be the biggest rebase artifact
>
> This patch series is based on top of "Swap-over-NBD without deadlocking v14"
> as it depends on the same reservation of PF_MEMALLOC reserves logic.
>
> When a user or administrator requires swap for their application, they
> create a swap partition and file, format it with mkswap and activate it with
> swapon. In diskless systems this is not an option so if swap if required
> then swapping over the network is considered. The two likely scenarios
> are when blade servers are used as part of a cluster where the form factor
> or maintenance costs do not allow the use of disks and thin clients.
>
> The Linux Terminal Server Project recommends the use of the Network
> Block Device (NBD) for swap but this is not always an option. There is
> no guarantee that the network attached storage (NAS) device is running
> Linux or supports NBD. However, it is likely that it supports NFS so there
> are users that want support for swapping over NFS despite any performance
> concern. Some distributions currently carry patches that support swapping
> over NFS but it would be preferable to support it in the mainline kernel.
>
> Patch 1 avoids a stream-specific deadlock that potentially affects TCP.
>
> Patch 2 is a small modification to SELinux to avoid using PFMEMALLOC
> reserves.
>
> Patch 3 adds three helpers for filesystems to handle swap cache pages.
> For example, page_file_mapping() returns page->mapping for
> file-backed pages and the address_space of the underlying
> swap file for swap cache pages.
>
> Patch 4 adds two address_space_operations to allow a filesystem
> to pin all metadata relevant to a swapfile in memory. Upon
> successful activation, the swapfile is marked SWP_FILE and
> the address space operation ->direct_IO is used for writing
> and ->readpage for reading in swap pages.
>
> Patch 5 notes that patch 3 is bolting
> filesystem-specific-swapfile-support onto the side and that
> the default handlers have different information to what
> is available to the filesystem. This patch refactors the
> code so that there are generic handlers for each of the new
> address_space operations.
>
> Patch 6 adds an API to allow a vector of kernel addresses to be
> translated to struct pages and pinned for IO.
>
> Patch 7 adds support for using highmem pages for swap by kmapping
> the pages before calling the direct_IO handler.
>
> Patch 8 updates NFS to use the helpers from patch 3 where necessary.
>
> Patch 9 avoids setting PF_private on PG_swapcache pages within NFS.
>
> Patch 10 implements the new swapfile-related address_space operations
> for NFS and teaches the direct IO handler how to manage
> kernel addresses.
>
> Patch 11 prevents page allocator recursions in NFS by using GFP_NOIO
> where appropriate.
>
> Patch 12 fixes a NULL pointer dereference that occurs when using
> swap-over-NFS.
>
> With the patches applied, it is possible to mount a swapfile that is on an
> NFS filesystem. Swap performance is not great with a swap stress test taking
> roughly twice as long to complete than if the swap device was backed by NBD.
To test this set I am using memory cgroups to force swap usage. I am seeing
the cgroup controller killing my processes instead of using the nfs swapfile.
I am not yet sure if I am making a silly mistake or if something else is wrong.
Eric
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 09/10] net/mlx4_en: Manage flow steering rules with ethtool
From: Joe Perches @ 2012-07-01 16:38 UTC (permalink / raw)
To: Ben Hutchings
Cc: Or Gerlitz, davem, roland, yevgenyp, oren, netdev, Hadar Hen Zion
In-Reply-To: <1341158452.4852.107.camel@deadeye.wl.decadent.org.uk>
On Sun, 2012-07-01 at 17:00 +0100, Ben Hutchings wrote:
> On Sun, 2012-07-01 at 12:43 +0300, Or Gerlitz wrote:
> > From: Hadar Hen Zion <hadarh@mellanox.co.il>
[]
> > diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
[]
> > @@ -599,16 +603,360 @@ static int mlx4_en_set_rxfh_indir(struct net_device *dev,
> > return err;
> > }
> >
> > +#define not_all_zeros_or_all_ones(field, type) \
> > + (field && (type)~field)
I think this macro is suboptimal because
negated names are easy to misuse.
I think type is also unnecessary and too
easy to mismatch or keep up to date with
field type changes.
Perhaps it's better as:
#define all_zeros_or_all_ones(field) \
({ \
field && (typeof(field))~field; \
})
> > +
> > +static int mlx4_en_validate_flow(struct net_device *dev,
> > + struct ethtool_rxnfc *cmd)
> > +{
[]
> > + /* don't allow mask which isn't all 0 or 1 */
> > + if (not_all_zeros_or_all_ones(l4_mask->ip4src, __be32) ||
> > + not_all_zeros_or_all_ones(l4_mask->ip4dst, __be32) ||
> > + not_all_zeros_or_all_ones(l4_mask->psrc, __be16) ||
> > + not_all_zeros_or_all_ones(l4_mask->pdst, __be16))
> > + return -EOPNOTSUPP;
if (!all_zeros_or_all_ones(l4_mask->ip4src) ||
!all_zeros_or_all_ones(l4_mask->ip4dst) ||
!all_zeros_or_all_ones(l4_mask->psrc) ||
!all_zeros_or_all_ones(l4_mask->pdst))
^ permalink raw reply
* Re: [PATCH net-next 09/10] net/mlx4_en: Manage flow steering rules with ethtool
From: Ben Hutchings @ 2012-07-01 16:00 UTC (permalink / raw)
To: Or Gerlitz; +Cc: davem, roland, yevgenyp, oren, netdev, Hadar Hen Zion
In-Reply-To: <1341135823-29039-10-git-send-email-ogerlitz@mellanox.com>
On Sun, 2012-07-01 at 12:43 +0300, Or Gerlitz wrote:
> From: Hadar Hen Zion <hadarh@mellanox.co.il>
>
> Implement the ethtool APIs for attaching L2/L3/L4 based flow steering
> rules to the netdevice RX rings. Added set_rxnfc callback and enhanced
> the existing get_rxnfc callback.
>
> Signed-off-by: Hadar Hen Zion <hadarh@mellanox.co.il>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> ---
> drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 373 +++++++++++++++++++++++
> drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 7 +
> 2 files changed, 380 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> index 72901ce..30de264 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
> @@ -38,6 +38,10 @@
> #include "mlx4_en.h"
> #include "en_port.h"
>
> +#define EN_ETHTOOL_QP_ATTACH (1ull << 63)
> +#define EN_ETHTOOL_MAC_MASK 0xffffffffffffULL
> +#define EN_ETHTOOL_SHORT_MASK cpu_to_be16(0xffff)
> +#define EN_ETHTOOL_WORD_MASK cpu_to_be32(0xffffffff)
>
> static void
> mlx4_en_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
> @@ -599,16 +603,360 @@ static int mlx4_en_set_rxfh_indir(struct net_device *dev,
> return err;
> }
>
> +#define not_all_zeros_or_all_ones(field, type) \
> + (field && (type)~field)
> +
> +static int mlx4_en_validate_flow(struct net_device *dev,
> + struct ethtool_rxnfc *cmd)
> +{
> + struct ethtool_usrip4_spec *l3_mask;
> + struct ethtool_tcpip4_spec *l4_mask;
> + struct ethhdr *eth_mask;
> + u64 full_mac = ~0ull;
> + u64 zero_mac = 0;
> +
> + if (cmd->fs.location >= MAX_NUM_OF_FS_RULES)
> + return -EINVAL;
> +
> + switch (cmd->fs.flow_type & ~FLOW_EXT) {
> + case TCP_V4_FLOW:
> + case UDP_V4_FLOW:
> + if (cmd->fs.h_u.tcp_ip4_spec.tos)
> + return -EOPNOTSUPP;
I suspect that your filter ignores TOS, rather than only matching TOS ==
0, so you should actually be checking the corresponding field in the
mask (fs.m_u). The error code should be EINVAL.
> + l4_mask = &cmd->fs.m_u.tcp_ip4_spec;
> + /* don't allow mask which isn't all 0 or 1 */
> + if (not_all_zeros_or_all_ones(l4_mask->ip4src, __be32) ||
> + not_all_zeros_or_all_ones(l4_mask->ip4dst, __be32) ||
> + not_all_zeros_or_all_ones(l4_mask->psrc, __be16) ||
> + not_all_zeros_or_all_ones(l4_mask->pdst, __be16))
> + return -EOPNOTSUPP;
Again, here and in many further instances, the error code should be
EINVAL.
> + break;
> + case IP_USER_FLOW:
> + l3_mask = &cmd->fs.m_u.usr_ip4_spec;
> + if (cmd->fs.h_u.usr_ip4_spec.l4_4_bytes ||
> + cmd->fs.h_u.usr_ip4_spec.tos ||
I think this should be checking l4_4_bytes and tos in the mask.
> + cmd->fs.h_u.usr_ip4_spec.proto ||
> + cmd->fs.h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4 ||
> + (!cmd->fs.h_u.usr_ip4_spec.ip4src &&
> + !cmd->fs.h_u.usr_ip4_spec.ip4dst) ||
> + not_all_zeros_or_all_ones(l3_mask->ip4src, __be32) ||
> + not_all_zeros_or_all_ones(l3_mask->ip4dst, __be32))
> + return -EOPNOTSUPP;
> + break;
> + case ETHER_FLOW:
> + eth_mask = &cmd->fs.m_u.ether_spec;
> + if (memcmp(eth_mask->h_source, &zero_mac, ETH_ALEN))
> + return -EOPNOTSUPP;
> + if (!memcmp(eth_mask->h_dest, &zero_mac, ETH_ALEN))
> + return -EOPNOTSUPP;
But in the next statement you test whether eth_mask->h_dest is either
all-zeroes or all-ones. Is all-zeroes valid or not? I suspect you
actually intend to reject the case where both h_dest and h_proto are
masked out.
> + if (not_all_zeros_or_all_ones(eth_mask->h_proto, __be16) ||
> + (memcmp(eth_mask->h_dest, &zero_mac, ETH_ALEN) &&
> + memcmp(eth_mask->h_dest, &full_mac, ETH_ALEN)))
> + return -EOPNOTSUPP;
> + break;
> + default:
> + return -EOPNOTSUPP;
> + }
> +
> + if ((cmd->fs.flow_type & FLOW_EXT)) {
> + if (cmd->fs.m_ext.vlan_etype ||
> + not_all_zeros_or_all_ones(cmd->fs.m_ext.vlan_tci,
> + __be16)) {
> + return -EOPNOTSUPP;
> + }
> + }
> +
> + return 0;
> +}
> +
> +static void add_ip_rule(struct mlx4_en_priv *priv,
> + struct ethtool_rxnfc *cmd,
> + struct list_head *list_h)
> +{
> + struct mlx4_spec_list *spec_l3;
> +
> + spec_l3 = kzalloc(sizeof *spec_l3, GFP_KERNEL);
> + if (!spec_l3) {
> + en_err(priv, "Fail to alloc ethtool rule.\n");
> + return;
> + }
This should return an error code as well - logging is not a substitue.
> + spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4;
> + spec_l3->ipv4.src_ip = cmd->fs.h_u.usr_ip4_spec.ip4src;
> + if (spec_l3->ipv4.src_ip)
> + spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK;
> + spec_l3->ipv4.dst_ip = cmd->fs.h_u.usr_ip4_spec.ip4dst;
> + if (spec_l3->ipv4.dst_ip)
> + spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK;
The conditions should be using the mask (cmd->fs.m_u) not the value.
> + list_add_tail(&spec_l3->list, list_h);
> +}
> +
> +static void add_tcp_udp_rule(struct mlx4_en_priv *priv,
> + struct ethtool_rxnfc *cmd,
> + struct list_head *list_h, int proto)
> +{
> + struct mlx4_spec_list *spec_l3;
> + struct mlx4_spec_list *spec_l4;
> +
> + spec_l3 = kzalloc(sizeof *spec_l3, GFP_KERNEL);
> + spec_l4 = kzalloc(sizeof *spec_l4, GFP_KERNEL);
> + if (!spec_l4 || !spec_l3) {
> + en_err(priv, "Fail to alloc ethtool rule.\n");
If one of them was successfully allocated, it will now be leaked.
> + return;
> + }
> +
> + spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4;
> +
> + if (proto == TCP_V4_FLOW) {
> + spec_l4->id = MLX4_NET_TRANS_RULE_ID_TCP;
> + spec_l3->ipv4.src_ip = cmd->fs.h_u.tcp_ip4_spec.ip4src;
> + spec_l3->ipv4.dst_ip = cmd->fs.h_u.tcp_ip4_spec.ip4dst;
> + spec_l4->tcp_udp.src_port = cmd->fs.h_u.tcp_ip4_spec.psrc;
> + spec_l4->tcp_udp.dst_port = cmd->fs.h_u.tcp_ip4_spec.pdst;
> + } else {
> + spec_l4->id = MLX4_NET_TRANS_RULE_ID_UDP;
> + spec_l3->ipv4.src_ip = cmd->fs.h_u.udp_ip4_spec.ip4src;
> + spec_l3->ipv4.dst_ip = cmd->fs.h_u.udp_ip4_spec.ip4dst;
> + spec_l4->tcp_udp.src_port = cmd->fs.h_u.udp_ip4_spec.psrc;
> + spec_l4->tcp_udp.dst_port = cmd->fs.h_u.udp_ip4_spec.pdst;
> + }
> +
> + if (spec_l3->ipv4.src_ip)
> + spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK;
> + if (spec_l3->ipv4.dst_ip)
> + spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK;
> +
> + if (spec_l4->tcp_udp.src_port)
> + spec_l4->tcp_udp.src_port_msk = EN_ETHTOOL_SHORT_MASK;
> + if (spec_l4->tcp_udp.dst_port)
> + spec_l4->tcp_udp.dst_port_msk = EN_ETHTOOL_SHORT_MASK;
All these conditions should be using the mask, not the value.
> + list_add_tail(&spec_l3->list, list_h);
> + list_add_tail(&spec_l4->list, list_h);
> +}
> +
> +static int mlx4_en_ethtool_to_net_trans_rule(struct net_device *dev,
> + struct ethtool_rxnfc *cmd,
> + struct list_head *rule_list_h)
> +{
> + int err;
> + u64 mac;
> + __be64 be_mac;
> + struct ethhdr *eth_spec;
> + struct mlx4_en_priv *priv = netdev_priv(dev);
> + struct mlx4_spec_list *spec_l2;
> + __be64 mac_msk = cpu_to_be64(EN_ETHTOOL_MAC_MASK << 16);
> +
> + err = mlx4_en_validate_flow(dev, cmd);
> + if (err)
> + return err;
> +
> + spec_l2 = kzalloc(sizeof *spec_l2, GFP_KERNEL);
> + if (!spec_l2)
> + return -ENOMEM;
> +
> + mac = priv->mac & EN_ETHTOOL_MAC_MASK;
> + be_mac = cpu_to_be64(mac << 16);
> +
> + spec_l2->id = MLX4_NET_TRANS_RULE_ID_ETH;
> + memcpy(spec_l2->eth.dst_mac_msk, &mac_msk, ETH_ALEN);
> + if ((cmd->fs.flow_type & ~FLOW_EXT) != ETHER_FLOW)
> + memcpy(spec_l2->eth.dst_mac, &be_mac, ETH_ALEN);
Does the hardware require filtering by MAC address and not only by layer
3/4 addresses?
> + if ((cmd->fs.flow_type & FLOW_EXT) && cmd->fs.m_ext.vlan_tci) {
> + spec_l2->eth.vlan_id = cmd->fs.h_ext.vlan_tci;
> + spec_l2->eth.vlan_id_msk = cpu_to_be16(0xfff);
This doesn't match mlx4_en_validate_flow(); you are replacing a mask of
0xffff with 0xfff.
> + }
> +
> + list_add_tail(&spec_l2->list, rule_list_h);
> +
> + switch (cmd->fs.flow_type & ~FLOW_EXT) {
> + case ETHER_FLOW:
> + eth_spec = &cmd->fs.h_u.ether_spec;
> + memcpy(&spec_l2->eth.dst_mac, eth_spec->h_dest, ETH_ALEN);
> + spec_l2->eth.ether_type = eth_spec->h_proto;
> + if (eth_spec->h_proto)
> + spec_l2->eth.ether_type_enable = 1;
> + break;
> + case IP_USER_FLOW:
> + add_ip_rule(priv, cmd, rule_list_h);
> + break;
> + case TCP_V4_FLOW:
> + add_tcp_udp_rule(priv, cmd, rule_list_h, TCP_V4_FLOW);
> + break;
> + case UDP_V4_FLOW:
> + add_tcp_udp_rule(priv, cmd, rule_list_h, UDP_V4_FLOW);
> + break;
All those functions need to be able to return errors.
> + }
> + return 0;
> +}
> +
> +static int mlx4_en_flow_replace(struct net_device *dev,
> + struct ethtool_rxnfc *cmd)
> +{
> + int err;
> + struct mlx4_en_priv *priv = netdev_priv(dev);
> + struct ethtool_flow_id *loc_rule;
> + struct mlx4_spec_list *spec, *tmp_spec;
> + u32 qpn;
> + u64 reg_id;
> +
> + struct mlx4_net_trans_rule rule = {
> + .queue_mode = MLX4_NET_TRANS_Q_FIFO,
> + .exclusive = 0,
> + .allow_loopback = 1,
> + .promisc_mode = MLX4_FS_PROMISC_NONE,
> + };
> +
> + rule.port = priv->port;
> + rule.priority = MLX4_DOMAIN_ETHTOOL | cmd->fs.location;
> + INIT_LIST_HEAD(&rule.list);
> +
> + /* Allow direct QP attaches if the EN_ETHTOOL_QP_ATTACH flag is set */
> + if (cmd->fs.ring_cookie == RX_CLS_FLOW_DISC)
> + return -EOPNOTSUPP;
EINVAL.
[...]
> static int mlx4_en_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
> u32 *rule_locs)
> {
> struct mlx4_en_priv *priv = netdev_priv(dev);
> + struct mlx4_en_dev *mdev = priv->mdev;
> int err = 0;
> + int i = 0, priority = 0;
> +
> + if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_DEVICE_MANAGED)
> + return -EOPNOTSUPP;
>
> switch (cmd->cmd) {
> case ETHTOOL_GRXRINGS:
> cmd->data = priv->rx_ring_num;
> break;
> + case ETHTOOL_GRXCLSRLCNT:
> + cmd->rule_cnt = mlx4_en_get_num_flows(priv);
> + break;
> + case ETHTOOL_GRXCLSRULE:
> + err = mlx4_en_get_flow(dev, cmd, cmd->fs.location);
> + break;
> + case ETHTOOL_GRXCLSRLALL:
> + while (!err || err == -ENOENT) {
> + err = mlx4_en_get_flow(dev, cmd, i);
> + if (!err)
> + ((u32 *)(rule_locs))[priority++] = i;
I don't see any range check against cmd->rule_cnt.
Why are you casting rule_locs?
Also, are the rules really prioritised by location, so that if rule 0
and 1 match a packet then only rule 0 is applied? If they are actually
prioritised by the match type then you need to assign locations on the
driver side that reflect the actual priorities.
> + i++;
> + }
> + if (priority)
> + err = 0;
[...]
But if there are no rules defined, this is an error? That's not right.
I think you should unconditionally set err = 0 here.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH net-next 00/11] default maximal number of RSS queues in mq drivers
From: Or Gerlitz @ 2012-07-01 15:01 UTC (permalink / raw)
To: Yuval Mintz
Cc: davem, netdev, eilong, Divy Le Ray, Jon Mason,
Anirban Chakraborty, Jitendra Kalsaria, Ron Mercer, Jeff Kirsher,
Jon Mason, Andrew Gallatin, Sathya Perla, Subbu Seetharaman,
Ajit Khaparde, Matt Carlson, Michael Chan, Eric Dumazet,
Ben Hutchings
In-Reply-To: <1341148740-7375-1-git-send-email-yuvalmin@broadcom.com>
On 7/1/2012 4:18 PM, Yuval Mintz wrote:
> Different vendors support different number of RSS queues by default. Today,
> there exists an ethtool API through which users can change the number of
> channels their driver supports; This enables us to pursue the goal of using
> a default number of RSS queues in various multi-queue drivers.
Yuval,
I assume this posting is actually v3 of "[RFC net-next (v2) 00/14]
default maximal number of RSS queues in mq drivers" see
http://marc.info/?l=linux-netdev&m=134062509310404&w=2?
correct? so what has been changed along v0/v1/v2 --> v3? It would be
very helpful to follow
if you make sure to mark the patches that makes Vn with "PATCH net-next
Vn" and specify the changes
from Vn-1, Vn-2...V1, V0.
Or.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox