Received: from eggs.gnu.org ([208.118.235.92]:48278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYzYr-0006G6-Cr for qemu-devel@nongnu.org; Sun, 05 May 2013 10:05:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYzYq-0000a2-Ds for qemu-devel@nongnu.org; Sun, 05 May 2013 10:05:09 -0400 Received: from zose-mta15.web4all.fr ([178.33.204.94]:36305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYzYq-0000Zd-3h for qemu-devel@nongnu.org; Sun, 05 May 2013 10:05:08 -0400 Message-ID: <51866711.8090208@tribudubois.net> Date: Sun, 05 May 2013 16:05:05 +0200 From: Jean-Christophe DUBOIS MIME-Version: 1.0 References: <6476d358d7f54aa7db6b7dc435d010bc83b2e806.1367676178.git.jcd@tribudubois.net> <51865B2A.4030101@tribudubois.net> <51865F40.2060609@suse.de> In-Reply-To: <51865F40.2060609@suse.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 1/4] Add i.MX FEC Ethernet driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Andreas_F=E4rber?= Cc: peter.maydell@linaro.org, Peter Crosthwaite , peter.chubb@nicta.com.au, qemu-devel@nongnu.org On 05/05/2013 03:31 PM, Andreas F=E4rber wrote: > Am 05.05.2013 15:14, schrieb Jean-Christophe DUBOIS: >> On 05/05/2013 05:11 AM, Peter Crosthwaite wrote: >>> Hi JC, >>> >>> On Sun, May 5, 2013 at 12:09 AM, Jean-Christophe DUBOIS >>> wrote: >>>> This is based on the mcf_fec.c FEC implementation for ColdFire. > Note that ColdFire is one of the least maintained targets in QEMU... Well, that's too bad. I actually believe the ColdFire FEC implementation would not work in=20 actual QEMU (but I don't plan to build a ColdFire Kernel and RootFS to=20 find out). > >>>> +static int imx_fec_can_receive(NetClientState *nc) >>>> +{ >>>> + imx_fec_state *s =3D qemu_get_nic_opaque(nc); >>>> + >>> Andreas, do we care about QOM casts coming from random void* opaques? > Generally no. If we ever switch to C++ or some other OO language we'll > have to touch casts anyway. > > Peter, please note that I usually don't have time to read through all > patches - noticed this inline question incidentally only. > >> OK, I am going to do a QOM cast anyway. > You should check how frequently this function is called - the current > OBJECT_CHECK() implementation does at least one string comparison, so > I'd suggest to avoid it here. That is, if the type passed in as opaque > matches the type assigned here (thinking of interfaces). Hum, ... you are going to be unhappy with my new patch. > >>>> + return s->rx_enabled; >>>> +} > [snip] > > Not knowing this piece of hardware, might it make sense to call it > "imx-fec" when there's another FEC for ColdFire? I am calling it "imx.fec" in the new version of the file (to be=20 equivalent to "imx.i2c" I did for I2C). > Or are they the same > thing and should be unified? Well, they are certainly very similar but are different on a few points.=20 In particular the "buffer descriptors" are reversed between i.MX and=20 Coldfire. Linux does a compile time decision about these buffer=20 descriptors but I don't know how this would work with Qemu (can you make=20 a different compile time decision for 2 different targets?). We could also implement a more cumbersome run time decision but I wanted=20 to keep simple. And anyway I don't have Coldfire (cross compilers, rootfs, ...) setup=20 around to test. > > Regards, > Andreas >