Re: [B.A.T.M.A.N.] [PATCH] batman-adv: use CRC32C instead of CRC16 in TT code

Marek Lindner
2013-04-17T16:55:40Z

On Wednesday, April 17, 2013 02:16:05 Antonio Quartulli wrote:
> @@ -1376,13 +1376,11 @@ out:
> static uint16_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
> struct batadv_orig_node *orig_node)
> {
> - uint16_t total = 0, total_one;
> struct batadv_hashtable *hash = bat_priv->tt.global_hash;
> struct batadv_tt_common_entry *tt_common;
> struct batadv_tt_global_entry *tt_global;
> struct hlist_head *head;
> - uint32_t i;
> - int j;
> + uint32_t i, crc = 0;
>
> for (i = 0; i < hash->size; i++) {
> head = &hash->table[i];

How about making the function to "static uint32_t" ?

> /* Calculates the checksum of the local table */
> static uint16_t batadv_tt_local_crc(struct batadv_priv *bat_priv)
> {
> - uint16_t total = 0, total_one;
> struct batadv_hashtable *hash = bat_priv->tt.local_hash;
> struct batadv_tt_common_entry *tt_common;
> struct hlist_head *head;
> - uint32_t i;
> - int j;
> + uint32_t i, crc = 0;
>
> for (i = 0; i < hash->size; i++) {
> head = &hash->table[i];

Same here.

> @@ -1642,7 +1631,7 @@ out:
>
> static int batadv_send_tt_request(struct batadv_priv *bat_priv,
> struct batadv_orig_node *dst_orig_node,
> - uint8_t ttvn, uint16_t tt_crc,
> + uint8_t ttvn, uint32_t tt_crc,
> bool full_table)
> {

Kernel doc ? :)

Cheers,
Marek