[1/2] batman-adv: split tt_local/global_entry flags field for local and remote computations
Commit Message
The tt_global/local_entry 'flags' field contains flags used either for
local and remote computations. To optimise the usage of this field, its
length has been increased to 16bit in order to use the eight leading bits
(from 0 to 7) to store flags that have to be sent on the wire, while the
eight ending ones are used for local computation only.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
packet.h | 10 ++++++----
types.h | 4 ++--
2 files changed, 8 insertions(+), 6 deletions(-)
Comments
On Thursday, June 30, 2011 01:13:59 Antonio Quartulli wrote:
> The tt_global/local_entry 'flags' field contains flags used either for
> local and remote computations. To optimise the usage of this field, its
> length has been increased to 16bit in order to use the eight leading bits
> (from 0 to 7) to store flags that have to be sent on the wire, while the
> eight ending ones are used for local computation only.
Applied in revision 68f78c7.
Thanks,
Marek
@@ -78,11 +78,13 @@ enum tt_query_flags {
TT_FULL_TABLE = 1 << 2
};
-/* TT_CLIENT flags */
+/* TT_CLIENT flags.
+ * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to
+ * 1 << 15 are used for local computation only */
enum tt_client_flags {
- TT_CLIENT_DEL = 0x01,
- TT_CLIENT_ROAM = 0x02,
- TT_CLIENT_NOPURGE = 0x04
+ TT_CLIENT_DEL = 1 << 0,
+ TT_CLIENT_ROAM = 1 << 1,
+ TT_CLIENT_NOPURGE = 1 << 8
};
struct batman_packet {
@@ -224,7 +224,7 @@ struct socket_packet {
struct tt_local_entry {
uint8_t addr[ETH_ALEN];
unsigned long last_seen;
- uint8_t flags;
+ uint16_t flags;
atomic_t refcount;
struct rcu_head rcu;
struct hlist_node hash_entry;
@@ -234,7 +234,7 @@ struct tt_global_entry {
uint8_t addr[ETH_ALEN];
struct orig_node *orig_node;
uint8_t ttvn;
- uint8_t flags; /* only TT_GLOBAL_ROAM is used */
+ uint16_t flags; /* only TT_GLOBAL_ROAM is used */
unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */
atomic_t refcount;
struct rcu_head rcu;