Skip to contentSkip to conversation

Add VMDq support to ixgbe

PATCH In review Mitch Williams 3 participants 8 messages Jan 29, 2009 – Mar 24, 2009 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add VMDq support to ixgbe

This patch adds experimental VMDq support (AKA Netchannel2 vmq) to the ixgbe driver. This applies to the Netchannel2 tree, and should NOT be applied to the "normal" development tree.

To enable VMDq functionality, load the driver with the command-line parameter VMDQ=<num queues>, as in:

$ modprobe ixgbe VMDQ=8

You can then set up PV domains to use the device by modifying your VM configuration file from

     vif = [ '<whatever>' ]
to
     vif2 = [ 'pdev=<netdev>' ]

where <netdev> is the interface name for your 82598 board, e.g peth0 in dom0.

The Netchannel2 code is VERY experimental at this stage and should not be used in production environments. This patch is intended to support further development and testing efforts.

drivers/net/ixgbe/ixgbe.h +10 -0
diff -urpN -X dontdiff a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
@@ -35,6 +35,9 @@
 #include <linux/pci.h>
 #include <linux/netdevice.h>
 #include <linux/vmalloc.h>
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+#include <linux/netvmq.h>
+#endif
 
 #ifdef SIOCETHTOOL
 #include <linux/ethtool.h>
@@ -224,6 +227,9 @@ struct ixgbe_ring {
 #endif
 	u16 work_limit;                /* max work per interrupt */
 	u16 rx_buf_len;
+	u8 mac_addr[ETH_ALEN];
+	u8 active;
+	u8 allocated;
 };
 
 #define RING_F_DCB  0
@@ -417,6 +423,10 @@ struct ixgbe_adapter {
 	unsigned int lro_flushed;
 	unsigned int lro_no_desc;
 #endif
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+	struct net_vmq *vmq;
+	u32 rx_queues_allocated;
+#endif
 	unsigned int tx_ring_count;
 	unsigned int rx_ring_count;
 

diff -urpN -X dontdiff a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c

drivers/net/ixgbe/ixgbe_main.c +78 -10

169 lines not on this page · raw message

u32 *vmdq)
{
+#ifndef CONFIG_XEN_NETDEV2_BACKEND
struct ixgbe_adapter *adapter = hw->back;
+#endif
struct dev_mc_list *mc_ptr;
u8 *addr = *mc_addr_ptr;
*vmdq = 0;
@@ -2439,7 +2509,7 @@ static u8 *ixgbe_addr_list_itr(struct ix
*mc_addr_ptr = mc_ptr->next->dmi_addr;
else
*mc_addr_ptr = NULL;
-
+#ifndef CONFIG_XEN_NETDEV2_BACKEND
if (adapter->flags & IXGBE_FLAG_VMDQ_ENABLED) {
/* VMDQ set 1 is used for FCoE */
if (adapter->ring_feature[RING_F_VMDQ].indices)
@@ -2459,6 +2529,7 @@ static u8 *ixgbe_addr_list_itr(struct ix
IXGBE_WRITE_REG(hw, IXGBE_MHADD, mhadd);
}
}
+#endif
return addr;
}

@@ -2665,8 +2736,9 @@ static void ixgbe_configure(struct ixgbe
ixgbe_configure_tx(adapter); ixgbe_configure_rx(adapter);
for (i = 0; i < adapter->num_rx_queues; i++)
- ixgbe_alloc_rx_buffers(adapter, &adapter->rx_ring[i],
- IXGBE_DESC_UNUSED(&adapter->rx_ring[i]));
+ if (adapter->rx_ring[i].active)
+ ixgbe_alloc_rx_buffers(adapter, &adapter->rx_ring[i],
+ IXGBE_DESC_UNUSED(&adapter->rx_ring[i]));
}

static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
@@ -2751,7 +2823,8 @@ static int ixgbe_up_complete(struct ixgb
* and HTHRESH=0 descriptors (to minimize latency on fetch),
* this also removes a pesky rx_no_buffer_count increment */
rxdctl |= 0x0020;
- rxdctl |= IXGBE_RXDCTL_ENABLE;
+ if (adapter->rx_ring[i].active)
+ rxdctl |= IXGBE_RXDCTL_ENABLE;
IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(j), rxdctl);
}
/* enable all receives */
@@ -2832,16 +2905,27 @@ static void ixgbe_clean_rx_ring(struct i
struct ixgbe_rx_buffer *rx_buffer_info;

rx_buffer_info = &rx_ring->rx_buffer_info[i];
+ if (rx_buffer_info->skb) {
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+ if (rx_ring->queue_index) {
+ pci_unmap_page(pdev, rx_buffer_info->dma,
+ PAGE_SIZE,
+ PCI_DMA_FROMDEVICE);
+ vmq_free_skb(rx_buffer_info->skb,
+ rx_ring->queue_index);
+ rx_buffer_info->dma = 0;
+ } else
+#endif
+ dev_kfree_skb(rx_buffer_info->skb);
+ rx_buffer_info->skb = NULL;
+ }
+
if (rx_buffer_info->dma) {
pci_unmap_single(pdev, rx_buffer_info->dma,
rx_ring->rx_buf_len + NET_IP_ALIGN, PCI_DMA_FROMDEVICE);
rx_buffer_info->dma = 0;
}
- if (rx_buffer_info->skb) {
- dev_kfree_skb(rx_buffer_info->skb);
- rx_buffer_info->skb = NULL;
- }
if (!rx_buffer_info->page)
continue;
pci_unmap_page(pdev, rx_buffer_info->page_dma, PAGE_SIZE / 2,
@@ -3787,6 +3871,19 @@ int ixgbe_setup_rx_resources(struct ixgb
rx_ring->work_limit = rx_ring->count / 2;
#endif

+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+ if ((adapter->flags & IXGBE_FLAG_VMDQ_ENABLED) &&
+ rx_ring->queue_index) {
+ rx_ring->active = 0;
+ rx_ring->allocated = 0;
+ } else {
+#endif
+ rx_ring->active = 1;
+ rx_ring->allocated = 1;
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+ }
+#endif
+
#ifndef IXGBE_NO_LRO
ixgbe_lro_ring_init(rx_ring->lrolist, adapter);
#endif
@@ -3906,6 +4003,9 @@ static int ixgbe_setup_all_rx_resources(
DPRINTK(PROBE, ERR, "Allocation for Rx Queue %u failed\n", i); break;
}
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+ adapter->rx_queues_allocated = 0;
+#endif
return err;
}

@@ -3949,6 +4049,12 @@ static int ixgbe_change_mtu(struct net_d
if ((new_mtu < 68) || (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE))
return -EINVAL;

+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+ /* Jumbo frames not currently supported in VMDq mode under Xen */
+ if ((adapter->flags & IXGBE_FLAG_VMDQ_ENABLED) &&
+ (max_frame > ETH_FRAME_LEN))
+ return -EINVAL;
+#endif
DPRINTK(PROBE, INFO, "changing MTU from %d to %d\n",
netdev->mtu, new_mtu);
/* must set new MTU before calling down or up */
@@ -4854,6 +4960,191 @@ static int ixgbe_ioctl(struct net_device
}

#endif
+
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+int ixgbe_get_avail_queues(struct net_device *netdev, unsigned int queue_type) +{
+ struct ixgbe_adapter *adapter = netdev_priv(netdev);
+ if (queue_type == VMQ_TYPE_RX)
+ return (adapter->num_rx_queues - adapter->rx_queues_allocated) - 1;
+ else if (queue_type == VMQ_TYPE_TX)
+ return 0;
+ else return 0;
+}
+int ixgbe_get_vmq_maxsize(struct net_device *netdev) {
+ return IXGBE_MAX_TXD;
+}
+
+int ixgbe_alloc_vmq_queue(struct net_device *netdev, unsigned int queue_type) +{
+ struct ixgbe_adapter *adapter = netdev_priv(netdev);
+
+ if (queue_type == VMQ_TYPE_TX) {
+ return -EINVAL;
+ }
+
+ if (adapter->rx_queues_allocated >= adapter->num_rx_queues) {
+ return -EINVAL;
+ }
+ else {
+ int i;
+ for (i = 1; i < adapter->num_rx_queues; i++) {
+ if (!adapter->rx_ring[i].allocated) {
+ adapter->rx_ring[i].allocated = TRUE;
+ adapter->rx_queues_allocated++;
+ return i;
+ }
+ }
+ return -EINVAL;
+ }
+}
+
+int ixgbe_free_vmq_queue(struct net_device *netdev, int queue)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(netdev);
+
+ if (queue >= adapter->num_rx_queues)
+ return -EINVAL;
+
+ if (!adapter->rx_ring[queue].allocated) {
+ return -EINVAL;
+ }
+
+ adapter->rx_ring[queue].allocated = FALSE;
+ adapter->rx_queues_allocated--;
+ ixgbe_clean_rx_ring(adapter, &adapter->rx_ring[queue]);
+
+ return 0;
+}
+
+int ixgbe_set_rxqueue_macfilter(struct net_device *netdev, int queue,
+ u8 *mac_addr)
+{
+ int err = 0;
+ u32 rah;
+ struct ixgbe_adapter *adapter = netdev_priv(netdev);
+ struct ixgbe_hw *hw = &adapter->hw;
+ struct ixgbe_ring *rx_ring = &adapter->rx_ring[queue];
+
+ if ((queue < 0) || (queue > adapter->num_rx_queues)) {
+ return -EADDRNOTAVAIL;
+ }
+
+ /* Note: Broadcast address is used to disable the MAC filter*/
+ if (!is_valid_ether_addr(mac_addr)) {
+
+ memset(rx_ring->mac_addr, 0xFF, ETH_ALEN);
+
+ /* Clear RAR */
+ IXGBE_WRITE_REG(hw, IXGBE_RAL(queue), 0);
+ IXGBE_WRITE_FLUSH(hw);
+ IXGBE_WRITE_REG(hw, IXGBE_RAH(queue), 0);
+ IXGBE_WRITE_FLUSH(hw);
+
+ return -EADDRNOTAVAIL;
+ }
+
+ /* Store in ring */
+ memcpy(rx_ring->mac_addr, mac_addr, ETH_ALEN);
+
+ err = ixgbe_set_rar(&adapter->hw, queue, rx_ring->mac_addr, 1, IXGBE_RAH_AV);
+
+ if (!err) {
+ /* Set the VIND for the indicated queue's RAR Entry */
+ rah = IXGBE_READ_REG(hw, IXGBE_RAH(queue));
+ rah &= ~IXGBE_RAH_VIND_MASK;
+ rah |= (queue << IXGBE_RAH_VIND_SHIFT);
+ IXGBE_WRITE_REG(hw, IXGBE_RAH(queue), rah);
+ IXGBE_WRITE_FLUSH(hw);
+ }
+
+ return err;
+}
+
+int ixgbe_get_vmq_size(struct net_device *netdev, int queue)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(netdev);
+
+ if (queue >= adapter->num_rx_queues)
+ return -EINVAL;
+ return adapter->rx_ring[queue].count;
+}
+
+int ixgbe_set_vmq_size(struct net_device *netdev, int queue, int size) +{
+ struct ixgbe_adapter *adapter = netdev_priv(netdev);
+ /* Not implemented yet, so just return count. */
+ return adapter->rx_ring[queue].count;
+}
+
+int ixgbe_set_vmq_vlan(struct net_device *netdev, int queue, int vlan_id) +{
+ return 0; /* not implemented */
+}
+
+int ixgbe_vmq_enable(struct net_device *netdev, int queue)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(netdev);
+ struct ixgbe_hw *hw = &adapter->hw;
+ u32 rxdctl;
+
+ if (queue >= adapter->num_rx_queues)
+ return -EINVAL;
+
+ if (!adapter->rx_ring[queue].allocated) {
+ return -EINVAL;
+ }
+ adapter->rx_ring[queue].active = 1;
+ rxdctl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(queue));
+ rxdctl |= IXGBE_RXDCTL_ENABLE;
+ IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(queue), rxdctl);
+ IXGBE_WRITE_FLUSH(hw);
+ ixgbe_alloc_rx_buffers(adapter,
+ &adapter->rx_ring[queue],
+ IXGBE_DESC_UNUSED(&adapter->rx_ring[queue]));
+ return 0;
+}
+int ixgbe_vmq_disable(struct net_device *netdev, int queue)
+{
+ struct ixgbe_adapter *adapter = netdev_priv(netdev);
+ struct ixgbe_hw *hw = &adapter->hw;
+ u32 rxdctl;
+
+ if (queue >= adapter->num_rx_queues)
+ return -EINVAL;
+
+ if (!adapter->rx_ring[queue].allocated) {
+ return -EINVAL;
+ }
+
+ adapter->rx_ring[queue].active = 0;
+ rxdctl = IXGBE_READ_REG(hw, IXGBE_RXDCTL(queue));
+ rxdctl &= ~IXGBE_RXDCTL_ENABLE;
+ IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(queue), rxdctl);
+ return 0;
+}
+
+static void ixgbe_setup_vmq(struct ixgbe_adapter *adapter) {
+ net_vmq_t *vmq;
+
+ vmq = alloc_vmq(adapter->num_rx_queues);
+ if (vmq) {
+ vmq->avail_queues = ixgbe_get_avail_queues;
+ vmq->alloc_queue = ixgbe_alloc_vmq_queue;
+ vmq->free_queue = ixgbe_free_vmq_queue;
+ vmq->get_maxsize = ixgbe_get_vmq_maxsize;
+ vmq->get_size = ixgbe_get_vmq_size;
+ vmq->set_size = ixgbe_set_vmq_size;
+ vmq->set_mac = ixgbe_set_rxqueue_macfilter;
+ vmq->set_vlan = ixgbe_set_vmq_vlan;
+ vmq->enable = ixgbe_vmq_enable;
+ vmq->disable = ixgbe_vmq_disable;
+ vmq->nvmq = adapter->num_rx_queues;
+ adapter->netdev->vmq = vmq;
+ }
+}
+#endif /* CONFIG_XEN_NETDEV2_BACKEND */
+
#ifdef CONFIG_NET_POLL_CONTROLLER
/*
* Polling 'interrupt' - used by things like netconsole to send skbs
@@ -5152,12 +5443,18 @@ static int __devinit ixgbe_probe(struct

#endif
strcpy(netdev->name, "eth%d");
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+ if (adapter->flags & IXGBE_FLAG_VMDQ_ENABLED)
+ ixgbe_setup_vmq(adapter);
+#endif
err = register_netdev(netdev);
if (err)
goto err_register;

+#ifndef CONFIG_XEN_NETDEV2_BACKEND
if (adapter->flags & IXGBE_FLAG_VMDQ_ENABLED)
ixgbe_sysfs_create(adapter);
+#endif

#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE)
if (adapter->flags & IXGBE_FLAG_DCA_CAPABLE) {
@@ -5267,8 +5564,17 @@ static void __devexit ixgbe_remove(struc
}

#endif
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+ if (netdev->vmq) {
+ free_vmq(netdev->vmq);
+ netdev->vmq = 0;
+ }
+#endif
+
+#ifndef CONFIG_XEN_NETDEV2_BACKEND
if (adapter->flags & IXGBE_FLAG_VMDQ_ENABLED)
ixgbe_sysfs_remove(adapter);
+#endif
if (netdev->reg_state == NETREG_REGISTERED)
unregister_netdev(netdev);

diff -urpN -X dontdiff a/drivers/net/ixgbe/ixgbe_param.c b/drivers/net/ixgbe/ixgbe_param.c

drivers/net/ixgbe/ixgbe_param.c +7 -0
@@ -723,6 +723,13 @@ void __devinit ixgbe_check_options(struc
 			adapter->flags |= IXGBE_FLAG_RX_PS_CAPABLE;
 		}
 #endif
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+	if (adapter->flags &
+	    (IXGBE_FLAG_RX_PS_CAPABLE | IXGBE_FLAG_VMDQ_ENABLED)) {
+		printk(KERN_INFO "ixgbe: packet split disabled for Xen VMDQ\n");
+		adapter->flags &= ~IXGBE_FLAG_RX_PS_CAPABLE;
+	}
+#endif
 	}
 }
#1 lore raw

Mitch,

I finally found the time to test this.
I am still seeing the same kernel oops that was present on the previous patch when the ixgbe module was separated from the linux tree. Could you please download the code from the latest netchannel2 tree and try to reproduce the problem?
I have attached my old email which has the kernel oops message and includes an older version of the patch that works for me. You can compare that older version with the current code to find out what is the problem.

Also the right config option to enable VMDq should be CONFIG_XEN_NETDEV2_VMQ and not CONFIG_XEN_NETDEV2_BACKEND.

Thanks

Renato

Quoted 22 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Mitch Williams
Sent: Wednesday, January 28, 2009 4:43 PM
To: [email protected]
Subject: [Xen-devel] [PATCH] Add VMDq support to ixgbe

This patch adds experimental VMDq support (AKA Netchannel2 vmq) to the ixgbe driver. This applies to the Netchannel2 tree, and should NOT be applied to the "normal" development tree.

To enable VMDq functionality, load the driver with the command-line parameter VMDQ=<num queues>, as in:

$ modprobe ixgbe VMDQ=8

You can then set up PV domains to use the device by modifying your VM configuration file from

     vif = [ '<whatever>' ]
to
     vif2 = [ 'pdev=<netdev>' ]
Quoted 9 lines

where <netdev> is the interface name for your 82598 board, e.g peth0 in dom0.

The Netchannel2 code is VERY experimental at this stage and should not be used in production environments. This patch is intended to support further development and testing efforts.

Mitch,

It seems this last patch is not working properly
I get a kernel panic when the driver module loads (see panic message below).
Apparently the driver is trying to allocate guest memory (vmq_alloc_skb()) before the queue is allocated to a guest (there is no guest running when the ixgbe module is loaded). This is probably something easy to fix

I am able to use the previous version of the patch (version 1.3.31.3 attached) with no problem. Not sure what changed from version 1.3.31.3 to this new version 1.3.47. I am also attaching the buggy patch for version 1.3.47 that I am using so you can verify if I am using the right patch ...

Could you please take a look at this?

Thanks

Renato

=====================================

Unable to handle kernel paging request at 0000000000007800 RIP:
 [<ffffffff804600a4>] vmq_alloc_skb+0x64/0x1f0
PGD 79807067 PUD 79710067 PMD 0
Oops: 0000 [1] SMP
CPU 0
Modules linked in: video thermal fan button battery asus_acpi ac ixgbe
Pid: 0, comm: swapper Not tainted 2.6.18.8-xen0 #73
RIP: e030:[<ffffffff804600a4>]  [<ffffffff804600a4>] vmq_alloc_skb+0x64/0x1f0
RSP: e02b:ffffffff80793ca0  EFLAGS: 00010206
RAX: ffff88007acc5dd8 RBX: 0000000000000000 RCX: 0000000000080000
RDX: ffff88007b5d7740 RSI: 0000000000000001 RDI: ffff88007a450000
RBP: ffffffff80793cd0 R08: 0000000000000001 R09: ffff88007a450c80
R10: 000000000000003f R11: 000000000000012c R12: 0000000000007800
R13: 0000000000000000 R14: 0000000000000500 R15: 00000000000005f4
FS:  00002ba4a6b1eda0(0000) GS:ffffffff80737000(0000) knlGS:0000000000000000
CS:  e033 DS: 0000 ES: 0000
Process swapper (pid: 0, threadinfo ffffffff8074c000, task ffffffff8064d440)
Stack:  ffff88007a450000 ffffc200118f0000 0000000000000000 0000000000000000
 ffff88007b279070 ffff88007a450500 ffffffff80793d30 ffffffff88000d2f
 000003ff80793d50 ffff880075df0000 ffff88007a450000 ffff88007fe90800
Call Trace:
 <IRQ> [<ffffffff88000d2f>] :ixgbe:ixgbe_alloc_rx_buffers+0x15f/0x2e0
 [<ffffffff8800320b>] :ixgbe:ixgbe_clean_rx_irq+0x9eb/0xaa0
 [<ffffffff8800798e>] :ixgbe:ixgbe_clean_rxonly_many+0xbe/0x210
 [<ffffffff8800de3e>] :ixgbe:__kc_adapter_clean+0x2e/0x50
 [<ffffffff8052eba4>] net_rx_action+0xc4/0x1c0
 [<ffffffff80239eec>] __do_softirq+0x9c/0x140
 [<ffffffff8020b604>] call_softirq+0x1c/0x28
 [<ffffffff8020d7cc>] do_softirq+0x6c/0x100
 [<ffffffff80239d48>] irq_exit+0x48/0x50
 [<ffffffff80430b92>] evtchn_do_upcall+0x232/0x250
 [<ffffffff8020b13a>] do_hypervisor_callback+0x1e/0x2c
 <EOI> [<ffffffff802063aa>] hypercall_page+0x3aa/0x1000
 [<ffffffff802063aa>] hypercall_page+0x3aa/0x1000
 [<ffffffff8020eed2>] raw_safe_halt+0xc2/0xf0
 [<ffffffff80209b15>] xen_idle+0x75/0x90
 [<ffffffff8020926a>] cpu_idle+0xba/0xe0
 [<ffffffff802073b6>] rest_init+0x26/0x30
 [<ffffffff807568f5>] start_kernel+0x265/0x270
 [<ffffffff8075623d>] _sinittext+0x23d/0x250


Code: 4d 39 a6 00 73 00 00 4d 8d ae e8 72 00 00 0f 84 58 01 00 00
RIP  [<ffffffff804600a4>] vmq_alloc_skb+0x64/0x1f0
 RSP <ffffffff80793ca0>

CR2: 0000000000007800
<0>Kernel panic - not syncing: Aiee, killing interrupt handler! (XEN) Domain 0 crashed: 'noreboot' set - not rebooting.

Quoted 70 lines

-----Original Message-----
From: Williams, Mitch A [mailto:[email protected]]
Sent: Friday, January 16, 2009 3:57 PM
To: Williams, Mitch A; [email protected]
Cc: [email protected]; Ronciak, John; Santos, Jose Renato G
Subject: RE: [Xen-devel] RFC: Xen VMDq patch for ixgbe

Whoops! Attached the wrong patch file. Please use this one.

Sorry for the confusion.
-Mitch

Quoted 7 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Mitch Williams
Sent: Friday, January 16, 2009 3:06 PM
To: [email protected]
Cc: [email protected]; Ronciak, John;

[email protected]

Quoted 9 lines

Subject: [Xen-devel] RFC: Xen VMDq patch for ixgbe

Attached is a patch to enable Xen VMDq (AKA Netchannel2 vmq) for the ixgbe driver. This is intended for testing and development purposes and should not be considered to be production-quality code.

Please note that this does NOT apply to the Xen Linux kernel; it applies to the ixgbe 1.3.47 release, available from
http://sourceforge.net/projects/e1000/. You'll obviously

also need an

Quoted 4 lines

Intel 82598-based 10 Gigabit network card and some sort of link partner. This will build against the current Netchannel2 source available from http:xenbits.xen.org/ext/netchannel2. You'll need to enable "Net channel 2 support for multi-queue devices" in

your kernel

Quoted 8 lines

config.

To enable VMDq functionality, load the driver with the command-line parameter VMDQ=<num queues>, as in:

$ insmod ~/ixgbe-1.3.47/src/ixgbe.ko VMDQ=8

You can then set up PV domains to use the device by

modifying your VM

Quoted 5 lines

configuration file from

    vif = [ '<whatever>' ]
to
    vif2 = [ 'pdev=<netdev>' ]

where <netdev> is the interface name for your 82598 board,

e.g peth0 in

Quoted 6 lines

dom0.

Known issues (at least, known by me):
1) Must manually attach bridge device after starting domU vm. Netchannel2 backend devices show up as ethNN, not vifN.M, so the scripts don't automatically attach the interface. Once your

VM starts,

Quoted 1 line

do ifconfig -a to see which new interface got added. Then

use "brctl

Quoted 2 lines

addif" to add this new interface the the bridge.
2) No broadcast replication. This is a big one. Incoming

broadcasts

Quoted 1 line

will ONLY go to dom0. This means that your VMs can send ARP

requests

Quoted 6 lines

and initiate IP sessions to outside machines, but outside machines cannot initiate connections because the ARP requests don't go to the domU VMs.
3) No loopback. VMs cannot communicate with other VMs (including dom0) on the same machine.

Quoted 15 lines
Quoted 2 lines

Once I get this out, I'll start working on a proper backport of the driver into the Xen kernel (2.6.18.8) tree. I'll remove as

much of the

Quoted 2 lines

compatibility cruft as is prudent and properly integrate it into
the Kbuild stuff. When that's done, I'll send a complete

patchset to

Quoted 1 line

this list, including signed-off-by lines which can then be

checked in

Quoted 7 lines

to Mercurial.

Please review and comment, and if possible test.

Thanks,
Mitch

src/ixgbe.h +12 -0
diff -Naur ixgbe-1.3.31.3/src/ixgbe.h ixgbe-1.3.31.3-xen-vmq/src/ixgbe.h
@@ -31,6 +31,9 @@
 #include <linux/pci.h>
 #include <linux/netdevice.h>
 #include <linux/vmalloc.h>
+#ifdef CONFIG_XEN
+#include <linux/netvmq.h>
+#endif
 
 #ifdef SIOCETHTOOL
 #include <linux/ethtool.h>
@@ -167,6 +170,7 @@
 struct ixgbe_queue_stats {
 	u64 packets;
 	u64 bytes;
+	u64 mac;
 };
 
 struct ixgbe_ring {
@@ -208,6 +212,9 @@
 #endif
 	u16 work_limit;                /* max work per interrupt */
 	u16 rx_buf_len;
+	u8 mac_addr[ETH_ALEN];
+	u8 active;
+	u8 allocated;
 };
 
 #define RING_F_DCB  0
@@ -399,6 +406,11 @@
 	unsigned long state;
 	u32 *config_space;
 	u64 tx_busy;
+#ifdef CONFIG_XEN
+	struct net_vmq *vmq;
+	u32 n_rx_queues_allocated;
+	u32 n_tx_queues_allocated;
+#endif
 	unsigned int tx_ring_count;
 	unsigned int rx_ring_count;
 
src/ixgbe_main.c +350 -103

699 lines not on this page · raw message

src/ixgbe.h +10 -0
diff -urpN ixgbe-1.3.47/src/ixgbe.h ixgbe-1.3.47-vmq/src/ixgbe.h
@@ -35,6 +35,9 @@
 #include <linux/pci.h>
 #include <linux/netdevice.h>
 #include <linux/vmalloc.h>
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+#include <linux/netvmq.h>
+#endif
 
 #ifdef SIOCETHTOOL
 #include <linux/ethtool.h>
@@ -229,6 +232,9 @@ struct ixgbe_ring {
 #endif
 	u16 work_limit;                /* max work per interrupt */
 	u16 rx_buf_len;
+	u8 mac_addr[ETH_ALEN];
+	u8 active;
+	u8 allocated;
 };
 
 #define RING_F_DCB  0
@@ -427,6 +433,10 @@ struct ixgbe_adapter {
 	unsigned int lro_flushed;
 	unsigned int lro_no_desc;
 #endif
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+	struct net_vmq *vmq;
+	u32 rx_queues_allocated;
+#endif
 	unsigned int tx_ring_count;
 	unsigned int rx_ring_count;
 
src/ixgbe_main.c +315 -16

485 lines not on this page · raw message

src/ixgbe_param.c +7 -0
diff -urpN ixgbe-1.3.47/src/ixgbe_param.c ixgbe-1.3.47-vmq/src/ixgbe_param.c
@@ -723,6 +723,13 @@ void __devinit ixgbe_check_options(struc
 			adapter->flags |= IXGBE_FLAG_RX_PS_CAPABLE;
 		}
 #endif
+#ifdef CONFIG_XEN_NETDEV2_BACKEND
+	if (adapter->flags & 
+	    (IXGBE_FLAG_RX_PS_CAPABLE | IXGBE_FLAG_VMDQ_ENABLED)) {
+		printk(KERN_INFO "ixgbe: packet split disabled for Xen VMDQ\n");
+		adapter->flags &= ~IXGBE_FLAG_RX_PS_CAPABLE;
+	}
+#endif
 	}
 }
 

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

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

#2 lore raw

I have not seen this crash, and I am running the latest Netchannel2 code. Can you send me some more details? When do you see this crash? How many VMs do you have running, and with what options?

Thanks for catching the config option issue. I'll spin up a new patch and get it out to Steven.

-Mitch

Quoted 59 lines

-----Original Message-----
From: Santos, Jose Renato G [mailto:[email protected]]
Sent: Thursday, February 05, 2009 2:37 PM
To: Williams, Mitch A; [email protected]
Cc: [email protected]
Subject: RE: [Xen-devel] [PATCH] Add VMDq support to ixgbe

Mitch,

I finally found the time to test this.
I am still seeing the same kernel oops that was present on the previous patch when the ixgbe module was separated from the linux tree. Could you please download the code from the latest netchannel2 tree and try to reproduce the problem?
I have attached my old email which has the kernel oops message and includes an older version of the patch that works for me. You can compare that older version with the current code to find out what is the problem.

Also the right config option to enable VMDq should be CONFIG_XEN_NETDEV2_VMQ and not CONFIG_XEN_NETDEV2_BACKEND.

Thanks

Renato

Quoted 31 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Mitch Williams
Sent: Wednesday, January 28, 2009 4:43 PM
To: [email protected]
Subject: [Xen-devel] [PATCH] Add VMDq support to ixgbe

This patch adds experimental VMDq support (AKA Netchannel2 vmq) to the ixgbe driver. This applies to the Netchannel2 tree, and should NOT be applied to the "normal" development tree.

To enable VMDq functionality, load the driver with the command-line parameter VMDQ=<num queues>, as in:

$ modprobe ixgbe VMDQ=8

You can then set up PV domains to use the device by modifying your VM configuration file from

     vif = [ '<whatever>' ]
to
     vif2 = [ 'pdev=<netdev>' ]

where <netdev> is the interface name for your 82598 board, e.g peth0 in dom0.

The Netchannel2 code is VERY experimental at this stage and should not be used in production environments. This patch is intended to support further development and testing efforts.

#3 lore raw
Quoted 9 lines

-----Original Message-----
From: Williams, Mitch A [mailto:[email protected]]
Sent: Thursday, February 05, 2009 2:51 PM
To: Santos, Jose Renato G; [email protected]
Cc: [email protected]
Subject: RE: [Xen-devel] [PATCH] Add VMDq support to ixgbe

Quoted 3 lines

I have not seen this crash, and I am running the latest Netchannel2 code. Can you send me some more details? When do you see this crash?

When dom0 boots the interface is disabled
As soon as I bring the interface up (i.e. ifup eth2) the system crashes. NO guest is running. Just dom0

Here is the kenel panic output
I have also attached the output of "dmesg" and "xm dmesg" that is executed just after the system boots Could you please send me the same output for your system so I can take a look and see if I can spot anything?

Thanks

Renato

====================================================

 Unable to handle kernel paging request at 00000000000078c0 RIP: 
 [<ffffffff80471144>] vmq_alloc_skb+0x64/0x1f0
PGD 5e3e5067 PUD 5e3e4067 PMD 0 
Oops: 0000 [1] SMP 
CPU 0 
Modules linked in: video thermal fan button battery asus_acpi ac
Pid: 0, comm: swapper Not tainted 2.6.18.8-xen0 #1
RIP: e030:[<ffffffff80471144>]  [<ffffffff80471144>] vmq_alloc_skb+0x64/0x1f0
RSP: e02b:ffffffff807a7cb0  EFLAGS: 00010206
RAX: ffff88007ed1bd98 RBX: 0000000000000000 RCX: 0000000000080000
RDX: ffff88007edb10c0 RSI: 0000000000000001 RDI: ffff88007ee50000
RBP: ffffffff807a7ce0 R08: 0000000000000001 R09: ffff88007ee50c80
R10: 000000000000003f R11: 000000000000012c R12: 00000000000078c0
R13: 0000000000000000 R14: 0000000000000500 R15: 00000000000005f4
FS:  00002b9d6ed01da0(0000) GS:ffffffff8074c000(0000) knlGS:0000000000000000
CS:  e033 DS: 0000 ES: 0000
Process swapper (pid: 0, threadinfo ffffffff80760000, task ffffffff80660440)
Stack:  ffff88007ee50000 ffffc200118f7000 0000000000000000 0000000000000000
 ffff88007fef0070 ffff88007ee50500 ffffffff807a7d40 ffffffff803db482
 ffffffff807a7d20 000003ff00000001 ffff88005b788000 ffff88007fe90800
Call Trace:
 <IRQ> [<ffffffff803db482>] ixgbe_alloc_rx_buffers+0x152/0x2d0
 [<ffffffff803dd95b>] ixgbe_clean_rx_irq+0x9eb/0xaa0
 [<ffffffff8022c3dd>] default_wake_function+0xd/0x10
 [<ffffffff805b1161>] _spin_unlock_irqrestore+0x11/0x70
 [<ffffffff8022af2e>] __wake_up+0x4e/0x70
 [<ffffffff803e2262>] ixgbe_clean_rxonly_many+0xb2/0x210
 [<ffffffff803eab0e>] __kc_adapter_clean+0x2e/0x50
 [<ffffffff8053fc44>] net_rx_action+0xc4/0x1c0
 [<ffffffff80239eec>] __do_softirq+0x9c/0x140
 [<ffffffff8020b604>] call_softirq+0x1c/0x28
 [<ffffffff8020d7cc>] do_softirq+0x6c/0x100
 [<ffffffff80239d48>] irq_exit+0x48/0x50
 [<ffffffff80440d82>] evtchn_do_upcall+0x232/0x250
 [<ffffffff8020b13a>] do_hypervisor_callback+0x1e/0x2c
 <EOI> [<ffffffff802063aa>] hypercall_page+0x3aa/0x1000
 [<ffffffff802063aa>] hypercall_page+0x3aa/0x1000
 [<ffffffff8020eed2>] raw_safe_halt+0xc2/0xf0
 [<ffffffff80209b15>] xen_idle+0x75/0x90
 [<ffffffff8020926a>] cpu_idle+0xba/0xe0
 [<ffffffff802073b6>] rest_init+0x26/0x30
 [<ffffffff8076a8f5>] start_kernel+0x265/0x270
 [<ffffffff8076a23d>] _sinittext+0x23d/0x250


Code: 4d 39 a6 c0 73 00 00 4d 8d ae a8 73 00 00 0f 84 58 01 00 00 
RIP  [<ffffffff80471144>] vmq_alloc_skb+0x64/0x1f0
 RSP <ffffffff807a7cb0>

CR2: 00000000000078c0
<0>Kernel panic - not syncing: Aiee, killing interrupt handler! (XEN) Domain 0 crashed: 'noreboot' set - not rebooting.

Quoted 8 lines

How many VMs do you have running, and
with what options?

Thanks for catching the config option issue. I'll spin up a new patch and get it out to Steven.

-Mitch

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

#4 lore raw
Quoted 7 lines

Here is the kenel panic output
I have also attached the output of "dmesg" and "xm dmesg"
that is executed just after the system boots
Could you please send me the same output for your system so
I can take a look and see if I can spot anything?

I think I see what's going on -- it's definitely a logic bug. I've reproduced the crash here, and I'll try to get a fix out ASAP.

Looks like when I added vmq, I broke RSS, which is the default configuration.

Make sure you have "options ixgbe VMDQ=8" in /etc/modprobe.conf, then you should be OK.

-Mitch

#5 lore raw
Quoted 17 lines

-----Original Message-----
From: Williams, Mitch A [mailto:[email protected]]
Sent: Friday, February 06, 2009 2:30 PM
To: Santos, Jose Renato G; [email protected]
Cc: [email protected]
Subject: RE: [Xen-devel] [PATCH] Add VMDq support to ixgbe

Quoted 7 lines

Here is the kenel panic output
I have also attached the output of "dmesg" and "xm dmesg"
that is executed just after the system boots
Could you please send me the same output for your system so I can
take a look and see if I can spot anything?

Quoted 5 lines

I think I see what's going on -- it's definitely a logic bug.
I've reproduced the crash here, and I'll try to get a fix out ASAP.

Looks like when I added vmq, I broke RSS, which is the default configuration.

Thanks Mitch. I am not sure if you found where is the bug or if you are still trying to debug the code.
In a previous email, I have included a previous version of the code that works. That version is based on your original patch for an ealier version of the ixbge driver plus some fixes we did at HP Labs. We have been using that version without problems. If you compare that with your current code you should be able to locate the problem in the current code.
Thanks
Renato

Quoted 6 lines

Make sure you have "options ixgbe VMDQ=8" in
/etc/modprobe.conf, then you should be OK.

-Mitch

#6 lore raw
In reply to Williams, Mitch A
Quoted 16 lines

-----Original Message-----
From: Williams, Mitch A [mailto:[email protected]]
Sent: Friday, February 06, 2009 2:30 PM
To: Santos, Jose Renato G; [email protected]
Cc: [email protected]
Subject: RE: [Xen-devel] [PATCH] Add VMDq support to ixgbe

Quoted 7 lines

Here is the kenel panic output
I have also attached the output of "dmesg" and "xm dmesg"
that is executed just after the system boots
Could you please send me the same output for your system so I can
take a look and see if I can spot anything?

Quoted 9 lines

I think I see what's going on -- it's definitely a logic bug.
I've reproduced the crash here, and I'll try to get a fix out ASAP.

Looks like when I added vmq, I broke RSS, which is the default configuration.

Make sure you have "options ixgbe VMDQ=8" in
/etc/modprobe.conf, then you should be OK.

I think I am doing that already, except that the driver is built in the kernel and the option is passed as a boot parameter

If you look at the output of the dmesg that I sent in a previous email you can find the following lines relevant to ixbge:

ixgbe: Virtual Machine Device Queues (VMDQ) set to 8
ixgbe: packet split disabled for Xen VMDQ
ixgbe: 0000:13:00.0: ixgbe_init_interrupt_scheme: Multiqueue Enabled: Rx Queue count = 8, Tx Queue count = 8
ixgbe: eth2: ixgbe_probe: (PCI Express:2.5Gb/s:Width x8) 00:1b:21:04:c3:2d
ixgbe: eth2: ixgbe_probe: MAC: 1, PHY: 2
ixgbe: eth2: ixgbe_probe: Internal LRO is enabled
ixgbe: eth2: ixgbe_probe: Intel(R) 10 Gigabit Network Connection

As you see VMDQ is in fact being set to 8.
So I think the problem is somewhere else.
Please look at the older version of the code that I sent as I think we may have fixed this problem in the past. I am not sure if this problem was one of the problems we fixed but we know that the older version of the code works for us.

Thanks

Renato

Quoted 2 lines

-Mitch

#7 lore raw
In reply to Mitch Williams
Quoted 16 lines

Subject: [Xen-devel] [PATCH] Add VMDq support to ixgbe

This patch adds experimental VMDq support (AKA Netchannel2 vmq) to the ixgbe driver. This applies to the Netchannel2 tree, and should NOT be applied to the "normal" development tree.

To enable VMDq functionality, load the driver with the command-line parameter VMDQ=<num queues>, as in:

$ modprobe ixgbe VMDQ=8

You can then set up PV domains to use the device by modifying your VM configuration file from

     vif = [ '<whatever>' ]
to
     vif2 = [ 'pdev=<netdev>' ]
Quoted 6 lines

where <netdev> is the interface name for your 82598 board, e.g peth0 in dom0.

The Netchannel2 code is VERY experimental at this stage and should not be used in production environments. This patch is intended to support further development and testing efforts.

I have ported the netchannel2 frontend driver to run as PV-on-HVM network driver in an HVM guest. I am running only a single guest at the moment. I use a bridged setup, so the backend drivers plug into a bridge in dom0.

My guest needs multiple VIFs. This works fine as long as I never have multiple VIFs plugged into the same bridge. I have tried with multiple queues from different NIC ports, and with multiple queues from the same NIC port. As long as I have a separate bridge per VIF, then my guest networking is up and running nicely.

As soon as I have two or more VIFs plugged into the same bridge that connects to the physical network (using standard Xen setup scripts), then the system freezes if there is network traffic. It does not freeze on the first packet I believe, but very shortly after network communication takes place. I would attach logs but as the system freezes there are no error messages or anything that could indicate what the problem is. Is there a reason why netchannel2 VMDQ support does not work when multiple queues (or backend devices) share the same bridge?

Thanks,
Anna