From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wo5kc-0005Z8-4F for qemu-devel@nongnu.org; Sat, 24 May 2014 02:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wo5kV-0003tL-V0 for qemu-devel@nongnu.org; Sat, 24 May 2014 02:48:14 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:43068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wo5kV-0003tA-Nc for qemu-devel@nongnu.org; Sat, 24 May 2014 02:48:07 -0400 Message-ID: <538040A4.5030602@msgid.tls.msk.ru> Date: Sat, 24 May 2014 10:48:04 +0400 From: Michael Tokarev MIME-Version: 1.0 References: <53803E4E.8010108@msgid.tls.msk.ru> In-Reply-To: <53803E4E.8010108@msgid.tls.msk.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [net, v1, 1/4] net: cadence_gem: Fix Tx descriptor update List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: edgar.iglesias@xilinx.com, Peter Maydell , qemu-devel , Stefan Hajnoczi 24.05.2014 10:38, Michael Tokarev wrote: > [...] > if (tx_desc_get_last(desc)) { > + unsigned desc_first[2]; > + > /* Modify the 1st descriptor of this packet to be owned by > * the processor. > */ > cpu_physical_memory_read(s->tx_desc_addr, > - (uint8_t *)&desc[0], sizeof(desc)); > - tx_desc_set_used(desc); > + (uint8_t *)&desc_first[0], sizeof(desc)); > + tx_desc_set_used(desc_first); > cpu_physical_memory_write(s->tx_desc_addr, > - (uint8_t *)&desc[0], sizeof(desc)); > + (uint8_t *)&desc_first[0], sizeof(desc)); > /* Advance the hardare current descriptor past this packet */ > > This is quite fun. > > Can we, please, > > a) s/unsigned/uint8_t/ in the variable declaration, > and remove the useless casts and "readdressing" everywhere? Um, no, this is ofcourse wrong - tx_desc_set_used() expects unsigned. Still it's possible to remove "readdressing", instead of (uint8_t *)&desc[0] use (uint8_t *)desc The second point stands.. ;) > and, more interesting, > > b) s/sizeof(desc)/sizeof(desc_first)/g > ? :) > > Thanks, > > /mjt >