fragmentation.c (b9f12a5d97f652c77ef6803dccd0d40d1290f5be) | fragmentation.c (d9124268d84a836f14a6ead54ff9d8eee4c43be5) |
---|---|
1/* Copyright (C) 2013-2014 B.A.T.M.A.N. contributors: 2 * 3 * Martin Hundebøll <martin@hundeboll.net> 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of version 2 of the GNU General Public 7 * License as published by the Free Software Foundation. 8 * --- 114 unchanged lines hidden (view full) --- 123 * to avoid locking the chain in the table. 124 */ 125static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, 126 struct sk_buff *skb, 127 struct hlist_head *chain_out) 128{ 129 struct batadv_frag_table_entry *chain; 130 struct batadv_frag_list_entry *frag_entry_new = NULL, *frag_entry_curr; | 1/* Copyright (C) 2013-2014 B.A.T.M.A.N. contributors: 2 * 3 * Martin Hundebøll <martin@hundeboll.net> 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of version 2 of the GNU General Public 7 * License as published by the Free Software Foundation. 8 * --- 114 unchanged lines hidden (view full) --- 123 * to avoid locking the chain in the table. 124 */ 125static bool batadv_frag_insert_packet(struct batadv_orig_node *orig_node, 126 struct sk_buff *skb, 127 struct hlist_head *chain_out) 128{ 129 struct batadv_frag_table_entry *chain; 130 struct batadv_frag_list_entry *frag_entry_new = NULL, *frag_entry_curr; |
131 struct batadv_frag_list_entry *frag_entry_last = NULL; |
|
131 struct batadv_frag_packet *frag_packet; 132 uint8_t bucket; 133 uint16_t seqno, hdr_size = sizeof(struct batadv_frag_packet); 134 bool ret = false; 135 136 /* Linearize packet to avoid linearizing 16 packets in a row when doing 137 * the later merge. Non-linear merge should be added to remove this 138 * linearization. --- 36 unchanged lines hidden (view full) --- 175 if (frag_entry_curr->no < frag_entry_new->no) { 176 hlist_add_before(&frag_entry_new->list, 177 &frag_entry_curr->list); 178 chain->size += skb->len - hdr_size; 179 chain->timestamp = jiffies; 180 ret = true; 181 goto out; 182 } | 132 struct batadv_frag_packet *frag_packet; 133 uint8_t bucket; 134 uint16_t seqno, hdr_size = sizeof(struct batadv_frag_packet); 135 bool ret = false; 136 137 /* Linearize packet to avoid linearizing 16 packets in a row when doing 138 * the later merge. Non-linear merge should be added to remove this 139 * linearization. --- 36 unchanged lines hidden (view full) --- 176 if (frag_entry_curr->no < frag_entry_new->no) { 177 hlist_add_before(&frag_entry_new->list, 178 &frag_entry_curr->list); 179 chain->size += skb->len - hdr_size; 180 chain->timestamp = jiffies; 181 ret = true; 182 goto out; 183 } |
184 185 /* store current entry because it could be the last in list */ 186 frag_entry_last = frag_entry_curr; |
|
183 } 184 | 187 } 188 |
185 /* Reached the end of the list, so insert after 'frag_entry_curr'. */ 186 if (likely(frag_entry_curr)) { 187 hlist_add_after(&frag_entry_curr->list, &frag_entry_new->list); | 189 /* Reached the end of the list, so insert after 'frag_entry_last'. */ 190 if (likely(frag_entry_last)) { 191 hlist_add_after(&frag_entry_last->list, &frag_entry_new->list); |
188 chain->size += skb->len - hdr_size; 189 chain->timestamp = jiffies; 190 ret = true; 191 } 192 193out: 194 if (chain->size > batadv_frag_size_limit() || 195 ntohs(frag_packet->total_size) > batadv_frag_size_limit()) { --- 299 unchanged lines hidden --- | 192 chain->size += skb->len - hdr_size; 193 chain->timestamp = jiffies; 194 ret = true; 195 } 196 197out: 198 if (chain->size > batadv_frag_size_limit() || 199 ntohs(frag_packet->total_size) > batadv_frag_size_limit()) { --- 299 unchanged lines hidden --- |