[2/3] batman-adv: Correct gw_speed down bit mask

Message ID 1275519516-21394-2-git-send-email-sven.eckelmann@gmx.de (mailing list archive)
State Accepted, archived
Headers

Commit Message

Sven Eckelmann June 2, 2010, 10:58 p.m. UTC
  We want to get bits .OOOO... and not as the mask would suggest .OOOOO..
when we decode the encoded bits for the download part of the gateway
speed.

Reported-By: Bill Meier <wmeier@newsguy.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman-adv-kernelland/gateway_common.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
  

Comments

Simon Wunderlich June 5, 2010, 5:57 p.m. UTC | #1
Thanks, committed in r1690.

On Thu, Jun 03, 2010 at 12:58:35AM +0200, Sven Eckelmann wrote:
> We want to get bits .OOOO... and not as the mask would suggest .OOOOO..
> when we decode the encoded bits for the download part of the gateway
> speed.
> 
> Reported-By: Bill Meier <wmeier@newsguy.com>
> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
> ---
>  batman-adv-kernelland/gateway_common.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/batman-adv-kernelland/gateway_common.c b/batman-adv-kernelland/gateway_common.c
> index d542306..270cf3d 100644
> --- a/batman-adv-kernelland/gateway_common.c
> +++ b/batman-adv-kernelland/gateway_common.c
> @@ -63,7 +63,7 @@ static void kbit_to_gw_srv_class(int down, int up, long *gw_srv_class)
>  void gw_srv_class_to_kbit(uint8_t gw_srv_class, int *down, int *up)
>  {
>  	char sbit = (gw_srv_class & 0x80) >> 7;
> -	char dpart = (gw_srv_class & 0x7C) >> 3;
> +	char dpart = (gw_srv_class & 0x78) >> 3;
>  	char upart = (gw_srv_class & 0x07);
>  
>  	if (!gw_srv_class) {
> -- 
> 1.7.1
> 
>
  

Patch

diff --git a/batman-adv-kernelland/gateway_common.c b/batman-adv-kernelland/gateway_common.c
index d542306..270cf3d 100644
--- a/batman-adv-kernelland/gateway_common.c
+++ b/batman-adv-kernelland/gateway_common.c
@@ -63,7 +63,7 @@  static void kbit_to_gw_srv_class(int down, int up, long *gw_srv_class)
 void gw_srv_class_to_kbit(uint8_t gw_srv_class, int *down, int *up)
 {
 	char sbit = (gw_srv_class & 0x80) >> 7;
-	char dpart = (gw_srv_class & 0x7C) >> 3;
+	char dpart = (gw_srv_class & 0x78) >> 3;
 	char upart = (gw_srv_class & 0x07);
 
 	if (!gw_srv_class) {