Skip to contentSkip to conversation

Porting linux network driver to Xen

DISCUSSION ravi kerur 2 participants 9 messages Nov 4, 2009 – Nov 5, 2009

lore
Share & tools
lore

ravi kerur

author
#0 lore raw

Hi All,

I am working on porting an existing network driver from Linux to Xen, I understand network drivers needs netback and netfront functionality in order to work in Xen but I am unable to nail down the details of changes required esp.

a. will the existing driver go into hypervisor or dom0?
b. what changes are required in TX/RX rings for DMA in existing driver and how to incorporate them into netback/netfront,
c. handling IRQs...

Any pointers to existing nic driver or pointer to a document would be really helpful.

Thanks
-RK

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Native Linux drivers should work as such in Dom0. You don't have to port them.

-Kaushik

Quoted 16 lines · ravi kerur

Hi All,

I am working on porting an existing network driver from Linux to Xen, I understand network drivers needs netback and netfront functionality in order to work in Xen but I am unable to nail down the details of changes required esp.

a. will the existing driver go into hypervisor or dom0?
b. what changes are required in TX/RX rings for DMA in existing driver and how to incorporate them into netback/netfront, c. handling IRQs...

Any pointers to existing nic driver or pointer to a document would be really helpful.

Thanks
-RK
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#2 lore raw

Thanks kaushik, How does netfront/netback interact with this driver? I believe I need netback functionality running in dom0 and netfront running in domU's for the existing driver. One of the documents has following explanation for Tx/Rx path.

"For transmit (TX) requests the driver domain(dom0) uses a hypercall to map the guest page(domU) into its address space before sending the request through the bridge. When the physical device driver frees the page a callback function is automatically invoked to return a response to netfront which then revokes the grant.

For RX requests netfront posts I/O buffer page grants to the RX I/O channel. When netback receives a packet from the bridge it retrieves a posted grant from the I/O channel and issues a grant copy hypercall to copy the packet to the guest page(domU). Finally, netback sends a response to the guest via the RX channel indicating a packet is available."

I am not quite sure what changes or api's I need to call such that existing Tx/Rx buffers(rings) used for DMA in the native drivers starts talking via netfront/netback.

Inputs appreciated.

Thanks
-RK

------------------------------

Quoted 31 lines · Kaushik Kumar Ram

Native Linux drivers should work as such in Dom0. You don't have to port them.

-Kaushik

On Nov 4, 2009, at 7:17 AM, ravi kerur wrote:

Hi All,

Quoted 21 lines

I am working on porting an existing network driver from Linux to Xen, I understand network drivers needs netback and netfront functionality in order to work in Xen but I am unable to nail down the details of changes required esp.

a. will the existing driver go into hypervisor or dom0?
b. what changes are required in TX/RX rings for DMA in existing driver and how to incorporate them into netback/netfront,
c. handling IRQs...

Any pointers to existing nic driver or pointer to a document would be really helpful.

Thanks
-RK
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

Again, you don't have to make any changes to the driver. Netback/netfront do not interact directly with the NIC's driver.

-Kaushik

Quoted 40 lines · ravi kerur

Thanks kaushik, How does netfront/netback interact with this driver? I believe I need netback functionality running in dom0 and netfront running in domU's for the existing driver. One of the documents has following explanation for Tx/Rx path.

"For transmit (TX) requests the driver domain(dom0) uses a hypercall to map the guest page(domU) into its address space before sending the request through the bridge. When the physical device driver frees the page a callback function is automatically invoked to return a response to netfront which then revokes the grant.

For RX requests netfront posts I/O buffer page grants to the RX I/O channel. When netback receives a packet from the bridge it retrieves a posted grant from the I/O channel and issues a grant copy hypercall to copy the packet to the guest page(domU). Finally, netback sends a response to the guest via the RX channel indicating a packet is available."

I am not quite sure what changes or api's I need to call such that existing Tx/Rx buffers(rings) used for DMA in the native drivers starts talking via netfront/netback.

Inputs appreciated.

Thanks
-RK

On Wed, Nov 4, 2009 at 8:58 AM, Kaushik Kumar Ram <[email protected]> wrote:
Native Linux drivers should work as such in Dom0. You don't have to port them.

-Kaushik

On Nov 4, 2009, at 7:17 AM, ravi kerur wrote:

Hi All,

I am working on porting an existing network driver from Linux to Xen, I understand network drivers needs netback and netfront functionality in order to work in Xen but I am unable to nail down the details of changes required esp.

a. will the existing driver go into hypervisor or dom0?
b. what changes are required in TX/RX rings for DMA in existing driver and how to incorporate them into netback/netfront, c. handling IRQs...

Any pointers to existing nic driver or pointer to a document would be really helpful.

Thanks
-RK
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#4 lore raw

I am confused now, probably I should ask what changes are needed such that I can access NIC from guest domains(domUs) for Tx and Rx? i.e if I compile native linux driver and run on dom0, how can I access it from domU's

are the changes just the configuration such that path is setup from domU/netfront -> dom0/netback->Bridge->NIC?

Inputs appreciated.

Thanks
-Ravi

Quoted 70 lines · Kaushik Kumar Ram

Again, you don't have to make any changes to the driver. Netback/netfront do not interact directly with the
NIC's driver.

-Kaushik

On Nov 4, 2009, at 3:18 PM, ravi kerur wrote:

Thanks kaushik, How does netfront/netback interact with this driver? I believe I need netback functionality running in dom0 and netfront running in domU's for the existing driver. One of the documents has following explanation for Tx/Rx path.

"For transmit (TX) requests the driver domain(dom0) uses a hypercall to map the guest page(domU) into its address space before sending the request through the bridge. When the physical device driver frees the page a callback function is automatically invoked to return a response to netfront which then revokes the grant.

For RX requests netfront posts I/O buffer page grants to the RX I/O channel. When netback receives a packet from the bridge it retrieves a posted grant from the I/O channel and issues a grant copy hypercall to copy the packet to the guest page(domU). Finally, netback sends a response to the guest via the RX channel indicating a packet is available."

I am not quite sure what changes or api's I need to call such that existing Tx/Rx buffers(rings) used for DMA in the native drivers starts talking via netfront/netback.

Inputs appreciated.

Thanks
-RK

------------------------------

Quoted 31 lines · Kaushik Kumar Ram

Native Linux drivers should work as such in Dom0. You don't have to port them.

-Kaushik

On Nov 4, 2009, at 7:17 AM, ravi kerur wrote:

Hi All,

Quoted 21 lines

I am working on porting an existing network driver from Linux to Xen, I understand network drivers needs netback and netfront functionality in order to work in Xen but I am unable to nail down the details of changes required esp.

a. will the existing driver go into hypervisor or dom0?
b. what changes are required in TX/RX rings for DMA in existing driver and how to incorporate them into netback/netfront,
c. handling IRQs...

Any pointers to existing nic driver or pointer to a document would be really helpful.

Thanks
-RK
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 7 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw
Quoted 4 lines

I am confused now, probably I should ask what changes are needed such that I can access NIC from guest domains(domUs) for Tx and Rx? i.e if I compile native linux driver and run on dom0, how can I access it from domU's

are the changes just the configuration such that path is setup from domU/netfront -> dom0/netback->Bridge->NIC?

Yes. Just make sure the NIC corresponding to this driver is attached to the bridge. If this NIC is not your default interface you may need to tweak the configuration.

-Kaushik

Quoted 21 lines · Kaushik Kumar Ram

Again, you don't have to make any changes to the driver. Netback/netfront do not interact directly with the NIC's driver.

-Kaushik

Quoted 12 lines · ravi kerur

Thanks kaushik, How does netfront/netback interact with this driver? I believe I need netback functionality running in dom0 and netfront running in domU's for the existing driver. One of the documents has following explanation for Tx/Rx path.

"For transmit (TX) requests the driver domain(dom0) uses a hypercall to map the guest page(domU) into its address space before sending the request through the bridge. When the physical device driver frees the page a callback function is automatically invoked to return a response to netfront which then revokes the grant.

For RX requests netfront posts I/O buffer page grants to the RX I/O channel. When netback receives a packet from the bridge it retrieves a posted grant from the I/O channel and issues a grant copy hypercall to copy the packet to the guest page(domU). Finally, netback sends a response to the guest via the RX channel indicating a packet is available."

I am not quite sure what changes or api's I need to call such that existing Tx/Rx buffers(rings) used for DMA in the native drivers starts talking via netfront/netback.

Inputs appreciated.

Thanks
-RK

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#6 lore raw

Thank you Kaushik for your help. Very much appreciated.

Thanks
-RK

Quoted 47 lines · Kaushik Kumar Ram

I am confused now, probably I should ask what changes are needed such that I can access NIC from guest domains(domUs) for Tx and Rx? i.e if I compile native linux driver and run on dom0, how can I access it from domU's

are the changes just the configuration such that path is setup from domU/netfront -> dom0/netback->Bridge->NIC?

Yes. Just make sure the NIC corresponding to this driver is attached to the bridge. If this NIC is not your default
interface you may need to tweak the configuration.

-Kaushik

Quoted 29 lines · Kaushik Kumar Ram

Again, you don't have to make any changes to the driver. Netback/netfront do not interact directly with the
NIC's driver.

-Kaushik

On Nov 4, 2009, at 3:18 PM, ravi kerur wrote:

Thanks kaushik, How does netfront/netback interact with this driver? I believe I need netback functionality running in dom0 and netfront running in domU's for the existing driver. One of the documents has following explanation for Tx/Rx path.

"For transmit (TX) requests the driver domain(dom0) uses a hypercall to map the guest page(domU) into its address space before sending the request through the bridge. When the physical device driver frees the page a callback function is automatically invoked to return a response to netfront which then revokes the grant.

For RX requests netfront posts I/O buffer page grants to the RX I/O channel. When netback receives a packet from the bridge it retrieves a posted grant from the I/O channel and issues a grant copy hypercall to copy the packet to the guest page(domU). Finally, netback sends a response to the guest via the RX channel indicating a packet is available."

I am not quite sure what changes or api's I need to call such that existing Tx/Rx buffers(rings) used for DMA in the native drivers starts talking via netfront/netback.

Quoted 7 lines
Quoted 6 lines

Inputs appreciated.

Thanks
-RK

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#7 lore raw

Hi Kaushik,

An additional Q, as long as the configuration is correct, I should be able to access network(i.e ftp, ssh and other apps) from dom0 via the usual path mentioned earlier. Please confirm.

Thanks
RK

Quoted 62 lines · ravi kerur

Thank you Kaushik for your help. Very much appreciated.

Thanks
-RK

Quoted 54 lines · Kaushik Kumar Ram

I am confused now, probably I should ask what changes are needed such that I can access NIC from guest domains(domUs) for Tx and Rx? i.e if I compile native linux driver and run on dom0, how can I access it from domU's

are the changes just the configuration such that path is setup from domU/netfront -> dom0/netback->Bridge->NIC?

Yes. Just make sure the NIC corresponding to this driver is attached to the bridge. If this NIC is not your default
interface you may need to tweak the configuration.

-Kaushik

Quoted 35 lines · Kaushik Kumar Ram

Again, you don't have to make any changes to the driver. Netback/netfront do not interact directly with the
NIC's driver.

-Kaushik

On Nov 4, 2009, at 3:18 PM, ravi kerur wrote:

Thanks kaushik, How does netfront/netback interact with this driver? I believe I need netback functionality running in dom0 and netfront running in domU's for the existing driver. One of the documents has following explanation for Tx/Rx path.

"For transmit (TX) requests the driver domain(dom0) uses a hypercall to map the guest page(domU) into its address space before sending the request through the bridge. When the physical device driver frees the page a callback function is automatically invoked to return a response to netfront which then revokes the grant.

For RX requests netfront posts I/O buffer page grants to the RX I/O channel. When netback receives a packet from the bridge it retrieves a posted grant from the I/O channel and issues a grant copy hypercall to copy the packet to the guest page(domU). Finally, netback sends a response to the guest via the RX channel indicating a packet is available."

I am not quite sure what changes or api's I need to call such that existing Tx/Rx buffers(rings) used for DMA in the native drivers starts talking via netfront/netback.

Inputs appreciated.

Thanks
-RK

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw
Quoted 2 lines

An additional Q, as long as the configuration is correct, I should be able to access network(i.e ftp, ssh and other apps) from dom0 via the usual path mentioned earlier. Please confirm.

Yes.

-Kaushik

Quoted 38 lines · Kaushik Kumar Ram
Quoted 4 lines

I am confused now, probably I should ask what changes are needed such that I can access NIC from guest domains(domUs) for Tx and Rx? i.e if I compile native linux driver and run on dom0, how can I access it from domU's

are the changes just the configuration such that path is setup from domU/netfront -> dom0/netback->Bridge->NIC?

Yes. Just make sure the NIC corresponding to this driver is attached to the bridge. If this NIC is not your default interface you may need to tweak the configuration.

-Kaushik

Quoted 21 lines · Kaushik Kumar Ram

Again, you don't have to make any changes to the driver. Netback/netfront do not interact directly with the NIC's driver.

-Kaushik

Quoted 12 lines · ravi kerur

Thanks kaushik, How does netfront/netback interact with this driver? I believe I need netback functionality running in dom0 and netfront running in domU's for the existing driver. One of the documents has following explanation for Tx/Rx path.

"For transmit (TX) requests the driver domain(dom0) uses a hypercall to map the guest page(domU) into its address space before sending the request through the bridge. When the physical device driver frees the page a callback function is automatically invoked to return a response to netfront which then revokes the grant.

For RX requests netfront posts I/O buffer page grants to the RX I/O channel. When netback receives a packet from the bridge it retrieves a posted grant from the I/O channel and issues a grant copy hypercall to copy the packet to the guest page(domU). Finally, netback sends a response to the guest via the RX channel indicating a packet is available."

I am not quite sure what changes or api's I need to call such that existing Tx/Rx buffers(rings) used for DMA in the native drivers starts talking via netfront/netback.

Inputs appreciated.

Thanks
-RK

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel