/* 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);
}
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);
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
}
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
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;
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 */
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);
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;
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;
}
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;
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;
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;
"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;
};
#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 {