diff options
author | Sven Eckelmann <sven@narfation.org> | 2016-07-27 06:31:07 -0400 |
---|---|---|
committer | Simon Wunderlich <sw@simonwunderlich.de> | 2016-10-19 02:37:52 -0400 |
commit | 176e5b772b113f9ab013d574e13d8a433d47bbcb (patch) | |
tree | cdac0bb46e98ab5c2529499d2170813ea6521504 /net | |
parent | 422d2f77803d85477df72f3153e85fd2b8c6b9e9 (diff) |
batman-adv: Use proper name for fragments list head
The batman-adv codebase is using "list" for the list node (prev/next) and
<list content descriptor>+"_list" for the head of a list. Not using this
naming scheme can up in confusions because list_head is used for both the
head of the list and the list node (prev/next) in each item of the list.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/fragmentation.c | 14 | ||||
-rw-r--r-- | net/batman-adv/fragmentation.h | 2 | ||||
-rw-r--r-- | net/batman-adv/originator.c | 2 | ||||
-rw-r--r-- | net/batman-adv/types.h | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index 1b2f5b999b23..2b967a34703d 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c | |||
@@ -73,7 +73,7 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node, | |||
73 | spin_lock_bh(&chain->lock); | 73 | spin_lock_bh(&chain->lock); |
74 | 74 | ||
75 | if (!check_cb || check_cb(chain)) { | 75 | if (!check_cb || check_cb(chain)) { |
76 | batadv_frag_clear_chain(&chain->head); | 76 | batadv_frag_clear_chain(&chain->fragment_list); |
77 | chain->size = 0; | 77 | chain->size = 0; |
78 | } | 78 | } |
79 | 79 | ||
@@ -117,8 +117,8 @@ static bool batadv_frag_init_chain(struct batadv_frag_table_entry *chain, | |||
117 | if (chain->seqno == seqno) | 117 | if (chain->seqno == seqno) |
118 | return false; | 118 | return false; |
119 | 119 | ||
120 | if (!hlist_empty(&chain->head)) | 120 | if (!hlist_empty(&chain->fragment_list)) |
121 | batadv_frag_clear_chain(&chain->head); | 121 | batadv_frag_clear_chain(&chain->fragment_list); |
122 | 122 | ||
123 | chain->size = 0; | 123 | chain->size = 0; |
124 | chain->seqno = seqno; | 124 | chain->seqno = seqno; |
@@ -176,7 +176,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, | |||
176 | chain = &orig_node->fragments[bucket]; | 176 | chain = &orig_node->fragments[bucket]; |
177 | spin_lock_bh(&chain->lock); | 177 | spin_lock_bh(&chain->lock); |
178 | if (batadv_frag_init_chain(chain, seqno)) { | 178 | if (batadv_frag_init_chain(chain, seqno)) { |
179 | hlist_add_head(&frag_entry_new->list, &chain->head); | 179 | hlist_add_head(&frag_entry_new->list, &chain->fragment_list); |
180 | chain->size = skb->len - hdr_size; | 180 | chain->size = skb->len - hdr_size; |
181 | chain->timestamp = jiffies; | 181 | chain->timestamp = jiffies; |
182 | chain->total_size = ntohs(frag_packet->total_size); | 182 | chain->total_size = ntohs(frag_packet->total_size); |
@@ -185,7 +185,7 @@ static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, | |||
185 | } | 185 | } |
186 | 186 | ||
187 | /* Find the position for the new fragment. */ | 187 | /* Find the position for the new fragment. */ |
188 | hlist_for_each_entry(frag_entry_curr, &chain->head, list) { | 188 | hlist_for_each_entry(frag_entry_curr, &chain->fragment_list, list) { |
189 | /* Drop packet if fragment already exists. */ | 189 | /* Drop packet if fragment already exists. */ |
190 | if (frag_entry_curr->no == frag_entry_new->no) | 190 | if (frag_entry_curr->no == frag_entry_new->no) |
191 | goto err_unlock; | 191 | goto err_unlock; |
@@ -220,11 +220,11 @@ out: | |||
220 | * exceeds the maximum size of one merged packet. Don't allow | 220 | * exceeds the maximum size of one merged packet. Don't allow |
221 | * packets to have different total_size. | 221 | * packets to have different total_size. |
222 | */ | 222 | */ |
223 | batadv_frag_clear_chain(&chain->head); | 223 | batadv_frag_clear_chain(&chain->fragment_list); |
224 | chain->size = 0; | 224 | chain->size = 0; |
225 | } else if (ntohs(frag_packet->total_size) == chain->size) { | 225 | } else if (ntohs(frag_packet->total_size) == chain->size) { |
226 | /* All fragments received. Hand over chain to caller. */ | 226 | /* All fragments received. Hand over chain to caller. */ |
227 | hlist_move_list(&chain->head, chain_out); | 227 | hlist_move_list(&chain->fragment_list, chain_out); |
228 | chain->size = 0; | 228 | chain->size = 0; |
229 | } | 229 | } |
230 | 230 | ||
diff --git a/net/batman-adv/fragmentation.h b/net/batman-adv/fragmentation.h index 3202fe329e63..b95f619606af 100644 --- a/net/batman-adv/fragmentation.h +++ b/net/batman-adv/fragmentation.h | |||
@@ -47,7 +47,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, | |||
47 | static inline bool | 47 | static inline bool |
48 | batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry) | 48 | batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry) |
49 | { | 49 | { |
50 | if (!hlist_empty(&frags_entry->head) && | 50 | if (!hlist_empty(&frags_entry->fragment_list) && |
51 | batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT)) | 51 | batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT)) |
52 | return true; | 52 | return true; |
53 | return false; | 53 | return false; |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 6af87c9494f2..518b1ed87b64 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -1021,7 +1021,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv, | |||
1021 | batadv_orig_node_vlan_put(vlan); | 1021 | batadv_orig_node_vlan_put(vlan); |
1022 | 1022 | ||
1023 | for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) { | 1023 | for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) { |
1024 | INIT_HLIST_HEAD(&orig_node->fragments[i].head); | 1024 | INIT_HLIST_HEAD(&orig_node->fragments[i].fragment_list); |
1025 | spin_lock_init(&orig_node->fragments[i].lock); | 1025 | spin_lock_init(&orig_node->fragments[i].lock); |
1026 | orig_node->fragments[i].size = 0; | 1026 | orig_node->fragments[i].size = 0; |
1027 | } | 1027 | } |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 97336ec0c601..d31e7ec22a60 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
@@ -184,7 +184,7 @@ struct batadv_orig_ifinfo { | |||
184 | 184 | ||
185 | /** | 185 | /** |
186 | * struct batadv_frag_table_entry - head in the fragment buffer table | 186 | * struct batadv_frag_table_entry - head in the fragment buffer table |
187 | * @head: head of list with fragments | 187 | * @fragment_list: head of list with fragments |
188 | * @lock: lock to protect the list of fragments | 188 | * @lock: lock to protect the list of fragments |
189 | * @timestamp: time (jiffie) of last received fragment | 189 | * @timestamp: time (jiffie) of last received fragment |
190 | * @seqno: sequence number of the fragments in the list | 190 | * @seqno: sequence number of the fragments in the list |
@@ -192,8 +192,8 @@ struct batadv_orig_ifinfo { | |||
192 | * @total_size: expected size of the assembled packet | 192 | * @total_size: expected size of the assembled packet |
193 | */ | 193 | */ |
194 | struct batadv_frag_table_entry { | 194 | struct batadv_frag_table_entry { |
195 | struct hlist_head head; | 195 | struct hlist_head fragment_list; |
196 | spinlock_t lock; /* protects head */ | 196 | spinlock_t lock; /* protects fragment_list */ |
197 | unsigned long timestamp; | 197 | unsigned long timestamp; |
198 | u16 seqno; | 198 | u16 seqno; |
199 | u16 size; | 199 | u16 size; |