Loading net/batman-adv/distributed-arp-table.c +17 −2 Original line number Diff line number Diff line Loading @@ -601,9 +601,22 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv, send_status = batadv_send_skb_packet(tmp_skb, neigh_node->if_incoming, neigh_node->addr); if (send_status == NET_XMIT_SUCCESS) if (send_status == NET_XMIT_SUCCESS) { /* count the sent packet */ switch (packet_subtype) { case BATADV_P_DAT_DHT_GET: batadv_inc_counter(bat_priv, BATADV_CNT_DAT_GET_TX); break; case BATADV_P_DAT_DHT_PUT: batadv_inc_counter(bat_priv, BATADV_CNT_DAT_PUT_TX); break; } /* packet sent to a candidate: return true */ ret = true; } free_neigh: batadv_neigh_node_free_ref(neigh_node); free_orig: Loading Loading @@ -909,8 +922,10 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, else err = batadv_unicast_send_skb(bat_priv, skb_new); if (!err) if (!err) { batadv_inc_counter(bat_priv, BATADV_CNT_DAT_CACHED_REPLY_TX); ret = true; } out: if (dat_entry) batadv_dat_entry_free_ref(dat_entry); Loading net/batman-adv/distributed-arp-table.h +27 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,28 @@ int batadv_dat_init(struct batadv_priv *bat_priv); void batadv_dat_free(struct batadv_priv *bat_priv); int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset); /** * batadv_dat_inc_counter - increment the correct DAT packet counter * @bat_priv: the bat priv with all the soft interface information * @subtype: the 4addr subtype of the packet to be counted * * Updates the ethtool statistics for the received packet if it is a DAT subtype */ static inline void batadv_dat_inc_counter(struct batadv_priv *bat_priv, uint8_t subtype) { switch (subtype) { case BATADV_P_DAT_DHT_GET: batadv_inc_counter(bat_priv, BATADV_CNT_DAT_GET_RX); break; case BATADV_P_DAT_DHT_PUT: batadv_inc_counter(bat_priv, BATADV_CNT_DAT_PUT_RX); break; } } #else static inline bool Loading Loading @@ -135,6 +157,11 @@ static inline void batadv_dat_free(struct batadv_priv *bat_priv) { } static inline void batadv_dat_inc_counter(struct batadv_priv *bat_priv, uint8_t subtype) { } #endif /* CONFIG_BATMAN_ADV_DAT */ #endif /* _NET_BATMAN_ADV_ARP_H_ */ net/batman-adv/routing.c +7 −1 Original line number Diff line number Diff line Loading @@ -985,15 +985,17 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, { struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct batadv_unicast_packet *unicast_packet; struct batadv_unicast_4addr_packet *unicast_4addr_packet; int hdr_size = sizeof(*unicast_packet); bool is4addr; unicast_packet = (struct batadv_unicast_packet *)skb->data; unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data; is4addr = unicast_packet->header.packet_type == BATADV_UNICAST_4ADDR; /* the caller function should have already pulled 2 bytes */ if (is4addr) hdr_size = sizeof(struct batadv_unicast_4addr_packet); hdr_size = sizeof(*unicast_4addr_packet); if (batadv_check_unicast_packet(skb, hdr_size) < 0) return NET_RX_DROP; Loading @@ -1003,6 +1005,10 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, /* packet for me */ if (batadv_is_my_mac(unicast_packet->dest)) { if (is4addr) batadv_dat_inc_counter(bat_priv, unicast_4addr_packet->subtype); if (batadv_dat_snoop_incoming_arp_request(bat_priv, skb, hdr_size)) goto rx_success; Loading net/batman-adv/soft-interface.c +7 −0 Original line number Diff line number Diff line Loading @@ -625,6 +625,13 @@ static const struct { { "tt_response_rx" }, { "tt_roam_adv_tx" }, { "tt_roam_adv_rx" }, #ifdef CONFIG_BATMAN_ADV_DAT { "dat_get_tx" }, { "dat_get_rx" }, { "dat_put_tx" }, { "dat_put_rx" }, { "dat_cached_reply_tx" }, #endif }; static void batadv_get_strings(struct net_device *dev, uint32_t stringset, Loading net/batman-adv/types.h +7 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,13 @@ enum batadv_counters { BATADV_CNT_TT_RESPONSE_RX, BATADV_CNT_TT_ROAM_ADV_TX, BATADV_CNT_TT_ROAM_ADV_RX, #ifdef CONFIG_BATMAN_ADV_DAT BATADV_CNT_DAT_GET_TX, BATADV_CNT_DAT_GET_RX, BATADV_CNT_DAT_PUT_TX, BATADV_CNT_DAT_PUT_RX, BATADV_CNT_DAT_CACHED_REPLY_TX, #endif BATADV_CNT_NUM, }; Loading Loading
net/batman-adv/distributed-arp-table.c +17 −2 Original line number Diff line number Diff line Loading @@ -601,9 +601,22 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv, send_status = batadv_send_skb_packet(tmp_skb, neigh_node->if_incoming, neigh_node->addr); if (send_status == NET_XMIT_SUCCESS) if (send_status == NET_XMIT_SUCCESS) { /* count the sent packet */ switch (packet_subtype) { case BATADV_P_DAT_DHT_GET: batadv_inc_counter(bat_priv, BATADV_CNT_DAT_GET_TX); break; case BATADV_P_DAT_DHT_PUT: batadv_inc_counter(bat_priv, BATADV_CNT_DAT_PUT_TX); break; } /* packet sent to a candidate: return true */ ret = true; } free_neigh: batadv_neigh_node_free_ref(neigh_node); free_orig: Loading Loading @@ -909,8 +922,10 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv, else err = batadv_unicast_send_skb(bat_priv, skb_new); if (!err) if (!err) { batadv_inc_counter(bat_priv, BATADV_CNT_DAT_CACHED_REPLY_TX); ret = true; } out: if (dat_entry) batadv_dat_entry_free_ref(dat_entry); Loading
net/batman-adv/distributed-arp-table.h +27 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,28 @@ int batadv_dat_init(struct batadv_priv *bat_priv); void batadv_dat_free(struct batadv_priv *bat_priv); int batadv_dat_cache_seq_print_text(struct seq_file *seq, void *offset); /** * batadv_dat_inc_counter - increment the correct DAT packet counter * @bat_priv: the bat priv with all the soft interface information * @subtype: the 4addr subtype of the packet to be counted * * Updates the ethtool statistics for the received packet if it is a DAT subtype */ static inline void batadv_dat_inc_counter(struct batadv_priv *bat_priv, uint8_t subtype) { switch (subtype) { case BATADV_P_DAT_DHT_GET: batadv_inc_counter(bat_priv, BATADV_CNT_DAT_GET_RX); break; case BATADV_P_DAT_DHT_PUT: batadv_inc_counter(bat_priv, BATADV_CNT_DAT_PUT_RX); break; } } #else static inline bool Loading Loading @@ -135,6 +157,11 @@ static inline void batadv_dat_free(struct batadv_priv *bat_priv) { } static inline void batadv_dat_inc_counter(struct batadv_priv *bat_priv, uint8_t subtype) { } #endif /* CONFIG_BATMAN_ADV_DAT */ #endif /* _NET_BATMAN_ADV_ARP_H_ */
net/batman-adv/routing.c +7 −1 Original line number Diff line number Diff line Loading @@ -985,15 +985,17 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, { struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); struct batadv_unicast_packet *unicast_packet; struct batadv_unicast_4addr_packet *unicast_4addr_packet; int hdr_size = sizeof(*unicast_packet); bool is4addr; unicast_packet = (struct batadv_unicast_packet *)skb->data; unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data; is4addr = unicast_packet->header.packet_type == BATADV_UNICAST_4ADDR; /* the caller function should have already pulled 2 bytes */ if (is4addr) hdr_size = sizeof(struct batadv_unicast_4addr_packet); hdr_size = sizeof(*unicast_4addr_packet); if (batadv_check_unicast_packet(skb, hdr_size) < 0) return NET_RX_DROP; Loading @@ -1003,6 +1005,10 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, /* packet for me */ if (batadv_is_my_mac(unicast_packet->dest)) { if (is4addr) batadv_dat_inc_counter(bat_priv, unicast_4addr_packet->subtype); if (batadv_dat_snoop_incoming_arp_request(bat_priv, skb, hdr_size)) goto rx_success; Loading
net/batman-adv/soft-interface.c +7 −0 Original line number Diff line number Diff line Loading @@ -625,6 +625,13 @@ static const struct { { "tt_response_rx" }, { "tt_roam_adv_tx" }, { "tt_roam_adv_rx" }, #ifdef CONFIG_BATMAN_ADV_DAT { "dat_get_tx" }, { "dat_get_rx" }, { "dat_put_tx" }, { "dat_put_rx" }, { "dat_cached_reply_tx" }, #endif }; static void batadv_get_strings(struct net_device *dev, uint32_t stringset, Loading
net/batman-adv/types.h +7 −0 Original line number Diff line number Diff line Loading @@ -186,6 +186,13 @@ enum batadv_counters { BATADV_CNT_TT_RESPONSE_RX, BATADV_CNT_TT_ROAM_ADV_TX, BATADV_CNT_TT_ROAM_ADV_RX, #ifdef CONFIG_BATMAN_ADV_DAT BATADV_CNT_DAT_GET_TX, BATADV_CNT_DAT_GET_RX, BATADV_CNT_DAT_PUT_TX, BATADV_CNT_DAT_PUT_RX, BATADV_CNT_DAT_CACHED_REPLY_TX, #endif BATADV_CNT_NUM, }; Loading