Is there any written guidance available giving the basic steps to port other linux network drivers to Xen? I did look around a little in the source tree and didn''t find it, so the pointer would be appreciated. thanks, paul ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> Is there any written guidance available giving the basic steps to port other > linux network drivers to Xen? I did look around a little in the source tree > and didn''t find it, so the pointer would be appreciated.Apologies -- no such file currently exists, but we were discussing the need to write one just a couple of days ago. We''ll try and get around to this soon. Porting network drivers is generally very straight forward. Our device drivers use the traditional Linux API rather than the new Linux NAPI API. (Most decent Gig Ethernet cards have hardware interrupt hold-off, which works at least as well as NAPI anyway). In many cases, just copying the driver into the tree and building it will work. Getting drivers that use scatter-gather DMA working is working is actually easier than old PIO drivers. The reason for this is that network buffer pages are, by default, not mapped into Xen''s address space, hence you can''t just read and write them. You need to call map_domain_mem( phys addr ) first, then remember to call unmap_domain_mem( virt addr ) when you''re done. See the e100 driver for an example. The other thing to watch out for is that Xen is entirely event driven -- there''s no process contexts that you can use semaphores or wait queues on. It''s just possible that there''s some Ethernet driver that uses these for sleeping during media detection. In which case, it can probably be fairly easily rewritten to use schedule_timeout (which is supported). What card are you wanting to get working? Best, Ian ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> From: Ian Pratt [mailto:Ian.Pratt@cl.cam.ac.uk] > Sent: Sunday, October 05, 2003 4:11 PM > > > Is there any written guidance available giving the basic steps > to port other > > linux network drivers to Xen? I did look around a little in > the source tree > > and didn''t find it, so the pointer would be appreciated. > > Apologies -- no such file currently exists, but we were > discussing the need to write one just a couple of days ago. > We''ll try and get around to this soon.No need to apologize. I just didn''t want to hack around without the benefit of whatever had been written thus far. Thanks for the pointers.> What card are you wanting to get working?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. thanks, paul ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> 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. Ian ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel
> > 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 unmap_domain_mem(vdata); skb_put(len); -- Keir ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Xen-devel mailing list Xen-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xen-devel