batman-adv: Don't break statements after assignment operator
Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
This commit is contained in:
parent
8de47de575
commit
bbb1f90efb
|
@ -588,6 +588,8 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)
|
||||||
struct batadv_ogm_packet *batadv_ogm_packet;
|
struct batadv_ogm_packet *batadv_ogm_packet;
|
||||||
struct batadv_hard_iface *primary_if;
|
struct batadv_hard_iface *primary_if;
|
||||||
int vis_server, tt_num_changes = 0;
|
int vis_server, tt_num_changes = 0;
|
||||||
|
uint32_t seqno;
|
||||||
|
uint8_t bandwidth;
|
||||||
|
|
||||||
vis_server = atomic_read(&bat_priv->vis_mode);
|
vis_server = atomic_read(&bat_priv->vis_mode);
|
||||||
primary_if = batadv_primary_if_get_selected(bat_priv);
|
primary_if = batadv_primary_if_get_selected(bat_priv);
|
||||||
|
@ -601,8 +603,8 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)
|
||||||
batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
|
batadv_ogm_packet = (struct batadv_ogm_packet *)hard_iface->packet_buff;
|
||||||
|
|
||||||
/* change sequence number to network order */
|
/* change sequence number to network order */
|
||||||
batadv_ogm_packet->seqno =
|
seqno = (uint32_t)atomic_read(&hard_iface->seqno);
|
||||||
htonl((uint32_t)atomic_read(&hard_iface->seqno));
|
batadv_ogm_packet->seqno = htonl(seqno);
|
||||||
atomic_inc(&hard_iface->seqno);
|
atomic_inc(&hard_iface->seqno);
|
||||||
|
|
||||||
batadv_ogm_packet->ttvn = atomic_read(&bat_priv->tt.vn);
|
batadv_ogm_packet->ttvn = atomic_read(&bat_priv->tt.vn);
|
||||||
|
@ -615,12 +617,13 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface)
|
||||||
else
|
else
|
||||||
batadv_ogm_packet->flags &= ~BATADV_VIS_SERVER;
|
batadv_ogm_packet->flags &= ~BATADV_VIS_SERVER;
|
||||||
|
|
||||||
if ((hard_iface == primary_if) &&
|
if (hard_iface == primary_if &&
|
||||||
(atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER))
|
atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER) {
|
||||||
batadv_ogm_packet->gw_flags =
|
bandwidth = (uint8_t)atomic_read(&bat_priv->gw_bandwidth);
|
||||||
(uint8_t)atomic_read(&bat_priv->gw_bandwidth);
|
batadv_ogm_packet->gw_flags = bandwidth;
|
||||||
else
|
} else {
|
||||||
batadv_ogm_packet->gw_flags = BATADV_NO_FLAGS;
|
batadv_ogm_packet->gw_flags = BATADV_NO_FLAGS;
|
||||||
|
}
|
||||||
|
|
||||||
batadv_slide_own_bcast_window(hard_iface);
|
batadv_slide_own_bcast_window(hard_iface);
|
||||||
batadv_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff,
|
batadv_iv_ogm_queue_add(bat_priv, hard_iface->packet_buff,
|
||||||
|
@ -644,8 +647,9 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
|
||||||
struct batadv_neigh_node *router = NULL;
|
struct batadv_neigh_node *router = NULL;
|
||||||
struct batadv_orig_node *orig_node_tmp;
|
struct batadv_orig_node *orig_node_tmp;
|
||||||
struct hlist_node *node;
|
struct hlist_node *node;
|
||||||
uint8_t bcast_own_sum_orig, bcast_own_sum_neigh;
|
uint8_t sum_orig, sum_neigh;
|
||||||
uint8_t *neigh_addr;
|
uint8_t *neigh_addr;
|
||||||
|
uint8_t tq_avg;
|
||||||
|
|
||||||
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
|
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
|
||||||
"update_originator(): Searching and updating originator entry of received packet\n");
|
"update_originator(): Searching and updating originator entry of received packet\n");
|
||||||
|
@ -669,8 +673,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
|
||||||
spin_lock_bh(&tmp_neigh_node->lq_update_lock);
|
spin_lock_bh(&tmp_neigh_node->lq_update_lock);
|
||||||
batadv_ring_buffer_set(tmp_neigh_node->tq_recv,
|
batadv_ring_buffer_set(tmp_neigh_node->tq_recv,
|
||||||
&tmp_neigh_node->tq_index, 0);
|
&tmp_neigh_node->tq_index, 0);
|
||||||
tmp_neigh_node->tq_avg =
|
tq_avg = batadv_ring_buffer_avg(tmp_neigh_node->tq_recv);
|
||||||
batadv_ring_buffer_avg(tmp_neigh_node->tq_recv);
|
tmp_neigh_node->tq_avg = tq_avg;
|
||||||
spin_unlock_bh(&tmp_neigh_node->lq_update_lock);
|
spin_unlock_bh(&tmp_neigh_node->lq_update_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,17 +733,15 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv,
|
||||||
if (router && (neigh_node->tq_avg == router->tq_avg)) {
|
if (router && (neigh_node->tq_avg == router->tq_avg)) {
|
||||||
orig_node_tmp = router->orig_node;
|
orig_node_tmp = router->orig_node;
|
||||||
spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
|
spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
|
||||||
bcast_own_sum_orig =
|
sum_orig = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
|
||||||
orig_node_tmp->bcast_own_sum[if_incoming->if_num];
|
|
||||||
spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
|
spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
|
||||||
|
|
||||||
orig_node_tmp = neigh_node->orig_node;
|
orig_node_tmp = neigh_node->orig_node;
|
||||||
spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
|
spin_lock_bh(&orig_node_tmp->ogm_cnt_lock);
|
||||||
bcast_own_sum_neigh =
|
sum_neigh = orig_node_tmp->bcast_own_sum[if_incoming->if_num];
|
||||||
orig_node_tmp->bcast_own_sum[if_incoming->if_num];
|
|
||||||
spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
|
spin_unlock_bh(&orig_node_tmp->ogm_cnt_lock);
|
||||||
|
|
||||||
if (bcast_own_sum_orig >= bcast_own_sum_neigh)
|
if (sum_orig >= sum_neigh)
|
||||||
goto update_tt;
|
goto update_tt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,6 +914,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
|
||||||
int set_mark, ret = -1;
|
int set_mark, ret = -1;
|
||||||
uint32_t seqno = ntohl(batadv_ogm_packet->seqno);
|
uint32_t seqno = ntohl(batadv_ogm_packet->seqno);
|
||||||
uint8_t *neigh_addr;
|
uint8_t *neigh_addr;
|
||||||
|
uint8_t packet_count;
|
||||||
|
|
||||||
orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig);
|
orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig);
|
||||||
if (!orig_node)
|
if (!orig_node)
|
||||||
|
@ -946,9 +949,9 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
|
||||||
tmp_neigh_node->real_bits,
|
tmp_neigh_node->real_bits,
|
||||||
seq_diff, set_mark);
|
seq_diff, set_mark);
|
||||||
|
|
||||||
tmp_neigh_node->real_packet_count =
|
packet_count = bitmap_weight(tmp_neigh_node->real_bits,
|
||||||
bitmap_weight(tmp_neigh_node->real_bits,
|
|
||||||
BATADV_TQ_LOCAL_WINDOW_SIZE);
|
BATADV_TQ_LOCAL_WINDOW_SIZE);
|
||||||
|
tmp_neigh_node->real_packet_count = packet_count;
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
|
|
@ -579,8 +579,7 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
|
||||||
"bla_add_claim(): changing ownership for %pM, vid %d\n",
|
"bla_add_claim(): changing ownership for %pM, vid %d\n",
|
||||||
mac, vid);
|
mac, vid);
|
||||||
|
|
||||||
claim->backbone_gw->crc ^=
|
claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN);
|
||||||
crc16(0, claim->addr, ETH_ALEN);
|
|
||||||
batadv_backbone_gw_free_ref(claim->backbone_gw);
|
batadv_backbone_gw_free_ref(claim->backbone_gw);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1102,8 +1101,7 @@ static void batadv_bla_start_timer(struct batadv_priv *bat_priv)
|
||||||
*/
|
*/
|
||||||
static void batadv_bla_periodic_work(struct work_struct *work)
|
static void batadv_bla_periodic_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct delayed_work *delayed_work =
|
struct delayed_work *delayed_work;
|
||||||
container_of(work, struct delayed_work, work);
|
|
||||||
struct batadv_priv *bat_priv;
|
struct batadv_priv *bat_priv;
|
||||||
struct batadv_priv_bla *priv_bla;
|
struct batadv_priv_bla *priv_bla;
|
||||||
struct hlist_node *node;
|
struct hlist_node *node;
|
||||||
|
@ -1113,6 +1111,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)
|
||||||
struct batadv_hard_iface *primary_if;
|
struct batadv_hard_iface *primary_if;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
delayed_work = container_of(work, struct delayed_work, work);
|
||||||
priv_bla = container_of(delayed_work, struct batadv_priv_bla, work);
|
priv_bla = container_of(delayed_work, struct batadv_priv_bla, work);
|
||||||
bat_priv = container_of(priv_bla, struct batadv_priv, bla);
|
bat_priv = container_of(priv_bla, struct batadv_priv, bla);
|
||||||
primary_if = batadv_primary_if_get_selected(bat_priv);
|
primary_if = batadv_primary_if_get_selected(bat_priv);
|
||||||
|
|
|
@ -190,13 +190,13 @@ out:
|
||||||
static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
|
static void batadv_send_outstanding_bcast_packet(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct batadv_hard_iface *hard_iface;
|
struct batadv_hard_iface *hard_iface;
|
||||||
struct delayed_work *delayed_work =
|
struct delayed_work *delayed_work;
|
||||||
container_of(work, struct delayed_work, work);
|
|
||||||
struct batadv_forw_packet *forw_packet;
|
struct batadv_forw_packet *forw_packet;
|
||||||
struct sk_buff *skb1;
|
struct sk_buff *skb1;
|
||||||
struct net_device *soft_iface;
|
struct net_device *soft_iface;
|
||||||
struct batadv_priv *bat_priv;
|
struct batadv_priv *bat_priv;
|
||||||
|
|
||||||
|
delayed_work = container_of(work, struct delayed_work, work);
|
||||||
forw_packet = container_of(delayed_work, struct batadv_forw_packet,
|
forw_packet = container_of(delayed_work, struct batadv_forw_packet,
|
||||||
delayed_work);
|
delayed_work);
|
||||||
soft_iface = forw_packet->if_incoming->soft_iface;
|
soft_iface = forw_packet->if_incoming->soft_iface;
|
||||||
|
@ -239,11 +239,11 @@ out:
|
||||||
|
|
||||||
void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work)
|
void batadv_send_outstanding_bat_ogm_packet(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct delayed_work *delayed_work =
|
struct delayed_work *delayed_work;
|
||||||
container_of(work, struct delayed_work, work);
|
|
||||||
struct batadv_forw_packet *forw_packet;
|
struct batadv_forw_packet *forw_packet;
|
||||||
struct batadv_priv *bat_priv;
|
struct batadv_priv *bat_priv;
|
||||||
|
|
||||||
|
delayed_work = container_of(work, struct delayed_work, work);
|
||||||
forw_packet = container_of(delayed_work, struct batadv_forw_packet,
|
forw_packet = container_of(delayed_work, struct batadv_forw_packet,
|
||||||
delayed_work);
|
delayed_work);
|
||||||
bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface);
|
bat_priv = netdev_priv(forw_packet->if_incoming->soft_iface);
|
||||||
|
|
|
@ -149,6 +149,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
|
||||||
int data_len = skb->len, ret;
|
int data_len = skb->len, ret;
|
||||||
short vid __maybe_unused = -1;
|
short vid __maybe_unused = -1;
|
||||||
bool do_bcast = false;
|
bool do_bcast = false;
|
||||||
|
uint32_t seqno;
|
||||||
|
|
||||||
if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE)
|
if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE)
|
||||||
goto dropped;
|
goto dropped;
|
||||||
|
@ -230,8 +231,8 @@ static int batadv_interface_tx(struct sk_buff *skb,
|
||||||
primary_if->net_dev->dev_addr, ETH_ALEN);
|
primary_if->net_dev->dev_addr, ETH_ALEN);
|
||||||
|
|
||||||
/* set broadcast sequence number */
|
/* set broadcast sequence number */
|
||||||
bcast_packet->seqno =
|
seqno = atomic_inc_return(&bat_priv->bcast_seqno);
|
||||||
htonl(atomic_inc_return(&bat_priv->bcast_seqno));
|
bcast_packet->seqno = htonl(seqno);
|
||||||
|
|
||||||
batadv_add_bcast_packet_to_list(bat_priv, skb, 1);
|
batadv_add_bcast_packet_to_list(bat_priv, skb, 1);
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,7 @@ batadv_frag_search_packet(struct list_head *head,
|
||||||
{
|
{
|
||||||
struct batadv_frag_packet_list_entry *tfp;
|
struct batadv_frag_packet_list_entry *tfp;
|
||||||
struct batadv_unicast_frag_packet *tmp_up = NULL;
|
struct batadv_unicast_frag_packet *tmp_up = NULL;
|
||||||
|
int is_head_tmp, is_head;
|
||||||
uint16_t search_seqno;
|
uint16_t search_seqno;
|
||||||
|
|
||||||
if (up->flags & BATADV_UNI_FRAG_HEAD)
|
if (up->flags & BATADV_UNI_FRAG_HEAD)
|
||||||
|
@ -128,6 +129,8 @@ batadv_frag_search_packet(struct list_head *head,
|
||||||
else
|
else
|
||||||
search_seqno = ntohs(up->seqno)-1;
|
search_seqno = ntohs(up->seqno)-1;
|
||||||
|
|
||||||
|
is_head = !!(up->flags & BATADV_UNI_FRAG_HEAD);
|
||||||
|
|
||||||
list_for_each_entry(tfp, head, list) {
|
list_for_each_entry(tfp, head, list) {
|
||||||
|
|
||||||
if (!tfp->skb)
|
if (!tfp->skb)
|
||||||
|
@ -139,9 +142,8 @@ batadv_frag_search_packet(struct list_head *head,
|
||||||
tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data;
|
tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data;
|
||||||
|
|
||||||
if (tfp->seqno == search_seqno) {
|
if (tfp->seqno == search_seqno) {
|
||||||
|
is_head_tmp = !!(tmp_up->flags & BATADV_UNI_FRAG_HEAD);
|
||||||
if ((tmp_up->flags & BATADV_UNI_FRAG_HEAD) !=
|
if (is_head_tmp != is_head)
|
||||||
(up->flags & BATADV_UNI_FRAG_HEAD))
|
|
||||||
return tfp;
|
return tfp;
|
||||||
else
|
else
|
||||||
goto mov_tail;
|
goto mov_tail;
|
||||||
|
@ -334,8 +336,7 @@ find_router:
|
||||||
/* copy the destination for faster routing */
|
/* copy the destination for faster routing */
|
||||||
memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN);
|
memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN);
|
||||||
/* set the destination tt version number */
|
/* set the destination tt version number */
|
||||||
unicast_packet->ttvn =
|
unicast_packet->ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn);
|
||||||
(uint8_t)atomic_read(&orig_node->last_ttvn);
|
|
||||||
|
|
||||||
/* inform the destination node that we are still missing a correct route
|
/* inform the destination node that we are still missing a correct route
|
||||||
* for this client. The destination will receive this packet and will
|
* for this client. The destination will receive this packet and will
|
||||||
|
|
|
@ -814,12 +814,12 @@ out:
|
||||||
/* called from timer; send (and maybe generate) vis packet. */
|
/* called from timer; send (and maybe generate) vis packet. */
|
||||||
static void batadv_send_vis_packets(struct work_struct *work)
|
static void batadv_send_vis_packets(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct delayed_work *delayed_work =
|
struct delayed_work *delayed_work;
|
||||||
container_of(work, struct delayed_work, work);
|
|
||||||
struct batadv_priv *bat_priv;
|
struct batadv_priv *bat_priv;
|
||||||
struct batadv_priv_vis *priv_vis;
|
struct batadv_priv_vis *priv_vis;
|
||||||
struct batadv_vis_info *info;
|
struct batadv_vis_info *info;
|
||||||
|
|
||||||
|
delayed_work = container_of(work, struct delayed_work, work);
|
||||||
priv_vis = container_of(delayed_work, struct batadv_priv_vis, work);
|
priv_vis = container_of(delayed_work, struct batadv_priv_vis, work);
|
||||||
bat_priv = container_of(priv_vis, struct batadv_priv, vis);
|
bat_priv = container_of(priv_vis, struct batadv_priv, vis);
|
||||||
spin_lock_bh(&bat_priv->vis.hash_lock);
|
spin_lock_bh(&bat_priv->vis.hash_lock);
|
||||||
|
|
Loading…
Reference in New Issue