Skip to contentSkip to conversation

batman-adv: use CRC32C instead of CRC16 in TT code

PATCH New Antonio Quartulli 1 participant 1 message Apr 19, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 batman-adv: use CRC32C instead of CRC16 in TT code

CRC32C has to be preferred to CRC16 because of its possible HW native support and because of its less likely probability of collision. With this change the Translation Table component now uses CRC32C to compute the Local and Global Table checksum.

---

v3:
- added kernel doc

 packet.h            |  4 +--
 translation-table.c | 71 ++++++++++++++++++++++++++++-------------------------
 types.h             |  4 +--
 3 files changed, 42 insertions(+), 37 deletions(-)
packet.h +2 -2
index 27424e1..e24daa6 100644
@@ -360,12 +360,12 @@ struct batadv_tvlv_long {
  * struct tvlv_tt_data - tt data propagated through the tt tvlv container
  * @flags: translation table flags (see batadv_tt_data_flags)
  * @ttvn: translation table version number
- * @crc: crc16 checksum of the local translation table
+ * @crc: crc32 checksum of the local translation table
  */
 struct batadv_tvlv_tt_data {
 	uint8_t flags;
 	uint8_t ttvn;
-	__be16  crc;
+	__be32  crc;
 };
 
 /**
translation-table.c +38 -33

177 lines not on this page · raw message

types.h +2 -2
index 1548372..0c77d67 100644
@@ -152,7 +152,7 @@ struct batadv_orig_node {
 	uint8_t flags;
 	uint8_t capabilities;
 	atomic_t last_ttvn;
-	uint16_t tt_crc;
+	uint32_t tt_crc;
 	unsigned char *tt_buff;
 	int16_t tt_buff_len;
 	spinlock_t tt_buff_lock; /* protects tt_buff & tt_buff_len */
@@ -375,7 +375,7 @@ struct batadv_priv_tt {
 	spinlock_t req_list_lock; /* protects req_list */
 	spinlock_t roam_list_lock; /* protects roam_list */
 	atomic_t local_entry_num;
-	uint16_t local_crc;
+	uint32_t local_crc;
 	unsigned char *last_changeset;
 	int16_t last_changeset_len;
 	/* protects last_changeset & last_changeset_len */
Signature · 1 line
1.8.1.5