qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Simulate different network card vendors
@ 2014-01-15  7:57 rajan pathak
  2014-01-16  6:29 ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: rajan pathak @ 2014-01-15  7:57 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]

Hello All

I am new QEMU development and wanted to Simulate Atheros Network controller.


I am Running QEMU on x86 machine with underlaying network controller from
Broadcom and
 compiled linux kernel based on ARM having Atheros driver support.

I guess there must be mapping at QEMU level calls for Atheros driver maps
to Broadcom.
Have no idea where to start looking in to QEMU code and what files to look
into.

Can anyone let me know how in general mapping mapping between two different
network vendors takes plave at QEMU level.

Thanks
Rajan

[-- Attachment #2: Type: text/html, Size: 1823 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Simulate different network card vendors
  2014-01-15  7:57 [Qemu-devel] Simulate different network card vendors rajan pathak
@ 2014-01-16  6:29 ` Stefan Hajnoczi
  2014-01-18 17:19   ` rajan pathak
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-01-16  6:29 UTC (permalink / raw)
  To: rajan pathak; +Cc: qemu-devel

On Wed, Jan 15, 2014 at 01:27:41PM +0530, rajan pathak wrote:
> I am new QEMU development and wanted to Simulate Atheros Network controller.
> 
> 
> I am Running QEMU on x86 machine with underlaying network controller from
> Broadcom and
>  compiled linux kernel based on ARM having Atheros driver support.
> 
> I guess there must be mapping at QEMU level calls for Atheros driver maps
> to Broadcom.
> Have no idea where to start looking in to QEMU code and what files to look
> into.
> 
> Can anyone let me know how in general mapping mapping between two different
> network vendors takes plave at QEMU level.

QEMU emulates hardware (network cards, graphics cards, sound cards,
etc).  What you are asking about is adding a new emulated device for an
Atheros NIC.

Usually that involves reviewing the datasheet from the hardware vendor
to understand the programming interface that the hardware provides (e.g.
hardware registers accessible over PCI).

In some cases no datasheet is available so you have to look at existing
open source drivers to understand how the device is supposed to behave.

Then you can implement the device in QEMU.  See the hw/net/ directory.

If you're not already familiar with device drivers/device emulation and
C programming then this can be a big undertaking.  The main requirement
is to understand how the hardware is supposed to behave, it can be very
difficult if the vendor does not provide a datasheet.

Perhaps you can modify your guest to use one of the NICs that QEMU
already has support for (rtl8139, e1000, virtio-net, etc)?

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Simulate different network card vendors
  2014-01-16  6:29 ` Stefan Hajnoczi
@ 2014-01-18 17:19   ` rajan pathak
  2014-01-20 16:22     ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: rajan pathak @ 2014-01-18 17:19 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2396 bytes --]

Thanks Stefan for your kind response.

I am OK with C programming and wrote couple of LKM related to FPGA device.

But my understanding of QEMU is very limited.

Let me ask some specific question on what I wanted to do.

I am looking forward to emulate single-chip Ethernet controller.

I can find some of its source code online and it has two main part Ethernet
PHY (any 1GB SGMII compatible)
and Ethernet MAC .

So ,DO I need to simply put the corresponding source files of PHY and MAC
in hw/net directory of QEMU?

Also ,do I need to take care of underlying Ethernet controller(of my
machine where I am trying to do this) from
Broadcom in any way?

Thanks
Rajan





On Wed, Jan 15, 2014 at 10:29 PM, Stefan Hajnoczi <stefanha@gmail.com>wrote:

> On Wed, Jan 15, 2014 at 01:27:41PM +0530, rajan pathak wrote:
> > I am new QEMU development and wanted to Simulate Atheros Network
> controller.
> >
> >
> > I am Running QEMU on x86 machine with underlaying network controller from
> > Broadcom and
> >  compiled linux kernel based on ARM having Atheros driver support.
> >
> > I guess there must be mapping at QEMU level calls for Atheros driver maps
> > to Broadcom.
> > Have no idea where to start looking in to QEMU code and what files to
> look
> > into.
> >
> > Can anyone let me know how in general mapping mapping between two
> different
> > network vendors takes plave at QEMU level.
>
> QEMU emulates hardware (network cards, graphics cards, sound cards,
> etc).  What you are asking about is adding a new emulated device for an
> Atheros NIC.
>
> Usually that involves reviewing the datasheet from the hardware vendor
> to understand the programming interface that the hardware provides (e.g.
> hardware registers accessible over PCI).
>
> In some cases no datasheet is available so you have to look at existing
> open source drivers to understand how the device is supposed to behave.
>
> Then you can implement the device in QEMU.  See the hw/net/ directory.
>
> If you're not already familiar with device drivers/device emulation and
> C programming then this can be a big undertaking.  The main requirement
> is to understand how the hardware is supposed to behave, it can be very
> difficult if the vendor does not provide a datasheet.
>
> Perhaps you can modify your guest to use one of the NICs that QEMU
> already has support for (rtl8139, e1000, virtio-net, etc)?
>
> Stefan
>

[-- Attachment #2: Type: text/html, Size: 3271 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Simulate different network card vendors
  2014-01-18 17:19   ` rajan pathak
@ 2014-01-20 16:22     ` Stefan Hajnoczi
  2014-01-22 13:00       ` rajan pathak
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-01-20 16:22 UTC (permalink / raw)
  To: rajan pathak; +Cc: qemu-devel

On Sat, Jan 18, 2014 at 09:19:43AM -0800, rajan pathak wrote:
> I am looking forward to emulate single-chip Ethernet controller.
> 
> I can find some of its source code online and it has two main part Ethernet
> PHY (any 1GB SGMII compatible)
> and Ethernet MAC .
> 
> So ,DO I need to simply put the corresponding source files of PHY and MAC
> in hw/net directory of QEMU?

I'm not sure what you mean.  Do you have source code for QEMU emulation
of the network card?

If you have some other source code like a driver for the card, or
emulation for the card but not for QEMU, then a lot more work would be
necessary to emulate the card in QEMU.

> Also ,do I need to take care of underlying Ethernet controller(of my
> machine where I am trying to do this) from
> Broadcom in any way?

QEMU uses mechanisms to send raw packets from userspace, like the
tun/tap driver that many OSes have.  Therefore the physical NIC doesn't
matter, it's abstracted by the tun/tap interface that the host kernel
provides.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Simulate different network card vendors
  2014-01-20 16:22     ` Stefan Hajnoczi
@ 2014-01-22 13:00       ` rajan pathak
  2014-01-22 15:58         ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: rajan pathak @ 2014-01-22 13:00 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]

Thanks Stefan.

I don't have source code of  QEMU emulation of the network card?

I do have the source code(driver code) of the devices the I wanted to
emulate.

Basically,Ethernet controller, I wanted to emulate has following two main
part

1)Ethernet PHY
 2)Ethernet MAC

nd have driver code for these devices.

But I don't know what are the steps to emulate it for QEMU.

Would you suggest me some links where I can get some idea of how emulating
a Device for QEMU?



Thanks,
Rajan




On Mon, Jan 20, 2014 at 9:52 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:

> On Sat, Jan 18, 2014 at 09:19:43AM -0800, rajan pathak wrote:
> > I am looking forward to emulate single-chip Ethernet controller.
> >
> > I can find some of its source code online and it has two main part
> Ethernet
> > PHY (any 1GB SGMII compatible)
> > and Ethernet MAC .
> >
> > So ,DO I need to simply put the corresponding source files of PHY and MAC
> > in hw/net directory of QEMU?
>
> I'm not sure what you mean.  Do you have source code for QEMU emulation
> of the network card?
>
> If you have some other source code like a driver for the card, or
> emulation for the card but not for QEMU, then a lot more work would be
> necessary to emulate the card in QEMU.
>
> > Also ,do I need to take care of underlying Ethernet controller(of my
> > machine where I am trying to do this) from
> > Broadcom in any way?
>
> QEMU uses mechanisms to send raw packets from userspace, like the
> tun/tap driver that many OSes have.  Therefore the physical NIC doesn't
> matter, it's abstracted by the tun/tap interface that the host kernel
> provides.
>

[-- Attachment #2: Type: text/html, Size: 3413 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Simulate different network card vendors
  2014-01-22 13:00       ` rajan pathak
@ 2014-01-22 15:58         ` Stefan Hajnoczi
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-01-22 15:58 UTC (permalink / raw)
  To: rajan pathak; +Cc: qemu-devel

On Wed, Jan 22, 2014 at 06:30:42PM +0530, rajan pathak wrote:
> But I don't know what are the steps to emulate it for QEMU.
> 
> Would you suggest me some links where I can get some idea of how emulating
> a Device for QEMU?

Look at existing code in hw/net/*.c, for example e1000.c.

Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-01-22 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-15  7:57 [Qemu-devel] Simulate different network card vendors rajan pathak
2014-01-16  6:29 ` Stefan Hajnoczi
2014-01-18 17:19   ` rajan pathak
2014-01-20 16:22     ` Stefan Hajnoczi
2014-01-22 13:00       ` rajan pathak
2014-01-22 15:58         ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).