Loading net/batman-adv/aggregation.c +12 −11 Original line number Original line Diff line number Diff line Loading @@ -26,18 +26,18 @@ #include "hard-interface.h" #include "hard-interface.h" /* calculate the size of the tt information for a given packet */ /* calculate the size of the tt information for a given packet */ static int tt_len(struct batman_packet *batman_packet) static int tt_len(const struct batman_packet *batman_packet) { { return batman_packet->num_tt * ETH_ALEN; return batman_packet->num_tt * ETH_ALEN; } } /* return true if new_packet can be aggregated with forw_packet */ /* return true if new_packet can be aggregated with forw_packet */ static bool can_aggregate_with(struct batman_packet *new_batman_packet, static bool can_aggregate_with(const struct batman_packet *new_batman_packet, int packet_len, int packet_len, unsigned long send_time, unsigned long send_time, bool directlink, bool directlink, struct hard_iface *if_incoming, const struct hard_iface *if_incoming, struct forw_packet *forw_packet) const struct forw_packet *forw_packet) { { struct batman_packet *batman_packet = struct batman_packet *batman_packet = (struct batman_packet *)forw_packet->skb->data; (struct batman_packet *)forw_packet->skb->data; Loading Loading @@ -97,8 +97,9 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet, } } /* create a new aggregated packet and add this packet to it */ /* create a new aggregated packet and add this packet to it */ static void new_aggregated_packet(unsigned char *packet_buff, int packet_len, static void new_aggregated_packet(const unsigned char *packet_buff, unsigned long send_time, bool direct_link, int packet_len, unsigned long send_time, bool direct_link, struct hard_iface *if_incoming, struct hard_iface *if_incoming, int own_packet) int own_packet) { { Loading @@ -118,7 +119,7 @@ static void new_aggregated_packet(unsigned char *packet_buff, int packet_len, } } } } forw_packet_aggr = kmalloc(sizeof(struct forw_packet), GFP_ATOMIC); forw_packet_aggr = kmalloc(sizeof(*forw_packet_aggr), GFP_ATOMIC); if (!forw_packet_aggr) { if (!forw_packet_aggr) { if (!own_packet) if (!own_packet) atomic_inc(&bat_priv->batman_queue_left); atomic_inc(&bat_priv->batman_queue_left); Loading Loading @@ -176,8 +177,7 @@ static void new_aggregated_packet(unsigned char *packet_buff, int packet_len, /* aggregate a new packet into the existing aggregation */ /* aggregate a new packet into the existing aggregation */ static void aggregate(struct forw_packet *forw_packet_aggr, static void aggregate(struct forw_packet *forw_packet_aggr, unsigned char *packet_buff, const unsigned char *packet_buff, int packet_len, int packet_len, bool direct_link) bool direct_link) { { unsigned char *skb_buff; unsigned char *skb_buff; Loading Loading @@ -253,8 +253,9 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, } } /* unpack the aggregated packets and process them one by one */ /* unpack the aggregated packets and process them one by one */ void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, void receive_aggr_bat_packet(const struct ethhdr *ethhdr, int packet_len, struct hard_iface *if_incoming) unsigned char *packet_buff, int packet_len, struct hard_iface *if_incoming) { { struct batman_packet *batman_packet; struct batman_packet *batman_packet; int buff_pos = 0; int buff_pos = 0; Loading net/batman-adv/aggregation.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -37,7 +37,8 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, unsigned char *packet_buff, int packet_len, unsigned char *packet_buff, int packet_len, struct hard_iface *if_incoming, char own_packet, struct hard_iface *if_incoming, char own_packet, unsigned long send_time); unsigned long send_time); void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, void receive_aggr_bat_packet(const struct ethhdr *ethhdr, int packet_len, struct hard_iface *if_incoming); unsigned char *packet_buff, int packet_len, struct hard_iface *if_incoming); #endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */ #endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */ net/batman-adv/bat_debugfs.c +6 −5 Original line number Original line Diff line number Diff line Loading @@ -50,7 +50,8 @@ static void emit_log_char(struct debug_log *debug_log, char c) debug_log->log_start = debug_log->log_end - log_buff_len; debug_log->log_start = debug_log->log_end - log_buff_len; } } static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) __printf(2, 3) static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...) { { va_list args; va_list args; static char debug_log_buf[256]; static char debug_log_buf[256]; Loading @@ -74,14 +75,14 @@ static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) return 0; return 0; } } int debug_log(struct bat_priv *bat_priv, char *fmt, ...) int debug_log(struct bat_priv *bat_priv, const char *fmt, ...) { { va_list args; va_list args; char tmp_log_buf[256]; char tmp_log_buf[256]; va_start(args, fmt); va_start(args, fmt); vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); fdebug_log(bat_priv->debug_log, "[%10u] %s", fdebug_log(bat_priv->debug_log, "[%10lu] %s", (jiffies / HZ), tmp_log_buf); (jiffies / HZ), tmp_log_buf); va_end(args); va_end(args); Loading Loading @@ -114,7 +115,7 @@ static ssize_t log_read(struct file *file, char __user *buf, !(debug_log->log_end - debug_log->log_start)) !(debug_log->log_end - debug_log->log_start)) return -EAGAIN; return -EAGAIN; if ((!buf) || (count < 0)) if (!buf) return -EINVAL; return -EINVAL; if (count == 0) if (count == 0) Loading Loading @@ -184,7 +185,7 @@ static int debug_log_setup(struct bat_priv *bat_priv) if (!bat_priv->debug_dir) if (!bat_priv->debug_dir) goto err; goto err; bat_priv->debug_log = kzalloc(sizeof(struct debug_log), GFP_ATOMIC); bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC); if (!bat_priv->debug_log) if (!bat_priv->debug_log) goto err; goto err; Loading net/batman-adv/bat_sysfs.c +7 −8 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ ssize_t show_##_name(struct kobject *kobj, struct attribute *attr, \ static int store_bool_attr(char *buff, size_t count, static int store_bool_attr(char *buff, size_t count, struct net_device *net_dev, struct net_device *net_dev, char *attr_name, atomic_t *attr) const char *attr_name, atomic_t *attr) { { int enabled = -1; int enabled = -1; Loading Loading @@ -138,16 +138,15 @@ static inline ssize_t __store_bool_attr(char *buff, size_t count, { { int ret; int ret; ret = store_bool_attr(buff, count, net_dev, (char *)attr->name, ret = store_bool_attr(buff, count, net_dev, attr->name, attr_store); attr_store); if (post_func && ret) if (post_func && ret) post_func(net_dev); post_func(net_dev); return ret; return ret; } } static int store_uint_attr(char *buff, size_t count, static int store_uint_attr(const char *buff, size_t count, struct net_device *net_dev, char *attr_name, struct net_device *net_dev, const char *attr_name, unsigned int min, unsigned int max, atomic_t *attr) unsigned int min, unsigned int max, atomic_t *attr) { { unsigned long uint_val; unsigned long uint_val; Loading Loading @@ -183,15 +182,15 @@ static int store_uint_attr(char *buff, size_t count, return count; return count; } } static inline ssize_t __store_uint_attr(char *buff, size_t count, static inline ssize_t __store_uint_attr(const char *buff, size_t count, int min, int max, int min, int max, void (*post_func)(struct net_device *), void (*post_func)(struct net_device *), struct attribute *attr, const struct attribute *attr, atomic_t *attr_store, struct net_device *net_dev) atomic_t *attr_store, struct net_device *net_dev) { { int ret; int ret; ret = store_uint_attr(buff, count, net_dev, (char *)attr->name, ret = store_uint_attr(buff, count, net_dev, attr->name, min, max, attr_store); min, max, attr_store); if (post_func && ret) if (post_func && ret) post_func(net_dev); post_func(net_dev); Loading net/batman-adv/bitarray.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,7 @@ /* returns true if the corresponding bit in the given seq_bits indicates true /* returns true if the corresponding bit in the given seq_bits indicates true * and curr_seqno is within range of last_seqno */ * and curr_seqno is within range of last_seqno */ uint8_t get_bit_status(unsigned long *seq_bits, uint32_t last_seqno, uint8_t get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno, uint32_t curr_seqno) uint32_t curr_seqno) { { int32_t diff, word_offset, word_num; int32_t diff, word_offset, word_num; Loading Loading @@ -130,7 +130,7 @@ static void bit_reset_window(unsigned long *seq_bits) char bit_get_packet(void *priv, unsigned long *seq_bits, char bit_get_packet(void *priv, unsigned long *seq_bits, int32_t seq_num_diff, int8_t set_mark) int32_t seq_num_diff, int8_t set_mark) { { struct bat_priv *bat_priv = (struct bat_priv *)priv; struct bat_priv *bat_priv = priv; /* sequence number is slightly older. We already got a sequence number /* sequence number is slightly older. We already got a sequence number * higher than this one, so we just mark it. */ * higher than this one, so we just mark it. */ Loading Loading @@ -190,7 +190,7 @@ char bit_get_packet(void *priv, unsigned long *seq_bits, /* count the hamming weight, how many good packets did we receive? just count /* count the hamming weight, how many good packets did we receive? just count * the 1's. * the 1's. */ */ int bit_packet_count(unsigned long *seq_bits) int bit_packet_count(const unsigned long *seq_bits) { { int i, hamming = 0; int i, hamming = 0; Loading Loading
net/batman-adv/aggregation.c +12 −11 Original line number Original line Diff line number Diff line Loading @@ -26,18 +26,18 @@ #include "hard-interface.h" #include "hard-interface.h" /* calculate the size of the tt information for a given packet */ /* calculate the size of the tt information for a given packet */ static int tt_len(struct batman_packet *batman_packet) static int tt_len(const struct batman_packet *batman_packet) { { return batman_packet->num_tt * ETH_ALEN; return batman_packet->num_tt * ETH_ALEN; } } /* return true if new_packet can be aggregated with forw_packet */ /* return true if new_packet can be aggregated with forw_packet */ static bool can_aggregate_with(struct batman_packet *new_batman_packet, static bool can_aggregate_with(const struct batman_packet *new_batman_packet, int packet_len, int packet_len, unsigned long send_time, unsigned long send_time, bool directlink, bool directlink, struct hard_iface *if_incoming, const struct hard_iface *if_incoming, struct forw_packet *forw_packet) const struct forw_packet *forw_packet) { { struct batman_packet *batman_packet = struct batman_packet *batman_packet = (struct batman_packet *)forw_packet->skb->data; (struct batman_packet *)forw_packet->skb->data; Loading Loading @@ -97,8 +97,9 @@ static bool can_aggregate_with(struct batman_packet *new_batman_packet, } } /* create a new aggregated packet and add this packet to it */ /* create a new aggregated packet and add this packet to it */ static void new_aggregated_packet(unsigned char *packet_buff, int packet_len, static void new_aggregated_packet(const unsigned char *packet_buff, unsigned long send_time, bool direct_link, int packet_len, unsigned long send_time, bool direct_link, struct hard_iface *if_incoming, struct hard_iface *if_incoming, int own_packet) int own_packet) { { Loading @@ -118,7 +119,7 @@ static void new_aggregated_packet(unsigned char *packet_buff, int packet_len, } } } } forw_packet_aggr = kmalloc(sizeof(struct forw_packet), GFP_ATOMIC); forw_packet_aggr = kmalloc(sizeof(*forw_packet_aggr), GFP_ATOMIC); if (!forw_packet_aggr) { if (!forw_packet_aggr) { if (!own_packet) if (!own_packet) atomic_inc(&bat_priv->batman_queue_left); atomic_inc(&bat_priv->batman_queue_left); Loading Loading @@ -176,8 +177,7 @@ static void new_aggregated_packet(unsigned char *packet_buff, int packet_len, /* aggregate a new packet into the existing aggregation */ /* aggregate a new packet into the existing aggregation */ static void aggregate(struct forw_packet *forw_packet_aggr, static void aggregate(struct forw_packet *forw_packet_aggr, unsigned char *packet_buff, const unsigned char *packet_buff, int packet_len, int packet_len, bool direct_link) bool direct_link) { { unsigned char *skb_buff; unsigned char *skb_buff; Loading Loading @@ -253,8 +253,9 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, } } /* unpack the aggregated packets and process them one by one */ /* unpack the aggregated packets and process them one by one */ void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, void receive_aggr_bat_packet(const struct ethhdr *ethhdr, int packet_len, struct hard_iface *if_incoming) unsigned char *packet_buff, int packet_len, struct hard_iface *if_incoming) { { struct batman_packet *batman_packet; struct batman_packet *batman_packet; int buff_pos = 0; int buff_pos = 0; Loading
net/batman-adv/aggregation.h +3 −2 Original line number Original line Diff line number Diff line Loading @@ -37,7 +37,8 @@ void add_bat_packet_to_list(struct bat_priv *bat_priv, unsigned char *packet_buff, int packet_len, unsigned char *packet_buff, int packet_len, struct hard_iface *if_incoming, char own_packet, struct hard_iface *if_incoming, char own_packet, unsigned long send_time); unsigned long send_time); void receive_aggr_bat_packet(struct ethhdr *ethhdr, unsigned char *packet_buff, void receive_aggr_bat_packet(const struct ethhdr *ethhdr, int packet_len, struct hard_iface *if_incoming); unsigned char *packet_buff, int packet_len, struct hard_iface *if_incoming); #endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */ #endif /* _NET_BATMAN_ADV_AGGREGATION_H_ */
net/batman-adv/bat_debugfs.c +6 −5 Original line number Original line Diff line number Diff line Loading @@ -50,7 +50,8 @@ static void emit_log_char(struct debug_log *debug_log, char c) debug_log->log_start = debug_log->log_end - log_buff_len; debug_log->log_start = debug_log->log_end - log_buff_len; } } static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) __printf(2, 3) static int fdebug_log(struct debug_log *debug_log, const char *fmt, ...) { { va_list args; va_list args; static char debug_log_buf[256]; static char debug_log_buf[256]; Loading @@ -74,14 +75,14 @@ static int fdebug_log(struct debug_log *debug_log, char *fmt, ...) return 0; return 0; } } int debug_log(struct bat_priv *bat_priv, char *fmt, ...) int debug_log(struct bat_priv *bat_priv, const char *fmt, ...) { { va_list args; va_list args; char tmp_log_buf[256]; char tmp_log_buf[256]; va_start(args, fmt); va_start(args, fmt); vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args); fdebug_log(bat_priv->debug_log, "[%10u] %s", fdebug_log(bat_priv->debug_log, "[%10lu] %s", (jiffies / HZ), tmp_log_buf); (jiffies / HZ), tmp_log_buf); va_end(args); va_end(args); Loading Loading @@ -114,7 +115,7 @@ static ssize_t log_read(struct file *file, char __user *buf, !(debug_log->log_end - debug_log->log_start)) !(debug_log->log_end - debug_log->log_start)) return -EAGAIN; return -EAGAIN; if ((!buf) || (count < 0)) if (!buf) return -EINVAL; return -EINVAL; if (count == 0) if (count == 0) Loading Loading @@ -184,7 +185,7 @@ static int debug_log_setup(struct bat_priv *bat_priv) if (!bat_priv->debug_dir) if (!bat_priv->debug_dir) goto err; goto err; bat_priv->debug_log = kzalloc(sizeof(struct debug_log), GFP_ATOMIC); bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC); if (!bat_priv->debug_log) if (!bat_priv->debug_log) goto err; goto err; Loading
net/batman-adv/bat_sysfs.c +7 −8 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ ssize_t show_##_name(struct kobject *kobj, struct attribute *attr, \ static int store_bool_attr(char *buff, size_t count, static int store_bool_attr(char *buff, size_t count, struct net_device *net_dev, struct net_device *net_dev, char *attr_name, atomic_t *attr) const char *attr_name, atomic_t *attr) { { int enabled = -1; int enabled = -1; Loading Loading @@ -138,16 +138,15 @@ static inline ssize_t __store_bool_attr(char *buff, size_t count, { { int ret; int ret; ret = store_bool_attr(buff, count, net_dev, (char *)attr->name, ret = store_bool_attr(buff, count, net_dev, attr->name, attr_store); attr_store); if (post_func && ret) if (post_func && ret) post_func(net_dev); post_func(net_dev); return ret; return ret; } } static int store_uint_attr(char *buff, size_t count, static int store_uint_attr(const char *buff, size_t count, struct net_device *net_dev, char *attr_name, struct net_device *net_dev, const char *attr_name, unsigned int min, unsigned int max, atomic_t *attr) unsigned int min, unsigned int max, atomic_t *attr) { { unsigned long uint_val; unsigned long uint_val; Loading Loading @@ -183,15 +182,15 @@ static int store_uint_attr(char *buff, size_t count, return count; return count; } } static inline ssize_t __store_uint_attr(char *buff, size_t count, static inline ssize_t __store_uint_attr(const char *buff, size_t count, int min, int max, int min, int max, void (*post_func)(struct net_device *), void (*post_func)(struct net_device *), struct attribute *attr, const struct attribute *attr, atomic_t *attr_store, struct net_device *net_dev) atomic_t *attr_store, struct net_device *net_dev) { { int ret; int ret; ret = store_uint_attr(buff, count, net_dev, (char *)attr->name, ret = store_uint_attr(buff, count, net_dev, attr->name, min, max, attr_store); min, max, attr_store); if (post_func && ret) if (post_func && ret) post_func(net_dev); post_func(net_dev); Loading
net/batman-adv/bitarray.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,7 @@ /* returns true if the corresponding bit in the given seq_bits indicates true /* returns true if the corresponding bit in the given seq_bits indicates true * and curr_seqno is within range of last_seqno */ * and curr_seqno is within range of last_seqno */ uint8_t get_bit_status(unsigned long *seq_bits, uint32_t last_seqno, uint8_t get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno, uint32_t curr_seqno) uint32_t curr_seqno) { { int32_t diff, word_offset, word_num; int32_t diff, word_offset, word_num; Loading Loading @@ -130,7 +130,7 @@ static void bit_reset_window(unsigned long *seq_bits) char bit_get_packet(void *priv, unsigned long *seq_bits, char bit_get_packet(void *priv, unsigned long *seq_bits, int32_t seq_num_diff, int8_t set_mark) int32_t seq_num_diff, int8_t set_mark) { { struct bat_priv *bat_priv = (struct bat_priv *)priv; struct bat_priv *bat_priv = priv; /* sequence number is slightly older. We already got a sequence number /* sequence number is slightly older. We already got a sequence number * higher than this one, so we just mark it. */ * higher than this one, so we just mark it. */ Loading Loading @@ -190,7 +190,7 @@ char bit_get_packet(void *priv, unsigned long *seq_bits, /* count the hamming weight, how many good packets did we receive? just count /* count the hamming weight, how many good packets did we receive? just count * the 1's. * the 1's. */ */ int bit_packet_count(unsigned long *seq_bits) int bit_packet_count(const unsigned long *seq_bits) { { int i, hamming = 0; int i, hamming = 0; Loading