lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1268754720.3094.55.camel@edumazet-laptop>
Date:	Tue, 16 Mar 2010 16:52:00 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Yegor Yefremov <yegorslists@...glemail.com>
Cc:	netdev <netdev@...r.kernel.org>, davem@...emloft.net
Subject: Re: [PATCH 1/1] KS8695: update ksp->next_rx_desc_read at the end
 of rx loop

Le mardi 16 mars 2010 à 16:42 +0100, Yegor Yefremov a écrit :
> KS8695: update ksp->next_rx_desc_read at the end of rx loop
> 
> There is no need to adjust the next rx descriptor after each packet,
> so do it only once at the end of the routine.
> 
> Signed-off-by: Yegor Yefremov <yegorslists@...glemail.com>
> 
> Index: linux-2.6.34-rc1/drivers/net/arm/ks8695net.c
> ===================================================================
> --- linux-2.6.34-rc1.orig/drivers/net/arm/ks8695net.c
> +++ linux-2.6.34-rc1/drivers/net/arm/ks8695net.c
> @@ -538,12 +538,13 @@ rx_finished:
>  			 */
>  			last_rx_processed = buff_n;
>  			buff_n = (buff_n + 1) & MAX_RX_DESC_MASK;
> -			/*And note which RX descriptor we last did */
> -			if (likely(last_rx_processed != -1))
> -				ksp->next_rx_desc_read =
> -					(last_rx_processed + 1) &
> -					MAX_RX_DESC_MASK;
>  	}
> +
> +	/*And note which RX descriptor we last did */
> +	if (likely(last_rx_processed != -1))
> +		ksp->next_rx_desc_read =
> +			(last_rx_processed + 1) & MAX_RX_DESC_MASK;
> +

Very strange to see all these computations...

At this point, why not use

if (likely(last_rx_processed != -1))
	ksp->next_rx_desc_read = buff_n;

or even get rid of last_rx_processed completely and do :


diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index a1d4188..ac6ab04 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -461,7 +461,6 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
 	int buff_n;
 	u32 flags;
 	int pktlen;
-	int last_rx_processed = -1;
 	int received = 0;
 
 	buff_n = ksp->next_rx_desc_read;
@@ -533,17 +532,9 @@ rx_failure:
 			ksp->rx_ring[buff_n].status = cpu_to_le32(RDES_OWN);
 rx_finished:
 			received++;
-			/* And note this as processed so we can start
-			 * from here next time
-			 */
-			last_rx_processed = buff_n;
 			buff_n = (buff_n + 1) & MAX_RX_DESC_MASK;
-			/*And note which RX descriptor we last did */
-			if (likely(last_rx_processed != -1))
-				ksp->next_rx_desc_read =
-					(last_rx_processed + 1) &
-					MAX_RX_DESC_MASK;
 	}
+	ksp->next_rx_desc_read = buff_n;
 	/* And refill the buffers */
 	ks8695_refill_rxbuffers(ksp);
 



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ