[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Porting network drivers to Xen?

> > RealTek 8139C.  Just what I have on an extra machine I was using to poke
> > around with Xen.  Network card didn't work, so I figure that was a good a
> > place as any to start learning to hack.
> 'diffing' the Xen e100 driver against the stock Linux one will be
> very instructive. The patch is very short.
> What's the recommended Linux driver for your card, 8139cp.c or 8139too.c ?
> A quick glance reveals that the 8139too driver contains a `watch
> thread' (interruptible_sleep_on_timeout). This will have to be
> transformed into an event call back that uses schedule_timeout.

There are two key issues when porting 8139.

First, there's the timer issue. That is fixed either by removing the
watch thread altogether (maybe risky) or by using add_ac_timer() to
get yourself an event callback sometime later. The end of the handler
should call add_ac_timer() again if the event is periodic.

Second, there's the issue that 8139 doesn't do DMA. On transmit this
is not a problem if you don't specify NETIF_F_SG in the NIC flags --
in that case Xen will provide you with a linearized skbuff which is
directly readable/writeable by the NIC driver. Receive is harder,
since the data page does not have a mapping in Xen's address space. To
read out of the NIC buffer you will have to do something like:
 vdata = map_domain_mem(skb->data);
 copy 'len' bytes to 'vdata' from NIC buffer

 -- Keir

This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.