Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256122
b: refs/heads/master
c: b539e4c
h: refs/heads/master
v: v3
  • Loading branch information
Marek Lindner committed Jul 5, 2011
1 parent beec4d2 commit 2885e07
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6a020ab452d38b3878903de931c162429072a7d7
refs/heads/master: b539e4cd3b08dddbaa2ba0f158eed3c7c2244eaf
25 changes: 20 additions & 5 deletions trunk/net/batman-adv/aggregation.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

/* return true if new_packet can be aggregated with forw_packet */
static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
struct bat_priv *bat_priv,
int packet_len,
unsigned long send_time,
bool directlink,
Expand All @@ -37,6 +38,8 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
struct batman_packet *batman_packet =
(struct batman_packet *)forw_packet->skb->data;
int aggregated_bytes = forw_packet->packet_len + packet_len;
struct hard_iface *primary_if = NULL;
bool res = false;

/**
* we can aggregate the current packet to this aggregated packet
Expand All @@ -61,6 +64,10 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
* packet
*/

primary_if = primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;

/* packets without direct link flag and high TTL
* are flooded through the net */
if ((!directlink) &&
Expand All @@ -70,8 +77,10 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
/* own packets originating non-primary
* interfaces leave only that interface */
((!forw_packet->own) ||
(forw_packet->if_incoming->if_num == 0)))
return true;
(forw_packet->if_incoming == primary_if))) {
res = true;
goto out;
}

/* if the incoming packet is sent via this one
* interface only - we still can aggregate */
Expand All @@ -84,11 +93,16 @@ static bool can_aggregate_with(const struct batman_packet *new_batman_packet,
* (= secondary interface packets in general) */
(batman_packet->flags & DIRECTLINK ||
(forw_packet->own &&
forw_packet->if_incoming->if_num != 0)))
return true;
forw_packet->if_incoming != primary_if))) {
res = true;
goto out;
}
}

return false;
out:
if (primary_if)
hardif_free_ref(primary_if);
return res;
}

/* create a new aggregated packet and add this packet to it */
Expand Down Expand Up @@ -210,6 +224,7 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv,
hlist_for_each_entry(forw_packet_pos, tmp_node,
&bat_priv->forw_bat_list, list) {
if (can_aggregate_with(batman_packet,
bat_priv,
packet_len,
send_time,
direct_link,
Expand Down

0 comments on commit 2885e07

Please sign in to comment.