From patchwork Wed Jun 29 23:13:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1136 Return-Path: Received: from contumacia.investici.org (contumacia.investici.org [178.255.144.35]) by open-mesh.org (Postfix) with ESMTPS id F228D15441B for ; Thu, 30 Jun 2011 01:21:08 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [178.255.144.35] (contumacia [178.255.144.35]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 97258E82F7; Wed, 29 Jun 2011 23:21:04 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 contumacia.investici.org 97258E82F7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1309389666; bh=mq/++wfwXa2EM8ksSIYrwfOMxgpo38o0x2cGI4HU1h4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ZwEteBLcSvKBCpO4Pi8wwcqR2EZ/iwhghsyiVTi3/ZZwDx7gK23RKRcVvlrnYTQSk pCht8nxRmLHUJRlSAbLGTRRJaaHwu7jfYIQidZdZDObA67kfIHTcsI4j+3ws5fuxKE iL4N5199oDm+cRvsnroR8nJguZu0aALX7aoETciE= From: Antonio Quartulli To: "B.A.T.M.A.N" Date: Thu, 30 Jun 2011 01:13:59 +0200 Message-Id: <1309389240-11486-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1309127157-32507-1-git-send-email-ordex@autistici.org> References: <1309127157-32507-1-git-send-email-ordex@autistici.org> Subject: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: split tt_local/global_entry flags field for local and remote computations X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2011 23:21:09 -0000 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 --- packet.h | 10 ++++++---- types.h | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packet.h b/packet.h index 8fd2fde..590e4a6 100644 --- a/packet.h +++ b/packet.h @@ -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 { diff --git a/types.h b/types.h index 582283a..25bd1db 100644 --- a/types.h +++ b/types.h @@ -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;